mirror of
https://github.com/element-hq/element-x-ios.git
synced 2025-03-10 21:39:12 +00:00
Fix the call URL input field in Developer Options (#3192)
This commit is contained in:
parent
4eb1ed5d09
commit
8c07397548
@ -19,7 +19,12 @@ import SwiftUI
|
|||||||
struct DeveloperOptionsScreen: View {
|
struct DeveloperOptionsScreen: View {
|
||||||
@ObservedObject var context: DeveloperOptionsScreenViewModel.Context
|
@ObservedObject var context: DeveloperOptionsScreenViewModel.Context
|
||||||
@State private var showConfetti = false
|
@State private var showConfetti = false
|
||||||
@State private var elementCallBaseURLString = ""
|
@State private var elementCallURLOverrideString: String
|
||||||
|
|
||||||
|
init(context: DeveloperOptionsScreenViewModel.Context) {
|
||||||
|
self.context = context
|
||||||
|
elementCallURLOverrideString = context.elementCallBaseURLOverride?.absoluteString ?? ""
|
||||||
|
}
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
Form {
|
Form {
|
||||||
@ -50,22 +55,31 @@ struct DeveloperOptionsScreen: View {
|
|||||||
Text("Fuzzy searching")
|
Text("Fuzzy searching")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Section("Element Call") {
|
Section {
|
||||||
TextField(context.viewState.elementCallBaseURL.absoluteString, text: $elementCallBaseURLString)
|
TextField(context.viewState.elementCallBaseURL.absoluteString, text: $elementCallURLOverrideString)
|
||||||
.submitLabel(.done)
|
|
||||||
.onSubmit {
|
|
||||||
guard let url = URL(string: elementCallBaseURLString) else { return }
|
|
||||||
context.elementCallBaseURLOverride = url
|
|
||||||
}
|
|
||||||
.autocorrectionDisabled(true)
|
.autocorrectionDisabled(true)
|
||||||
.autocapitalization(.none)
|
.autocapitalization(.none)
|
||||||
.foregroundColor(URL(string: elementCallBaseURLString) == nil ? .red : .primary)
|
.foregroundColor(URL(string: elementCallURLOverrideString) == nil ? .red : .primary)
|
||||||
|
.submitLabel(.done)
|
||||||
|
.onSubmit {
|
||||||
|
if elementCallURLOverrideString.isEmpty {
|
||||||
|
context.elementCallBaseURLOverride = nil
|
||||||
|
} else if let url = URL(string: elementCallURLOverrideString) {
|
||||||
|
context.elementCallBaseURLOverride = url
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Toggle(isOn: $context.elementCallPictureInPictureEnabled) {
|
Toggle(isOn: $context.elementCallPictureInPictureEnabled) {
|
||||||
Text("Picture in Picture support")
|
Text("Picture in Picture support")
|
||||||
Text("Requires an Element Call deployment with support for signalling PiP availability.")
|
Text("Requires an Element Call deployment with support for signalling PiP availability.")
|
||||||
}
|
}
|
||||||
|
} header: {
|
||||||
|
Text("Element Call")
|
||||||
|
} footer: {
|
||||||
|
if context.elementCallBaseURLOverride == nil {
|
||||||
|
Text("The call URL may be overridden by your homeserver.")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Section {
|
Section {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user