diff options
author | Samuel Newman <mozzius@protonmail.com> | 2025-08-24 01:18:02 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-08-24 01:18:02 +0300 |
commit | ce2604d0e992618fcc590ccfc836e4b5b9bb8962 (patch) | |
tree | a941f55bd00d4af2873cf2713951a1df1a1311c1 /src/screens | |
parent | c28195067f27fb02de1ae471c4f86aab660b45ce (diff) | |
download | voidsky-ce2604d0e992618fcc590ccfc836e4b5b9bb8962.tar.zst |
Update `@mozzius/expo-dynamic-app-icon` (#8834)
Diffstat (limited to 'src/screens')
-rw-r--r-- | src/screens/Settings/AppIconSettings/index.tsx | 16 | ||||
-rw-r--r-- | src/screens/Settings/AppIconSettings/types.ts | 5 | ||||
-rw-r--r-- | src/screens/Settings/AppIconSettings/useAppIconSets.ts | 10 | ||||
-rw-r--r-- | src/screens/Settings/AppearanceSettings.tsx | 4 |
4 files changed, 22 insertions, 13 deletions
diff --git a/src/screens/Settings/AppIconSettings/index.tsx b/src/screens/Settings/AppIconSettings/index.tsx index 799873c2d..953ae2e60 100644 --- a/src/screens/Settings/AppIconSettings/index.tsx +++ b/src/screens/Settings/AppIconSettings/index.tsx @@ -28,7 +28,7 @@ export function AppIconSettingsScreen({}: Props) { getAppIconName(DynamicAppIcon.getAppIcon()), ) - const onSetAppIcon = (icon: string) => { + const onSetAppIcon = (icon: DynamicAppIcon.IconName) => { if (isAndroid) { const next = sets.defaults.find(i => i.id === icon) ?? @@ -37,7 +37,7 @@ export function AppIconSettingsScreen({}: Props) { next ? _(msg`Change app icon to "${next.name}"`) : _(msg`Change app icon`), - // to determine - can we stop this happening? -sfn + // unfortunately necessary -sfn _(msg`The app will be restarted`), [ { @@ -119,7 +119,7 @@ export function AppIconSettingsScreen({}: Props) { ) } -function setAppIcon(icon: string) { +function setAppIcon(icon: DynamicAppIcon.IconName) { if (icon === 'default_light') { return getAppIconName(DynamicAppIcon.setAppIcon(null)) } else { @@ -127,11 +127,11 @@ function setAppIcon(icon: string) { } } -function getAppIconName(icon: string | false) { +function getAppIconName(icon: string | false): DynamicAppIcon.IconName { if (!icon || icon === 'DEFAULT') { return 'default_light' } else { - return icon + return icon as DynamicAppIcon.IconName } } @@ -143,8 +143,8 @@ function Group({ }: { children: React.ReactNode label: string - value: string - onChange: (value: string) => void + value: DynamicAppIcon.IconName + onChange: (value: DynamicAppIcon.IconName) => void }) { return ( <Toggle.Group @@ -153,7 +153,7 @@ function Group({ values={[value]} maxSelections={1} onChange={vals => { - if (vals[0]) onChange(vals[0]) + if (vals[0]) onChange(vals[0] as DynamicAppIcon.IconName) }}> <View style={[a.flex_1, a.rounded_md, a.overflow_hidden]}> {children} diff --git a/src/screens/Settings/AppIconSettings/types.ts b/src/screens/Settings/AppIconSettings/types.ts index 5010f6f02..02c2791dc 100644 --- a/src/screens/Settings/AppIconSettings/types.ts +++ b/src/screens/Settings/AppIconSettings/types.ts @@ -1,7 +1,8 @@ -import {ImageSourcePropType} from 'react-native' +import {type ImageSourcePropType} from 'react-native' +import type * as DynamicAppIcon from '@mozzius/expo-dynamic-app-icon' export type AppIconSet = { - id: string + id: DynamicAppIcon.IconName name: string iosImage: () => ImageSourcePropType androidImage: () => ImageSourcePropType diff --git a/src/screens/Settings/AppIconSettings/useAppIconSets.ts b/src/screens/Settings/AppIconSettings/useAppIconSets.ts index fd3caeb30..f7d191f77 100644 --- a/src/screens/Settings/AppIconSettings/useAppIconSets.ts +++ b/src/screens/Settings/AppIconSettings/useAppIconSets.ts @@ -37,6 +37,16 @@ export function useAppIconSets() { ) }, }, + { + id: 'next', + name: _(msg({context: 'Name of app icon variant', message: 'Next'})), + iosImage: () => { + return require(`../../../../assets/app-icons/icon_default_next.png`) + }, + androidImage: () => { + return require(`../../../../assets/app-icons/icon_default_next.png`) + }, + }, ] satisfies AppIconSet[] /** diff --git a/src/screens/Settings/AppearanceSettings.tsx b/src/screens/Settings/AppearanceSettings.tsx index 492d6d172..5d597ff8e 100644 --- a/src/screens/Settings/AppearanceSettings.tsx +++ b/src/screens/Settings/AppearanceSettings.tsx @@ -12,7 +12,6 @@ import { type CommonNavigatorParams, type NativeStackScreenProps, } from '#/lib/routes/types' -import {useGate} from '#/lib/statsig/statsig' import {isNative} from '#/platform/detection' import {useSetThemePrefs, useThemePrefs} from '#/state/shell' import {SettingsListItem as AppIconSettingsListItem} from '#/screens/Settings/AppIconSettings/SettingsListItem' @@ -32,7 +31,6 @@ type Props = NativeStackScreenProps<CommonNavigatorParams, 'AppearanceSettings'> export function AppearanceSettingsScreen({}: Props) { const {_} = useLingui() const {fonts} = useAlf() - const gate = useGate() const {colorMode, darkTheme} = useThemePrefs() const {setColorMode, setDarkTheme} = useSetThemePrefs() @@ -180,7 +178,7 @@ export function AppearanceSettingsScreen({}: Props) { onChange={onChangeFontScale} /> - {isNative && IS_INTERNAL && gate('debug_subscriptions') && ( + {isNative && IS_INTERNAL && ( <> <SettingsList.Divider /> <AppIconSettingsListItem /> |