removed debrid integration

This commit is contained in:
tapframe 2026-01-11 19:47:11 +05:30
parent 9e6b455323
commit d398c73214
4 changed files with 51 additions and 76 deletions

42
App.tsx
View file

@ -43,7 +43,6 @@ import { aiService } from './src/services/aiService';
import { AccountProvider, useAccount } from './src/contexts/AccountContext'; import { AccountProvider, useAccount } from './src/contexts/AccountContext';
import { ToastProvider } from './src/contexts/ToastContext'; import { ToastProvider } from './src/contexts/ToastContext';
import { mmkvStorage } from './src/services/mmkvStorage'; import { mmkvStorage } from './src/services/mmkvStorage';
import AnnouncementOverlay from './src/components/AnnouncementOverlay';
import { CampaignManager } from './src/components/promotions/CampaignManager'; import { CampaignManager } from './src/components/promotions/CampaignManager';
Sentry.init({ Sentry.init({
@ -91,7 +90,6 @@ const ThemedApp = () => {
const { currentTheme } = useTheme(); const { currentTheme } = useTheme();
const [isAppReady, setIsAppReady] = useState(false); const [isAppReady, setIsAppReady] = useState(false);
const [hasCompletedOnboarding, setHasCompletedOnboarding] = useState<boolean | null>(null); const [hasCompletedOnboarding, setHasCompletedOnboarding] = useState<boolean | null>(null);
const [showAnnouncement, setShowAnnouncement] = useState(false);
// Update popup functionality // Update popup functionality
const { const {
@ -106,16 +104,6 @@ const ThemedApp = () => {
// GitHub major/minor release overlay // GitHub major/minor release overlay
const githubUpdate = useGithubMajorUpdate(); const githubUpdate = useGithubMajorUpdate();
// Announcement data
const announcements = [
{
icon: 'zap',
title: 'Debrid Integration',
description: 'Unlock 4K high-quality streams with lightning-fast speeds. Connect your TorBox account to access cached premium content with zero buffering.',
tag: 'NEW',
},
];
// Check onboarding status and initialize services // Check onboarding status and initialize services
useEffect(() => { useEffect(() => {
const initializeApp = async () => { const initializeApp = async () => {
@ -135,15 +123,6 @@ const ThemedApp = () => {
await aiService.initialize(); await aiService.initialize();
console.log('AI service initialized'); console.log('AI service initialized');
// Check if announcement should be shown (version 1.0.0)
const announcementShown = await mmkvStorage.getItem('announcement_v1.0.0_shown');
if (!announcementShown && onboardingCompleted === 'true') {
// Show announcement only after app is ready
setTimeout(() => {
setShowAnnouncement(true);
}, 1000);
}
} catch (error) { } catch (error) {
console.error('Error initializing app:', error); console.error('Error initializing app:', error);
// Default to showing onboarding if we can't check // Default to showing onboarding if we can't check
@ -181,20 +160,6 @@ const ThemedApp = () => {
// Navigation reference // Navigation reference
const navigationRef = React.useRef<any>(null); const navigationRef = React.useRef<any>(null);
// Handler for navigating to debrid integration
const handleNavigateToDebrid = () => {
if (navigationRef.current) {
navigationRef.current.navigate('DebridIntegration');
}
};
// Handler for announcement close
const handleAnnouncementClose = async () => {
setShowAnnouncement(false);
// Mark announcement as shown
await mmkvStorage.setItem('announcement_v1.0.0_shown', 'true');
};
// Don't render anything until we know the onboarding status // Don't render anything until we know the onboarding status
const shouldShowApp = isAppReady && hasCompletedOnboarding !== null; const shouldShowApp = isAppReady && hasCompletedOnboarding !== null;
const initialRouteName = hasCompletedOnboarding ? 'MainTabs' : 'Onboarding'; const initialRouteName = hasCompletedOnboarding ? 'MainTabs' : 'Onboarding';
@ -237,13 +202,6 @@ const ThemedApp = () => {
onDismiss={githubUpdate.onDismiss} onDismiss={githubUpdate.onDismiss}
onLater={githubUpdate.onLater} onLater={githubUpdate.onLater}
/> />
<AnnouncementOverlay
visible={showAnnouncement}
announcements={announcements}
onClose={handleAnnouncementClose}
onActionPress={handleNavigateToDebrid}
actionButtonText="Connect Now"
/>
<CampaignManager /> <CampaignManager />
</View> </View>
</DownloadsProvider> </DownloadsProvider>

View file

@ -74,6 +74,7 @@ export const ParentalGuideOverlay: React.FC<ParentalGuideOverlayProps> = ({
const hasShownRef = useRef(false); const hasShownRef = useRef(false);
const hideTimeoutRef = useRef<NodeJS.Timeout | null>(null); const hideTimeoutRef = useRef<NodeJS.Timeout | null>(null);
const fadeTimeoutRef = useRef<NodeJS.Timeout | null>(null); const fadeTimeoutRef = useRef<NodeJS.Timeout | null>(null);
const prevShouldShowRef = useRef<boolean>(false);
// Animation values // Animation values
const lineHeight = useSharedValue(0); const lineHeight = useSharedValue(0);
@ -130,9 +131,51 @@ export const ParentalGuideOverlay: React.FC<ParentalGuideOverlayProps> = ({
fetchData(); fetchData();
}, [imdbId, type, season, episode]); }, [imdbId, type, season, episode]);
// Trigger animation when shouldShow becomes true // Handle show/hide based on shouldShow (controls visibility)
useEffect(() => { useEffect(() => {
if (shouldShow && warnings.length > 0 && !hasShownRef.current) { // When controls are shown (shouldShow becomes false), immediately hide overlay
if (!shouldShow && isVisible) {
// Clear any pending timeouts
if (hideTimeoutRef.current) {
clearTimeout(hideTimeoutRef.current);
hideTimeoutRef.current = null;
}
if (fadeTimeoutRef.current) {
clearTimeout(fadeTimeoutRef.current);
fadeTimeoutRef.current = null;
}
// Immediately hide overlay with quick fade out
const count = warnings.length;
// FADE OUT: Items fade out in reverse order (bottom to top)
for (let i = count - 1; i >= 0; i--) {
const reverseDelay = (count - 1 - i) * 40;
itemOpacities[i].value = withDelay(
reverseDelay,
withTiming(0, { duration: 100 })
);
}
// Line shrinks after items are gone
const lineDelay = count * 40 + 50;
lineHeight.value = withDelay(lineDelay, withTiming(0, {
duration: 200,
easing: Easing.in(Easing.cubic),
}));
// Container fades out last
containerOpacity.value = withDelay(lineDelay + 100, withTiming(0, { duration: 150 }));
// Set invisible after all animations complete
fadeTimeoutRef.current = setTimeout(() => {
setIsVisible(false);
// Don't reset hasShownRef here - only reset on content change
}, lineDelay + 300);
}
// When controls are hidden (shouldShow becomes true), show overlay if not already shown for this content
// Only show if transitioning from false to true (controls just hidden)
if (shouldShow && !prevShouldShowRef.current && warnings.length > 0 && !hasShownRef.current) {
hasShownRef.current = true; hasShownRef.current = true;
setIsVisible(true); setIsVisible(true);
@ -182,10 +225,14 @@ export const ParentalGuideOverlay: React.FC<ParentalGuideOverlayProps> = ({
// Set invisible after all animations complete // Set invisible after all animations complete
fadeTimeoutRef.current = setTimeout(() => { fadeTimeoutRef.current = setTimeout(() => {
setIsVisible(false); setIsVisible(false);
// Don't reset hasShownRef - only reset on content change
}, lineDelay + 500); }, lineDelay + 500);
}, 5000); }, 5000);
} }
}, [shouldShow, warnings.length]);
// Update previous shouldShow value
prevShouldShowRef.current = shouldShow;
}, [shouldShow, isVisible, warnings.length]);
// Cleanup on unmount // Cleanup on unmount
useEffect(() => { useEffect(() => {
@ -198,6 +245,7 @@ export const ParentalGuideOverlay: React.FC<ParentalGuideOverlayProps> = ({
// Reset when content changes // Reset when content changes
useEffect(() => { useEffect(() => {
hasShownRef.current = false; hasShownRef.current = false;
prevShouldShowRef.current = false;
setWarnings([]); setWarnings([]);
setIsVisible(false); setIsVisible(false);
lineHeight.value = 0; lineHeight.value = 0;

View file

@ -432,21 +432,6 @@ const SettingsScreen: React.FC = () => {
renderControl={() => <ChevronRight />} renderControl={() => <ChevronRight />}
isTablet={isTablet} isTablet={isTablet}
/> />
<SettingItem
title={t('settings.items.test_announcement')}
icon="bell"
description={t('settings.items.test_announcement_desc')}
onPress={async () => {
try {
await mmkvStorage.removeItem('announcement_v1.0.0_shown');
openAlert('Success', 'Announcement reset. Restart the app to see the announcement overlay.');
} catch (error) {
openAlert('Error', 'Failed to reset announcement.');
}
}}
renderControl={() => <ChevronRight />}
isTablet={isTablet}
/>
<SettingItem <SettingItem
title={t('settings.items.reset_campaigns')} title={t('settings.items.reset_campaigns')}
description={t('settings.items.reset_campaigns_desc')} description={t('settings.items.reset_campaigns_desc')}

View file

@ -57,15 +57,6 @@ const DeveloperSettingsScreen: React.FC = () => {
} }
}; };
const handleResetAnnouncement = async () => {
try {
await mmkvStorage.removeItem('announcement_v1.0.0_shown');
openAlert('Success', 'Announcement reset. Restart the app to see the announcement overlay.');
} catch (error) {
openAlert('Error', 'Failed to reset announcement.');
}
};
const handleResetCampaigns = async () => { const handleResetCampaigns = async () => {
await campaignService.resetCampaigns(); await campaignService.resetCampaigns();
openAlert('Success', 'Campaign history reset. Restart app to see posters again.'); openAlert('Success', 'Campaign history reset. Restart app to see posters again.');
@ -127,13 +118,6 @@ const DeveloperSettingsScreen: React.FC = () => {
onPress={handleResetOnboarding} onPress={handleResetOnboarding}
renderControl={() => <ChevronRight />} renderControl={() => <ChevronRight />}
/> />
<SettingItem
title={t('settings.items.test_announcement')}
icon="bell"
description={t('settings.items.test_announcement_desc')}
onPress={handleResetAnnouncement}
renderControl={() => <ChevronRight />}
/>
<SettingItem <SettingItem
title={t('settings.items.reset_campaigns')} title={t('settings.items.reset_campaigns')}
description={t('settings.items.reset_campaigns_desc')} description={t('settings.items.reset_campaigns_desc')}