Wire KeychainDelegate before DataManager init to fix token persistence

TokenManager.keychainDelegate was never set, so all Keychain reads/writes
failed silently. Tokens couldn't be persisted or loaded on app restart,
and TokenStorage.getToken() returned nil during task completion flows.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Trey t
2026-03-02 20:14:01 -06:00
parent 469d371635
commit 233fb08cce

View File

@@ -23,6 +23,10 @@ struct iOSApp: App {
init() {
UITestRuntime.configureForLaunch()
// Set Keychain delegate BEFORE DataManager.initialize() so token can be
// loaded from Keychain on startup (Kotlin/Native can't use SecItem* directly)
TokenManager.Companion.shared.keychainDelegate = KeychainHelper.shared
// Initialize DataManager with platform-specific managers
// This must be done before any other operations that access DataManager
DataManager.shared.initialize(