decord/alpha/source/modules/cache/CacheManager.native.tsx
github-actions 97fd043558 chore: update source for alpha 347.5
Skipped 1 file(s) >100MB (GitHub limit): source/__polyfill/04xxx/module_4941.js (118.4 MB)
2026-09-19 06:52:51 +00:00

77 lines
2.7 KiB
TypeScript

// Module ID: 17734
// Function ID: 17735
// Name: CacheManager
// Dependencies: [5489, 7716, 3, 1091, 7358, 7888, 15844, 1364, 1094, 2]
// Module 17734 (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" /* 7888 */;
import GatewayConnectionStore from "GatewayConnectionStore" /* 5489 */;
import CacheStore from "CacheStore" /* 7716 */;
import AutomaticLifecycleManager from "AutomaticLifecycleManager" /* 7358 */;
const CacheActionCreators = tmp(15844);
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;