verbose logs cleanup

This commit is contained in:
tapframe 2026-01-19 13:57:49 +05:30
parent 674dbcf818
commit 2314d1db86
9 changed files with 265 additions and 266 deletions

View file

@ -134,7 +134,8 @@ const StreamCard = memo(({
}
} catch { }
// Show immediate feedback on both platforms
showAlert('Starting Download', 'Download will be started.');
// Show immediate feedback on both platforms
// showAlert('Starting Download', 'Download will be started.');
const parent: any = stream as any;
const inferredTitle = parentTitle || stream.name || stream.title || parent.metaName || 'Content';
const inferredType: 'movie' | 'series' = parentType || (parent.kind === 'series' || parent.type === 'series' ? 'series' : 'movie');
@ -172,7 +173,9 @@ const StreamCard = memo(({
tmdbId: tmdbId,
});
showAlert('Download Started', 'Your download has been added to the queue.');
} catch {}
} catch (e: any) {
showAlert('Download Failed', e.message || 'Could not start download.');
}
}, [startDownload, stream.url, stream.headers, streamInfo.quality, showAlert, stream.name, stream.title, parentId, parentImdbId, parentTitle, parentType, parentSeason, parentEpisode, parentEpisodeTitle, parentPosterUrl, providerName]);
const isDebrid = streamInfo.isDebrid;

View file

@ -446,7 +446,7 @@ const AppleTVHero: React.FC<AppleTVHeroProps> = ({
if (url) {
const bestUrl = TrailerService.getBestFormatUrl(url);
setTrailerUrl(bestUrl);
logger.info('[AppleTVHero] Trailer URL loaded:', bestUrl);
// logger.info('[AppleTVHero] Trailer URL loaded:', bestUrl);
} else {
logger.info('[AppleTVHero] No trailer found for:', currentItem.name);
setTrailerUrl(null);
@ -997,7 +997,7 @@ const AppleTVHero: React.FC<AppleTVHeroProps> = ({
{/* Background Images with Crossfade */}
<View style={styles.backgroundContainer}>
{/* Current Image - Always visible as base */}
<Animated.View style={[styles.imageWrapper, backgroundParallaxStyle]}>
<Animated.View style={[styles.imageWrapper, backgroundParallaxStyle, { opacity: thumbnailOpacity }]}>
<FastImage
source={{
uri: bannerUrl,
@ -1441,7 +1441,7 @@ const styles = StyleSheet.create({
bottom: 0,
left: 0,
right: 0,
height: 40,
height: 400, // Increased to cover action buttons with dark background
pointerEvents: 'none',
},
// Loading & Empty States

View file

@ -351,7 +351,6 @@ const CompactCommentCard: React.FC<{
onPressIn={() => setIsPressed(true)}
onPressOut={() => setIsPressed(false)}
onPress={() => {
console.log('CompactCommentCard: TouchableOpacity pressed for comment:', comment.id);
onPress();
}}
activeOpacity={1}
@ -789,26 +788,21 @@ export const CommentsSection: React.FC<CommentsSectionProps> = ({
}, [loading]);
// Debug logging
console.log('CommentsSection: Comments data:', comments);
console.log('CommentsSection: Comments length:', comments?.length);
console.log('CommentsSection: Loading:', loading);
console.log('CommentsSection: Error:', error);
// Debug logging removed per user request
const renderComment = useCallback(({ item }: { item: TraktContentComment }) => {
// Safety check for null/undefined items
if (!item || !item.id) {
console.log('CommentsSection: Invalid comment item:', item);
return null;
}
console.log('CommentsSection: Rendering comment:', item.id);
return (
<CompactCommentCard
comment={item}
theme={currentTheme}
onPress={() => {
console.log('CommentsSection: Comment pressed:', item.id);
onCommentPress?.(item);
}}
isSpoilerRevealed={true}

View file

@ -925,7 +925,7 @@ const HeroSection: React.FC<HeroSectionProps> = memo(({
// Handle trailer preload completion
const handleTrailerPreloaded = useCallback(() => {
setTrailerPreloaded(true);
logger.info('HeroSection', 'Trailer preloaded successfully');
// logger.info('HeroSection', 'Trailer preloaded successfully');
}, []);
// Handle smooth transition when trailer is ready to play

View file

@ -252,7 +252,7 @@ const TrailerPlayer = React.forwardRef<any, TrailerPlayerProps>(({
// Only show loading spinner if not hidden
loadingOpacity.value = hideLoadingSpinner ? 0 : 1;
onLoadStart?.();
logger.info('TrailerPlayer', 'Video load started');
// logger.info('TrailerPlayer', 'Video load started');
}, [loadingOpacity, onLoadStart, hideLoadingSpinner, isComponentMounted]);
const handleLoad = useCallback((data: OnLoadData) => {
@ -262,7 +262,7 @@ const TrailerPlayer = React.forwardRef<any, TrailerPlayerProps>(({
loadingOpacity.value = withTiming(0, { duration: 300 });
setDuration(data.duration * 1000); // Convert to milliseconds
onLoad?.();
logger.info('TrailerPlayer', 'Video loaded successfully');
// logger.info('TrailerPlayer', 'Video loaded successfully');
}, [loadingOpacity, onLoad, isComponentMounted]);
const handleError = useCallback((error: any) => {

View file

@ -515,8 +515,8 @@ export const DownloadsProvider: React.FC<{ children: React.ReactNode }> = ({ chi
resumablesRef.current.set(compoundId, resumable);
lastBytesRef.current.set(compoundId, { bytes: 0, time: Date.now() });
try {
const result = await resumable.downloadAsync();
// Start download in background (non-blocking) to allow UI success alert
resumable.downloadAsync().then(async (result) => {
// Check if download was paused during download
const currentItem = downloadsRef.current.find(d => d.id === compoundId);
@ -581,7 +581,7 @@ export const DownloadsProvider: React.FC<{ children: React.ReactNode }> = ({ chi
if (done) notifyCompleted({ ...done, status: 'completed', progress: 100, fileUri: result.uri } as DownloadItem);
resumablesRef.current.delete(compoundId);
lastBytesRef.current.delete(compoundId);
} catch (e: any) {
}).catch(async (e: any) => {
// If user paused, keep paused state, else error
const current = downloadsRef.current.find(d => d.id === compoundId);
if (current && current.status === 'paused') {
@ -634,7 +634,7 @@ export const DownloadsProvider: React.FC<{ children: React.ReactNode }> = ({ chi
updateDownload(compoundId, (d) => ({ ...d, status: 'error', updatedAt: Date.now() }));
// Keep resumable for potential retry
}
}
});
}, [updateDownload, resumeDownload]);
const pauseDownload = useCallback(async (id: string) => {

View file

@ -60,7 +60,7 @@ export const useTraktComments = ({
const traktService = TraktService.getInstance();
let fetchedComments: TraktContentComment[] = [];
console.log(`[useTraktComments] Loading comments for ${type} - IMDb: ${imdbId}, TMDB: ${tmdbId}, page: ${pageNum}`);
switch (type) {
case 'movie':
@ -87,10 +87,10 @@ export const useTraktComments = ({
setComments(prevComments => {
if (append) {
const newComments = [...prevComments, ...fetchedComments];
console.log(`[useTraktComments] Appended ${fetchedComments.length} comments, total: ${newComments.length}`);
return newComments;
} else {
console.log(`[useTraktComments] Loaded ${fetchedComments.length} comments`);
return fetchedComments;
}
});

View file

@ -33,7 +33,7 @@ export class TrailerService {
// Try local server first, fallback to XPrime if it fails
const localResult = await this.getTrailerFromLocalServer(title, year, tmdbId, type);
if (localResult) {
logger.info('TrailerService', 'Returning trailer URL from local server');
// logger.info('TrailerService', 'Returning trailer URL from local server');
return localResult;
}
@ -88,23 +88,25 @@ export class TrailerService {
signal: controller.signal,
});
logger.info('TrailerService', `Fetch request completed. Response status: ${response.status}`);
// logger.info('TrailerService', `Fetch request completed. Response status: ${response.status}`);
clearTimeout(timeoutId);
const elapsed = Date.now() - startTime;
const contentType = response.headers.get('content-type') || 'unknown';
logger.info('TrailerService', `Local server response: status=${response.status} ok=${response.ok} content-type=${contentType} elapsedMs=${elapsed}`);
// logger.info('TrailerService', `Local server response: status=${response.status} ok=${response.ok} content-type=${contentType} elapsedMs=${elapsed}`);
// Read body as text first so we can log it even on non-200s
let rawText = '';
try {
rawText = await response.text();
if (rawText) {
/*
const preview = rawText.length > 200 ? `${rawText.slice(0, 200)}...` : rawText;
logger.info('TrailerService', `Local server body preview: ${preview}`);
*/
} else {
logger.info('TrailerService', 'Local server body is empty');
// logger.info('TrailerService', 'Local server body is empty');
}
} catch (e) {
const msg = e instanceof Error ? `${e.name}: ${e.message}` : String(e);
@ -120,8 +122,8 @@ export class TrailerService {
let data: any = null;
try {
data = rawText ? JSON.parse(rawText) : null;
const keys = typeof data === 'object' && data !== null ? Object.keys(data).join(',') : typeof data;
logger.info('TrailerService', `Local server JSON parsed. Keys/Type: ${keys}`);
// const keys = typeof data === 'object' && data !== null ? Object.keys(data).join(',') : typeof data;
// logger.info('TrailerService', `Local server JSON parsed. Keys/Type: ${keys}`);
} catch (e) {
const msg = e instanceof Error ? `${e.name}: ${e.message}` : String(e);
logger.warn('TrailerService', `Failed to parse local server JSON: ${msg}`);
@ -133,7 +135,7 @@ export class TrailerService {
return null;
}
logger.info('TrailerService', `Successfully found trailer: ${String(data.url).substring(0, 80)}...`);
// logger.info('TrailerService', `Successfully found trailer: ${String(data.url).substring(0, 80)}...`);
return data.url;
} catch (error) {
if (error instanceof Error && error.name === 'AbortError') {
@ -288,7 +290,7 @@ export class TrailerService {
}
// Return the original URL if no format optimization is needed
logger.info('TrailerService', 'No format optimization applied');
// logger.info('TrailerService', 'No format optimization applied');
return url;
}

View file

@ -1463,7 +1463,7 @@ export class TraktService {
if (matchingResult) {
const traktId = matchingResult[type]?.ids?.trakt;
if (traktId) {
logger.log(`[TraktService] Found Trakt ID: ${traktId} for IMDb ID: ${fullImdbId}`);
// logger.log(`[TraktService] Found Trakt ID: ${traktId} for IMDb ID: ${fullImdbId}`);
return traktId;
}
}
@ -1471,7 +1471,7 @@ export class TraktService {
// Fallback: try the first result if type filtering didn't work
const traktId = data[0][type]?.ids?.trakt;
if (traktId) {
logger.log(`[TraktService] Found Trakt ID (fallback): ${traktId} for IMDb ID: ${fullImdbId}`);
// logger.log(`[TraktService] Found Trakt ID (fallback): ${traktId} for IMDb ID: ${fullImdbId}`);
return traktId;
}
}
@ -2860,7 +2860,7 @@ export class TraktService {
if (data && data.length > 0) {
const traktId = data[0][type === 'show' ? 'show' : type]?.ids?.trakt;
if (traktId) {
logger.log(`[TraktService] Found Trakt ID via TMDB: ${traktId} for TMDB ID: ${tmdbId}`);
// logger.log(`[TraktService] Found Trakt ID via TMDB: ${traktId} for TMDB ID: ${tmdbId}`);
return traktId;
}
}
@ -2893,7 +2893,7 @@ export class TraktService {
const endpoint = `/movies/${traktId}/comments?page=${page}&limit=${limit}`;
const result = await this.apiRequest<TraktContentComment[]>(endpoint, 'GET');
console.log(`[TraktService] Movie comments response:`, result);
// console.log(`[TraktService] Movie comments response:`, result);
return result;
} catch (error) {
logger.error('[TraktService] Failed to get movie comments:', error);