Files
discord-decomp/sources/modules/changelog/useCurrentChangelog.tsx
T
2026-07-28 01:06:53 +03:00

88 lines
5.8 KiB
TypeScript

/* Metro module 8337; source: modules/changelog/useCurrentChangelog.tsx; dependencies: [31, 1949, 4604, 1933, 632, 8338, 2] */
import LocaleStore from '../user_settings/LocaleStore.tsx'; /* Metro dependency 1949 */
import ChangelogStore from './ChangelogStore.tsx'; /* Metro dependency 4604 */
import * as FileImportTrackerModule from '../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
import * as ReactModule from '../../by-id/module-00031-React.js'; /* Metro dependency 31 */
import * as UseStateFromStoresModule from '../../external/discord_common/js/packages/flux/useStateFromStores.tsx'; /* Metro dependency 632 */
import * as ChangelogConstantsModule from './ChangelogConstants.tsx'; /* Metro dependency 1933 */
function _fun66379(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#66379, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8522:6, offset: 0x01bf960c, size: 192 bytes, params: 8, frame: 20
const env0_0 = require;
const useChangelog2 = useChangelog;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
(FileImportTrackerModule).fileFinishedImporting('modules/changelog/useCurrentChangelog.tsx');
exports.useChangelog = useChangelog2;
exports.useCurrentChangelog = useCurrentChangelog;
function useChangelog(a0, a1) { // fn#66380, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8522:155, offset: 0x01bf96cc, size: 275 bytes, params: 3, frame: 22
const env0_0 = a0;
const env0_1 = a1;
const value2 = (UseStateFromStoresModule).useStateFromStoresObject([ChangelogStore],
_fun66381, [a0, a1]);
const changelog = value2.changelog;
const loadState = value2.loadState;
const loadState2 = loadState;
const defaultChangelog = value2.defaultChangelog;
const defaultLoadState = value2.defaultLoadState;
loadState2.useEffect(_fun66382, [a0, changelog, loadState, a1]);
return a0 == null ? {'id': null, 'changelog': null, 'loaded': false, id: a0} : changelog != null ? {id: a0,
changelog: changelog,
loaded: loadState !== ChangelogLoadState.NOT_LOADED} : loadState === ChangelogLoadState.LOADED_FAILURE ? {id: a0,
changelog: defaultChangelog, loaded: defaultLoadState !== ChangelogLoadState.NOT_LOADED} : {id: a0,
changelog: changelog, loaded: loadState !== ChangelogLoadState.NOT_LOADED};
function _fun66381() { // fn#66381, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8522:226, offset: 0x01bf97df, size: 185 bytes, params: 1, frame: 18
const value2 = null;
return {changelog: value2 != env0_0 ? ChangelogStore.getChangelog(env0_0, require) : value2,
loadState: value2 != env0_0 && ChangelogStore.getChangelogLoadStatus(env0_0, require),
defaultChangelog: value2 != env0_0 ? ChangelogStore.getChangelog(env0_0, 'en-US') : value2,
defaultLoadState: value2 != env0_0 && ChangelogStore.getChangelogLoadStatus(env0_0, 'en-US')};
}
function _fun66382() { // fn#66382, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8522:564, offset: 0x01bf9898, size: 100 bytes, params: 1, frame: 13
var value6;
var defaultImport;
if (env0_0 != null && changelog == null && loadState === ChangelogLoadState.NOT_LOADED) {
value6 = environment.__proto__;
defaultImport = importDefault(8338) /* metro dependency 8338: ChangeLogActionCreators */;
defaultImport.fetchChangelog(env0_0, require);
}
}
}
function useCurrentChangelog() { // fn#66383, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:8522:927, offset: 0x01bf98fc, size: 377 bytes, params: 1, frame: 21
const locale = (require(632) /* metro dependency 632: useStateFromStores */).useStateFromStores([LocaleStore],
function() {
return LocaleStore.locale;
});
const value2 = (require(632) /* metro dependency 632: useStateFromStores */).useStateFromStores([ChangelogStore],
function() {
return ChangelogStore.latestChangelogId();
});
const config = (require(632) /* metro dependency 632: useStateFromStores */).useStateFromStores([ChangelogStore],
function() {
return ChangelogStore.getConfig();
});
const r5 = config != null && global.Object.keys(config).length === 0;
const r2 = config != null && global.Object.keys(config).length > 0 && value2 == null;
const value8 = (require(632) /* metro dependency 632: useStateFromStores */).useStateFromStores([ChangelogStore],
function() {
return ChangelogStore.overrideId();
});
let value = useChangelog(value2, locale);
const changelog = value.changelog;
const loaded = value.loaded;
value = useChangelog(value8, locale);
const changelog2 = value.changelog;
const loaded2 = value.loaded;
return value8 == null ? {id: value2, changelog: changelog, loaded: r5 ? !!r5 : loaded,
clientTooOld: r2} : changelog2 != null ? {id: value8, changelog: changelog2, loaded: loaded2,
clientTooOld: false} : loaded2 ? {id: value2, changelog: changelog, loaded: r5 ? !!r5 : loaded,
clientTooOld: r2} : {id: value8, changelog: changelog2, loaded: loaded2, clientTooOld: false};
}
}
global.__d(_fun66379, 8337, [31, 1949, 4604, 1933, 632, 8338,
2]) /* metro module 8337, dependencies: [31, 1949, 4604, 1933, 632, 8338, 2] */;