mirror of
https://github.com/Jellify-Music/App.git
synced 2026-03-17 10:40:38 -05:00
fix: commits
This commit is contained in:
@@ -13,6 +13,8 @@ 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 { storage } from '../../constants/storage'
|
||||
import { MMKVStorageKeys } from '../../enums/mmkv-storage-keys'
|
||||
|
||||
const version = DeviceInfo.getVersion()
|
||||
|
||||
@@ -27,6 +29,8 @@ const { downloadUrl, versionUrl } = githubOTA({
|
||||
const otaVersion = getStoredOtaVersion()
|
||||
const isPRUpdate = otaVersion ? otaVersion.startsWith('PULL_REQUEST') : false
|
||||
|
||||
const isOTAUpdatesEnabled = storage.getBoolean(MMKVStorageKeys.IsOTAUpdatesEnabled)
|
||||
|
||||
const otaManager = new OTAUpdateManager(downloadUrl, versionUrl)
|
||||
|
||||
export const downloadUpdate = (showCatchAlert: boolean = false) => {
|
||||
@@ -78,7 +82,7 @@ const GitUpdateModal = () => {
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
if (__DEV__ || !OTA_UPDATE_ENABLED || isPRUpdate) {
|
||||
if (__DEV__ || !OTA_UPDATE_ENABLED || isPRUpdate || !isOTAUpdatesEnabled) {
|
||||
return
|
||||
}
|
||||
onCheckGitVersion()
|
||||
|
||||
@@ -25,4 +25,5 @@ export enum MMKVStorageKeys {
|
||||
ReducedHaptics = 'ReducedHaptics',
|
||||
Theme = 'Theme',
|
||||
SetupCompleted = 'SetupCompleted',
|
||||
IsOTAUpdatesEnabled = 'IsOTAUpdatesEnabled',
|
||||
}
|
||||
|
||||
@@ -13,9 +13,11 @@ import Animated, {
|
||||
withSequence,
|
||||
withTiming,
|
||||
} from 'react-native-reanimated'
|
||||
import { useSendMetricsSetting } from '../../../stores/settings/app'
|
||||
import { useDisableOTAUpdatesSetting, useSendMetricsSetting } from '../../../stores/settings/app'
|
||||
import MaterialDesignIcon from '@react-native-vector-icons/material-design-icons'
|
||||
import { useTheme } from 'tamagui'
|
||||
import { useMMKVBoolean } from 'react-native-mmkv'
|
||||
import { MMKVStorageKeys } from '../../../enums/mmkv-storage-keys'
|
||||
|
||||
interface Props {
|
||||
onNext: () => void
|
||||
@@ -24,6 +26,9 @@ interface Props {
|
||||
export const PrivacyStep: React.FC<Props> = ({ onNext }) => {
|
||||
const [metrics, setMetrics] = useSendMetricsSetting()
|
||||
const theme = useTheme()
|
||||
const [isOTAUpdatesEnabled, setIsOTAUpdatesEnabled] = useMMKVBoolean(
|
||||
MMKVStorageKeys.IsOTAUpdatesEnabled,
|
||||
)
|
||||
const shieldScale = useSharedValue(1)
|
||||
const glowOpacity = useSharedValue(0.5)
|
||||
|
||||
@@ -136,6 +141,35 @@ export const PrivacyStep: React.FC<Props> = ({ onNext }) => {
|
||||
</View>
|
||||
</Animated.View>
|
||||
|
||||
<Animated.View
|
||||
entering={FadeInDown.delay(1000).springify()}
|
||||
style={styles.fullWidth}
|
||||
>
|
||||
<View
|
||||
style={[
|
||||
styles.toggleCard,
|
||||
{
|
||||
backgroundColor: isLight
|
||||
? 'rgba(109, 47, 255, 0.12)'
|
||||
: 'rgba(255,255,255,0.12)',
|
||||
borderColor: isLight
|
||||
? 'rgba(109, 47, 255, 0.2)'
|
||||
: 'rgba(255,255,255,0.2)',
|
||||
},
|
||||
]}
|
||||
>
|
||||
<SwitchWithLabel
|
||||
label='Enable OTA Updates'
|
||||
checked={isOTAUpdatesEnabled ?? false}
|
||||
onCheckedChange={(value) => setIsOTAUpdatesEnabled(value)}
|
||||
size='$4'
|
||||
/>
|
||||
<Text style={[styles.toggleDescription, { color: textColor }]}>
|
||||
Enable OTA Updates to receive automatic updates.
|
||||
</Text>
|
||||
</View>
|
||||
</Animated.View>
|
||||
|
||||
{/* Finish Button */}
|
||||
<Animated.View
|
||||
entering={FadeInDown.delay(1100).springify()}
|
||||
|
||||
@@ -27,7 +27,7 @@ export default function Root(): React.JSX.Element {
|
||||
const [library] = useJellifyLibrary()
|
||||
|
||||
return (
|
||||
<RootStack.Navigator initialRouteName={api && library ? baseScreen : 'Login'}>
|
||||
<RootStack.Navigator initialRouteName={api && library ? 'Setup' : 'Login'}>
|
||||
<RootStack.Screen
|
||||
name='Tabs'
|
||||
component={Tabs}
|
||||
|
||||
@@ -6,6 +6,9 @@ import { useShallow } from 'zustand/react/shallow'
|
||||
export type ThemeSetting = 'system' | 'light' | 'dark' | 'oled'
|
||||
|
||||
type AppSettingsStore = {
|
||||
disableOTAUpdates: boolean
|
||||
setDisableOTAUpdates: (disableOTAUpdates: boolean) => void
|
||||
|
||||
sendMetrics: boolean
|
||||
setSendMetrics: (sendMetrics: boolean) => void
|
||||
|
||||
@@ -34,6 +37,9 @@ export const useAppSettingsStore = create<AppSettingsStore>()(
|
||||
|
||||
theme: 'system',
|
||||
setTheme: (theme: ThemeSetting) => set({ theme }),
|
||||
|
||||
disableOTAUpdates: false,
|
||||
setDisableOTAUpdates: (disableOTAUpdates: boolean) => set({ disableOTAUpdates }),
|
||||
}),
|
||||
{
|
||||
name: 'app-settings-storage',
|
||||
@@ -68,3 +74,11 @@ export const useSendMetricsSetting: () => [boolean, (sendMetrics: boolean) => vo
|
||||
|
||||
export const useHideRunTimesSetting: () => [boolean, (hideRunTimes: boolean) => void] = () =>
|
||||
useAppSettingsStore(useShallow((state) => [state.hideRunTimes, state.setHideRunTimes]))
|
||||
|
||||
export const useDisableOTAUpdatesSetting: () => [
|
||||
boolean,
|
||||
(disableOTAUpdates: boolean) => void,
|
||||
] = () =>
|
||||
useAppSettingsStore(
|
||||
useShallow((state) => [state.disableOTAUpdates, state.setDisableOTAUpdates]),
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user