mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-04-16 06:28:27 +02:00
Configured and applied SwiftFormat
This commit is contained in:
committed by
Stefan Ceriu
parent
ff2e6ddfa7
commit
43c28d23b7
15
.swiftformat
Normal file
15
.swiftformat
Normal file
@@ -0,0 +1,15 @@
|
||||
--swiftversion 5.6
|
||||
|
||||
--exclude CommonKit, Config, DesignKit, Riot, RiotNSE, RiotShareExtension, RiotTests, SiriIntents, Tools, Variants, vendor
|
||||
|
||||
--disable wrapMultiLineStatementBraces
|
||||
--disable hoistPatternLet
|
||||
|
||||
--commas inline
|
||||
--ifdef no-indent
|
||||
--nospaceoperators ...,..<
|
||||
--stripunusedargs closure-only
|
||||
--trimwhitespace nonblank-lines
|
||||
--wrapparameters after-first
|
||||
--redundanttype inferred
|
||||
--emptybraces spaced
|
||||
@@ -1,4 +1,4 @@
|
||||
//
|
||||
//
|
||||
// Copyright 2021 New Vector Ltd
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
|
||||
@@ -14,14 +14,13 @@
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
import Combine
|
||||
import SwiftUI
|
||||
|
||||
typealias AnalyticsPromptViewModelType = StateStoreViewModel<AnalyticsPromptViewState,
|
||||
Never,
|
||||
AnalyticsPromptViewAction>
|
||||
Never,
|
||||
AnalyticsPromptViewAction>
|
||||
class AnalyticsPromptViewModel: AnalyticsPromptViewModelType {
|
||||
|
||||
// MARK: - Properties
|
||||
|
||||
// MARK: Private
|
||||
|
||||
@@ -22,17 +22,16 @@ struct AnalyticsPromptCoordinatorParameters {
|
||||
}
|
||||
|
||||
final class AnalyticsPromptCoordinator: Coordinator, Presentable {
|
||||
|
||||
// MARK: - Properties
|
||||
|
||||
// MARK: Private
|
||||
|
||||
private let parameters: AnalyticsPromptCoordinatorParameters
|
||||
private let analyticsPromptHostingController: UIViewController
|
||||
private var _analyticsPromptViewModel: Any? = nil
|
||||
private var _analyticsPromptViewModel: Any?
|
||||
|
||||
fileprivate var analyticsPromptViewModel: AnalyticsPromptViewModel {
|
||||
return _analyticsPromptViewModel as! AnalyticsPromptViewModel
|
||||
_analyticsPromptViewModel as! AnalyticsPromptViewModel
|
||||
}
|
||||
|
||||
// MARK: Public
|
||||
@@ -84,6 +83,6 @@ final class AnalyticsPromptCoordinator: Coordinator, Presentable {
|
||||
}
|
||||
|
||||
func toPresentable() -> UIViewController {
|
||||
return self.analyticsPromptHostingController
|
||||
analyticsPromptHostingController
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
//
|
||||
//
|
||||
// Copyright 2021 New Vector Ltd
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@@ -25,4 +25,3 @@ struct AnalyticsPromptStrings: AnalyticsPromptStringsProtocol {
|
||||
withAllowedTags: ["b", "p"],
|
||||
font: UIFont.systemFont(ofSize: UIFont.systemFontSize))
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
//
|
||||
//
|
||||
// Copyright 2021 New Vector Ltd
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
//
|
||||
//
|
||||
// Copyright 2021 New Vector Ltd
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
|
||||
@@ -14,8 +14,8 @@
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
import XCTest
|
||||
import RiotSwiftUI
|
||||
import XCTest
|
||||
|
||||
class AnalyticsPromptUITests: MockScreenTestCase {
|
||||
/// Verify that the prompt is displayed correctly for new users.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
//
|
||||
//
|
||||
// Copyright 2021 New Vector Ltd
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@@ -18,7 +18,6 @@ import SwiftUI
|
||||
|
||||
/// A prompt that asks the user whether they would like to enable Analytics or not.
|
||||
struct AnalyticsPrompt: View {
|
||||
|
||||
// MARK: - Properties
|
||||
|
||||
// MARK: Private
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
//
|
||||
//
|
||||
// Copyright 2021 New Vector Ltd
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@@ -17,7 +17,6 @@
|
||||
import SwiftUI
|
||||
|
||||
struct AnalyticsPromptCheckmarkItem: View {
|
||||
|
||||
// MARK: - Properties
|
||||
|
||||
// MARK: Private
|
||||
@@ -40,7 +39,7 @@ struct AnalyticsPromptCheckmarkItem: View {
|
||||
let range = NSRange(location: 0, length: attributedString.length)
|
||||
let string = attributedString.string as NSString
|
||||
|
||||
attributedString.enumerateAttributes(in: range, options: []) { attributes, range, stop in
|
||||
attributedString.enumerateAttributes(in: range, options: []) { attributes, range, _ in
|
||||
var isBold = false
|
||||
|
||||
if let font = attributes[.font] as? UIFont {
|
||||
@@ -54,7 +53,7 @@ struct AnalyticsPromptCheckmarkItem: View {
|
||||
}
|
||||
|
||||
init(string: String) {
|
||||
self.components = [StringComponent(string: string, isBold: false)]
|
||||
components = [StringComponent(string: string, isBold: false)]
|
||||
}
|
||||
|
||||
// MARK: - Views
|
||||
@@ -75,11 +74,10 @@ struct AnalyticsPromptCheckmarkItem: View {
|
||||
// MARK: - Previews
|
||||
|
||||
struct AnalyticsPromptCheckmarkItem_Previews: PreviewProvider {
|
||||
|
||||
static let strings = MockAnalyticsPromptStrings()
|
||||
|
||||
static var previews: some View {
|
||||
VStack(alignment:.leading) {
|
||||
VStack(alignment: .leading) {
|
||||
AnalyticsPromptCheckmarkItem(attributedString: strings.point1)
|
||||
AnalyticsPromptCheckmarkItem(attributedString: strings.point2)
|
||||
AnalyticsPromptCheckmarkItem(attributedString: strings.longString)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
//
|
||||
//
|
||||
// Copyright 2021 New Vector Ltd
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
|
||||
@@ -17,10 +17,9 @@
|
||||
import SwiftUI
|
||||
|
||||
typealias AuthenticationChoosePasswordViewModelType = StateStoreViewModel<AuthenticationChoosePasswordViewState,
|
||||
Never,
|
||||
AuthenticationChoosePasswordViewAction>
|
||||
Never,
|
||||
AuthenticationChoosePasswordViewAction>
|
||||
class AuthenticationChoosePasswordViewModel: AuthenticationChoosePasswordViewModelType, AuthenticationChoosePasswordViewModelProtocol {
|
||||
|
||||
// MARK: - Properties
|
||||
|
||||
// MARK: Private
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
//
|
||||
//
|
||||
// Copyright 2021 New Vector Ltd
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@@ -17,7 +17,6 @@
|
||||
import Foundation
|
||||
|
||||
protocol AuthenticationChoosePasswordViewModelProtocol {
|
||||
|
||||
var callback: (@MainActor (AuthenticationChoosePasswordViewModelResult) -> Void)? { get set }
|
||||
var context: AuthenticationChoosePasswordViewModelType.Context { get }
|
||||
|
||||
|
||||
@@ -14,8 +14,8 @@
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
import CommonKit
|
||||
import SwiftUI
|
||||
|
||||
struct AuthenticationChoosePasswordCoordinatorParameters {
|
||||
let loginWizard: LoginWizard
|
||||
@@ -29,7 +29,6 @@ enum AuthenticationChoosePasswordCoordinatorResult {
|
||||
}
|
||||
|
||||
final class AuthenticationChoosePasswordCoordinator: Coordinator, Presentable {
|
||||
|
||||
// MARK: - Properties
|
||||
|
||||
// MARK: Private
|
||||
@@ -79,7 +78,7 @@ final class AuthenticationChoosePasswordCoordinator: Coordinator, Presentable {
|
||||
}
|
||||
|
||||
func toPresentable() -> UIViewController {
|
||||
return self.authenticationChoosePasswordHostingController
|
||||
authenticationChoosePasswordHostingController
|
||||
}
|
||||
|
||||
// MARK: - Private
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
//
|
||||
//
|
||||
// Copyright 2021 New Vector Ltd
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@@ -34,7 +34,7 @@ enum MockAuthenticationChoosePasswordScreenState: MockScreenState, CaseIterable
|
||||
}
|
||||
|
||||
/// Generate the view struct for the screen state.
|
||||
var screenView: ([Any], AnyView) {
|
||||
var screenView: ([Any], AnyView) {
|
||||
let viewModel: AuthenticationChoosePasswordViewModel
|
||||
switch self {
|
||||
case .emptyPassword:
|
||||
|
||||
@@ -14,8 +14,8 @@
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
import XCTest
|
||||
import RiotSwiftUI
|
||||
import XCTest
|
||||
|
||||
class AuthenticationChoosePasswordUITests: MockScreenTestCase {
|
||||
func testEmptyPassword() {
|
||||
@@ -93,7 +93,6 @@ class AuthenticationChoosePasswordUITests: MockScreenTestCase {
|
||||
XCTAssertTrue(signoutAllDevicesToggle.exists, "Sign out all devices toggle should exist")
|
||||
XCTAssertTrue(signoutAllDevicesToggle.isOn, "Sign out all devices should be checked")
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
extension XCUIElement {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
//
|
||||
//
|
||||
// Copyright 2021 New Vector Ltd
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@@ -19,7 +19,6 @@ import XCTest
|
||||
@testable import RiotSwiftUI
|
||||
|
||||
class AuthenticationChoosePasswordViewModelTests: XCTestCase {
|
||||
|
||||
@MainActor func testInitialState() async {
|
||||
let viewModel = AuthenticationChoosePasswordViewModel()
|
||||
let context = viewModel.context
|
||||
@@ -29,5 +28,4 @@ class AuthenticationChoosePasswordViewModelTests: XCTestCase {
|
||||
XCTAssert(context.viewState.hasInvalidPassword, "The view model should start with an invalid password.")
|
||||
XCTAssertFalse(context.signoutAllDevices, "The view model should start with sign out of all devices unchecked.")
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
//
|
||||
//
|
||||
// Copyright 2021 New Vector Ltd
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@@ -17,7 +17,6 @@
|
||||
import SwiftUI
|
||||
|
||||
struct AuthenticationChoosePasswordScreen: View {
|
||||
|
||||
// MARK: - Properties
|
||||
|
||||
// MARK: Private
|
||||
@@ -100,7 +99,7 @@ struct AuthenticationChoosePasswordScreen: View {
|
||||
configuration: UIKitTextInputConfiguration(returnKeyType: .done,
|
||||
isSecureTextEntry: true),
|
||||
onCommit: submit)
|
||||
.accessibilityIdentifier("passwordTextField")
|
||||
.accessibilityIdentifier("passwordTextField")
|
||||
}
|
||||
|
||||
/// Sends the `send` view action so long as a valid email address has been input.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
//
|
||||
//
|
||||
// Copyright 2022 New Vector Ltd
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@@ -37,11 +37,11 @@ extension AuthenticationHomeserverViewData {
|
||||
showLoginForm: true,
|
||||
showRegistrationForm: true,
|
||||
ssoIdentityProviders: [
|
||||
SSOIdentityProvider(id: "1", name: "Apple", brand: "apple", iconURL: nil),
|
||||
SSOIdentityProvider(id: "2", name: "Facebook", brand: "facebook", iconURL: nil),
|
||||
SSOIdentityProvider(id: "3", name: "GitHub", brand: "github", iconURL: nil),
|
||||
SSOIdentityProvider(id: "4", name: "GitLab", brand: "gitlab", iconURL: nil),
|
||||
SSOIdentityProvider(id: "5", name: "Google", brand: "google", iconURL: nil)
|
||||
SSOIdentityProvider(id: "1", name: "Apple", brand: "apple", iconURL: nil),
|
||||
SSOIdentityProvider(id: "2", name: "Facebook", brand: "facebook", iconURL: nil),
|
||||
SSOIdentityProvider(id: "3", name: "GitHub", brand: "github", iconURL: nil),
|
||||
SSOIdentityProvider(id: "4", name: "GitLab", brand: "gitlab", iconURL: nil),
|
||||
SSOIdentityProvider(id: "5", name: "Google", brand: "google", iconURL: nil)
|
||||
])
|
||||
}
|
||||
|
||||
@@ -68,5 +68,4 @@ extension AuthenticationHomeserverViewData {
|
||||
showRegistrationForm: false,
|
||||
ssoIdentityProviders: [])
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
//
|
||||
//
|
||||
// Copyright 2022 New Vector Ltd
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@@ -78,7 +78,7 @@ enum LoginError: String, Error {
|
||||
case resetPasswordNotStarted
|
||||
}
|
||||
|
||||
@objcMembers
|
||||
@objcMembers
|
||||
class HomeserverAddress: NSObject {
|
||||
/// Sanitizes a user entered homeserver address with the following rules
|
||||
/// - Trim any whitespace.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
//
|
||||
//
|
||||
// Copyright 2022 New Vector Ltd
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@@ -18,7 +18,6 @@ import SwiftUI
|
||||
|
||||
/// A button that displays the icon and name of an SSO provider.
|
||||
struct AuthenticationSSOButton: View {
|
||||
|
||||
// MARK: - Constants
|
||||
|
||||
enum Brand: String {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
//
|
||||
//
|
||||
// Copyright 2022 New Vector Ltd
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@@ -19,7 +19,6 @@ import SwiftUI
|
||||
/// A view that shows information about the chosen homeserver,
|
||||
/// along with an edit button to pick a different one.
|
||||
struct AuthenticationServerInfoSection: View {
|
||||
|
||||
// MARK: - Private
|
||||
|
||||
@Environment(\.theme) private var theme
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
//
|
||||
//
|
||||
// Copyright 2022 New Vector Ltd
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
//
|
||||
//
|
||||
// Copyright 2022 New Vector Ltd
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@@ -18,6 +18,7 @@ import Foundation
|
||||
|
||||
protocol AuthenticationRestClient: AnyObject {
|
||||
// MARK: Configuration
|
||||
|
||||
var homeserver: String! { get }
|
||||
var identityServer: String! { get set }
|
||||
var credentials: MXCredentials! { get }
|
||||
@@ -26,24 +27,27 @@ protocol AuthenticationRestClient: AnyObject {
|
||||
init(homeServer: URL, unrecognizedCertificateHandler handler: MXHTTPClientOnUnrecognizedCertificate?)
|
||||
|
||||
// MARK: Login
|
||||
|
||||
var loginFallbackURL: URL { get }
|
||||
func wellKnown() async throws -> MXWellKnown
|
||||
func getLoginSession() async throws -> MXAuthenticationSession
|
||||
func login(parameters: LoginParameters) async throws -> MXCredentials
|
||||
func login(parameters: [String : Any]) async throws -> MXCredentials
|
||||
func login(parameters: [String: Any]) async throws -> MXCredentials
|
||||
|
||||
// MARK: Registration
|
||||
|
||||
var registerFallbackURL: URL { get }
|
||||
func getRegisterSession() async throws -> MXAuthenticationSession
|
||||
func isUsernameAvailable(_ username: String) async throws -> Bool
|
||||
func register(parameters: RegistrationParameters) async throws -> MXLoginResponse
|
||||
func register(parameters: [String : Any]) async throws -> MXLoginResponse
|
||||
func register(parameters: [String: Any]) async throws -> MXLoginResponse
|
||||
func requestTokenDuringRegistration(for threePID: RegisterThreePID, clientSecret: String, sendAttempt: UInt) async throws -> RegistrationThreePIDTokenResponse
|
||||
|
||||
// MARK: Forgot Password
|
||||
|
||||
func forgetPassword(for email: String, clientSecret: String, sendAttempt: UInt) async throws -> String
|
||||
func resetPassword(parameters: CheckResetPasswordParameters) async throws
|
||||
func resetPassword(parameters: [String : Any]) async throws
|
||||
func resetPassword(parameters: [String: Any]) async throws
|
||||
}
|
||||
|
||||
extension MXRestClient: AuthenticationRestClient { }
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
//
|
||||
//
|
||||
// Copyright 2021 New Vector Ltd
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@@ -39,7 +39,6 @@ protocol AuthenticationServiceDelegate: AnyObject {
|
||||
|
||||
@objcMembers
|
||||
class AuthenticationService: NSObject {
|
||||
|
||||
/// The shared service object.
|
||||
static let shared = AuthenticationService()
|
||||
|
||||
@@ -97,7 +96,7 @@ class AuthenticationService: NSObject {
|
||||
let hsUrl = universalLink.homeserverUrl
|
||||
let isUrl = universalLink.identityServerUrl
|
||||
|
||||
if hsUrl == nil && isUrl == nil {
|
||||
if hsUrl == nil, isUrl == nil {
|
||||
MXLog.debug("[AuthenticationService] handleServerProvisioningLink: no hsUrl or isUrl")
|
||||
return false
|
||||
}
|
||||
@@ -166,7 +165,7 @@ class AuthenticationService: NSObject {
|
||||
|
||||
// The state and client are set after trying the registration flow to
|
||||
// ensure the existing state isn't wiped out when an error occurs.
|
||||
self.state = AuthenticationState(flow: flow, homeserver: homeserver)
|
||||
state = AuthenticationState(flow: flow, homeserver: homeserver)
|
||||
self.client = client
|
||||
}
|
||||
|
||||
@@ -200,9 +199,9 @@ class AuthenticationService: NSObject {
|
||||
// completeness revert to the default homeserver if requested anyway.
|
||||
let address = useDefaultServer ? BuildSettings.serverConfigDefaultHomeserverUrlString : state.homeserver.addressFromUser ?? state.homeserver.address
|
||||
let identityServer = state.identityServer
|
||||
self.state = AuthenticationState(flow: .login,
|
||||
homeserverAddress: address,
|
||||
identityServer: identityServer)
|
||||
state = AuthenticationState(flow: .login,
|
||||
homeserverAddress: address,
|
||||
identityServer: identityServer)
|
||||
}
|
||||
|
||||
/// Continues an SSO flow when completion comes via a deep link.
|
||||
@@ -289,7 +288,7 @@ class AuthenticationService: NSObject {
|
||||
|
||||
let identityProviders = loginFlowResponse.flows?.compactMap { $0 as? MXLoginSSOFlow }.first?.identityProviders ?? []
|
||||
return LoginFlowResult(supportedLoginTypes: loginFlowResponse.flows?.compactMap { $0 } ?? [],
|
||||
ssoIdentityProviders: identityProviders.sorted { $0.name < $1.name }.map { $0.ssoIdentityProvider },
|
||||
ssoIdentityProviders: identityProviders.sorted { $0.name < $1.name }.map(\.ssoIdentityProvider),
|
||||
homeserverAddress: client.homeserver)
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
//
|
||||
//
|
||||
// Copyright 2022 New Vector Ltd
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@@ -29,7 +29,7 @@ struct AuthenticationState {
|
||||
|
||||
init(flow: AuthenticationFlow, homeserverAddress: String, identityServer: String? = nil) {
|
||||
self.flow = flow
|
||||
self.homeserver = Homeserver(address: homeserverAddress)
|
||||
homeserver = Homeserver(address: homeserverAddress)
|
||||
self.identityServer = identityServer
|
||||
}
|
||||
|
||||
@@ -72,7 +72,7 @@ struct AuthenticationState {
|
||||
|
||||
/// Needs authentication fallback for login
|
||||
var needsLoginFallback: Bool {
|
||||
return preferredLoginMode.isUnsupported
|
||||
preferredLoginMode.isUnsupported
|
||||
}
|
||||
|
||||
/// Needs authentication fallback for registration
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
//
|
||||
//
|
||||
// Copyright 2022 New Vector Ltd
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@@ -93,4 +93,3 @@ enum LoginMode {
|
||||
struct ResetPasswordData {
|
||||
let addThreePIDSessionID: String
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
//
|
||||
//
|
||||
// Copyright 2022 New Vector Ltd
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@@ -110,7 +110,7 @@ struct CheckResetPasswordParameters: DictionaryEncodable {
|
||||
}
|
||||
|
||||
init(clientSecret: String, sessionID: String, newPassword: String, signoutAllDevices: Bool) {
|
||||
self.auth = AuthenticationParameters.resetPasswordParameters(clientSecret: clientSecret, sessionID: sessionID)
|
||||
auth = AuthenticationParameters.resetPasswordParameters(clientSecret: clientSecret, sessionID: sessionID)
|
||||
self.newPassword = newPassword
|
||||
self.signoutAllDevices = signoutAllDevices
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
//
|
||||
//
|
||||
// Copyright 2022 New Vector Ltd
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@@ -40,7 +40,7 @@ class LoginWizard {
|
||||
self.client = client
|
||||
self.sessionCreator = sessionCreator
|
||||
|
||||
self.state = State()
|
||||
state = State()
|
||||
}
|
||||
|
||||
/// Login to the homeserver.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
//
|
||||
//
|
||||
// Copyright 2022 New Vector Ltd
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@@ -114,7 +114,7 @@ struct FlowResult {
|
||||
}
|
||||
|
||||
/// Whether fallback registration should be used due to unsupported stages.
|
||||
var needsFallback : Bool {
|
||||
var needsFallback: Bool {
|
||||
missingStages.filter(\.isMandatory).contains { stage in
|
||||
if case .other = stage { return true } else { return false }
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
//
|
||||
//
|
||||
// Copyright 2022 New Vector Ltd
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
|
||||
@@ -63,7 +63,7 @@ class RegistrationWizard {
|
||||
self.client = client
|
||||
self.sessionCreator = sessionCreator
|
||||
|
||||
self.state = State()
|
||||
state = State()
|
||||
}
|
||||
|
||||
/// Call this method to get the possible registration flow of the current homeserver.
|
||||
@@ -164,7 +164,7 @@ class RegistrationWizard {
|
||||
/// Send the code received by SMS to validate a msisdn.
|
||||
/// If the code is correct, the registration request will be executed to validate the msisdn.
|
||||
func handleValidateThreePID(code: String) async throws -> RegistrationResult {
|
||||
return try await validateThreePid(code: code)
|
||||
try await validateThreePid(code: code)
|
||||
}
|
||||
|
||||
/// Useful to poll the homeserver when waiting for the email to be validated by the user.
|
||||
@@ -197,7 +197,6 @@ class RegistrationWizard {
|
||||
throw RegistrationError.missingThreePIDURL
|
||||
}
|
||||
|
||||
|
||||
let validationBody = ThreePIDValidationCodeBody(clientSecret: state.clientSecret,
|
||||
sessionID: threePIDData.registrationResponse.sessionID,
|
||||
code: code)
|
||||
@@ -278,7 +277,7 @@ class RegistrationWizard {
|
||||
/// Checks for a dummy stage and handles it automatically when possible.
|
||||
private func handleDummyStage(flowResult: FlowResult) async throws -> RegistrationResult {
|
||||
// If the dummy stage is mandatory, do the dummy stage now
|
||||
guard flowResult.missingStages.contains(where: { $0.isDummy }) else { return .flowResponse(flowResult) }
|
||||
guard flowResult.missingStages.contains(where: \.isDummy) else { return .flowResponse(flowResult) }
|
||||
return try await dummy()
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
//
|
||||
//
|
||||
// Copyright 2022 New Vector Ltd
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@@ -29,7 +29,6 @@ protocol SessionCreatorProtocol {
|
||||
|
||||
/// A struct that provides common functionality to create a new session.
|
||||
struct SessionCreator: SessionCreatorProtocol {
|
||||
|
||||
private let accountManager: MXKAccountManager
|
||||
|
||||
init(withAccountManager accountManager: MXKAccountManager = .shared()) {
|
||||
@@ -44,7 +43,7 @@ struct SessionCreator: SessionCreatorProtocol {
|
||||
}
|
||||
|
||||
if removeOtherAccounts {
|
||||
let otherAccounts = accountManager.accounts.filter({ $0.mxCredentials.userId != credentials.userId })
|
||||
let otherAccounts = accountManager.accounts.filter { $0.mxCredentials.userId != credentials.userId }
|
||||
for account in otherAccounts {
|
||||
accountManager.removeAccount(account, completion: nil)
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
//
|
||||
//
|
||||
// Copyright 2022 New Vector Ltd
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@@ -53,13 +53,13 @@ struct RegistrationThreePIDTokenResponse {
|
||||
///
|
||||
/// If this field is not present, the client can assume that verification will happen without the client's involvement provided
|
||||
/// the homeserver advertises this specification version in the /versions response (ie: r0.5.0).
|
||||
var submitURL: String? = nil
|
||||
var submitURL: String?
|
||||
|
||||
// MARK: - Additional data that may be needed
|
||||
|
||||
var msisdn: String? = nil
|
||||
var formattedMSISDN: String? = nil
|
||||
var success: Bool? = nil
|
||||
var msisdn: String?
|
||||
var formattedMSISDN: String?
|
||||
var success: Bool?
|
||||
|
||||
enum CodingKeys: String, CodingKey {
|
||||
case sessionID = "sid"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
//
|
||||
//
|
||||
// Copyright 2021 New Vector Ltd
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
|
||||
@@ -17,10 +17,9 @@
|
||||
import SwiftUI
|
||||
|
||||
typealias AuthenticationForgotPasswordViewModelType = StateStoreViewModel<AuthenticationForgotPasswordViewState,
|
||||
Never,
|
||||
AuthenticationForgotPasswordViewAction>
|
||||
Never,
|
||||
AuthenticationForgotPasswordViewAction>
|
||||
class AuthenticationForgotPasswordViewModel: AuthenticationForgotPasswordViewModelType, AuthenticationForgotPasswordViewModelProtocol {
|
||||
|
||||
// MARK: - Properties
|
||||
|
||||
// MARK: Private
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
//
|
||||
//
|
||||
// Copyright 2021 New Vector Ltd
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@@ -17,7 +17,6 @@
|
||||
import Foundation
|
||||
|
||||
protocol AuthenticationForgotPasswordViewModelProtocol {
|
||||
|
||||
var callback: (@MainActor (AuthenticationForgotPasswordViewModelResult) -> Void)? { get set }
|
||||
var context: AuthenticationForgotPasswordViewModelType.Context { get }
|
||||
|
||||
|
||||
@@ -14,8 +14,8 @@
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
import CommonKit
|
||||
import SwiftUI
|
||||
|
||||
struct AuthenticationForgotPasswordCoordinatorParameters {
|
||||
let navigationRouter: NavigationRouterType
|
||||
@@ -32,7 +32,6 @@ enum AuthenticationForgotPasswordCoordinatorResult {
|
||||
}
|
||||
|
||||
final class AuthenticationForgotPasswordCoordinator: Coordinator, Presentable {
|
||||
|
||||
// MARK: - Properties
|
||||
|
||||
// MARK: Private
|
||||
@@ -83,7 +82,7 @@ final class AuthenticationForgotPasswordCoordinator: Coordinator, Presentable {
|
||||
}
|
||||
|
||||
func toPresentable() -> UIViewController {
|
||||
return self.authenticationForgotPasswordHostingController
|
||||
authenticationForgotPasswordHostingController
|
||||
}
|
||||
|
||||
// MARK: - Private
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
//
|
||||
//
|
||||
// Copyright 2021 New Vector Ltd
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@@ -33,7 +33,7 @@ enum MockAuthenticationForgotPasswordScreenState: MockScreenState, CaseIterable
|
||||
}
|
||||
|
||||
/// Generate the view struct for the screen state.
|
||||
var screenView: ([Any], AnyView) {
|
||||
var screenView: ([Any], AnyView) {
|
||||
let viewModel: AuthenticationForgotPasswordViewModel
|
||||
switch self {
|
||||
case .emptyAddress:
|
||||
|
||||
@@ -14,8 +14,8 @@
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
import XCTest
|
||||
import RiotSwiftUI
|
||||
import XCTest
|
||||
|
||||
class AuthenticationForgotPasswordUITests: MockScreenTestCase {
|
||||
func testEmptyAddress() {
|
||||
@@ -98,5 +98,4 @@ class AuthenticationForgotPasswordUITests: MockScreenTestCase {
|
||||
XCTAssertTrue(backButton.exists, "Back button should be shown.")
|
||||
XCTAssertEqual(backButton.label, "Back")
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
//
|
||||
//
|
||||
// Copyright 2021 New Vector Ltd
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@@ -19,7 +19,6 @@ import XCTest
|
||||
@testable import RiotSwiftUI
|
||||
|
||||
class AuthenticationForgotPasswordViewModelTests: XCTestCase {
|
||||
|
||||
var viewModel: AuthenticationForgotPasswordViewModelProtocol!
|
||||
var context: AuthenticationForgotPasswordViewModelType.Context!
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
//
|
||||
//
|
||||
// Copyright 2022 New Vector Ltd
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@@ -18,7 +18,6 @@ import SwiftUI
|
||||
|
||||
/// The form shown to enter an email address.
|
||||
struct AuthenticationForgotPasswordForm: View {
|
||||
|
||||
// MARK: - Properties
|
||||
|
||||
// MARK: Private
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
//
|
||||
//
|
||||
// Copyright 2021 New Vector Ltd
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@@ -17,7 +17,6 @@
|
||||
import SwiftUI
|
||||
|
||||
struct AuthenticationForgotPasswordScreen: View {
|
||||
|
||||
// MARK: - Properties
|
||||
|
||||
// MARK: Private
|
||||
|
||||
@@ -57,7 +57,7 @@ struct AuthenticationLoginViewState: BindableState {
|
||||
/// Data about the selected homeserver.
|
||||
var homeserver: AuthenticationHomeserverViewData
|
||||
/// Whether a new homeserver is currently being loaded.
|
||||
var isLoading: Bool = false
|
||||
var isLoading = false
|
||||
/// View state that can be bound to from SwiftUI.
|
||||
var bindings: AuthenticationLoginBindings
|
||||
|
||||
|
||||
@@ -17,11 +17,10 @@
|
||||
import SwiftUI
|
||||
|
||||
typealias AuthenticationLoginViewModelType = StateStoreViewModel<AuthenticationLoginViewState,
|
||||
Never,
|
||||
AuthenticationLoginViewAction>
|
||||
Never,
|
||||
AuthenticationLoginViewAction>
|
||||
|
||||
class AuthenticationLoginViewModel: AuthenticationLoginViewModelType, AuthenticationLoginViewModelProtocol {
|
||||
|
||||
// MARK: - Properties
|
||||
|
||||
// MARK: Public
|
||||
@@ -52,7 +51,7 @@ class AuthenticationLoginViewModel: AuthenticationLoginViewModelType, Authentica
|
||||
case .fallback:
|
||||
Task { await callback?(.fallback) }
|
||||
case .continueWithSSO(let provider):
|
||||
Task { await callback?(.continueWithSSO(provider))}
|
||||
Task { await callback?(.continueWithSSO(provider)) }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
//
|
||||
//
|
||||
// Copyright 2021 New Vector Ltd
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@@ -17,7 +17,6 @@
|
||||
import Foundation
|
||||
|
||||
protocol AuthenticationLoginViewModelProtocol {
|
||||
|
||||
var callback: (@MainActor (AuthenticationLoginViewModelResult) -> Void)? { get set }
|
||||
var context: AuthenticationLoginViewModelType.Context { get }
|
||||
|
||||
|
||||
@@ -14,9 +14,9 @@
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
import CommonKit
|
||||
import MatrixSDK
|
||||
import SwiftUI
|
||||
|
||||
struct AuthenticationLoginCoordinatorParameters {
|
||||
let navigationRouter: NavigationRouterType
|
||||
@@ -47,7 +47,6 @@ enum AuthenticationLoginCoordinatorResult: CustomStringConvertible {
|
||||
}
|
||||
|
||||
final class AuthenticationLoginCoordinator: Coordinator, Presentable {
|
||||
|
||||
// MARK: - Properties
|
||||
|
||||
// MARK: Private
|
||||
@@ -96,6 +95,7 @@ final class AuthenticationLoginCoordinator: Coordinator, Presentable {
|
||||
}
|
||||
|
||||
// MARK: - Public
|
||||
|
||||
func start() {
|
||||
MXLog.debug("[AuthenticationLoginCoordinator] did start.")
|
||||
Task { await setupViewModel() }
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
//
|
||||
//
|
||||
// Copyright 2021 New Vector Ltd
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@@ -35,7 +35,7 @@ enum MockAuthenticationLoginScreenState: MockScreenState, CaseIterable {
|
||||
}
|
||||
|
||||
/// Generate the view struct for the screen state.
|
||||
var screenView: ([Any], AnyView) {
|
||||
var screenView: ([Any], AnyView) {
|
||||
let viewModel: AuthenticationLoginViewModel
|
||||
switch self {
|
||||
case .matrixDotOrg:
|
||||
@@ -52,7 +52,6 @@ enum MockAuthenticationLoginScreenState: MockScreenState, CaseIterable {
|
||||
viewModel = AuthenticationLoginViewModel(homeserver: .mockFallback)
|
||||
}
|
||||
|
||||
|
||||
// can simulate service and viewModel actions here if needs be.
|
||||
|
||||
return (
|
||||
|
||||
@@ -14,8 +14,8 @@
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
import XCTest
|
||||
import RiotSwiftUI
|
||||
import XCTest
|
||||
|
||||
class AuthenticationLoginUITests: MockScreenTestCase {
|
||||
func testMatrixDotOrg() {
|
||||
@@ -120,5 +120,4 @@ class AuthenticationLoginUITests: MockScreenTestCase {
|
||||
XCTAssertTrue(fallbackButton.exists, "The fallback button should be shown for \(state).")
|
||||
XCTAssertTrue(fallbackButton.isEnabled, "The fallback button should be enabled for \(state).")
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
//
|
||||
//
|
||||
// Copyright 2021 New Vector Ltd
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
import SwiftUI
|
||||
|
||||
struct AuthenticationLoginScreen: View {
|
||||
|
||||
// MARK: - Properties
|
||||
|
||||
// MARK: Private
|
||||
@@ -52,7 +51,7 @@ struct AuthenticationLoginScreen: View {
|
||||
loginForm
|
||||
}
|
||||
|
||||
if viewModel.viewState.homeserver.showLoginForm && viewModel.viewState.showSSOButtons {
|
||||
if viewModel.viewState.homeserver.showLoginForm, viewModel.viewState.showSSOButtons {
|
||||
Text(VectorL10n.or)
|
||||
.foregroundColor(theme.colors.secondaryContent)
|
||||
.padding(.top, 16)
|
||||
@@ -63,10 +62,9 @@ struct AuthenticationLoginScreen: View {
|
||||
.padding(.top, 16)
|
||||
}
|
||||
|
||||
if !viewModel.viewState.homeserver.showLoginForm && !viewModel.viewState.showSSOButtons {
|
||||
if !viewModel.viewState.homeserver.showLoginForm, !viewModel.viewState.showSSOButtons {
|
||||
fallbackButton
|
||||
}
|
||||
|
||||
}
|
||||
.readableFrame()
|
||||
.padding(.horizontal, 16)
|
||||
@@ -104,8 +102,8 @@ struct AuthenticationLoginScreen: View {
|
||||
autocorrectionType: .no),
|
||||
onEditingChanged: usernameEditingChanged,
|
||||
onCommit: { isPasswordFocused = true })
|
||||
.accessibilityIdentifier("usernameTextField")
|
||||
.padding(.bottom, 7)
|
||||
.accessibilityIdentifier("usernameTextField")
|
||||
.padding(.bottom, 7)
|
||||
|
||||
RoundedBorderTextField(placeHolder: VectorL10n.authPasswordPlaceholder,
|
||||
text: $viewModel.password,
|
||||
@@ -114,7 +112,7 @@ struct AuthenticationLoginScreen: View {
|
||||
isSecureTextEntry: true),
|
||||
onEditingChanged: passwordEditingChanged,
|
||||
onCommit: submit)
|
||||
.accessibilityIdentifier("passwordTextField")
|
||||
.accessibilityIdentifier("passwordTextField")
|
||||
|
||||
Button { viewModel.send(viewAction: .forgotPassword) } label: {
|
||||
Text(VectorL10n.authenticationLoginForgotPassword)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
//
|
||||
//
|
||||
// Copyright 2021 New Vector Ltd
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
|
||||
@@ -17,11 +17,10 @@
|
||||
import SwiftUI
|
||||
|
||||
typealias AuthenticationReCaptchaViewModelType = StateStoreViewModel<AuthenticationReCaptchaViewState,
|
||||
Never,
|
||||
AuthenticationReCaptchaViewAction>
|
||||
Never,
|
||||
AuthenticationReCaptchaViewAction>
|
||||
|
||||
class AuthenticationReCaptchaViewModel: AuthenticationReCaptchaViewModelType, AuthenticationReCaptchaViewModelProtocol {
|
||||
|
||||
// MARK: - Properties
|
||||
|
||||
// MARK: Private
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
//
|
||||
//
|
||||
// Copyright 2021 New Vector Ltd
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@@ -17,7 +17,6 @@
|
||||
import Foundation
|
||||
|
||||
protocol AuthenticationReCaptchaViewModelProtocol {
|
||||
|
||||
var callback: (@MainActor (AuthenticationReCaptchaViewModelResult) -> Void)? { get set }
|
||||
var context: AuthenticationReCaptchaViewModelType.Context { get }
|
||||
|
||||
|
||||
@@ -14,8 +14,8 @@
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
import CommonKit
|
||||
import SwiftUI
|
||||
|
||||
struct AuthenticationReCaptchaCoordinatorParameters {
|
||||
let registrationWizard: RegistrationWizard
|
||||
@@ -26,7 +26,6 @@ struct AuthenticationReCaptchaCoordinatorParameters {
|
||||
}
|
||||
|
||||
final class AuthenticationReCaptchaCoordinator: Coordinator, Presentable {
|
||||
|
||||
// MARK: - Properties
|
||||
|
||||
// MARK: Private
|
||||
@@ -76,7 +75,7 @@ final class AuthenticationReCaptchaCoordinator: Coordinator, Presentable {
|
||||
}
|
||||
|
||||
func toPresentable() -> UIViewController {
|
||||
return self.authenticationReCaptchaHostingController
|
||||
authenticationReCaptchaHostingController
|
||||
}
|
||||
|
||||
// MARK: - Private
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
//
|
||||
//
|
||||
// Copyright 2021 New Vector Ltd
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@@ -31,7 +31,7 @@ enum MockAuthenticationReCaptchaScreenState: MockScreenState, CaseIterable {
|
||||
}
|
||||
|
||||
/// Generate the view struct for the screen state.
|
||||
var screenView: ([Any], AnyView) {
|
||||
var screenView: ([Any], AnyView) {
|
||||
let viewModel: AuthenticationReCaptchaViewModel
|
||||
switch self {
|
||||
case .standard:
|
||||
|
||||
@@ -14,8 +14,8 @@
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
import XCTest
|
||||
import RiotSwiftUI
|
||||
import XCTest
|
||||
|
||||
class AuthenticationReCaptchaUITests: MockScreenTestCase {
|
||||
// Nothing to test as the view only has a single state.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
//
|
||||
//
|
||||
// Copyright 2021 New Vector Ltd
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
//
|
||||
//
|
||||
// Copyright 2021 New Vector Ltd
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@@ -17,7 +17,6 @@
|
||||
import SwiftUI
|
||||
|
||||
struct AuthenticationReCaptchaScreen: View {
|
||||
|
||||
// MARK: - Properties
|
||||
|
||||
// MARK: Private
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
//
|
||||
//
|
||||
// Copyright 2022 New Vector Ltd
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@@ -18,7 +18,6 @@ import SwiftUI
|
||||
import WebKit
|
||||
|
||||
struct AuthenticationRecaptchaWebView: UIViewRepresentable {
|
||||
|
||||
// MARK: - Properties
|
||||
|
||||
// MARK: Public
|
||||
@@ -84,7 +83,7 @@ struct AuthenticationRecaptchaWebView: UIViewRepresentable {
|
||||
var completion: ((String) -> Void)?
|
||||
|
||||
init(isLoading: Binding<Bool>) {
|
||||
self._isLoading = isLoading
|
||||
_isLoading = isLoading
|
||||
}
|
||||
|
||||
/// Generates the HTML page to show for the given `siteKey` and `theme`.
|
||||
@@ -134,4 +133,3 @@ struct AuthenticationRecaptchaWebView: UIViewRepresentable {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
//
|
||||
//
|
||||
// Copyright 2021 New Vector Ltd
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@@ -62,7 +62,7 @@ struct AuthenticationRegistrationViewState: BindableState {
|
||||
/// Data about the selected homeserver.
|
||||
var homeserver: AuthenticationHomeserverViewData
|
||||
/// Whether a new homeserver is currently being loaded.
|
||||
var isLoading: Bool = false
|
||||
var isLoading = false
|
||||
/// View state that can be bound to from SwiftUI.
|
||||
var bindings: AuthenticationRegistrationBindings
|
||||
/// Whether or not the username field has been edited yet.
|
||||
|
||||
@@ -14,15 +14,14 @@
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
import Combine
|
||||
import SwiftUI
|
||||
|
||||
typealias AuthenticationRegistrationViewModelType = StateStoreViewModel<AuthenticationRegistrationViewState,
|
||||
Never,
|
||||
AuthenticationRegistrationViewAction>
|
||||
Never,
|
||||
AuthenticationRegistrationViewAction>
|
||||
|
||||
class AuthenticationRegistrationViewModel: AuthenticationRegistrationViewModelType, AuthenticationRegistrationViewModelProtocol {
|
||||
|
||||
// MARK: - Properties
|
||||
|
||||
// MARK: Public
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
//
|
||||
//
|
||||
// Copyright 2021 New Vector Ltd
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@@ -17,7 +17,6 @@
|
||||
import Foundation
|
||||
|
||||
protocol AuthenticationRegistrationViewModelProtocol {
|
||||
|
||||
var callback: (@MainActor (AuthenticationRegistrationViewModelResult) -> Void)? { get set }
|
||||
var context: AuthenticationRegistrationViewModelType.Context { get }
|
||||
|
||||
|
||||
@@ -14,9 +14,9 @@
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
import CommonKit
|
||||
import MatrixSDK
|
||||
import SwiftUI
|
||||
|
||||
struct AuthenticationRegistrationCoordinatorParameters {
|
||||
let navigationRouter: NavigationRouterType
|
||||
@@ -49,7 +49,6 @@ enum AuthenticationRegistrationCoordinatorResult: CustomStringConvertible {
|
||||
}
|
||||
|
||||
final class AuthenticationRegistrationCoordinator: Coordinator, Presentable {
|
||||
|
||||
// MARK: - Properties
|
||||
|
||||
// MARK: Private
|
||||
@@ -97,13 +96,14 @@ final class AuthenticationRegistrationCoordinator: Coordinator, Presentable {
|
||||
}
|
||||
|
||||
// MARK: - Public
|
||||
|
||||
func start() {
|
||||
MXLog.debug("[AuthenticationRegistrationCoordinator] did start.")
|
||||
Task { await setupViewModel() }
|
||||
}
|
||||
|
||||
func toPresentable() -> UIViewController {
|
||||
return self.authenticationRegistrationHostingController
|
||||
authenticationRegistrationHostingController
|
||||
}
|
||||
|
||||
// MARK: - Private
|
||||
@@ -117,7 +117,7 @@ final class AuthenticationRegistrationCoordinator: Coordinator, Presentable {
|
||||
switch result {
|
||||
case .selectServer:
|
||||
self.presentServerSelectionScreen()
|
||||
case.validateUsername(let username):
|
||||
case .validateUsername(let username):
|
||||
self.validateUsername(username)
|
||||
case .createAccount(let username, let password):
|
||||
self.createAccount(username: username, password: password)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
//
|
||||
//
|
||||
// Copyright 2021 New Vector Ltd
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@@ -36,7 +36,7 @@ enum MockAuthenticationRegistrationScreenState: MockScreenState, CaseIterable {
|
||||
}
|
||||
|
||||
/// Generate the view struct for the screen state.
|
||||
var screenView: ([Any], AnyView) {
|
||||
var screenView: ([Any], AnyView) {
|
||||
let viewModel: AuthenticationRegistrationViewModel
|
||||
switch self {
|
||||
case .matrixDotOrg:
|
||||
@@ -58,7 +58,6 @@ enum MockAuthenticationRegistrationScreenState: MockScreenState, CaseIterable {
|
||||
viewModel = AuthenticationRegistrationViewModel(homeserver: .mockFallback)
|
||||
}
|
||||
|
||||
|
||||
// can simulate service and viewModel actions here if needs be.
|
||||
|
||||
return (
|
||||
|
||||
@@ -14,8 +14,8 @@
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
import XCTest
|
||||
import RiotSwiftUI
|
||||
import XCTest
|
||||
|
||||
class AuthenticationRegistrationUITests: MockScreenTestCase {
|
||||
func testMatrixDotOrg() {
|
||||
@@ -88,7 +88,6 @@ class AuthenticationRegistrationUITests: MockScreenTestCase {
|
||||
validateFallbackButtonIsShown(for: state)
|
||||
}
|
||||
|
||||
|
||||
/// Checks that the username and password text fields are shown along with the next button.
|
||||
func validateRegistrationFormIsVisible(for state: String) {
|
||||
let usernameTextField = app.textFields.element
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
//
|
||||
//
|
||||
// Copyright 2021 New Vector Ltd
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@@ -14,8 +14,8 @@
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
import XCTest
|
||||
import Combine
|
||||
import XCTest
|
||||
|
||||
@testable import RiotSwiftUI
|
||||
|
||||
@@ -110,7 +110,7 @@ import Combine
|
||||
XCTAssertEqual(context.viewState.usernameFooterMessage, VectorL10n.authenticationRegistrationUsernameFooterAvailable("@bob:matrix.org"),
|
||||
"The footer message should display that the username is available.")
|
||||
XCTAssertFalse(context.viewState.isUsernameInvalid,
|
||||
"The username should continue to be valid when it is available.")
|
||||
"The username should continue to be valid when it is available.")
|
||||
|
||||
// When clearing the error.
|
||||
context.send(viewAction: .resetUsernameAvailability)
|
||||
@@ -190,7 +190,7 @@ import Combine
|
||||
|
||||
// Then the username should be valid but the credentials should still be invalid.
|
||||
XCTAssertTrue(context.viewState.isPasswordInvalid, "An empty password should be invalid.")
|
||||
XCTAssertFalse(context.viewState.isUsernameInvalid, "The username should be valid when unverified.")
|
||||
XCTAssertFalse(context.viewState.isUsernameInvalid, "The username should be valid when unverified.")
|
||||
XCTAssertFalse(context.viewState.hasValidCredentials, "The credentials should be invalid.")
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
//
|
||||
//
|
||||
// Copyright 2021 New Vector Ltd
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@@ -17,7 +17,6 @@
|
||||
import SwiftUI
|
||||
|
||||
struct AuthenticationRegistrationScreen: View {
|
||||
|
||||
// MARK: - Properties
|
||||
|
||||
// MARK: Private
|
||||
@@ -50,7 +49,7 @@ struct AuthenticationRegistrationScreen: View {
|
||||
registrationForm
|
||||
}
|
||||
|
||||
if viewModel.viewState.homeserver.showRegistrationForm && viewModel.viewState.showSSOButtons {
|
||||
if viewModel.viewState.homeserver.showRegistrationForm, viewModel.viewState.showSSOButtons {
|
||||
Text(VectorL10n.or)
|
||||
.foregroundColor(theme.colors.secondaryContent)
|
||||
.padding(.top, 16)
|
||||
@@ -61,10 +60,9 @@ struct AuthenticationRegistrationScreen: View {
|
||||
.padding(.top, 16)
|
||||
}
|
||||
|
||||
if !viewModel.viewState.homeserver.showRegistrationForm && !viewModel.viewState.showSSOButtons {
|
||||
if !viewModel.viewState.homeserver.showRegistrationForm, !viewModel.viewState.showSSOButtons {
|
||||
fallbackButton
|
||||
}
|
||||
|
||||
}
|
||||
.readableFrame()
|
||||
.padding(.horizontal, 16)
|
||||
@@ -110,8 +108,8 @@ struct AuthenticationRegistrationScreen: View {
|
||||
autocorrectionType: .no),
|
||||
onEditingChanged: usernameEditingChanged,
|
||||
onCommit: { isPasswordFocused = true })
|
||||
.onChange(of: viewModel.username) { _ in viewModel.send(viewAction: .resetUsernameAvailability) }
|
||||
.accessibilityIdentifier("usernameTextField")
|
||||
.onChange(of: viewModel.username) { _ in viewModel.send(viewAction: .resetUsernameAvailability) }
|
||||
.accessibilityIdentifier("usernameTextField")
|
||||
|
||||
RoundedBorderTextField(title: nil,
|
||||
placeHolder: VectorL10n.authPasswordPlaceholder,
|
||||
@@ -123,7 +121,7 @@ struct AuthenticationRegistrationScreen: View {
|
||||
isSecureTextEntry: true),
|
||||
onEditingChanged: passwordEditingChanged,
|
||||
onCommit: submit)
|
||||
.accessibilityIdentifier("passwordTextField")
|
||||
.accessibilityIdentifier("passwordTextField")
|
||||
|
||||
Button(action: submit) {
|
||||
Text(VectorL10n.next)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
//
|
||||
//
|
||||
// Copyright 2021 New Vector Ltd
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
|
||||
@@ -17,11 +17,10 @@
|
||||
import SwiftUI
|
||||
|
||||
typealias AuthenticationServerSelectionViewModelType = StateStoreViewModel<AuthenticationServerSelectionViewState,
|
||||
Never,
|
||||
AuthenticationServerSelectionViewAction>
|
||||
Never,
|
||||
AuthenticationServerSelectionViewAction>
|
||||
|
||||
class AuthenticationServerSelectionViewModel: AuthenticationServerSelectionViewModelType, AuthenticationServerSelectionViewModelProtocol {
|
||||
|
||||
// MARK: - Properties
|
||||
|
||||
// MARK: Private
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
//
|
||||
//
|
||||
// Copyright 2021 New Vector Ltd
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@@ -17,7 +17,6 @@
|
||||
import Foundation
|
||||
|
||||
protocol AuthenticationServerSelectionViewModelProtocol {
|
||||
|
||||
var callback: (@MainActor (AuthenticationServerSelectionViewModelResult) -> Void)? { get set }
|
||||
var context: AuthenticationServerSelectionViewModelType.Context { get }
|
||||
|
||||
|
||||
@@ -14,8 +14,8 @@
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
import CommonKit
|
||||
import SwiftUI
|
||||
|
||||
struct AuthenticationServerSelectionCoordinatorParameters {
|
||||
let authenticationService: AuthenticationService
|
||||
@@ -31,7 +31,6 @@ enum AuthenticationServerSelectionCoordinatorResult {
|
||||
}
|
||||
|
||||
final class AuthenticationServerSelectionCoordinator: Coordinator, Presentable {
|
||||
|
||||
// MARK: - Properties
|
||||
|
||||
// MARK: Private
|
||||
@@ -78,7 +77,7 @@ final class AuthenticationServerSelectionCoordinator: Coordinator, Presentable {
|
||||
}
|
||||
|
||||
func toPresentable() -> UIViewController {
|
||||
return self.authenticationServerSelectionHostingController
|
||||
authenticationServerSelectionHostingController
|
||||
}
|
||||
|
||||
// MARK: - Private
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
//
|
||||
//
|
||||
// Copyright 2021 New Vector Ltd
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@@ -35,7 +35,7 @@ enum MockAuthenticationServerSelectionScreenState: MockScreenState, CaseIterable
|
||||
}
|
||||
|
||||
/// Generate the view struct for the screen state.
|
||||
var screenView: ([Any], AnyView) {
|
||||
var screenView: ([Any], AnyView) {
|
||||
let viewModel: AuthenticationServerSelectionViewModel
|
||||
switch self {
|
||||
case .matrix:
|
||||
|
||||
@@ -14,8 +14,8 @@
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
import XCTest
|
||||
import RiotSwiftUI
|
||||
import XCTest
|
||||
|
||||
class AuthenticationServerSelectionUITests: MockScreenTestCase {
|
||||
func testRegisterState() {
|
||||
@@ -41,7 +41,6 @@ class AuthenticationServerSelectionUITests: MockScreenTestCase {
|
||||
XCTAssertTrue(dismissButton.exists, "The dismiss button should be shown during modal presentation.")
|
||||
}
|
||||
|
||||
|
||||
func testLoginState() {
|
||||
app.goToScreenWithIdentifier(MockAuthenticationServerSelectionScreenState.login.title)
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
//
|
||||
//
|
||||
// Copyright 2021 New Vector Ltd
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
//
|
||||
//
|
||||
// Copyright 2021 New Vector Ltd
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@@ -17,7 +17,6 @@
|
||||
import SwiftUI
|
||||
|
||||
struct AuthenticationServerSelectionScreen: View {
|
||||
|
||||
// MARK: - Properties
|
||||
|
||||
// MARK: Private
|
||||
@@ -37,7 +36,7 @@ struct AuthenticationServerSelectionScreen: View {
|
||||
// MARK: Views
|
||||
|
||||
var body: some View {
|
||||
GeometryReader { geometry in
|
||||
GeometryReader { _ in
|
||||
ScrollView {
|
||||
VStack(spacing: 0) {
|
||||
header
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
//
|
||||
//
|
||||
// Copyright 2021 New Vector Ltd
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@@ -17,6 +17,7 @@
|
||||
import SwiftUI
|
||||
|
||||
// MARK: Data
|
||||
|
||||
struct SoftLogoutCredentials {
|
||||
let userId: String
|
||||
let homeserverName: String
|
||||
|
||||
@@ -17,10 +17,9 @@
|
||||
import SwiftUI
|
||||
|
||||
typealias AuthenticationSoftLogoutViewModelType = StateStoreViewModel<AuthenticationSoftLogoutViewState,
|
||||
Never,
|
||||
AuthenticationSoftLogoutViewAction>
|
||||
Never,
|
||||
AuthenticationSoftLogoutViewAction>
|
||||
class AuthenticationSoftLogoutViewModel: AuthenticationSoftLogoutViewModelType, AuthenticationSoftLogoutViewModelProtocol {
|
||||
|
||||
// MARK: - Properties
|
||||
|
||||
// MARK: Private
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
//
|
||||
//
|
||||
// Copyright 2021 New Vector Ltd
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@@ -17,7 +17,6 @@
|
||||
import Foundation
|
||||
|
||||
protocol AuthenticationSoftLogoutViewModelProtocol {
|
||||
|
||||
var callback: (@MainActor (AuthenticationSoftLogoutViewModelResult) -> Void)? { get set }
|
||||
var context: AuthenticationSoftLogoutViewModelType.Context { get }
|
||||
|
||||
|
||||
@@ -14,8 +14,8 @@
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
import CommonKit
|
||||
import SwiftUI
|
||||
|
||||
struct AuthenticationSoftLogoutCoordinatorParameters {
|
||||
let navigationRouter: NavigationRouterType
|
||||
@@ -50,7 +50,6 @@ enum AuthenticationSoftLogoutCoordinatorResult: CustomStringConvertible {
|
||||
}
|
||||
|
||||
final class AuthenticationSoftLogoutCoordinator: Coordinator, Presentable {
|
||||
|
||||
// MARK: - Properties
|
||||
|
||||
// MARK: Private
|
||||
@@ -107,7 +106,7 @@ final class AuthenticationSoftLogoutCoordinator: Coordinator, Presentable {
|
||||
}
|
||||
|
||||
func toPresentable() -> UIViewController {
|
||||
return self.authenticationSoftLogoutHostingController
|
||||
authenticationSoftLogoutHostingController
|
||||
}
|
||||
|
||||
// MARK: - Private
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
//
|
||||
//
|
||||
// Copyright 2021 New Vector Ltd
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@@ -36,7 +36,7 @@ enum MockAuthenticationSoftLogoutScreenState: MockScreenState, CaseIterable {
|
||||
}
|
||||
|
||||
/// Generate the view struct for the screen state.
|
||||
var screenView: ([Any], AnyView) {
|
||||
var screenView: ([Any], AnyView) {
|
||||
let viewModel: AuthenticationSoftLogoutViewModel
|
||||
let credentials = SoftLogoutCredentials(userId: "@mock:matrix.org",
|
||||
homeserverName: "matrix.org",
|
||||
|
||||
@@ -14,8 +14,8 @@
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
import XCTest
|
||||
import RiotSwiftUI
|
||||
import XCTest
|
||||
|
||||
class AuthenticationSoftLogoutUITests: MockScreenTestCase {
|
||||
func testEmptyPassword() {
|
||||
@@ -185,5 +185,4 @@ class AuthenticationSoftLogoutUITests: MockScreenTestCase {
|
||||
|
||||
XCTAssertFalse(app.staticTexts["messageLabel2"].exists, "The message 2 should not be shown.")
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
//
|
||||
//
|
||||
// Copyright 2021 New Vector Ltd
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@@ -19,7 +19,6 @@ import XCTest
|
||||
@testable import RiotSwiftUI
|
||||
|
||||
class AuthenticationSoftLogoutViewModelTests: XCTestCase {
|
||||
|
||||
@MainActor func testInitialStateForMatrixOrg() async {
|
||||
let credentials = SoftLogoutCredentials(userId: "mock_user_id",
|
||||
homeserverName: "https://matrix.org",
|
||||
@@ -55,5 +54,4 @@ class AuthenticationSoftLogoutViewModelTests: XCTestCase {
|
||||
XCTAssert(context.viewState.showLoginForm, "The view model should show login form for the given homeserver.")
|
||||
XCTAssertFalse(context.viewState.showRecoverEncryptionKeysMessage, "The view model should not show recover encryption keys message.")
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
//
|
||||
//
|
||||
// Copyright 2021 New Vector Ltd
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@@ -17,7 +17,6 @@
|
||||
import SwiftUI
|
||||
|
||||
struct AuthenticationSoftLogoutScreen: View {
|
||||
|
||||
// MARK: - Properties
|
||||
|
||||
// MARK: Private
|
||||
@@ -153,7 +152,7 @@ struct AuthenticationSoftLogoutScreen: View {
|
||||
configuration: UIKitTextInputConfiguration(returnKeyType: .done,
|
||||
isSecureTextEntry: true),
|
||||
onCommit: login)
|
||||
.accessibilityIdentifier("passwordTextField")
|
||||
.accessibilityIdentifier("passwordTextField")
|
||||
}
|
||||
|
||||
/// A list of SSO buttons that can be used for login.
|
||||
@@ -188,7 +187,6 @@ struct AuthenticationSoftLogoutScreen: View {
|
||||
func clearData() {
|
||||
viewModel.send(viewAction: .clearAllData)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// MARK: - Previews
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
//
|
||||
//
|
||||
// Copyright 2021 New Vector Ltd
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@@ -27,7 +27,7 @@ struct AuthenticationTermsPolicy: Identifiable, Equatable {
|
||||
/// The policy's subtitle.
|
||||
let subtitle: String
|
||||
/// Whether or not the policy has been accepted.
|
||||
var accepted: Bool = false
|
||||
var accepted = false
|
||||
}
|
||||
|
||||
// MARK: View model
|
||||
|
||||
@@ -16,13 +16,11 @@
|
||||
|
||||
import SwiftUI
|
||||
|
||||
|
||||
typealias AuthenticationTermsViewModelType = StateStoreViewModel<AuthenticationTermsViewState,
|
||||
Never,
|
||||
AuthenticationTermsViewAction>
|
||||
Never,
|
||||
AuthenticationTermsViewAction>
|
||||
|
||||
class AuthenticationTermsViewModel: AuthenticationTermsViewModelType, AuthenticationTermsViewModelProtocol {
|
||||
|
||||
// MARK: - Properties
|
||||
|
||||
// MARK: Private
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
//
|
||||
//
|
||||
// Copyright 2021 New Vector Ltd
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@@ -17,7 +17,6 @@
|
||||
import Foundation
|
||||
|
||||
protocol AuthenticationTermsViewModelProtocol {
|
||||
|
||||
var callback: (@MainActor (AuthenticationTermsViewModelResult) -> Void)? { get set }
|
||||
var context: AuthenticationTermsViewModelType.Context { get }
|
||||
|
||||
|
||||
@@ -14,9 +14,9 @@
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
import CommonKit
|
||||
import SafariServices
|
||||
import SwiftUI
|
||||
|
||||
struct AuthenticationTermsCoordinatorParameters {
|
||||
let registrationWizard: RegistrationWizard
|
||||
@@ -27,7 +27,6 @@ struct AuthenticationTermsCoordinatorParameters {
|
||||
}
|
||||
|
||||
final class AuthenticationTermsCoordinator: Coordinator, Presentable {
|
||||
|
||||
// MARK: - Properties
|
||||
|
||||
// MARK: Private
|
||||
@@ -80,7 +79,7 @@ final class AuthenticationTermsCoordinator: Coordinator, Presentable {
|
||||
}
|
||||
|
||||
func toPresentable() -> UIViewController {
|
||||
return self.authenticationTermsHostingController
|
||||
authenticationTermsHostingController
|
||||
}
|
||||
|
||||
// MARK: - Private
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
//
|
||||
//
|
||||
// Copyright 2021 New Vector Ltd
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@@ -33,7 +33,7 @@ enum MockAuthenticationTermsScreenState: MockScreenState, CaseIterable {
|
||||
}
|
||||
|
||||
/// Generate the view struct for the screen state.
|
||||
var screenView: ([Any], AnyView) {
|
||||
var screenView: ([Any], AnyView) {
|
||||
let viewModel: AuthenticationTermsViewModel
|
||||
switch self {
|
||||
case .matrixDotOrg:
|
||||
|
||||
@@ -14,8 +14,8 @@
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
import XCTest
|
||||
import RiotSwiftUI
|
||||
import XCTest
|
||||
|
||||
class AuthenticationTermsUITests: MockScreenTestCase {
|
||||
func testMatrixDotOrg() {
|
||||
@@ -38,5 +38,4 @@ class AuthenticationTermsUITests: MockScreenTestCase {
|
||||
XCTAssertTrue(nextButton.exists, "The next button should always exist.")
|
||||
XCTAssertEqual(nextButton.isEnabled, accepted, "The next button should be enabled when the terms are accepted")
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
//
|
||||
//
|
||||
// Copyright 2021 New Vector Ltd
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
//
|
||||
//
|
||||
// Copyright 2022 New Vector Ltd
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@@ -17,7 +17,6 @@
|
||||
import SwiftUI
|
||||
|
||||
struct AuthenticationTermsListItem: View {
|
||||
|
||||
// MARK: - Properties
|
||||
|
||||
// MARK: Private
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
//
|
||||
//
|
||||
// Copyright 2021 New Vector Ltd
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@@ -17,7 +17,6 @@
|
||||
import SwiftUI
|
||||
|
||||
struct AuthenticationTermsScreen: View {
|
||||
|
||||
// MARK: - Properties
|
||||
|
||||
// MARK: Private
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
//
|
||||
//
|
||||
// Copyright 2022 New Vector Ltd
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
//
|
||||
//
|
||||
// Copyright 2021 New Vector Ltd
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
|
||||
@@ -17,10 +17,9 @@
|
||||
import SwiftUI
|
||||
|
||||
typealias AuthenticationVerifyEmailViewModelType = StateStoreViewModel<AuthenticationVerifyEmailViewState,
|
||||
Never,
|
||||
AuthenticationVerifyEmailViewAction>
|
||||
Never,
|
||||
AuthenticationVerifyEmailViewAction>
|
||||
class AuthenticationVerifyEmailViewModel: AuthenticationVerifyEmailViewModelType, AuthenticationVerifyEmailViewModelProtocol {
|
||||
|
||||
// MARK: - Properties
|
||||
|
||||
// MARK: Private
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
//
|
||||
//
|
||||
// Copyright 2021 New Vector Ltd
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@@ -17,7 +17,6 @@
|
||||
import Foundation
|
||||
|
||||
protocol AuthenticationVerifyEmailViewModelProtocol {
|
||||
|
||||
var callback: (@MainActor (AuthenticationVerifyEmailViewModelResult) -> Void)? { get set }
|
||||
var context: AuthenticationVerifyEmailViewModelType.Context { get }
|
||||
|
||||
|
||||
@@ -14,8 +14,8 @@
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
import SwiftUI
|
||||
import CommonKit
|
||||
import SwiftUI
|
||||
|
||||
struct AuthenticationVerifyEmailCoordinatorParameters {
|
||||
let registrationWizard: RegistrationWizard
|
||||
@@ -24,7 +24,6 @@ struct AuthenticationVerifyEmailCoordinatorParameters {
|
||||
}
|
||||
|
||||
final class AuthenticationVerifyEmailCoordinator: Coordinator, Presentable {
|
||||
|
||||
// MARK: - Properties
|
||||
|
||||
// MARK: Private
|
||||
@@ -74,7 +73,7 @@ final class AuthenticationVerifyEmailCoordinator: Coordinator, Presentable {
|
||||
}
|
||||
|
||||
func toPresentable() -> UIViewController {
|
||||
return self.authenticationVerifyEmailHostingController
|
||||
authenticationVerifyEmailHostingController
|
||||
}
|
||||
|
||||
// MARK: - Private
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
//
|
||||
//
|
||||
// Copyright 2021 New Vector Ltd
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@@ -33,7 +33,7 @@ enum MockAuthenticationVerifyEmailScreenState: MockScreenState, CaseIterable {
|
||||
}
|
||||
|
||||
/// Generate the view struct for the screen state.
|
||||
var screenView: ([Any], AnyView) {
|
||||
var screenView: ([Any], AnyView) {
|
||||
let viewModel: AuthenticationVerifyEmailViewModel
|
||||
switch self {
|
||||
case .emptyAddress:
|
||||
|
||||
@@ -14,8 +14,8 @@
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
import XCTest
|
||||
import RiotSwiftUI
|
||||
import XCTest
|
||||
|
||||
class AuthenticationVerifyEmailUITests: MockScreenTestCase {
|
||||
func testEmptyAddress() {
|
||||
@@ -78,5 +78,4 @@ class AuthenticationVerifyEmailUITests: MockScreenTestCase {
|
||||
XCTAssertTrue(backButton.exists, "Back button should be shown.")
|
||||
XCTAssertEqual(backButton.label, "Back")
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user