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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user