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>
This commit is contained in:
spaced4ndy
2023-05-05 15:52:16 +04:00
committed by GitHub
parent d19a59a364
commit 7b157fa8e5

View File

@@ -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)