diff --git a/src/components/metadata/CommentsSection.tsx b/src/components/metadata/CommentsSection.tsx
index 6664c88..d4b6bc4 100644
--- a/src/components/metadata/CommentsSection.tsx
+++ b/src/components/metadata/CommentsSection.tsx
@@ -11,10 +11,12 @@ import {
ScrollView,
} from 'react-native';
import { MaterialIcons } from '@expo/vector-icons';
+import TraktIcon from '../../../assets/rating-icons/trakt.svg';
import { useTheme } from '../../contexts/ThemeContext';
import { TraktContentComment } from '../../services/traktService';
import { logger } from '../../utils/logger';
import { useTraktComments } from '../../hooks/useTraktComments';
+import { useSettings } from '../../hooks/useSettings';
import BottomSheet, { BottomSheetView } from '@gorhom/bottom-sheet';
const { width } = Dimensions.get('window');
@@ -134,16 +136,23 @@ const CompactCommentCard: React.FC<{
}}
activeOpacity={0.7}
>
+ {/* Trakt Icon - Top Right Corner */}
+
+
+
+
{/* Header Section - Fixed at top */}
-
- {username}
-
- {user.vip && (
-
- VIP
-
- )}
+
+
+ {username}
+
+ {user.vip && (
+
+ VIP
+
+ )}
+
{/* Rating - Show stars */}
@@ -400,6 +409,7 @@ export const CommentsSection: React.FC = ({
onCommentPress,
}) => {
const { currentTheme } = useTheme();
+ const { settings } = useSettings();
const {
comments,
@@ -468,8 +478,17 @@ export const CommentsSection: React.FC = ({
);
}, [loading, error, currentTheme]);
- // Don't show section if not authenticated
- if (!isAuthenticated) {
+ // Don't show section if not authenticated, if comments are disabled in settings, or if still checking authentication
+ // Only show when authentication is definitively true and settings allow it
+ if (isAuthenticated !== true || !settings.showTraktComments) {
+ // Show loading state only if we're checking authentication but settings allow comments
+ if (isAuthenticated === null && settings.showTraktComments) {
+ return (
+
+
+
+ );
+ }
return null;
}
@@ -787,10 +806,15 @@ const styles = StyleSheet.create({
alignItems: 'center',
marginBottom: 8,
},
+ usernameContainer: {
+ flexDirection: 'row',
+ alignItems: 'center',
+ flex: 1,
+ },
compactUsername: {
fontSize: 16,
fontWeight: '600',
- flex: 1,
+ marginRight: 8,
},
miniVipBadge: {
backgroundColor: '#FFD700',
@@ -799,6 +823,12 @@ const styles = StyleSheet.create({
borderRadius: 6,
marginLeft: 6,
},
+ traktIconContainer: {
+ position: 'absolute',
+ top: 8,
+ right: 8,
+ zIndex: 1,
+ },
miniVipText: {
fontSize: 9,
fontWeight: '700',
@@ -983,7 +1013,7 @@ const styles = StyleSheet.create({
loadingContainer: {
alignItems: 'center',
justifyContent: 'center',
- paddingVertical: 40,
+ paddingVertical: 20,
},
loadingText: {
fontSize: 14,
diff --git a/src/hooks/useSettings.ts b/src/hooks/useSettings.ts
index 030d8ae..1723589 100644
--- a/src/hooks/useSettings.ts
+++ b/src/hooks/useSettings.ts
@@ -79,6 +79,8 @@ export interface AppSettings {
// Metadata enrichment
enrichMetadataWithTMDB: boolean; // Use TMDB to enrich metadata (cast, certification, posters, fallbacks)
useTmdbLocalizedMetadata: boolean; // Use TMDB localized metadata (titles, overviews) per tmdbLanguagePreference
+ // Trakt integration
+ showTraktComments: boolean; // Show Trakt comments in metadata screens
}
export const DEFAULT_SETTINGS: AppSettings = {
@@ -130,6 +132,8 @@ export const DEFAULT_SETTINGS: AppSettings = {
// Metadata enrichment
enrichMetadataWithTMDB: true,
useTmdbLocalizedMetadata: false,
+ // Trakt integration
+ showTraktComments: true, // Show Trakt comments by default when authenticated
};
const SETTINGS_STORAGE_KEY = 'app_settings';
diff --git a/src/hooks/useTraktComments.ts b/src/hooks/useTraktComments.ts
index 8a729c0..3b87ad2 100644
--- a/src/hooks/useTraktComments.ts
+++ b/src/hooks/useTraktComments.ts
@@ -24,7 +24,7 @@ export const useTraktComments = ({
const [error, setError] = useState(null);
const [hasMore, setHasMore] = useState(false);
const [page, setPage] = useState(1);
- const [isAuthenticated, setIsAuthenticated] = useState(false);
+ const [isAuthenticated, setIsAuthenticated] = useState(null);
const COMMENTS_PER_PAGE = 10;
@@ -42,12 +42,14 @@ export const useTraktComments = ({
};
if (enabled) {
+ // Set to null initially to indicate we're checking
+ setIsAuthenticated(null);
checkAuth();
}
}, [enabled]);
const loadComments = useCallback(async (pageNum: number = 1, append: boolean = false) => {
- if (!enabled || !imdbId || !isAuthenticated) {
+ if (!enabled || !imdbId || isAuthenticated !== true) {
return;
}
@@ -103,7 +105,7 @@ export const useTraktComments = ({
}, [enabled, imdbId, tmdbId, type, season, episode, isAuthenticated]);
const loadMore = useCallback(() => {
- if (!loading && hasMore && isAuthenticated) {
+ if (!loading && hasMore && isAuthenticated === true) {
loadComments(page + 1, true);
}
}, [loading, hasMore, page, loadComments, isAuthenticated]);
diff --git a/src/screens/TraktSettingsScreen.tsx b/src/screens/TraktSettingsScreen.tsx
index d6d6316..53c55e5 100644
--- a/src/screens/TraktSettingsScreen.tsx
+++ b/src/screens/TraktSettingsScreen.tsx
@@ -46,7 +46,7 @@ const redirectUri = makeRedirectUri({
});
const TraktSettingsScreen: React.FC = () => {
- const { settings } = useSettings();
+ const { settings, updateSetting } = useSettings();
const isDarkMode = settings.enableDarkMode;
const navigation = useNavigation();
const [isLoading, setIsLoading] = useState(true);
@@ -247,7 +247,7 @@ const TraktSettingsScreen: React.FC = () => {
>
{isLoading ? (
@@ -357,67 +357,73 @@ const TraktSettingsScreen: React.FC = () => {
Sync Settings
When connected to Trakt, Continue Watching is sourced from Trakt. Account sync for watch progress is disabled to avoid conflicts.
-
-
-
- Auto-sync playback progress
-
-
+
+
+
+ Auto-sync playback progress
+
+
Automatically sync watch progress to Trakt
-
+
+
+
+
-
-
- Import watched history
-
-
- Use "Sync Now" to import your watch history and progress from Trakt
-
+
+
+
+ Import watched history
+
+
+ Use "Sync Now" to import your watch history and progress from Trakt
+
+
+
{
}}
>
{isSyncing ? (
-
) : (
Sync Now
)}
+ {/* Display Settings Section */}
+
+ Display Settings
+
+
+
+
+
+
+ Show Trakt Comments
+
+
+ Display Trakt comments in metadata screens when available
+
+
+
+ updateSetting('showTraktComments', value)}
+ trackColor={{
+ false: currentTheme.colors.border,
+ true: currentTheme.colors.primary + '80'
+ }}
+ thumbColor={settings.showTraktComments ? currentTheme.colors.white : currentTheme.colors.mediumEmphasis}
+ />
+
+
+
+
@@ -612,10 +656,25 @@ const styles = StyleSheet.create({
fontSize: 18,
fontWeight: '600',
marginBottom: 16,
+ marginTop: 8,
},
settingItem: {
marginBottom: 16,
},
+ settingContent: {
+ flexDirection: 'row',
+ justifyContent: 'space-between',
+ alignItems: 'center',
+ minHeight: 60,
+ },
+ settingTextContainer: {
+ flex: 1,
+ marginRight: 16,
+ },
+ settingToggleContainer: {
+ justifyContent: 'center',
+ alignItems: 'center',
+ },
settingLabel: {
fontSize: 15,
fontWeight: '500',