add back button on login screen
This commit is contained in:
parent
bc60710ae4
commit
c46838905f
|
@ -34,6 +34,7 @@ struct ConnectToServerView: View {
|
|||
@State private var isConnected = false;
|
||||
@State private var serverName = "";
|
||||
@State private var publicUsers: [publicUser] = [];
|
||||
@State private var lastPublicUsers: [publicUser] = [];
|
||||
@Binding var rootIsActive : Bool
|
||||
|
||||
let userUUID = UUID();
|
||||
|
@ -258,12 +259,47 @@ struct ConnectToServerView: View {
|
|||
Alert(title: Text("Error"), message: Text("Invalid credentials"), dismissButton: .default(Text("Back")))
|
||||
}
|
||||
}
|
||||
|
||||
if(serverSkipped) {
|
||||
Section() {
|
||||
Button {
|
||||
_serverSkippedAlert.wrappedValue = false;
|
||||
_server_id.wrappedValue = ""
|
||||
_serverName.wrappedValue = ""
|
||||
_isConnected.wrappedValue = false;
|
||||
_serverSkipped.wrappedValue = false;
|
||||
} label: {
|
||||
HStack() {
|
||||
HStack() {
|
||||
Image(systemName: "chevron.left")
|
||||
Text("Change Server")
|
||||
}
|
||||
Spacer()
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
Section() {
|
||||
Button {
|
||||
_publicUsers.wrappedValue = _lastPublicUsers.wrappedValue
|
||||
} label: {
|
||||
HStack() {
|
||||
HStack() {
|
||||
Image(systemName: "chevron.left")
|
||||
Text("Back")
|
||||
}
|
||||
Spacer()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
Section(header: Text("\(serverSkipped ? "Reauthenticate" : "Login") to \(serverName)")) {
|
||||
ForEach(publicUsers, id: \.id) { pubuser in
|
||||
HStack() {
|
||||
Button() {
|
||||
if(pubuser.hasPassword) {
|
||||
_lastPublicUsers.wrappedValue = _publicUsers.wrappedValue
|
||||
_publicUsers.wrappedValue = []
|
||||
} else {
|
||||
_publicUsers.wrappedValue = []
|
||||
|
|
|
@ -9,9 +9,20 @@ import SwiftUI
|
|||
|
||||
struct SettingsView: View {
|
||||
@Binding var close: Bool;
|
||||
@EnvironmentObject private var globalData: GlobalData
|
||||
@State private var username: String = "";
|
||||
|
||||
func onAppear() {
|
||||
_username.wrappedValue = globalData.user?.username ?? "";
|
||||
}
|
||||
|
||||
var body: some View {
|
||||
NavigationView() {
|
||||
Text("SettingsView not implemented.")
|
||||
Form() {
|
||||
Section(header: Text("Playback settings")) {
|
||||
|
||||
}
|
||||
}
|
||||
.navigationBarTitle("Settings", displayMode: .inline)
|
||||
.toolbar {
|
||||
ToolbarItemGroup(placement: .navigationBarLeading) {
|
||||
|
@ -24,6 +35,6 @@ struct SettingsView: View {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}.onAppear(perform: onAppear)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue