Remove iOS 13/14 checks from Template/Onboarding/Authentication.

This commit is contained in:
Doug 2022-05-10 11:23:42 +01:00 committed by Doug
parent 9646cbaa48
commit 9429bebb53
111 changed files with 44 additions and 213 deletions

View file

@ -18,7 +18,6 @@
import UIKit
@available(iOS 14.0, *)
struct AuthenticationCoordinatorParameters {
let navigationRouter: NavigationRouterType
/// The screen that should be shown when starting the flow.
@ -28,7 +27,6 @@ struct AuthenticationCoordinatorParameters {
}
/// A coordinator that handles authentication, verification and setting a PIN.
@available(iOS 14.0, *)
final class AuthenticationCoordinator: NSObject, AuthenticationCoordinatorProtocol {
enum EntryPoint {
@ -150,7 +148,6 @@ final class AuthenticationCoordinator: NSObject, AuthenticationCoordinatorProtoc
}
}
@available(iOS 14.0, *)
/// Shows the next screen in the flow after the server selection screen.
@MainActor private func serverSelectionCoordinator(_ coordinator: AuthenticationServerSelectionCoordinator,
didCompleteWith result: AuthenticationServerSelectionCoordinatorResult) {
@ -189,7 +186,6 @@ final class AuthenticationCoordinator: NSObject, AuthenticationCoordinatorProtoc
}
/// Displays the next view in the flow after the registration screen.
@available(iOS 14.0, *)
@MainActor private func registrationCoordinator(_ coordinator: AuthenticationRegistrationCoordinator,
didCompleteWith result: AuthenticationRegistrationCoordinatorResult) {
switch result {
@ -292,7 +288,6 @@ final class AuthenticationCoordinator: NSObject, AuthenticationCoordinatorProtoc
}
// MARK: - KeyVerificationCoordinatorDelegate
@available(iOS 14.0, *)
extension AuthenticationCoordinator: KeyVerificationCoordinatorDelegate {
func keyVerificationCoordinatorDidComplete(_ coordinator: KeyVerificationCoordinatorType, otherUserId: String, otherDeviceId: String) {
if let crypto = session?.crypto,
@ -314,7 +309,6 @@ extension AuthenticationCoordinator: KeyVerificationCoordinatorDelegate {
}
// MARK: - UIAdaptivePresentationControllerDelegate
@available(iOS 14.0, *)
extension AuthenticationCoordinator: UIAdaptivePresentationControllerDelegate {
func presentationControllerShouldDismiss(_ presentationController: UIPresentationController) -> Bool {
// Prevent Key Verification from using swipe to dismiss
@ -325,7 +319,6 @@ extension AuthenticationCoordinator: UIAdaptivePresentationControllerDelegate {
// MARK: - Unused conformances
@available(iOS 14.0, *)
extension AuthenticationCoordinator {
var customServerFieldsVisible: Bool {
get { false }

View file

@ -101,7 +101,7 @@ final class OnboardingCoordinator: NSObject, OnboardingCoordinatorProtocol {
func start() {
// TODO: Manage a separate flow for soft logout that just uses AuthenticationCoordinator
if #available(iOS 14.0, *), parameters.softLogoutCredentials == nil, BuildSettings.authScreenShowRegister {
if parameters.softLogoutCredentials == nil, BuildSettings.authScreenShowRegister {
showSplashScreen()
} else {
showLegacyAuthenticationScreen()
@ -134,7 +134,6 @@ final class OnboardingCoordinator: NSObject, OnboardingCoordinatorProtocol {
// MARK: - Pre-Authentication
@available(iOS 14.0, *)
/// Show the onboarding splash screen as the root module in the flow.
private func showSplashScreen() {
MXLog.debug("[OnboardingCoordinator] showSplashScreen")
@ -151,7 +150,6 @@ final class OnboardingCoordinator: NSObject, OnboardingCoordinatorProtocol {
navigationRouter.setRootModule(coordinator, popCompletion: nil)
}
@available(iOS 14.0, *)
/// Displays the next view in the flow after the splash screen.
private func splashScreenCoordinator(_ coordinator: OnboardingSplashScreenCoordinator, didCompleteWith result: OnboardingSplashScreenViewModelResult) {
splashScreenResult = result
@ -167,7 +165,6 @@ final class OnboardingCoordinator: NSObject, OnboardingCoordinatorProtocol {
}
}
@available(iOS 14.0, *)
/// Show the use case screen for new users.
private func showUseCaseSelectionScreen() {
MXLog.debug("[OnboardingCoordinator] showUseCaseSelectionScreen")
@ -191,7 +188,6 @@ final class OnboardingCoordinator: NSObject, OnboardingCoordinatorProtocol {
}
/// Displays the next view in the flow after the use case screen.
@available(iOS 14.0, *)
private func useCaseSelectionCoordinator(_ coordinator: OnboardingUseCaseSelectionCoordinator, didCompleteWith result: OnboardingUseCaseViewModelResult) {
useCaseResult = result
@ -210,7 +206,6 @@ final class OnboardingCoordinator: NSObject, OnboardingCoordinatorProtocol {
// MARK: - Authentication
/// Show the authentication flow, starting at the specified initial screen.
@available(iOS 14.0, *)
private func beginAuthentication(with initialScreen: AuthenticationCoordinator.EntryPoint) {
MXLog.debug("[OnboardingCoordinator] beginAuthentication")
@ -294,22 +289,20 @@ final class OnboardingCoordinator: NSObject, OnboardingCoordinatorProtocol {
self.authenticationType = authenticationType
// Check whether another screen should be shown.
if #available(iOS 14.0, *) {
if authenticationFlow == .register,
let userId = session.credentials.userId,
let userSession = UserSessionsService.shared.userSession(withUserId: userId) {
// If personalisation is to be shown, check that the homeserver supports it otherwise show the congratulations screen
if BuildSettings.onboardingShowAccountPersonalization {
checkHomeserverCapabilities(for: userSession)
return
} else {
showCongratulationsScreen(for: userSession)
return
}
} else if Analytics.shared.shouldShowAnalyticsPrompt {
showAnalyticsPrompt(for: session)
if authenticationFlow == .register,
let userId = session.credentials.userId,
let userSession = UserSessionsService.shared.userSession(withUserId: userId) {
// If personalisation is to be shown, check that the homeserver supports it otherwise show the congratulations screen
if BuildSettings.onboardingShowAccountPersonalization {
checkHomeserverCapabilities(for: userSession)
return
} else {
showCongratulationsScreen(for: userSession)
return
}
} else if Analytics.shared.shouldShowAnalyticsPrompt {
showAnalyticsPrompt(for: session)
return
}
// Otherwise onboarding is finished.
@ -321,7 +314,6 @@ final class OnboardingCoordinator: NSObject, OnboardingCoordinatorProtocol {
/// whether or not the display name and avatar can be updated.
///
/// Once complete this method will start the post authentication flow automatically.
@available(iOS 14.0, *)
private func checkHomeserverCapabilities(for userSession: UserSession) {
userSession.matrixSession.matrixRestClient.capabilities { [weak self] capabilities in
guard let self = self else { return }
@ -358,13 +350,11 @@ final class OnboardingCoordinator: NSObject, OnboardingCoordinatorProtocol {
// MARK: - Post-Authentication
/// Starts the part of the flow that comes after authentication for new users.
@available(iOS 14.0, *)
private func beginPostAuthentication(for userSession: UserSession) {
showCongratulationsScreen(for: userSession)
}
/// Show the congratulations screen for new users. The screen will be configured based on the homeserver's capabilities.
@available(iOS 14.0, *)
private func showCongratulationsScreen(for userSession: UserSession) {
MXLog.debug("[OnboardingCoordinator] showCongratulationsScreen")
@ -387,7 +377,6 @@ final class OnboardingCoordinator: NSObject, OnboardingCoordinatorProtocol {
}
/// Displays the next view in the flow after the congratulations screen.
@available(iOS 14.0, *)
private func congratulationsCoordinator(_ coordinator: OnboardingCongratulationsCoordinator, didCompleteWith result: OnboardingCongratulationsCoordinatorResult) {
switch result {
case .personalizeProfile(let userSession):
@ -413,7 +402,6 @@ final class OnboardingCoordinator: NSObject, OnboardingCoordinatorProtocol {
}
/// Show the display name personalization screen for new users using the supplied user session.
@available(iOS 14.0, *)
private func showDisplayNameScreen(for userSession: UserSession) {
MXLog.debug("[OnboardingCoordinator]: showDisplayNameScreen")
@ -434,7 +422,6 @@ final class OnboardingCoordinator: NSObject, OnboardingCoordinatorProtocol {
}
/// Displays the next view in the flow after the display name screen.
@available(iOS 14.0, *)
private func displayNameCoordinator(_ coordinator: OnboardingDisplayNameCoordinator, didCompleteWith userSession: UserSession) {
if shouldShowAvatarScreen {
showAvatarScreen(for: userSession)
@ -444,7 +431,6 @@ final class OnboardingCoordinator: NSObject, OnboardingCoordinatorProtocol {
}
/// Show the avatar personalization screen for new users using the supplied user session.
@available(iOS 14.0, *)
private func showAvatarScreen(for userSession: UserSession) {
MXLog.debug("[OnboardingCoordinator]: showAvatarScreen")
@ -479,7 +465,6 @@ final class OnboardingCoordinator: NSObject, OnboardingCoordinatorProtocol {
}
/// Displays the next view in the flow after the avatar screen.
@available(iOS 14.0, *)
private func avatarCoordinator(_ coordinator: OnboardingAvatarCoordinator, didCompleteWith userSession: UserSession) {
showCelebrationScreen(for: userSession)
@ -487,7 +472,6 @@ final class OnboardingCoordinator: NSObject, OnboardingCoordinatorProtocol {
selectedAvatar = nil
}
@available(iOS 14.0, *)
private func showCelebrationScreen(for userSession: UserSession) {
MXLog.debug("[OnboardingCoordinator] showCelebrationScreen")
@ -507,7 +491,6 @@ final class OnboardingCoordinator: NSObject, OnboardingCoordinatorProtocol {
}
}
@available(iOS 14.0, *)
private func celebrationCoordinator(_ coordinator: OnboardingCelebrationCoordinator, didCompleteWith userSession: UserSession) {
if Analytics.shared.shouldShowAnalyticsPrompt {
showAnalyticsPrompt(for: userSession.matrixSession)
@ -521,7 +504,6 @@ final class OnboardingCoordinator: NSObject, OnboardingCoordinatorProtocol {
/// Shows the analytics prompt for the supplied session.
///
/// Check `Analytics.shared.shouldShowAnalyticsPrompt` before calling this method.
@available(iOS 14.0, *)
private func showAnalyticsPrompt(for session: MXSession) {
MXLog.debug("[OnboardingCoordinator]: Invite the user to send analytics")

View file

@ -16,12 +16,10 @@
import Foundation
@available(iOS 14.0, *)
protocol AuthenticationServiceDelegate: AnyObject {
func authenticationServiceDidUpdateRegistrationParameters(_ authenticationService: AuthenticationService)
}
@available(iOS 14.0, *)
class AuthenticationService: NSObject {
/// The shared service object.

View file

@ -17,7 +17,6 @@
import Foundation
import MatrixSDK
@available(iOS 14.0, *)
struct AuthenticationState {
// var serverType: ServerType = .unknown
var flow: AuthenticationFlow

View file

@ -16,7 +16,6 @@
import Foundation
@available(iOS 14.0, *)
/// Set of methods to be able to create an account on a homeserver.
///
/// Common scenario to register an account successfully:

View file

@ -17,13 +17,10 @@
import SwiftUI
import Combine
@available(iOS 14, *)
typealias AuthenticationRegistrationViewModelType = StateStoreViewModel<AuthenticationRegistrationViewState,
Never,
AuthenticationRegistrationViewAction>
@available(iOS 14, *)
class AuthenticationRegistrationViewModel: AuthenticationRegistrationViewModelType, AuthenticationRegistrationViewModelProtocol {
// MARK: - Properties

View file

@ -19,7 +19,6 @@ import Foundation
protocol AuthenticationRegistrationViewModelProtocol {
@MainActor var completion: ((AuthenticationRegistrationViewModelResult) -> Void)? { get set }
@available(iOS 14, *)
var context: AuthenticationRegistrationViewModelType.Context { get }
/// Update the view with new homeserver information.

View file

@ -18,7 +18,6 @@ import SwiftUI
import CommonKit
import MatrixSDK
@available(iOS 14.0, *)
struct AuthenticationRegistrationCoordinatorParameters {
let navigationRouter: NavigationRouterType
let authenticationService: AuthenticationService
@ -35,7 +34,6 @@ enum AuthenticationRegistrationCoordinatorResult {
case completed(RegistrationResult)
}
@available(iOS 14.0, *)
final class AuthenticationRegistrationCoordinator: Coordinator, Presentable {
// MARK: - Properties

View file

@ -19,7 +19,6 @@ import SwiftUI
/// Using an enum for the screen allows you define the different state cases with
/// the relevant associated data for each case.
@available(iOS 14.0, *)
enum MockAuthenticationRegistrationScreenState: MockScreenState, CaseIterable {
// A case for each state you want to represent
// with specific, minimal associated data that will allow you

View file

@ -17,7 +17,6 @@
import XCTest
import RiotSwiftUI
@available(iOS 14.0, *)
class AuthenticationRegistrationUITests: MockScreenTest {
override class var screenType: MockScreenState.Type {

View file

@ -19,7 +19,6 @@ import Combine
@testable import RiotSwiftUI
@available(iOS 14.0, *)
@MainActor class AuthenticationRegistrationViewModelTests: XCTestCase {
var viewModel: AuthenticationRegistrationViewModelProtocol!
var context: AuthenticationRegistrationViewModelType.Context!

View file

@ -16,7 +16,6 @@
import SwiftUI
@available(iOS 14.0, *)
struct AuthenticationRegistrationScreen: View {
// MARK: - Properties

View file

@ -16,7 +16,6 @@
import SwiftUI
@available(iOS 14.0, *)
/// An button that displays the icon and name of an SSO provider.
struct AuthenticationSSOButton: View {

View file

@ -16,11 +16,10 @@
import SwiftUI
@available(iOS 14, *)
typealias AuthenticationServerSelectionViewModelType = StateStoreViewModel<AuthenticationServerSelectionViewState,
Never,
AuthenticationServerSelectionViewAction>
@available(iOS 14, *)
class AuthenticationServerSelectionViewModel: AuthenticationServerSelectionViewModelType, AuthenticationServerSelectionViewModelProtocol {
// MARK: - Properties

View file

@ -19,7 +19,6 @@ import Foundation
protocol AuthenticationServerSelectionViewModelProtocol {
@MainActor var completion: ((AuthenticationServerSelectionViewModelResult) -> Void)? { get set }
@available(iOS 14, *)
var context: AuthenticationServerSelectionViewModelType.Context { get }
/// Displays an error to the user.

View file

@ -17,7 +17,6 @@
import SwiftUI
import CommonKit
@available(iOS 14.0, *)
struct AuthenticationServerSelectionCoordinatorParameters {
let authenticationService: AuthenticationService
/// Whether the screen is presented modally or within a navigation stack.
@ -29,7 +28,6 @@ enum AuthenticationServerSelectionCoordinatorResult {
case dismiss
}
@available(iOS 14.0, *)
final class AuthenticationServerSelectionCoordinator: Coordinator, Presentable {
// MARK: - Properties

View file

@ -19,7 +19,6 @@ import SwiftUI
/// Using an enum for the screen allows you define the different state cases with
/// the relevant associated data for each case.
@available(iOS 14.0, *)
enum MockAuthenticationServerSelectionScreenState: MockScreenState, CaseIterable {
// A case for each state you want to represent
// with specific, minimal associated data that will allow you

View file

@ -17,7 +17,6 @@
import XCTest
import RiotSwiftUI
@available(iOS 14.0, *)
class AuthenticationServerSelectionUITests: MockScreenTest {
override class var screenType: MockScreenState.Type {

View file

@ -18,7 +18,6 @@ import XCTest
@testable import RiotSwiftUI
@available(iOS 14.0, *)
class AuthenticationServerSelectionViewModelTests: XCTestCase {
private enum Constants {
static let counterInitialValue = 0

View file

@ -16,7 +16,6 @@
import SwiftUI
@available(iOS 14.0, *)
struct AuthenticationServerSelectionScreen: View {
enum Constants {

View file

@ -30,7 +30,6 @@ enum OnboardingAvatarCoordinatorResult {
case complete(UserSession)
}
@available(iOS 14.0, *)
final class OnboardingAvatarCoordinator: Coordinator, Presentable {
// MARK: - Properties
@ -178,7 +177,6 @@ final class OnboardingAvatarCoordinator: Coordinator, Presentable {
// MARK: - MediaPickerPresenterDelegate
@available(iOS 14.0, *)
extension OnboardingAvatarCoordinator: MediaPickerPresenterDelegate {
/// **Note:** MediaPickerPresenter fails to load images on the simulator as of Xcode 13.3 (at least on an M1 Mac),
/// so whilst this method may not appear to be called, everything works fine when run on a device.
@ -195,7 +193,6 @@ extension OnboardingAvatarCoordinator: MediaPickerPresenterDelegate {
// MARK: - CameraPresenterDelegate
@available(iOS 14.0, *)
extension OnboardingAvatarCoordinator: CameraPresenterDelegate {
func cameraPresenter(_ presenter: CameraPresenter, didSelectImage image: UIImage) {
onboardingAvatarViewModel.updateAvatarImage(with: image)

View file

@ -19,7 +19,6 @@ import SwiftUI
/// Using an enum for the screen allows you define the different state cases with
/// the relevant associated data for each case.
@available(iOS 14.0, *)
enum MockOnboardingAvatarScreenState: MockScreenState, CaseIterable {
// A case for each state you want to represent
// with specific, minimal associated data that will allow you
@ -63,7 +62,6 @@ enum MockOnboardingAvatarScreenState: MockScreenState, CaseIterable {
}
}
@available(iOS 14.0, *)
extension MockOnboardingAvatarScreenState: CustomStringConvertible {
// Added to have different descriptions in the SwiftUI target's list.
var description: String {

View file

@ -17,11 +17,10 @@
import SwiftUI
import Combine
@available(iOS 14, *)
typealias OnboardingAvatarViewModelType = StateStoreViewModel<OnboardingAvatarViewState,
Never,
OnboardingAvatarViewAction>
@available(iOS 14, *)
class OnboardingAvatarViewModel: OnboardingAvatarViewModelType, OnboardingAvatarViewModelProtocol {
// MARK: - Properties

View file

@ -19,7 +19,6 @@ import SwiftUI
protocol OnboardingAvatarViewModelProtocol {
var completion: ((OnboardingAvatarViewModelResult) -> Void)? { get set }
@available(iOS 14, *)
var context: OnboardingAvatarViewModelType.Context { get }
/// Update the view model to show the image that the user has picked.

View file

@ -17,7 +17,6 @@
import XCTest
import RiotSwiftUI
@available(iOS 14.0, *)
class OnboardingAvatarUITests: MockScreenTest {
override class var screenType: MockScreenState.Type {

View file

@ -19,7 +19,6 @@ import Combine
@testable import RiotSwiftUI
@available(iOS 14.0, *)
class OnboardingAvatarViewModelTests: XCTestCase {
private enum Constants {
static let userId = "@user:matrix.org"

View file

@ -17,7 +17,6 @@
import SwiftUI
import DesignKit
@available(iOS 14.0, *)
struct OnboardingAvatarScreen: View {
// MARK: - Properties

View file

@ -20,7 +20,6 @@ struct OnboardingCelebrationCoordinatorParameters {
let userSession: UserSession
}
@available(iOS 14.0, *)
final class OnboardingCelebrationCoordinator: Coordinator, Presentable {
// MARK: - Properties

View file

@ -19,7 +19,6 @@ import SwiftUI
/// Using an enum for the screen allows you define the different state cases with
/// the relevant associated data for each case.
@available(iOS 14.0, *)
enum MockOnboardingCelebrationScreenState: MockScreenState, CaseIterable {
// A case for each state you want to represent
// with specific, minimal associated data that will allow you

View file

@ -16,11 +16,10 @@
import SwiftUI
@available(iOS 14, *)
typealias OnboardingCelebrationViewModelType = StateStoreViewModel<OnboardingCelebrationViewState,
Never,
OnboardingCelebrationViewAction>
@available(iOS 14, *)
Never,
OnboardingCelebrationViewAction>
class OnboardingCelebrationViewModel: OnboardingCelebrationViewModelType, OnboardingCelebrationViewModelProtocol {
// MARK: - Properties

View file

@ -19,6 +19,5 @@ import Foundation
protocol OnboardingCelebrationViewModelProtocol {
var completion: (() -> Void)? { get set }
@available(iOS 14, *)
var context: OnboardingCelebrationViewModelType.Context { get }
}

View file

@ -17,7 +17,6 @@
import XCTest
import RiotSwiftUI
@available(iOS 14.0, *)
class OnboardingCelebrationUITests: MockScreenTest {
// Nothing to test as the view is completely static
}

View file

@ -18,7 +18,6 @@ import XCTest
@testable import RiotSwiftUI
@available(iOS 14.0, *)
class OnboardingCelebrationViewModelTests: XCTestCase {
// Nothing to test as there is no mutable state
}

View file

@ -17,7 +17,6 @@
import SwiftUI
import SceneKit
@available(iOS 14.0, *)
struct OnboardingCelebrationScreen: View {
// MARK: - Properties

View file

@ -16,7 +16,6 @@
import SwiftUI
@available(iOS 14.0, *)
struct OnboardingButtonStyle: ButtonStyle {
@Environment(\.theme) private var theme

View file

@ -17,7 +17,6 @@
import SwiftUI
/// Metrics used across the entire onboarding flow.
@available(iOS 14.0, *)
struct OnboardingMetrics {
static let maxContentWidth: CGFloat = 600
static let maxContentHeight: CGFloat = 750

View file

@ -16,7 +16,6 @@
import SwiftUI
@available(iOS 14.0, *)
/// A view that displays text, highlighting the first occurrence of
/// the character `.` in the theme's accent color.
struct OnboardingTintedFullStopText: View {

View file

@ -31,7 +31,6 @@ enum OnboardingCongratulationsCoordinatorResult {
case takeMeHome(UserSession)
}
@available(iOS 14.0, *)
final class OnboardingCongratulationsCoordinator: Coordinator, Presentable {
// MARK: - Properties

View file

@ -19,7 +19,6 @@ import SwiftUI
/// Using an enum for the screen allows you define the different state cases with
/// the relevant associated data for each case.
@available(iOS 14.0, *)
enum MockOnboardingCongratulationsScreenState: MockScreenState, CaseIterable {
// A case for each state you want to represent
// with specific, minimal associated data that will allow you

View file

@ -16,11 +16,10 @@
import SwiftUI
@available(iOS 14, *)
typealias OnboardingCongratulationsViewModelType = StateStoreViewModel<OnboardingCongratulationsViewState,
Never,
OnboardingCongratulationsViewAction>
@available(iOS 14, *)
Never,
OnboardingCongratulationsViewAction>
class OnboardingCongratulationsViewModel: OnboardingCongratulationsViewModelType, OnboardingCongratulationsViewModelProtocol {
// MARK: - Properties

View file

@ -19,6 +19,5 @@ import Foundation
protocol OnboardingCongratulationsViewModelProtocol {
var completion: ((OnboardingCongratulationsViewModelResult) -> Void)? { get set }
@available(iOS 14, *)
var context: OnboardingCongratulationsViewModelType.Context { get }
}

View file

@ -17,7 +17,6 @@
import XCTest
import RiotSwiftUI
@available(iOS 14.0, *)
class OnboardingCongratulationsUITests: MockScreenTest {
override class var screenType: MockScreenState.Type {

View file

@ -18,7 +18,6 @@ import XCTest
@testable import RiotSwiftUI
@available(iOS 14.0, *)
class OnboardingCongratulationsViewModelTests: XCTestCase {
// The view modal has minimal set up and no mutation so nothing to test.
}

View file

@ -16,7 +16,6 @@
import SwiftUI
@available(iOS 14.0, *)
struct OnboardingCongratulationsScreen: View {
// MARK: - Properties
@ -142,7 +141,6 @@ struct OnboardingCongratulationsScreen: View {
// MARK: - Previews
@available(iOS 14.0, *)
struct OnboardingCongratulationsScreen_Previews: PreviewProvider {
static let stateRenderer = MockOnboardingCongratulationsScreenState.stateRenderer
static var previews: some View {

View file

@ -21,7 +21,6 @@ struct OnboardingDisplayNameCoordinatorParameters {
let userSession: UserSession
}
@available(iOS 14.0, *)
final class OnboardingDisplayNameCoordinator: Coordinator, Presentable {
// MARK: - Properties

View file

@ -19,7 +19,6 @@ import SwiftUI
/// Using an enum for the screen allows you define the different state cases with
/// the relevant associated data for each case.
@available(iOS 14.0, *)
enum MockOnboardingDisplayNameScreenState: MockScreenState, CaseIterable {
// A case for each state you want to represent
// with specific, minimal associated data that will allow you

View file

@ -17,11 +17,10 @@
import SwiftUI
import Combine
@available(iOS 14, *)
typealias OnboardingDisplayNameViewModelType = StateStoreViewModel<OnboardingDisplayNameViewState,
Never,
OnboardingDisplayNameViewAction>
@available(iOS 14, *)
Never,
OnboardingDisplayNameViewAction>
class OnboardingDisplayNameViewModel: OnboardingDisplayNameViewModelType, OnboardingDisplayNameViewModelProtocol {
// MARK: - Properties

View file

@ -19,7 +19,6 @@ import Foundation
protocol OnboardingDisplayNameViewModelProtocol {
var completion: ((OnboardingDisplayNameViewModelResult) -> Void)? { get set }
@available(iOS 14, *)
var context: OnboardingDisplayNameViewModelType.Context { get }
/// Update the view model to show that an error has occurred.

View file

@ -17,7 +17,6 @@
import XCTest
import RiotSwiftUI
@available(iOS 14.0, *)
class OnboardingDisplayNameUITests: MockScreenTest {
override class var screenType: MockScreenState.Type {

View file

@ -19,7 +19,6 @@ import Combine
@testable import RiotSwiftUI
@available(iOS 14.0, *)
class OnboardingDisplayNameViewModelTests: XCTestCase {
var viewModel: OnboardingDisplayNameViewModel!
var context: OnboardingDisplayNameViewModelType.Context!

View file

@ -16,7 +16,6 @@
import SwiftUI
@available(iOS 14.0, *)
struct OnboardingDisplayNameScreen: View {
// MARK: - Properties

View file

@ -20,7 +20,6 @@ protocol OnboardingSplashScreenCoordinatorProtocol: Coordinator, Presentable {
var completion: ((OnboardingSplashScreenViewModelResult) -> Void)? { get set }
}
@available(iOS 14.0, *)
final class OnboardingSplashScreenCoordinator: OnboardingSplashScreenCoordinatorProtocol {
// MARK: - Properties

View file

@ -19,7 +19,6 @@ import SwiftUI
/// Using an enum for the screen allows you define the different state cases with
/// the relevant associated data for each case.
@available(iOS 14.0, *)
enum MockOnboardingSplashScreenScreenState: MockScreenState, CaseIterable {
// A case for each state you want to represent
// with specific, minimal associated data that will allow you

View file

@ -18,7 +18,6 @@ import SwiftUI
// MARK: - Coordinator
@available(iOS 13.0, *)
/// The content displayed in a single splash screen page.
struct OnboardingSplashScreenPageContent {
let title: String
@ -37,7 +36,6 @@ enum OnboardingSplashScreenViewModelResult {
// MARK: View
@available(iOS 13.0, *)
struct OnboardingSplashScreenViewState: BindableState, CustomDebugStringConvertible {
// MARK: - Constants

View file

@ -17,19 +17,15 @@
import SwiftUI
import Combine
@available(iOS 14, *)
typealias OnboardingSplashScreenViewModelType = StateStoreViewModel<OnboardingSplashScreenViewState,
Never,
OnboardingSplashScreenViewAction>
protocol OnboardingSplashScreenViewModelProtocol {
var completion: ((OnboardingSplashScreenViewModelResult) -> Void)? { get set }
@available(iOS 14, *)
var context: OnboardingSplashScreenViewModelType.Context { get }
}
@available(iOS 14, *)
class OnboardingSplashScreenViewModel: OnboardingSplashScreenViewModelType, OnboardingSplashScreenViewModelProtocol {
// MARK: - Properties

View file

@ -19,7 +19,6 @@ import Combine
@testable import RiotSwiftUI
@available(iOS 14.0, *)
class OnboardingSplashScreenViewModelTests: XCTestCase {
}

View file

@ -16,7 +16,6 @@
import SwiftUI
@available(iOS 14.0, *)
/// The splash screen shown at the beginning of the onboarding flow.
struct OnboardingSplashScreen: View {
@ -199,7 +198,6 @@ struct OnboardingSplashScreen: View {
// MARK: - Previews
@available(iOS 14.0, *)
struct OnboardingSplashScreen_Previews: PreviewProvider {
static let stateRenderer = MockOnboardingSplashScreenScreenState.stateRenderer
static var previews: some View {

View file

@ -16,7 +16,6 @@
import SwiftUI
@available(iOS 14.0, *)
struct OnboardingSplashScreenPage: View {
// MARK: - Properties
@ -75,7 +74,6 @@ struct OnboardingSplashScreenPage: View {
}
}
@available(iOS 14.0, *)
struct OnboardingSplashScreenPage_Previews: PreviewProvider {
static let content = OnboardingSplashScreenViewState().content
static var previews: some View {

View file

@ -16,7 +16,6 @@
import SwiftUI
@available(iOS 14.0, *)
struct OnboardingSplashScreenPageIndicator: View {
// MARK: - Properties

View file

@ -16,7 +16,6 @@
import SwiftUI
@available(iOS 14.0, *)
final class OnboardingUseCaseSelectionCoordinator: Coordinator, Presentable {
// MARK: - Properties

View file

@ -19,7 +19,6 @@ import SwiftUI
/// Using an enum for the screen allows you define the different state cases with
/// the relevant associated data for each case.
@available(iOS 14.0, *)
enum MockOnboardingUseCaseSelectionScreenState: MockScreenState, CaseIterable {
// A case for each state you want to represent
// with specific, minimal associated data that will allow you

View file

@ -16,11 +16,10 @@
import SwiftUI
@available(iOS 14, *)
typealias OnboardingUseCaseViewModelType = StateStoreViewModel<OnboardingUseCaseViewState,
OnboardingUseCaseStateAction,
OnboardingUseCaseViewAction>
@available(iOS 14, *)
OnboardingUseCaseStateAction,
OnboardingUseCaseViewAction>
class OnboardingUseCaseViewModel: OnboardingUseCaseViewModelType, OnboardingUseCaseViewModelProtocol {
// MARK: - Properties

View file

@ -19,6 +19,5 @@ import Foundation
protocol OnboardingUseCaseViewModelProtocol {
var completion: ((OnboardingUseCaseViewModelResult) -> Void)? { get set }
@available(iOS 14, *)
var context: OnboardingUseCaseViewModelType.Context { get }
}

View file

@ -17,7 +17,6 @@
import XCTest
import RiotSwiftUI
@available(iOS 14.0, *)
class OnboardingUseCaseUITests: MockScreenTest {
// The view has no parameters or changing state to test.
}

View file

@ -18,7 +18,6 @@ import XCTest
@testable import RiotSwiftUI
@available(iOS 14.0, *)
class OnboardingUseCaseViewModelTests: XCTestCase {
// The view model has nothing to test.
}

View file

@ -16,7 +16,6 @@
import SwiftUI
@available(iOS 14.0, *)
/// A button used for the Use Case selection.
struct OnboardingUseCaseButton: View {
@ -48,7 +47,6 @@ struct OnboardingUseCaseButton: View {
}
}
@available(iOS 14.0, *)
struct Previews_OnboardingUseCaseButton_Previews: PreviewProvider {
static var previews: some View {
OnboardingUseCaseButton(title: VectorL10n.onboardingUseCaseWorkMessaging,

View file

@ -16,7 +16,6 @@
import SwiftUI
@available(iOS 14.0, *)
/// The screen shown to a new user to select their use case for the app.
struct OnboardingUseCaseSelectionScreen: View {
@ -116,7 +115,6 @@ struct OnboardingUseCaseSelectionScreen: View {
// MARK: - Previews
@available(iOS 14.0, *)
struct OnboardingUseCase_Previews: PreviewProvider {
static let stateRenderer = MockOnboardingUseCaseSelectionScreenState.stateRenderer

View file

@ -42,7 +42,6 @@ final class TemplateSimpleScreenCoordinator: Coordinator, Presentable {
// MARK: - Setup
@available(iOS 14.0, *)
init(parameters: TemplateSimpleScreenCoordinatorParameters) {
self.parameters = parameters

View file

@ -19,7 +19,6 @@ import SwiftUI
/// Using an enum for the screen allows you define the different state cases with
/// the relevant associated data for each case.
@available(iOS 14.0, *)
enum MockTemplateSimpleScreenScreenState: MockScreenState, CaseIterable {
// A case for each state you want to represent
// with specific, minimal associated data that will allow you

View file

@ -16,11 +16,10 @@
import SwiftUI
@available(iOS 14, *)
typealias TemplateSimpleScreenViewModelType = StateStoreViewModel<TemplateSimpleScreenViewState,
Never,
TemplateSimpleScreenViewAction>
@available(iOS 14, *)
class TemplateSimpleScreenViewModel: TemplateSimpleScreenViewModelType, TemplateSimpleScreenViewModelProtocol {
// MARK: - Properties

View file

@ -19,6 +19,5 @@ import Foundation
protocol TemplateSimpleScreenViewModelProtocol {
var completion: ((TemplateSimpleScreenViewModelResult) -> Void)? { get set }
@available(iOS 14, *)
var context: TemplateSimpleScreenViewModelType.Context { get }
}

View file

@ -17,7 +17,6 @@
import XCTest
import RiotSwiftUI
@available(iOS 14.0, *)
class TemplateSimpleScreenUITests: MockScreenTest {
override class var screenType: MockScreenState.Type {

View file

@ -18,7 +18,6 @@ import XCTest
@testable import RiotSwiftUI
@available(iOS 14.0, *)
class TemplateSimpleScreenViewModelTests: XCTestCase {
private enum Constants {
static let counterInitialValue = 0

View file

@ -16,7 +16,6 @@
import SwiftUI
@available(iOS 14.0, *)
struct TemplateSimpleScreen: View {
// MARK: - Properties
@ -104,7 +103,6 @@ struct TemplateSimpleScreen: View {
// MARK: - Previews
@available(iOS 14.0, *)
struct TemplateSimpleScreen_Previews: PreviewProvider {
static let stateRenderer = MockTemplateSimpleScreenScreenState.stateRenderer
static var previews: some View {

View file

@ -42,7 +42,6 @@ final class TemplateUserProfileCoordinator: Coordinator, Presentable {
// MARK: - Setup
@available(iOS 14.0, *)
init(parameters: TemplateUserProfileCoordinatorParameters) {
self.parameters = parameters
let viewModel = TemplateUserProfileViewModel.makeTemplateUserProfileViewModel(templateUserProfileService: TemplateUserProfileService(session: parameters.session))

View file

@ -19,7 +19,6 @@ import SwiftUI
/// Using an enum for the screen allows you define the different state cases with
/// the relevant associated data for each case.
@available(iOS 14.0, *)
enum MockTemplateUserProfileScreenState: MockScreenState, CaseIterable {
// A case for each state you want to represent
// with specific, minimal associated data that will allow you

View file

@ -17,7 +17,6 @@
import Foundation
import Combine
@available(iOS 14.0, *)
class TemplateUserProfileService: TemplateUserProfileServiceProtocol {
// MARK: - Properties

View file

@ -17,7 +17,6 @@
import Foundation
import Combine
@available(iOS 14.0, *)
class MockTemplateUserProfileService: TemplateUserProfileServiceProtocol {
var presenceSubject: CurrentValueSubject<TemplateUserProfilePresence, Never>

View file

@ -17,7 +17,6 @@
import Foundation
import Combine
@available(iOS 14.0, *)
protocol TemplateUserProfileServiceProtocol: Avatarable {
var userId: String { get }
var displayName: String? { get }
@ -27,7 +26,6 @@ protocol TemplateUserProfileServiceProtocol: Avatarable {
// MARK: Avatarable
@available(iOS 14.0, *)
extension TemplateUserProfileServiceProtocol {
var mxContentUri: String? {
avatarUrl

View file

@ -17,11 +17,10 @@
import SwiftUI
import Combine
@available(iOS 14, *)
typealias TemplateUserProfileViewModelType = StateStoreViewModel<TemplateUserProfileViewState,
Never,
TemplateUserProfileViewAction>
@available(iOS 14, *)
class TemplateUserProfileViewModel: TemplateUserProfileViewModelType, TemplateUserProfileViewModelProtocol {
// MARK: - Properties

View file

@ -19,8 +19,6 @@ import Foundation
protocol TemplateUserProfileViewModelProtocol {
var completion: ((TemplateUserProfileViewModelResult) -> Void)? { get set }
@available(iOS 14, *)
static func makeTemplateUserProfileViewModel(templateUserProfileService: TemplateUserProfileServiceProtocol) -> TemplateUserProfileViewModelProtocol
@available(iOS 14, *)
var context: TemplateUserProfileViewModelType.Context { get }
}

View file

@ -17,7 +17,6 @@
import XCTest
import RiotSwiftUI
@available(iOS 14.0, *)
class TemplateUserProfileUITests: MockScreenTest {
override class var screenType: MockScreenState.Type {

View file

@ -19,7 +19,6 @@ import Combine
@testable import RiotSwiftUI
@available(iOS 14.0, *)
class TemplateUserProfileViewModelTests: XCTestCase {
private enum Constants {
static let presenceInitialValue: TemplateUserProfilePresence = .offline

View file

@ -16,7 +16,6 @@
import SwiftUI
@available(iOS 14.0, *)
struct TemplateUserProfile: View {
// MARK: - Properties
@ -70,7 +69,6 @@ struct TemplateUserProfile: View {
// MARK: - Previews
@available(iOS 14.0, *)
struct TemplateUserProfile_Previews: PreviewProvider {
static let stateRenderer = MockTemplateUserProfileScreenState.stateRenderer
static var previews: some View {

View file

@ -16,7 +16,6 @@
import SwiftUI
@available(iOS 14.0, *)
struct TemplateUserProfileHeader: View {
// MARK: - Properties
@ -49,7 +48,6 @@ struct TemplateUserProfileHeader: View {
// MARK: - Previews
@available(iOS 14.0, *)
struct TemplateUserProfileHeader_Previews: PreviewProvider {
static var previews: some View {
TemplateUserProfileHeader(avatar: MockAvatarInput.example, displayName: "Alice", presence: .online)

View file

@ -16,7 +16,6 @@
import SwiftUI
@available(iOS 14.0, *)
struct TemplateUserProfilePresenceView: View {
// MARK: - Properties
@ -53,7 +52,6 @@ struct TemplateUserProfilePresenceView: View {
// MARK: - Previews
@available(iOS 14.0, *)
struct TemplateUserProfilePresenceView_Previews: PreviewProvider {
static var previews: some View {
VStack(alignment:.leading){

View file

@ -46,21 +46,19 @@ final class TemplateRoomsCoordinator: Coordinator, Presentable {
func start() {
if #available(iOS 14.0, *) {
MXLog.debug("[TemplateRoomsCoordinator] did start.")
let rootCoordinator = self.createTemplateRoomListCoordinator()
rootCoordinator.start()
self.add(childCoordinator: rootCoordinator)
if self.navigationRouter.modules.isEmpty == false {
self.navigationRouter.push(rootCoordinator, animated: true, popCompletion: { [weak self] in
self?.remove(childCoordinator: rootCoordinator)
})
} else {
self.navigationRouter.setRootModule(rootCoordinator) { [weak self] in
self?.remove(childCoordinator: rootCoordinator)
}
MXLog.debug("[TemplateRoomsCoordinator] did start.")
let rootCoordinator = self.createTemplateRoomListCoordinator()
rootCoordinator.start()
self.add(childCoordinator: rootCoordinator)
if self.navigationRouter.modules.isEmpty == false {
self.navigationRouter.push(rootCoordinator, animated: true, popCompletion: { [weak self] in
self?.remove(childCoordinator: rootCoordinator)
})
} else {
self.navigationRouter.setRootModule(rootCoordinator) { [weak self] in
self?.remove(childCoordinator: rootCoordinator)
}
}
}
@ -71,7 +69,6 @@ final class TemplateRoomsCoordinator: Coordinator, Presentable {
// MARK: - Private
@available(iOS 14.0, *)
private func createTemplateRoomListCoordinator() -> TemplateRoomListCoordinator {
let coordinator: TemplateRoomListCoordinator = TemplateRoomListCoordinator(parameters: TemplateRoomListCoordinatorParameters(session: parameters.session))
@ -88,13 +85,11 @@ final class TemplateRoomsCoordinator: Coordinator, Presentable {
return coordinator
}
@available(iOS 14.0, *)
private func createTemplateRoomChatCoordinator(room: MXRoom) -> TemplateRoomChatCoordinator {
let coordinator: TemplateRoomChatCoordinator = TemplateRoomChatCoordinator(parameters: TemplateRoomChatCoordinatorParameters(room: room))
return coordinator
}
@available(iOS 14.0, *)
func showTemplateRoomChat(roomId: String) {
guard let room = parameters.session.room(withRoomId: roomId) else {
MXLog.error("[TemplateRoomsCoordinator] Failed to find room by selected Id.")

View file

@ -38,7 +38,6 @@ final class TemplateRoomChatCoordinator: Coordinator, Presentable {
// MARK: - Setup
@available(iOS 14.0, *)
init(parameters: TemplateRoomChatCoordinatorParameters) {
self.parameters = parameters
let viewModel = TemplateRoomChatViewModel(templateRoomChatService: TemplateRoomChatService(room: parameters.room))

View file

@ -19,7 +19,6 @@ import SwiftUI
/// Using an enum for the screen allows you define the different state cases with
/// the relevant associated data for each case.
@available(iOS 14.0, *)
enum MockTemplateRoomChatScreenState: MockScreenState, CaseIterable {
// A case for each state you want to represent
// with specific, minimal associated data that will allow you

View file

@ -17,7 +17,6 @@
import Foundation
import Combine
@available(iOS 14.0, *)
class TemplateRoomChatService: TemplateRoomChatServiceProtocol {
// MARK: - Properties

View file

@ -17,7 +17,6 @@
import Foundation
import Combine
@available(iOS 14.0, *)
class MockTemplateRoomChatService: TemplateRoomChatServiceProtocol {
let roomName: String? = "New Vector"

View file

@ -17,7 +17,6 @@
import Foundation
import Combine
@available(iOS 14.0, *)
protocol TemplateRoomChatServiceProtocol {
var roomInitializationStatus: CurrentValueSubject<TemplateRoomChatRoomInitializationStatus, Never> { get }
var chatMessagesSubject: CurrentValueSubject<[TemplateRoomChatMessage], Never> { get }

View file

@ -17,12 +17,10 @@
import SwiftUI
import Combine
@available(iOS 14, *)
typealias TemplateRoomChatViewModelType = StateStoreViewModel<TemplateRoomChatViewState,
Never,
TemplateRoomChatViewAction>
@available(iOS 14, *)
class TemplateRoomChatViewModel: TemplateRoomChatViewModelType, TemplateRoomChatViewModelProtocol {
enum Constants {

View file

@ -17,7 +17,6 @@
import XCTest
import RiotSwiftUI
@available(iOS 14.0, *)
class TemplateRoomChatUITests: MockScreenTest {
override class var screenType: MockScreenState.Type {

View file

@ -19,7 +19,6 @@ import Combine
@testable import RiotSwiftUI
@available(iOS 14.0, *)
class TemplateRoomChatViewModelTests: XCTestCase {
var service: MockTemplateRoomChatService!

View file

@ -17,7 +17,6 @@
import SwiftUI
import Combine
@available(iOS 14.0, *)
struct TemplateRoomChat: View {
// MARK: - Properties
@ -127,7 +126,6 @@ struct TemplateRoomChat: View {
// MARK: - Previews
@available(iOS 14.0, *)
struct TemplateRoomChat_Previews: PreviewProvider {
static let stateRenderer = MockTemplateRoomChatScreenState.stateRenderer
static var previews: some View {

View file

@ -16,7 +16,6 @@
import SwiftUI
@available(iOS 14.0, *)
struct TemplateRoomChatBubbleContentView: View {
// MARK: - Properties
@ -44,7 +43,6 @@ struct TemplateRoomChatBubbleContentView: View {
// MARK: - Previews
@available(iOS 14.0, *)
struct TemplateRoomChatBubbleItemView_Previews: PreviewProvider {
static var previews: some View {
EmptyView()

View file

@ -16,7 +16,6 @@
import SwiftUI
@available(iOS 14.0, *)
struct TemplateRoomChatBubbleImage: View {
// MARK: - Properties
@ -36,7 +35,6 @@ struct TemplateRoomChatBubbleImage: View {
// MARK: - Previews
@available(iOS 14.0, *)
struct TemplateRoomChatBubbleImage_Previews: PreviewProvider {
static var previews: some View {
EmptyView()

View file

@ -16,7 +16,6 @@
import SwiftUI
@available(iOS 14.0, *)
struct TemplateRoomChatBubbleMessage: View {
// MARK: - Properties
@ -39,7 +38,6 @@ struct TemplateRoomChatBubbleMessage: View {
// MARK: - Previews
@available(iOS 14.0, *)
struct TemplateRoomChatBubbleMessage_Previews: PreviewProvider {
static let message = TemplateRoomChatMessageTextContent(body: "Hello")
static var previews: some View {

View file

@ -16,7 +16,6 @@
import SwiftUI
@available(iOS 14.0, *)
struct TemplateRoomChatBubbleView: View {
// MARK: - Properties
@ -52,7 +51,6 @@ struct TemplateRoomChatBubbleView: View {
// MARK: - Previews
@available(iOS 14.0, *)
struct TemplateRoomChatBubbleView_Previews: PreviewProvider {
static let bubble = TemplateRoomChatBubble(
id: "111",

Some files were not shown because too many files have changed in this diff Show more