-
Notifications
You must be signed in to change notification settings - Fork 311
Add Configuration for OAuth to work with workflows #513
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
WalkthroughIntroduces 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
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)
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}
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Poem
✨ Finishing Touches
🧪 Generate unit tests
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
CodeRabbit Configuration File (
|
|
🎉 Welcome @M4dhav!
We appreciate your contribution! 🚀 |
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
There was a problem hiding this 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.
📒 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.
| val projectId: String = System.getenv("APPWRITE_PROJECT_ID") ?: "resonate" | ||
| println("PROJECT_ID: $projectId") |
There was a problem hiding this comment.
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.
| 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.
|
✅ PR Closed - Thank You, @M4dhav!
We appreciate your effort and look forward to more contributions from you! 🤝 |
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
How Has This Been Tested?
Tested by building the app both via workflow and locally
Checklist:
Maintainer Checklist
Summary by CodeRabbit