Skip to content

Conversation

@M4dhav
Copy link
Contributor

@M4dhav M4dhav commented Aug 31, 2025

Description

This PR fixes the OAuth issues in Resonate which were causing OAuth to not function properly after addition of automatic build workflows.

Related to #504

Type of change

  • Bug fix (non-breaking CHANGE which fixes an issue)

How Has This Been Tested?

Tested by building the app both via workflow and locally

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules
  • I have checked my code and corrected any misspellings

Maintainer Checklist

Summary by CodeRabbit

  • New Features
    • Enabled GitHub sign-in from the Welcome screen.
  • Bug Fixes
    • Improved Android authentication callback handling to better support multiple environments and reduce sign-in issues.
  • Chores
    • Incremented build number to 1.0.1+4.
    • Updated Android store deployment workflow configuration.

@M4dhav M4dhav self-assigned this Aug 31, 2025
@M4dhav M4dhav added the gsoc Part of Google Summer of Code season label Aug 31, 2025
@coderabbitai
Copy link

coderabbitai bot commented Aug 31, 2025

Walkthrough

Introduces an environment variable for Appwrite project ID in the Android store deploy workflow, wires this value into Android via Gradle manifest placeholders, updates intent-filter schemes in the manifest to use the placeholder, enables GitHub login action in the welcome screen, and bumps the app build number.

Changes

Cohort / File(s) Summary
CI workflow
.github/workflows/store_deploy_android.yml
Adds APPWRITE_PROJECT_ID to job env using ${{ secrets.APPWRITE_PROJECT_ID }}.
Android build config
android/app/build.gradle.kts
Reads APPWRITE_PROJECT_ID from environment (default "resonate"); prints it; adds manifestPlaceholders["PROJECT_ID"] = projectId.
Android manifest & deep links
android/app/src/main/AndroidManifest.xml
Removes package attribute from root <manifest>; replaces hardcoded schemes appwrite-callback-resonate with appwrite-callback-${PROJECT_ID} for MainActivity and flutter_web_auth_2.CallbackActivity.
Flutter UI login action
lib/views/screens/welcome_screen.dart
Changes GitHub sign-in button to async and calls await controller.loginWithGithub().
Versioning
pubspec.yaml
Increments build number from 1.0.1+3 to 1.0.1+4.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor U as User
  participant W as WelcomeScreen
  participant C as Controller
  participant F as FlutterWebAuth2
  participant GH as GitHub OAuth
  participant AW as Appwrite
  participant A as Android (Intent Filters)

  U->>W: Tap "Sign in with GitHub"
  W->>C: loginWithGithub()
  activate C
  C->>F: Start auth session (callback scheme: appwrite-callback-${PROJECT_ID})
  F->>GH: Open OAuth authorize URL
  GH-->>AW: Redirect with code
  AW-->>A: Redirect to app scheme appwrite-callback-${PROJECT_ID}
  A-->>F: Deliver callback intent
  F-->>C: Return callback URL (token/code)
  C-->>W: Resolve login future
  deactivate C
  W-->>U: Proceed (logged in)
Loading
sequenceDiagram
  autonumber
  participant WF as CI Workflow
  participant G as Gradle Build
  participant M as AndroidManifest
  participant APK as App Package

  WF->>G: Set env APPWRITE_PROJECT_ID
  G->>G: Read env (default "resonate")
  G->>M: Apply manifestPlaceholders PROJECT_ID
  M->>APK: Embed scheme appwrite-callback-${PROJECT_ID}
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Poem

In burrows of code where secrets hide,
A project ID hops inside.
Schemes now shift with nimble grace,
GitHub doors unlock apace.
Build hops +1, with ears held high—
appwrite-callback, we comply.
Thump-thump, release draws nigh! 🐇✨

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore or @coderabbit ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@github-actions
Copy link
Contributor

🎉 Welcome @M4dhav!
Thank you for your pull request! Our team will review it soon. 🔍

  • Please ensure your PR follows the contribution guidelines. ✅
  • All automated tests should pass before merging. 🔄
  • If this PR fixes an issue, link it in the description. 🔗

We appreciate your contribution! 🚀

@M4dhav
Copy link
Contributor Author

M4dhav commented Aug 31, 2025

@coderabbitai review

@coderabbitai
Copy link

coderabbitai bot commented Aug 31, 2025

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (2)
lib/views/screens/welcome_screen.dart (1)

148-150: Guard against double-taps and surface failures.

Consider disabling the button while the flow is in progress and wrapping the call in try/catch to show a SnackBar/dialog on error.

android/app/src/main/AndroidManifest.xml (1)

62-62: Scheme placeholder aligns with Appwrite’s OAuth redirect pattern.

Ensure APPWRITE_PROJECT_ID resolves at build time (fallback “resonate” is acceptable locally) and that your Appwrite client config uses the same project. Test a deep link to validate CallbackActivity resolution.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between b6e8672 and 63a0a6c.

📒 Files selected for processing (5)
  • .github/workflows/store_deploy_android.yml (1 hunks)
  • android/app/build.gradle.kts (2 hunks)
  • android/app/src/main/AndroidManifest.xml (2 hunks)
  • lib/views/screens/welcome_screen.dart (1 hunks)
  • pubspec.yaml (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Run Software Tests
🔇 Additional comments (6)
pubspec.yaml (1)

20-20: Version bump noted; ensure platform parity.

Confirm iOS CFBundleVersion/CFBundleShortVersionString and Play Store versionCode/versionName reflect 1.0.1+4 to avoid store upload rejects.

lib/views/screens/welcome_screen.dart (1)

148-150: Enabling GitHub sign-in looks good.

android/app/build.gradle.kts (1)

44-44: Manifest placeholder wiring OK.

PROJECT_ID propagates cleanly to the manifest via placeholders.

.github/workflows/store_deploy_android.yml (2)

27-27: Good: expose APPWRITE_PROJECT_ID to the job environment.

This ensures Gradle sees the variable during the Android build.


27-27: Verify secret availability across environments.

Confirm the secret exists in repo/org secrets for all branches using this workflow, and matches the Appwrite project used by your runtime (--dart-define).

android/app/src/main/AndroidManifest.xml (1)

1-1: Safe to drop package when namespace is set.

With namespace defined in Gradle, removing the manifest package is correct and avoids duplication.

Comment on lines +33 to +34
val projectId: String = System.getenv("APPWRITE_PROJECT_ID") ?: "resonate"
println("PROJECT_ID: $projectId")
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Don’t print secrets; prefer property with env fallback.

Avoid logging the project ID, and allow overriding via Gradle property for local builds.

Apply:

-val projectId: String = System.getenv("APPWRITE_PROJECT_ID") ?: "resonate"
-println("PROJECT_ID: $projectId")
+val projectId: String =
+    (System.getenv("APPWRITE_PROJECT_ID")
+        ?: (project.findProperty("APPWRITE_PROJECT_ID") as String?))
+        ?: "resonate"
+project.logger.lifecycle("PROJECT_ID configured") // avoid printing the value
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
val projectId: String = System.getenv("APPWRITE_PROJECT_ID") ?: "resonate"
println("PROJECT_ID: $projectId")
val projectId: String =
(System.getenv("APPWRITE_PROJECT_ID")
?: (project.findProperty("APPWRITE_PROJECT_ID") as String?))
?: "resonate"
project.logger.lifecycle("PROJECT_ID configured") // avoid printing the value
🤖 Prompt for AI Agents
In android/app/build.gradle.kts around lines 33 to 34, remove the println that
logs the project ID and instead obtain the projectId by first checking for a
Gradle property (project.findProperty("appwriteProjectId")) and falling back to
the APPWRITE_PROJECT_ID environment variable; do not print or log the resolved
value anywhere in the build file; ensure the property name is documented in
README or gradle.properties for local overrides.

@M4dhav M4dhav merged commit 5f07656 into AOSSIE-Org:dev Aug 31, 2025
3 checks passed
@github-actions
Copy link
Contributor

PR Closed - Thank You, @M4dhav!

  • If this PR was merged: Congratulations! Your contribution is now part of the project. 🚀
  • If this PR was closed without merging: Don’t worry! You can always improve it and submit again. 💪

We appreciate your effort and look forward to more contributions from you! 🤝

@coderabbitai coderabbitai bot mentioned this pull request Oct 27, 2025
16 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gsoc Part of Google Summer of Code season

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant