mirror of
https://github.com/tapframe/NuvioStreaming.git
synced 2026-04-29 04:13:03 +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');
|
const onboardingCompleted = await AsyncStorage.getItem('hasCompletedOnboarding');
|
||||||
setHasCompletedOnboarding(onboardingCompleted === 'true');
|
setHasCompletedOnboarding(onboardingCompleted === 'true');
|
||||||
|
|
||||||
// Initialize update service
|
// Initialize update service (skip on Android to prevent update checks)
|
||||||
await UpdateService.initialize();
|
if (Platform.OS !== 'android') {
|
||||||
|
await UpdateService.initialize();
|
||||||
|
}
|
||||||
|
|
||||||
// Initialize memory monitoring service to prevent OutOfMemoryError
|
// Initialize memory monitoring service to prevent OutOfMemoryError
|
||||||
memoryMonitorService; // Just accessing it starts the monitoring
|
memoryMonitorService; // Just accessing it starts the monitoring
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,11 @@ export const useUpdatePopup = (): UseUpdatePopupReturn => {
|
||||||
|
|
||||||
const checkForUpdates = useCallback(async (forceCheck = false) => {
|
const checkForUpdates = useCallback(async (forceCheck = false) => {
|
||||||
try {
|
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
|
// Check if user has dismissed the popup for this version
|
||||||
const dismissedVersion = await AsyncStorage.getItem(UPDATE_POPUP_STORAGE_KEY);
|
const dismissedVersion = await AsyncStorage.getItem(UPDATE_POPUP_STORAGE_KEY);
|
||||||
const currentVersion = updateInfo.manifest?.id;
|
const currentVersion = updateInfo.manifest?.id;
|
||||||
|
|
@ -52,23 +57,8 @@ export const useUpdatePopup = (): UseUpdatePopupReturn => {
|
||||||
setUpdateInfo(info);
|
setUpdateInfo(info);
|
||||||
|
|
||||||
if (info.isAvailable) {
|
if (info.isAvailable) {
|
||||||
// Android: use badge instead of popup to avoid freezes
|
// Show popup (Android checks are handled earlier in the function)
|
||||||
if (Platform.OS === 'android') {
|
setShowUpdatePopup(true);
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (__DEV__) console.error('Error checking for updates:', error);
|
if (__DEV__) console.error('Error checking for updates:', error);
|
||||||
|
|
@ -135,6 +125,11 @@ export const useUpdatePopup = (): UseUpdatePopupReturn => {
|
||||||
|
|
||||||
// Handle startup update check results
|
// Handle startup update check results
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
// Skip startup update check registration on Android
|
||||||
|
if (Platform.OS === 'android') {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const handleStartupUpdateCheck = (updateInfo: UpdateInfo) => {
|
const handleStartupUpdateCheck = (updateInfo: UpdateInfo) => {
|
||||||
console.log('UpdatePopup: Received startup update check result', updateInfo);
|
console.log('UpdatePopup: Received startup update check result', updateInfo);
|
||||||
setUpdateInfo(updateInfo);
|
setUpdateInfo(updateInfo);
|
||||||
|
|
@ -203,6 +198,11 @@ export const useUpdatePopup = (): UseUpdatePopupReturn => {
|
||||||
return; // Already checked on startup
|
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
|
// Add a small delay to ensure the app is fully loaded
|
||||||
const timer = setTimeout(() => {
|
const timer = setTimeout(() => {
|
||||||
(async () => {
|
(async () => {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue