304 lines
15 KiB
TypeScript
304 lines
15 KiB
TypeScript
/* Metro module 3969; source: stores/SelectedGuildStore.tsx; dependencies: [6, 7, 15, 17, 18, 3970, 1226, 3973, 1867, 661, 1230, 3974, 3987, 566, 694, 2] */
|
|
import ClassCallCheck from '../by-id/module-00006-ClassCallCheck.js'; /* Metro dependency 6 */
|
|
import CreateClass from '../by-id/module-00007-CreateClass.js'; /* Metro dependency 7 */
|
|
import PossibleConstructorReturn from '../by-id/module-00015-PossibleConstructorReturn.js'; /* Metro dependency 15 */
|
|
import Module00017 from '../by-id/module-00017.js'; /* Metro dependency 17 */
|
|
import Inherits from '../by-id/module-00018-Inherits.js'; /* Metro dependency 18 */
|
|
import Flux from '../external/discord_common/js/packages/flux/index.tsx'; /* Metro dependency 566 */
|
|
import AuthenticationStore from './AuthenticationStore.tsx'; /* Metro dependency 1226 */
|
|
import GuildStore from './GuildStore.tsx'; /* Metro dependency 1867 */
|
|
import UserGuildJoinRequestStore from '../modules/guild_member_verification/UserGuildJoinRequestStore.tsx'; /* Metro dependency 3970 */
|
|
import DefaultRouteStore from './DefaultRouteStore.tsx'; /* Metro dependency 3973 */
|
|
import * as FileImportTrackerModule from '../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
|
|
import * as ConstantsModule from '../Constants.tsx'; /* Metro dependency 661 */
|
|
import * as MatchPathCompatModule from '../modules/routing/matchPathCompat.tsx'; /* Metro dependency 3974 */
|
|
import * as RouteUtilsModule from '../modules/routing/RouteUtils.tsx'; /* Metro dependency 3987 */
|
|
|
|
function _fun32528(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#32528, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4118:6, offset: 0x01018c1a, size: 471 bytes, params: 8, frame: 20
|
|
const env0_0 = require;
|
|
const CONNECTION_OPEN_325322 = CONNECTION_OPEN_32532;
|
|
const Object = global.Object;
|
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
let value = ConstantsModule;
|
|
const env0_11 = value.ME;
|
|
const env0_12 = value.Routes;
|
|
const env0_15 = {};
|
|
const PersistedStore = (Flux).PersistedStore;
|
|
value = _fun32537(PersistedStore);
|
|
value.displayName = 'SelectedGuildStore';
|
|
value.persistKey = 'SelectedGuildStore';
|
|
value = new value(importDefault(694) /* metro dependency 694: Dispatcher */,
|
|
{CONNECTION_OPEN: CONNECTION_OPEN_325322, OVERLAY_INITIALIZE: function(a0) {
|
|
env0_13 = a0.selectedGuildId;
|
|
env0_14 = undefined;
|
|
CONNECTION_OPEN_32532();
|
|
}, CHANNEL_SELECT: CHANNEL_SELECT_32546, GUILD_MEMBER_REMOVE: GUILD_MEMBER_REMOVE_32547,
|
|
GUILD_DELETE: GUILD_DELETE_32548, LOGOUT: function() {
|
|
env0_13 = null;
|
|
env0_14 = null;
|
|
}});
|
|
(FileImportTrackerModule).fileFinishedImporting('stores/SelectedGuildStore.tsx');
|
|
exports.default = value;
|
|
exports.SELECTED_GUILD_TIMESTAMP_NOW = -1;
|
|
function _isNativeReflectConstruct_32529() { // fn#32529, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4118:216, offset: 0x01018df1, 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_32529_isNativeReflectConstruct = function() {
|
|
return !!result;
|
|
})();
|
|
}
|
|
|
|
function CONNECTION_OPEN_32532() { // fn#32532, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4118:432, offset: 0x01018e4f, size: 156 bytes, params: 1, frame: 14
|
|
env0_13 = env0_13 != null && GuildStore.getGuild(env0_13) == null && UserGuildJoinRequestStore.getRequest(env0_13) == null ? null : env0_13;
|
|
if (env0_14 != null && GuildStore.getGuild(env0_14) == null && UserGuildJoinRequestStore.getRequest(env0_14) == null) {
|
|
}
|
|
updateLastSelectedGuildMillis(env0_13);
|
|
}
|
|
|
|
function updateLastSelectedGuildMillis(a0) { // fn#32533, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4118:621, offset: 0x01018eeb, size: 41 bytes, params: 2, frame: 11
|
|
var binding;
|
|
var Date;
|
|
if (a0 != null) {
|
|
binding = env0_15;
|
|
Date = global.Date;
|
|
binding[a0] = Date.now();
|
|
}
|
|
}
|
|
|
|
function handleGuildRemove(a0) { // fn#32534, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4118:690, offset: 0x01018f14, size: 166 bytes, params: 2, frame: 15
|
|
var r0;
|
|
var value4;
|
|
var moduleValue;
|
|
var moduleValue2;
|
|
delete env0_15[a0];
|
|
if (env0_14 !== a0) {
|
|
r0 = false;
|
|
} else {
|
|
r0 = true;
|
|
}
|
|
if (env0_13 === a0) {
|
|
value4 = pickFallbackGuildId(a0);
|
|
if (value4 != null) {
|
|
moduleValue2 = require(1230) /* metro dependency 1230: router_utils */;
|
|
moduleValue2.replaceWith(Routes.CHANNEL(value4));
|
|
r0 = true;
|
|
} else {
|
|
moduleValue = require(1230) /* metro dependency 1230: router_utils */;
|
|
moduleValue.replaceWith(Routes.ME);
|
|
r0 = true;
|
|
}
|
|
}
|
|
return r0;
|
|
function pickFallbackGuildId(a0) { // fn#32535, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4118:778, owner: handleGuildRemove.pickFallbackGuildId, offset: 0x01018fba, size: 254 bytes, params: 2, frame: 26
|
|
var environment;
|
|
var r7;
|
|
var r8;
|
|
var r9;
|
|
var r15;
|
|
var r12;
|
|
var r13;
|
|
var r1;
|
|
var id;
|
|
var guildStoreBinding;
|
|
var getGuild;
|
|
var property;
|
|
var property2;
|
|
var value6;
|
|
var value7;
|
|
var value8;
|
|
const env0_0 = a0;
|
|
let value = environment.__proto__;
|
|
const value2 = null;
|
|
if (value2 != env1_14) {
|
|
guildStoreBinding = GuildStore;
|
|
getGuild = guildStoreBinding.getGuild;
|
|
reducibleJoin2: while (true) {
|
|
if (value2 != Reflect.apply(getGuild, guildStoreBinding, [env1_14])) {
|
|
return env1_14;
|
|
}
|
|
break reducibleJoin2;
|
|
}
|
|
}
|
|
const Object = global.Object;
|
|
const value3 = Object.keys(env1_15);
|
|
let length = value3.length;
|
|
const value4 = 0;
|
|
const value5 = undefined;
|
|
if (value4 < length) {
|
|
r7 = value4;
|
|
r8 = value4;
|
|
r9 = value2;
|
|
reducibleLoop3: while (true) {
|
|
property = value3[r7];
|
|
reducibleJoin7: while (true) {
|
|
if (property === a0) {
|
|
r12 = r9;
|
|
r13 = r8;
|
|
break reducibleJoin7;
|
|
}
|
|
property2 = env1_15[property];
|
|
value6 = property2 > r8;
|
|
reducibleJoin6: while (true) {
|
|
if (value6) {
|
|
guildStoreBinding = GuildStore;
|
|
getGuild = guildStoreBinding.getGuild;
|
|
value7 = value2 != Reflect.apply(getGuild, guildStoreBinding, [property]);
|
|
r15 = value7;
|
|
break reducibleJoin6;
|
|
}
|
|
r15 = value6;
|
|
break reducibleJoin6;
|
|
}
|
|
if (r15) {
|
|
r12 = property;
|
|
r13 = property2;
|
|
break reducibleJoin7;
|
|
}
|
|
r12 = r9;
|
|
r13 = r8;
|
|
break reducibleJoin7;
|
|
}
|
|
value8 = typeof r7 === 'bigint' ? r7 + 1n : +r7 + 1;
|
|
length = value3.length;
|
|
if (value8 < length) {
|
|
r7 = value8;
|
|
r8 = r13;
|
|
r9 = r12;
|
|
continue reducibleLoop3;
|
|
}
|
|
r1 = r12;
|
|
break reducibleLoop3;
|
|
}
|
|
} else {
|
|
r1 = value2;
|
|
}
|
|
if (value2 != r1) {
|
|
return r1;
|
|
}
|
|
value = GuildStore.getGuildsArray();
|
|
value = value.find(_fun32536);
|
|
reducibleJoin11: while (true) {
|
|
if (value2 == value) {
|
|
id = value5;
|
|
break reducibleJoin11;
|
|
}
|
|
id = value.id;
|
|
break reducibleJoin11;
|
|
}
|
|
return value2 != id ? id : value2;
|
|
function _fun32536({id}) { // fn#32536, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4118:1054, offset: 0x010190b8, size: 21 bytes, params: 2, frame: 2
|
|
return id !== env0_0;
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
function _fun32537(a0) { // fn#32537, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4118:1198, offset: 0x010190cd, size: 162 bytes, params: 2, frame: 16
|
|
const SelectedGuildStore2 = SelectedGuildStore;
|
|
Inherits(SelectedGuildStore2, a0);
|
|
return CreateClass(SelectedGuildStore2, [{key: 'initialize', value: value_32539}, {key: 'getState', value: value_32541},
|
|
{key: 'getGuildId', value: value_32542}, {key: 'getLastSelectedGuildId', value: value_32543},
|
|
{key: 'getLastSelectedTimestamp', value: value_32544}]);
|
|
function SelectedGuildStore() { // fn#32538, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4118:1210, offset: 0x00fc4bce, size: 113 bytes, params: 1, frame: 20
|
|
const value = environment.__proto__;
|
|
env1_2(this, SelectedGuildStore);
|
|
const value3 = env1_5(SelectedGuildStore);
|
|
return env1_4(this, _isNativeReflectConstruct_32529() ? global.Reflect.construct(value3, arguments,
|
|
env1_5(this).constructor) : value3.apply(this, arguments));
|
|
}
|
|
|
|
function value_32539(a0) { // fn#32539, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4118:1518, offset: 0x0101916f, size: 316 bytes, params: 2, frame: 23
|
|
this.mustEmitChanges(function(a0) {
|
|
return a0.type !== 'CONNECTION_OPEN';
|
|
});
|
|
this.waitFor(AuthenticationStore, DefaultRouteStore, GuildStore, UserGuildJoinRequestStore);
|
|
const value2 = null;
|
|
const value3 = undefined;
|
|
const selectedGuildTimestampMillis = value2 == a0 ? value3 : a0.selectedGuildTimestampMillis;
|
|
const r4 = value2 != selectedGuildTimestampMillis ? selectedGuildTimestampMillis : {};
|
|
const selectedGuildId = value2 == a0 ? value3 : a0.selectedGuildId;
|
|
env1_13 = value2 != selectedGuildId ? selectedGuildId : value2;
|
|
const lastSelectedGuildId = value2 == a0 ? value3 : a0.lastSelectedGuildId;
|
|
let r1 = value2 != lastSelectedGuildId ? lastSelectedGuildId : value2;
|
|
const lastNonVoiceRoute = DefaultRouteStore.lastNonVoiceRoute;
|
|
const matchPath = MatchPathCompatModule.matchPath;
|
|
const CHANNEL = Routes.CHANNEL;
|
|
const RouteParam = (RouteUtilsModule).RouteParam;
|
|
let guildId = RouteParam.guildId;
|
|
const value4 = Reflect.apply(matchPath, MatchPathCompatModule, [lastNonVoiceRoute, {path: Reflect.apply(CHANNEL,
|
|
Routes, [Reflect.apply(guildId, RouteParam, [])])}]);
|
|
guildId = value2 == value4 || value2 == value4.params ? value3 : value4.params.guildId;
|
|
r1 = guildId === ME ? value2 : value2 != guildId ? guildId : value2;
|
|
if (value2 != r1 && r1 !== env1_13) {
|
|
}
|
|
return value3;
|
|
}
|
|
|
|
function value_32541() { // fn#32541, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4118:2052, offset: 0x010192bd, size: 34 bytes, params: 1, frame: 3
|
|
return {selectedGuildTimestampMillis: env1_15, selectedGuildId: env1_13, lastSelectedGuildId: env1_14};
|
|
}
|
|
|
|
function value_32542() { // fn#32542, offset: 0x00e2f9d5, size: 9 bytes, params: 1, frame: 1
|
|
return env1_13;
|
|
}
|
|
|
|
function value_32543() { // fn#32543, offset: 0x00df0f5a, size: 9 bytes, params: 1, frame: 1
|
|
return env1_14;
|
|
}
|
|
|
|
function value_32544(a0) { // fn#32544, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4118:2286, offset: 0x010192df, size: 30 bytes, params: 2, frame: 4
|
|
return env1_13 === a0 ? -1 : env1_15[a0];
|
|
}
|
|
|
|
}
|
|
|
|
function CHANNEL_SELECT_32546({guildId}) { // fn#32546, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4118:2600, offset: 0x0101931d, size: 59 bytes, params: 2, frame: 13
|
|
if (env0_13 === guildId) {
|
|
return false;
|
|
}
|
|
const updateLastSelectedGuildMillisBinding = updateLastSelectedGuildMillis;
|
|
updateLastSelectedGuildMillisBinding(env0_13);
|
|
updateLastSelectedGuildMillisBinding(guildId);
|
|
if (guildId == null) {
|
|
}
|
|
}
|
|
|
|
function GUILD_MEMBER_REMOVE_32547({guildId, user}) { // fn#32547, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4118:2766, offset: 0x01019358, size: 55 bytes, params: 2, frame: 13
|
|
const id = user.id;
|
|
const authenticationStoreBinding = AuthenticationStore;
|
|
const getId = authenticationStoreBinding.getId;
|
|
return id === Reflect.apply(getId, authenticationStoreBinding, []) && handleGuildRemove(guildId);
|
|
}
|
|
|
|
function GUILD_DELETE_32548({guild}) { // fn#32548, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:4118:2879, offset: 0x0101938f, size: 44 bytes, params: 2, frame: 12
|
|
return guild.unavailable !== true && handleGuildRemove(guild.id);
|
|
}
|
|
|
|
}
|
|
|
|
global.__d(_fun32528, 3969, [6, 7, 15, 17, 18, 3970, 1226, 3973, 1867, 661, 1230, 3974, 3987, 566, 694,
|
|
2]) /* metro module 3969, dependencies: [6, 7, 15, 17, 18, 3970, 1226, 3973, 1867, 661, 1230, 3974, 3987, 566, 694, 2] */;
|