From 233fb08ccee21c251be257b0bfd7a8e1e596f19a Mon Sep 17 00:00:00 2001 From: Trey t Date: Mon, 2 Mar 2026 20:14:01 -0600 Subject: [PATCH] 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 --- iosApp/iosApp/iOSApp.swift | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/iosApp/iosApp/iOSApp.swift b/iosApp/iosApp/iOSApp.swift index 30e9b3b..c0eef8c 100644 --- a/iosApp/iosApp/iOSApp.swift +++ b/iosApp/iosApp/iOSApp.swift @@ -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(