changes for build 13

This commit is contained in:
Aiden Vigue 2021-05-23 19:04:27 -04:00
parent c46838905f
commit d61a85da9e
3 changed files with 58 additions and 2 deletions

View File

@ -239,7 +239,7 @@ struct ConnectToServerView: View {
}
} else {
if(_publicUsers.wrappedValue.count == 0) {
Section(header: Text("\(serverSkipped ? "re" : "")Authenticate to \"\(serverName)\"")) {
Section(header: Text("\(serverSkipped ? "Reauthenticate" : "Login") to \(serverName)")) {
TextField("Username", text: $username)
.disableAutocorrection(true)
.autocapitalization(.none)

View File

@ -19,6 +19,7 @@ class GlobalData: ObservableObject {
@Published var authToken: String = ""
@Published var server: Server?
@Published var authHeader: String = ""
@Published var isInNetwork: Bool = true;
}
extension View {
@ -327,6 +328,26 @@ struct ContentView: View {
}
}
}
let request2 = RestRequest(method: .get, url: (globalData.server?.baseURI ?? "") + "/System/Endpoint")
request2.headerParameters["X-Emby-Authorization"] = globalData.authHeader
request2.contentType = "application/json"
request2.acceptType = "application/json"
request2.responseData(){ (result: Result<RestResponse<Data>, RestError>) in
switch result {
case .success( let resp):
do {
let json = try JSON(data: resp.body)
globalData.isInNetwork = json["IsInNetwork"].bool ?? true;
} catch {
}
break
case .failure( let error):
break;
}
}
}
}

View File

@ -11,6 +11,7 @@ struct SettingsView: View {
@Binding var close: Bool;
@EnvironmentObject private var globalData: GlobalData
@State private var username: String = "";
@State private var inNetworkStreamBitrate: Int = 40;
func onAppear() {
_username.wrappedValue = globalData.user?.username ?? "";
@ -20,7 +21,41 @@ struct SettingsView: View {
NavigationView() {
Form() {
Section(header: Text("Playback settings")) {
Picker("Local playback bitrate", selection: $inNetworkStreamBitrate) {
Group {
Text("1080p - 60 Mbps").tag(60)
Text("1080p - 40 Mbps").tag(40)
Text("1080p - 20 Mbps").tag(20)
Text("1080p - 15 Mbps").tag(15)
Text("1080p - 10 Mbps").tag(10)
}
Group {
Text("720p - 8 Mbps").tag(8)
Text("720p - 6 Mbps").tag(6)
Text("720p - 4 Mbps").tag(4)
}
Text("480p - 3 Mbps").tag(3)
Text("480p - 1.5 Mbps").tag(2)
Text("480p - 740 Kbps").tag(1)
}
Picker("Remote playback bitrate", selection: $inNetworkStreamBitrate) {
Group {
Text("1080p - 60 Mbps").tag(60)
Text("1080p - 40 Mbps").tag(40)
Text("1080p - 20 Mbps").tag(20)
Text("1080p - 15 Mbps").tag(15)
Text("1080p - 10 Mbps").tag(10)
}
Group {
Text("720p - 8 Mbps").tag(8)
Text("720p - 6 Mbps").tag(6)
Text("720p - 4 Mbps").tag(4)
}
Text("480p - 3 Mbps").tag(3)
Text("480p - 1.5 Mbps").tag(2)
Text("480p - 740 Kbps").tag(1)
}
}
}
.navigationBarTitle("Settings", displayMode: .inline)