ios: restore onboarding step (#2384)

This commit is contained in:
spaced4ndy
2023-05-05 12:56:48 +04:00
committed by GitHub
parent b5f482bb50
commit aa2b36d5cc
8 changed files with 21 additions and 4 deletions
+4 -2
View File
@@ -1025,6 +1025,7 @@ func initializeChat(start: Bool, dbKey: String? = nil, refreshInvitations: Bool
m.chatInitialized = true
m.currentUser = try apiGetActiveUser()
if m.currentUser == nil {
onboardingStageDefault.set(.step1_SimpleXInfo)
m.onboardingStage = .step1_SimpleXInfo
} else if start {
try startChat(refreshInvitations: refreshInvitations)
@@ -1050,9 +1051,10 @@ func startChat(refreshInvitations: Bool = true) throws {
registerToken(token: token)
}
withAnimation {
m.onboardingStage = m.onboardingStage == .step2_CreateProfile && m.users.count == 1
let savedOnboardingStage = onboardingStageDefault.get()
m.onboardingStage = [.step1_SimpleXInfo, .step2_CreateProfile].contains(savedOnboardingStage) && m.users.count == 1
? .step3_CreateSimpleXAddress
: .onboardingComplete
: savedOnboardingStage
}
}
ChatReceiver.shared.start()