Skip to content

Fix/vault issues batch 2 - #145

Open
valoryyaa-byte wants to merge 6 commits into
ethos-protocol:mainfrom
valoryyaa-byte:fix/vault-issues-batch-2
Open

Fix/vault issues batch 2#145
valoryyaa-byte wants to merge 6 commits into
ethos-protocol:mainfrom
valoryyaa-byte:fix/vault-issues-batch-2

Conversation

valoryyaa-byte and others added 4 commits July 26, 2026 23:56
ApiClient.get/post/delete and PasskeyService.register/authenticate were
surfacing raw exception text (SocketTimeoutException: timeout, etc.)
straight into VaultUiState.error/AuthUiState.error. Add ApiErrorMapper to
translate common exception types (timeout, host unreachable, TLS failure,
generic IO) into user-presentable strings, keep the raw message in
BuildConfig.DEBUG-gated Logcat only, and pass through already-friendly
ApiResult.Error/no-network messages unchanged via ApiCallFailedException.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
ApiClient.unregisterPushToken had zero call sites, so a signed-out device
stayed registered for push notifications against the account. Persist the
last-known FCM token via TokenProvider (set whenever
TTLFirebaseMessagingService.onNewToken fires) and call unregisterPushToken
from AuthViewModel.signOut() before clearing the auth token, since the
unregister request still needs to be authenticated.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Audited every viewModelScope.launch body in ViewModels.kt: none needed
manual isActive checks once ApiClient/PasskeyService stopped swallowing
CancellationException (fixed alongside the friendly-error-message change,
since both live in the same runCatching/getOrElse blocks). Add regression
tests proving that when the in-flight call is cancelled mid-request — e.g.
because the screen was torn down and viewModelScope died — the ViewModel
does not go on to write a stray error/loading update into dead state.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…ueue

PendingCheckInDao/CheckInSyncWorker only handled check-in; createVault had
no offline durability at all (just "No network", discarding whatever the
user filled in). Replace the check-in-specific Room setup with a general
PendingAction entity/DAO (dedupeKey reproduces the old
per-vaultId-replace behavior for check-ins, while types like create-vault
with no natural key can queue multiple items), rename
CheckInSyncWorker -> PendingActionSyncWorker to dispatch on action type,
and wire VaultViewModel.createVault's NetworkUnavailable branch through
the same queue-and-notify path check-in already used.

deposit/withdraw are left for ethos-protocol#65/ethos-protocol#66 since those VaultViewModel methods
don't exist yet.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@drips-wave

drips-wave Bot commented Jul 27, 2026

Copy link
Copy Markdown

@valoryyaa-byte Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

Resolve conflicts by keeping PendingAction refactoring from current branch:
- AppModule.kt: Use PendingActionDatabase/PendingActionDao
- PendingActionSyncWorker.kt: Include NetworkMonitor and CreateVaultRequest
- ViewModels.kt: Remove duplicate package statement, use PendingActionSyncWorker
Resolves conflicts from PRs ethos-protocol#146-ethos-protocol#148 landing upstream while this branch
diverged: merges token-expiry tracking and injectable HttpClientEngine
(ApiClient/Infrastructure) with local logging additions, reconciles the
CheckInSyncWorker->PendingActionSyncWorker generalization with upstream's
added sync diagnostics, and merges AuthViewModel's push-token/pending-action
cleanup on sign-out with upstream's session-refresh changes. Also fixes a
latent credentialManager reference bug and a missing constructor arg in
PendingActionSyncWorkerTest introduced by prior merges upstream.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant