decord/alpha/source/modules/cache/CacheManager.native.tsx
github-actions c6aa9eb120 chore: update source for alpha 349.3
Skipped 1 file(s) >100MB (GitHub limit): source/__polyfill/05xxx/module_5030.js (118.4 MB)
2026-10-01 06:55:13 +00:00

77 lines
2.7 KiB
TypeScript

// Module ID: 17352
// Function ID: 17353
// Name: CacheManager
// Dependencies: [5775, 7084, 3, 1091, 6725, 7240, 15339, 1364, 1094, 2]
// Module 17352 (CacheManager)
import LoggerDefault from "Logger" /* 3 */;
import DurationsDefault from "Durations" /* 1091 */;
import ConstantsIOS from "ConstantsIOS" /* 1094 */;
import PlatformUtils from "PlatformUtils" /* 1364 */;
import KvCacheVersionDefault from "KvCacheVersion" /* 7240 */;
import GatewayConnectionStore from "GatewayConnectionStore" /* 5775 */;
import CacheStore from "CacheStore" /* 7084 */;
import AutomaticLifecycleManager from "AutomaticLifecycleManager" /* 6725 */;
const CacheActionCreators = tmp(15339);
require = fn;
let closure_5 = new LoggerDefault("CacheStore");
let closure_6 = 15 * DurationsDefault.Millis.MINUTE;
class CacheManager extends tmp3 {
constructor() {
applyArgumentsResult = HermesBuiltin.applyArguments(new.target, new.target);
closure_0 = applyArgumentsResult;
applyArgumentsResult.actions = {
POST_CONNECTION_OPEN: applyArgumentsResult.handleConnectionOpen,
CONNECTION_CLOSED: applyArgumentsResult.handleConnectionClose,
APP_STATE_UPDATE(arg0) {
return applyArgumentsResult.handleAppStateUpdate(arg0);
},
WINDOW_FOCUS(arg0) {
return applyArgumentsResult.handleWindowFocus(arg0);
}
};
return applyArgumentsResult;
}
}
const prototype = CacheManager.prototype;
prototype["handleConnectionOpen"] = function handleConnectionOpen() {
const result = KvCacheVersionDefault.doesDatabaseVersionMatchJsConstants();
result.then((result) => {
if (!result) {
CacheActionCreators.writeCaches();
}
});
};
prototype["handleConnectionClose"] = function handleConnectionClose() {
return false;
};
prototype["handleAppStateUpdate"] = function handleAppStateUpdate(state) {
const AppStates = ConstantsIOS.AppStates;
let isConnectedResult = (PlatformUtils.isAndroid() ? AppStates.BACKGROUND : AppStates.INACTIVE) === state.state;
if (isConnectedResult) {
isConnectedResult = GatewayConnectionStore.isConnected();
}
if (isConnectedResult) {
CacheActionCreators.writeCaches();
const tmpResult = CacheActionCreators;
}
return false;
};
prototype["handleWindowFocus"] = function handleWindowFocus(focused) {
if (!focused.focused) {
const _Date = Date;
if (Date.now() - CacheStore.lastWriteTime > closure_6) {
closure_5.verbose("Writing cache from window unfocus");
CacheActionCreators.writeCaches();
} else {
closure_5.verbose("Not writing cache from window unfocus");
}
}
return false;
};
const cacheManager = new CacheManager();
const size = fn(2);
let result = size.fileFinishedImporting("modules/cache/CacheManager.native.tsx");
export default cacheManager;