mirror of
https://github.com/Jellify-Music/App.git
synced 2026-05-05 10:49:22 -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 DeviceInfo from 'react-native-device-info'
|
||||||
import { OTA_UPDATE_ENABLED } from '../../configs/config'
|
import { OTA_UPDATE_ENABLED } from '../../configs/config'
|
||||||
import { githubOTA, OTAUpdateManager, reloadApp, getStoredOtaVersion } from 'react-native-nitro-ota'
|
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()
|
const version = DeviceInfo.getVersion()
|
||||||
|
|
||||||
@@ -27,6 +29,8 @@ const { downloadUrl, versionUrl } = githubOTA({
|
|||||||
const otaVersion = getStoredOtaVersion()
|
const otaVersion = getStoredOtaVersion()
|
||||||
const isPRUpdate = otaVersion ? otaVersion.startsWith('PULL_REQUEST') : false
|
const isPRUpdate = otaVersion ? otaVersion.startsWith('PULL_REQUEST') : false
|
||||||
|
|
||||||
|
const isOTAUpdatesEnabled = storage.getBoolean(MMKVStorageKeys.IsOTAUpdatesEnabled)
|
||||||
|
|
||||||
const otaManager = new OTAUpdateManager(downloadUrl, versionUrl)
|
const otaManager = new OTAUpdateManager(downloadUrl, versionUrl)
|
||||||
|
|
||||||
export const downloadUpdate = (showCatchAlert: boolean = false) => {
|
export const downloadUpdate = (showCatchAlert: boolean = false) => {
|
||||||
@@ -78,7 +82,7 @@ const GitUpdateModal = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (__DEV__ || !OTA_UPDATE_ENABLED || isPRUpdate) {
|
if (__DEV__ || !OTA_UPDATE_ENABLED || isPRUpdate || !isOTAUpdatesEnabled) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
onCheckGitVersion()
|
onCheckGitVersion()
|
||||||
|
|||||||
@@ -25,4 +25,5 @@ export enum MMKVStorageKeys {
|
|||||||
ReducedHaptics = 'ReducedHaptics',
|
ReducedHaptics = 'ReducedHaptics',
|
||||||
Theme = 'Theme',
|
Theme = 'Theme',
|
||||||
SetupCompleted = 'SetupCompleted',
|
SetupCompleted = 'SetupCompleted',
|
||||||
|
IsOTAUpdatesEnabled = 'IsOTAUpdatesEnabled',
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,9 +13,11 @@ import Animated, {
|
|||||||
withSequence,
|
withSequence,
|
||||||
withTiming,
|
withTiming,
|
||||||
} from 'react-native-reanimated'
|
} 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 MaterialDesignIcon from '@react-native-vector-icons/material-design-icons'
|
||||||
import { useTheme } from 'tamagui'
|
import { useTheme } from 'tamagui'
|
||||||
|
import { useMMKVBoolean } from 'react-native-mmkv'
|
||||||
|
import { MMKVStorageKeys } from '../../../enums/mmkv-storage-keys'
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
onNext: () => void
|
onNext: () => void
|
||||||
@@ -24,6 +26,9 @@ interface Props {
|
|||||||
export const PrivacyStep: React.FC<Props> = ({ onNext }) => {
|
export const PrivacyStep: React.FC<Props> = ({ onNext }) => {
|
||||||
const [metrics, setMetrics] = useSendMetricsSetting()
|
const [metrics, setMetrics] = useSendMetricsSetting()
|
||||||
const theme = useTheme()
|
const theme = useTheme()
|
||||||
|
const [isOTAUpdatesEnabled, setIsOTAUpdatesEnabled] = useMMKVBoolean(
|
||||||
|
MMKVStorageKeys.IsOTAUpdatesEnabled,
|
||||||
|
)
|
||||||
const shieldScale = useSharedValue(1)
|
const shieldScale = useSharedValue(1)
|
||||||
const glowOpacity = useSharedValue(0.5)
|
const glowOpacity = useSharedValue(0.5)
|
||||||
|
|
||||||
@@ -136,6 +141,35 @@ export const PrivacyStep: React.FC<Props> = ({ onNext }) => {
|
|||||||
</View>
|
</View>
|
||||||
</Animated.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 */}
|
{/* Finish Button */}
|
||||||
<Animated.View
|
<Animated.View
|
||||||
entering={FadeInDown.delay(1100).springify()}
|
entering={FadeInDown.delay(1100).springify()}
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ export default function Root(): React.JSX.Element {
|
|||||||
const [library] = useJellifyLibrary()
|
const [library] = useJellifyLibrary()
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<RootStack.Navigator initialRouteName={api && library ? baseScreen : 'Login'}>
|
<RootStack.Navigator initialRouteName={api && library ? 'Setup' : 'Login'}>
|
||||||
<RootStack.Screen
|
<RootStack.Screen
|
||||||
name='Tabs'
|
name='Tabs'
|
||||||
component={Tabs}
|
component={Tabs}
|
||||||
|
|||||||
@@ -6,6 +6,9 @@ import { useShallow } from 'zustand/react/shallow'
|
|||||||
export type ThemeSetting = 'system' | 'light' | 'dark' | 'oled'
|
export type ThemeSetting = 'system' | 'light' | 'dark' | 'oled'
|
||||||
|
|
||||||
type AppSettingsStore = {
|
type AppSettingsStore = {
|
||||||
|
disableOTAUpdates: boolean
|
||||||
|
setDisableOTAUpdates: (disableOTAUpdates: boolean) => void
|
||||||
|
|
||||||
sendMetrics: boolean
|
sendMetrics: boolean
|
||||||
setSendMetrics: (sendMetrics: boolean) => void
|
setSendMetrics: (sendMetrics: boolean) => void
|
||||||
|
|
||||||
@@ -34,6 +37,9 @@ export const useAppSettingsStore = create<AppSettingsStore>()(
|
|||||||
|
|
||||||
theme: 'system',
|
theme: 'system',
|
||||||
setTheme: (theme: ThemeSetting) => set({ theme }),
|
setTheme: (theme: ThemeSetting) => set({ theme }),
|
||||||
|
|
||||||
|
disableOTAUpdates: false,
|
||||||
|
setDisableOTAUpdates: (disableOTAUpdates: boolean) => set({ disableOTAUpdates }),
|
||||||
}),
|
}),
|
||||||
{
|
{
|
||||||
name: 'app-settings-storage',
|
name: 'app-settings-storage',
|
||||||
@@ -68,3 +74,11 @@ export const useSendMetricsSetting: () => [boolean, (sendMetrics: boolean) => vo
|
|||||||
|
|
||||||
export const useHideRunTimesSetting: () => [boolean, (hideRunTimes: boolean) => void] = () =>
|
export const useHideRunTimesSetting: () => [boolean, (hideRunTimes: boolean) => void] = () =>
|
||||||
useAppSettingsStore(useShallow((state) => [state.hideRunTimes, state.setHideRunTimes]))
|
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