fix dismiss when deleting last visible user while having hidden users

This commit is contained in:
Diogo
2024-08-27 22:23:01 +01:00
parent 9c15471fbd
commit 1a9e6dc25a
2 changed files with 4 additions and 4 deletions
@@ -166,7 +166,7 @@ struct UserPicker: View {
NavigationView {
switch sheet {
case .chatProfiles:
UserProfilesView(showSettings: $showSettings)
UserProfilesView()
case .currentProfile:
UserProfile()
.navigationTitle("Your current profile")
@@ -9,8 +9,8 @@ import SimpleXChat
struct UserProfilesView: View {
@EnvironmentObject private var m: ChatModel
@EnvironmentObject private var theme: AppTheme
@Binding var showSettings: Bool
@Environment(\.editMode) private var editMode
@Environment(\.dismiss) var dismiss: DismissAction
@AppStorage(DEFAULT_SHOW_HIDDEN_PROFILES_NOTICE) private var showHiddenProfilesNotice = true
@AppStorage(DEFAULT_SHOW_MUTE_PROFILE_ALERT) private var showMuteProfileAlert = true
@State private var showDeleteConfirmation = false
@@ -285,7 +285,7 @@ struct UserProfilesView: View {
await MainActor.run {
onboardingStageDefault.set(.step1_SimpleXInfo)
m.onboardingStage = .step1_SimpleXInfo
showSettings = false
dismiss()
}
}
} else {
@@ -415,6 +415,6 @@ public func correctPassword(_ user: User, _ pwd: String) -> Bool {
struct UserProfilesView_Previews: PreviewProvider {
static var previews: some View {
UserProfilesView(showSettings: Binding.constant(true))
UserProfilesView()
}
}