Skip to content

Change login flow for gmail - #49

Merged
rajzik merged 5 commits into
mainfrom
some-fixes
Jul 17, 2026
Merged

rajzik merged 5 commits into
mainfrom
some-fixes

Conversation

@rajzik

@rajzik rajzik commented Jul 17, 2026 •

Copy link
Copy Markdown
Contributor

View with Codesmith Autofix with Codesmith
Need help on this PR? Tag @codesmith with what you need. Autofix is disabled.

Summary by CodeRabbit

  • New Features
    • Simplified Gmail connection to a single “Sign in with Google” button.
    • Improved Google sign-in using PKCE with state validation, token exchange, and safe cancellation.
    • Strengthened Gmail connection verification by deriving identity from OAuth/profile responses and refreshed tokens.
  • Documentation
    • Updated Apple local setup to use repo-root .env.local with app-specific overrides.
    • Refreshed Gmail OAuth and Sign in with Apple setup guidance, including callback scheme requirements and “no client secrets in-app” emphasis.
  • Chores
    • Adjusted Xcode environment/build settings and URL scheme registration for OAuth callbacks.
  • Tests
    • Added/updated unit coverage for env parsing and OAuth request/verification flows.

rajzik added 2 commits July 17, 2026 18:41
…ating environment configurations. The .env.example file now includes GMAIL_OAUTH_CLIENT_ID and GMAIL_PUBSUB_TOPIC for better clarity on app-specific settings. The AccountView has been updated to utilize the new GoogleGmailOAuthService for handling OAuth, while the GmailProviderConnectionService has been refactored to streamline credential verification. Additionally, tests have been added to ensure proper handling of Apple client values and OAuth requests.
@cursor

cursor Bot commented Jul 17, 2026

Copy link
Copy Markdown

Bugbot is not enabled for your account, so this pull request was not reviewed.

Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs.

@coderabbitai

coderabbitai Bot commented Jul 17, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Important

Review skipped

No new commits to review since the last review.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: f91baa52-e2e4-4e88-99cf-b8d33bd4ad85

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Changes

Apple configuration and build wiring

Layer / File(s) Summary
Apple client configuration and signing setup
.env.example, apps/unwired-mail/..., .gitignore, packages/convex/package.json
Apple client environment keys are filtered from repository dotenv files, optional local signing settings are included, Xcode references the OAuth service and shared configuration, and Convex loads the repository environment file.
Development documentation and validation
README.md, docs/bootstrap-review.md, apps/unwired-mail/unwired-mailTests/DotEnvFileTests.swift
Local OAuth, signing, environment, and secret-handling instructions are updated, with tests covering exclusion of backend secrets.

Google PKCE authorization

Layer / File(s) Summary
OAuth request and session flow
apps/unwired-mail/unwired-mail/Services/ProductAccount/GoogleGmailOAuthService.swift, apps/unwired-mail/unwired-mailTests/GmailProviderConnectionServiceTests.swift
Google authorization uses PKCE, state validation, ASWebAuthenticationSession, and a form-encoded token exchange returning access and refresh tokens.

Gmail credential verification

Layer / File(s) Summary
Account identity and permission verification
apps/unwired-mail/unwired-mail/Services/ProductAccount/GmailProviderConnectionService.swift, apps/unwired-mail/unwired-mailTests/GmailProviderConnectionServiceTests.swift
Verification derives the OpenID subject, checks Gmail profile and message-body access, refreshes tokens, and compares refreshed identity values.

Account sign-in integration

Layer / File(s) Summary
Google sign-in UI and connection flow
apps/unwired-mail/unwired-mail/Features/Account/AccountView.swift
Manual Gmail credential fields are replaced with a Google sign-in button that authorizes, verifies, and completes the connection.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant AccountView
  participant GmailProviderConnectionViewModel
  participant GoogleGmailOAuthService
  participant Google
  participant GoogleGmailProviderCredentialVerifier
  AccountView->>GmailProviderConnectionViewModel: Tap Sign in with Google
  GmailProviderConnectionViewModel->>GoogleGmailOAuthService: authorize()
  GoogleGmailOAuthService->>Google: PKCE authorization and token exchange
  Google-->>GoogleGmailOAuthService: Access and refresh tokens
  GoogleGmailOAuthService-->>GmailProviderConnectionViewModel: Return tokens
  GmailProviderConnectionViewModel->>GoogleGmailProviderCredentialVerifier: verify(tokens)
  GoogleGmailProviderCredentialVerifier->>Google: Check profile, subject, scope, and refresh
  Google-->>GoogleGmailProviderCredentialVerifier: Verification responses
  GoogleGmailProviderCredentialVerifier-->>GmailProviderConnectionViewModel: Verified Gmail account
Loading

Possibly related PRs

  • unwired-dev/product#30: Modifies Gmail credential verification and token scope checks in the same provider flow.
  • unwired-dev/product#34: Adds Convex client wrappers for encrypted Product Sync APIs used by related synchronization flows.

Suggested labels: codex

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 8.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title matches the core change: the Gmail sign-in/login flow was overhauled.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch some-fixes

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@README.md`:
- Line 40: Update the developer setup documentation around the Convex
environment configuration to reference the repository-root .env.local
consistently with the updated Convex script, replacing any
packages/convex/.env.local instructions. Ensure the setup and common-command
guidance tells developers where to place the required values so fresh setups use
the configured environment.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 456db136-4b62-482a-b251-3748d1cdb56e

📥 Commits

Reviewing files that changed from the base of the PR and between acb503f and acd818c.

⛔ Files ignored due to path filters (1)
  • packages/convex/convex/_generated/api.d.ts is excluded by !**/_generated/**
📒 Files selected for processing (13)
  • .env.example
  • .gitignore
  • README.md
  • apps/unwired-mail/unwired-mail.xcodeproj/project.pbxproj
  • apps/unwired-mail/unwired-mail/Features/Account/AccountView.swift
  • apps/unwired-mail/unwired-mail/Services/DotEnvFile.swift
  • apps/unwired-mail/unwired-mail/Services/ProductAccount/GmailProviderConnectionService.swift
  • apps/unwired-mail/unwired-mail/Services/ProductAccount/GoogleGmailOAuthService.swift
  • apps/unwired-mail/unwired-mail/Shared.xcconfig
  • apps/unwired-mail/unwired-mailTests/DotEnvFileTests.swift
  • apps/unwired-mail/unwired-mailTests/GmailProviderConnectionServiceTests.swift
  • docs/bootstrap-review.md
  • packages/convex/package.json

Comment thread README.md

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: acd818c8de

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread packages/convex/package.json

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 52e534e07c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
apps/unwired-mail/unwired-mail.xcodeproj/project.pbxproj (1)

489-502: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Do not override OAuth settings with empty target values.

Because target-level settings override Shared.xcconfig, these empty assignments cause Info.plist to resolve GmailOAuthClientId and CFBundleURLSchemes to empty strings in both Debug and Release. Google cannot return to the app, so the login flow fails. Remove these assignments or provide real per-configuration values.

Proposed fix
-				GMAIL_OAUTH_CALLBACK_SCHEME = "";
-				GMAIL_OAUTH_CLIENT_ID = "";
-				GMAIL_PUBSUB_TOPIC = "";

Apply this to both Debug and Release unless these values are intentionally supplied directly in the target configuration.

Also applies to: 523-536

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@apps/unwired-mail/unwired-mail.xcodeproj/project.pbxproj` around lines 489 -
502, Remove the empty GMAIL_OAUTH_CALLBACK_SCHEME and GMAIL_OAUTH_CLIENT_ID
assignments from the target buildSettings blocks for both Debug and Release,
allowing Shared.xcconfig values to flow through; only retain target-level
assignments if they contain valid per-configuration OAuth values.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In `@apps/unwired-mail/unwired-mail.xcodeproj/project.pbxproj`:
- Around line 489-502: Remove the empty GMAIL_OAUTH_CALLBACK_SCHEME and
GMAIL_OAUTH_CLIENT_ID assignments from the target buildSettings blocks for both
Debug and Release, allowing Shared.xcconfig values to flow through; only retain
target-level assignments if they contain valid per-configuration OAuth values.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 08b16322-a9d4-4534-b5a6-bf6a9d1195c8

📥 Commits

Reviewing files that changed from the base of the PR and between 52e534e and f303a2d.

📒 Files selected for processing (3)
  • README.md
  • apps/unwired-mail/unwired-mail.xcodeproj/project.pbxproj
  • apps/unwired-mail/unwired-mail/Info.plist

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f303a2de9b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread apps/unwired-mail/unwired-mail.xcodeproj/project.pbxproj Outdated
@rajzik

rajzik commented Jul 17, 2026

Copy link
Copy Markdown
Contributor Author

@codex review

@rajzik

rajzik commented Jul 17, 2026

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 17, 2026 •

Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

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.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Keep it up!

Reviewed commit: ab3c208a13

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

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.

1 participant