Skip to content

Conversation

@davedean
Copy link
Owner

Motivation

  • Background sync failures that are authentication-related currently leave the UI in a confusing state with lists still visible and the user forced to manually sign out and back in.
  • The app should surface auth failures immediately and guide the user to re-authenticate so background-triggered token invalidation doesn't cause stale UI or a hidden sign-in flow.

Description

  • Make the main UI require sign-in by presenting a blocking LoginView when there is no valid token and hide the Lists/Sync sections while signed out.
  • Add an allowsDismiss flag to LoginView so it can be used as a dismissible sheet or a non-dismissible full-screen cover for blocking sign-in.
  • Detect Vikunja auth errors (401/403) via ErrorPresenter.isAuthenticationError(_:) and clear the token + surface the login flow when those occur during manual sync, project loading, or background sync.
  • Persist an auth-specific flag by extending BackgroundSyncStatus with a backward-compatible requiresReauth field and delete the keychain token from background sync when an auth failure is detected.
  • Add reloadTokenFromKeychain() to AppState and call it on app foreground to reflect background invalidation in the UI, and clear cachedProjects when the token is removed.

Testing

  • Ran the package test suite with swift test, which built successfully and all unit tests passed (70 tests, 0 failures).
  • Verified the app compiles and the changes were committed (manual smoke verification steps listed in the PR body during commit creation were followed where possible in this environment).

Codex Task

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant