fix(android): the launch profile refresh waits for the stored login
release / web (push) Successful in 1m25s
release / go (push) Successful in 1m50s
release / govulncheck (push) Successful in 18s
release / integration (push) Successful in 4m36s
release / android (push) Successful in 3m59s
release / Build signed APK (push) Successful in 4m37s
release / Attach APK to the Release (tag releases only) (push) Skipped
release / Build + push container image (push) Successful in 15s
release / Verify release artifacts (tag releases only) (push) Skipped
release / web (push) Successful in 1m25s
release / go (push) Successful in 1m50s
release / govulncheck (push) Successful in 18s
release / integration (push) Successful in 4m36s
release / android (push) Successful in 3m59s
release / Build signed APK (push) Successful in 4m37s
release / Attach APK to the Release (tag releases only) (push) Skipped
release / Build + push container image (push) Successful in 15s
release / Verify release artifacts (tag releases only) (push) Skipped
AuthController refreshes /api/me when the app starts, to pick up account flags such as debug mode. That ran before the session cookie had loaded from the Keystore, read the user as signed out, and skipped. It now waits for the load (bounded by the hydration deadline). The diagnostics uploader's drain waits the same way, so a launch-time trigger isn't skipped. BootReceiver already waited. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -89,8 +89,11 @@ class AuthController @Inject constructor(
|
||||
* + persisted userJson. Carries account-level flags (debug mode)
|
||||
* that aren't in the login response. Best-effort: a network failure
|
||||
* leaves the cached identity untouched. No-op when signed out.
|
||||
* Waits for the stored login to load first: at launch this runs before
|
||||
* it has, and would otherwise read the user as signed out and skip.
|
||||
*/
|
||||
suspend fun refreshProfile() {
|
||||
authStore.awaitSessionHydrated()
|
||||
if (!isSignedIn) return
|
||||
val p = runCatching { meApi.getProfile() }.getOrNull() ?: return
|
||||
val user = UserRef(
|
||||
|
||||
@@ -70,6 +70,9 @@ class DiagnosticsUploader @Inject constructor(
|
||||
|
||||
/** Coalesces concurrent triggers via tryLock — a drain in flight wins. */
|
||||
private suspend fun drainSafe() {
|
||||
// A trigger at launch can fire before the stored login has loaded;
|
||||
// wait for it, so a signed-in user is not read as signed out.
|
||||
authStore.awaitSessionHydrated()
|
||||
val clientId = authStore.clientId.value
|
||||
// Signed out / no client id yet → nothing to do. Single guard keeps
|
||||
// the return count within the detekt gate.
|
||||
|
||||
Reference in New Issue
Block a user