diff --git a/apps/ios/Shared/ContentView.swift b/apps/ios/Shared/ContentView.swift index 8edc66df43..ccc8d769da 100644 --- a/apps/ios/Shared/ContentView.swift +++ b/apps/ios/Shared/ContentView.swift @@ -18,6 +18,7 @@ struct ContentView: View { @Binding var userAuthorized: Bool? @Binding var canConnectCall: Bool @Binding var lastSuccessfulUnlock: TimeInterval? + @Binding var showInitializationView: Bool @AppStorage(DEFAULT_SHOW_LA_NOTICE) private var prefShowLANotice = false @AppStorage(DEFAULT_LA_NOTICE_SHOWN) private var prefLANoticeShown = false @AppStorage(DEFAULT_PERFORM_LA) private var prefPerformLA = false @@ -27,7 +28,6 @@ struct ContentView: View { @State private var showWhatsNew = false @State private var showChooseLAMode = false @State private var showSetPasscode = false - @State private var showInitializationView = false var body: some View { ZStack { @@ -53,9 +53,6 @@ struct ContentView: View { .onAppear { if prefPerformLA { requestNtfAuthorization() } initAuthenticate() - DispatchQueue.main.asyncAfter(deadline: .now() + 1) { - showInitializationView = true - } } .onChange(of: doAuthenticate) { _ in initAuthenticate() diff --git a/apps/ios/Shared/SimpleXApp.swift b/apps/ios/Shared/SimpleXApp.swift index 5e03b13101..5184808bd7 100644 --- a/apps/ios/Shared/SimpleXApp.swift +++ b/apps/ios/Shared/SimpleXApp.swift @@ -23,6 +23,7 @@ struct SimpleXApp: App { @State private var enteredBackground: TimeInterval? = nil @State private var canConnectCall = false @State private var lastSuccessfulUnlock: TimeInterval? = nil + @State private var showInitializationView = false init() { hs_init(0, nil) @@ -36,14 +37,23 @@ struct SimpleXApp: App { var body: some Scene { return WindowGroup { - ContentView(doAuthenticate: $doAuthenticate, userAuthorized: $userAuthorized, canConnectCall: $canConnectCall, lastSuccessfulUnlock: $lastSuccessfulUnlock) + ContentView( + doAuthenticate: $doAuthenticate, + userAuthorized: $userAuthorized, + canConnectCall: $canConnectCall, + lastSuccessfulUnlock: $lastSuccessfulUnlock, + showInitializationView: $showInitializationView + ) .environmentObject(chatModel) .onOpenURL { url in logger.debug("ContentView.onOpenURL: \(url)") chatModel.appOpenUrl = url } .onAppear() { - initChatAndMigrate() + showInitializationView = true + DispatchQueue.main.asyncAfter(deadline: .now() + 0.1) { + initChatAndMigrate() + } } .onChange(of: scenePhase) { phase in logger.debug("scenePhase was \(String(describing: scenePhase)), now \(String(describing: phase))")