Clean up media-upload temp files on iOS (#11007)

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
So Asano
2026-07-06 23:18:00 +09:00
committed by GitHub
parent be0fbdff82
commit e5d2ee3315
2 changed files with 32 additions and 2 deletions
+8 -1
View File
@@ -10,6 +10,7 @@ import {useMutation} from '@tanstack/react-query'
import {STATUS_PAGE_URL} from '#/lib/constants'
import {type CommonNavigatorParams} from '#/lib/routes/types'
import {purgeTemporaryImageFiles} from '#/state/gallery'
import * as SettingsList from '#/screens/Settings/components/SettingsList'
import {Atom_Stroke2_Corner0_Rounded as AtomIcon} from '#/components/icons/Atom'
import {BroomSparkle_Stroke2_Corner2_Rounded as BroomSparkleIcon} from '#/components/icons/BroomSparkle'
@@ -41,7 +42,13 @@ export function AboutSettingsScreen({}: Props) {
useMutation({
mutationFn: async () => {
const freeSpaceBefore = await FileSystem.getFreeDiskStorageAsync()
await Image.clearDiskCache()
await Promise.all([
// expo-image's disk cache
Image.clearDiskCache(),
// full-resolution media-upload leftovers (picker/manipulator copies);
// the only in-app way for iOS users to reclaim this space
purgeTemporaryImageFiles(),
])
const freeSpaceAfter = await FileSystem.getFreeDiskStorageAsync()
const spaceDiff = freeSpaceBefore - freeSpaceAfter
return spaceDiff * -1