mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-03 16:10:20 +00:00
Remove the Learn More URL for the sliding sync proxy. (#4070)
This commit is contained in:
-2
@@ -12,7 +12,6 @@ struct ServerSelectionScreenCoordinatorParameters {
|
||||
/// The service used to authenticate the user.
|
||||
let authenticationService: AuthenticationServiceProtocol
|
||||
let authenticationFlow: AuthenticationFlow
|
||||
let slidingSyncLearnMoreURL: URL
|
||||
let userIndicatorController: UserIndicatorControllerProtocol
|
||||
}
|
||||
|
||||
@@ -39,7 +38,6 @@ final class ServerSelectionScreenCoordinator: CoordinatorProtocol {
|
||||
self.parameters = parameters
|
||||
viewModel = ServerSelectionScreenViewModel(authenticationService: parameters.authenticationService,
|
||||
authenticationFlow: parameters.authenticationFlow,
|
||||
slidingSyncLearnMoreURL: parameters.slidingSyncLearnMoreURL,
|
||||
userIndicatorController: parameters.userIndicatorController)
|
||||
userIndicatorController = parameters.userIndicatorController
|
||||
}
|
||||
|
||||
+3
-15
@@ -16,7 +16,7 @@ enum ServerSelectionScreenViewModelAction {
|
||||
|
||||
struct ServerSelectionScreenViewState: BindableState {
|
||||
/// The message to be shown in the text field footer when no error has occurred.
|
||||
private let regularFooterMessage: AttributedString
|
||||
private let regularFooterMessage = L10n.screenChangeServerFormNotice
|
||||
|
||||
/// View state that can be bound to from SwiftUI.
|
||||
var bindings: ServerSelectionScreenBindings
|
||||
@@ -24,8 +24,8 @@ struct ServerSelectionScreenViewState: BindableState {
|
||||
var footerErrorMessage: String?
|
||||
|
||||
/// The message to show in the text field footer.
|
||||
var footerMessage: AttributedString {
|
||||
footerErrorMessage.map(AttributedString.init) ?? regularFooterMessage
|
||||
var footerMessage: String {
|
||||
footerErrorMessage ?? regularFooterMessage
|
||||
}
|
||||
|
||||
/// The text field is showing an error.
|
||||
@@ -37,18 +37,6 @@ struct ServerSelectionScreenViewState: BindableState {
|
||||
var hasValidationError: Bool {
|
||||
bindings.homeserverAddress.isEmpty || isShowingFooterError
|
||||
}
|
||||
|
||||
init(slidingSyncLearnMoreURL: URL, bindings: ServerSelectionScreenBindings, footerErrorMessage: String? = nil) {
|
||||
self.bindings = bindings
|
||||
self.footerErrorMessage = footerErrorMessage
|
||||
|
||||
let linkPlaceholder = "{link}"
|
||||
var message = AttributedString(L10n.screenChangeServerFormNotice(linkPlaceholder))
|
||||
message.replace(linkPlaceholder,
|
||||
with: L10n.actionLearnMore,
|
||||
asLinkTo: slidingSyncLearnMoreURL)
|
||||
regularFooterMessage = message
|
||||
}
|
||||
}
|
||||
|
||||
struct ServerSelectionScreenBindings {
|
||||
|
||||
+3
-8
@@ -13,7 +13,6 @@ typealias ServerSelectionScreenViewModelType = StateStoreViewModel<ServerSelecti
|
||||
class ServerSelectionScreenViewModel: ServerSelectionScreenViewModelType, ServerSelectionScreenViewModelProtocol {
|
||||
private let authenticationService: AuthenticationServiceProtocol
|
||||
private let authenticationFlow: AuthenticationFlow
|
||||
private let slidingSyncLearnMoreURL: URL
|
||||
private let userIndicatorController: UserIndicatorControllerProtocol
|
||||
|
||||
private var actionsSubject: PassthroughSubject<ServerSelectionScreenViewModelAction, Never> = .init()
|
||||
@@ -24,15 +23,13 @@ class ServerSelectionScreenViewModel: ServerSelectionScreenViewModelType, Server
|
||||
|
||||
init(authenticationService: AuthenticationServiceProtocol,
|
||||
authenticationFlow: AuthenticationFlow,
|
||||
slidingSyncLearnMoreURL: URL,
|
||||
userIndicatorController: UserIndicatorControllerProtocol) {
|
||||
self.authenticationService = authenticationService
|
||||
self.authenticationFlow = authenticationFlow
|
||||
self.slidingSyncLearnMoreURL = slidingSyncLearnMoreURL
|
||||
self.userIndicatorController = userIndicatorController
|
||||
|
||||
let bindings = ServerSelectionScreenBindings(homeserverAddress: authenticationService.homeserver.value.address)
|
||||
super.init(initialViewState: ServerSelectionScreenViewState(slidingSyncLearnMoreURL: slidingSyncLearnMoreURL, bindings: bindings))
|
||||
super.init(initialViewState: ServerSelectionScreenViewState(bindings: bindings))
|
||||
}
|
||||
|
||||
override func process(viewAction: ServerSelectionScreenViewAction) {
|
||||
@@ -87,12 +84,10 @@ class ServerSelectionScreenViewModel: ServerSelectionScreenViewModelType, Server
|
||||
title: L10n.commonServerNotSupported,
|
||||
message: L10n.screenChangeServerErrorInvalidWellKnown(error))
|
||||
case .slidingSyncNotAvailable:
|
||||
let openURL = { UIApplication.shared.open(self.slidingSyncLearnMoreURL) }
|
||||
let nonBreakingAppName = InfoPlistReader.main.bundleDisplayName.replacingOccurrences(of: " ", with: "\u{00A0}")
|
||||
state.bindings.alertInfo = AlertInfo(id: .slidingSyncAlert,
|
||||
title: L10n.commonServerNotSupported,
|
||||
message: L10n.screenChangeServerErrorNoSlidingSyncMessage,
|
||||
primaryButton: .init(title: L10n.actionLearnMore, role: .cancel, action: openURL),
|
||||
secondaryButton: .init(title: L10n.actionCancel, action: nil))
|
||||
message: L10n.screenChangeServerErrorNoSlidingSyncMessage(nonBreakingAppName))
|
||||
case .loginNotSupported:
|
||||
state.bindings.alertInfo = AlertInfo(id: .loginAlert,
|
||||
title: L10n.commonServerNotSupported,
|
||||
|
||||
-3
@@ -115,11 +115,8 @@ struct ServerSelection_Previews: PreviewProvider, TestablePreview {
|
||||
static func makeViewModel(for homeserverAddress: String) -> ServerSelectionScreenViewModel {
|
||||
let authenticationService = AuthenticationService.mock
|
||||
|
||||
let slidingSyncLearnMoreURL = ServiceLocator.shared.settings.slidingSyncLearnMoreURL
|
||||
|
||||
let viewModel = ServerSelectionScreenViewModel(authenticationService: authenticationService,
|
||||
authenticationFlow: .login,
|
||||
slidingSyncLearnMoreURL: slidingSyncLearnMoreURL,
|
||||
userIndicatorController: UserIndicatorControllerMock())
|
||||
viewModel.context.homeserverAddress = homeserverAddress
|
||||
if homeserverAddress == "thisisbad" {
|
||||
|
||||
Reference in New Issue
Block a user