This commit is contained in:
janisslsm committed 2026-11-01 12:12:55 +02:00
1 parent 1781d25a15
commit 732c0ad767
33051 files changed
+2591613 -3019689

No files matched your search

+32
View File
@@ -0,0 +1,32 @@
// Metro module 1930 (f1931).
const r13 = {
DESKTOP: 0,
0: "DESKTOP",
MOBILE: 1,
1: "MOBILE"
};
const r16 = {
YOUTUBE_VIDEO_ID: 0,
0: "YOUTUBE_VIDEO_ID",
IMAGE: 1,
1: "IMAGE"
};
const r19 = {
NOT_LOADED: 0,
0: "NOT_LOADED",
LOADED_SUCCESS: 1,
1: "LOADED_SUCCESS",
LOADED_FAILURE: 2,
2: "LOADED_FAILURE"
};
const r24 = {
SPECIAL: "special",
STANDARD: "standard"
};
export const CHANGELOG_MODAL_KEY = "CHANGELOG_MODAL";
export const SYSTEM_UPDATES_USER_ID = "1232523165893132288";
export const CHANGELOG_URL = "https://discord.com/category/product";
export { r13 as ChangelogPlatforms };
export { r16 as AssetType };
export { r19 as ChangelogLoadState };
export { r24 as ChangeLogTemplate };
+175
View File
@@ -0,0 +1,175 @@
// Metro module 16144 (f16145).
import _slicedToArray from "../../_bundle/_slicedToArray";
import LocaleStore from "../user_settings/LocaleStore";
import ChangelogStore from "./ChangelogStore";
import AutomaticLifecycleManager from "../../lib/AutomaticLifecycleManager";
import ChangeLogActionCreators from "../../actions/ChangeLogActionCreators";
import { getClientVersionForChangelog } from "./getClientVersionForChangelog.native";
import Dispatcher from "../../Dispatcher";
import SnowflakeUtils from "../../utils/SnowflakeUtils";
import { openChangelog } from "./openChangelog.native";
function $mk118523($env) {
return function getLatestChangelogIdForVersion(a0, a1) {
let r8 = 0;
let r0 = null;
for (const item of Object.entries(a0)) {
const r33 = (0, _slicedToArray)(item, 2);
const r34 = r33[0];
const min_version = r33[1].min_version;
if (min_version <= a1 && min_version > r8) {
r8 = min_version;
r0 = r34;
}
}
return r0;
};
}
let c11565_7;
let env11565 = {};
class ChangelogManager extends AutomaticLifecycleManager {
constructor() {
let c22821_0;
super(...arguments);
const _this = this;
this.actions = {
POST_CONNECTION_OPEN: (a0) => _this.handleConnectionOpen(a0)
};
c22821_0 = void 0;
c22821_0 = async () => {
let c30965_0, c30965_1, c30965_2;
let c30965_3 = 0;
const r14 = void 0;
const r13 = env11565;
L33: {
L32: {
L31: {
L30: {
L29: {
L28: {
L16: {
try {
let env31789;
c30965_1 = r14;
const r33 = env31789 = {
$parent: r13
};
c30965_0 = r33;
env31789[0] = void 0;
env31789[1] = void 0;
env31789[2] = void 0;
env31789[3] = void 0;
env31789[4] = void 0;
env31789[5] = void 0;
c30965_3 = 1;
env31789[0] = await ChangeLogActionCreators.fetchChangelogConfig();
env31789[1] = env31789[0].body;
const r20 = env31789[1];
const clientVersionForChangelog = getClientVersionForChangelog();
env31789[2] = $mk118523(env11565)(r20, clientVersionForChangelog);
Dispatcher.dispatch({
type: "CHANGE_LOG_SET_CONFIG",
config: env31789[0].body,
latestChangelogId: env31789[2]
});
if (env31789[2] == null) {
c30965_3 = 0;
Dispatcher.dispatch({
type: "CHANGE_LOG_RESOLVED"
});
break L33;
}
if (env31789[1][env31789[2]].show_on_startup !== true) {
c30965_3 = 0;
Dispatcher.dispatch({
type: "CHANGE_LOG_RESOLVED"
});
break L32;
}
env31789[3] = ChangelogStore.lastSeenChangelogId();
env31789[4] = ChangelogStore.lastSeenChangelogDate();
if (env31789[3] != null) {
if (SnowflakeUtils.compare(env31789[2], env31789[3]) <= 0) {
c30965_3 = 0;
Dispatcher.dispatch({
type: "CHANGE_LOG_RESOLVED"
});
break L16;
}
}
env31789[5] = await ChangeLogActionCreators.fetchChangelog(env31789[2], LocaleStore.locale);
if (env31789[5] == null) {
c30965_3 = 0;
Dispatcher.dispatch({
type: "CHANGE_LOG_RESOLVED"
});
break L31;
}
if (env31789[4] != null && ChangelogStore.lastSeenChangelogDate() != null) {
if (ChangelogStore.isLocked()) {
c30965_3 = 0;
Dispatcher.dispatch({
type: "CHANGE_LOG_RESOLVED"
});
break L29;
}
if (new Date(env31789[5].date) > new Date(env31789[4])) {
openChangelog();
}
c30965_3 = 0;
Dispatcher.dispatch({
type: "CHANGE_LOG_RESOLVED"
});
break L28;
}
ChangeLogActionCreators.markChangelogAsSeen(env31789[2], env31789[5].date);
c30965_3 = 0;
Dispatcher.dispatch({
type: "CHANGE_LOG_RESOLVED"
});
break L30;
} catch ($e) {
const r31 = $e;
let r7 = r31;
c30965_2 = r31;
if (c30965_3 !== 0) {
while (true) {
try {
const r261 = c30965_2;
c30965_3 = 0;
Dispatcher.dispatch({
type: "CHANGE_LOG_RESOLVED"
});
throw r261;
} catch (r258) {
r7 = r258;
c30965_2 = r258;
if (c30965_3 === 0) {
break;
}
}
}
}
throw r7;
}
}
return void 0;
}
return void 0;
}
return void 0;
}
return void 0;
}
return void 0;
}
return void 0;
}
};
this.handleConnectionOpen = function() {
return c22821_0.apply(this, arguments);
};
}
}
c11565_7 = ChangelogManager;
const r27 = new ChangelogManager();
export default r27;
+143
View File
@@ -0,0 +1,143 @@
// Metro module 4200 (f4201).
import LocaleStore from "../user_settings/LocaleStore";
import UserSettingsProtoStore from "../user_settings/UserSettingsProtoStore";
import { AssetType, ChangelogLoadState } from "./ChangelogConstants";
import { Storage } from "../../_bundle/Module595";
import { LastReceivedChangelogId } from "../user_settings/UserSettings";
import Module589 from "../../_bundle/Module589";
import Dispatcher from "../../Dispatcher";
let c2420_6, loadedChangelogs, latestChangelogId2, id, config, c2420_11, setting, lastSeenChangelogDate2, c2420_14;
const handleUserSettingsProtoStoreChange = function handleUserSettingsProtoStoreChange() {
setting = LastReceivedChangelogId.getSetting();
};
c2420_6 = {};
loadedChangelogs = {};
latestChangelogId2 = null;
id = null;
config = null;
c2420_11 = "lastChangeLogDate";
setting = null;
lastSeenChangelogDate2 = null;
c2420_14 = new Set();
class ChangelogStore extends Module589.Store {
static displayName = "ChangelogStore";
initialize() {
this.waitFor(LocaleStore, UserSettingsProtoStore);
this.syncWith([LocaleStore], () => true);
this.syncWith([UserSettingsProtoStore], handleUserSettingsProtoStoreChange);
const r7 = Storage.get(c2420_11);
if (r7 != null) {
try {
lastSeenChangelogDate2 = new Date(r7);
} catch ($e) {
Storage.remove(c2420_11);
}
}
}
getChangelog(a0, a1) {
const r4 = c2420_6[a0];
let r6 = r4 == null ? void 0 : r4[a1];
if (r6 == null) {
r6 = null;
}
return r6;
}
latestChangelogId() {
return latestChangelogId2;
}
getChangelogLoadStatus(a0, a1) {
const r5 = loadedChangelogs[a0];
let r6 = r5 == null ? void 0 : r5[a1];
if (r6 == null) {
r6 = ChangelogLoadState.NOT_LOADED;
}
return r6;
}
hasLoadedConfig() {
return config != null;
}
getConfig() {
return config;
}
overrideId() {
return id;
}
lastSeenChangelogId() {
return setting;
}
lastSeenChangelogDate() {
return lastSeenChangelogDate2;
}
getStateForDebugging() {
return {
changelogConfig: config,
loadedChangelogs,
lastSeenChangelogId: setting,
lastSeenChangelogDate: lastSeenChangelogDate2
};
}
isLocked() {
return c2420_14.size > 0;
}
}
const changelogStore = new ChangelogStore(Dispatcher, {
CHANGE_LOG_LOCK: function handleChangeLogLock({ key }) {
if (c2420_14.has(key)) {
return false;
}
const set = new Set(c2420_14);
c2420_14 = set;
set.add(key);
},
CHANGE_LOG_UNLOCK: function handleChangeLogUnlock({ key }) {
if (c2420_14.has(key)) {
const set = new Set(c2420_14);
c2420_14 = set;
set.delete(key);
return void 0;
}
return false;
},
CHANGE_LOG_SET_CONFIG: function handleConfig(a0) {
const config2 = a0.config;
latestChangelogId2 = a0.latestChangelogId;
config = config2;
},
CHANGE_LOG_FETCH_SUCCESS: function handleChangelogFetch({ id: id2, changelog }) {
if (c2420_6[id2] == null) {
c2420_6[id2] = {};
}
const r6 = c2420_6[id2];
const locale = changelog.locale;
const r13 = {
id: id2,
date: changelog.date,
body: changelog.content,
revision: 1,
locale: changelog.locale
};
r13[changelog.asset_type === AssetType.YOUTUBE_VIDEO_ID ? "youtube_video_id" : "image"] = changelog.asset;
r6[locale] = r13;
if (loadedChangelogs[id2] == null) {
loadedChangelogs[id2] = {};
}
loadedChangelogs[id2][changelog.locale] = ChangelogLoadState.LOADED_SUCCESS;
},
CHANGE_LOG_FETCH_FAILED: function handleChangelogFetchFailed({ id: id2, locale }) {
if (c2420_6[id2] != null && c2420_6[id2][locale] != null) {
return false;
}
if (loadedChangelogs[id2] == null) {
loadedChangelogs[id2] = {};
}
loadedChangelogs[id2][locale] = ChangelogLoadState.LOADED_FAILURE;
},
CHANGE_LOG_SET_OVERRIDE: function handleChangelogSetOverride(a0) {
id = a0.id;
},
CHANGE_LOG_MARK_SEEN: function handleDismiss({ changelogDate }) {
lastSeenChangelogDate2 = new Date(changelogDate);
Storage.set(c2420_11, changelogDate);
}
});
export default changelogStore;
@@ -0,0 +1,5 @@
// Metro module 16145 (f16146).
import { getAppMajorVersion } from "../../utils/native/AppInfoUtils";
export function getClientVersionForChangelog() {
return getAppMajorVersion();
}
@@ -0,0 +1,9 @@
// Metro module 16147 (f16148).
import { CHANGELOG_MODAL_KEY } from "./ChangelogConstants";
import { isModalOpen } from "../main_tabs_v2/helpers/NavigationRouteUtils.native";
import ModalActionCreators from "../../actions/ModalActionCreators";
export function openChangelog(r4 = false) {
if (!(r4 ? !r4 : isModalOpen())) {
ModalActionCreators.pushLazy(import("../../components_native/ChangeLogModal"), {}, CHANGELOG_MODAL_KEY);
}
}
@@ -0,0 +1,6 @@
// Metro module 11525 (f11526).
import MessageStore from "../../stores/MessageStore";
import { useStateFromStores } from "../../_bundle/Module589";
export default function useChangelogIdFromChannel(c18933_0) {
return useStateFromStores([MessageStore], () => MessageStore.getLastMessage(c18933_0))?.changelogId;
};
@@ -0,0 +1,61 @@
// Metro module 11524 (f11525).
import { useRef, useEffect } from "react";
import LocaleStore from "../user_settings/LocaleStore";
import ReadStateStore from "../../stores/ReadStateStore";
import ChangelogStore from "./ChangelogStore";
import { AnalyticEvents } from "../../Constants";
import useChangelogIdFromChannel from "./useChangelogIdFromChannel";
import { useStateFromStores } from "../../_bundle/Module589";
import isChangelogChannel from "./utils/isChangelogChannel";
import ChangeLogActionCreators from "../../actions/ChangeLogActionCreators";
import AnalyticsUtils from "../../utils/AnalyticsUtils";
export default function useChangelogRenderedAnalytics(a0) {
let stateFromStores2, c18932_4, ref, stateFromStores3, ref2;
const changelogIdFromChannel = useChangelogIdFromChannel(a0);
let c18932_1 = changelogIdFromChannel;
const stateFromStores = useStateFromStores([LocaleStore], () => LocaleStore.locale);
stateFromStores2 = useStateFromStores([ChangelogStore], () => {
let r5 = c18932_1;
if (r5 == null) {
r5 = "";
}
return ChangelogStore.getChangelog(r5, stateFromStores);
}, [changelogIdFromChannel, stateFromStores]);
const isChangelogChannel2 = isChangelogChannel(a0);
c18932_4 = isChangelogChannel2;
ref = useRef(isChangelogChannel2 ? Date.now() : null);
stateFromStores3 = useStateFromStores([ReadStateStore], () => ReadStateStore.getUnreadCount(a0), [a0]);
ref2 = useRef(stateFromStores3);
useEffect(() => {
ref2.current = stateFromStores3;
});
useEffect(() => {
ref.current = Date.now();
}, [isChangelogChannel2]);
useEffect(() => {
if (c18932_4 && c18932_1 != null) {
ChangeLogActionCreators.fetchChangelog(c18932_1, stateFromStores, true);
}
}, [changelogIdFromChannel, stateFromStores, isChangelogChannel2]);
useEffect(() => {
if (c18932_4 && stateFromStores2 != null) {
AnalyticsUtils.track(AnalyticEvents.CHANGE_LOG_OPENED, {
change_log_id: `${stateFromStores2.date}:${stateFromStores2.revision}`,
unread_count: ref2.current
});
}
}, [isChangelogChannel2, stateFromStores2]);
useEffect(() => {
const current = ref.current;
return () => {
if (c18932_4 && stateFromStores2 != null && current != null) {
AnalyticsUtils.track(AnalyticEvents.CHANGE_LOG_CLOSED, {
seconds_open: Math.round((Date.now() - current) / 1000),
change_log_id: `${stateFromStores2.date}:${stateFromStores2.revision}`,
unread_count: ref2.current
});
ref.current = 0;
}
};
}, [isChangelogChannel2, stateFromStores2]);
};
+94
View File
@@ -0,0 +1,94 @@
// Metro module 7866 (f7867).
import { useEffect } from "react";
import LocaleStore from "../user_settings/LocaleStore";
import ChangelogStore from "./ChangelogStore";
import { ChangelogLoadState } from "./ChangelogConstants";
import { useStateFromStoresObject, useStateFromStores } from "../../_bundle/defaultAreStatesEqual";
import ChangeLogActionCreators from "../../actions/ChangeLogActionCreators";
const useChangelog = function useChangelog(a0, stateFromStores) {
let r30;
let c16054_0, c16054_1, changelog, loadState;
L7: {
c16054_0 = a0;
c16054_1 = stateFromStores;
const stateFromStoresObject = useStateFromStoresObject([ChangelogStore], () => {
const changelog2 = c16054_0 != null ? ChangelogStore.getChangelog(c16054_0, c16054_1) : null;
const defaultChangelog = c16054_0 != null ? ChangelogStore.getChangelog(c16054_0, "en-US") : null;
const defaultLoadState = c16054_0 != null && ChangelogStore.getChangelogLoadStatus(c16054_0, "en-US");
return {
changelog: changelog2,
loadState: c16054_0 != null && ChangelogStore.getChangelogLoadStatus(c16054_0, c16054_1),
defaultChangelog,
defaultLoadState
};
}, [a0, stateFromStores]);
changelog = stateFromStoresObject.changelog;
loadState = stateFromStoresObject.loadState;
const { defaultChangelog, defaultLoadState } = stateFromStoresObject;
useEffect(() => {
if (c16054_0 != null && changelog == null && loadState === ChangelogLoadState.NOT_LOADED) {
ChangeLogActionCreators.fetchChangelog(c16054_0, c16054_1);
}
}, [a0, changelog, loadState, stateFromStores]);
if (a0 == null) {
r30 = {
id: a0,
changelog: null,
loaded: false
};
} else {
if (changelog == null && loadState === ChangelogLoadState.LOADED_FAILURE) {
r30 = {
id: a0,
changelog: defaultChangelog,
loaded: defaultLoadState !== ChangelogLoadState.NOT_LOADED
};
break L7;
}
r30 = {
id: a0,
changelog,
loaded: loadState !== ChangelogLoadState.NOT_LOADED
};
}
}
return r30;
};
export { useChangelog };
export function useCurrentChangelog() {
let r53, changelog3, loaded;
const stateFromStores = useStateFromStores([LocaleStore], () => LocaleStore.locale);
const stateFromStores2 = useStateFromStores([ChangelogStore], () => ChangelogStore.latestChangelogId());
const stateFromStores3 = useStateFromStores([ChangelogStore], () => ChangelogStore.getConfig());
const r2 = stateFromStores3 != null && Object.keys(stateFromStores3).length === 0;
const clientTooOld = stateFromStores3 != null && Object.keys(stateFromStores3).length > 0 && stateFromStores2 == null;
L13: {
L10: {
const stateFromStores4 = useStateFromStores([ChangelogStore], () => ChangelogStore.overrideId());
const changelog2 = useChangelog(stateFromStores2, stateFromStores);
changelog3 = changelog2.changelog;
loaded = changelog2.loaded;
const changelog4 = useChangelog(stateFromStores4, stateFromStores);
const { changelog: changelog5, loaded: loaded2 } = changelog4;
if (stateFromStores4 != null) {
if (changelog5 == null && loaded2) {
break L10;
}
r53 = {
id: stateFromStores4,
changelog: changelog5,
loaded: loaded2,
clientTooOld: false
};
break L13;
}
}
r53 = {
id: stateFromStores2,
changelog: changelog3,
loaded: !!r2 || loaded,
clientTooOld
};
}
return r53;
}
@@ -0,0 +1,6 @@
// Metro module 8204 (f8205).
import ChannelStore from "../../../stores/ChannelStore";
import { SYSTEM_UPDATES_USER_ID } from "../ChangelogConstants";
export default function isChangelogChannel(a0) {
return a0 != null && a0 === ChannelStore.getDMFromUserId(SYSTEM_UPDATES_USER_ID);
};
@@ -0,0 +1,5 @@
// Metro module 1929 (f1930).
import { SYSTEM_UPDATES_USER_ID } from "../ChangelogConstants";
export default function isChangelogUser(a0) {
return a0 != null && a0 === SYSTEM_UPDATES_USER_ID;
};