Skip to content

feat(mobile-android): add settings - #4758

Open
AatmanAJ wants to merge 632 commits into
CapSoftware:mainfrom
AatmanAJ:feat/mobile-android-settings
Open

AatmanAJ wants to merge 632 commits into
CapSoftware:mainfrom
AatmanAJ:feat/mobile-android-settings

Conversation

@AatmanAJ

@AatmanAJ AatmanAJ commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor

Stacked on the editor PR (#4754), which sits on the earlier Android PRs. Only the top 25 commits are new here, 1d6a637..c34367b: 24 commits and a merge of #4754's latest fixes, from "lay out the settings root in sections" to "ignore organisation reads from before a change". Once the PRs below merge this shows only its own diff.

This PR adds the settings from iOS, in full apart from push.

What is in it

Someone can now edit their profile and photo, run their organisation, choose which emails they get, see their plan, reach help and the legal pages, and ask for their account to be deleted.

  • Settings root. The grouped iOS layout: the profile header, the organisation section with the active organisation picker when there is more than one, the App section with the version, Help & Legal, and Sign out on its own with its confirmation.
  • Plan. Cap Pro or Free, with the five minute note on the free plan, a spinner while loading and Retry when the plan request failed. Pull to refresh reloads the account and plan, and the plan is checked again whenever the app comes back on a free plan, so an upgrade made on the web shows up.
  • Profile. First and last name and the read-only email. Save stays off until a trimmed name differs and the first name is not empty, checks the 255 character limit, sends a cleared last name as null and shows "Profile updated".
  • Profile photo. Choose photo or Remove photo from the system photo picker. The image is decoded with ImageDecoder, which applies the EXIF orientation, scaled to at most 1,024 px and written as JPEG at qualities 86, 78, 68, 56 and 45, keeping the first that fits in 1 MiB, then halved to 512 px before giving up with the iOS "too large" message. Re-encoding drops the metadata.
  • Organisation settings. The icon with the viewer's role, the name, the allowed email domain with its validity footer, the read-only custom domain with Verified or Pending, and the organisation id. Only owners and admins can edit, change the icon or see Save. Save trims the name, lower-cases the domain, sends an empty domain as null and refreshes the account so the new name and icon show across the app.
  • Notifications. The five iOS email switches with their captions. A switch moves at once and its change joins a queue that sends one request at a time, so a reply that arrives while later changes are waiting can never flip a switch back (the bug in Mobile Cap settings revert when independent saves finish out of order #3150), and a refresh during a save does not overwrite them. A failed save shows the error and returns the switches to what the server holds.
  • Delete account. The iOS warning, "Type DELETE to confirm" and the support footer. The request stays off until the field holds exactly DELETE, then asks "Delete your Cap account?" before posting. On success the app signs out. Google Play, like the App Store, requires an in-app path to deletion.
  • Links and permissions. View the Cap dashboard opens in the system browser so an existing cap.so sign-in carries over, and Permissions opens Cap's page in the system settings. Help & Support, Privacy Policy and Terms of Service open in a Custom Tab.

Fixes from review

  • The organisation form waits out an organisation switch. The server applies organisation settings to the active organisation, but the Organization settings row stayed open during a switch and the form loaded only once, so a save or icon change could reach the new organisation while the form showed the old one. The row is disabled during a switch, the form refuses to save or change the icon until it has loaded the current organisation, and it loads again when the active organisation changes.
  • The email restriction accepts what the server accepts. It was checked as user@ plus the whole value, so a stored email address or a comma-separated list showed as invalid and Save stayed disabled even for a name change. Each entry is now checked as a domain or an email address, the same rules as the mobile route.
  • A notification read cannot undo a newer change. A refresh answered after a switch change had been saved turned the switch back. A read is now dropped when a change was made after it was asked for.
  • Icon changes and refreshes keep the typed name and email restriction. Every answer reset both fields to the stored values. They are now replaced only on the first load, after their own save, or for a different organisation; otherwise only fields the user has not edited follow the server.
  • Account deletion, profile and organisation changes finish after their screen closes. These requests ran in the screen's coroutine scope, so leaving the screen mid-request cancelled the app's side after the server had acted: a deletion the server accepted left the user signed in, and a saved name, photo or organisation change did not reach the rest of the app. The requests now live in AccountDeletionModel, ProfileModel and OrganizationSettingsModel and run on the session's scope, which only ends at sign-out.
  • An older bootstrap cannot bring back the old user. A bootstrap refresh asked for before a profile edit, and answered after it, put the old name and photo back. An edit now moves the bootstrap generation on, the same way an organisation switch does, so that answer is dropped.
  • Profile and organisation changes are sent one at a time. Each answer carries the whole user or organisation, so a photo or icon change answered after a name save, but read before it, put the old name back. Changes now go to the server in the order they were made.
  • Confirming a deletion drops the field's focus first. The confirmation dialog takes the keyboard away, and when it closed on Android 10 and earlier the DELETE field was left focused with no keyboard. The request row now clears focus before the dialog opens, so nothing is left focused when it closes.

After the first review on this PR, and with #4754's latest fixes merged in:

  • Organisation changes stay on the organisation they were made for. The organisation endpoints act on whichever organisation is active when the request arrives, and a switch did not wait for a save queued behind a slow icon change, so the save could reach the organisation switched to. Organisation saves, icon changes and switches now share one queue on the session, so a switch waits for changes made before it, and a change is not sent once another organisation is active.
  • Profile changes from different visits share one queue. Each visit to the profile page had its own lock while its requests kept running after the page closed, so a photo change from one visit could undo a name saved on the next. The lock now lives on the session.
  • A notification read that overlaps a save is dropped. A read started after a switch change but answered after its save could turn the switch back. Each save answer now counts as a change, so such a read is ignored.
  • Organisation reads from before a change are ignored. A refresh that read the organisation before a save, and answered after it, put the old name and email restriction back, and the account refresh after a change could join a read started before it. The form drops reads older than the last save or icon change, and these changes ask for a fresh account that replaces any read already in flight.

To test the organisation form on the JVM, its state moved from the screen into OrganizationSettingsModel first, with no change in behaviour.

Screenshots

Screen Light Dark
Settings root
Settings root, scrolled to the end
Plan row
Profile
Organisation settings, as an owner
Notifications
Delete account
Delete confirmation

All on the API 37 emulator before the review fixes, none of which change these screens, signed in to the fixture server as an owner on Cap Pro. The API 29 settings use the same layout.

Where it differs from iOS, on purpose

  • No upgrade link yet. The upgrade row is built but sits behind the WEB_UPGRADE build flag, which is off, until Cap decides its position on upgrade links under Google Play's payments rules.
  • No push permission row. Android push needs server support and comes with a later PR.
  • "this device" instead of "this iPhone" in the delete confirmation.
  • Custom Tabs stand in for Safari's in-app sheet for the help and legal pages.
  • The notifications page keeps saving after it is left, because its model lives for the session, so a queue of changes still reaches the server.

Tests

  • capkit, :capkit:test: 231 tests, none new in this PR.
  • JVM, :app:testDebugUnitTest: 442 tests, 29 of them new. OrganizationSettingsModelTest (8) covers the switch, the email restriction rules, drafts kept across an icon change, a save and an icon change that finish after the screen is gone, a name save that an icon answer cannot undo, a save queued behind an icon change that reaches the server before a switch, and a refresh asked for before a save that cannot bring the old name back. SettingsRequestsTest (4) cancels a stand-in screen scope while the server holds the reply and checks that an account deletion still signs out and a saved name still reaches the app, and checks that a photo answer cannot undo a name save, from the same visit or an earlier one. NotificationSettingsModelTest (13) drives the save queue against a loopback server that holds replies: a second change waits for the first answer, an earlier reply cannot flip a later switch back, a refresh during a save keeps the switches, a read asked for before a change is dropped, a read that overlaps a save and answers last is dropped, and a failed save drops the queue and returns to the server state. SessionModelTest gains 4, for the plan error and retry, for replacing the signed-in user after an edit, for an older bootstrap answer that must not bring the old user back, and for a bootstrap read from before an organisation change that a fresh one replaces. Each review fix's test fails without its fix.
  • Instrumented, new ImageEncoderTest (6), on a device because ImageDecoder and Bitmap do not run on the JVM: the 1,024 px and 1 MiB limits, dropped metadata, the first quality that fits, and halving to 512 px before giving up.
  • Instrumented, new SettingsTest (4) against the fixture server: Cap Pro, Free without an upgrade link, notification switches that save and stay after a relaunch, only DELETE enabling the request, and no focus left on the field after the confirmation is cancelled.

Device runs, connectedDebugAndroidTest once per API against the fixture server, on this branch before #4754's latest fixes and the review fixes were added:

  • API 37 emulator: 80 tests, 77 passed. The 3 failures are CapDetailTest playback tests (playAndPause, aShareLinkWithATimeOpensTheCapThere, aChosenSpeedIsKeptAfterTheAppIsOpenedAgain), which this emulator image cannot run because it does not decode the fixture video; this PR does not touch playback.
  • API 29 emulator: 80 tests, 79 passed. SettingsTest.onlyTypingDeleteEnablesTheRequest failed in the run and in a retry, because the DELETE field kept focus after the confirmation closed. That is the last fix above.
  • With that fix, SettingsTest (4) and SignInTest (12) pass on both API 37 and API 29. SignInTest's signingOutReturnsToSignIn reads the Version row in the new layout. Without the fix, SettingsTest fails on API 29 in 3 of 3 runs; with it, it passes in 3 of 3.
  • At c34367b4e, with the review fixes, SettingsTest (4), SignInTest (13) and ImageEncoderTest (6) pass on both the API 37 and API 29 emulators.

Checked

  • ./gradlew spotlessCheck :capkit:test :app:testDebugUnitTest :app:lintDebug :app:assembleDebug :app:assembleRelease :app:assembleDebugAndroidTest passes on the last commit, c34367b, run once with --no-build-cache --rerun-tasks: 442 JVM tests in 35 classes and 231 capkit tests in 16 classes, no failures, and lint found no errors or warnings.

Not checked

  • The full instrumented suite at c34367b4e; only the settings, sign-in and image encoder classes ran there.
  • Screenshots of the photo control while busy or with a photo, organisation settings as a member, and the Free, loading and Retry plan states. SettingsTest covers Free, and SessionModelTest covers the plan error and retry.
  • Saving the profile, photo, organisation and notification settings, and deleting an account, against a real server; covered by JVM tests against a local server and by the instrumented tests through the relay.
  • The photo picker and the system settings page.
  • TalkBack speech, and a physical phone.

Confidence Score: 2/5RetriggerView in Greptile

The PR still needs fixes for the exposed upgrade link, incomplete plan refresh and upload cancellation that can exceed Android’s broadcast deadline.

Findings

  1. P1 Plan never recovers or updates ▶
  2. P1 Upgrade flag is bypassed ▶
  3. P1 Cancel can make Android wait ▶
  4. P2 Older replies undo an upgrade ▶
  5. P2 Fixed-focus devices lose access ▶
Fix with agent prompt
### Issue 1
apps/mobile-android/app/src/main/kotlin/so/cap/mobile/features/settings/SettingsScreen.kt:436-443
The redesigned settings page removes Retry, pull-to-refresh and the resume check for the plan. `refreshPlan()` now runs only when the session starts. If that request fails, this row spins for the rest of the session. If a free user upgrades on the web, the app keeps treating them as free until restart or sign-in. Restore the error/retry state and plan refresh on return.

### Issue 2
apps/mobile-android/app/src/main/kotlin/so/cap/mobile/features/settings/SettingsScreen.kt:445-448
The upgrade row no longer checks `BuildConfig.WEB_UPGRADE`, although the flag is still `false`. Every free user now gets a web upgrade link. The PR explicitly says this must stay off until Cap decides how to handle Google Play’s payment rules. Restore the flag check.

### Issue 3
apps/mobile-android/app/src/main/kotlin/so/cap/mobile/services/UploadActions.kt:55-62
`UploadActionReceiver` keeps its broadcast open while `deleteCap()` waits for the network. That request allows 30 seconds without a reply and 120 seconds overall. On a slow connection, this can exceed Android's broadcast deadline and make Android report the app as unresponsive. `goAsync()` does not remove that deadline. Move the network cleanup into scheduled work and finish the broadcast promptly.

### Issue 4
apps/mobile-android/app/src/main/kotlin/so/cap/mobile/features/settings/SettingsScreen.kt:114-116
Returning to Settings can start another plan request while the previous one is still running. `refreshPlan()` accepts every reply, so an older Free reply arriving after a newer Pro reply changes the account back to Free in the app until another refresh succeeds. Keep only the newest reply, or share one pending request.

### Issue 5
apps/mobile-android/app/src/main/AndroidManifest.xml:undefined-14
Adding `CAMERA` makes Google Play infer that autofocus is required. Making only `android.hardware.camera` optional does not remove that separate requirement. Devices without autofocus can therefore be prevented from installing the app, even though browsing and uploading do not need it. Also declare `android.hardware.camera.autofocus` with `android:required="false"`.

```suggestion
    <uses-feature android:name="android.hardware.camera" android:required="false" />
    <uses-feature android:name="android.hardware.camera.autofocus" android:required="false" />
```

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Summary

This stacked PR adds Android settings for profiles, organisations, notifications, plans and account deletion.

Since the previous review:

  • Cap now has a native Android app for signing in, viewing, editing, and uploading.
  • Android users can manage their profile, organisation, email, and account from Settings.
  • Mobile sign-in callbacks carry a state value, and Cap sharing choices reflect organisation rules.
  • Android changes now run checks, tests, lint, and a release build in CI.

No new actionable findings were accepted.

Reviews (23) · Last reviewed commit: "Merge commit '1e2e9c4d530a47f6081bef52a1..." · Reviewed by Greptile

@vercel

vercel Bot commented Dec 2, 2026

Copy link
Copy Markdown
Contributor

@AatmanAJ is attempting to deploy a commit to the Cap Software Inc Team on Vercel.

A member of the Team first needs to authorize it.

@AatmanAJ

AatmanAJ commented Dec 2, 2026

Copy link
Copy Markdown
Contributor Author

@greptileai review

@AatmanAJ

AatmanAJ commented Dec 2, 2026

Copy link
Copy Markdown
Contributor Author

@greptileai review

1 similar comment
@AatmanAJ

AatmanAJ commented Dec 2, 2026

Copy link
Copy Markdown
Contributor Author

@greptileai review

@AatmanAJ

AatmanAJ commented Dec 2, 2026

Copy link
Copy Markdown
Contributor Author

@greptileai review

2 similar comments
@AatmanAJ

AatmanAJ commented Dec 2, 2026

Copy link
Copy Markdown
Contributor Author

@greptileai review

@AatmanAJ

AatmanAJ commented Dec 2, 2026

Copy link
Copy Markdown
Contributor Author

@greptileai review

@AatmanAJ

AatmanAJ commented Dec 4, 2026

Copy link
Copy Markdown
Contributor Author

@greptileai review

# Conflicts:
#	apps/mobile-android/app/src/main/kotlin/so/cap/mobile/features/cap/CapDetailScreen.kt
# Conflicts:
#	apps/mobile-android/app/src/main/res/values/upper_layer_resources.xml
Comment on lines +436 to +443
val upgraded = session.plan?.upgraded
QuietRow(
label = stringResource(R.string.settings_plan),
value =
if (upgraded == null) ""
else if (upgraded) stringResource(R.string.settings_plan_pro)
else stringResource(R.string.settings_plan_free),
trailing = { if (upgraded == null) SettingsSpinner() },

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.

P1 Plan never recovers or updates

The redesigned settings page removes Retry, pull-to-refresh and the resume check for the plan. refreshPlan() now runs only when the session starts. If that request fails, this row spins for the rest of the session. If a free user upgrades on the web, the app keeps treating them as free until restart or sign-in. Restore the error/retry state and plan refresh on return.

Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/mobile-android/app/src/main/kotlin/so/cap/mobile/features/settings/SettingsScreen.kt
Line: 436-443

Comment:
**Plan never recovers or updates**

The redesigned settings page removes Retry, pull-to-refresh and the resume check for the plan. `refreshPlan()` now runs only when the session starts. If that request fails, this row spins for the rest of the session. If a free user upgrades on the web, the app keeps treating them as free until restart or sign-in. Restore the error/retry state and plan refresh on return.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Comment on lines +445 to +448
if (upgraded == false) {
QuietRow(
label = stringResource(R.string.settings_upgrade),
onClick = { openInAppBrowser(context, "https://cap.so/dashboard") },

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.

P1 Upgrade flag is bypassed

The upgrade row no longer checks BuildConfig.WEB_UPGRADE, although the flag is still false. Every free user now gets a web upgrade link. The PR explicitly says this must stay off until Cap decides how to handle Google Play’s payment rules. Restore the flag check.

Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/mobile-android/app/src/main/kotlin/so/cap/mobile/features/settings/SettingsScreen.kt
Line: 445-448

Comment:
**Upgrade flag is bypassed**

The upgrade row no longer checks `BuildConfig.WEB_UPGRADE`, although the flag is still `false`. Every free user now gets a web upgrade link. The PR explicitly says this must stay off until Cap decides how to handle Google Play’s payment rules. Restore the flag check.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

)
QuietRow(
label = stringResource(R.string.settings_help),
onClick = { openInAppBrowser(context, "https://cap.so/help") },

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.

P2 Help opens a missing page

Help & Support now opens https://cap.so/help, but the website has no /help page or redirect. Documentation lives at /docs, which CapEnvironment.supportUrl already supplies. Use that URL so users reach the documentation instead of a missing page.

Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/mobile-android/app/src/main/kotlin/so/cap/mobile/features/settings/SettingsScreen.kt
Line: 484

Comment:
**Help opens a missing page**

Help & Support now opens `https://cap.so/help`, but the website has no `/help` page or redirect. Documentation lives at `/docs`, which `CapEnvironment.supportUrl` already supplies. Use that URL so users reach the documentation instead of a missing page.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Only move the detail feed when its own composer opens the keyboard. A keyboard that is already closing from the link sheet can otherwise hide the video for a moment, scroll past the header and leave the cap title hidden after playback returns.
@AatmanAJ

AatmanAJ commented Dec 5, 2026

Copy link
Copy Markdown
Contributor Author

@greptileai review

The switch put a Material ripple on its 44dp square touch target, so
pressing a toggle showed a grey box around the 44x26 track. CapTheme now
provides a press indication that fades the control's own pixels and draws
a focus ring only for keyboard focus, so every clickable, selectable and
toggleable in the design system presses without a box. The switch itself
stretches its knob while held, and CapSwitchTrack lets toggleable rows
show the same switch.
The sign-in and first-run heroes blurred each cloud with Modifier.blur
inside a fixed box. RenderEffect clips the blur to that box, the widest
box was squeezed to the screen width, a page-coloured slab under the
bottom cloud blurred into a black smear in dark mode, nothing outside
the hero was clipped, and API 29 and 30 had no blur at all. SkyHero now
draws the design's exact gradient, rings and clouds, renders the clouds
once into a software bitmap with BlurMaskFilter so every API level and
vendor gets the same result, clips to its bounds and ends in the page
colour. In dark mode the sky runs from blue into the page instead of
through a white cloud bank. Both heroes now reach under the status bar,
which gains a scrim once the page scrolls.
…ttings

Notification rows drew the stock Material switch, which is a different
size and colour from the 44x26 design switch every other settings row
uses. They now show CapSwitchTrack. The two switch lines on Recording
defaults each drew a top and a bottom hairline, so the rule between them
was twice as thick as every other divider.
Keeps this layer's theme root, which already wraps Root in the picture
in picture box.

This branch has not been deployed

No deployments
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