Skip to content

Native Google Drive Sync (App Data Storage)#2600

Open
ramailo1 wants to merge 3 commits intorecloudstream:masterfrom
ramailo1:feature/google-drive-sync
Open

Native Google Drive Sync (App Data Storage)#2600
ramailo1 wants to merge 3 commits intorecloudstream:masterfrom
ramailo1:feature/google-drive-sync

Conversation

@ramailo1
Copy link
Copy Markdown

@ramailo1 ramailo1 commented Apr 2, 2026

Feature: Native Google Drive Sync (App Data Storage)

📝 Overview

This PR implements a native, privacy-safe synchronization provider using Google Drive's App Data folder. Unlike traditional trackers (AniList/MAL), this feature syncs the entire application state (settings, bookmarks, and local data) across devices.

🛡️ Privacy & Security

  • Scoped Storage: Uses the appDataFolder scope, which is hidden from the user's main Drive UI and inaccessible to other apps.
  • Modern Auth: Implements the latest Google Identity (One Tap) and Credential Manager APIs (replaces the deprecated GoogleAuthUtil).
  • No Extra Permissions: Only requires the user's permission to write to its own hidden app folder.

🛠️ Technical Changes

  • SyncManager: A modern implementation using AuthorizationRequest and Identity clients for OAuth2 token management.
  • BackupUtils Integration: Seamlessly hooks into the existing BackupFile architecture. Special care was taken to preserve the latest upstream fixes (e.g., DOWNLOAD_HEADER_CACHE).
  • UI/UX:
    • Added a new SyncSettingsFragment providing "Push Now", "Pull Now", and "Auto-sync" options.
    • Native "Bottom Sheet" sign-in flow.
  • Build System: Migrated required dependencies to the project's Version Catalog (libs.versions.toml).

⚙️ Setup for Maintainers

Important

To enable this feature in official builds, the following setup is required in the Google Cloud Console:

  1. Enable API: Enable the Google Drive API in your project.
  2. OAuth Consent: Ensure your OAuth consent screen is configured for your app's package name and includes the drive.appdata scope.
  3. local.properties: Add your Google OAuth 2.0 Client ID (Android):
    google.client_id=your_client_id_here.apps.googleusercontent.com

✅ Verification & Compatibility

  • Rebased: Fully rebased against recloudstream/cloudstream (Master) as of Feb 28, 2026.
  • Conflict Free: Tested against the recent "Backup fix" and "Download rework" commits to ensure data integrity.

Note: I've verified the navigation graph and fragment bindings, everything is ready for a prompt merge.

Copy link
Copy Markdown
Collaborator

@fire-light42 fire-light42 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. We have an AI policy, please read and update your PR:
    https://github.com/recloudstream/cloudstream/blob/master/AI-POLICY.md

  2. Read the issue with backup and sync at #1641 (comment) The current implementation is insufficient and will create a lot of confusion using it.

  3. Check out #2411 and the issues related to it, as they implement the same feature.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants