286 lines
15 KiB
TypeScript
286 lines
15 KiB
TypeScript
/* Metro module 11876; source: modules/multi_account/MultiAccountStore.tsx; dependencies: [6, 7, 15, 17, 18, 11877, 11878, 692, 11879, 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 * as FileImportTrackerModule from '../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
|
|
import * as TokenManagerModule from '../../external/discord_common/js/shared/lib/TokenManager.tsx'; /* Metro dependency 692 */
|
|
import * as ConstantsModule from './Constants.tsx'; /* Metro dependency 11877 */
|
|
|
|
function _fun91094(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#91094, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12062:6, offset: 0x02052bf7, size: 543 bytes, params: 8, frame: 21
|
|
const env0_0 = require;
|
|
const Object = global.Object;
|
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
object = {INVALID: 0};
|
|
object[0] = 'INVALID';
|
|
object.VALIDATING = 1;
|
|
object[1] = 'VALIDATING';
|
|
object.VALID = 2;
|
|
object[2] = 'VALID';
|
|
const env0_13 = [];
|
|
const PersistedStore = (Flux).PersistedStore;
|
|
let value = _fun91102(PersistedStore);
|
|
value.displayName = 'MultiAccountStore';
|
|
value.persistKey = 'MultiAccountStore';
|
|
value.migrations = [function(a0) {
|
|
return a0 != null ? {users: a0.users ?? [], canUseMultiAccountMobile: false} : {users: [],
|
|
canUseMultiAccountMobile: false};
|
|
}];
|
|
value = new value(importDefault(694) /* metro dependency 694: Dispatcher */,
|
|
{CONNECTION_OPEN: CONNECTION_OPEN_91116, LOGOUT: LOGOUT_91119,
|
|
MULTI_ACCOUNT_VALIDATE_TOKEN_REQUEST: MULTI_ACCOUNT_VALIDATE_TOKEN_REQUEST,
|
|
MULTI_ACCOUNT_VALIDATE_TOKEN_SUCCESS: MULTI_ACCOUNT_VALIDATE_TOKEN_SUCCESS,
|
|
MULTI_ACCOUNT_VALIDATE_TOKEN_FAILURE: MULTI_ACCOUNT_VALIDATE_TOKEN_FAILURE,
|
|
MULTI_ACCOUNT_REMOVE_ACCOUNT: function(a0) {
|
|
removeAccountById(a0.userId);
|
|
}, MULTI_ACCOUNT_MOVE_ACCOUNT: MULTI_ACCOUNT_MOVE_ACCOUNT, CURRENT_USER_UPDATE: CURRENT_USER_UPDATE_91126,
|
|
MULTI_ACCOUNT_UPDATE_PUSH_SYNC_TOKEN: MULTI_ACCOUNT_UPDATE_PUSH_SYNC_TOKEN,
|
|
MULTI_ACCOUNT_INVALIDATE_PUSH_SYNC_TOKENS: MULTI_ACCOUNT_INVALIDATE_PUSH_SYNC_TOKENS});
|
|
(FileImportTrackerModule).fileFinishedImporting('modules/multi_account/MultiAccountStore.tsx');
|
|
exports.default = value;
|
|
exports.MultiAccountTokenStatus = object;
|
|
function _isNativeReflectConstruct_91095() { // fn#91095, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12062:171, offset: 0x02052e16, size: 98 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_91095_isNativeReflectConstruct = function() {
|
|
return !!result;
|
|
})();
|
|
}
|
|
|
|
function removeAccountById(a0) { // fn#91098, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12062:487, offset: 0x02052e78, size: 72 bytes, params: 2, frame: 13
|
|
const env0_0 = a0;
|
|
env0_13 = env0_13.filter(_fun91099);
|
|
(TokenManagerModule).removeToken(a0);
|
|
function _fun91099({id}) { // fn#91099, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12062:529, offset: 0x010190b8, size: 21 bytes, params: 2, frame: 2
|
|
return id !== env0_0;
|
|
}
|
|
|
|
}
|
|
|
|
function setTokenStatus(a0, a1) { // fn#91100, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12062:570, offset: 0x02052ec0, size: 66 bytes, params: 3, frame: 12
|
|
const env0_0 = a0;
|
|
const value3 = env0_13.slice().find(_fun91101);
|
|
if (value3 != null) {
|
|
value3.tokenStatus = a1;
|
|
}
|
|
function _fun91101({id}) { // fn#91101, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12062:625, offset: 0x00db0c48, size: 21 bytes, params: 2, frame: 2
|
|
return id === env0_0;
|
|
}
|
|
|
|
}
|
|
|
|
function _fun91102(a0) { // fn#91102, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12062:680, offset: 0x02052f02, size: 274 bytes, params: 2, frame: 16
|
|
const MultiAccountStore2 = MultiAccountStore;
|
|
Inherits(MultiAccountStore2, a0);
|
|
return CreateClass(MultiAccountStore2, [{key: 'initialize', value: value_91104}, {key: 'getCanUseMultiAccountMobile',
|
|
value: value_91105}, {key: 'getState', value: value_91106}, {key: 'getUsers', value: value_91107},
|
|
{key: 'getValidUsers', value: value_91108}, {key: 'getHasLoggedInAccounts', value: value_91110},
|
|
{key: 'getIsValidatingUsers', value: value_91111}, {key: 'canUseMultiAccountNotifications', get: function() {
|
|
return this.getCanUseMultiAccountMobile();
|
|
}}, {key: 'isSwitchingAccount', get: get_91114}]);
|
|
function MultiAccountStore() { // fn#91103, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12062:692, offset: 0x02053014, size: 113 bytes, params: 1, frame: 20
|
|
const value = environment.__proto__;
|
|
env1_4(this, MultiAccountStore);
|
|
const value3 = env1_7(MultiAccountStore);
|
|
return env1_6(this, _isNativeReflectConstruct_91095() ? global.Reflect.construct(value3, arguments,
|
|
env1_7(this).constructor) : value3.apply(this, arguments));
|
|
}
|
|
|
|
function value_91104(a0) { // fn#91104, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12062:995, offset: 0x02053085, size: 44 bytes, params: 2, frame: 3
|
|
var r2;
|
|
var value;
|
|
var canUseMultiAccountMobile;
|
|
if (a0 != null) {
|
|
r2 = a0.users ?? [];
|
|
value = environment.__proto__;
|
|
canUseMultiAccountMobile = a0.canUseMultiAccountMobile;
|
|
}
|
|
}
|
|
|
|
function value_91105() { // fn#91105, offset: 0x00ef8482, size: 9 bytes, params: 1, frame: 1
|
|
return env1_11;
|
|
}
|
|
|
|
function value_91106() { // fn#91106, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12062:1165, offset: 0x020530b1, size: 25 bytes, params: 1, frame: 3
|
|
return {users: env1_13, canUseMultiAccountMobile: env1_11};
|
|
}
|
|
|
|
function value_91107() { // fn#91107, offset: 0x00e2f9d5, size: 9 bytes, params: 1, frame: 1
|
|
return env1_13;
|
|
}
|
|
|
|
function value_91108() { // fn#91108, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12062:1292, offset: 0x020530ca, size: 28 bytes, params: 1, frame: 11
|
|
return env1_13.filter(_fun91109);
|
|
function _fun91109({tokenStatus}) { // fn#91109, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12062:1320, offset: 0x020530e6, size: 28 bytes, params: 2, frame: 2
|
|
const INVALID = env2_12.INVALID;
|
|
return tokenStatus !== INVALID;
|
|
}
|
|
|
|
}
|
|
|
|
function value_91110() { // fn#91110, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12062:1393, offset: 0x02053102, size: 20 bytes, params: 1, frame: 2
|
|
return env1_13.length > 0;
|
|
}
|
|
|
|
function value_91111() { // fn#91111, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12062:1458, offset: 0x02053116, size: 29 bytes, params: 1, frame: 11
|
|
return env1_13.some(_fun91112);
|
|
function _fun91112({tokenStatus}) { // fn#91112, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12062:1484, offset: 0x02053133, size: 28 bytes, params: 2, frame: 2
|
|
const VALIDATING = env2_12.VALIDATING;
|
|
return tokenStatus === VALIDATING;
|
|
}
|
|
|
|
}
|
|
|
|
function get_91114() { // fn#91114, offset: 0x00df0f5a, size: 9 bytes, params: 1, frame: 1
|
|
return env1_14;
|
|
}
|
|
|
|
}
|
|
|
|
function CONNECTION_OPEN_91116({user}) { // fn#91116, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12062:1945, offset: 0x0205319c, size: 346 bytes, params: 2, frame: 16
|
|
var property;
|
|
const id = user.id;
|
|
if (!env0_11 && (importDefault(11878) /* metro dependency 11878: isStaffFromRawUser */)(user)) {
|
|
}
|
|
const value4 = env0_13.slice();
|
|
const index = value4.findIndex(function({id}) {
|
|
return id === user.id;
|
|
});
|
|
if (index > -1) {
|
|
property = env0_13[index];
|
|
property.avatar = user.avatar;
|
|
property = env0_13[index];
|
|
property.username = user.username;
|
|
property = env0_13[index];
|
|
property.discriminator = user.discriminator;
|
|
property = env0_13[index];
|
|
property.tokenStatus = env0_12.VALID;
|
|
env0_13 = value4;
|
|
} else {
|
|
value4.push({id: user.id, avatar: user.avatar, username: user.username, discriminator: user.discriminator,
|
|
tokenStatus: env0_12.VALID, pushSyncToken: null});
|
|
env0_13 = value4;
|
|
}
|
|
if (env0_13.length > MAX_ACCOUNTS) {
|
|
env0_13.splice(MAX_ACCOUNTS).forEach(function({id}) {
|
|
removeAccountById(id);
|
|
});
|
|
}
|
|
}
|
|
|
|
function LOGOUT_91119(a0) { // fn#91119, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12062:2394, offset: 0x0205330e, size: 68 bytes, params: 2, frame: 12
|
|
result = !!a0.isSwitchingAccount;
|
|
if (!a0.isSwitchingAccount) {
|
|
env0_13 = env0_13.filter(_fun91120);
|
|
}
|
|
function _fun91120({id}) { // fn#91120, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12062:2479, offset: 0x02053352, size: 21 bytes, params: 2, frame: 2
|
|
return id !== env1_10;
|
|
}
|
|
|
|
}
|
|
|
|
function MULTI_ACCOUNT_VALIDATE_TOKEN_REQUEST({userId}) { // fn#91121, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12062:2543, offset: 0x02053367, size: 35 bytes, params: 2, frame: 13
|
|
const setTokenStatusBinding = setTokenStatus;
|
|
const VALIDATING = env0_12.VALIDATING;
|
|
setTokenStatusBinding(userId, VALIDATING);
|
|
}
|
|
|
|
function MULTI_ACCOUNT_VALIDATE_TOKEN_SUCCESS({userId}) { // fn#91122, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12062:2621, offset: 0x0205338a, size: 35 bytes, params: 2, frame: 13
|
|
const setTokenStatusBinding = setTokenStatus;
|
|
const VALID = env0_12.VALID;
|
|
setTokenStatusBinding(userId, VALID);
|
|
}
|
|
|
|
function MULTI_ACCOUNT_VALIDATE_TOKEN_FAILURE({userId}) { // fn#91123, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12062:2694, offset: 0x020533ad, size: 35 bytes, params: 2, frame: 13
|
|
const setTokenStatusBinding = setTokenStatus;
|
|
const INVALID = env0_12.INVALID;
|
|
setTokenStatusBinding(userId, INVALID);
|
|
}
|
|
|
|
function MULTI_ACCOUNT_MOVE_ACCOUNT({from, to}) { // fn#91125, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12062:2819, offset: 0x020533e8, size: 61 bytes, params: 2, frame: 17
|
|
env0_13 = (require(11879) /* metro dependency 11879: DragAndDropUtils */).moveItemFromTo(env0_13, from, to);
|
|
}
|
|
|
|
function CURRENT_USER_UPDATE_91126({user}) { // fn#91126, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12062:2914, offset: 0x02053425, size: 98 bytes, params: 2, frame: 13
|
|
const value3 = env0_13.slice().find(function({id}) {
|
|
return id === user.id;
|
|
});
|
|
if (value3 != null) {
|
|
value3.avatar = user.avatar;
|
|
value3.username = user.username;
|
|
value3.discriminator = user.discriminator;
|
|
}
|
|
}
|
|
|
|
function MULTI_ACCOUNT_UPDATE_PUSH_SYNC_TOKEN({userId, pushSyncToken}) { // fn#91128, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12062:3129, offset: 0x02053487, size: 56 bytes, params: 2, frame: 12
|
|
env0_13 = env0_13.map(function(a0) {
|
|
var r0;
|
|
var object;
|
|
var value = a0;
|
|
var id = value.id;
|
|
if (id !== userId) {
|
|
r0 = value;
|
|
} else {
|
|
object = {};
|
|
copyDataProperties(object, value, id);
|
|
object['pushSyncToken'] = pushSyncToken;
|
|
r0 = object;
|
|
}
|
|
return r0;
|
|
});
|
|
}
|
|
|
|
function MULTI_ACCOUNT_INVALIDATE_PUSH_SYNC_TOKENS({invalidPushSyncTokens}) { // fn#91130, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12062:3283, offset: 0x020534f3, size: 47 bytes, params: 2, frame: 12
|
|
env0_13 = env0_13.map(_fun91131);
|
|
function _fun91131(a0) { // fn#91131, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:12062:3359, offset: 0x02053522, size: 73 bytes, params: 2, frame: 15
|
|
var r0;
|
|
var invalidPushSyncTokensBinding;
|
|
var object;
|
|
const value = a0;
|
|
if (value.pushSyncToken == null) {
|
|
r0 = value;
|
|
} else {
|
|
invalidPushSyncTokensBinding = invalidPushSyncTokens;
|
|
if (invalidPushSyncTokensBinding.includes(value.pushSyncToken)) {
|
|
object = {};
|
|
copyDataProperties(object, value, invalidPushSyncTokensBinding);
|
|
object['pushSyncToken'] = null;
|
|
r0 = object;
|
|
} else {
|
|
r0 = value;
|
|
}
|
|
}
|
|
return r0;
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
global.__d(_fun91094, 11876, [6, 7, 15, 17, 18, 11877, 11878, 692, 11879, 566, 694,
|
|
2]) /* metro module 11876, dependencies: [6, 7, 15, 17, 18, 11877, 11878, 692, 11879, 566, 694, 2] */;
|