Files
discord-decomp/sources/modules/changelog/ChangelogStore.tsx
T
2026-07-27 16:20:00 +03:00

203 lines
9.4 KiB
TypeScript

/* Metro module 4604; source: modules/changelog/ChangelogStore.tsx; dependencies: [6, 7, 15, 17, 18, 1949, 1348, 1933, 587, 3829, 566, 694, 2] */
function _fun39121(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#39121, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4782:6, offset: 0x010d8bc4, size: 478 bytes, params: 8, frame: 20
const env0_0 = require;
const handleUserSettingsProtoStoreChange = function() {
var LastReceivedChangelogId = require(dependencyMap[9]).LastReceivedChangelogId;
env0_16 = LastReceivedChangelogId.getSetting();
};
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
const env0_2 = importDefault(6) /* metro dependency 6 */;
const env0_3 = importDefault(7) /* metro dependency 7 */;
const env0_4 = importDefault(15) /* metro dependency 15 */;
const env0_5 = importDefault(17) /* metro dependency 17 */;
const env0_6 = importDefault(18) /* metro dependency 18 */;
const localeStore = importDefault(1949) /* metro dependency 1949: LocaleStore */;
const userSettingsProtoStore = importDefault(1348) /* metro dependency 1348: UserSettingsProtoStore */;
const changelogConstantsModule = require(1933) /* metro dependency 1933: ChangelogConstants */;
const env0_9 = changelogConstantsModule.AssetType;
const env0_10 = changelogConstantsModule.ChangelogLoadState;
const env0_11 = {};
const env0_12 = {};
const Set = global.Set;
let set = new Set();
const Store = (importDefault(566) /* metro dependency 566: flux */).Store;
_fun39126(Store).displayName = 'ChangelogStore';
set = new set(importDefault(694) /* metro dependency 694: Dispatcher */, {CHANGE_LOG_LOCK: CHANGE_LOG_LOCK,
CHANGE_LOG_UNLOCK: CHANGE_LOG_UNLOCK, CHANGE_LOG_SET_CONFIG: function(a0) {
var config = a0.config;
env0_13 = a0.latestChangelogId;
env0_15 = config;
}, CHANGE_LOG_FETCH_SUCCESS: CHANGE_LOG_FETCH_SUCCESS, CHANGE_LOG_FETCH_FAILED: CHANGE_LOG_FETCH_FAILED,
CHANGE_LOG_SET_OVERRIDE: function(a0) {
env0_14 = a0.id;
}, CHANGE_LOG_MARK_SEEN: function({changelogDate}) {
var Date = global.Date;
env0_17 = new Date(changelogDate);
var Storage = require(dependencyMap[8]).Storage;
Storage.set('lastChangeLogDate', changelogDate);
}});
(require(2) /* metro dependency 2 */).fileFinishedImporting('modules/changelog/ChangelogStore.tsx');
exports.default = set;
}
function _isNativeReflectConstruct_39122() { // fn#39122, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4782:215, offset: 0x010d8da2, size: 94 bytes, params: 1, frame: 18
var Boolean;
var prototype;
var valueOf;
var call;
var Reflect;
var construct;
var closure;
var value;
var error;
try {
Boolean = global.Boolean;
prototype = Boolean.prototype;
valueOf = prototype.valueOf;
call = valueOf.call;
Reflect = global.Reflect;
construct = Reflect.construct;
Boolean = global.Boolean;
closure = function() {
};
value = Reflect.apply(construct, Reflect, [Boolean, [], closure]);
value = Reflect.apply(call, valueOf, [value]);
var result = !value;
} catch (error) {
}
return (_isNativeReflectConstruct_39122_isNativeReflectConstruct = function() {
return !!result;
})();
}
function _fun39126(a0) { // fn#39126, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4782:588, offset: 0x010d8e2f, size: 302 bytes, params: 2, frame: 16
const closure = ChangelogStore;
env0_6(closure, a0);
return env0_3(closure, [{key: 'initialize', value: value_39128}, {key: 'getChangelog', value: value_39130},
{key: 'latestChangelogId', value: value_39131}, {key: 'getChangelogLoadStatus', value: value_39132},
{key: 'hasLoadedConfig', value: value_39133}, {key: 'getConfig', value: value_39134}, {key: 'overrideId',
value: value_39135}, {key: 'lastSeenChangelogId', value: value_39136}, {key: 'lastSeenChangelogDate',
value: value_39137}, {key: 'getStateForDebugging', value: value_39138}, {key: 'isLocked', value: value_39139}]);
}
function CHANGE_LOG_LOCK({key}) { // fn#39140, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4782:1905, offset: 0x010d90dc, size: 82 bytes, params: 2, frame: 13
let binding = env0_18;
if (binding.has(key)) {
return false;
}
const Set = global.Set;
binding = env0_18;
const value2 = Object.create(Set.prototype, {constructor: {value: Set}});
const set = new Set(binding);
(set instanceof Object ? set : value2).add(key);
}
function CHANGE_LOG_UNLOCK({key}) { // fn#39141, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4782:2005, offset: 0x010d912e, size: 82 bytes, params: 2, frame: 13
var Set;
var value2;
var set;
let binding = env0_18;
if (binding.has(key)) {
Set = global.Set;
binding = env0_18;
value2 = Object.create(Set.prototype, {constructor: {value: Set}});
set = new Set(binding);
(set instanceof Object ? set : value2).delete(key);
return undefined;
}
return false;
}
function CHANGE_LOG_FETCH_SUCCESS({id, changelog}) { // fn#39143, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4782:2203, offset: 0x010d919e, size: 199 bytes, params: 2, frame: 10
if (env0_11[id] == null) {
env0_11[id] = {};
}
let property = env0_11[id];
let locale = changelog.locale;
const asset_type = changelog.asset_type;
const YOUTUBE_VIDEO_ID = AssetType.YOUTUBE_VIDEO_ID;
property[locale] = {id: id, date: changelog.date, body: changelog.content, revision: 1, locale: changelog.locale,
[asset_type !== YOUTUBE_VIDEO_ID ? 'image' : 'youtube_video_id']: changelog.asset};
if (env0_12[id] == null) {
env0_12[id] = {};
}
property = env0_12[id];
locale = changelog.locale;
const LOADED_SUCCESS = ChangelogLoadState.LOADED_SUCCESS;
property[locale] = LOADED_SUCCESS;
}
function CHANGE_LOG_FETCH_FAILED({id, locale}) { // fn#39144, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4782:2501, offset: 0x010d9265, size: 99 bytes, params: 2, frame: 5
if (env0_11[id] == null) {
if (env0_12[id] == null) {
env0_12[id] = {};
}
env0_12[id][locale] = ChangelogLoadState.LOADED_FAILURE;
} else {
if (env0_11[id][locale] != null) {
return false;
}
if (env0_12[id] == null) {
env0_12[id] = {};
}
env0_12[id][locale] = ChangelogLoadState.LOADED_FAILURE;
}
}
function value_39128() { // fn#39128, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4782:888, offset: 0x010d8f5d, size: 207 bytes, params: 1, frame: 17
var Date;
var prototype;
var value3;
var date;
var value4;
var error;
this.waitFor(LocaleStore, UserSettingsProtoStore);
this.syncWith([LocaleStore], function() {
return true;
});
this.syncWith([UserSettingsProtoStore], handleUserSettingsProtoStoreChange);
const Storage = (require(587) /* metro dependency 587: Storage */).Storage;
const value2 = Storage.get('lastChangeLogDate');
if (value2 != null) {
try {
Date = global.Date;
prototype = Date.prototype;
value3 = Object.create(prototype, {constructor: {value: Date}});
date = new Date(value2);
value4 = date instanceof Object ? date : value3;
env1_17 = value4;
} catch (error) {
Storage.remove('lastChangeLogDate');
}
}
}
function value_39130(a0, a1) { // fn#39130, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4782:1121, offset: 0x010d902c, size: 46 bytes, params: 3, frame: 4
let value = environment.__proto__;
const property = env1_11[a0];
value = null;
const r1 = value == property ? undefined : property[a1];
return value != r1 ? r1 : value;
}
function value_39132(a0, a1) { // fn#39132, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4782:1285, offset: 0x010d905a, size: 48 bytes, params: 3, frame: 5
let r0 = env1_12[a0]?.[a1];
r0 = r0 ?? ChangelogLoadState.NOT_LOADED;
return r0;
}
function value_39133() { // fn#39133, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4782:1397, offset: 0x010d908a, size: 15 bytes, params: 1, frame: 2
return env1_15 != null;
}
function value_39138() { // fn#39138, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4782:1662, offset: 0x010d9099, size: 47 bytes, params: 1, frame: 3
return {changelogConfig: env1_15, loadedChangelogs: env1_12, lastSeenChangelogId: env1_16,
lastSeenChangelogDate: env1_17};
}
function value_39139() { // fn#39139, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4782:1788, offset: 0x010d90c8, size: 20 bytes, params: 1, frame: 2
return env1_18.size > 0;
}