Import/export gift badges, other fields

This commit is contained in:
Fedor Indutny
2024-06-12 13:36:02 -07:00
committed by GitHub
parent af1c593fef
commit e6b62001d3
10 changed files with 536 additions and 55 deletions

View File

@@ -397,6 +397,13 @@ export function toAccountRecord(
if (typeof subscriberCurrencyCode === 'string') {
accountRecord.subscriberCurrencyCode = subscriberCurrencyCode;
}
const donorSubscriptionManuallyCancelled = window.storage.get(
'donorSubscriptionManuallyCancelled'
);
if (typeof donorSubscriptionManuallyCancelled === 'boolean') {
accountRecord.donorSubscriptionManuallyCancelled =
donorSubscriptionManuallyCancelled;
}
const backupsSubscriberId = window.storage.get('backupsSubscriberId');
if (Bytes.isNotEmpty(backupsSubscriberId)) {
accountRecord.backupsSubscriberId = backupsSubscriberId;
@@ -407,6 +414,13 @@ export function toAccountRecord(
if (typeof backupsSubscriberCurrencyCode === 'string') {
accountRecord.backupsSubscriberCurrencyCode = backupsSubscriberCurrencyCode;
}
const backupsSubscriptionManuallyCancelled = window.storage.get(
'backupsSubscriptionManuallyCancelled'
);
if (typeof backupsSubscriptionManuallyCancelled === 'boolean') {
accountRecord.backupsSubscriptionManuallyCancelled =
backupsSubscriptionManuallyCancelled;
}
const displayBadgesOnProfile = window.storage.get('displayBadgesOnProfile');
if (displayBadgesOnProfile !== undefined) {
accountRecord.displayBadgesOnProfile = displayBadgesOnProfile;
@@ -436,6 +450,14 @@ export function toAccountRecord(
hasCompletedUsernameOnboarding;
}
const hasSeenGroupStoryEducationSheet = window.storage.get(
'hasSeenGroupStoryEducationSheet'
);
if (hasSeenGroupStoryEducationSheet !== undefined) {
accountRecord.hasSeenGroupStoryEducationSheet =
hasSeenGroupStoryEducationSheet;
}
const hasStoriesDisabled = window.storage.get('hasStoriesDisabled');
accountRecord.storiesDisabled = hasStoriesDisabled === true;
@@ -1235,11 +1257,14 @@ export async function mergeAccountRecord(
preferredReactionEmoji: rawPreferredReactionEmoji,
subscriberId,
subscriberCurrencyCode,
donorSubscriptionManuallyCancelled,
backupsSubscriberId,
backupsSubscriberCurrencyCode,
backupsSubscriptionManuallyCancelled,
displayBadgesOnProfile,
keepMutedChatsArchived,
hasCompletedUsernameOnboarding,
hasSeenGroupStoryEducationSheet,
hasSetMyStoriesPrivacy,
hasViewedOnboardingStory,
storiesDisabled,
@@ -1448,6 +1473,12 @@ export async function mergeAccountRecord(
if (typeof subscriberCurrencyCode === 'string') {
await window.storage.put('subscriberCurrencyCode', subscriberCurrencyCode);
}
if (donorSubscriptionManuallyCancelled != null) {
await window.storage.put(
'donorSubscriptionManuallyCancelled',
donorSubscriptionManuallyCancelled
);
}
if (Bytes.isNotEmpty(backupsSubscriberId)) {
await window.storage.put('backupsSubscriberId', backupsSubscriberId);
}
@@ -1457,6 +1488,12 @@ export async function mergeAccountRecord(
backupsSubscriberCurrencyCode
);
}
if (backupsSubscriptionManuallyCancelled != null) {
await window.storage.put(
'backupsSubscriptionManuallyCancelled',
backupsSubscriptionManuallyCancelled
);
}
await window.storage.put(
'displayBadgesOnProfile',
Boolean(displayBadgesOnProfile)
@@ -1490,6 +1527,15 @@ export async function mergeAccountRecord(
hasCompletedUsernameOnboardingBool
);
}
{
const hasCompletedUsernameOnboardingBool = Boolean(
hasSeenGroupStoryEducationSheet
);
await window.storage.put(
'hasSeenGroupStoryEducationSheet',
hasCompletedUsernameOnboardingBool
);
}
{
const hasStoriesDisabled = Boolean(storiesDisabled);
await window.storage.put('hasStoriesDisabled', hasStoriesDisabled);