2026-10-12 06:59:38 +00:00
|
|
|
// Module ID: 18060
|
|
|
|
|
// Function ID: 18061
|
2026-09-10 05:38:07 +00:00
|
|
|
// Name: CacheManager
|
2026-10-12 06:59:38 +00:00
|
|
|
// Dependencies: [5757, 7198, 3, 1102, 6808, 7343, 15876, 1382, 1105, 2]
|
2026-07-20 16:05:17 +00:00
|
|
|
|
2026-10-12 06:59:38 +00:00
|
|
|
// Module 18060 (CacheManager)
|
2026-09-10 05:38:07 +00:00
|
|
|
import LoggerDefault from "Logger" /* 3 */;
|
2026-10-03 08:58:59 +00:00
|
|
|
import DurationsDefault from "Durations" /* 1102 */;
|
|
|
|
|
import ConstantsIOS from "ConstantsIOS" /* 1105 */;
|
2026-10-09 10:00:15 +00:00
|
|
|
import PlatformUtils from "PlatformUtils" /* 1382 */;
|
2026-10-12 06:59:38 +00:00
|
|
|
import KvCacheVersionDefault from "KvCacheVersion" /* 7343 */;
|
2026-10-10 08:08:14 +00:00
|
|
|
import GatewayConnectionStore from "GatewayConnectionStore" /* 5757 */;
|
2026-10-12 06:59:38 +00:00
|
|
|
import CacheStore from "CacheStore" /* 7198 */;
|
|
|
|
|
import AutomaticLifecycleManager from "AutomaticLifecycleManager" /* 6808 */;
|
2026-10-03 08:58:59 +00:00
|
|
|
import size from "module_2" /* 2 */;
|
2026-07-23 10:11:24 +00:00
|
|
|
|
2026-10-03 08:58:59 +00:00
|
|
|
let tmp;
|
2026-10-12 06:59:38 +00:00
|
|
|
const CacheActionCreators = tmp(15876);
|
2026-10-03 08:58:59 +00:00
|
|
|
const hasOwnProperty = new LoggerDefault("CacheStore");
|
|
|
|
|
const tmp2 = new LoggerDefault("CacheStore");
|
2026-09-10 05:38:07 +00:00
|
|
|
let closure_6 = 15 * DurationsDefault.Millis.MINUTE;
|
2026-10-03 08:58:59 +00:00
|
|
|
class CacheManager extends AutomaticLifecycleManager {
|
2026-07-29 08:29:29 +00:00
|
|
|
constructor() {
|
2026-10-03 08:58:59 +00:00
|
|
|
const applyArgumentsResult = HermesBuiltin.applyArguments(this, new.target);
|
2026-07-29 08:29:29 +00:00
|
|
|
applyArgumentsResult.actions = {
|
|
|
|
|
POST_CONNECTION_OPEN: applyArgumentsResult.handleConnectionOpen,
|
|
|
|
|
CONNECTION_CLOSED: applyArgumentsResult.handleConnectionClose,
|
|
|
|
|
APP_STATE_UPDATE(arg0) {
|
2026-10-03 08:58:59 +00:00
|
|
|
return applyArgumentsResult.handleAppStateUpdate(arg0);
|
|
|
|
|
},
|
2026-07-29 08:29:29 +00:00
|
|
|
WINDOW_FOCUS(arg0) {
|
2026-10-03 08:58:59 +00:00
|
|
|
return applyArgumentsResult.handleWindowFocus(arg0);
|
|
|
|
|
}
|
2026-07-29 08:29:29 +00:00
|
|
|
};
|
|
|
|
|
return applyArgumentsResult;
|
2026-07-20 16:05:17 +00:00
|
|
|
}
|
2026-10-03 08:58:59 +00:00
|
|
|
handleConnectionOpen() {
|
|
|
|
|
let obj = KvCacheVersionDefault;
|
|
|
|
|
const result = obj.doesDatabaseVersionMatchJsConstants();
|
|
|
|
|
result.then((result) => {
|
|
|
|
|
const tmp = result;
|
|
|
|
|
if (!tmp) {
|
|
|
|
|
const obj = CacheActionCreators;
|
|
|
|
|
obj.writeCaches();
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
handleConnectionClose() {
|
|
|
|
|
return false;
|
2026-07-29 08:29:29 +00:00
|
|
|
}
|
2026-10-03 08:58:59 +00:00
|
|
|
handleAppStateUpdate(state) {
|
|
|
|
|
state = state.state;
|
|
|
|
|
const obj = PlatformUtils;
|
|
|
|
|
const isAndroidResult = obj.isAndroid();
|
|
|
|
|
const AppStates = ConstantsIOS.AppStates;
|
|
|
|
|
let isConnectedResult = (isAndroidResult ? AppStates.BACKGROUND : AppStates.INACTIVE) === state;
|
|
|
|
|
if (isConnectedResult) {
|
|
|
|
|
isConnectedResult = GatewayConnectionStore.isConnected();
|
|
|
|
|
}
|
|
|
|
|
if (isConnectedResult) {
|
|
|
|
|
const tmpResult = CacheActionCreators;
|
|
|
|
|
tmpResult.writeCaches();
|
|
|
|
|
}
|
|
|
|
|
return false;
|
2026-07-29 08:29:29 +00:00
|
|
|
}
|
2026-10-03 08:58:59 +00:00
|
|
|
handleWindowFocus(focused) {
|
|
|
|
|
if (!focused.focused) {
|
|
|
|
|
const _Date = Date;
|
|
|
|
|
if (Date.now() - CacheStore.lastWriteTime > closure_6) {
|
|
|
|
|
closure_5.verbose("Writing cache from window unfocus");
|
|
|
|
|
const obj = CacheActionCreators;
|
|
|
|
|
obj.writeCaches();
|
|
|
|
|
} else {
|
|
|
|
|
closure_5.verbose("Not writing cache from window unfocus");
|
|
|
|
|
}
|
2026-07-29 08:29:29 +00:00
|
|
|
}
|
2026-10-03 08:58:59 +00:00
|
|
|
return false;
|
2026-07-29 08:29:29 +00:00
|
|
|
}
|
2026-10-03 08:58:59 +00:00
|
|
|
}
|
|
|
|
|
const prototype = CacheManager.prototype;
|
2026-07-29 08:29:29 +00:00
|
|
|
const cacheManager = new CacheManager();
|
2026-09-10 05:38:07 +00:00
|
|
|
let result = size.fileFinishedImporting("modules/cache/CacheManager.native.tsx");
|
2026-07-20 16:05:17 +00:00
|
|
|
|
2026-07-29 08:29:29 +00:00
|
|
|
export default cacheManager;
|