mirror of
https://github.com/stablyai/orca.git
synced 2026-11-13 09:27:29 +00:00
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.
34 lines
1.3 KiB
JavaScript
34 lines
1.3 KiB
JavaScript
const fs = require('node:fs')
|
|
const path = require('node:path')
|
|
const { withAndroidManifest, withDangerousMod, AndroidConfig } = require('expo/config-plugins')
|
|
|
|
// allowBackup="false" stops cloud backup but not Android 12+ device-to-device transfer, which copies filesDir.
|
|
// Page builds are re-downloadable and belong to this phone's pairings, so a new phone starts without them.
|
|
module.exports = function withAndroidDeviceTransferRules(config) {
|
|
config = withDangerousMod(config, [
|
|
'android',
|
|
(cfg) => {
|
|
const folder = path.join(cfg.modRequest.platformProjectRoot, 'app/src/main/res/xml')
|
|
fs.mkdirSync(folder, { recursive: true })
|
|
fs.writeFileSync(
|
|
path.join(folder, 'data_extraction_rules.xml'),
|
|
[
|
|
'<?xml version="1.0" encoding="utf-8"?>',
|
|
'<data-extraction-rules>',
|
|
' <device-transfer>',
|
|
' <exclude domain="file" path="mobile-web/"/>',
|
|
' </device-transfer>',
|
|
'</data-extraction-rules>',
|
|
''
|
|
].join('\n')
|
|
)
|
|
return cfg
|
|
}
|
|
])
|
|
return withAndroidManifest(config, (cfg) => {
|
|
const application = AndroidConfig.Manifest.getMainApplicationOrThrow(cfg.modResults)
|
|
application.$['android:dataExtractionRules'] = '@xml/data_extraction_rules'
|
|
return cfg
|
|
})
|
|
}
|