Files
discord-decomp/sources/stores/ConnectedAccountsStore.tsx
T
2026-07-27 16:20:00 +03:00

221 lines
12 KiB
TypeScript

/* Metro module 5040; source: stores/ConnectedAccountsStore.tsx; dependencies: [6, 7, 15, 17, 18, 5041, 661, 4915, 1418, 5042, 566, 694, 2] */
function _fun43605(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#43605, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5218:6, offset: 0x01157407, size: 485 bytes, params: 8, frame: 21
const env0_0 = require;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
const env0_3 = importDefault(6) /* metro dependency 6 */;
const env0_4 = importDefault(7) /* metro dependency 7 */;
const env0_5 = importDefault(15) /* metro dependency 15 */;
const env0_6 = importDefault(17) /* metro dependency 17 */;
const env0_7 = importDefault(18) /* metro dependency 18 */;
const connectedAccountRecord = importDefault(5041) /* metro dependency 5041: ConnectedAccountRecord */;
const PlatformTypes = (require(661) /* metro dependency 661: Constants */).PlatformTypes;
let Set = global.Set;
const CONTACTS = PlatformTypes.CONTACTS;
let set = new Set([CONTACTS]);
let env0_11 = [];
let env0_12 = [];
const env0_13 = {};
Set = global.Set;
set = new Set();
const env0_15 = {};
const env0_16 = {};
const updateAccounts = function(a0) {
env0_11 = a0.filter(_fun43610);
env0_12 = a0.filter(_fun43611);
env0_10 = false;
};
const Store = (importDefault(566) /* metro dependency 566: flux */).Store;
_fun43612(Store).displayName = 'ConnectedAccountsStore';
set = new set(importDefault(694) /* metro dependency 694: Dispatcher */,
{CONNECTION_OPEN: function({connectedAccounts}) {
updateAccounts(connectedAccounts.map(_fun43628));
}, USER_CONNECTIONS_UPDATE: USER_CONNECTIONS_UPDATE,
USER_CONNECTIONS_INTEGRATION_JOINING: USER_CONNECTIONS_INTEGRATION_JOINING,
USER_CONNECTION_UPDATE: USER_CONNECTION_UPDATE,
USER_CONNECTIONS_INTEGRATION_JOINING_ERROR: USER_CONNECTIONS_INTEGRATION_JOINING_ERROR,
USER_CONNECTIONS_CALLBACK: USER_CONNECTIONS_CALLBACK});
(require(2) /* metro dependency 2 */).fileFinishedImporting('stores/ConnectedAccountsStore.tsx');
exports.default = set;
}
function _isNativeReflectConstruct_43606() { // fn#43606, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5218:182, offset: 0x011575ec, 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_43606_isNativeReflectConstruct = function() {
return !!result;
})();
}
function updateAccounts(a0) { // fn#43609, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5218:458, offset: 0x0115764a, size: 56 bytes, params: 2, frame: 12
const value = a0.filter(_fun43610);
env0_12 = a0.filter(_fun43611);
}
function _fun43612(a0) { // fn#43612, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5218:566, offset: 0x011576e4, size: 310 bytes, params: 2, frame: 16
const closure = ConnectedAccountsStore;
env0_7(closure, a0);
return env0_4(closure, [{key: 'isJoining', value: value_43614}, {key: 'joinErrorMessage', value: value_43615},
{key: 'isFetching', value: value_43616}, {key: 'getAccounts', value: value_43617}, {key: 'getLocalAccounts',
value: value_43618}, {key: 'getAccount', value: value_43619}, {key: 'getLocalAccount', value: value_43621},
{key: 'isSuggestedAccountType', value: value_43623}, {key: 'addPendingAuthorizedState', value: value_43624},
{key: 'deletePendingAuthorizedState', value: value_43625}, {key: 'hasPendingAuthorizedState',
value: value_43626}]);
}
function CONNECTION_OPEN_43627({connectedAccounts}) { // fn#43627, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5218:1663, offset: 0x01157907, size: 42 bytes, params: 2, frame: 11
updateAccounts(connectedAccounts.map(_fun43628));
}
function USER_CONNECTIONS_UPDATE(a0) { // fn#43629, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5218:1784, offset: 0x01157951, size: 102 bytes, params: 2, frame: 12
if (a0.local) {
if (a0.accounts != null) {
updateAccounts(a0.accounts.map(_fun43630));
} else {
(importDefault(5042) /* metro dependency 5042: ConnectedAccountsActionCreators */).fetch();
}
} else {
(importDefault(5042) /* metro dependency 5042: ConnectedAccountsActionCreators */).fetch();
}
}
function USER_CONNECTIONS_INTEGRATION_JOINING({integrationId, joining}) { // fn#43632, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5218:2070, offset: 0x01157a5f, size: 30 bytes, params: 2, frame: 3
env0_13[integrationId] = joining;
}
function USER_CONNECTION_UPDATE({platformType, id, revoked, accessToken}) { // fn#43633, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5218:2149, offset: 0x01157a7d, size: 93 bytes, params: 2, frame: 13
const value = env0_11.find(_fun43634);
if (value == null) {
return false;
}
if (revoked != null) {
value.revoked = revoked;
}
if (accessToken != null) {
value.accessToken = accessToken;
}
}
function USER_CONNECTIONS_INTEGRATION_JOINING_ERROR(a0) { // fn#43635, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5218:2386, offset: 0x01157aff, size: 42 bytes, params: 2, frame: 6
const binding = env0_16;
const integrationId = a0.integrationId;
let error = a0.error;
error = error === undefined ? '' : a0.error;
binding[integrationId] = error;
}
function USER_CONNECTIONS_CALLBACK({code, state, openid_params, provider}) { // fn#43636, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5218:2491, offset: 0x01157b29, size: 79 bytes, params: 2, frame: 17
const connectedAccountsActionCreators = importDefault(5042) /* metro dependency 5042: ConnectedAccountsActionCreators */;
connectedAccountsActionCreators.callback(provider, {code: code, state: state, openid_params: openid_params});
}
function _fun43610(a0) { // fn#43610, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5218:474, offset: 0x01157682, size: 71 bytes, params: 2, frame: 13
var r0;
let value = environment.__proto__;
const binding = env1_9;
const value2 = binding.has(a0.type);
if (value2) {
r0 = !value2;
} else {
value = importDefault(4915) /* metro dependency 4915: Platforms */;
value = value.isSupported(a0.type);
r0 = value;
}
return r0;
}
function _fun43611({type}) { // fn#43611, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5218:535, offset: 0x011576c9, size: 27 bytes, params: 2, frame: 11
return env1_9.has(type);
}
function value_43614(a0) { // fn#43614, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5218:905, offset: 0x0115781a, size: 21 bytes, params: 2, frame: 2
const value = environment.__proto__;
return env1_13[a0] || false;
}
function value_43619(a0, a1) { // fn#43619, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5218:1160, offset: 0x0115782f, size: 41 bytes, params: 3, frame: 11
const env0_0 = a0;
const env0_1 = a1;
return env1_11.find(_fun43620);
}
function value_43621(a0) { // fn#43621, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5218:1257, offset: 0x0115788a, size: 34 bytes, params: 2, frame: 11
const env0_0 = a0;
return env1_12.find(_fun43622);
}
function value_43623(a0) { // fn#43623, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5218:1338, offset: 0x011578ac, size: 21 bytes, params: 2, frame: 2
const value = environment.__proto__;
return env1_15[a0] || false;
}
function value_43624(a0) { // fn#43624, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5218:1407, offset: 0x011578c1, size: 24 bytes, params: 2, frame: 11
env1_14.add(a0);
}
function value_43625(a0) { // fn#43625, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5218:1472, offset: 0x011578d9, size: 24 bytes, params: 2, frame: 11
env1_14.delete(a0);
}
function _fun43628(a0) { // fn#43628, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5218:1727, offset: 0x01157931, size: 32 bytes, params: 2, frame: 11
let value = environment.__proto__;
value = Object.create(ConnectedAccountRecord.prototype, {constructor: {value: ConnectedAccountRecord}});
const connectedAccountRecord = new ConnectedAccountRecord(a0);
return connectedAccountRecord instanceof Object ? connectedAccountRecord : value;
}
function _fun43630(a0) { // fn#43630, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5218:1872, offset: 0x011579b7, size: 79 bytes, params: 2, frame: 14
var environment;
let value = environment.__proto__;
const object2 = {};
copyDataProperties(object2, a0, undefined);
object2['integrations'] = a0.integrations.map(_fun43631);
value = Object.create(ConnectedAccountRecord.prototype, {constructor: {value: ConnectedAccountRecord}});
const connectedAccountRecord = new ConnectedAccountRecord(object2);
return connectedAccountRecord instanceof Object ? connectedAccountRecord : value;
}
function _fun43634(a0) { // fn#43634, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5218:2246, offset: 0x01157ada, size: 37 bytes, params: 2, frame: 4
return a0.id === id && a0.type === platformType;
}
function _fun43620(a0) { // fn#43620, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5218:1189, offset: 0x01157858, size: 50 bytes, params: 2, frame: 5
return (env0_0 == null || a0.id === env0_0) && a0.type === require;
}
function _fun43631(a0) { // fn#43631, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:5218:1920, offset: 0x01157a06, size: 89 bytes, params: 2, frame: 15
const object3 = {};
copyDataProperties(object3, a0, undefined);
let value = environment.__proto__.__proto__;
const fromGuildBasic = (require(1418) /* metro dependency 1418: GuildRecordUtils */).fromGuildBasic;
const object4 = {};
copyDataProperties(object4, a0.guild, undefined);
object4['features'] = [];
value = Reflect.apply(fromGuildBasic, value, [object4]);
object3['guild'] = value;
return object3;
}