From 64c9919e28d8457850c822588de24399b07418cb Mon Sep 17 00:00:00 2001 From: Aayush Rautela Date: Mon, 29 Sep 2025 22:56:12 +0200 Subject: [PATCH 1/3] Enhance ContinueWatchingSection to fetch and handle both watched movies and shows from Trakt, improving filtering logic for displayed content. --- .../home/ContinueWatchingSection.tsx | 74 ++++++++++++++----- 1 file changed, 57 insertions(+), 17 deletions(-) diff --git a/src/components/home/ContinueWatchingSection.tsx b/src/components/home/ContinueWatchingSection.tsx index 99fdd3a9..c6f3d861 100644 --- a/src/components/home/ContinueWatchingSection.tsx +++ b/src/components/home/ContinueWatchingSection.tsx @@ -227,25 +227,47 @@ const ContinueWatchingSection = React.forwardRef((props, re contentGroups[contentKey].episodes.push({ key, episodeId, progress, progressPercent }); } - // Fetch Trakt watched movies once and reuse - const traktMoviesSetPromise = (async () => { + // Fetch Trakt watched movies and shows once and reuse + const traktDataPromise = (async () => { try { const traktService = TraktService.getInstance(); const isAuthed = await traktService.isAuthenticated(); - if (!isAuthed) return new Set(); - if (typeof (traktService as any).getWatchedMovies === 'function') { - const watched = await (traktService as any).getWatchedMovies(); - if (Array.isArray(watched)) { - const ids = watched - .map((w: any) => w?.movie?.ids?.imdb) - .filter(Boolean) - .map((imdb: string) => (imdb.startsWith('tt') ? imdb : `tt${imdb}`)); - return new Set(ids); - } - } - return new Set(); + if (!isAuthed) return { watchedMovies: new Set(), watchedShows: new Set() }; + + const [watchedMovies, watchedShows] = await Promise.all([ + // Get watched movies + (async () => { + if (typeof (traktService as any).getWatchedMovies === 'function') { + const watched = await (traktService as any).getWatchedMovies(); + if (Array.isArray(watched)) { + const ids = watched + .map((w: any) => w?.movie?.ids?.imdb) + .filter(Boolean) + .map((imdb: string) => (imdb.startsWith('tt') ? imdb : `tt${imdb}`)); + return new Set(ids); + } + } + return new Set(); + })(), + // Get watched shows + (async () => { + if (typeof (traktService as any).getWatchedShows === 'function') { + const watched = await (traktService as any).getWatchedShows(); + if (Array.isArray(watched)) { + const ids = watched + .map((w: any) => w?.show?.ids?.imdb) + .filter(Boolean) + .map((imdb: string) => (imdb.startsWith('tt') ? imdb : `tt${imdb}`)); + return new Set(ids); + } + } + return new Set(); + })() + ]); + + return { watchedMovies, watchedShows }; } catch { - return new Set(); + return { watchedMovies: new Set(), watchedShows: new Set() }; } })(); @@ -253,10 +275,13 @@ const ContinueWatchingSection = React.forwardRef((props, re const groupPromises = Object.values(contentGroups).map(async (group) => { try { if (!isSupportedId(group.id)) return; + + // Get Trakt data for filtering + const { watchedMovies, watchedShows } = await traktDataPromise; + // Skip movies that are already watched on Trakt if (group.type === 'movie') { - const watchedSet = await traktMoviesSetPromise; - if (watchedSet.has(group.id)) { + if (watchedMovies.has(group.id)) { // Optional: sync local store to watched to prevent reappearance try { await storageService.setWatchProgress(group.id, 'movie', { @@ -270,6 +295,14 @@ const ContinueWatchingSection = React.forwardRef((props, re return; } } + + // Skip shows that are marked as watched on Trakt (entire show) + if (group.type === 'series') { + if (watchedShows.has(group.id)) { + logger.log(`🚫 [TraktFilter] Skipping show marked as watched on Trakt: ${group.id}`); + return; + } + } const cachedData = await getCachedMetadata(group.type, group.id); if (!cachedData?.basicContent) return; const { metadata, basicContent } = cachedData; @@ -392,6 +425,13 @@ const ContinueWatchingSection = React.forwardRef((props, re return; } + // Check if this show is marked as watched on Trakt (entire show) + const { watchedShows } = await traktDataPromise; + if (watchedShows.has(showId)) { + logger.log(`🚫 [TraktSync] Skipping show marked as watched on Trakt: ${showId}`); + return; + } + const nextEpisode = info.episode + 1; const cachedData = await getCachedMetadata('series', showId); if (!cachedData?.basicContent) return; From 1ca8813e5802d7da84d61a046a37207d1a4749f8 Mon Sep 17 00:00:00 2001 From: Aayush Rautela Date: Mon, 29 Sep 2025 22:59:14 +0200 Subject: [PATCH 2/3] C/I --- .github/workflows/ci.yml | 194 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 194 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..d597ce27 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,194 @@ +name: CI + +on: + push: + branches: [ main, develop ] + pull_request: + branches: [ main, develop ] + +jobs: + test: + name: Test and Build + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '18' + cache: 'npm' + + - name: Install dependencies + run: npm ci + + - name: Run TypeScript check + run: npx tsc --noEmit + + - name: Run ESLint (if available) + run: | + if [ -f ".eslintrc.js" ] || [ -f ".eslintrc.json" ] || [ -f "eslint.config.js" ]; then + npx eslint . --ext .ts,.tsx,.js,.jsx + else + echo "No ESLint config found, skipping linting" + fi + continue-on-error: true + + - name: Check for common issues + run: | + echo "Checking for common React Native issues..." + + # Check for console.log statements in production code + if grep -r "console\.log" src/ --include="*.ts" --include="*.tsx" | grep -v "// console.log" | head -5; then + echo "⚠️ Found console.log statements in source code" + else + echo "✅ No console.log statements found" + fi + + # Check for TODO comments + if grep -r "TODO\|FIXME\|HACK" src/ --include="*.ts" --include="*.tsx" | head -5; then + echo "⚠️ Found TODO/FIXME/HACK comments" + else + echo "✅ No TODO comments found" + fi + + # Check package.json for required fields + if [ -f "package.json" ]; then + echo "✅ package.json exists" + if grep -q '"name"' package.json; then + echo "✅ Package name defined" + else + echo "❌ Package name missing" + exit 1 + fi + else + echo "❌ package.json missing" + exit 1 + fi + + - name: Verify React Native setup + run: | + echo "Verifying React Native setup..." + + # Check if React Native is properly installed + if npm list react-native > /dev/null 2>&1; then + echo "✅ React Native is installed" + else + echo "❌ React Native not found" + exit 1 + fi + + # Check if Expo is properly installed + if npm list expo > /dev/null 2>&1; then + echo "✅ Expo is installed" + else + echo "❌ Expo not found" + exit 1 + fi + + # Check for required config files + if [ -f "app.json" ]; then + echo "✅ app.json exists" + else + echo "❌ app.json missing" + exit 1 + fi + + if [ -f "babel.config.js" ]; then + echo "✅ babel.config.js exists" + else + echo "❌ babel.config.js missing" + exit 1 + fi + + if [ -f "metro.config.js" ]; then + echo "✅ metro.config.js exists" + else + echo "❌ metro.config.js missing" + exit 1 + fi + + - name: Test Metro bundler + run: | + echo "Testing Metro bundler..." + npx expo export --platform web --output-dir ./dist-test + if [ -d "./dist-test" ]; then + echo "✅ Metro bundler test successful" + rm -rf ./dist-test + else + echo "❌ Metro bundler test failed" + exit 1 + fi + + - name: Check Android build files + run: | + echo "Checking Android build configuration..." + if [ -d "android" ]; then + echo "✅ Android directory exists" + if [ -f "android/build.gradle" ]; then + echo "✅ Android build.gradle exists" + else + echo "❌ Android build.gradle missing" + exit 1 + fi + if [ -f "android/app/build.gradle" ]; then + echo "✅ Android app build.gradle exists" + else + echo "❌ Android app build.gradle missing" + exit 1 + fi + else + echo "⚠️ Android directory not found" + fi + + - name: Check iOS build files + run: | + echo "Checking iOS build configuration..." + if [ -d "ios" ]; then + echo "✅ iOS directory exists" + if [ -f "ios/Podfile" ]; then + echo "✅ iOS Podfile exists" + else + echo "❌ iOS Podfile missing" + exit 1 + fi + else + echo "⚠️ iOS directory not found" + fi + + - name: Security check + run: | + echo "Running security audit..." + npm audit --audit-level moderate || echo "⚠️ Security vulnerabilities found (non-blocking)" + + - name: Check environment variables + run: | + echo "Checking for required environment variables..." + if [ -f ".env.example" ]; then + echo "✅ .env.example found" + else + echo "⚠️ .env.example not found" + fi + + # Check for hardcoded secrets (basic check) + if grep -r "password\|secret\|key\|token" src/ --include="*.ts" --include="*.tsx" | grep -v "// " | grep -v "password:" | head -3; then + echo "⚠️ Potential hardcoded secrets found" + else + echo "✅ No obvious hardcoded secrets found" + fi + + - name: Build summary + run: | + echo "🎉 Build Summary:" + echo "✅ Dependencies installed" + echo "✅ TypeScript compilation check passed" + echo "✅ React Native setup verified" + echo "✅ Metro bundler test passed" + echo "✅ Build configuration verified" + echo "" + echo "📊 Project Stats:" + echo "- TypeScript files: $(find src -name '*.ts' -o -name '*.tsx' | wc -l)" + echo "- Total source lines: $(find src -name '*.ts' -o -name '*.tsx' -exec wc -l {} + | tail -1 | awk '{print $1}')" + echo "- Dependencies: $(npm list --depth=0 | wc -l)" From eea003c170c6dcc6aaa162e7402eb0e799f85ab1 Mon Sep 17 00:00:00 2001 From: Aayush Rautela <32957381+aayushrautela@users.noreply.github.com> Date: Mon, 29 Sep 2025 23:03:28 +0200 Subject: [PATCH 3/3] Delete .github/workflows/ci.yml --- .github/workflows/ci.yml | 194 --------------------------------------- 1 file changed, 194 deletions(-) delete mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml deleted file mode 100644 index d597ce27..00000000 --- a/.github/workflows/ci.yml +++ /dev/null @@ -1,194 +0,0 @@ -name: CI - -on: - push: - branches: [ main, develop ] - pull_request: - branches: [ main, develop ] - -jobs: - test: - name: Test and Build - runs-on: ubuntu-latest - - steps: - - name: Checkout code - uses: actions/checkout@v4 - - - name: Setup Node.js - uses: actions/setup-node@v4 - with: - node-version: '18' - cache: 'npm' - - - name: Install dependencies - run: npm ci - - - name: Run TypeScript check - run: npx tsc --noEmit - - - name: Run ESLint (if available) - run: | - if [ -f ".eslintrc.js" ] || [ -f ".eslintrc.json" ] || [ -f "eslint.config.js" ]; then - npx eslint . --ext .ts,.tsx,.js,.jsx - else - echo "No ESLint config found, skipping linting" - fi - continue-on-error: true - - - name: Check for common issues - run: | - echo "Checking for common React Native issues..." - - # Check for console.log statements in production code - if grep -r "console\.log" src/ --include="*.ts" --include="*.tsx" | grep -v "// console.log" | head -5; then - echo "⚠️ Found console.log statements in source code" - else - echo "✅ No console.log statements found" - fi - - # Check for TODO comments - if grep -r "TODO\|FIXME\|HACK" src/ --include="*.ts" --include="*.tsx" | head -5; then - echo "⚠️ Found TODO/FIXME/HACK comments" - else - echo "✅ No TODO comments found" - fi - - # Check package.json for required fields - if [ -f "package.json" ]; then - echo "✅ package.json exists" - if grep -q '"name"' package.json; then - echo "✅ Package name defined" - else - echo "❌ Package name missing" - exit 1 - fi - else - echo "❌ package.json missing" - exit 1 - fi - - - name: Verify React Native setup - run: | - echo "Verifying React Native setup..." - - # Check if React Native is properly installed - if npm list react-native > /dev/null 2>&1; then - echo "✅ React Native is installed" - else - echo "❌ React Native not found" - exit 1 - fi - - # Check if Expo is properly installed - if npm list expo > /dev/null 2>&1; then - echo "✅ Expo is installed" - else - echo "❌ Expo not found" - exit 1 - fi - - # Check for required config files - if [ -f "app.json" ]; then - echo "✅ app.json exists" - else - echo "❌ app.json missing" - exit 1 - fi - - if [ -f "babel.config.js" ]; then - echo "✅ babel.config.js exists" - else - echo "❌ babel.config.js missing" - exit 1 - fi - - if [ -f "metro.config.js" ]; then - echo "✅ metro.config.js exists" - else - echo "❌ metro.config.js missing" - exit 1 - fi - - - name: Test Metro bundler - run: | - echo "Testing Metro bundler..." - npx expo export --platform web --output-dir ./dist-test - if [ -d "./dist-test" ]; then - echo "✅ Metro bundler test successful" - rm -rf ./dist-test - else - echo "❌ Metro bundler test failed" - exit 1 - fi - - - name: Check Android build files - run: | - echo "Checking Android build configuration..." - if [ -d "android" ]; then - echo "✅ Android directory exists" - if [ -f "android/build.gradle" ]; then - echo "✅ Android build.gradle exists" - else - echo "❌ Android build.gradle missing" - exit 1 - fi - if [ -f "android/app/build.gradle" ]; then - echo "✅ Android app build.gradle exists" - else - echo "❌ Android app build.gradle missing" - exit 1 - fi - else - echo "⚠️ Android directory not found" - fi - - - name: Check iOS build files - run: | - echo "Checking iOS build configuration..." - if [ -d "ios" ]; then - echo "✅ iOS directory exists" - if [ -f "ios/Podfile" ]; then - echo "✅ iOS Podfile exists" - else - echo "❌ iOS Podfile missing" - exit 1 - fi - else - echo "⚠️ iOS directory not found" - fi - - - name: Security check - run: | - echo "Running security audit..." - npm audit --audit-level moderate || echo "⚠️ Security vulnerabilities found (non-blocking)" - - - name: Check environment variables - run: | - echo "Checking for required environment variables..." - if [ -f ".env.example" ]; then - echo "✅ .env.example found" - else - echo "⚠️ .env.example not found" - fi - - # Check for hardcoded secrets (basic check) - if grep -r "password\|secret\|key\|token" src/ --include="*.ts" --include="*.tsx" | grep -v "// " | grep -v "password:" | head -3; then - echo "⚠️ Potential hardcoded secrets found" - else - echo "✅ No obvious hardcoded secrets found" - fi - - - name: Build summary - run: | - echo "🎉 Build Summary:" - echo "✅ Dependencies installed" - echo "✅ TypeScript compilation check passed" - echo "✅ React Native setup verified" - echo "✅ Metro bundler test passed" - echo "✅ Build configuration verified" - echo "" - echo "📊 Project Stats:" - echo "- TypeScript files: $(find src -name '*.ts' -o -name '*.tsx' | wc -l)" - echo "- Total source lines: $(find src -name '*.ts' -o -name '*.tsx' -exec wc -l {} + | tail -1 | awk '{print $1}')" - echo "- Dependencies: $(npm list --depth=0 | wc -l)"