update popup for android fix

This commit is contained in:
tapframe 2025-10-24 19:45:15 +05:30
parent 4daab74e27
commit b81435be29
6 changed files with 42 additions and 43 deletions

24
App.tsx
View file

@ -107,10 +107,8 @@ const ThemedApp = () => {
const onboardingCompleted = await AsyncStorage.getItem('hasCompletedOnboarding');
setHasCompletedOnboarding(onboardingCompleted === 'true');
// Initialize update service (skip on Android to prevent update checks)
if (Platform.OS !== 'android') {
await UpdateService.initialize();
}
// Initialize update service
await UpdateService.initialize();
// Initialize memory monitoring service to prevent OutOfMemoryError
memoryMonitorService; // Just accessing it starts the monitoring
@ -170,16 +168,14 @@ const ThemedApp = () => {
<StatusBar style="light" />
{!isAppReady && <SplashScreen onFinish={handleSplashComplete} />}
{shouldShowApp && <AppNavigator initialRouteName={initialRouteName} />}
{Platform.OS === 'ios' && (
<UpdatePopup
visible={showUpdatePopup}
updateInfo={updateInfo}
onUpdateNow={handleUpdateNow}
onUpdateLater={handleUpdateLater}
onDismiss={handleDismiss}
isInstalling={isInstalling}
/>
)}
<UpdatePopup
visible={showUpdatePopup}
updateInfo={updateInfo}
onUpdateNow={handleUpdateNow}
onUpdateLater={handleUpdateLater}
onDismiss={handleDismiss}
isInstalling={isInstalling}
/>
<MajorUpdateOverlay
visible={githubUpdate.visible}
latestTag={githubUpdate.latestTag}

View file

@ -79,11 +79,6 @@ const UpdatePopup: React.FC<UpdatePopupProps> = ({
return null;
}
// Completely disable popup on Android
if (Platform.OS === 'android') {
return null;
}
// iOS implementation with full features
return (
<Modal

View file

@ -28,10 +28,6 @@ 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);
@ -119,10 +115,6 @@ 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);
@ -130,16 +122,7 @@ export const useUpdatePopup = (): UseUpdatePopupReturn => {
setHasCheckedOnStartup(true);
if (updateInfo.isAvailable) {
if (Platform.OS === 'android') {
// Set badge and show a toast
(async () => {
try { await AsyncStorage.setItem(UPDATE_BADGE_KEY, 'true'); } catch {}
})();
toastService.showInfo('Update Available', 'Update available — go to Settings → App Updates');
setShowUpdatePopup(false);
} else {
setShowUpdatePopup(true);
}
setShowUpdatePopup(true);
}
};
@ -187,10 +170,6 @@ 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(() => {

View file

@ -353,7 +353,7 @@ const HomeScreen = () => {
await AsyncStorage.removeItem('showLoginHintToastOnce');
hideTimer = setTimeout(() => setHintVisible(false), 2000);
// Also show a global toast for consistency across screens
showInfo('Sign In Available', 'You can sign in anytime from Settings → Account');
// showInfo('Sign In Available', 'You can sign in anytime from Settings → Account');
}
} catch {}
})();

View file

@ -864,16 +864,31 @@ class LocalScraperService {
async getStreams(type: string, tmdbId: string, season?: number, episode?: number, callback?: ScraperCallback): Promise<void> {
await this.ensureInitialized();
// Get list of installed scrapers at the beginning for callback invocations
const installedScrapers = Array.from(this.installedScrapers.values());
// Helper function to invoke callback for all installed scrapers with empty results
const invokeCallbacksForAllScrapers = (reason: string) => {
if (callback && installedScrapers.length > 0) {
logger.log(`[LocalScraperService] Invoking callbacks for ${installedScrapers.length} scrapers due to: ${reason}`);
installedScrapers.forEach(scraper => {
callback([], scraper.id, scraper.name, null);
});
}
};
// Check if local scrapers are enabled
const userSettings = await this.getUserScraperSettings();
if (!userSettings.enableLocalScrapers) {
logger.log('[LocalScraperService] Local scrapers are disabled');
invokeCallbacksForAllScrapers('local scrapers disabled');
return;
}
// If no repository is configured, return early
if (!this.repositoryUrl) {
logger.log('[LocalScraperService] No repository URL configured');
invokeCallbacksForAllScrapers('no repository URL configured');
return;
}
@ -884,6 +899,7 @@ class LocalScraperService {
await this.performRepositoryRefresh();
} catch (error) {
logger.error('[LocalScraperService] Failed to refresh repository for getStreams:', error);
invokeCallbacksForAllScrapers('repository refresh failed');
return;
}
}
@ -899,6 +915,7 @@ class LocalScraperService {
if (enabledScrapers.length === 0) {
logger.log('[LocalScraperService] No enabled scrapers found for type:', type);
// No callback needed here since this is after filtering - scrapers weren't added to UI yet
return;
}

View file

@ -1171,7 +1171,19 @@ class StremioService {
}
});
} else {
logger.log('🔧 [getStreams] Local scrapers not executed for this ID/type; continuing with Stremio addons');
logger.log('🔧 [getStreams] Local scrapers not executed - no TMDB ID available');
// Notify UI that local scrapers won't execute by calling their callbacks
try {
const installedScrapers = await localScraperService.getInstalledScrapers();
const enabledScrapers = installedScrapers.filter(s => s.enabled);
enabledScrapers.forEach(scraper => {
if (callback) {
callback([], scraper.id, scraper.name, null);
}
});
} catch (error) {
logger.warn('🔧 [getStreams] Failed to notify UI about skipped local scrapers:', error);
}
}
}
}