Files
orca/mobile/modules/orca-mobile-web-shell/src/generation-store-directory.ts
Kelvin Amoaba a4291dbc4a fix(mobile): keep page builds where the OS doesn't purge them (#40524)
iOS emptied Library/Caches under storage pressure, and Android's cacheDir is
cleared by Clear cache, cleaner apps and low storage. Each purge cost a full
foreground download of the page build on the next open. Builds now live in
Application Support (excluded from backup) on iOS and filesDir on Android
(kept off device transfers), and the old cache folder moves over once.
2026-11-09 23:35:43 +00:00

15 lines
579 B
TypeScript

import { requireOptionalNativeModule } from 'expo-modules-core'
// <name> under the app's durable storage (iOS Application Support, outside backups; Android filesDir) as a file URL.
// Null from a binary built before the function existed, or when the directory can't be made.
export function generationStoreDirectory(name: string): string | null {
const shell = requireOptionalNativeModule<{
generationStoreDirectory?: (name: string) => string
}>('OrcaMobileWebShell')
try {
return shell?.generationStoreDirectory?.(name) ?? null
} catch {
return null
}
}