/* Metro module 15673; source: modules/cache/CacheManager.native.tsx; dependencies: [6, 7, 15, 17, 18, 4257, 4885, 3, 672, 5238, 13965, 477, 676, 4860, 2] */ import Logger from '../debug/Logger.tsx'; /* Metro dependency 3 */ 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 Durations from '../../utils/Durations.tsx'; /* Metro dependency 672 */ import GatewayConnectionStore from '../gateway/GatewayConnectionStore.tsx'; /* Metro dependency 4257 */ import CacheStore from './CacheStore.tsx'; /* Metro dependency 4885 */ import * as FileImportTrackerModule from '../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */ import * as PlatformUtilsModule from '../../utils/PlatformUtils.tsx'; /* Metro dependency 477 */ import * as ConstantsIOSModule from '../../ConstantsIOS.tsx'; /* Metro dependency 676 */ function _fun120218(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#120218, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15881:6, offset: 0x02524c6c, size: 339 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('CacheStore'); const Millis = (Durations).Millis; const MINUTE = Millis.MINUTE; const env0_11 = 15 * MINUTE; value = importDefault(4860) /* metro dependency 4860: AutomaticLifecycleManager */; value = _fun120222(value); value = new value(); (FileImportTrackerModule).fileFinishedImporting('modules/cache/CacheManager.native.tsx'); exports.default = value; function _isNativeReflectConstruct_120219() { // fn#120219, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15881:168, offset: 0x02524dbf, 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_120219_isNativeReflectConstruct = function() { return !!result; })(); } function _fun120222(a0) { // fn#120222, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15881:427, offset: 0x02524e21, size: 149 bytes, params: 2, frame: 16 const CacheManager2 = CacheManager; Inherits(CacheManager2, a0); return CreateClass(CacheManager2, [{key: 'handleConnectionOpen', value: value_120226}, {key: 'handleConnectionClose', value: function() { return false; }}, {key: 'handleAppStateUpdate', value: value_120229}, {key: 'handleWindowFocus', value: value_120230}]); function CacheManager(a0) { // fn#120223, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15881:439, offset: 0x02524eb6, size: 188 bytes, params: 2, frame: 20 var r0; var Reflect; let value = copyRestArgs(0, undefined); let binding = env1_3; binding(this, CacheManager); const items2 = []; arraySpread(items2, value, 0, items2); value = env1_6(CacheManager); binding = env1_5; if (_isNativeReflectConstruct_120219()) { 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); value.actions = {POST_CONNECTION_OPEN: value.handleConnectionOpen, CONNECTION_CLOSED: value.handleConnectionClose, APP_STATE_UPDATE: APP_STATE_UPDATE_120224, WINDOW_FOCUS: WINDOW_FOCUS_120225}; return value; function CacheManagerAPP_STATE_UPDATE(a0) { // fn#120224, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15881:775, owner: CacheManager.APP_STATE_UPDATE, offset: 0x0114875f, size: 23 bytes, params: 2, frame: 11 return env0_0.handleAppStateUpdate(a0); } function CacheManagerWINDOW_FOCUS(a0) { // fn#120225, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15881:817, owner: CacheManager.WINDOW_FOCUS, offset: 0x02524f72, size: 23 bytes, params: 2, frame: 11 return env0_0.handleWindowFocus(a0); } } function value_120226() { // fn#120226, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15881:921, offset: 0x02524f89, size: 56 bytes, params: 1, frame: 12 var environment; let value = environment.__proto__; value = importDefault(5238) /* metro dependency 5238: KvCacheVersion */; value = value.doesDatabaseVersionMatchJsConstants(); value.then(_fun120227); function _fun120227(a0) { // fn#120227, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15881:984, offset: 0x02524fc1, size: 45 bytes, params: 2, frame: 11 var value; if (!a0) { value = environment.__proto__.__proto__; value = require(13965) /* metro dependency 13965: CacheActionCreators */; value.writeCaches(); } } } function value_120229({state}) { // fn#120229, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15881:1110, offset: 0x02524fee, size: 144 bytes, params: 2, frame: 15 const value = environment.__proto__; const isAndroid2 = (PlatformUtilsModule).isAndroid(); const AppStates = (ConstantsIOSModule).AppStates; let r1 = isAndroid2 ? AppStates.BACKGROUND : AppStates.INACTIVE; r1 = r1 === state && GatewayConnectionStore.isConnected(); if (r1) { (require(13965) /* metro dependency 13965: CacheActionCreators */).writeCaches(); } return false; } function value_120230(a0) { // fn#120230, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15881:1298, offset: 0x0252507e, size: 136 bytes, params: 2, frame: 12 var value; var value2; if (!a0.focused) { value = global.Date.now(); value2 = environment.__proto__; value -= CacheStore.lastWriteTime; if (value > env1_11) { env1_10.verbose('Writing cache from window unfocus'); (require(13965) /* metro dependency 13965: CacheActionCreators */).writeCaches(); } else { env1_10.verbose('Not writing cache from window unfocus'); } } return false; } } } global.__d(_fun120218, 15673, [6, 7, 15, 17, 18, 4257, 4885, 3, 672, 5238, 13965, 477, 676, 4860, 2]) /* metro module 15673, dependencies: [6, 7, 15, 17, 18, 4257, 4885, 3, 672, 5238, 13965, 477, 676, 4860, 2] */;