mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2026-04-27 10:45:54 +00:00
recursive sheets
This commit is contained in:
@@ -16,7 +16,6 @@ enum UserPickerSheet: Identifiable {
|
||||
case currentProfile
|
||||
case useFromDesktop
|
||||
case settings
|
||||
case userPicker
|
||||
|
||||
var id: Self { self }
|
||||
}
|
||||
@@ -32,7 +31,8 @@ struct ChatListView: View {
|
||||
@State private var searchChatFilteredBySimplexLink: String? = nil
|
||||
@State private var scrollToSearchBar = false
|
||||
@State private var activeUserPickerSheet: UserPickerSheet? = nil
|
||||
|
||||
@State private var isUserPickerPresented: Bool = false
|
||||
|
||||
@AppStorage(DEFAULT_SHOW_UNREAD_AND_FAVORITES) private var showUnreadAndFavorites = false
|
||||
@AppStorage(GROUP_DEFAULT_ONE_HAND_UI, store: groupDefaults) private var oneHandUI = true
|
||||
@AppStorage(DEFAULT_ONE_HAND_UI_CARD_SHOWN) private var oneHandUICardShown = false
|
||||
@@ -58,44 +58,43 @@ struct ChatListView: View {
|
||||
destination: chatView
|
||||
) { chatListView }
|
||||
}
|
||||
.sheet(item: $activeUserPickerSheet) { sheet in
|
||||
if let currentUser = chatModel.currentUser {
|
||||
switch sheet {
|
||||
case .address:
|
||||
NavigationView {
|
||||
UserAddressView(shareViaProfile: currentUser.addressShared)
|
||||
.navigationTitle("Public address")
|
||||
.sheet(isPresented: $isUserPickerPresented) {
|
||||
UserPicker(activeSheet: $activeUserPickerSheet)
|
||||
.sheet(item: $activeUserPickerSheet) { sheet in
|
||||
if let currentUser = chatModel.currentUser {
|
||||
switch sheet {
|
||||
case .address:
|
||||
NavigationView {
|
||||
UserAddressView(shareViaProfile: currentUser.addressShared)
|
||||
.navigationTitle("Public address")
|
||||
.navigationBarTitleDisplayMode(.large)
|
||||
.modifier(ThemedBackground(grouped: true))
|
||||
}
|
||||
case .chatProfiles:
|
||||
NavigationView {
|
||||
UserProfilesView()
|
||||
}
|
||||
case .currentProfile:
|
||||
NavigationView {
|
||||
UserProfile()
|
||||
.navigationTitle("Your current profile")
|
||||
.modifier(ThemedBackground())
|
||||
}
|
||||
case .chatPreferences:
|
||||
NavigationView {
|
||||
PreferencesView(profile: currentUser.profile, preferences: currentUser.fullPreferences, currentPreferences: currentUser.fullPreferences)
|
||||
.navigationTitle("Your preferences")
|
||||
.navigationBarTitleDisplayMode(.large)
|
||||
.modifier(ThemedBackground(grouped: true))
|
||||
}
|
||||
case .useFromDesktop:
|
||||
ConnectDesktopView(viaSettings: false)
|
||||
case .settings:
|
||||
SettingsView(showSettings: $showSettings)
|
||||
.navigationBarTitleDisplayMode(.large)
|
||||
.modifier(ThemedBackground(grouped: true))
|
||||
}
|
||||
case .chatProfiles:
|
||||
NavigationView {
|
||||
UserProfilesView()
|
||||
}
|
||||
case .currentProfile:
|
||||
NavigationView {
|
||||
UserProfile()
|
||||
.navigationTitle("Your current profile")
|
||||
.modifier(ThemedBackground())
|
||||
}
|
||||
case .chatPreferences:
|
||||
NavigationView {
|
||||
PreferencesView(profile: currentUser.profile, preferences: currentUser.fullPreferences, currentPreferences: currentUser.fullPreferences)
|
||||
.navigationTitle("Your preferences")
|
||||
.navigationBarTitleDisplayMode(.large)
|
||||
.modifier(ThemedBackground(grouped: true))
|
||||
}
|
||||
case .useFromDesktop:
|
||||
ConnectDesktopView(viaSettings: false)
|
||||
case .settings:
|
||||
SettingsView(showSettings: $showSettings)
|
||||
.navigationBarTitleDisplayMode(.large)
|
||||
case .userPicker:
|
||||
UserPicker(
|
||||
activeSheet: $activeUserPickerSheet
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -208,7 +207,7 @@ struct ChatListView: View {
|
||||
}
|
||||
}
|
||||
.onTapGesture {
|
||||
activeUserPickerSheet = .userPicker
|
||||
isUserPickerPresented = true
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ struct UserPicker: View {
|
||||
@Environment(\.scenePhase) var scenePhase
|
||||
@Environment(\.colorScheme) var colorScheme
|
||||
@Binding var activeSheet: UserPickerSheet?
|
||||
|
||||
|
||||
var body: some View {
|
||||
if #available(iOS 16.0, *) {
|
||||
let v = viewBody.presentationDetents([.height(425)])
|
||||
|
||||
Reference in New Issue
Block a user