/* Metro module 15663; source: modules/app_icons/native/AppIconPremiumManager.tsx; dependencies: [5, 6, 7, 15, 17, 18, 1878, 7902, 661, 3, 7903, 477, 12187, 3802, 683, 4860, 2] */ function _fun120083(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#120083, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15871:6, offset: 0x0252069c, size: 406 bytes, params: 8, frame: 19 const env0_0 = require; const Object = global.Object; Object.defineProperty(exports, '__esModule', {value: true}); const env0_3 = importDefault(5) /* metro dependency 5 */; const env0_4 = importDefault(6) /* metro dependency 6 */; const env0_5 = importDefault(7) /* metro dependency 7 */; const env0_6 = importDefault(15) /* metro dependency 15 */; const env0_7 = importDefault(17) /* metro dependency 17 */; const env0_8 = importDefault(18) /* metro dependency 18 */; const userStore = importDefault(1878) /* metro dependency 1878: UserStore */; const env0_10 = (require(7902) /* metro dependency 7902: AppIconConstants */).getIconById; const env0_11 = (require(661) /* metro dependency 661: Constants */).AnalyticEvents; let value = importDefault(3) /* metro dependency 3: Logger */; value = new value('AppIconPremiumManager'); const FreemiumAppIconIds = (require(7903) /* metro dependency 7903: AppIconTypes */).FreemiumAppIconIds; const env0_13 = FreemiumAppIconIds.DEFAULT; object = {ORPHANED: 'orphaned', PREMIUM_LOST: 'premium_lost'}; value = importDefault(4860) /* metro dependency 4860: AutomaticLifecycleManager */; value = _fun120087(value); value = new value(); (require(2) /* metro dependency 2 */).fileFinishedImporting('modules/app_icons/native/AppIconPremiumManager.tsx'); exports.default = value; } function _isNativeReflectConstruct_120084() { // fn#120084, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15871:215, offset: 0x02520832, 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_120084_isNativeReflectConstruct = function() { return !!result; })(); } function _fun120087(a0) { // fn#120087, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15871:575, offset: 0x02520894, size: 144 bytes, params: 2, frame: 17 const closure = AppIconPremiumManager; env0_8(closure, a0); const binding = env0_5; const items2 = [{key: 'handleAppStateUpdate', value: value_120090}]; const env0_0 = env0_3(_fun120092); items2[1] = {key: 'validateAndResetIfNeeded', value: value_120093}; items2[2] = {key: 'resetIcon', value: value_120094}; return binding(closure, items2); } function AppIconPremiumManager(a0) { // fn#120088, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15871:587, offset: 0x02520924, size: 152 bytes, params: 2, frame: 20 var r0; var Reflect; let value = copyRestArgs(0, undefined); let binding = env1_4; binding(this, AppIconPremiumManager); const items = []; arraySpread(items, value, 0, items); value = env1_7(AppIconPremiumManager); binding = env1_6; if (_isNativeReflectConstruct_120084()) { Reflect = global.Reflect; value = Reflect.construct(value, items, env1_7(this).constructor); r0 = value; } else { value = value.apply(this, items); r0 = value; } value = binding(this, r0); value.actions = {APP_STATE_UPDATE: APP_STATE_UPDATE_120089}; return value; } function value_120090({state}) { // fn#120090, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15871:989, offset: 0x025209bc, size: 84 bytes, params: 2, frame: 13 let value = environment.__proto__; value = require(477) /* metro dependency 477: PlatformUtils */; value = value.isIOS(); if (value ? state === 'active' : state === 'background') { this.validateAndResetIfNeeded(); } } function* _fun120092() { // fn#120092, original name: ?anon_0_, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15871:1141, offset: 0x02520a1b, size: 362 bytes, params: 1, frame: 21 if (false) { return undefined; } value = environment.__proto__.__proto__; let binding = env2_9; const currentUser = binding.getCurrentUser(); binding = env2_0; const value4 = undefined; const value5 = binding(env2_2[12]); yield value5.fetchCurrentAppIcon(); const value6 = undefined; if (false) { return value6; } if (value6 !== env2_13) { var value8 = env2_10(value6); if (value6 !== value8.id) { env2_12.info('Icon ' + value6 + ' is no longer available, resetting to default'); this.resetIcon(value6, (currentUser == null ? value4 : currentUser.premiumType) ?? value4, env2_14.ORPHANED); return value4; } if (!env2_1(env2_2[13]).canUsePremiumAppIcons(currentUser) && value8.isPremium) { env2_12.info('User is not premium, resetting icon ' + value6 + ' to default'); this.resetIcon(value6, (currentUser == null ? value4 : currentUser.premiumType) ?? value4, env2_14.PREMIUM_LOST); } } return value4; } function value_120094(a0, a1, a2) { // fn#120094, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15871:1699, offset: 0x02520b85, size: 97 bytes, params: 4, frame: 15 var environment; const env0_0 = a0; const env0_1 = a2; let value = environment.__proto__; value = (require(12187) /* metro dependency 12187: AppIconUtils */).setAppIcon(DEFAULT, a1); value = value.then(_fun120095); value.catch(_fun120096); } function _fun120095() { // fn#120095, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15871:1746, offset: 0x02520be6, size: 86 bytes, params: 1, frame: 17 const defaultImport = importDefault(683) /* metro dependency 683: AnalyticsUtils */; const track = defaultImport.track; const APP_ICON_AUTO_RESET = AnalyticEvents.APP_ICON_AUTO_RESET; Reflect.apply(track, defaultImport, [APP_ICON_AUTO_RESET, {previous_icon_id: env0_0, reset_to_icon_id: DEFAULT, reset_reason: importDefault}]); } function _fun120096(a0) { // fn#120096, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15871:1854, offset: 0x02520c3c, size: 31 bytes, params: 2, frame: 13 env2_12.error('Failed to reset app icon:', a0); }