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 {
|
||||
@ObservedObject var context: DeveloperOptionsScreenViewModel.Context
|
||||
@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 {
|
||||
Form {
|
||||
@ -51,21 +56,30 @@ struct DeveloperOptionsScreen: View {
|
||||
}
|
||||
}
|
||||
|
||||
Section("Element Call") {
|
||||
TextField(context.viewState.elementCallBaseURL.absoluteString, text: $elementCallBaseURLString)
|
||||
.submitLabel(.done)
|
||||
.onSubmit {
|
||||
guard let url = URL(string: elementCallBaseURLString) else { return }
|
||||
context.elementCallBaseURLOverride = url
|
||||
}
|
||||
Section {
|
||||
TextField(context.viewState.elementCallBaseURL.absoluteString, text: $elementCallURLOverrideString)
|
||||
.autocorrectionDisabled(true)
|
||||
.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) {
|
||||
Text("Picture in Picture support")
|
||||
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 {
|
||||
|
Loading…
x
Reference in New Issue
Block a user