Horváth Gergely dda4bfd9d3 Improve iCloud / Watch token sync & recovery
Add robust handling for token synchronization and recovery across iOS/watchOS and Flutter.

- iOS (WatchSessionManager.swift): queue token events until Flutter signals watchSyncReady, flush queued auth events and iCloud recovery notifications when ready, forward tokens with de-duplication logic, provide fallback to iCloud when Flutter isn't ready, and avoid sending duplicate events. Adds helper methods for token payloads and comparison.
- Token management (TokenManager.swift): track active studentIdNorm in UserDefaults to prefer a single account, persist active account on saves, prefer freshest token within preferred account, improve proactive refresh with configurable lead time and cooldown, skip unnecessary recoveries when a valid token exists, and add cooldown for phone recovery requests.
- iCloud logic (iCloudTokenManager.swift): avoid overwriting tokens across accounts using updatedAt comparisons and only ignore truly stale saves.
- Dart client (kreta_client.dart): skip recovery if local token still valid, clearer iCloud recovery retry flow, fallbacks, and clear reauth flag when usable token applied.
- Token model (token_model.dart & generated .g.dart): add tokenVersion and updatedAtMs fields, populate them on creation/from response, and update Isar schema + generated query helpers.
- Watch sync helper (watch_sync_helper.dart): include tokenVersion/updatedAt in outgoing payloads, resolve incoming/current versions more robustly, use updatedAt when deciding freshness, and invoke watchSyncReady on init so native side can flush queued events.
- App init (main.dart): run an iCloud recovery check on iOS during startup and only clear reauth flag when the chosen token is still in the future.

These changes improve cross-device token consistency, reduce spurious reauth prompts, and make proactive refresh/recovery less noisy and more efficient.
2026-02-11 11:33:11 +01:00
2025-09-15 12:21:40 +02:00
2025-02-10 22:22:45 +01:00
2025-10-12 15:50:53 +02:00
2025-02-10 22:22:45 +01:00
2025-09-08 20:50:41 +02:00
2025-10-26 09:14:10 +01:00
2025-08-24 16:57:08 +02:00
2025-02-10 22:22:45 +01:00
2025-02-10 22:22:45 +01:00

Firka

HU Magyar EN English

Crowdin

The project

Firka is an alternative client for [an application to be named]. The app's goal is to be a modern user friendly app for the [to be named] system.

Contribution guide

Description
No description provided
Readme 59 MiB
Languages
Dart 61.4%
Swift 35.1%
Kotlin 3.1%
Shell 0.3%