Files
discord-decomp/sources/modules/cache/CacheManager.native.tsx
T
2026-07-27 16:20:00 +03:00

138 lines
6.5 KiB
TypeScript

/* 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] */
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});
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 gatewayConnectionStore = importDefault(4257) /* metro dependency 4257: GatewayConnectionStore */;
const cacheStore = importDefault(4885) /* metro dependency 4885: CacheStore */;
let value = importDefault(3) /* metro dependency 3: Logger */;
value = new value('CacheStore');
const Millis = (importDefault(672) /* metro dependency 672: Durations */).Millis;
const MINUTE = Millis.MINUTE;
const env0_11 = 15 * MINUTE;
value = importDefault(4860) /* metro dependency 4860: AutomaticLifecycleManager */;
value = _fun120222(value);
value = new value();
(require(2) /* metro dependency 2 */).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 closure = CacheManager;
env0_7(closure, a0);
return env0_4(closure, [{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 items = [];
arraySpread(items, value, 0, items);
value = env1_6(CacheManager);
binding = env1_5;
if (_isNativeReflectConstruct_120219()) {
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 = {POST_CONNECTION_OPEN: value.handleConnectionOpen, CONNECTION_CLOSED: value.handleConnectionClose,
APP_STATE_UPDATE: APP_STATE_UPDATE_120224, WINDOW_FOCUS: WINDOW_FOCUS_120225};
return value;
}
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 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 = (require(477) /* metro dependency 477: PlatformUtils */).isAndroid();
const AppStates = (require(676) /* metro dependency 676: ConstantsIOS */).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;
}
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 _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();
}
}