decord/source/modules/user_settings/SelectivelySyncedUserSettingsStore.tsx

163 lines
4.9 KiB
TypeScript
Raw Normal View History

2026-07-29 08:29:29 +00:00
// Module ID: 1303
// Function ID: 1304
// Name: initialize
// Dependencies: [676, 589, 595, 12, 709, 2]
2026-07-20 16:05:17 +00:00
2026-07-29 08:29:29 +00:00
// Module 1303 (initialize)
2026-08-24 06:08:38 +00:00
import set from "set" /* 2 */;
import applyDefault from "apply" /* 12 */;
import initializeDefault from "initialize" /* 589 */;
import Storage4 from "Storage" /* 595 */;
import ME from "ME" /* 676 */;
import dispatcherDefault from "dispatcher" /* 709 */;
2026-07-23 10:11:24 +00:00
2026-08-24 06:08:38 +00:00
const UserSettingsSections = ME.UserSettingsSections;
2026-07-29 08:29:29 +00:00
let closure_4 = {};
2026-08-24 06:08:38 +00:00
const PersistedStore = initializeDefault.PersistedStore;
2026-07-29 08:29:29 +00:00
class SelectivelySyncedUserSettingsStore extends PersistedStore {
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
const prototype = SelectivelySyncedUserSettingsStore.prototype;
prototype["initialize"] = function initialize(arg0) {
let obj = arg0;
if (arg0 == null) {
obj = {};
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
};
prototype["getState"] = function getState() {
return closure_4;
};
prototype["shouldSync"] = function shouldSync(appearance) {
let shouldSync;
if (closure_4[appearance] != null) {
shouldSync = tmp.shouldSync;
}
return false !== shouldSync;
};
prototype["getTextSettings"] = function getTextSettings() {
const text = closure_4.text;
let settings;
if (text != null) {
settings = text.settings;
}
return settings;
};
prototype["getAppearanceSettings"] = function getAppearanceSettings() {
const appearance = closure_4.appearance;
let settings;
if (appearance != null) {
settings = appearance.settings;
}
return settings;
};
SelectivelySyncedUserSettingsStore.displayName = "SelectivelySyncedUserSettingsStore";
SelectivelySyncedUserSettingsStore.persistKey = "SelectivelySyncedUserSettingsStore";
const items = [
2026-07-20 16:05:17 +00:00
() => {
2026-08-24 06:08:38 +00:00
const Storage = Storage4.Storage;
2026-07-20 16:05:17 +00:00
let obj = Storage.get("UserSettingsSync");
2026-07-29 08:29:29 +00:00
if (obj == null) {
2026-07-20 16:05:17 +00:00
obj = {};
}
2026-07-29 08:29:29 +00:00
const Storage2 = tmp(595).Storage;
2026-07-20 16:05:17 +00:00
let value = Storage2.get("UserSettingsStore");
2026-07-29 08:29:29 +00:00
if (value == null) {
2026-07-20 16:05:17 +00:00
value = {};
}
2026-07-29 08:29:29 +00:00
const Storage3 = tmp(595).Storage;
2026-07-20 16:05:17 +00:00
Storage3.remove("UserSettingsSync");
obj = {};
2026-07-23 10:11:24 +00:00
if (false === obj[UserSettingsSections.TEXT]) {
2026-08-24 06:08:38 +00:00
obj1 = { shouldSync: false, settings: null };
obj1[1] = applyDefault.pick(value, ["inlineAttachmentMedia", "inlineEmbedMedia", "renderEmbeds", "renderReactions", "animateEmoji", "animateStickers", "gifAutoPlay", "defaultReactionEmoji"]);
2026-07-20 16:05:17 +00:00
obj.text = obj1;
2026-08-24 06:08:38 +00:00
const obj5 = applyDefault;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
if (false === obj[tmp4.APPEARANCE]) {
const obj2 = { shouldSync: false, settings: null };
2026-08-24 06:08:38 +00:00
obj2[1] = applyDefault.pick(value, ["theme", "clientThemeSettings", "developerMode"]);
2026-07-20 16:05:17 +00:00
obj.appearance = obj2;
2026-08-24 06:08:38 +00:00
const obj7 = applyDefault;
2026-07-20 16:05:17 +00:00
}
return obj;
},
(appearance) => {
let theme;
2026-07-29 08:29:29 +00:00
if (appearance != null) {
2026-07-20 16:05:17 +00:00
appearance = appearance.appearance;
2026-07-29 08:29:29 +00:00
if (appearance != null) {
2026-07-20 16:05:17 +00:00
const settings = appearance.settings;
2026-07-29 08:29:29 +00:00
if (settings != null) {
2026-07-20 16:05:17 +00:00
theme = settings.theme;
}
}
}
if ("amoled" === theme) {
let obj = {};
const merged = Object.assign(appearance);
obj = {};
const merged1 = Object.assign(appearance.appearance);
obj = {};
const merged2 = Object.assign(appearance.appearance.settings);
2026-07-29 08:29:29 +00:00
obj.theme = "midnight";
obj.settings = obj;
obj.appearance = obj;
2026-07-20 16:05:17 +00:00
return obj;
}
}
];
2026-07-29 08:29:29 +00:00
SelectivelySyncedUserSettingsStore.migrations = items;
2026-08-24 06:08:38 +00:00
const selectivelySyncedUserSettingsStore = new SelectivelySyncedUserSettingsStore(dispatcherDefault, {
2026-07-20 16:05:17 +00:00
SELECTIVELY_SYNCED_USER_SETTINGS_UPDATE: function handleSelectivelySyncedUserSettingsUpdate(changes) {
changes = changes.changes;
2026-07-29 08:29:29 +00:00
for (const key10008 in changes) {
let tmp12 = key10008;
({ shouldSync, settings } = changes[key10008]);
2026-07-20 16:05:17 +00:00
if (true !== shouldSync) {
if (false === shouldSync) {
2026-07-29 08:29:29 +00:00
let tmp5 = closure_4;
let obj = { shouldSync: null, settings: null };
obj[0] = shouldSync;
obj[1] = {};
closure_4[key10008] = obj;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
let tmp6 = closure_4;
let tmp7 = closure_4[key10008];
2026-07-20 16:05:17 +00:00
shouldSync = undefined;
2026-07-29 08:29:29 +00:00
if (tmp7 != null) {
shouldSync = tmp7.shouldSync;
2026-07-20 16:05:17 +00:00
}
if (false !== shouldSync) {
continue;
} else {
2026-07-23 10:11:24 +00:00
let tmp9 = settings;
2026-07-20 16:05:17 +00:00
let keys = Object.keys();
if (keys === undefined) {
continue;
} else {
2026-07-29 08:29:29 +00:00
let tmp11 = keys[tmp];
while (tmp11 !== undefined) {
let tmp13 = tmp11;
let tmp14 = closure_4;
closure_4[key10008].settings[tmp11] = settings[tmp11];
2026-07-23 10:11:24 +00:00
continue;
2026-07-20 16:05:17 +00:00
}
}
continue;
}
continue;
} else {
2026-07-29 08:29:29 +00:00
let tmp4 = closure_4;
delete tmp2[tmp3];
2026-07-23 10:11:24 +00:00
continue;
2026-07-20 16:05:17 +00:00
}
continue;
}
},
LOGOUT: function handleLogOut() {
2026-08-24 06:08:38 +00:00
closure_4 = {};
2026-07-20 16:05:17 +00:00
}
});
2026-08-24 06:08:38 +00:00
const result = set.fileFinishedImporting("modules/user_settings/SelectivelySyncedUserSettingsStore.tsx");
2026-07-20 16:05:17 +00:00
2026-07-29 08:29:29 +00:00
export default selectivelySyncedUserSettingsStore;