/* 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] */ import Logger from '../../debug/Logger.tsx'; /* Metro dependency 3 */ import Module00005 from '../../../by-id/module-00005.js'; /* Metro dependency 5 */ 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 AnalyticsUtils from '../../../utils/AnalyticsUtils.tsx'; /* Metro dependency 683 */ import UserStore from '../../../stores/UserStore.tsx'; /* Metro dependency 1878 */ import * as FileImportTrackerModule from '../../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */ import * as ConstantsModule from '../../../Constants.tsx'; /* Metro dependency 661 */ import * as AppIconConstantsModule from './AppIconConstants.tsx'; /* Metro dependency 7902 */ import * as AppIconTypesModule from '../AppIconTypes.tsx'; /* Metro dependency 7903 */ 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}); let value = Logger; value = new value('AppIconPremiumManager'); const FreemiumAppIconIds = (AppIconTypesModule).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(); (FileImportTrackerModule).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 AppIconPremiumManager2 = AppIconPremiumManager; Inherits(AppIconPremiumManager2, a0); const items2 = [{key: 'handleAppStateUpdate', value: value_120090}]; const env0_0 = Module00005(_fun120092); items2[1] = {key: 'validateAndResetIfNeeded', value: value_120093}; items2[2] = {key: 'resetIcon', value: value_120094}; return CreateClass(AppIconPremiumManager2, 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 items2 = []; arraySpread(items2, value, 0, items2); value = env1_7(AppIconPremiumManager); binding = env1_6; if (_isNativeReflectConstruct_120084()) { Reflect = global.Reflect; value = Reflect.construct(value, items2, env1_7(this).constructor); r0 = value; } else { value = value.apply(this, items2); r0 = value; } value = binding(this, r0); value.actions = {APP_STATE_UPDATE: APP_STATE_UPDATE_120089}; return value; function AppIconPremiumManagerAPP_STATE_UPDATE(a0) { // fn#120089, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15871:864, owner: AppIconPremiumManager.APP_STATE_UPDATE, offset: 0x0114875f, size: 23 bytes, params: 2, frame: 11 return env0_0.handleAppStateUpdate(a0); } } 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_120093() { // fn#120093, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15871:1606, offset: 0x00c3945f, size: 30 bytes, params: 1, frame: 13 return env0_0.apply(this, arguments); } 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 = 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); } } } } global.__d(_fun120083, 15663, [5, 6, 7, 15, 17, 18, 1878, 7902, 661, 3, 7903, 477, 12187, 3802, 683, 4860, 2]) /* metro module 15663, dependencies: [5, 6, 7, 15, 17, 18, 1878, 7902, 661, 3, 7903, 477, 12187, 3802, 683, 4860, 2] */;