Skip to content

feat(ios): Settings username inline edit (closes #282)#311

Merged
auerbachb merged 6 commits into
mainfrom
cursor/ios-settings-username-edit-3920
May 1, 2026
Merged

feat(ios): Settings username inline edit (closes #282)#311
auerbachb merged 6 commits into
mainfrom
cursor/ios-settings-username-edit-3920

Conversation

@auerbachb
Copy link
Copy Markdown
Owner

@auerbachb auerbachb commented Apr 30, 2026

User description

Summary

Ports web-style username editing to iOS Settings (inline edit, validation, PATCH, local user sync).

Babysitter follow-ups

  1. CI compile: Renamed updateSettings parameter from patch to body to avoid shadowing the HTTP patch method.
  2. CodeAnt: applySettingsUser guarded when logged out / user id mismatch.
  3. CodeAnt: Deterministic username field clear in UITests (Select All or Delete fallback).
  4. Smoke flake: Dismiss keyboard before auth submit; longer wait for home after login.

Closes #282

Open in Web Open in Cursor 

CodeAnt-AI Description

Add inline username editing in iOS Settings with validation and save feedback

What Changed

  • Users can now edit their username directly in Settings, save it in place, or cancel without leaving the page.
  • Username saves are checked for valid length and characters, and the screen shows a clear error when the name is too short, invalid, or already taken.
  • After a successful save, the updated username appears immediately in Settings.
  • Public profile changes and username updates now avoid stepping on each other, which keeps the displayed account info in sync.
  • Login and Settings UI tests were hardened to reduce flakiness when the keyboard is open or the app responds slowly.

Impact

✅ Shorter username changes
✅ Clearer username error messages
✅ Fewer Settings update conflicts

🔄 Retrigger CodeAnt AI Review

Details

💡 Usage Guide

Checking Your Pull Request

Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.

Talking to CodeAnt AI

Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:

@codeant-ai ask: Your question here

This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.

Example

@codeant-ai ask: Can you suggest a safer alternative to storing this secret?

Preserve Org Learnings with CodeAnt

You can record team preferences so CodeAnt AI applies them in future reviews. Reply directly to the specific CodeAnt AI suggestion (in the same thread) and replace "Your feedback here" with your input:

@codeant-ai: Your feedback here

This helps CodeAnt AI learn and adapt to your team's coding style and standards.

Example

@codeant-ai: Do not flag unused imports.

Retrigger review

Ask CodeAnt AI to review the PR again, by typing:

@codeant-ai: review

Check Your Repository Health

To analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.

@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 30, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
still-point Ignored Ignored Preview May 1, 2026 5:24pm

Request Review

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 30, 2026

📝 Walkthrough

Walkthrough

Adds inline username editing in SettingsView with client-side validation, routes username updates through a shared PATCH settings API, applies returned UserDTO via a new AppViewModel method, and adds unit and UI tests including a UI-test conflict simulation flag.

Changes

Cohort / File(s) Summary
Settings UI & ViewModel
ios/StillPointApp/Views/SettingsView.swift, ios/StillPointApp/ViewModels/AppViewModel.swift
Adds inline username edit mode, draft/saving/error/success state, client-side trimming/validation, save/cancel flows, and calls APIClient.updateSettings(username:). Adds AppViewModel.applySettingsUser(_:) to conditionally apply returned UserDTO.
API Client & UITest hooks
ios/StillPointShared/Sources/StillPointShared/APIClient.swift
Refactors settings patching to updateSettings(body:), adds updateSettings(username:), and updates UI-test path to accept SettingsPatchBody. UI-test logic trims/validates username and can return 409 if forceUsernameConflict flag enabled.
Validation & Tests
ios/StillPointShared/Sources/StillPointShared/UsernameValidation.swift, ios/StillPointShared/Tests/StillPointSharedTests/UsernameValidationTests.swift, ios/StillPointAppUITests/StillPointAppUITests.swift
Introduces UsernameValidation (3–30 chars, [A-Za-z0-9_], trims) and unit tests. Adds UI tests for successful rename, client-side validation message, and conflict handling; expands test launcher with forceUsernameConflict env flag and a robust username-clearing helper.

Sequence Diagram

sequenceDiagram
    participant User as User (SettingsView)
    participant UI as SettingsView
    participant Validation as UsernameValidation
    participant API as APIClient
    participant Server as Backend
    participant VM as AppViewModel

    User->>UI: open editor / type username / tap Save
    UI->>Validation: isValid(candidate)
    Validation-->>UI: valid / invalid
    alt valid
        UI->>API: updateSettings(username:)
        API->>Server: PATCH /api/settings { username }
        alt 200 OK
            Server-->>API: UserDTO
            API-->>UI: UserDTO
            UI->>VM: applySettingsUser(UserDTO)
            VM-->>VM: update currentUser if allowed
            UI-->>User: show success
        else 409 Conflict
            Server-->>API: 409 "Username already taken"
            API-->>UI: APIError
            UI-->>User: show "Username already taken"
        else other error
            API-->>UI: APIError
            UI-->>User: show generic error
        end
    else invalid
        UI-->>User: show validation error
    end
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Suggested reviewers

  • codeant-ai

"I hopped into Settings, nibbling keys with care,
Trimmed the whitespace, checked each underscore and hair,
Sent a PATCH on my way, awaited server's wink,
If 'taken' it cried, I thumped my foot and blinked,
Now usernames hop home — neat, tidy, and fair!" 🐰

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 6.25% 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
Title check ✅ Passed The title 'feat(ios): Settings username inline edit (closes #282)' clearly and concisely summarizes the main change: adding inline username editing functionality to the iOS Settings view. It is specific, relevant, and accurately represents the primary objective of the changeset.
Linked Issues check ✅ Passed The pull request successfully implements all coding requirements from issue #282: inline username editing UI in SettingsView [282], client-side validation (3-30 chars, allowed characters) [282], PATCH /api/settings integration [282], username conflict handling (409) and validation errors (400) [282], local user model synchronization [282], and supporting test coverage [282].
Out of Scope Changes check ✅ Passed All changes align with issue #282 requirements. The PR includes necessary supporting changes: AppViewModel.applySettingsUser for concurrent update safety, UsernameValidation utility for consistency across platforms, enhanced UITests for validation and conflict scenarios, APIClient refactoring for code reuse, and babysitter improvements to reduce flakiness—all justified by the primary objective.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

📋 Issue Planner

Built with CodeRabbit's Coding Plans for faster development and fewer bugs.

View plan used: #282

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch cursor/ios-settings-username-edit-3920

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

@auerbachb auerbachb marked this pull request as ready for review April 30, 2026 23:18
@auerbachb
Copy link
Copy Markdown
Owner Author

@CodeAnt-AI review

@codeant-ai
Copy link
Copy Markdown

codeant-ai Bot commented Apr 30, 2026

CodeAnt AI is running the review.

@auerbachb
Copy link
Copy Markdown
Owner Author

@cursor review

@auerbachb
Copy link
Copy Markdown
Owner Author

@graphite-app re-review

@codeant-ai codeant-ai Bot added the size:L This PR changes 100-499 lines, ignoring generated files label Apr 30, 2026
@codeant-ai
Copy link
Copy Markdown

codeant-ai Bot commented Apr 30, 2026

Sequence Diagram

This PR adds inline username editing on the iOS Settings screen with shared validation, sends a PATCH-style settings update for valid changes, and syncs the returned user into the app view model.

sequenceDiagram
    participant User
    participant SettingsView
    participant APIClient
    participant Backend
    participant AppViewModel

    User->>SettingsView: Edit username and tap save
    SettingsView->>SettingsView: Validate username locally

    alt Username invalid
        SettingsView-->>User: Show username validation error
    else Username valid
        SettingsView->>APIClient: Update settings with username
        APIClient->>Backend: PATCH settings with username
        Backend-->>APIClient: Return updated user
        APIClient-->>AppViewModel: Provide updated user
        AppViewModel-->>SettingsView: Update current user state
        SettingsView-->>User: Show updated username and success message
    end
Loading

Generated by CodeAnt AI

Comment thread ios/StillPointApp/ViewModels/AppViewModel.swift
Comment thread ios/StillPointAppUITests/StillPointAppUITests.swift Outdated
@codeant-ai
Copy link
Copy Markdown

codeant-ai Bot commented Apr 30, 2026

CodeAnt AI finished running the review.

Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

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

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 5496098. Configure here.

@codeant-ai
Copy link
Copy Markdown

codeant-ai Bot commented Apr 30, 2026

CodeAnt AI is reviewing your PR.

@codeant-ai codeant-ai Bot added size:L This PR changes 100-499 lines, ignoring generated files and removed size:L This PR changes 100-499 lines, ignoring generated files labels Apr 30, 2026
@codeant-ai
Copy link
Copy Markdown

codeant-ai Bot commented Apr 30, 2026

CodeAnt AI finished reviewing your PR.

Copy link
Copy Markdown

@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

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@ios/StillPointApp/Views/SettingsView.swift`:
- Around line 84-85: Concurrent settings saves (username and visibility) can
overlap and a slower PATCH response can overwrite other fields when
appVM.applySettingsUser(updated) applies the whole UserDTO; fix by serializing
these save operations: introduce a small async serializer (e.g., an actor
SettingsUpdateActor or a TaskQueue) used by SettingsView to perform calls like
APIClient.shared.updateSettings(...) so only one update runs at a time, or
alternatively have the save helper merge the returned UserDTO into the existing
user rather than replacing it wholesale; update the calls around
updateSettings(...) and appVM.applySettingsUser(updated) (and the analogous
blocks at lines ~203-220 and ~295-300) to route through this serializer or use a
merge-on-apply method so overlapping requests cannot clobber each other.
🪄 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: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: a018b54e-5470-43d3-ac6b-e5e0cfa3a12c

📥 Commits

Reviewing files that changed from the base of the PR and between b40073d and a854538.

📒 Files selected for processing (6)
  • ios/StillPointApp/ViewModels/AppViewModel.swift
  • ios/StillPointApp/Views/SettingsView.swift
  • ios/StillPointAppUITests/StillPointAppUITests.swift
  • ios/StillPointShared/Sources/StillPointShared/APIClient.swift
  • ios/StillPointShared/Sources/StillPointShared/UsernameValidation.swift
  • ios/StillPointShared/Tests/StillPointSharedTests/UsernameValidationTests.swift

Comment thread ios/StillPointApp/Views/SettingsView.swift
Copy link
Copy Markdown

@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.

🧹 Nitpick comments (1)
ios/StillPointAppUITests/StillPointAppUITests.swift (1)

169-257: ⚡ Quick win

Add one UI test for the Cancel path.

This suite covers save, validation, and conflict well, but the inline editor’s cancel affordance is still unexercised. A small test that edits the field, taps Cancel, and asserts the original username remains visible would close the main regression gap for this feature.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@ios/StillPointAppUITests/StillPointAppUITests.swift` around lines 169 - 257,
Add a new UI test (e.g., testSettingsUsernameInlineEditCancelSucceeds) that
exercises the cancel path: launch the app with makeApp(seedAuthenticated: true,
resetStore: true), navigate to settings via openTab(...), capture the current
username from app.staticTexts["settings.usernameDisplay"], tap
app.buttons["settings.usernameEditButton"], wait for
app.textFields["settings.usernameField"], clearUsernameFieldForUITest(field, in:
app) and type a different value, tap the cancel control
(app.buttons["settings.usernameCancelButton"] or whatever the cancel identifier
is), then verify app.staticTexts["settings.usernameDisplay"] still exists and
its label equals the original captured username; also
dismissKeyboardIfPresent(in: app) at the end.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@ios/StillPointAppUITests/StillPointAppUITests.swift`:
- Around line 169-257: Add a new UI test (e.g.,
testSettingsUsernameInlineEditCancelSucceeds) that exercises the cancel path:
launch the app with makeApp(seedAuthenticated: true, resetStore: true), navigate
to settings via openTab(...), capture the current username from
app.staticTexts["settings.usernameDisplay"], tap
app.buttons["settings.usernameEditButton"], wait for
app.textFields["settings.usernameField"], clearUsernameFieldForUITest(field, in:
app) and type a different value, tap the cancel control
(app.buttons["settings.usernameCancelButton"] or whatever the cancel identifier
is), then verify app.staticTexts["settings.usernameDisplay"] still exists and
its label equals the original captured username; also
dismissKeyboardIfPresent(in: app) at the end.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 67128edd-34d8-47aa-b1f3-3fbd92b8e34a

📥 Commits

Reviewing files that changed from the base of the PR and between a854538 and 37b6e53.

📒 Files selected for processing (1)
  • ios/StillPointAppUITests/StillPointAppUITests.swift

@codeant-ai
Copy link
Copy Markdown

codeant-ai Bot commented May 1, 2026

CodeAnt AI is running Incremental review

@codeant-ai codeant-ai Bot added size:L This PR changes 100-499 lines, ignoring generated files and removed size:L This PR changes 100-499 lines, ignoring generated files labels May 1, 2026
@codeant-ai
Copy link
Copy Markdown

codeant-ai Bot commented May 1, 2026

CodeAnt AI Incremental review completed.

Comment thread ios/StillPointApp/Views/SettingsView.swift Outdated
cursoragent and others added 2 commits May 1, 2026 13:09
Add UsernameValidation mirroring web rules, extend APIClient with
username updates and UI-test simulation (400/409), sync currentUser
from settings responses, and add UITests for save, validation, and
conflict paths.

Closes #282

Co-authored-by: Bretton Auerbach <auerbachb@users.noreply.github.com>
Rename updateSettings(body:) parameter so it does not shadow the HTTP
patch helper (fixes Swift compile on CI). Guard applySettingsUser when
logged out or user id mismatches. Add deterministic UITest field clear
fallback when Select All is unavailable.

Co-authored-by: Bretton Auerbach <auerbachb@users.noreply.github.com>
@codeant-ai codeant-ai Bot added size:L This PR changes 100-499 lines, ignoring generated files and removed size:L This PR changes 100-499 lines, ignoring generated files labels May 7, 2026
@codeant-ai
Copy link
Copy Markdown

codeant-ai Bot commented May 7, 2026

Sequence Diagram

This diagram shows how the iOS Settings screen now supports inline username editing with local validation, a PATCH settings call, and syncing the updated user back into app state.

sequenceDiagram
    participant User
    participant SettingsView
    participant APIClient
    participant Backend
    participant AppViewModel

    User->>SettingsView: Tap Edit username and enter new value
    SettingsView->>SettingsView: Validate username
    SettingsView->>APIClient: Request username update
    APIClient->>Backend: PATCH settings with new username
    Backend-->>APIClient: Return updated user
    APIClient-->>SettingsView: Updated user data
    SettingsView->>AppViewModel: Apply updated user
    AppViewModel-->>SettingsView: Current user state updated in UI
Loading

Generated by CodeAnt AI

Comment on lines +592 to +605
field.tap()
field.press(forDuration: 1.2)
let selectAll = app.menuItems["Select All"]
if selectAll.waitForExistence(timeout: 2) {
selectAll.tap()
return
}
let deleteKey = app.keyboards.keys["Delete"]
XCTAssertTrue(
deleteKey.waitForExistence(timeout: 3),
"Expected keyboard with Delete after focusing username field"
)
for _ in 0..<40 {
deleteKey.tap()
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggestion: The delete-key fallback assumes the cursor is positioned at the end of the text, but after long-press focus that is not guaranteed. If the caret is in the middle/start, repeated Delete taps will not fully clear the username, so new text can be inserted into leftover content and make username assertions flaky. Ensure full selection before deletion or verify the field is empty after clearing. [possible bug]

Severity Level: Major ⚠️
- ⚠️ Settings username success UITest can intermittently fail in CI.
- ⚠️ Username validation error UITest susceptible to inconsistent input state.
- ⚠️ Username conflict UITest may assert against unintended concatenated usernames.
Steps of Reproduction ✅
1. Run `testSettingsUsernameInlineEditSucceeds()` in
`ios/StillPointAppUITests/StillPointAppUITests.swift:173-199`, which opens Settings from
Home (lines 178-179) and focuses the username input `settings.usernameField` (lines
185-186).

2. At line 187, the test calls `clearUsernameFieldForUITest(field, in: app)`, whose
implementation at lines 590-607 is intended to clear the existing username before typing a
new one; the helper comment explicitly notes the "Select All" context menu is flaky in CI.

3. Inside `clearUsernameFieldForUITest`, the field is tapped and long-pressed (lines
592-593). If the `"Select All"` menu item does **not** appear within 2 seconds (the
fallback case at lines 594-598), the helper asserts the keyboard delete key exists (lines
599-603) and then taps Delete 40 times (lines 604-605).

4. Because the tap and long-press are performed at the element's default/center
coordinate, the text cursor can be positioned in the middle of the existing username
string; repeated Delete keypresses only delete characters to the **left** of the caret,
leaving any characters to the right intact. After this fallback, when the test resumes and
calls `field.typeText("fixture_renamed")` at line 188, the new text is inserted before the
leftover suffix, so the final field value may be e.g. `"userfixture_renamed"` instead of
`"fixture_renamed"`. The subsequent save at lines 190-192 and assertion
`XCTAssertEqual(display.label, "fixture_renamed")` at line 196 will then fail, even though
the helper claimed to "clear" the field.

5. The same helper is used in `testSettingsUsernameValidationError()` (lines 201-230) and
`testSettingsUsernameConflictShowsTakenMessage()` (lines 232-261) via calls at lines 215
and 246 respectively, so the incomplete-clearing behavior in the fallback path can also
cause inconsistent inputs and flakiness in the validation-error and conflict-message
UITests whenever the `"Select All"` menu fails to appear.

Fix in Cursor | Fix in VSCode Claude

(Use Cmd/Ctrl + Click for best experience)

Prompt for AI Agent 🤖
This is a comment left during a code review.

**Path:** ios/StillPointAppUITests/StillPointAppUITests.swift
**Line:** 592:605
**Comment:**
	*Possible Bug: The delete-key fallback assumes the cursor is positioned at the end of the text, but after long-press focus that is not guaranteed. If the caret is in the middle/start, repeated Delete taps will not fully clear the username, so new text can be inserted into leftover content and make username assertions flaky. Ensure full selection before deletion or verify the field is empty after clearing.

Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix
👍 | 👎

@codeant-ai
Copy link
Copy Markdown

codeant-ai Bot commented May 7, 2026

CodeAnt AI finished running the review.

@codeant-ai
Copy link
Copy Markdown

codeant-ai Bot commented May 7, 2026

CodeAnt AI is running the review.

@codeant-ai codeant-ai Bot added size:L This PR changes 100-499 lines, ignoring generated files and removed size:L This PR changes 100-499 lines, ignoring generated files labels May 7, 2026
@codeant-ai
Copy link
Copy Markdown

codeant-ai Bot commented May 7, 2026

Sequence Diagram

This PR lets users edit their username directly in the iOS Settings screen, validates it locally, sends a PATCH to update settings, and syncs the returned user into app state so the new username is shown immediately.

sequenceDiagram
    participant User
    participant SettingsView
    participant APIClient
    participant Backend
    participant AppState

    User->>SettingsView: Edit username and tap Save
    SettingsView->>SettingsView: Validate username and prepare trimmed value
    SettingsView->>APIClient: Update settings with new username
    APIClient->>Backend: PATCH settings username
    Backend-->>APIClient: Return updated user
    APIClient-->>SettingsView: Updated user data
    SettingsView->>AppState: Apply updated user to current user
    AppState-->>SettingsView: Updated username reflected in Settings view
Loading

Generated by CodeAnt AI

@codeant-ai
Copy link
Copy Markdown

codeant-ai Bot commented May 7, 2026

CodeAnt AI finished running the review.

@codeant-ai
Copy link
Copy Markdown

codeant-ai Bot commented May 7, 2026

CodeAnt AI is running the review.

@codeant-ai codeant-ai Bot added size:L This PR changes 100-499 lines, ignoring generated files and removed size:L This PR changes 100-499 lines, ignoring generated files labels May 7, 2026
@codeant-ai
Copy link
Copy Markdown

codeant-ai Bot commented May 7, 2026

Sequence Diagram

This PR lets users edit their username inline in iOS Settings, validates it before sending, and uses a shared PATCH settings flow that returns an updated user and synchronizes app state.

sequenceDiagram
    participant User
    participant SettingsView
    participant AppViewModel
    participant APIClient
    participant SettingsAPI

    User->>SettingsView: Change username or visibility
    SettingsView->>SettingsView: Validate input and mark settings as saving
    SettingsView->>APIClient: Request settings update
    APIClient->>SettingsAPI: PATCH settings with partial body
    SettingsAPI-->>APIClient: Updated user data
    APIClient-->>AppViewModel: Return updated user
    AppViewModel-->>SettingsView: Apply settings user and refresh UI state
Loading

Generated by CodeAnt AI

@codeant-ai
Copy link
Copy Markdown

codeant-ai Bot commented May 7, 2026

CodeAnt AI finished running the review.

@codeant-ai
Copy link
Copy Markdown

codeant-ai Bot commented May 8, 2026

CodeAnt AI is running the review.

@codeant-ai codeant-ai Bot added size:L This PR changes 100-499 lines, ignoring generated files and removed size:L This PR changes 100-499 lines, ignoring generated files labels May 8, 2026
@codeant-ai
Copy link
Copy Markdown

codeant-ai Bot commented May 8, 2026

Sequence Diagram

This diagram shows how the iOS Settings screen now supports inline username editing with local validation, a settings PATCH call, and immediate UI update from the returned user data.

sequenceDiagram
    participant User
    participant SettingsView
    participant Backend

    User->>SettingsView: Open Settings and tap Edit username
    SettingsView->>SettingsView: Capture new username and validate
    User->>SettingsView: Tap Save username
    SettingsView->>Backend: Send settings update with new username
    Backend-->>SettingsView: Return updated user data
    SettingsView->>SettingsView: Update local user and show new username
Loading

Generated by CodeAnt AI

@codeant-ai
Copy link
Copy Markdown

codeant-ai Bot commented May 8, 2026

CodeAnt AI finished running the review.

@codeant-ai
Copy link
Copy Markdown

codeant-ai Bot commented May 8, 2026

CodeAnt AI is running the review.

@codeant-ai codeant-ai Bot added size:L This PR changes 100-499 lines, ignoring generated files and removed size:L This PR changes 100-499 lines, ignoring generated files labels May 8, 2026
@codeant-ai
Copy link
Copy Markdown

codeant-ai Bot commented May 8, 2026

Sequence Diagram

This diagram shows how the iOS Settings screen validates a new username, calls the shared settings API to update it, and syncs the updated user back into app state, including handling local validation errors.

sequenceDiagram
    participant User
    participant Settings as Settings screen
    participant API as API client
    participant Server as Backend
    participant AppVM as App view model

    User->>Settings: Edit username and tap Save
    Settings->>Settings: Validate username

    alt Invalid username
        Settings-->>User: Show validation error
    else Valid username
        Settings->>API: Update settings username
        API->>Server: Patch settings with new username
        Server-->>API: Updated user
        API-->>Settings: Updated user
        Settings->>AppVM: Apply updated user
        AppVM-->>Settings: Updated current user state
        Settings-->>User: Show updated username and success message
    end
Loading

Generated by CodeAnt AI

@codeant-ai
Copy link
Copy Markdown

codeant-ai Bot commented May 8, 2026

CodeAnt AI finished running the review.

@codeant-ai
Copy link
Copy Markdown

codeant-ai Bot commented May 8, 2026

CodeAnt AI is running the review.

@codeant-ai codeant-ai Bot added size:L This PR changes 100-499 lines, ignoring generated files and removed size:L This PR changes 100-499 lines, ignoring generated files labels May 8, 2026
@codeant-ai
Copy link
Copy Markdown

codeant-ai Bot commented May 8, 2026

Sequence Diagram

This diagram shows how the iOS Settings screen now handles inline username edits (and visibility changes), validating input, sending a single settings update, and syncing the updated user back into app state.

sequenceDiagram
    participant User
    participant SettingsView
    participant APIClient
    participant Backend
    participant AppViewModel

    User->>SettingsView: Change username or visibility and tap Save
    SettingsView->>SettingsView: Validate input and ensure single active save
    Note over SettingsView: Skip new saves while another settings update is in progress
    SettingsView->>APIClient: Send settings patch
    APIClient->>Backend: Patch settings with new values
    Backend-->>APIClient: Return updated user data
    APIClient-->>SettingsView: Updated user
    SettingsView->>AppViewModel: applySettingsUser with updated user
    AppViewModel-->>SettingsView: Update current user and refresh settings display
Loading

Generated by CodeAnt AI

@codeant-ai
Copy link
Copy Markdown

codeant-ai Bot commented May 8, 2026

CodeAnt AI finished running the review.

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

Labels

size:L This PR changes 100-499 lines, ignoring generated files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

iOS: port username editing from web Settings

2 participants