455 lines
17 KiB
TypeScript
455 lines
17 KiB
TypeScript
/* Metro module 16220; source: modules/application_account_linking/AccountLinkManager.tsx; dependencies: [57, 6, 7, 15, 17, 18, 5, 5109, 16221, 6775, 661, 672, 507, 4860, 2] */
|
|
function _fun125420(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#125420, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16428:6, offset: 0x025d816e, size: 447 bytes, params: 8, frame: 20
|
|
const env0_0 = require;
|
|
const _arrayLikeToArray_125423 = function(a0, a1) {
|
|
var r0;
|
|
var r1;
|
|
var r2;
|
|
var value3;
|
|
var length;
|
|
var value5;
|
|
var value = undefined;
|
|
var value2 = value == null;
|
|
reducibleJoin2: while (true) {
|
|
if (value2) {
|
|
r0 = value2;
|
|
break reducibleJoin2;
|
|
}
|
|
value3 = value > a0.length;
|
|
r0 = value3;
|
|
break reducibleJoin2;
|
|
}
|
|
reducibleJoin4: while (true) {
|
|
if (r0) {
|
|
length = a0.length;
|
|
r1 = length;
|
|
break reducibleJoin4;
|
|
}
|
|
r1 = value;
|
|
break reducibleJoin4;
|
|
}
|
|
value = (0, global.Array)(r1);
|
|
var value4 = 0;
|
|
if (value4 < r1) {
|
|
r2 = value4;
|
|
reducibleLoop5: while (true) {
|
|
value[r2] = a0[r2];
|
|
value5 = typeof r2 === 'bigint' ? r2 + 1n : +r2 + 1;
|
|
if (value5 < r1) {
|
|
r2 = value5;
|
|
continue reducibleLoop5;
|
|
}
|
|
break reducibleLoop5;
|
|
}
|
|
}
|
|
return value;
|
|
};
|
|
const closure = function() {
|
|
return _claimIncentivizedAccountLinkingReward.apply(this, arguments);
|
|
};
|
|
const Object = global.Object;
|
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
const env0_2 = importDefault(57) /* metro dependency 57 */;
|
|
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 env0_8 = importDefault(5) /* metro dependency 5 */;
|
|
const authorizedAppsStore = importDefault(5109) /* metro dependency 5109: AuthorizedAppsStore */;
|
|
const accountLinkStore = importDefault(16221) /* metro dependency 16221: AccountLinkStore */;
|
|
const env0_11 = (require(6775) /* metro dependency 6775: ApplicationAccountLinkingConstants */).IncentivizedAccountLinkingApplicationIds;
|
|
let value = require(661) /* metro dependency 661: Constants */;
|
|
const env0_12 = value.AppStates;
|
|
const env0_13 = value.Endpoints;
|
|
const Millis = (importDefault(672) /* metro dependency 672: Durations */).Millis;
|
|
const MINUTE = Millis.MINUTE;
|
|
const env0_14 = 20 * MINUTE;
|
|
value = importDefault(4860) /* metro dependency 4860: AutomaticLifecycleManager */;
|
|
value = _fun125431(value);
|
|
value.displayName = 'AccountLinkManager';
|
|
let value3 = new value();
|
|
(require(2) /* metro dependency 2 */).fileFinishedImporting('modules/application_account_linking/AccountLinkManager.tsx');
|
|
exports.default = value3;
|
|
exports.claimIncentivizedAccountLinkingReward = closure;
|
|
exports.AccountLinkManager = value;
|
|
}
|
|
|
|
function _createForOfIteratorHelperLoose_125421(a0, a1) { // fn#125421, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16428:282, offset: 0x025d832d, size: 372 bytes, params: 3, frame: 20
|
|
var r6;
|
|
var r9;
|
|
var r5;
|
|
var value3;
|
|
var regexp;
|
|
const env0_0 = a0;
|
|
const Symbol = global.Symbol;
|
|
let value = typeof Symbol !== 'undefined';
|
|
let r1 = value && a0[global.Symbol.iterator];
|
|
r1 = !r1 ? a0['@@iterator'] : r1;
|
|
if (r1) {
|
|
value = r1.call(a0);
|
|
return value.next.bind(value);
|
|
}
|
|
const Array = global.Array;
|
|
if (Array.isArray(a0)) {
|
|
if (r1) {
|
|
}
|
|
return _fun125422;
|
|
}
|
|
value = undefined;
|
|
if (a0) {
|
|
if (typeof a0 === 'string') {
|
|
value = _arrayLikeToArray_125423(a0, value);
|
|
r5 = value;
|
|
} else {
|
|
value3 = ({}).toString.call(a0).slice(8, -1);
|
|
r6 = value3 === 'Object' && a0.constructor;
|
|
r9 = r6 ? a0.constructor.name : value3;
|
|
if (r9 === 'Map') {
|
|
r6 = global.Array.from(a0);
|
|
} else if (r9 === 'Set') {
|
|
r6 = global.Array.from(a0);
|
|
} else if (r9 === 'Arguments') {
|
|
value = _arrayLikeToArray_125423(a0, value);
|
|
r6 = value;
|
|
} else {
|
|
regexp = RegExp('^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$', '');
|
|
if (regexp.test(r9)) {
|
|
value = _arrayLikeToArray_125423(a0, value);
|
|
r6 = value;
|
|
} else {
|
|
r6 = value;
|
|
}
|
|
}
|
|
r5 = r6;
|
|
}
|
|
} else {
|
|
r5 = value;
|
|
}
|
|
if (r5) {
|
|
if (r5) {
|
|
}
|
|
return _fun125422;
|
|
}
|
|
const TypeError = global.TypeError;
|
|
throw new TypeError('Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.');
|
|
}
|
|
|
|
function _isNativeReflectConstruct_125424() { // fn#125424, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16428:1192, offset: 0x025d84a1, 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_125424_isNativeReflectConstruct = function() {
|
|
return !!result;
|
|
})();
|
|
}
|
|
|
|
function _claimIncentivizedAccountLinkingReward() { // fn#125428, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16428:1534, offset: 0x025d8503, size: 50 bytes, params: 1, frame: 14
|
|
return env0_8(_fun125430).apply(this, arguments);
|
|
}
|
|
|
|
function _fun125431(a0) { // fn#125431, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16428:1870, offset: 0x025d85f0, size: 178 bytes, params: 2, frame: 16
|
|
const closure = AccountLinkManager;
|
|
env0_7(closure, a0);
|
|
return env0_4(closure, [{key: 'evaluatePending', value: value_125437}, {key: 'handleOAuth2TokenCreate',
|
|
value: value_125438}, {key: 'handleAuthorizedAppsUpdate', value: function() {
|
|
this.evaluatePending();
|
|
}}, {key: 'handleAccountLinkAuthorizationCompleted', value: value_125440}, {key: 'handleAppStateUpdate',
|
|
value: function({state}) {
|
|
if (state === AppStates.ACTIVE) {
|
|
this.evaluatePending();
|
|
}
|
|
}}]);
|
|
}
|
|
|
|
async function _fun125430({applicationId, onSuccess, onError}) { // fn#125430, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16428:1633, offset: 0x025d8549, size: 167 bytes, params: 2, frame: 19
|
|
var binding;
|
|
var binding2;
|
|
var property;
|
|
var value4;
|
|
var HTTP;
|
|
var post;
|
|
var object3;
|
|
var OAUTH2_ACCOUNT_LINKING_ACHIEVEMENT;
|
|
var object4;
|
|
var value5;
|
|
var error;
|
|
if (true) {
|
|
await undefined;
|
|
if (false) {
|
|
return undefined;
|
|
}
|
|
value = environment.__proto__.__proto__;
|
|
reducibleJoin5: while (true) {
|
|
reduciblePort30: while (true) {
|
|
exceptionLanding28: while (true) {
|
|
try {
|
|
binding = env2_0;
|
|
} catch (error) {
|
|
break exceptionLanding28;
|
|
}
|
|
break reducibleJoin5;
|
|
}
|
|
reducibleJoin30: while (true) {
|
|
if (onError == null) {
|
|
break reducibleJoin30;
|
|
}
|
|
onError(error);
|
|
break reducibleJoin30;
|
|
}
|
|
break reduciblePort30;
|
|
}
|
|
return undefined;
|
|
}
|
|
try {
|
|
binding2 = env2_1;
|
|
} catch (error) {
|
|
break exceptionLanding28;
|
|
}
|
|
try {
|
|
property = binding2[12];
|
|
} catch (error) {
|
|
break exceptionLanding28;
|
|
}
|
|
try {
|
|
value4 = binding(property);
|
|
} catch (error) {
|
|
break exceptionLanding28;
|
|
}
|
|
try {
|
|
HTTP = value4.HTTP;
|
|
} catch (error) {
|
|
break exceptionLanding28;
|
|
}
|
|
try {
|
|
post = HTTP.post;
|
|
} catch (error) {
|
|
break exceptionLanding28;
|
|
}
|
|
try {
|
|
object3 = {};
|
|
} catch (error) {
|
|
break exceptionLanding28;
|
|
}
|
|
try {
|
|
binding = env2_13;
|
|
} catch (error) {
|
|
break exceptionLanding28;
|
|
}
|
|
try {
|
|
OAUTH2_ACCOUNT_LINKING_ACHIEVEMENT = binding.OAUTH2_ACCOUNT_LINKING_ACHIEVEMENT;
|
|
} catch (error) {
|
|
break exceptionLanding28;
|
|
}
|
|
try {
|
|
object3.url = OAUTH2_ACCOUNT_LINKING_ACHIEVEMENT;
|
|
} catch (error) {
|
|
break exceptionLanding28;
|
|
}
|
|
try {
|
|
object4 = {};
|
|
} catch (error) {
|
|
break exceptionLanding28;
|
|
}
|
|
try {
|
|
object4.application_id = applicationId;
|
|
} catch (error) {
|
|
break exceptionLanding28;
|
|
}
|
|
try {
|
|
object3.body = object4;
|
|
} catch (error) {
|
|
break exceptionLanding28;
|
|
}
|
|
try {
|
|
object3.rejectWithError = true;
|
|
} catch (error) {
|
|
break exceptionLanding28;
|
|
}
|
|
try {
|
|
value = Reflect.apply(post, HTTP, [object3]);
|
|
} catch (error) {
|
|
break exceptionLanding28;
|
|
}
|
|
await value;
|
|
try {
|
|
value = undefined;
|
|
value5 = false;
|
|
} catch (error) {
|
|
break exceptionLanding28;
|
|
}
|
|
if (value5) {
|
|
return value;
|
|
}
|
|
try {
|
|
value = onSuccess == null;
|
|
} catch (error) {
|
|
break exceptionLanding28;
|
|
}
|
|
reducibleJoin30: while (true) {
|
|
if (value) {
|
|
break reducibleJoin30;
|
|
}
|
|
try {
|
|
onSuccess();
|
|
} catch (error) {
|
|
break exceptionLanding28;
|
|
}
|
|
break reducibleJoin30;
|
|
}
|
|
}
|
|
}
|
|
|
|
function AccountLinkManager(a0) { // fn#125432, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16428:1882, offset: 0x025d86a2, size: 190 bytes, params: 2, frame: 20
|
|
var r0;
|
|
var Reflect;
|
|
let value = copyRestArgs(0, undefined);
|
|
let binding = env1_3;
|
|
binding(this, AccountLinkManager);
|
|
const items = [];
|
|
arraySpread(items, value, 0, items);
|
|
value = env1_6(AccountLinkManager);
|
|
binding = env1_5;
|
|
if (_isNativeReflectConstruct_125424()) {
|
|
Reflect = global.Reflect;
|
|
value = Reflect.construct(value, items, env1_6(this).constructor);
|
|
r0 = value;
|
|
} else {
|
|
value = value.apply(this, items);
|
|
r0 = value;
|
|
}
|
|
value = binding(this, r0);
|
|
value.actions = {OAUTH2_TOKEN_CREATE: OAUTH2_TOKEN_CREATE_125433,
|
|
USER_AUTHORIZED_APPS_UPDATE: USER_AUTHORIZED_APPS_UPDATE_125434, APP_STATE_UPDATE: APP_STATE_UPDATE_125435,
|
|
ACCOUNT_LINK_AUTHORIZATION_COMPLETED: ACCOUNT_LINK_AUTHORIZATION_COMPLETED};
|
|
return value;
|
|
}
|
|
|
|
function value_125437() { // fn#125437, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16428:2464, offset: 0x025d87a7, size: 278 bytes, params: 1, frame: 23
|
|
var r1;
|
|
var r0;
|
|
var value3;
|
|
var value4;
|
|
var value5;
|
|
var done;
|
|
var value6;
|
|
var value7;
|
|
var property;
|
|
var property2;
|
|
var startedAt;
|
|
var value8;
|
|
var getNewestTokenForApplication;
|
|
var value9;
|
|
var value10;
|
|
var claimIncentivizedAccountLinkingRewardCallbacks;
|
|
var value11;
|
|
var claimIncentivizedAccountLinkingRewardBinding;
|
|
var onSuccess;
|
|
var onError;
|
|
var value12;
|
|
const pendingAuthorizations = AccountLinkStore.getPendingAuthorizations();
|
|
if (pendingAuthorizations.size !== 0) {
|
|
value3 = global.Date.now();
|
|
value4 = _createForOfIteratorHelperLoose_125421(pendingAuthorizations);
|
|
value5 = value4();
|
|
done = value5.done;
|
|
if (!done) {
|
|
r1 = value5;
|
|
while (true) {
|
|
value6 = r1.value;
|
|
value7 = env1_2(value6, 2);
|
|
property = value7[0];
|
|
property2 = value7[1];
|
|
startedAt = property2.startedAt;
|
|
value8 = value3 - startedAt;
|
|
if (!(value8 > env1_14)) {
|
|
getNewestTokenForApplication = AuthorizedAppsStore.getNewestTokenForApplication;
|
|
value9 = Reflect.apply(getNewestTokenForApplication, AuthorizedAppsStore, [property]) != null;
|
|
if (!value9) {
|
|
r0 = value9;
|
|
continue;
|
|
}
|
|
value10 = IncentivizedAccountLinkingApplicationIds.has(property);
|
|
r0 = value10;
|
|
if (!r0) {
|
|
continue;
|
|
}
|
|
claimIncentivizedAccountLinkingRewardCallbacks = property2.claimIncentivizedAccountLinkingRewardCallbacks;
|
|
value11 = claimIncentivizedAccountLinkingRewardCallbacks != null;
|
|
r0 = value11;
|
|
if (r0) {
|
|
claimIncentivizedAccountLinkingRewardBinding = claimIncentivizedAccountLinkingReward;
|
|
claimIncentivizedAccountLinkingRewardCallbacks = property2.claimIncentivizedAccountLinkingRewardCallbacks;
|
|
onSuccess = claimIncentivizedAccountLinkingRewardCallbacks.onSuccess;
|
|
claimIncentivizedAccountLinkingRewardCallbacks = property2.claimIncentivizedAccountLinkingRewardCallbacks;
|
|
onError = claimIncentivizedAccountLinkingRewardCallbacks.onError;
|
|
claimIncentivizedAccountLinkingRewardBinding({applicationId: property, onSuccess: onSuccess,
|
|
onError: onError});
|
|
AccountLinkStore.deletePendingAuthorization(property);
|
|
break;
|
|
}
|
|
break;
|
|
}
|
|
AccountLinkStore.deletePendingAuthorization(property);
|
|
value12 = value4();
|
|
done = value12.done;
|
|
if (done) {
|
|
break;
|
|
}
|
|
r1 = value12;
|
|
continue;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
function value_125438({application}) { // fn#125438, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16428:3057, offset: 0x025d88bd, size: 60 bytes, params: 2, frame: 12
|
|
let value = environment.__proto__;
|
|
value = AccountLinkStore.getPendingAuthorizations();
|
|
if (value.has(application.id)) {
|
|
this.evaluatePending();
|
|
}
|
|
}
|
|
|
|
function value_125440({applicationId}) { // fn#125440, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16428:3275, offset: 0x025d890a, size: 55 bytes, params: 2, frame: 12
|
|
let value = environment.__proto__;
|
|
value = AccountLinkStore.getPendingAuthorizations();
|
|
if (value.has(applicationId)) {
|
|
this.evaluatePending();
|
|
}
|
|
}
|
|
|
|
function AccountLinkManagerOAUTH2_TOKEN_CREATE(a0) { // fn#125433, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16428:2153, owner: AccountLinkManager.OAUTH2_TOKEN_CREATE, offset: 0x025d8760, size: 25 bytes, params: 2, frame: 11
|
|
return env0_0.handleOAuth2TokenCreate(a0);
|
|
}
|
|
|
|
function AccountLinkManagerUSER_AUTHORIZED_APPS_UPDATE() { // fn#125434, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16428:2213, owner: AccountLinkManager.USER_AUTHORIZED_APPS_UPDATE, offset: 0x025d8779, size: 21 bytes, params: 1, frame: 9
|
|
return env0_0.handleAuthorizedAppsUpdate();
|
|
}
|
|
|
|
function ACCOUNT_LINK_AUTHORIZATION_COMPLETED(a0) { // fn#125436, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16428:2331, owner: AccountLinkManager.ACCOUNT_LINK_AUTHORIZATION_COMPLETED, offset: 0x025d878e, size: 25 bytes, params: 2, frame: 11
|
|
return env0_0.handleAccountLinkAuthorizationCompleted(a0);
|
|
}
|
|
|