diff --git a/assets/icons/broomSparkle_stroke2_corner2_rounded.svg b/assets/icons/broomSparkle_stroke2_corner2_rounded.svg
new file mode 100644
index 0000000000..5c09fa1a3c
--- /dev/null
+++ b/assets/icons/broomSparkle_stroke2_corner2_rounded.svg
@@ -0,0 +1 @@
+
diff --git a/src/components/icons/BroomSparkle.tsx b/src/components/icons/BroomSparkle.tsx
new file mode 100644
index 0000000000..866efcfcd6
--- /dev/null
+++ b/src/components/icons/BroomSparkle.tsx
@@ -0,0 +1,5 @@
+import {createSinglePathSVG} from './TEMPLATE'
+
+export const BroomSparkle_Stroke2_Corner2_Rounded = createSinglePathSVG({
+ path: 'M20.494 2.13a1 1 0 0 1 .375 1.364l-4.658 8.2.263.095c1.52.554 2.737 2.062 2.484 3.864-.336 2.393-1.358 4.12-3.245 6.047a1 1 0 0 1-1.102.222l-9.5-4a1 1 0 0 1-.166-1.754c1.458-.971 2.623-1.923 3.498-3.3 1.057-1.662 3.154-2.854 5.281-2.08l.58.212 4.827-8.494a1 1 0 0 1 1.363-.375ZM13.04 12.669c-.983-.358-2.19.142-2.91 1.273-.737 1.16-1.628 2.054-2.601 2.828l1.708.72a.2.2 0 0 0 .177-.011l2.13-1.218a.2.2 0 0 1 .29.237l-.551 1.653a.2.2 0 0 0 .112.247l3.353 1.413c1.359-1.494 1.994-2.76 2.23-4.435.094-.675-.359-1.405-1.188-1.707l-2.75-1ZM4.407 7.184a.5.5 0 0 1-.224.224l-1.29.645a.5.5 0 0 0 0 .894l1.29.645a.5.5 0 0 1 .224.224l.645 1.29a.5.5 0 0 0 .894 0l.645-1.29a.5.5 0 0 1 .224-.224l1.29-.645a.5.5 0 0 0 0-.894l-1.29-.645a.5.5 0 0 1-.224-.224l-.645-1.29a.5.5 0 0 0-.894 0l-.645 1.29ZM9.559 3.72a.36.36 0 0 0 .16-.16l.46-.921a.357.357 0 0 1 .64 0l.46.921q.054.106.16.16l.921.46a.357.357 0 0 1 0 .64l-.921.46a.36.36 0 0 0-.16.16l-.46.921a.357.357 0 0 1-.64 0l-.46-.921a.36.36 0 0 0-.16-.16l-.921-.46a.357.357 0 0 1 0-.64l.921-.46Z',
+})
diff --git a/src/screens/Settings/AboutSettings.tsx b/src/screens/Settings/AboutSettings.tsx
index e174c09e56..e262425504 100644
--- a/src/screens/Settings/AboutSettings.tsx
+++ b/src/screens/Settings/AboutSettings.tsx
@@ -1,30 +1,68 @@
import {useMemo} from 'react'
import {Platform} from 'react-native'
import {setStringAsync} from 'expo-clipboard'
+import * as FileSystem from 'expo-file-system'
+import {Image} from 'expo-image'
import {msg, Trans} from '@lingui/macro'
import {useLingui} from '@lingui/react'
-import {NativeStackScreenProps} from '@react-navigation/native-stack'
+import {type NativeStackScreenProps} from '@react-navigation/native-stack'
+import {useMutation} from '@tanstack/react-query'
import {Statsig} from 'statsig-react-native-expo'
import {appVersion, BUNDLE_DATE, bundleInfo} from '#/lib/app-info'
import {STATUS_PAGE_URL} from '#/lib/constants'
-import {CommonNavigatorParams} from '#/lib/routes/types'
+import {type CommonNavigatorParams} from '#/lib/routes/types'
+import {isAndroid, isNative} from '#/platform/detection'
import {useDevModeEnabled} from '#/state/preferences/dev-mode'
import * as Toast from '#/view/com/util/Toast'
import * as SettingsList from '#/screens/Settings/components/SettingsList'
+import {BroomSparkle_Stroke2_Corner2_Rounded as BroomSparkleIcon} from '#/components/icons/BroomSparkle'
import {CodeLines_Stroke2_Corner2_Rounded as CodeLinesIcon} from '#/components/icons/CodeLines'
import {Globe_Stroke2_Corner0_Rounded as GlobeIcon} from '#/components/icons/Globe'
import {Newspaper_Stroke2_Corner2_Rounded as NewspaperIcon} from '#/components/icons/Newspaper'
import {Wrench_Stroke2_Corner2_Rounded as WrenchIcon} from '#/components/icons/Wrench'
import * as Layout from '#/components/Layout'
+import {Loader} from '#/components/Loader'
import {OTAInfo} from './components/OTAInfo'
type Props = NativeStackScreenProps
export function AboutSettingsScreen({}: Props) {
- const {_} = useLingui()
+ const {_, i18n} = useLingui()
const [devModeEnabled, setDevModeEnabled] = useDevModeEnabled()
const stableID = useMemo(() => Statsig.getStableID(), [])
+ const {mutate: onClearImageCache, isPending: isClearingImageCache} =
+ useMutation({
+ mutationFn: async () => {
+ const freeSpaceBefore = await FileSystem.getFreeDiskStorageAsync()
+ await Image.clearDiskCache()
+ const freeSpaceAfter = await FileSystem.getFreeDiskStorageAsync()
+ const spaceDiff = freeSpaceBefore - freeSpaceAfter
+ return spaceDiff * -1
+ },
+ onSuccess: sizeDiffBytes => {
+ if (isAndroid) {
+ Toast.show(
+ _(
+ msg({
+ message: `Image cache cleared, freed ${i18n.number(
+ Math.abs(sizeDiffBytes / 1024 / 1024),
+ {
+ notation: 'compact',
+ style: 'unit',
+ unit: 'megabyte',
+ },
+ )}`,
+ comment: `Android-only toast message which includes amount of space freed using localized number formatting`,
+ }),
+ ),
+ )
+ } else {
+ Toast.show(_(msg`Image cache cleared`))
+ }
+ },
+ })
+
return (
@@ -69,6 +107,18 @@ export function AboutSettingsScreen({}: Props) {
System log
+ {isNative && (
+ onClearImageCache()}
+ label={_(msg`Clear image cache`)}
+ disabled={isClearingImageCache}>
+
+
+ Clear image cache
+
+ {isClearingImageCache && }
+
+ )}