From 7b157fa8e5fc68844a891575657ebc00d781d626 Mon Sep 17 00:00:00 2001 From: spaced4ndy <8711996+spaced4ndy@users.noreply.github.com> Date: Fri, 5 May 2023 15:52:16 +0400 Subject: [PATCH] ios: progress indicator on migrations w/t confirmation (#2378) * ios: progress indicator on migrations w/t confirmation * layout * Update apps/ios/Shared/ContentView.swift Co-authored-by: Evgeny Poberezkin <2769109+epoberezkin@users.noreply.github.com> * add delay * move on appear * Update apps/ios/Shared/ContentView.swift Co-authored-by: Evgeny Poberezkin <2769109+epoberezkin@users.noreply.github.com> * Update apps/ios/Shared/ContentView.swift Co-authored-by: Evgeny Poberezkin <2769109+epoberezkin@users.noreply.github.com> --------- Co-authored-by: Evgeny Poberezkin <2769109+epoberezkin@users.noreply.github.com> --- apps/ios/Shared/ContentView.swift | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/apps/ios/Shared/ContentView.swift b/apps/ios/Shared/ContentView.swift index 61de5fd2dd..910922d704 100644 --- a/apps/ios/Shared/ContentView.swift +++ b/apps/ios/Shared/ContentView.swift @@ -27,6 +27,7 @@ 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 { @@ -52,6 +53,9 @@ struct ContentView: View { .onAppear { if prefPerformLA { requestNtfAuthorization() } initAuthenticate() + DispatchQueue.main.asyncAfter(deadline: .now() + 1) { + showInitializationView = true + } } .onChange(of: doAuthenticate) { _ in initAuthenticate() @@ -69,6 +73,8 @@ struct ContentView: View { @ViewBuilder private func contentView() -> some View { if prefPerformLA && userAuthorized != true { lockButton() + } else if chatModel.chatDbStatus == nil && showInitializationView { + initializationView() } else if let status = chatModel.chatDbStatus, status != .ok { DatabaseErrorView(status: status) } else if !chatModel.v3DBMigration.startChat { @@ -104,6 +110,14 @@ struct ContentView: View { Button(action: runAuthenticate) { Label("Unlock", systemImage: "lock") } } + private func initializationView() -> some View { + VStack { + ProgressView().scaleEffect(2) + Text("Opening database…") + .padding() + } + } + private func mainView() -> some View { ZStack(alignment: .top) { ChatListView(showSettings: $showSettings).privacySensitive(protectScreen)