Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions src/components/OtaUpdates/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import Animated, { useSharedValue, useAnimatedStyle, withTiming } from 'react-na
import DeviceInfo from 'react-native-device-info'
import { OTA_UPDATE_ENABLED } from '../../configs/config'
import { githubOTA, OTAUpdateManager, reloadApp, getStoredOtaVersion } from 'react-native-nitro-ota'
import { useAppSettingsStore } from '../../stores/settings/app'

const version = DeviceInfo.getVersion()

Expand Down Expand Up @@ -77,12 +78,14 @@ const GitUpdateModal = () => {
})
}

const userOtaEnabled = useAppSettingsStore((s) => s.enableOtaUpdates)

useEffect(() => {
if (__DEV__ || !OTA_UPDATE_ENABLED || isPRUpdate) {
if (__DEV__ || !OTA_UPDATE_ENABLED || isPRUpdate || !userOtaEnabled) {
return
}
onCheckGitVersion()
}, [])
}, [userOtaEnabled])

return null
return (
Expand Down
16 changes: 16 additions & 0 deletions src/components/Settings/components/preferences-tab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
ColorPreset,
ThemeSetting,
useColorPresetSetting,
useEnableOtaUpdatesSetting,
useHideRunTimesSetting,
useReducedHapticsSetting,
useSendMetricsSetting,
Expand Down Expand Up @@ -220,6 +221,7 @@ export default function PreferencesTab(): React.JSX.Element {
const [themeSetting, setThemeSetting] = useThemeSetting()
const [colorPreset, setColorPreset] = useColorPresetSetting()
const [hideRunTimes, setHideRunTimes] = useHideRunTimesSetting()
const [enableOtaUpdates, setEnableOtaUpdates] = useEnableOtaUpdatesSetting()

const left = useSwipeSettingsStore((s) => s.left)
const right = useSwipeSettingsStore((s) => s.right)
Expand Down Expand Up @@ -369,6 +371,20 @@ export default function PreferencesTab(): React.JSX.Element {
/>
),
},
{
title: 'OTA Updates',
iconName: enableOtaUpdates ? 'cloud-download' : 'cloud-off-outline',
iconColor: enableOtaUpdates ? '$success' : '$borderColor',
subTitle: 'Pull the latest JS bundle on launch',
children: (
<SwitchWithLabel
checked={enableOtaUpdates}
onCheckedChange={setEnableOtaUpdates}
size={'$2'}
label={enableOtaUpdates ? 'Enabled' : 'Disabled'}
/>
),
},
{
title: 'Send Analytics',
iconName: sendMetrics ? 'bug-check' : 'bug',
Expand Down
Loading
Loading