2026-10-02 13:37:24 +00:00
|
|
|
// Module ID: 17109
|
|
|
|
|
// Function ID: 17110
|
2026-09-18 19:45:33 +00:00
|
|
|
// Name: CacheManager
|
2026-10-02 13:37:24 +00:00
|
|
|
// Dependencies: [5590, 6900, 3, 1103, 6540, 7071, 15114, 1370, 1106, 2]
|
2026-09-18 19:45:33 +00:00
|
|
|
|
2026-10-02 13:37:24 +00:00
|
|
|
// Module 17109 (CacheManager)
|
2026-09-18 19:45:33 +00:00
|
|
|
import LoggerDefault from "Logger" /* 3 */;
|
2026-10-02 13:37:24 +00:00
|
|
|
import DurationsDefault from "Durations" /* 1103 */;
|
|
|
|
|
import ConstantsIOS from "ConstantsIOS" /* 1106 */;
|
|
|
|
|
import PlatformUtils from "PlatformUtils" /* 1370 */;
|
|
|
|
|
import KvCacheVersionDefault from "KvCacheVersion" /* 7071 */;
|
|
|
|
|
import GatewayConnectionStore from "GatewayConnectionStore" /* 5590 */;
|
|
|
|
|
import CacheStore from "CacheStore" /* 6900 */;
|
|
|
|
|
import AutomaticLifecycleManager from "AutomaticLifecycleManager" /* 6540 */;
|
2026-10-01 14:13:23 +00:00
|
|
|
import size from "module_2" /* 2 */;
|
2026-09-18 19:45:33 +00:00
|
|
|
|
2026-10-01 14:13:23 +00:00
|
|
|
let tmp;
|
2026-10-02 13:37:24 +00:00
|
|
|
const CacheActionCreators = tmp(15114);
|
2026-10-01 14:13:23 +00:00
|
|
|
const hasOwnProperty = new LoggerDefault("CacheStore");
|
|
|
|
|
const tmp2 = new LoggerDefault("CacheStore");
|
2026-09-18 19:45:33 +00:00
|
|
|
let closure_6 = 15 * DurationsDefault.Millis.MINUTE;
|
2026-10-01 14:13:23 +00:00
|
|
|
class CacheManager extends AutomaticLifecycleManager {
|
2026-09-18 19:45:33 +00:00
|
|
|
constructor() {
|
2026-10-01 14:13:23 +00:00
|
|
|
const applyArgumentsResult = HermesBuiltin.applyArguments(this, new.target);
|
2026-09-18 19:45:33 +00:00
|
|
|
applyArgumentsResult.actions = {
|
|
|
|
|
POST_CONNECTION_OPEN: applyArgumentsResult.handleConnectionOpen,
|
|
|
|
|
CONNECTION_CLOSED: applyArgumentsResult.handleConnectionClose,
|
|
|
|
|
APP_STATE_UPDATE(arg0) {
|
2026-10-01 14:13:23 +00:00
|
|
|
return applyArgumentsResult.handleAppStateUpdate(arg0);
|
|
|
|
|
},
|
2026-09-18 19:45:33 +00:00
|
|
|
WINDOW_FOCUS(arg0) {
|
2026-10-01 14:13:23 +00:00
|
|
|
return applyArgumentsResult.handleWindowFocus(arg0);
|
|
|
|
|
}
|
2026-09-18 19:45:33 +00:00
|
|
|
};
|
|
|
|
|
return applyArgumentsResult;
|
|
|
|
|
}
|
2026-10-01 14:13:23 +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-09-18 19:45:33 +00:00
|
|
|
}
|
2026-10-01 14:13:23 +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-09-18 19:45:33 +00:00
|
|
|
}
|
2026-10-01 14:13:23 +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-09-18 19:45:33 +00:00
|
|
|
}
|
2026-10-01 14:13:23 +00:00
|
|
|
return false;
|
2026-09-18 19:45:33 +00:00
|
|
|
}
|
2026-10-01 14:13:23 +00:00
|
|
|
}
|
|
|
|
|
const prototype = CacheManager.prototype;
|
2026-09-18 19:45:33 +00:00
|
|
|
const cacheManager = new CacheManager();
|
|
|
|
|
let result = size.fileFinishedImporting("modules/cache/CacheManager.native.tsx");
|
|
|
|
|
|
|
|
|
|
export default cacheManager;
|