mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2026-04-08 23:35:52 +00:00
load sheet navigation titles before presenting (#4963)
* load sheet navigation titles before presenting * list background during loading
This commit is contained in:
@@ -18,6 +18,17 @@ enum UserPickerSheet: Identifiable {
|
||||
case settings
|
||||
|
||||
var id: Self { self }
|
||||
|
||||
var navigationTitle: LocalizedStringKey {
|
||||
switch self {
|
||||
case .address: "SimpleX address"
|
||||
case .chatPreferences: "Your preferences"
|
||||
case .chatProfiles: "Your chat profiles"
|
||||
case .currentProfile: "Your current profile"
|
||||
case .useFromDesktop: "Connect to desktop"
|
||||
case .settings: "Your settings"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
struct UserPickerSheetView: View {
|
||||
@@ -27,43 +38,39 @@ struct UserPickerSheetView: View {
|
||||
@State private var loaded = false
|
||||
|
||||
var body: some View {
|
||||
Group {
|
||||
if loaded, let currentUser = chatModel.currentUser {
|
||||
switch sheet {
|
||||
case .address:
|
||||
NavigationView {
|
||||
NavigationView {
|
||||
ZStack {
|
||||
if loaded, let currentUser = chatModel.currentUser {
|
||||
switch sheet {
|
||||
case .address:
|
||||
UserAddressView(shareViaProfile: currentUser.addressShared)
|
||||
.navigationTitle("SimpleX address")
|
||||
.navigationBarTitleDisplayMode(.large)
|
||||
.modifier(ThemedBackground(grouped: true))
|
||||
}
|
||||
case .chatProfiles:
|
||||
NavigationView {
|
||||
case .chatPreferences:
|
||||
PreferencesView(
|
||||
profile: currentUser.profile,
|
||||
preferences: currentUser.fullPreferences,
|
||||
currentPreferences: currentUser.fullPreferences
|
||||
)
|
||||
case .chatProfiles:
|
||||
UserProfilesView()
|
||||
}
|
||||
case .currentProfile:
|
||||
NavigationView {
|
||||
case .currentProfile:
|
||||
UserProfile()
|
||||
.navigationTitle("Your current profile")
|
||||
.modifier(ThemedBackground(grouped: true))
|
||||
case .useFromDesktop:
|
||||
ConnectDesktopView()
|
||||
case .settings:
|
||||
SettingsView(showSettings: $showSettings, withNavigation: false)
|
||||
}
|
||||
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)
|
||||
}
|
||||
Color.clear // Required for list background to be rendered during loading
|
||||
}
|
||||
.navigationTitle(sheet.navigationTitle)
|
||||
.navigationBarTitleDisplayMode(.large)
|
||||
.modifier(ThemedBackground(grouped: true))
|
||||
}
|
||||
.task {
|
||||
withAnimation(.easeOut(duration: 0.1)) { loaded = true }
|
||||
withAnimation(
|
||||
.easeOut(duration: 0.1),
|
||||
{ loaded = true }
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,7 +14,6 @@ struct ConnectDesktopView: View {
|
||||
@EnvironmentObject var m: ChatModel
|
||||
@EnvironmentObject var theme: AppTheme
|
||||
@Environment(\.dismiss) var dismiss: DismissAction
|
||||
var viaSettings = false
|
||||
@AppStorage(DEFAULT_DEVICE_NAME_FOR_REMOTE_ACCESS) private var deviceName = UIDevice.current.name
|
||||
@AppStorage(DEFAULT_CONFIRM_REMOTE_SESSIONS) private var confirmRemoteSessions = false
|
||||
@AppStorage(DEFAULT_CONNECT_REMOTE_VIA_MULTICAST) private var connectRemoteViaMulticast = true
|
||||
@@ -57,16 +56,6 @@ struct ConnectDesktopView: View {
|
||||
}
|
||||
|
||||
var body: some View {
|
||||
if viaSettings {
|
||||
viewBody
|
||||
} else {
|
||||
NavigationView {
|
||||
viewBody
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var viewBody: some View {
|
||||
Group {
|
||||
let discovery = m.remoteCtrlSession?.discovery
|
||||
if discovery == true || (discovery == nil && !showConnectScreen) {
|
||||
|
||||
@@ -262,10 +262,13 @@ struct SettingsView: View {
|
||||
@EnvironmentObject var theme: AppTheme
|
||||
@Binding var showSettings: Bool
|
||||
@State private var showProgress: Bool = false
|
||||
var withNavigation = true
|
||||
|
||||
var body: some View {
|
||||
ZStack {
|
||||
NavigationView {
|
||||
if withNavigation {
|
||||
NavigationView { settingsView() }
|
||||
} else {
|
||||
settingsView()
|
||||
}
|
||||
if showProgress {
|
||||
|
||||
Reference in New Issue
Block a user