11import { devOptStore } from '@/zustand/devOptStore'
22import profileStore from '@/zustand/profileStore'
3+ import versionStore from '@/zustand/versionStore'
34import {
45 BrushSolidIcon ,
56 BubbleChatSolidIcon ,
@@ -15,27 +16,30 @@ import {
1516 Logout02SolidIcon ,
1617 PolicySolidIcon ,
1718 ShieldUserSolidIcon ,
19+ SquareArrowUp02SolidIcon ,
1820 SquareLock02SolidIcon ,
1921 TelegramSolidIcon ,
2022 UserSolidIcon ,
2123 Wallet02SolidIcon ,
2224} from '@assets/icons/icons'
2325import { Gap12 , Gap20 } from '@components/Gap'
2426import RoundedIcon from '@components/RoundedIcon'
27+ import RoundNotification from '@components/RoundNotification'
2528import { PaddingBottom , PaddingTop } from '@components/SafePadding'
2629import Search from '@components/Search'
2730import { SettGroup , SettOption , SettText } from '@components/Settings'
28- import { TxtAcc } from '@components/Text'
31+ import { Txt , TxtAcc } from '@components/Text'
2932import { useIsFocused } from '@react-navigation/native'
3033import { Colors } from '@utils/colors'
31- import { APP_VERSION , APP_VERSION_CODE , ask_a_question , join_telegram_channel } from '@utils/data '
34+ import { APP_VERSION , APP_VERSION_CODE , ask_a_question , join_telegram_channel } from '@utils/constants '
3235import { Bold } from '@utils/fonts'
3336import { Caches , clearStorage , getStartWithSize , getStorageSize } from '@utils/storage'
3437import type { NavProp } from '@utils/types'
3538import { screenDelay , toReadableSize } from '@utils/utils'
3639import React , { useEffect } from 'react'
3740import { useColorScheme , View } from 'react-native'
3841import { ScrollView } from 'react-native-gesture-handler'
42+ import Animated , { FadeIn } from 'react-native-reanimated'
3943// function getTransparentCardStyle(scheme: ColorSchemeName) {
4044// return scheme === 'dark' ? 'aa' : '77'
4145// }
@@ -92,6 +96,7 @@ export default function Settings({ navigation }: NavProp) {
9296 Hello { user ?. name . split ( ' ' ) [ 0 ] } , Go to each section to customize your experience. All settings are saved
9397 automatically.
9498 </ SettText >
99+ < UpdateSettings navigation = { navigation } />
95100 < SettGroup title = 'General' >
96101 { /* <SettOption
97102 title='App Update'
@@ -284,3 +289,26 @@ function AdminSettings({ navigation }: NavProp) {
284289 </ Gap12 >
285290 )
286291}
292+
293+ function UpdateSettings ( { navigation } : NavProp ) {
294+ const version = versionStore ( ( state ) => state . version )
295+ const isNew = version ? APP_VERSION_CODE < version . versionCode : false
296+
297+ if ( ! isNew ) return null
298+
299+ return (
300+ < Gap12 >
301+ < Animated . View entering = { FadeIn } >
302+ < SettGroup >
303+ < SettOption
304+ title = { isNew ? 'Update available' : 'Check for updates' }
305+ Icon = { < RoundedIcon Icon = { SquareArrowUp02SolidIcon } /> }
306+ arrow
307+ onPress = { ( ) => version && navigation . navigate ( 'Update' , { shouldGoBack : true } ) }
308+ Right = { isNew ? < RoundNotification n = { 1 } /> : < Txt > { `v${ APP_VERSION } ` } </ Txt > }
309+ />
310+ </ SettGroup >
311+ </ Animated . View >
312+ </ Gap12 >
313+ )
314+ }
0 commit comments