Configured and applied SwiftFormat

This commit is contained in:
Stefan Ceriu
2022-09-27 10:17:22 +03:00
committed by Stefan Ceriu
parent ff2e6ddfa7
commit 43c28d23b7
663 changed files with 2329 additions and 2840 deletions
@@ -1,4 +1,4 @@
//
//
// Copyright 2021 New Vector Ltd
//
// Licensed under the Apache License, Version 2.0 (the "License");
@@ -42,8 +42,8 @@ struct ChangePasswordViewState: BindableState {
/// Whether the user can submit the form: old password and new passwords should be entered
var canSubmit: Bool {
!bindings.oldPassword.isEmpty
&& !bindings.newPassword1.isEmpty
&& !bindings.newPassword2.isEmpty
&& !bindings.newPassword1.isEmpty
&& !bindings.newPassword2.isEmpty
}
}
@@ -17,10 +17,9 @@
import SwiftUI
typealias ChangePasswordViewModelType = StateStoreViewModel<ChangePasswordViewState,
Never,
ChangePasswordViewAction>
Never,
ChangePasswordViewAction>
class ChangePasswordViewModel: ChangePasswordViewModelType, ChangePasswordViewModelProtocol {
// 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 ChangePasswordViewModelProtocol {
var callback: (@MainActor (ChangePasswordViewModelResult) -> Void)? { get set }
var context: ChangePasswordViewModelType.Context { get }
@@ -30,7 +30,6 @@ import MatrixSDK
/// once the underlying Coordinator has been integrated by another Coordinator.
@objcMembers
final class ChangePasswordCoordinatorBridgePresenter: NSObject {
// MARK: - Constants
// MARK: - Properties
@@ -57,8 +56,7 @@ final class ChangePasswordCoordinatorBridgePresenter: NSObject {
// MARK: - Public
func present(from viewController: UIViewController, animated: Bool) {
let params = ChangePasswordCoordinatorParameters(restClient: self.session.matrixRestClient)
let params = ChangePasswordCoordinatorParameters(restClient: session.matrixRestClient)
let changePasswordCoordinator = ChangePasswordCoordinator(parameters: params)
changePasswordCoordinator.callback = { [weak self] in
@@ -74,11 +72,11 @@ final class ChangePasswordCoordinatorBridgePresenter: NSObject {
viewController.present(navController, animated: animated, completion: nil)
changePasswordCoordinator.start()
self.coordinator = changePasswordCoordinator
coordinator = changePasswordCoordinator
}
func dismiss(animated: Bool, completion: (() -> Void)?) {
guard let coordinator = self.coordinator else {
guard let coordinator = coordinator else {
return
}
@@ -14,15 +14,14 @@
// limitations under the License.
//
import SwiftUI
import CommonKit
import SwiftUI
struct ChangePasswordCoordinatorParameters {
let restClient: MXRestClient
}
final class ChangePasswordCoordinator: Coordinator, Presentable {
// MARK: - Properties
// MARK: Private
@@ -77,7 +76,7 @@ final class ChangePasswordCoordinator: Coordinator, Presentable {
}
func toPresentable() -> UIViewController {
return self.changePasswordHostingController
changePasswordHostingController
}
// 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 MockChangePasswordScreenState: MockScreenState, CaseIterable {
}
/// Generate the view struct for the screen state.
var screenView: ([Any], AnyView) {
var screenView: ([Any], AnyView) {
let viewModel: ChangePasswordViewModel
switch self {
case .allEmpty:
@@ -14,8 +14,8 @@
// limitations under the License.
//
import XCTest
import RiotSwiftUI
import XCTest
class ChangePasswordUITests: MockScreenTestCase {
func testAllEmpty() {
@@ -125,5 +125,4 @@ class ChangePasswordUITests: MockScreenTestCase {
XCTAssertTrue(signoutAllDevicesToggle.exists, "Sign out all devices toggle should exist")
XCTAssertTrue(signoutAllDevicesToggle.isOn, "Sign out all devices should be checked")
}
}
@@ -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 ChangePasswordViewModelTests: XCTestCase {
@MainActor func testEmptyState() async {
let viewModel = ChangePasswordViewModel()
let context = viewModel.context
@@ -46,5 +45,4 @@ class ChangePasswordViewModelTests: XCTestCase {
XCTAssertTrue(context.viewState.canSubmit, "The view model should be able to submit.")
XCTAssertTrue(context.signoutAllDevices, "Sign out of all devices should be checked.")
}
}
@@ -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 ChangePasswordScreen: View {
// MARK: - Properties
// MARK: Private
@@ -72,7 +71,7 @@ struct ChangePasswordScreen: View {
configuration: UIKitTextInputConfiguration(returnKeyType: .next,
isSecureTextEntry: true),
onCommit: { focusedField = .newPassword1 })
.accessibilityIdentifier("oldPasswordTextField")
.accessibilityIdentifier("oldPasswordTextField")
RoundedBorderTextField(placeHolder: VectorL10n.settingsNewPassword,
text: $viewModel.newPassword1,
@@ -80,7 +79,7 @@ struct ChangePasswordScreen: View {
configuration: UIKitTextInputConfiguration(returnKeyType: .next,
isSecureTextEntry: true),
onCommit: { focusedField = .newPassword2 })
.accessibilityIdentifier("newPasswordTextField1")
.accessibilityIdentifier("newPasswordTextField1")
RoundedBorderTextField(placeHolder: VectorL10n.settingsConfirmPassword,
text: $viewModel.newPassword2,
@@ -88,7 +87,7 @@ struct ChangePasswordScreen: View {
configuration: UIKitTextInputConfiguration(returnKeyType: .done,
isSecureTextEntry: true),
onCommit: submit)
.accessibilityIdentifier("newPasswordTextField2")
.accessibilityIdentifier("newPasswordTextField2")
HStack(alignment: .center, spacing: 8) {
Toggle(VectorL10n.authenticationChoosePasswordSignoutAllDevices, isOn: $viewModel.signoutAllDevices)