mirror of
https://github.com/tapframe/NuvioStreaming.git
synced 2026-01-11 20:10:25 +00:00
updated android to disable OTA check on start
This commit is contained in:
parent
8159cfeadb
commit
f1ba70db89
2 changed files with 21 additions and 19 deletions
6
App.tsx
6
App.tsx
|
|
@ -92,8 +92,10 @@ const ThemedApp = () => {
|
|||
const onboardingCompleted = await AsyncStorage.getItem('hasCompletedOnboarding');
|
||||
setHasCompletedOnboarding(onboardingCompleted === 'true');
|
||||
|
||||
// Initialize update service
|
||||
await UpdateService.initialize();
|
||||
// Initialize update service (skip on Android to prevent update checks)
|
||||
if (Platform.OS !== 'android') {
|
||||
await UpdateService.initialize();
|
||||
}
|
||||
|
||||
// Initialize memory monitoring service to prevent OutOfMemoryError
|
||||
memoryMonitorService; // Just accessing it starts the monitoring
|
||||
|
|
|
|||
|
|
@ -28,6 +28,11 @@ export const useUpdatePopup = (): UseUpdatePopupReturn => {
|
|||
|
||||
const checkForUpdates = useCallback(async (forceCheck = false) => {
|
||||
try {
|
||||
// Skip update checks on Android to prevent OTA checks
|
||||
if (Platform.OS === 'android') {
|
||||
return;
|
||||
}
|
||||
|
||||
// Check if user has dismissed the popup for this version
|
||||
const dismissedVersion = await AsyncStorage.getItem(UPDATE_POPUP_STORAGE_KEY);
|
||||
const currentVersion = updateInfo.manifest?.id;
|
||||
|
|
@ -52,23 +57,8 @@ export const useUpdatePopup = (): UseUpdatePopupReturn => {
|
|||
setUpdateInfo(info);
|
||||
|
||||
if (info.isAvailable) {
|
||||
// Android: use badge instead of popup to avoid freezes
|
||||
if (Platform.OS === 'android') {
|
||||
try {
|
||||
await AsyncStorage.setItem(UPDATE_BADGE_KEY, 'true');
|
||||
} catch {}
|
||||
// Show actionable toast instead of popup
|
||||
try {
|
||||
toast('Update available — go to Settings → App Updates', {
|
||||
duration: 3000,
|
||||
position: ToastPosition.TOP,
|
||||
});
|
||||
} catch {}
|
||||
setShowUpdatePopup(false);
|
||||
} else {
|
||||
// iOS: show popup as usual
|
||||
setShowUpdatePopup(true);
|
||||
}
|
||||
// Show popup (Android checks are handled earlier in the function)
|
||||
setShowUpdatePopup(true);
|
||||
}
|
||||
} catch (error) {
|
||||
if (__DEV__) console.error('Error checking for updates:', error);
|
||||
|
|
@ -135,6 +125,11 @@ export const useUpdatePopup = (): UseUpdatePopupReturn => {
|
|||
|
||||
// Handle startup update check results
|
||||
useEffect(() => {
|
||||
// Skip startup update check registration on Android
|
||||
if (Platform.OS === 'android') {
|
||||
return;
|
||||
}
|
||||
|
||||
const handleStartupUpdateCheck = (updateInfo: UpdateInfo) => {
|
||||
console.log('UpdatePopup: Received startup update check result', updateInfo);
|
||||
setUpdateInfo(updateInfo);
|
||||
|
|
@ -203,6 +198,11 @@ export const useUpdatePopup = (): UseUpdatePopupReturn => {
|
|||
return; // Already checked on startup
|
||||
}
|
||||
|
||||
// Skip auto-check on Android to prevent OTA checks
|
||||
if (Platform.OS === 'android') {
|
||||
return;
|
||||
}
|
||||
|
||||
// Add a small delay to ensure the app is fully loaded
|
||||
const timer = setTimeout(() => {
|
||||
(async () => {
|
||||
|
|
|
|||
Loading…
Reference in a new issue