/* Metro module 16152; source: modules/quests/managers/QuestFetchManager.tsx; dependencies: [6, 7, 15, 17, 18, 7093, 672, 9479, 9484, 1216, 477, 9493, 7108, 6531, 4860, 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 AutomaticLifecycleManager from '../../../lib/AutomaticLifecycleManager.tsx'; /* Metro dependency 4860 */ import QuestStore from '../QuestStore.tsx'; /* Metro dependency 7093 */ import * as FileImportTrackerModule from '../../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */ import * as QuestsEligibilityModule from '../lib/QuestsEligibility.tsx'; /* Metro dependency 9479 */ function _fun124815(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#124815, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16360:6, offset: 0x025c3cad, size: 414 bytes, params: 8, frame: 20 const env0_0 = require; const Object = global.Object; Object.defineProperty(exports, '__esModule', {value: true}); let Millis = (importDefault(672) /* metro dependency 672: Durations */).Millis; const env0_9 = Millis.DAY; Millis = (importDefault(672) /* metro dependency 672: Durations */).Millis; let MINUTE = Millis.MINUTE; const env0_10 = 30 * MINUTE; Millis = (importDefault(672) /* metro dependency 672: Durations */).Millis; const SECOND = Millis.SECOND; const env0_11 = 5 * SECOND; Millis = (importDefault(672) /* metro dependency 672: Durations */).Millis; MINUTE = Millis.MINUTE; const env0_12 = 5 * MINUTE; Millis = (importDefault(672) /* metro dependency 672: Durations */).Millis; Millis.HOUR; Millis = (importDefault(672) /* metro dependency 672: Durations */).Millis; MINUTE = Millis.MINUTE; const env0_13 = 5 * MINUTE; let value = AutomaticLifecycleManager; value = _fun124819(value); value = new value(); (FileImportTrackerModule).fileFinishedImporting('modules/quests/managers/QuestFetchManager.tsx'); exports.default = value; function _isNativeReflectConstruct_124816() { // fn#124816, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16360:158, offset: 0x025c3e4b, 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_124816_isNativeReflectConstruct = function() { return !!result; })(); } function _fun124819(a0) { // fn#124819, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16360:509, offset: 0x025c3ead, size: 72 bytes, params: 2, frame: 15 const QuestFetchManager2 = QuestFetchManager; Inherits(QuestFetchManager2, a0); return CreateClass(QuestFetchManager2, [{key: '_fetch', value: value_124829}]); function QuestFetchManager(a0) { // fn#124820, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16360:521, offset: 0x025c3ef5, size: 330 bytes, params: 2, frame: 21 var r0; var Reflect; let value = copyRestArgs(0, undefined); let binding = env1_3; binding(this, QuestFetchManager); const items2 = []; arraySpread(items2, value, 0, items2); value = env1_6(QuestFetchManager); binding = env1_5; if (_isNativeReflectConstruct_124816()) { Reflect = global.Reflect; value = Reflect.construct(value, items2, env1_6(this).constructor); r0 = value; } else { value = value.apply(this, items2); r0 = value; } value = binding(this, r0); const Date = global.Date; value.instantiatedAt = Date.now(); value.initialFetchTimerId = null; value.initialQuestHomeHeroFetchTimerId = null; value.recurringFetchTimerId = null; value.lastFetchAttemptedAt = 0; value.lastFetchedQuestForLocaleChangeAt = 0; value.handleQuestsFetchCurrentQuestsBegin = handleQuestsFetchCurrentQuestsBegin; value.handlePostConnectionOpen = handlePostConnectionOpen_124822; value.handleRunningGamesChange = function() { }; value.handleUserSettingsProtoUpdate = handleUserSettingsProtoUpdate_124827; value.handleLogout = handleLogout_124828; var handleQuestsFetchCurrentQuestsBegin = value.handleQuestsFetchCurrentQuestsBegin; value.actions = {QUESTS_FETCH_CURRENT_QUESTS_BEGIN: handleQuestsFetchCurrentQuestsBegin, POST_CONNECTION_OPEN: value.handlePostConnectionOpen, RUNNING_GAMES_CHANGE: value.handleRunningGamesChange, RUNNING_NON_GAMES_CHANGE: value.handleRunningGamesChange, USER_SETTINGS_PROTO_UPDATE: value.handleUserSettingsProtoUpdate, LOGOUT: value.handleLogout}; return value; function handleQuestsFetchCurrentQuestsBegin() { // fn#124821, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16360:983, owner: QuestFetchManager.handleQuestsFetchCurrentQuestsBegin, offset: 0x025c403f, size: 34 bytes, params: 1, frame: 10 const binding = env0_0; const Date = global.Date; binding.lastFetchAttemptedAt = Date.now(); } function QuestFetchManagerHandlePostConnectionOpen() { // fn#124822, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16360:1050, owner: QuestFetchManager.handlePostConnectionOpen, offset: 0x025c4061, size: 305 bytes, params: 1, frame: 19 let window = global.window; const clearTimeout = window.clearTimeout; const binding = env0_0; Reflect.apply(clearTimeout, window, [binding.initialFetchTimerId]); window = global.window; window.clearTimeout(binding.initialQuestHomeHeroFetchTimerId); window = global.window; window.clearTimeout(binding.recurringFetchTimerId); window = global.window; binding.recurringFetchTimerId = window.setInterval(_fun124823, env2_10); let Math = global.Math; const floor = Math.floor; const Math2 = global.Math; const value4 = Reflect.apply(floor, Math, [Math2.random() * env2_11]); binding.initialFetchTimerId = global.window.setTimeout(_fun124824, value4); const getIsEligibleForQuests = QuestsEligibilityModule.getIsEligibleForQuests; if (Reflect.apply(getIsEligibleForQuests, QuestsEligibilityModule, [])) { Math = global.Math; env0_0.initialQuestHomeHeroFetchTimerId = global.window.setTimeout(_fun124825, value4 + Math.floor(global.Math.random() * env2_11)); } function _fun124823() { // fn#124823, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16360:1243, offset: 0x025c4192, size: 70 bytes, params: 1, frame: 11 const Date = global.Date; let value = Date.now(); value -= env1_0.lastFetchAttemptedAt; if (value > DAY) { env1_0._fetch('post_connect_recurring'); } } function _fun124824() { // fn#124824, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16360:1403, offset: 0x025c41d8, size: 70 bytes, params: 1, frame: 11 const Date = global.Date; let value = Date.now(); value -= QuestStore.lastFetchedCurrentQuests; if (!(value <= env3_13)) { value = environment.__proto__; env1_0._fetch('post_connect_initial'); } } function _fun124825() { // fn#124825, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16360:1612, offset: 0x025c421e, size: 43 bytes, params: 1, frame: 11 var value; var property; var error; try { value = environment.__proto__.__proto__.__proto__; property = dependencyMap[8]; value = require(property); value.fetchQuestHomeHero(); } catch (error) { } } } function QuestFetchManagerHandleUserSettingsProtoUpdate({partial, settings, wasSaved}) { // fn#124827, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16360:1734, owner: QuestFetchManager.handleUserSettingsProtoUpdate, offset: 0x025c4249, size: 152 bytes, params: 2, frame: 12 var value4; var binding; let value = 'localization' in settings.proto; let r0 = value ? !partial : !value; r0 = !r0 ? wasSaved : r0; if (!r0) { value = global.Date.now(); value -= env0_0.lastFetchedQuestForLocaleChangeAt; value4 = environment.__proto__.__proto__; value = value <= env2_12; r0 = value; } if (!r0) { binding = env0_0; binding.lastFetchedQuestForLocaleChangeAt = global.Date.now(); binding._fetch('user_settings'); } } function QuestFetchManagerHandleLogout() { // fn#124828, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16360:1950, owner: QuestFetchManager.handleLogout, offset: 0x025c42e1, size: 96 bytes, params: 1, frame: 13 let window = global.window; const clearTimeout = window.clearTimeout; const binding = env0_0; Reflect.apply(clearTimeout, window, [binding.initialFetchTimerId]); window = global.window; window.clearTimeout(binding.initialQuestHomeHeroFetchTimerId); window = global.window; window.clearTimeout(binding.recurringFetchTimerId); binding.lastFetchAttemptedAt = 0; binding.lastFetchedQuestForLocaleChangeAt = 0; } } function value_124829(a0) { // fn#124829, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:16360:2549, offset: 0x025c4341, size: 391 bytes, params: 2, frame: 20 var r3; var questStoreBinding; var defaultImport; var addBreadcrumb; var object2; var lastFetchedCurrentQuests; var value4; var defaultImport3; let value = environment.__proto__; if ((require(9479) /* metro dependency 9479: QuestsEligibility */).getIsEligibleForQuests() && !QuestStore.isFetchingCurrentQuests) { defaultImport = importDefault(1216) /* metro dependency 1216: SentryUtilsNative */; addBreadcrumb = defaultImport.addBreadcrumb; object2 = {callerSource: a0}; questStoreBinding = QuestStore; object2.storeSize = questStoreBinding.quests.size; lastFetchedCurrentQuests = questStoreBinding.lastFetchedCurrentQuests; object2.lastFetchedCurrentQuests = lastFetchedCurrentQuests; value4 = global.Date.now(); lastFetchedCurrentQuests = questStoreBinding.lastFetchedCurrentQuests; object2.msSinceLastFetch = value4 - lastFetchedCurrentQuests; object2.isFetchingCurrentQuests = questStoreBinding.isFetchingCurrentQuests; Reflect.apply(addBreadcrumb, defaultImport, [{'category': 'quests.fetch', 'message': 'QuestFetchManager._fetch triggered', data: object2}]); (require(9484) /* metro dependency 9484: QuestActionCreators */).fetchCurrentQuests(); r3 = (require(477) /* metro dependency 477: PlatformUtils */).isMac() && (importDefault(9493) /* metro dependency 9493: DiscordAppStateNative */).getState() !== 'focused'; if (!r3) { defaultImport3 = importDefault(7108) /* metro dependency 7108: NewAdRequestBehaviorExperiment */; r3 = defaultImport3.getConfig({location: 'QuestFetchManager'}).enableNewRequestBehavior; } if (!r3) { value = require(9484) /* metro dependency 9484: QuestActionCreators */; value.fetchQuestToDeliver((require(6531) /* metro dependency 6531: QuestTypes */).QuestPlacement.MOBILE_HOME_DOCK_AREA, a0); } } } } } global.__d(_fun124815, 16152, [6, 7, 15, 17, 18, 7093, 672, 9479, 9484, 1216, 477, 9493, 7108, 6531, 4860, 2]) /* metro module 16152, dependencies: [6, 7, 15, 17, 18, 7093, 672, 9479, 9484, 1216, 477, 9493, 7108, 6531, 4860, 2] */;