Skip to content

Sign out when the account is gone, wait for an edit before validation messages, and drop stale offline messages - #96

Merged
dadachi merged 5 commits into
mainfrom
fix/account-gone-and-untouched-fields
Oct 29, 2026
Merged

dadachi merged 5 commits into
mainfrom
fix/account-gone-and-untouched-fields

Conversation

@dadachi

@dadachi dadachi commented Oct 29, 2026

Copy link
Copy Markdown
Contributor

Found while checking the release on a Pixel 6 against the public demo (debug and R8 release builds). Same fixes as NativeAppTemplate-Android (except the notification reason: the free edition has no push).

  • Account gone → sign out. A saved session whose account was deleted (the public demo deletes accounts unused for 30 days) left every screen on an error. The API looks up the organization in the path before the token, so the answer is account_not_found (404), not 401, and the free edition did not handle it. NativeAppTemplateApiError reads error_code, ApiException.isAccountGone is new, and SessionLifecycle.fetchPermissions logs out on it like a rejected token. Same as NativeAppTemplate-Free-iOS #121.
  • Validation messages wait for an edit. Forms showed "Email is required." / "Password is required." in red as soon as they opened. rememberIsEdited(value) gates each message on 7 screens, like iOS.
  • No stale offline message. A shop opened offline failed, its [NATIVEAPPTEMPLATE-2002] queued behind the indefinite offline snackbar, and it came up once the connection was back. showScreenMessage drops screen messages while offline; the offline snackbar already says why.

Test plan

  • Local CI ./scripts/pre-push (spotless, lint, R8, unit tests) passed (with Android Studio's JBR; GitHub Actions does not start for billing reasons)
  • New tests: MainActivityViewModelTest / ApiResponseExtensionsTest (account gone), IsEditedTest and the form tests, ShowScreenMessageTest
  • Pixel 6 × public demo: deleted account's session → start screen; sign-in opens without red errors; shop opened offline → error screen and offline banner → back online: the banner goes and no 2002 follows → Reload loads the shop

🤖 Generated with Claude Code

dadachi and others added 5 commits October 29, 2026 08:22
…ted session

The API looks up the organization in the path before the token. A free
account has only its personal organization, which goes with the account
(deleted by the user, or by the public demo after 30 unused days), so a saved
session for it gets account_not_found, never devise_token_auth's 401, and
every screen kept failing. The error body's error_code is now read
(ApiException.ApiError.apiErrorCode), and the permissions fetch signs out on
account_not_found as on a 401.

Found on 2026-10-28 with the paid app (same fix in NativeAppTemplate-Android,
NativeAppTemplate-iOS, NativeAppTemplate-Free-iOS).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
New forms (sign-in, sign-up, forgot password, resend confirmation, shop, item
tag, password) opened with "... is required." in red before anything was
typed. rememberIsEdited(value) is iOS's untilEdited(_:): the error waits until
the field's text first changes; the submit button stays disabled meanwhile.

Found on 2026-10-28 on a device with the paid app (same change in
NativeAppTemplate-Android).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…it stale once back online

Found on a device: a shop opened offline failed, its [NATIVEAPPTEMPLATE-2002]
queued behind the offline snackbar, which is indefinite, and came up once
the connection was back and that snackbar closed. The offline snackbar
already says why, so showScreenMessage drops screen messages while
offline. Same fix in NativeAppTemplate-Android.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@dadachi
dadachi merged commit a55d2f1 into main Oct 29, 2026
1 check passed
@dadachi
dadachi deleted the fix/account-gone-and-untouched-fields branch October 29, 2026 07:57
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