Hardcode the sliding sync proxy. (#502)

* Add support for migrating between versions.
* Rename InfoPlistReader property.
* Bump SDK version.
This commit is contained in:
Doug
2023-01-31 17:48:24 +00:00
committed by GitHub
parent 4f8cc08989
commit f6629e0d6e
31 changed files with 143 additions and 99 deletions
@@ -55,8 +55,6 @@ struct ServerSelectionViewState: BindableState {
struct ServerSelectionBindings {
/// The homeserver address input by the user.
var homeserverAddress: String
/// The sliding sync proxy address input by the user.
var slidingSyncProxyAddress: String
/// Information describing the currently displayed alert.
var alertInfo: AlertInfo<ServerSelectionErrorType>?
}
@@ -22,8 +22,7 @@ class ServerSelectionViewModel: ServerSelectionViewModelType, ServerSelectionVie
var callback: (@MainActor (ServerSelectionViewModelAction) -> Void)?
init(homeserverAddress: String, isModallyPresented: Bool) {
let bindings = ServerSelectionBindings(homeserverAddress: homeserverAddress,
slidingSyncProxyAddress: ServiceLocator.shared.settings.slidingSyncProxyBaseURLString)
let bindings = ServerSelectionBindings(homeserverAddress: homeserverAddress)
super.init(initialViewState: ServerSelectionViewState(bindings: bindings,
isModallyPresented: isModallyPresented))
@@ -32,11 +31,6 @@ class ServerSelectionViewModel: ServerSelectionViewModelType, ServerSelectionVie
override func process(viewAction: ServerSelectionViewAction) async {
switch viewAction {
case .confirm:
if !state.bindings.slidingSyncProxyAddress.isEmpty,
state.bindings.slidingSyncProxyAddress != ServiceLocator.shared.settings.slidingSyncProxyBaseURLString {
ServiceLocator.shared.settings.slidingSyncProxyBaseURLString = state.bindings.slidingSyncProxyAddress
}
callback?(.confirm(homeserverAddress: state.bindings.homeserverAddress))
case .dismiss:
callback?(.dismiss)
@@ -71,16 +71,6 @@ struct ServerSelectionScreen: View {
.onSubmit(submit)
.accessibilityIdentifier("addressTextField")
TextField(ElementL10n.ftueAuthChooseServerEntryHint, text: $context.slidingSyncProxyAddress)
.textFieldStyle(.elementInput(labelText: "Sliding sync proxy URL"))
.keyboardType(.URL)
.autocapitalization(.none)
.disableAutocorrection(true)
.submitLabel(.done)
.onSubmit(submit)
.accessibilityIdentifier("slidingSyncProxyAddressTextField")
.padding(.bottom, 8)
Button(action: submit) {
Text(context.viewState.buttonTitle)
}