diff --git a/Authorization/Authorization.xcodeproj/project.pbxproj b/Authorization/Authorization.xcodeproj/project.pbxproj index fba945920..8aa67bc84 100644 --- a/Authorization/Authorization.xcodeproj/project.pbxproj +++ b/Authorization/Authorization.xcodeproj/project.pbxproj @@ -27,6 +27,9 @@ 0770DE7128D0C0E7006D8A5D /* Strings.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0770DE7028D0C0E7006D8A5D /* Strings.swift */; }; 5FB79D2802949372CDAF08D6 /* Pods_App_Authorization_AuthorizationTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4FAE9B7FD61FF88C9C4FE1E8 /* Pods_App_Authorization_AuthorizationTests.framework */; }; DE843D6BB1B9DDA398494890 /* Pods_App_Authorization.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 47BCFB7C19382EECF15131B6 /* Pods_App_Authorization.framework */; }; + E03261642AE64676002CA7EB /* StartupViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = E03261632AE64676002CA7EB /* StartupViewModel.swift */; }; + E03261662AE64AF4002CA7EB /* StartupView.swift in Sources */ = {isa = PBXBuildFile; fileRef = E03261652AE64AF4002CA7EB /* StartupView.swift */; }; + E03261682AE9F156002CA7EB /* LogistrationBottomView.swift in Sources */ = {isa = PBXBuildFile; fileRef = E03261672AE9F156002CA7EB /* LogistrationBottomView.swift */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -75,6 +78,9 @@ 96C85172770225EB81A6D2DA /* Pods-App-Authorization.releasedev.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-App-Authorization.releasedev.xcconfig"; path = "Target Support Files/Pods-App-Authorization/Pods-App-Authorization.releasedev.xcconfig"; sourceTree = ""; }; 9BF6A1004A955E24527FCF0F /* Pods-App-Authorization-AuthorizationTests.releaseprod.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-App-Authorization-AuthorizationTests.releaseprod.xcconfig"; path = "Target Support Files/Pods-App-Authorization-AuthorizationTests/Pods-App-Authorization-AuthorizationTests.releaseprod.xcconfig"; sourceTree = ""; }; A99D45203C981893C104053A /* Pods-App-Authorization-AuthorizationTests.releasestage.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-App-Authorization-AuthorizationTests.releasestage.xcconfig"; path = "Target Support Files/Pods-App-Authorization-AuthorizationTests/Pods-App-Authorization-AuthorizationTests.releasestage.xcconfig"; sourceTree = ""; }; + E03261632AE64676002CA7EB /* StartupViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StartupViewModel.swift; sourceTree = ""; }; + E03261652AE64AF4002CA7EB /* StartupView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StartupView.swift; sourceTree = ""; }; + E03261672AE9F156002CA7EB /* LogistrationBottomView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LogistrationBottomView.swift; sourceTree = ""; }; E78971D8E6ED2116BBF9FD66 /* Pods-App-Authorization.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-App-Authorization.release.xcconfig"; path = "Target Support Files/Pods-App-Authorization/Pods-App-Authorization.release.xcconfig"; sourceTree = ""; }; F52826C68AEA1CF4769389EA /* Pods-App-Authorization.releasestage.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-App-Authorization.releasestage.xcconfig"; path = "Target Support Files/Pods-App-Authorization/Pods-App-Authorization.releasestage.xcconfig"; sourceTree = ""; }; F5802BBA113276950ABCD9B3 /* Pods-App-Authorization.releaseprod.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-App-Authorization.releaseprod.xcconfig"; path = "Target Support Files/Pods-App-Authorization/Pods-App-Authorization.releaseprod.xcconfig"; sourceTree = ""; }; @@ -139,6 +145,7 @@ 071009CC28D1E24000344290 /* Presentation */ = { isa = PBXGroup; children = ( + E03261622AE6464A002CA7EB /* Startup */, 020C31BD290AADA700D6DEA2 /* Base */, 071009C528D1D9FA00344290 /* Login */, 07169462296D93E000E3DED6 /* Registration */, @@ -258,6 +265,16 @@ path = ../Pods; sourceTree = ""; }; + E03261622AE6464A002CA7EB /* Startup */ = { + isa = PBXGroup; + children = ( + E03261632AE64676002CA7EB /* StartupViewModel.swift */, + E03261652AE64AF4002CA7EB /* StartupView.swift */, + E03261672AE9F156002CA7EB /* LogistrationBottomView.swift */, + ); + path = Startup; + sourceTree = ""; + }; /* End PBXGroup section */ /* Begin PBXHeadersBuildPhase section */ @@ -471,11 +488,14 @@ 0770DE7128D0C0E7006D8A5D /* Strings.swift in Sources */, 025F40E229D360E20064C183 /* ResetPasswordViewModel.swift in Sources */, 02066B462906D72F00F4307E /* SignUpViewModel.swift in Sources */, + E03261642AE64676002CA7EB /* StartupViewModel.swift in Sources */, 02A2ACDB2A4B016100FBBBBB /* AuthorizationAnalytics.swift in Sources */, + E03261682AE9F156002CA7EB /* LogistrationBottomView.swift in Sources */, 025F40E029D1E2FC0064C183 /* ResetPasswordView.swift in Sources */, 020C31CB290BF49900D6DEA2 /* FieldsView.swift in Sources */, 0770DE4E28D0A677006D8A5D /* SignInView.swift in Sources */, 02F3BFE5292533720051930C /* AuthorizationRouter.swift in Sources */, + E03261662AE64AF4002CA7EB /* StartupView.swift in Sources */, 071009C728D1DA4F00344290 /* SignInViewModel.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; diff --git a/Authorization/Authorization/Presentation/Login/SignInView.swift b/Authorization/Authorization/Presentation/Login/SignInView.swift index 893712c9b..17be98802 100644 --- a/Authorization/Authorization/Presentation/Login/SignInView.swift +++ b/Authorization/Authorization/Presentation/Login/SignInView.swift @@ -7,6 +7,7 @@ import SwiftUI import Core +import Swinject public struct SignInView: View { @@ -29,6 +30,19 @@ public struct SignInView: View { .resizable() .edgesIgnoringSafeArea(.top) }.frame(maxWidth: .infinity, maxHeight: 200) + if viewModel.config.features.startupScreenEnabled { + VStack { + Button(action: { viewModel.router.back() }, label: { + CoreAssets.arrowLeft.swiftUIImage.renderingMode(.template) + .backButtonStyle(color: .white) + }) + .foregroundColor(Theme.Colors.styledButtonText) + .padding(.leading, isHorizontal ? 48 : 0) + .padding(.top, 11) + + }.frame(maxWidth: .infinity, alignment: .topLeading) + .padding(.top, isHorizontal ? 20 : 0) + } VStack(alignment: .center) { CoreAssets.appLogo.swiftUIImage @@ -83,21 +97,23 @@ public struct SignInView: View { .stroke(lineWidth: 1) .fill(Theme.Colors.textInputStroke) ) - HStack { - Button(AuthLocalization.SignIn.registerBtn) { - viewModel.trackSignUpClicked() - viewModel.router.showRegisterScreen() - }.foregroundColor(Theme.Colors.accentColor) - - Spacer() - + if !viewModel.config.features.startupScreenEnabled { + Button(AuthLocalization.SignIn.registerBtn) { + viewModel.trackSignUpClicked() + viewModel.router.showRegisterScreen() + }.foregroundColor(Theme.Colors.accentColor) + + Spacer() + } + Button(AuthLocalization.SignIn.forgotPassBtn) { viewModel.trackForgotPasswordClicked() viewModel.router.showForgotPasswordScreen() }.foregroundColor(Theme.Colors.accentColor) + .padding(.top, 0) } - .padding(.top, 10) + if viewModel.isShowProgress { HStack(alignment: .center) { ProgressBar(size: 40, lineWidth: 8) @@ -153,8 +169,6 @@ public struct SignInView: View { } } .hideNavigationBar() - .navigationBarBackButtonHidden(true) - .navigationBarHidden(true) .ignoresSafeArea(.all, edges: .horizontal) .background(Theme.Colors.background.ignoresSafeArea(.all)) } diff --git a/Authorization/Authorization/Presentation/Login/SignInViewModel.swift b/Authorization/Authorization/Presentation/Login/SignInViewModel.swift index d1376e5a5..f2fa8a8f5 100644 --- a/Authorization/Authorization/Presentation/Login/SignInViewModel.swift +++ b/Authorization/Authorization/Presentation/Login/SignInViewModel.swift @@ -31,7 +31,7 @@ public class SignInViewModel: ObservableObject { } let router: AuthorizationRouter - private let config: ConfigProtocol + let config: ConfigProtocol private let interactor: AuthInteractorProtocol private let analytics: AuthorizationAnalytics private let validator: Validator diff --git a/Authorization/Authorization/Presentation/Startup/LogistrationBottomView.swift b/Authorization/Authorization/Presentation/Startup/LogistrationBottomView.swift new file mode 100644 index 000000000..2a4b2924c --- /dev/null +++ b/Authorization/Authorization/Presentation/Startup/LogistrationBottomView.swift @@ -0,0 +1,63 @@ +// +// LogistrationBottomView.swift +// Authorization +// +// Created by SaeedBashir on 10/26/23. +// + +import Foundation +import SwiftUI +import Core + +public struct LogistrationBottomView: View { + @ObservedObject + private var viewModel: StartupViewModel + + @Environment(\.isHorizontal) private var isHorizontal + + public init(viewModel: StartupViewModel) { + self.viewModel = viewModel + } + + public var body: some View { + VStack(alignment: .leading) { + HStack(spacing: 24) { + StyledButton(AuthLocalization.SignIn.registerBtn) { + viewModel.router.showRegisterScreen() + viewModel.tracksignUpClicked() + } + .frame(maxWidth: .infinity) + + StyledButton( + AuthLocalization.SignIn.logInTitle, + action: { viewModel.router.showLoginScreen() }, + color: .white, + textColor: Theme.Colors.accentColor, + borderColor: Theme.Colors.textInputStroke + ) + .frame(width: 100) + } + .padding(.horizontal, isHorizontal ? 0 : 0) + } + .padding(.horizontal, isHorizontal ? 10 : 24) + } +} + +struct LogistrationBottomView_Previews: PreviewProvider { + static var previews: some View { + let vm = StartupViewModel( + interactor: AuthInteractor.mock, + router: AuthorizationRouterMock(), + analytics: AuthorizationAnalyticsMock() + ) + LogistrationBottomView(viewModel: vm) + .preferredColorScheme(.light) + .previewDisplayName("StartupView Light") + .loadFonts() + + LogistrationBottomView(viewModel: vm) + .preferredColorScheme(.dark) + .previewDisplayName("StartupView Dark") + .loadFonts() + } +} diff --git a/Authorization/Authorization/Presentation/Startup/StartupView.swift b/Authorization/Authorization/Presentation/Startup/StartupView.swift new file mode 100644 index 000000000..b2c358ca2 --- /dev/null +++ b/Authorization/Authorization/Presentation/Startup/StartupView.swift @@ -0,0 +1,124 @@ +// +// StartupView.swift +// Authorization +// +// Created by SaeedBashir on 10/23/23. +// + +import Foundation +import SwiftUI +import Core + +public struct StartupView: View { + + @State private var searchQuery: String = "" + + @Environment(\.isHorizontal) private var isHorizontal + + @ObservedObject + private var viewModel: StartupViewModel + + public init(viewModel: StartupViewModel) { + self.viewModel = viewModel + } + + public var body: some View { + ZStack(alignment: .top) { + VStack(alignment: .leading) { + CoreAssets.appLogo.swiftUIImage + .resizable() + .frame(maxWidth: 189, maxHeight: 54) + .padding(.top, isHorizontal ? 20 : 40) + .padding(.bottom, isHorizontal ? 0 : 20) + .padding(.horizontal, isHorizontal ? 10 : 24) + .colorMultiply(Theme.Colors.accentColor) + + VStack { + VStack(alignment: .leading) { + Text(AuthLocalization.Startup.infoMessage) + .font(Theme.Fonts.titleLarge) + .foregroundColor(Theme.Colors.textPrimary) + .padding(.bottom, isHorizontal ? 10 : 20 ) + + Text(AuthLocalization.Startup.searchTitle) + .font(Theme.Fonts.bodyLarge) + .bold() + .foregroundColor(Theme.Colors.textPrimary) + .padding(.top, isHorizontal ? 0 : 24) + + HStack(spacing: 11) { + Image(systemName: "magnifyingglass") + .padding(.leading, 16) + .padding(.top, 1) + TextField(AuthLocalization.Startup.searchPlaceholder, text: $searchQuery, onCommit: { + if searchQuery.isEmpty { return } + viewModel.router.showDiscoveryScreen(searchQuery: searchQuery, fromStartupScreen: true) + }) + .autocapitalization(.none) + .autocorrectionDisabled() + .frame(minHeight: 50) + .submitLabel(.search) + + }.overlay( + Theme.Shapes.textInputShape + .stroke(lineWidth: 1) + .fill(Theme.Colors.textInputStroke) + ) + .background( + Theme.Shapes.textInputShape + .fill(Theme.Colors.textInputBackground) + ) + + Button { + viewModel.router.showDiscoveryScreen(searchQuery: searchQuery, fromStartupScreen: true) + } label: { + Text(AuthLocalization.Startup.exploreAllCourses) + .underline() + .foregroundColor(Theme.Colors.accentColor) + .font(Theme.Fonts.bodyLarge) + } + .padding(.top, isHorizontal ? 0 : 5) + Spacer() + } + .padding(.horizontal, isHorizontal ? 10 : 24) + + LogistrationBottomView(viewModel: viewModel) + } + .padding(.top, 10) + .padding(.bottom, 2) + } + .onDisappear { + searchQuery = "" + } + } + .hideNavigationBar() + .padding(.all, isHorizontal ? 1 : 0) + .background(Theme.Colors.background.ignoresSafeArea(.all)) + .ignoresSafeArea(.keyboard, edges: .bottom) + .onTapGesture { + UIApplication.shared.endEditing() + } + } +} + +#if DEBUG +struct StartupView_Previews: PreviewProvider { + static var previews: some View { + let vm = StartupViewModel( + interactor: AuthInteractor.mock, + router: AuthorizationRouterMock(), + analytics: AuthorizationAnalyticsMock() + ) + + StartupView(viewModel: vm) + .preferredColorScheme(.light) + .previewDisplayName("StartupView Light") + .loadFonts() + + StartupView(viewModel: vm) + .preferredColorScheme(.dark) + .previewDisplayName("StartupView Dark") + .loadFonts() + } +} +#endif diff --git a/Authorization/Authorization/Presentation/Startup/StartupViewModel.swift b/Authorization/Authorization/Presentation/Startup/StartupViewModel.swift new file mode 100644 index 000000000..1a13aaea9 --- /dev/null +++ b/Authorization/Authorization/Presentation/Startup/StartupViewModel.swift @@ -0,0 +1,30 @@ +// +// StartupViewModel.swift +// Authorization +// +// Created by SaeedBashir on 10/23/23. +// + +import Foundation +import Core + +public class StartupViewModel: ObservableObject { + let router: AuthorizationRouter + private let interactor: AuthInteractorProtocol + private let analytics: AuthorizationAnalytics + @Published var searchQuery: String? + + public init( + interactor: AuthInteractorProtocol, + router: AuthorizationRouter, + analytics: AuthorizationAnalytics + ) { + self.interactor = interactor + self.router = router + self.analytics = analytics + } + + func tracksignUpClicked() { + analytics.signUpClicked() + } +} diff --git a/Authorization/Authorization/SwiftGen/Strings.swift b/Authorization/Authorization/SwiftGen/Strings.swift index aa8fe2f35..512465414 100644 --- a/Authorization/Authorization/SwiftGen/Strings.swift +++ b/Authorization/Authorization/SwiftGen/Strings.swift @@ -63,6 +63,16 @@ public enum AuthLocalization { /// Sign up public static let title = AuthLocalization.tr("Localizable", "SIGN_UP.TITLE", fallback: "Sign up") } + public enum Startup { + /// Explore all courses + public static let exploreAllCourses = AuthLocalization.tr("Localizable", "STARTUP.EXPLORE_ALL_COURSES", fallback: "Explore all courses") + /// Courses and programs from the world's best universities in your pocket. + public static let infoMessage = AuthLocalization.tr("Localizable", "STARTUP.INFO_MESSAGE", fallback: "Courses and programs from the world's best universities in your pocket.") + /// Search our 3000+ courses + public static let searchPlaceholder = AuthLocalization.tr("Localizable", "STARTUP.SEARCH_PLACEHOLDER", fallback: "Search our 3000+ courses") + /// What do you want to learn? + public static let searchTitle = AuthLocalization.tr("Localizable", "STARTUP.SEARCH_TITLE", fallback: "What do you want to learn?") + } } // swiftlint:enable explicit_type_interface function_parameter_count identifier_name line_length // swiftlint:enable nesting type_body_length type_name vertical_whitespace_opening_braces diff --git a/Authorization/Authorization/en.lproj/Localizable.strings b/Authorization/Authorization/en.lproj/Localizable.strings index 8c58b2406..d6c2890b5 100644 --- a/Authorization/Authorization/en.lproj/Localizable.strings +++ b/Authorization/Authorization/en.lproj/Localizable.strings @@ -30,3 +30,8 @@ "FORGOT.REQUEST" = "Reset password"; "FORGOT.CHECK_TITLE" = "Check your email"; "FORGOT.CHECK_Description" = "We have sent a password recover instructions to your email "; + +"STARTUP.INFO_MESSAGE" = "Courses and programs from the world's best universities in your pocket."; +"STARTUP.SEARCH_TITLE" = "What do you want to learn?"; +"STARTUP.SEARCH_PLACEHOLDER" = "Search our 3000+ courses"; +"STARTUP.EXPLORE_ALL_COURSES" = "Explore all courses"; diff --git a/Authorization/Authorization/uk.lproj/Localizable.strings b/Authorization/Authorization/uk.lproj/Localizable.strings index cc06c89a0..3a334d6d4 100644 --- a/Authorization/Authorization/uk.lproj/Localizable.strings +++ b/Authorization/Authorization/uk.lproj/Localizable.strings @@ -28,3 +28,8 @@ "FORGOT.REQUEST" = "Відновити пароль"; "FORGOT.CHECK_TITLE" = "Перевірте свою електронну пошту"; "FORGOT.CHECK_Description" = "Ми надіслали інструкції щодо відновлення пароля на вашу електронну пошту "; + +"STARTUP.INFO_MESSAGE" = "Courses and programs from the world's best universities in your pocket."; +"STARTUP.SEARCH_TITLE" = "What do you want to learn?"; +"STARTUP.SEARCH_PLACEHOLDER" = "Search our 3000+ courses"; +"STARTUP.EXPLORE_ALL_COURSES" = "Explore all courses"; diff --git a/Authorization/AuthorizationTests/AuthorizationMock.generated.swift b/Authorization/AuthorizationTests/AuthorizationMock.generated.swift index 2afc95ada..98aae1963 100644 --- a/Authorization/AuthorizationTests/AuthorizationMock.generated.swift +++ b/Authorization/AuthorizationTests/AuthorizationMock.generated.swift @@ -773,6 +773,12 @@ open class AuthorizationRouterMock: AuthorizationRouter, Mock { perform?() } + open func showStartupScreen() { + addInvocation(.m_showStartupScreen) + let perform = methodPerformValue(.m_showStartupScreen) as? () -> Void + perform?() + } + open func showLoginScreen() { addInvocation(.m_showLoginScreen) let perform = methodPerformValue(.m_showLoginScreen) as? () -> Void @@ -791,6 +797,12 @@ open class AuthorizationRouterMock: AuthorizationRouter, Mock { perform?() } + open func showDiscoveryScreen(searchQuery: String?, fromStartupScreen: Bool) { + addInvocation(.m_showDiscoveryScreen__searchQuery_searchQueryfromStartupScreen_fromStartupScreen(Parameter.value(`searchQuery`), Parameter.value(`fromStartupScreen`))) + let perform = methodPerformValue(.m_showDiscoveryScreen__searchQuery_searchQueryfromStartupScreen_fromStartupScreen(Parameter.value(`searchQuery`), Parameter.value(`fromStartupScreen`))) as? (String?, Bool) -> Void + perform?(`searchQuery`, `fromStartupScreen`) + } + open func presentAlert(alertTitle: String, alertMessage: String, positiveAction: String, onCloseTapped: @escaping () -> Void, okTapped: @escaping () -> Void, type: AlertViewType) { addInvocation(.m_presentAlert__alertTitle_alertTitlealertMessage_alertMessagepositiveAction_positiveActiononCloseTapped_onCloseTappedokTapped_okTappedtype_type(Parameter.value(`alertTitle`), Parameter.value(`alertMessage`), Parameter.value(`positiveAction`), Parameter<() -> Void>.value(`onCloseTapped`), Parameter<() -> Void>.value(`okTapped`), Parameter.value(`type`))) let perform = methodPerformValue(.m_presentAlert__alertTitle_alertTitlealertMessage_alertMessagepositiveAction_positiveActiononCloseTapped_onCloseTappedokTapped_okTappedtype_type(Parameter.value(`alertTitle`), Parameter.value(`alertMessage`), Parameter.value(`positiveAction`), Parameter<() -> Void>.value(`onCloseTapped`), Parameter<() -> Void>.value(`okTapped`), Parameter.value(`type`))) as? (String, String, String, @escaping () -> Void, @escaping () -> Void, AlertViewType) -> Void @@ -824,9 +836,11 @@ open class AuthorizationRouterMock: AuthorizationRouter, Mock { case m_dismiss__animated_animated(Parameter) case m_removeLastView__controllers_controllers(Parameter) case m_showMainOrWhatsNewScreen + case m_showStartupScreen case m_showLoginScreen case m_showRegisterScreen case m_showForgotPasswordScreen + case m_showDiscoveryScreen__searchQuery_searchQueryfromStartupScreen_fromStartupScreen(Parameter, Parameter) case m_presentAlert__alertTitle_alertTitlealertMessage_alertMessagepositiveAction_positiveActiononCloseTapped_onCloseTappedokTapped_okTappedtype_type(Parameter, Parameter, Parameter, Parameter<() -> Void>, Parameter<() -> Void>, Parameter) case m_presentAlert__alertTitle_alertTitlealertMessage_alertMessagenextSectionName_nextSectionNameaction_actionimage_imageonCloseTapped_onCloseTappedokTapped_okTappednextSectionTapped_nextSectionTapped(Parameter, Parameter, Parameter, Parameter, Parameter, Parameter<() -> Void>, Parameter<() -> Void>, Parameter<() -> Void>) case m_presentView__transitionStyle_transitionStyleview_view(Parameter, Parameter) @@ -863,12 +877,20 @@ open class AuthorizationRouterMock: AuthorizationRouter, Mock { case (.m_showMainOrWhatsNewScreen, .m_showMainOrWhatsNewScreen): return .match + case (.m_showStartupScreen, .m_showStartupScreen): return .match + case (.m_showLoginScreen, .m_showLoginScreen): return .match case (.m_showRegisterScreen, .m_showRegisterScreen): return .match case (.m_showForgotPasswordScreen, .m_showForgotPasswordScreen): return .match + case (.m_showDiscoveryScreen__searchQuery_searchQueryfromStartupScreen_fromStartupScreen(let lhsSearchquery, let lhsFromstartupscreen), .m_showDiscoveryScreen__searchQuery_searchQueryfromStartupScreen_fromStartupScreen(let rhsSearchquery, let rhsFromstartupscreen)): + var results: [Matcher.ParameterComparisonResult] = [] + results.append(Matcher.ParameterComparisonResult(Parameter.compare(lhs: lhsSearchquery, rhs: rhsSearchquery, with: matcher), lhsSearchquery, rhsSearchquery, "searchQuery")) + results.append(Matcher.ParameterComparisonResult(Parameter.compare(lhs: lhsFromstartupscreen, rhs: rhsFromstartupscreen, with: matcher), lhsFromstartupscreen, rhsFromstartupscreen, "fromStartupScreen")) + return Matcher.ComparisonResult(results) + case (.m_presentAlert__alertTitle_alertTitlealertMessage_alertMessagepositiveAction_positiveActiononCloseTapped_onCloseTappedokTapped_okTappedtype_type(let lhsAlerttitle, let lhsAlertmessage, let lhsPositiveaction, let lhsOnclosetapped, let lhsOktapped, let lhsType), .m_presentAlert__alertTitle_alertTitlealertMessage_alertMessagepositiveAction_positiveActiononCloseTapped_onCloseTappedokTapped_okTappedtype_type(let rhsAlerttitle, let rhsAlertmessage, let rhsPositiveaction, let rhsOnclosetapped, let rhsOktapped, let rhsType)): var results: [Matcher.ParameterComparisonResult] = [] results.append(Matcher.ParameterComparisonResult(Parameter.compare(lhs: lhsAlerttitle, rhs: rhsAlerttitle, with: matcher), lhsAlerttitle, rhsAlerttitle, "alertTitle")) @@ -915,9 +937,11 @@ open class AuthorizationRouterMock: AuthorizationRouter, Mock { case let .m_dismiss__animated_animated(p0): return p0.intValue case let .m_removeLastView__controllers_controllers(p0): return p0.intValue case .m_showMainOrWhatsNewScreen: return 0 + case .m_showStartupScreen: return 0 case .m_showLoginScreen: return 0 case .m_showRegisterScreen: return 0 case .m_showForgotPasswordScreen: return 0 + case let .m_showDiscoveryScreen__searchQuery_searchQueryfromStartupScreen_fromStartupScreen(p0, p1): return p0.intValue + p1.intValue case let .m_presentAlert__alertTitle_alertTitlealertMessage_alertMessagepositiveAction_positiveActiononCloseTapped_onCloseTappedokTapped_okTappedtype_type(p0, p1, p2, p3, p4, p5): return p0.intValue + p1.intValue + p2.intValue + p3.intValue + p4.intValue + p5.intValue case let .m_presentAlert__alertTitle_alertTitlealertMessage_alertMessagenextSectionName_nextSectionNameaction_actionimage_imageonCloseTapped_onCloseTappedokTapped_okTappednextSectionTapped_nextSectionTapped(p0, p1, p2, p3, p4, p5, p6, p7): return p0.intValue + p1.intValue + p2.intValue + p3.intValue + p4.intValue + p5.intValue + p6.intValue + p7.intValue case let .m_presentView__transitionStyle_transitionStyleview_view(p0, p1): return p0.intValue + p1.intValue @@ -933,9 +957,11 @@ open class AuthorizationRouterMock: AuthorizationRouter, Mock { case .m_dismiss__animated_animated: return ".dismiss(animated:)" case .m_removeLastView__controllers_controllers: return ".removeLastView(controllers:)" case .m_showMainOrWhatsNewScreen: return ".showMainOrWhatsNewScreen()" + case .m_showStartupScreen: return ".showStartupScreen()" case .m_showLoginScreen: return ".showLoginScreen()" case .m_showRegisterScreen: return ".showRegisterScreen()" case .m_showForgotPasswordScreen: return ".showForgotPasswordScreen()" + case .m_showDiscoveryScreen__searchQuery_searchQueryfromStartupScreen_fromStartupScreen: return ".showDiscoveryScreen(searchQuery:fromStartupScreen:)" case .m_presentAlert__alertTitle_alertTitlealertMessage_alertMessagepositiveAction_positiveActiononCloseTapped_onCloseTappedokTapped_okTappedtype_type: return ".presentAlert(alertTitle:alertMessage:positiveAction:onCloseTapped:okTapped:type:)" case .m_presentAlert__alertTitle_alertTitlealertMessage_alertMessagenextSectionName_nextSectionNameaction_actionimage_imageonCloseTapped_onCloseTappedokTapped_okTappednextSectionTapped_nextSectionTapped: return ".presentAlert(alertTitle:alertMessage:nextSectionName:action:image:onCloseTapped:okTapped:nextSectionTapped:)" case .m_presentView__transitionStyle_transitionStyleview_view: return ".presentView(transitionStyle:view:)" @@ -965,9 +991,11 @@ open class AuthorizationRouterMock: AuthorizationRouter, Mock { public static func dismiss(animated: Parameter) -> Verify { return Verify(method: .m_dismiss__animated_animated(`animated`))} public static func removeLastView(controllers: Parameter) -> Verify { return Verify(method: .m_removeLastView__controllers_controllers(`controllers`))} public static func showMainOrWhatsNewScreen() -> Verify { return Verify(method: .m_showMainOrWhatsNewScreen)} + public static func showStartupScreen() -> Verify { return Verify(method: .m_showStartupScreen)} public static func showLoginScreen() -> Verify { return Verify(method: .m_showLoginScreen)} public static func showRegisterScreen() -> Verify { return Verify(method: .m_showRegisterScreen)} public static func showForgotPasswordScreen() -> Verify { return Verify(method: .m_showForgotPasswordScreen)} + public static func showDiscoveryScreen(searchQuery: Parameter, fromStartupScreen: Parameter) -> Verify { return Verify(method: .m_showDiscoveryScreen__searchQuery_searchQueryfromStartupScreen_fromStartupScreen(`searchQuery`, `fromStartupScreen`))} public static func presentAlert(alertTitle: Parameter, alertMessage: Parameter, positiveAction: Parameter, onCloseTapped: Parameter<() -> Void>, okTapped: Parameter<() -> Void>, type: Parameter) -> Verify { return Verify(method: .m_presentAlert__alertTitle_alertTitlealertMessage_alertMessagepositiveAction_positiveActiononCloseTapped_onCloseTappedokTapped_okTappedtype_type(`alertTitle`, `alertMessage`, `positiveAction`, `onCloseTapped`, `okTapped`, `type`))} public static func presentAlert(alertTitle: Parameter, alertMessage: Parameter, nextSectionName: Parameter, action: Parameter, image: Parameter, onCloseTapped: Parameter<() -> Void>, okTapped: Parameter<() -> Void>, nextSectionTapped: Parameter<() -> Void>) -> Verify { return Verify(method: .m_presentAlert__alertTitle_alertTitlealertMessage_alertMessagenextSectionName_nextSectionNameaction_actionimage_imageonCloseTapped_onCloseTappedokTapped_okTappednextSectionTapped_nextSectionTapped(`alertTitle`, `alertMessage`, `nextSectionName`, `action`, `image`, `onCloseTapped`, `okTapped`, `nextSectionTapped`))} public static func presentView(transitionStyle: Parameter, view: Parameter) -> Verify { return Verify(method: .m_presentView__transitionStyle_transitionStyleview_view(`transitionStyle`, `view`))} @@ -999,6 +1027,9 @@ open class AuthorizationRouterMock: AuthorizationRouter, Mock { public static func showMainOrWhatsNewScreen(perform: @escaping () -> Void) -> Perform { return Perform(method: .m_showMainOrWhatsNewScreen, performs: perform) } + public static func showStartupScreen(perform: @escaping () -> Void) -> Perform { + return Perform(method: .m_showStartupScreen, performs: perform) + } public static func showLoginScreen(perform: @escaping () -> Void) -> Perform { return Perform(method: .m_showLoginScreen, performs: perform) } @@ -1008,6 +1039,9 @@ open class AuthorizationRouterMock: AuthorizationRouter, Mock { public static func showForgotPasswordScreen(perform: @escaping () -> Void) -> Perform { return Perform(method: .m_showForgotPasswordScreen, performs: perform) } + public static func showDiscoveryScreen(searchQuery: Parameter, fromStartupScreen: Parameter, perform: @escaping (String?, Bool) -> Void) -> Perform { + return Perform(method: .m_showDiscoveryScreen__searchQuery_searchQueryfromStartupScreen_fromStartupScreen(`searchQuery`, `fromStartupScreen`), performs: perform) + } public static func presentAlert(alertTitle: Parameter, alertMessage: Parameter, positiveAction: Parameter, onCloseTapped: Parameter<() -> Void>, okTapped: Parameter<() -> Void>, type: Parameter, perform: @escaping (String, String, String, @escaping () -> Void, @escaping () -> Void, AlertViewType) -> Void) -> Perform { return Perform(method: .m_presentAlert__alertTitle_alertTitlealertMessage_alertMessagepositiveAction_positiveActiononCloseTapped_onCloseTappedokTapped_okTappedtype_type(`alertTitle`, `alertMessage`, `positiveAction`, `onCloseTapped`, `okTapped`, `type`), performs: perform) } @@ -1175,6 +1209,12 @@ open class BaseRouterMock: BaseRouter, Mock { perform?() } + open func showStartupScreen() { + addInvocation(.m_showStartupScreen) + let perform = methodPerformValue(.m_showStartupScreen) as? () -> Void + perform?() + } + open func showLoginScreen() { addInvocation(.m_showLoginScreen) let perform = methodPerformValue(.m_showLoginScreen) as? () -> Void @@ -1193,6 +1233,12 @@ open class BaseRouterMock: BaseRouter, Mock { perform?() } + open func showDiscoveryScreen(searchQuery: String?, fromStartupScreen: Bool) { + addInvocation(.m_showDiscoveryScreen__searchQuery_searchQueryfromStartupScreen_fromStartupScreen(Parameter.value(`searchQuery`), Parameter.value(`fromStartupScreen`))) + let perform = methodPerformValue(.m_showDiscoveryScreen__searchQuery_searchQueryfromStartupScreen_fromStartupScreen(Parameter.value(`searchQuery`), Parameter.value(`fromStartupScreen`))) as? (String?, Bool) -> Void + perform?(`searchQuery`, `fromStartupScreen`) + } + open func presentAlert(alertTitle: String, alertMessage: String, positiveAction: String, onCloseTapped: @escaping () -> Void, okTapped: @escaping () -> Void, type: AlertViewType) { addInvocation(.m_presentAlert__alertTitle_alertTitlealertMessage_alertMessagepositiveAction_positiveActiononCloseTapped_onCloseTappedokTapped_okTappedtype_type(Parameter.value(`alertTitle`), Parameter.value(`alertMessage`), Parameter.value(`positiveAction`), Parameter<() -> Void>.value(`onCloseTapped`), Parameter<() -> Void>.value(`okTapped`), Parameter.value(`type`))) let perform = methodPerformValue(.m_presentAlert__alertTitle_alertTitlealertMessage_alertMessagepositiveAction_positiveActiononCloseTapped_onCloseTappedokTapped_okTappedtype_type(Parameter.value(`alertTitle`), Parameter.value(`alertMessage`), Parameter.value(`positiveAction`), Parameter<() -> Void>.value(`onCloseTapped`), Parameter<() -> Void>.value(`okTapped`), Parameter.value(`type`))) as? (String, String, String, @escaping () -> Void, @escaping () -> Void, AlertViewType) -> Void @@ -1225,9 +1271,11 @@ open class BaseRouterMock: BaseRouter, Mock { case m_dismiss__animated_animated(Parameter) case m_removeLastView__controllers_controllers(Parameter) case m_showMainOrWhatsNewScreen + case m_showStartupScreen case m_showLoginScreen case m_showRegisterScreen case m_showForgotPasswordScreen + case m_showDiscoveryScreen__searchQuery_searchQueryfromStartupScreen_fromStartupScreen(Parameter, Parameter) case m_presentAlert__alertTitle_alertTitlealertMessage_alertMessagepositiveAction_positiveActiononCloseTapped_onCloseTappedokTapped_okTappedtype_type(Parameter, Parameter, Parameter, Parameter<() -> Void>, Parameter<() -> Void>, Parameter) case m_presentAlert__alertTitle_alertTitlealertMessage_alertMessagenextSectionName_nextSectionNameaction_actionimage_imageonCloseTapped_onCloseTappedokTapped_okTappednextSectionTapped_nextSectionTapped(Parameter, Parameter, Parameter, Parameter, Parameter, Parameter<() -> Void>, Parameter<() -> Void>, Parameter<() -> Void>) case m_presentView__transitionStyle_transitionStyleview_view(Parameter, Parameter) @@ -1259,12 +1307,20 @@ open class BaseRouterMock: BaseRouter, Mock { case (.m_showMainOrWhatsNewScreen, .m_showMainOrWhatsNewScreen): return .match + case (.m_showStartupScreen, .m_showStartupScreen): return .match + case (.m_showLoginScreen, .m_showLoginScreen): return .match case (.m_showRegisterScreen, .m_showRegisterScreen): return .match case (.m_showForgotPasswordScreen, .m_showForgotPasswordScreen): return .match + case (.m_showDiscoveryScreen__searchQuery_searchQueryfromStartupScreen_fromStartupScreen(let lhsSearchquery, let lhsFromstartupscreen), .m_showDiscoveryScreen__searchQuery_searchQueryfromStartupScreen_fromStartupScreen(let rhsSearchquery, let rhsFromstartupscreen)): + var results: [Matcher.ParameterComparisonResult] = [] + results.append(Matcher.ParameterComparisonResult(Parameter.compare(lhs: lhsSearchquery, rhs: rhsSearchquery, with: matcher), lhsSearchquery, rhsSearchquery, "searchQuery")) + results.append(Matcher.ParameterComparisonResult(Parameter.compare(lhs: lhsFromstartupscreen, rhs: rhsFromstartupscreen, with: matcher), lhsFromstartupscreen, rhsFromstartupscreen, "fromStartupScreen")) + return Matcher.ComparisonResult(results) + case (.m_presentAlert__alertTitle_alertTitlealertMessage_alertMessagepositiveAction_positiveActiononCloseTapped_onCloseTappedokTapped_okTappedtype_type(let lhsAlerttitle, let lhsAlertmessage, let lhsPositiveaction, let lhsOnclosetapped, let lhsOktapped, let lhsType), .m_presentAlert__alertTitle_alertTitlealertMessage_alertMessagepositiveAction_positiveActiononCloseTapped_onCloseTappedokTapped_okTappedtype_type(let rhsAlerttitle, let rhsAlertmessage, let rhsPositiveaction, let rhsOnclosetapped, let rhsOktapped, let rhsType)): var results: [Matcher.ParameterComparisonResult] = [] results.append(Matcher.ParameterComparisonResult(Parameter.compare(lhs: lhsAlerttitle, rhs: rhsAlerttitle, with: matcher), lhsAlerttitle, rhsAlerttitle, "alertTitle")) @@ -1310,9 +1366,11 @@ open class BaseRouterMock: BaseRouter, Mock { case let .m_dismiss__animated_animated(p0): return p0.intValue case let .m_removeLastView__controllers_controllers(p0): return p0.intValue case .m_showMainOrWhatsNewScreen: return 0 + case .m_showStartupScreen: return 0 case .m_showLoginScreen: return 0 case .m_showRegisterScreen: return 0 case .m_showForgotPasswordScreen: return 0 + case let .m_showDiscoveryScreen__searchQuery_searchQueryfromStartupScreen_fromStartupScreen(p0, p1): return p0.intValue + p1.intValue case let .m_presentAlert__alertTitle_alertTitlealertMessage_alertMessagepositiveAction_positiveActiononCloseTapped_onCloseTappedokTapped_okTappedtype_type(p0, p1, p2, p3, p4, p5): return p0.intValue + p1.intValue + p2.intValue + p3.intValue + p4.intValue + p5.intValue case let .m_presentAlert__alertTitle_alertTitlealertMessage_alertMessagenextSectionName_nextSectionNameaction_actionimage_imageonCloseTapped_onCloseTappedokTapped_okTappednextSectionTapped_nextSectionTapped(p0, p1, p2, p3, p4, p5, p6, p7): return p0.intValue + p1.intValue + p2.intValue + p3.intValue + p4.intValue + p5.intValue + p6.intValue + p7.intValue case let .m_presentView__transitionStyle_transitionStyleview_view(p0, p1): return p0.intValue + p1.intValue @@ -1327,9 +1385,11 @@ open class BaseRouterMock: BaseRouter, Mock { case .m_dismiss__animated_animated: return ".dismiss(animated:)" case .m_removeLastView__controllers_controllers: return ".removeLastView(controllers:)" case .m_showMainOrWhatsNewScreen: return ".showMainOrWhatsNewScreen()" + case .m_showStartupScreen: return ".showStartupScreen()" case .m_showLoginScreen: return ".showLoginScreen()" case .m_showRegisterScreen: return ".showRegisterScreen()" case .m_showForgotPasswordScreen: return ".showForgotPasswordScreen()" + case .m_showDiscoveryScreen__searchQuery_searchQueryfromStartupScreen_fromStartupScreen: return ".showDiscoveryScreen(searchQuery:fromStartupScreen:)" case .m_presentAlert__alertTitle_alertTitlealertMessage_alertMessagepositiveAction_positiveActiononCloseTapped_onCloseTappedokTapped_okTappedtype_type: return ".presentAlert(alertTitle:alertMessage:positiveAction:onCloseTapped:okTapped:type:)" case .m_presentAlert__alertTitle_alertTitlealertMessage_alertMessagenextSectionName_nextSectionNameaction_actionimage_imageonCloseTapped_onCloseTappedokTapped_okTappednextSectionTapped_nextSectionTapped: return ".presentAlert(alertTitle:alertMessage:nextSectionName:action:image:onCloseTapped:okTapped:nextSectionTapped:)" case .m_presentView__transitionStyle_transitionStyleview_view: return ".presentView(transitionStyle:view:)" @@ -1358,9 +1418,11 @@ open class BaseRouterMock: BaseRouter, Mock { public static func dismiss(animated: Parameter) -> Verify { return Verify(method: .m_dismiss__animated_animated(`animated`))} public static func removeLastView(controllers: Parameter) -> Verify { return Verify(method: .m_removeLastView__controllers_controllers(`controllers`))} public static func showMainOrWhatsNewScreen() -> Verify { return Verify(method: .m_showMainOrWhatsNewScreen)} + public static func showStartupScreen() -> Verify { return Verify(method: .m_showStartupScreen)} public static func showLoginScreen() -> Verify { return Verify(method: .m_showLoginScreen)} public static func showRegisterScreen() -> Verify { return Verify(method: .m_showRegisterScreen)} public static func showForgotPasswordScreen() -> Verify { return Verify(method: .m_showForgotPasswordScreen)} + public static func showDiscoveryScreen(searchQuery: Parameter, fromStartupScreen: Parameter) -> Verify { return Verify(method: .m_showDiscoveryScreen__searchQuery_searchQueryfromStartupScreen_fromStartupScreen(`searchQuery`, `fromStartupScreen`))} public static func presentAlert(alertTitle: Parameter, alertMessage: Parameter, positiveAction: Parameter, onCloseTapped: Parameter<() -> Void>, okTapped: Parameter<() -> Void>, type: Parameter) -> Verify { return Verify(method: .m_presentAlert__alertTitle_alertTitlealertMessage_alertMessagepositiveAction_positiveActiononCloseTapped_onCloseTappedokTapped_okTappedtype_type(`alertTitle`, `alertMessage`, `positiveAction`, `onCloseTapped`, `okTapped`, `type`))} public static func presentAlert(alertTitle: Parameter, alertMessage: Parameter, nextSectionName: Parameter, action: Parameter, image: Parameter, onCloseTapped: Parameter<() -> Void>, okTapped: Parameter<() -> Void>, nextSectionTapped: Parameter<() -> Void>) -> Verify { return Verify(method: .m_presentAlert__alertTitle_alertTitlealertMessage_alertMessagenextSectionName_nextSectionNameaction_actionimage_imageonCloseTapped_onCloseTappedokTapped_okTappednextSectionTapped_nextSectionTapped(`alertTitle`, `alertMessage`, `nextSectionName`, `action`, `image`, `onCloseTapped`, `okTapped`, `nextSectionTapped`))} public static func presentView(transitionStyle: Parameter, view: Parameter) -> Verify { return Verify(method: .m_presentView__transitionStyle_transitionStyleview_view(`transitionStyle`, `view`))} @@ -1389,6 +1451,9 @@ open class BaseRouterMock: BaseRouter, Mock { public static func showMainOrWhatsNewScreen(perform: @escaping () -> Void) -> Perform { return Perform(method: .m_showMainOrWhatsNewScreen, performs: perform) } + public static func showStartupScreen(perform: @escaping () -> Void) -> Perform { + return Perform(method: .m_showStartupScreen, performs: perform) + } public static func showLoginScreen(perform: @escaping () -> Void) -> Perform { return Perform(method: .m_showLoginScreen, performs: perform) } @@ -1398,6 +1463,9 @@ open class BaseRouterMock: BaseRouter, Mock { public static func showForgotPasswordScreen(perform: @escaping () -> Void) -> Perform { return Perform(method: .m_showForgotPasswordScreen, performs: perform) } + public static func showDiscoveryScreen(searchQuery: Parameter, fromStartupScreen: Parameter, perform: @escaping (String?, Bool) -> Void) -> Perform { + return Perform(method: .m_showDiscoveryScreen__searchQuery_searchQueryfromStartupScreen_fromStartupScreen(`searchQuery`, `fromStartupScreen`), performs: perform) + } public static func presentAlert(alertTitle: Parameter, alertMessage: Parameter, positiveAction: Parameter, onCloseTapped: Parameter<() -> Void>, okTapped: Parameter<() -> Void>, type: Parameter, perform: @escaping (String, String, String, @escaping () -> Void, @escaping () -> Void, AlertViewType) -> Void) -> Perform { return Perform(method: .m_presentAlert__alertTitle_alertTitlealertMessage_alertMessagepositiveAction_positiveActiononCloseTapped_onCloseTappedokTapped_okTappedtype_type(`alertTitle`, `alertMessage`, `positiveAction`, `onCloseTapped`, `okTapped`, `type`), performs: perform) } diff --git a/Core/Core/Configuration/BaseRouter.swift b/Core/Core/Configuration/BaseRouter.swift index 034855d87..a153aa067 100644 --- a/Core/Core/Configuration/BaseRouter.swift +++ b/Core/Core/Configuration/BaseRouter.swift @@ -22,12 +22,16 @@ public protocol BaseRouter { func removeLastView(controllers: Int) func showMainOrWhatsNewScreen() - + + func showStartupScreen() + func showLoginScreen() - + func showRegisterScreen() func showForgotPasswordScreen() + + func showDiscoveryScreen(searchQuery: String?, fromStartupScreen: Bool) func presentAlert( alertTitle: String, @@ -74,13 +78,17 @@ open class BaseRouterMock: BaseRouter { public func dismiss(animated: Bool) {} public func showMainOrWhatsNewScreen() {} + + public func showStartupScreen() {} public func showLoginScreen() {} - + public func showRegisterScreen() {} public func showForgotPasswordScreen() {} + public func showDiscoveryScreen(searchQuery: String?, fromStartupScreen: Bool) {} + public func backToRoot(animated: Bool) {} public func back(animated: Bool) {} diff --git a/Core/Core/Configuration/Config/FeaturesConfig.swift b/Core/Core/Configuration/Config/FeaturesConfig.swift index eb6c6227f..eec9e9853 100644 --- a/Core/Core/Configuration/Config/FeaturesConfig.swift +++ b/Core/Core/Configuration/Config/FeaturesConfig.swift @@ -9,13 +9,16 @@ import Foundation private enum FeaturesKeys: String { case whatNewEnabled = "WHATS_NEW_ENABLED" + case startupScreenEnabled = "PRE_LOGIN_EXPERIENCE_ENABLED" } public class FeaturesConfig: NSObject { public var whatNewEnabled: Bool + public var startupScreenEnabled: Bool init(dictionary: [String: Any]) { whatNewEnabled = dictionary[FeaturesKeys.whatNewEnabled.rawValue] as? Bool ?? false + startupScreenEnabled = dictionary[FeaturesKeys.startupScreenEnabled.rawValue] as? Bool ?? false super.init() } } diff --git a/Core/Core/View/Base/StyledButton.swift b/Core/Core/View/Base/StyledButton.swift index fdad6a1d1..92ef56e84 100644 --- a/Core/Core/View/Base/StyledButton.swift +++ b/Core/Core/View/Base/StyledButton.swift @@ -8,29 +8,35 @@ import SwiftUI public struct StyledButton: View { - private let title: String private let action: () -> Void private let isTransparent: Bool private var idiom: UIUserInterfaceIdiom { UIDevice.current.userInterfaceIdiom } private let buttonColor: Color private let textColor: Color + private let disabledTextColor: Color private let isActive: Bool + private let borderColor: Color public init(_ title: String, action: @escaping () -> Void, isTransparent: Bool = false, color: Color = Theme.Colors.accentColor, + textColor: Color = Theme.Colors.styledButtonText, + disabledTextColor: Color = Theme.Colors.textPrimary, + borderColor: Color = .clear, isActive: Bool = true) { self.title = title self.action = action self.isTransparent = isTransparent + self.textColor = textColor + self.disabledTextColor = disabledTextColor + self.borderColor = borderColor + if isActive { self.buttonColor = color - self.textColor = Theme.Colors.styledButtonText } else { self.buttonColor = Theme.Colors.cardViewStroke - self.textColor = Theme.Colors.textPrimary } self.isActive = isActive } @@ -39,7 +45,7 @@ public struct StyledButton: View { Button(action: action) { Text(title) .tracking(isTransparent ? 0 : 1.3) - .foregroundColor(textColor) + .foregroundColor(isActive ? textColor : disabledTextColor) .font(Theme.Fonts.labelLarge) .frame(maxWidth: .infinity) .padding(.horizontal, 16) @@ -53,7 +59,7 @@ public struct StyledButton: View { .overlay( RoundedRectangle(cornerRadius: 8) .stroke(style: .init(lineWidth: 1, lineCap: .round, lineJoin: .round, miterLimit: 1)) - .foregroundColor(isTransparent ? .white : .clear) + .foregroundColor(isTransparent ? .white : borderColor) ) .accessibilityElement(children: .ignore) .accessibilityLabel(title) diff --git a/Course/CourseTests/CourseMock.generated.swift b/Course/CourseTests/CourseMock.generated.swift index 8c909304b..0c093e89c 100644 --- a/Course/CourseTests/CourseMock.generated.swift +++ b/Course/CourseTests/CourseMock.generated.swift @@ -496,6 +496,12 @@ open class BaseRouterMock: BaseRouter, Mock { perform?() } + open func showStartupScreen() { + addInvocation(.m_showStartupScreen) + let perform = methodPerformValue(.m_showStartupScreen) as? () -> Void + perform?() + } + open func showLoginScreen() { addInvocation(.m_showLoginScreen) let perform = methodPerformValue(.m_showLoginScreen) as? () -> Void @@ -514,6 +520,12 @@ open class BaseRouterMock: BaseRouter, Mock { perform?() } + open func showDiscoveryScreen(searchQuery: String?, fromStartupScreen: Bool) { + addInvocation(.m_showDiscoveryScreen__searchQuery_searchQueryfromStartupScreen_fromStartupScreen(Parameter.value(`searchQuery`), Parameter.value(`fromStartupScreen`))) + let perform = methodPerformValue(.m_showDiscoveryScreen__searchQuery_searchQueryfromStartupScreen_fromStartupScreen(Parameter.value(`searchQuery`), Parameter.value(`fromStartupScreen`))) as? (String?, Bool) -> Void + perform?(`searchQuery`, `fromStartupScreen`) + } + open func presentAlert(alertTitle: String, alertMessage: String, positiveAction: String, onCloseTapped: @escaping () -> Void, okTapped: @escaping () -> Void, type: AlertViewType) { addInvocation(.m_presentAlert__alertTitle_alertTitlealertMessage_alertMessagepositiveAction_positiveActiononCloseTapped_onCloseTappedokTapped_okTappedtype_type(Parameter.value(`alertTitle`), Parameter.value(`alertMessage`), Parameter.value(`positiveAction`), Parameter<() -> Void>.value(`onCloseTapped`), Parameter<() -> Void>.value(`okTapped`), Parameter.value(`type`))) let perform = methodPerformValue(.m_presentAlert__alertTitle_alertTitlealertMessage_alertMessagepositiveAction_positiveActiononCloseTapped_onCloseTappedokTapped_okTappedtype_type(Parameter.value(`alertTitle`), Parameter.value(`alertMessage`), Parameter.value(`positiveAction`), Parameter<() -> Void>.value(`onCloseTapped`), Parameter<() -> Void>.value(`okTapped`), Parameter.value(`type`))) as? (String, String, String, @escaping () -> Void, @escaping () -> Void, AlertViewType) -> Void @@ -546,9 +558,11 @@ open class BaseRouterMock: BaseRouter, Mock { case m_dismiss__animated_animated(Parameter) case m_removeLastView__controllers_controllers(Parameter) case m_showMainOrWhatsNewScreen + case m_showStartupScreen case m_showLoginScreen case m_showRegisterScreen case m_showForgotPasswordScreen + case m_showDiscoveryScreen__searchQuery_searchQueryfromStartupScreen_fromStartupScreen(Parameter, Parameter) case m_presentAlert__alertTitle_alertTitlealertMessage_alertMessagepositiveAction_positiveActiononCloseTapped_onCloseTappedokTapped_okTappedtype_type(Parameter, Parameter, Parameter, Parameter<() -> Void>, Parameter<() -> Void>, Parameter) case m_presentAlert__alertTitle_alertTitlealertMessage_alertMessagenextSectionName_nextSectionNameaction_actionimage_imageonCloseTapped_onCloseTappedokTapped_okTappednextSectionTapped_nextSectionTapped(Parameter, Parameter, Parameter, Parameter, Parameter, Parameter<() -> Void>, Parameter<() -> Void>, Parameter<() -> Void>) case m_presentView__transitionStyle_transitionStyleview_view(Parameter, Parameter) @@ -580,12 +594,20 @@ open class BaseRouterMock: BaseRouter, Mock { case (.m_showMainOrWhatsNewScreen, .m_showMainOrWhatsNewScreen): return .match + case (.m_showStartupScreen, .m_showStartupScreen): return .match + case (.m_showLoginScreen, .m_showLoginScreen): return .match case (.m_showRegisterScreen, .m_showRegisterScreen): return .match case (.m_showForgotPasswordScreen, .m_showForgotPasswordScreen): return .match + case (.m_showDiscoveryScreen__searchQuery_searchQueryfromStartupScreen_fromStartupScreen(let lhsSearchquery, let lhsFromstartupscreen), .m_showDiscoveryScreen__searchQuery_searchQueryfromStartupScreen_fromStartupScreen(let rhsSearchquery, let rhsFromstartupscreen)): + var results: [Matcher.ParameterComparisonResult] = [] + results.append(Matcher.ParameterComparisonResult(Parameter.compare(lhs: lhsSearchquery, rhs: rhsSearchquery, with: matcher), lhsSearchquery, rhsSearchquery, "searchQuery")) + results.append(Matcher.ParameterComparisonResult(Parameter.compare(lhs: lhsFromstartupscreen, rhs: rhsFromstartupscreen, with: matcher), lhsFromstartupscreen, rhsFromstartupscreen, "fromStartupScreen")) + return Matcher.ComparisonResult(results) + case (.m_presentAlert__alertTitle_alertTitlealertMessage_alertMessagepositiveAction_positiveActiononCloseTapped_onCloseTappedokTapped_okTappedtype_type(let lhsAlerttitle, let lhsAlertmessage, let lhsPositiveaction, let lhsOnclosetapped, let lhsOktapped, let lhsType), .m_presentAlert__alertTitle_alertTitlealertMessage_alertMessagepositiveAction_positiveActiononCloseTapped_onCloseTappedokTapped_okTappedtype_type(let rhsAlerttitle, let rhsAlertmessage, let rhsPositiveaction, let rhsOnclosetapped, let rhsOktapped, let rhsType)): var results: [Matcher.ParameterComparisonResult] = [] results.append(Matcher.ParameterComparisonResult(Parameter.compare(lhs: lhsAlerttitle, rhs: rhsAlerttitle, with: matcher), lhsAlerttitle, rhsAlerttitle, "alertTitle")) @@ -631,9 +653,11 @@ open class BaseRouterMock: BaseRouter, Mock { case let .m_dismiss__animated_animated(p0): return p0.intValue case let .m_removeLastView__controllers_controllers(p0): return p0.intValue case .m_showMainOrWhatsNewScreen: return 0 + case .m_showStartupScreen: return 0 case .m_showLoginScreen: return 0 case .m_showRegisterScreen: return 0 case .m_showForgotPasswordScreen: return 0 + case let .m_showDiscoveryScreen__searchQuery_searchQueryfromStartupScreen_fromStartupScreen(p0, p1): return p0.intValue + p1.intValue case let .m_presentAlert__alertTitle_alertTitlealertMessage_alertMessagepositiveAction_positiveActiononCloseTapped_onCloseTappedokTapped_okTappedtype_type(p0, p1, p2, p3, p4, p5): return p0.intValue + p1.intValue + p2.intValue + p3.intValue + p4.intValue + p5.intValue case let .m_presentAlert__alertTitle_alertTitlealertMessage_alertMessagenextSectionName_nextSectionNameaction_actionimage_imageonCloseTapped_onCloseTappedokTapped_okTappednextSectionTapped_nextSectionTapped(p0, p1, p2, p3, p4, p5, p6, p7): return p0.intValue + p1.intValue + p2.intValue + p3.intValue + p4.intValue + p5.intValue + p6.intValue + p7.intValue case let .m_presentView__transitionStyle_transitionStyleview_view(p0, p1): return p0.intValue + p1.intValue @@ -648,9 +672,11 @@ open class BaseRouterMock: BaseRouter, Mock { case .m_dismiss__animated_animated: return ".dismiss(animated:)" case .m_removeLastView__controllers_controllers: return ".removeLastView(controllers:)" case .m_showMainOrWhatsNewScreen: return ".showMainOrWhatsNewScreen()" + case .m_showStartupScreen: return ".showStartupScreen()" case .m_showLoginScreen: return ".showLoginScreen()" case .m_showRegisterScreen: return ".showRegisterScreen()" case .m_showForgotPasswordScreen: return ".showForgotPasswordScreen()" + case .m_showDiscoveryScreen__searchQuery_searchQueryfromStartupScreen_fromStartupScreen: return ".showDiscoveryScreen(searchQuery:fromStartupScreen:)" case .m_presentAlert__alertTitle_alertTitlealertMessage_alertMessagepositiveAction_positiveActiononCloseTapped_onCloseTappedokTapped_okTappedtype_type: return ".presentAlert(alertTitle:alertMessage:positiveAction:onCloseTapped:okTapped:type:)" case .m_presentAlert__alertTitle_alertTitlealertMessage_alertMessagenextSectionName_nextSectionNameaction_actionimage_imageonCloseTapped_onCloseTappedokTapped_okTappednextSectionTapped_nextSectionTapped: return ".presentAlert(alertTitle:alertMessage:nextSectionName:action:image:onCloseTapped:okTapped:nextSectionTapped:)" case .m_presentView__transitionStyle_transitionStyleview_view: return ".presentView(transitionStyle:view:)" @@ -679,9 +705,11 @@ open class BaseRouterMock: BaseRouter, Mock { public static func dismiss(animated: Parameter) -> Verify { return Verify(method: .m_dismiss__animated_animated(`animated`))} public static func removeLastView(controllers: Parameter) -> Verify { return Verify(method: .m_removeLastView__controllers_controllers(`controllers`))} public static func showMainOrWhatsNewScreen() -> Verify { return Verify(method: .m_showMainOrWhatsNewScreen)} + public static func showStartupScreen() -> Verify { return Verify(method: .m_showStartupScreen)} public static func showLoginScreen() -> Verify { return Verify(method: .m_showLoginScreen)} public static func showRegisterScreen() -> Verify { return Verify(method: .m_showRegisterScreen)} public static func showForgotPasswordScreen() -> Verify { return Verify(method: .m_showForgotPasswordScreen)} + public static func showDiscoveryScreen(searchQuery: Parameter, fromStartupScreen: Parameter) -> Verify { return Verify(method: .m_showDiscoveryScreen__searchQuery_searchQueryfromStartupScreen_fromStartupScreen(`searchQuery`, `fromStartupScreen`))} public static func presentAlert(alertTitle: Parameter, alertMessage: Parameter, positiveAction: Parameter, onCloseTapped: Parameter<() -> Void>, okTapped: Parameter<() -> Void>, type: Parameter) -> Verify { return Verify(method: .m_presentAlert__alertTitle_alertTitlealertMessage_alertMessagepositiveAction_positiveActiononCloseTapped_onCloseTappedokTapped_okTappedtype_type(`alertTitle`, `alertMessage`, `positiveAction`, `onCloseTapped`, `okTapped`, `type`))} public static func presentAlert(alertTitle: Parameter, alertMessage: Parameter, nextSectionName: Parameter, action: Parameter, image: Parameter, onCloseTapped: Parameter<() -> Void>, okTapped: Parameter<() -> Void>, nextSectionTapped: Parameter<() -> Void>) -> Verify { return Verify(method: .m_presentAlert__alertTitle_alertTitlealertMessage_alertMessagenextSectionName_nextSectionNameaction_actionimage_imageonCloseTapped_onCloseTappedokTapped_okTappednextSectionTapped_nextSectionTapped(`alertTitle`, `alertMessage`, `nextSectionName`, `action`, `image`, `onCloseTapped`, `okTapped`, `nextSectionTapped`))} public static func presentView(transitionStyle: Parameter, view: Parameter) -> Verify { return Verify(method: .m_presentView__transitionStyle_transitionStyleview_view(`transitionStyle`, `view`))} @@ -710,6 +738,9 @@ open class BaseRouterMock: BaseRouter, Mock { public static func showMainOrWhatsNewScreen(perform: @escaping () -> Void) -> Perform { return Perform(method: .m_showMainOrWhatsNewScreen, performs: perform) } + public static func showStartupScreen(perform: @escaping () -> Void) -> Perform { + return Perform(method: .m_showStartupScreen, performs: perform) + } public static func showLoginScreen(perform: @escaping () -> Void) -> Perform { return Perform(method: .m_showLoginScreen, performs: perform) } @@ -719,6 +750,9 @@ open class BaseRouterMock: BaseRouter, Mock { public static func showForgotPasswordScreen(perform: @escaping () -> Void) -> Perform { return Perform(method: .m_showForgotPasswordScreen, performs: perform) } + public static func showDiscoveryScreen(searchQuery: Parameter, fromStartupScreen: Parameter, perform: @escaping (String?, Bool) -> Void) -> Perform { + return Perform(method: .m_showDiscoveryScreen__searchQuery_searchQueryfromStartupScreen_fromStartupScreen(`searchQuery`, `fromStartupScreen`), performs: perform) + } public static func presentAlert(alertTitle: Parameter, alertMessage: Parameter, positiveAction: Parameter, onCloseTapped: Parameter<() -> Void>, okTapped: Parameter<() -> Void>, type: Parameter, perform: @escaping (String, String, String, @escaping () -> Void, @escaping () -> Void, AlertViewType) -> Void) -> Perform { return Perform(method: .m_presentAlert__alertTitle_alertTitlealertMessage_alertMessagepositiveAction_positiveActiononCloseTapped_onCloseTappedokTapped_okTappedtype_type(`alertTitle`, `alertMessage`, `positiveAction`, `onCloseTapped`, `okTapped`, `type`), performs: perform) } diff --git a/Dashboard/DashboardTests/DashboardMock.generated.swift b/Dashboard/DashboardTests/DashboardMock.generated.swift index 08f998ce9..ba988cfff 100644 --- a/Dashboard/DashboardTests/DashboardMock.generated.swift +++ b/Dashboard/DashboardTests/DashboardMock.generated.swift @@ -496,6 +496,12 @@ open class BaseRouterMock: BaseRouter, Mock { perform?() } + open func showStartupScreen() { + addInvocation(.m_showStartupScreen) + let perform = methodPerformValue(.m_showStartupScreen) as? () -> Void + perform?() + } + open func showLoginScreen() { addInvocation(.m_showLoginScreen) let perform = methodPerformValue(.m_showLoginScreen) as? () -> Void @@ -514,6 +520,12 @@ open class BaseRouterMock: BaseRouter, Mock { perform?() } + open func showDiscoveryScreen(searchQuery: String?, fromStartupScreen: Bool) { + addInvocation(.m_showDiscoveryScreen__searchQuery_searchQueryfromStartupScreen_fromStartupScreen(Parameter.value(`searchQuery`), Parameter.value(`fromStartupScreen`))) + let perform = methodPerformValue(.m_showDiscoveryScreen__searchQuery_searchQueryfromStartupScreen_fromStartupScreen(Parameter.value(`searchQuery`), Parameter.value(`fromStartupScreen`))) as? (String?, Bool) -> Void + perform?(`searchQuery`, `fromStartupScreen`) + } + open func presentAlert(alertTitle: String, alertMessage: String, positiveAction: String, onCloseTapped: @escaping () -> Void, okTapped: @escaping () -> Void, type: AlertViewType) { addInvocation(.m_presentAlert__alertTitle_alertTitlealertMessage_alertMessagepositiveAction_positiveActiononCloseTapped_onCloseTappedokTapped_okTappedtype_type(Parameter.value(`alertTitle`), Parameter.value(`alertMessage`), Parameter.value(`positiveAction`), Parameter<() -> Void>.value(`onCloseTapped`), Parameter<() -> Void>.value(`okTapped`), Parameter.value(`type`))) let perform = methodPerformValue(.m_presentAlert__alertTitle_alertTitlealertMessage_alertMessagepositiveAction_positiveActiononCloseTapped_onCloseTappedokTapped_okTappedtype_type(Parameter.value(`alertTitle`), Parameter.value(`alertMessage`), Parameter.value(`positiveAction`), Parameter<() -> Void>.value(`onCloseTapped`), Parameter<() -> Void>.value(`okTapped`), Parameter.value(`type`))) as? (String, String, String, @escaping () -> Void, @escaping () -> Void, AlertViewType) -> Void @@ -546,9 +558,11 @@ open class BaseRouterMock: BaseRouter, Mock { case m_dismiss__animated_animated(Parameter) case m_removeLastView__controllers_controllers(Parameter) case m_showMainOrWhatsNewScreen + case m_showStartupScreen case m_showLoginScreen case m_showRegisterScreen case m_showForgotPasswordScreen + case m_showDiscoveryScreen__searchQuery_searchQueryfromStartupScreen_fromStartupScreen(Parameter, Parameter) case m_presentAlert__alertTitle_alertTitlealertMessage_alertMessagepositiveAction_positiveActiononCloseTapped_onCloseTappedokTapped_okTappedtype_type(Parameter, Parameter, Parameter, Parameter<() -> Void>, Parameter<() -> Void>, Parameter) case m_presentAlert__alertTitle_alertTitlealertMessage_alertMessagenextSectionName_nextSectionNameaction_actionimage_imageonCloseTapped_onCloseTappedokTapped_okTappednextSectionTapped_nextSectionTapped(Parameter, Parameter, Parameter, Parameter, Parameter, Parameter<() -> Void>, Parameter<() -> Void>, Parameter<() -> Void>) case m_presentView__transitionStyle_transitionStyleview_view(Parameter, Parameter) @@ -580,12 +594,20 @@ open class BaseRouterMock: BaseRouter, Mock { case (.m_showMainOrWhatsNewScreen, .m_showMainOrWhatsNewScreen): return .match + case (.m_showStartupScreen, .m_showStartupScreen): return .match + case (.m_showLoginScreen, .m_showLoginScreen): return .match case (.m_showRegisterScreen, .m_showRegisterScreen): return .match case (.m_showForgotPasswordScreen, .m_showForgotPasswordScreen): return .match + case (.m_showDiscoveryScreen__searchQuery_searchQueryfromStartupScreen_fromStartupScreen(let lhsSearchquery, let lhsFromstartupscreen), .m_showDiscoveryScreen__searchQuery_searchQueryfromStartupScreen_fromStartupScreen(let rhsSearchquery, let rhsFromstartupscreen)): + var results: [Matcher.ParameterComparisonResult] = [] + results.append(Matcher.ParameterComparisonResult(Parameter.compare(lhs: lhsSearchquery, rhs: rhsSearchquery, with: matcher), lhsSearchquery, rhsSearchquery, "searchQuery")) + results.append(Matcher.ParameterComparisonResult(Parameter.compare(lhs: lhsFromstartupscreen, rhs: rhsFromstartupscreen, with: matcher), lhsFromstartupscreen, rhsFromstartupscreen, "fromStartupScreen")) + return Matcher.ComparisonResult(results) + case (.m_presentAlert__alertTitle_alertTitlealertMessage_alertMessagepositiveAction_positiveActiononCloseTapped_onCloseTappedokTapped_okTappedtype_type(let lhsAlerttitle, let lhsAlertmessage, let lhsPositiveaction, let lhsOnclosetapped, let lhsOktapped, let lhsType), .m_presentAlert__alertTitle_alertTitlealertMessage_alertMessagepositiveAction_positiveActiononCloseTapped_onCloseTappedokTapped_okTappedtype_type(let rhsAlerttitle, let rhsAlertmessage, let rhsPositiveaction, let rhsOnclosetapped, let rhsOktapped, let rhsType)): var results: [Matcher.ParameterComparisonResult] = [] results.append(Matcher.ParameterComparisonResult(Parameter.compare(lhs: lhsAlerttitle, rhs: rhsAlerttitle, with: matcher), lhsAlerttitle, rhsAlerttitle, "alertTitle")) @@ -631,9 +653,11 @@ open class BaseRouterMock: BaseRouter, Mock { case let .m_dismiss__animated_animated(p0): return p0.intValue case let .m_removeLastView__controllers_controllers(p0): return p0.intValue case .m_showMainOrWhatsNewScreen: return 0 + case .m_showStartupScreen: return 0 case .m_showLoginScreen: return 0 case .m_showRegisterScreen: return 0 case .m_showForgotPasswordScreen: return 0 + case let .m_showDiscoveryScreen__searchQuery_searchQueryfromStartupScreen_fromStartupScreen(p0, p1): return p0.intValue + p1.intValue case let .m_presentAlert__alertTitle_alertTitlealertMessage_alertMessagepositiveAction_positiveActiononCloseTapped_onCloseTappedokTapped_okTappedtype_type(p0, p1, p2, p3, p4, p5): return p0.intValue + p1.intValue + p2.intValue + p3.intValue + p4.intValue + p5.intValue case let .m_presentAlert__alertTitle_alertTitlealertMessage_alertMessagenextSectionName_nextSectionNameaction_actionimage_imageonCloseTapped_onCloseTappedokTapped_okTappednextSectionTapped_nextSectionTapped(p0, p1, p2, p3, p4, p5, p6, p7): return p0.intValue + p1.intValue + p2.intValue + p3.intValue + p4.intValue + p5.intValue + p6.intValue + p7.intValue case let .m_presentView__transitionStyle_transitionStyleview_view(p0, p1): return p0.intValue + p1.intValue @@ -648,9 +672,11 @@ open class BaseRouterMock: BaseRouter, Mock { case .m_dismiss__animated_animated: return ".dismiss(animated:)" case .m_removeLastView__controllers_controllers: return ".removeLastView(controllers:)" case .m_showMainOrWhatsNewScreen: return ".showMainOrWhatsNewScreen()" + case .m_showStartupScreen: return ".showStartupScreen()" case .m_showLoginScreen: return ".showLoginScreen()" case .m_showRegisterScreen: return ".showRegisterScreen()" case .m_showForgotPasswordScreen: return ".showForgotPasswordScreen()" + case .m_showDiscoveryScreen__searchQuery_searchQueryfromStartupScreen_fromStartupScreen: return ".showDiscoveryScreen(searchQuery:fromStartupScreen:)" case .m_presentAlert__alertTitle_alertTitlealertMessage_alertMessagepositiveAction_positiveActiononCloseTapped_onCloseTappedokTapped_okTappedtype_type: return ".presentAlert(alertTitle:alertMessage:positiveAction:onCloseTapped:okTapped:type:)" case .m_presentAlert__alertTitle_alertTitlealertMessage_alertMessagenextSectionName_nextSectionNameaction_actionimage_imageonCloseTapped_onCloseTappedokTapped_okTappednextSectionTapped_nextSectionTapped: return ".presentAlert(alertTitle:alertMessage:nextSectionName:action:image:onCloseTapped:okTapped:nextSectionTapped:)" case .m_presentView__transitionStyle_transitionStyleview_view: return ".presentView(transitionStyle:view:)" @@ -679,9 +705,11 @@ open class BaseRouterMock: BaseRouter, Mock { public static func dismiss(animated: Parameter) -> Verify { return Verify(method: .m_dismiss__animated_animated(`animated`))} public static func removeLastView(controllers: Parameter) -> Verify { return Verify(method: .m_removeLastView__controllers_controllers(`controllers`))} public static func showMainOrWhatsNewScreen() -> Verify { return Verify(method: .m_showMainOrWhatsNewScreen)} + public static func showStartupScreen() -> Verify { return Verify(method: .m_showStartupScreen)} public static func showLoginScreen() -> Verify { return Verify(method: .m_showLoginScreen)} public static func showRegisterScreen() -> Verify { return Verify(method: .m_showRegisterScreen)} public static func showForgotPasswordScreen() -> Verify { return Verify(method: .m_showForgotPasswordScreen)} + public static func showDiscoveryScreen(searchQuery: Parameter, fromStartupScreen: Parameter) -> Verify { return Verify(method: .m_showDiscoveryScreen__searchQuery_searchQueryfromStartupScreen_fromStartupScreen(`searchQuery`, `fromStartupScreen`))} public static func presentAlert(alertTitle: Parameter, alertMessage: Parameter, positiveAction: Parameter, onCloseTapped: Parameter<() -> Void>, okTapped: Parameter<() -> Void>, type: Parameter) -> Verify { return Verify(method: .m_presentAlert__alertTitle_alertTitlealertMessage_alertMessagepositiveAction_positiveActiononCloseTapped_onCloseTappedokTapped_okTappedtype_type(`alertTitle`, `alertMessage`, `positiveAction`, `onCloseTapped`, `okTapped`, `type`))} public static func presentAlert(alertTitle: Parameter, alertMessage: Parameter, nextSectionName: Parameter, action: Parameter, image: Parameter, onCloseTapped: Parameter<() -> Void>, okTapped: Parameter<() -> Void>, nextSectionTapped: Parameter<() -> Void>) -> Verify { return Verify(method: .m_presentAlert__alertTitle_alertTitlealertMessage_alertMessagenextSectionName_nextSectionNameaction_actionimage_imageonCloseTapped_onCloseTappedokTapped_okTappednextSectionTapped_nextSectionTapped(`alertTitle`, `alertMessage`, `nextSectionName`, `action`, `image`, `onCloseTapped`, `okTapped`, `nextSectionTapped`))} public static func presentView(transitionStyle: Parameter, view: Parameter) -> Verify { return Verify(method: .m_presentView__transitionStyle_transitionStyleview_view(`transitionStyle`, `view`))} @@ -710,6 +738,9 @@ open class BaseRouterMock: BaseRouter, Mock { public static func showMainOrWhatsNewScreen(perform: @escaping () -> Void) -> Perform { return Perform(method: .m_showMainOrWhatsNewScreen, performs: perform) } + public static func showStartupScreen(perform: @escaping () -> Void) -> Perform { + return Perform(method: .m_showStartupScreen, performs: perform) + } public static func showLoginScreen(perform: @escaping () -> Void) -> Perform { return Perform(method: .m_showLoginScreen, performs: perform) } @@ -719,6 +750,9 @@ open class BaseRouterMock: BaseRouter, Mock { public static func showForgotPasswordScreen(perform: @escaping () -> Void) -> Perform { return Perform(method: .m_showForgotPasswordScreen, performs: perform) } + public static func showDiscoveryScreen(searchQuery: Parameter, fromStartupScreen: Parameter, perform: @escaping (String?, Bool) -> Void) -> Perform { + return Perform(method: .m_showDiscoveryScreen__searchQuery_searchQueryfromStartupScreen_fromStartupScreen(`searchQuery`, `fromStartupScreen`), performs: perform) + } public static func presentAlert(alertTitle: Parameter, alertMessage: Parameter, positiveAction: Parameter, onCloseTapped: Parameter<() -> Void>, okTapped: Parameter<() -> Void>, type: Parameter, perform: @escaping (String, String, String, @escaping () -> Void, @escaping () -> Void, AlertViewType) -> Void) -> Perform { return Perform(method: .m_presentAlert__alertTitle_alertTitlealertMessage_alertMessagepositiveAction_positiveActiononCloseTapped_onCloseTappedokTapped_okTappedtype_type(`alertTitle`, `alertMessage`, `positiveAction`, `onCloseTapped`, `okTapped`, `type`), performs: perform) } diff --git a/Discovery/Discovery/Presentation/DiscoveryRouter.swift b/Discovery/Discovery/Presentation/DiscoveryRouter.swift index 61fc564d5..32b13a6e4 100644 --- a/Discovery/Discovery/Presentation/DiscoveryRouter.swift +++ b/Discovery/Discovery/Presentation/DiscoveryRouter.swift @@ -11,9 +11,9 @@ import Core public protocol DiscoveryRouter: BaseRouter { func showCourseDetais(courseID: String, title: String) - func showDiscoverySearch() func showUpdateRequiredView(showAccountLink: Bool) func showUpdateRecomendedView() + func showDiscoverySearch(searchQuery: String?) } // Mark - For testing and SwiftUI preview @@ -23,8 +23,8 @@ public class DiscoveryRouterMock: BaseRouterMock, DiscoveryRouter { public override init() {} public func showCourseDetais(courseID: String, title: String) {} - public func showDiscoverySearch() {} public func showUpdateRequiredView(showAccountLink: Bool) {} - public func showUpdateRecomendedView() {} + public func showUpdateRecomendedView() {} + public func showDiscoverySearch(searchQuery: String? = nil) {} } #endif diff --git a/Discovery/Discovery/Presentation/DiscoveryView.swift b/Discovery/Discovery/Presentation/DiscoveryView.swift index a90b41a9b..95c19a0b0 100644 --- a/Discovery/Discovery/Presentation/DiscoveryView.swift +++ b/Discovery/Discovery/Presentation/DiscoveryView.swift @@ -12,8 +12,15 @@ public struct DiscoveryView: View { @StateObject private var viewModel: DiscoveryViewModel + private var router: DiscoveryRouter + @State private var searchQuery: String = "" @State private var isRefreshing: Bool = false + private var fromStartupScreen: Bool = false + + @Environment (\.isHorizontal) private var isHorizontal + @Environment(\.presentationMode) private var presentationMode + private let discoveryNew: some View = VStack(alignment: .leading) { Text(DiscoveryLocalization.Header.title1) .font(Theme.Fonts.displaySmall) @@ -25,8 +32,16 @@ public struct DiscoveryView: View { .accessibilityElement(children: .ignore) .accessibilityLabel(DiscoveryLocalization.Header.title1 + DiscoveryLocalization.Header.title2) - public init(viewModel: DiscoveryViewModel) { + public init( + viewModel: DiscoveryViewModel, + router: DiscoveryRouter, + searchQuery: String? = nil, + fromStartupScreen: Bool = false + ) { self._viewModel = StateObject(wrappedValue: { viewModel }()) + self.router = router + self.fromStartupScreen = fromStartupScreen + self._searchQuery = State(initialValue: searchQuery ?? "") } public var body: some View { @@ -45,11 +60,11 @@ public struct DiscoveryView: View { Spacer() } .onTapGesture { - viewModel.router.showDiscoverySearch() + router.showDiscoverySearch(searchQuery: searchQuery) viewModel.discoverySearchBarClicked() } .frame(minHeight: 48) - .frame(maxWidth: 532) + .frame(maxWidth: .infinity) .background( Theme.Shapes.textInputShape .fill(Theme.Colors.textInputUnfocusedBackground) @@ -58,11 +73,11 @@ public struct DiscoveryView: View { Theme.Shapes.textInputShape .stroke(lineWidth: 1) .fill(Theme.Colors.textInputUnfocusedStroke) - ) - .onTapGesture { - viewModel.router.showDiscoverySearch() + ).onTapGesture { + router.showDiscoverySearch(searchQuery: searchQuery) viewModel.discoverySearchBarClicked() } + .padding(.top, 11.5) .padding(.horizontal, 24) .padding(.bottom, 20) .accessibilityElement(children: .ignore) @@ -145,7 +160,12 @@ public struct DiscoveryView: View { } } } + .navigationBarHidden(fromStartupScreen ? false : true) .onFirstAppear { + if !(searchQuery.isEmpty) { + router.showDiscoverySearch(searchQuery: searchQuery) + searchQuery = "" + } Task { await viewModel.discovery(page: 1) } @@ -165,11 +185,11 @@ struct DiscoveryView_Previews: PreviewProvider { analytics: DiscoveryAnalyticsMock()) let router = DiscoveryRouterMock() - DiscoveryView(viewModel: vm) + DiscoveryView(viewModel: vm, router: router) .preferredColorScheme(.light) .previewDisplayName("DiscoveryView Light") - DiscoveryView(viewModel: vm) + DiscoveryView(viewModel: vm, router: router) .preferredColorScheme(.dark) .previewDisplayName("DiscoveryView Dark") } diff --git a/Discovery/Discovery/Presentation/SearchView.swift b/Discovery/Discovery/Presentation/SearchView.swift index 77dd693c8..3a857d0bf 100644 --- a/Discovery/Discovery/Presentation/SearchView.swift +++ b/Discovery/Discovery/Presentation/SearchView.swift @@ -17,8 +17,10 @@ public struct SearchView: View { private var viewModel: SearchViewModel @State private var animated: Bool = false - public init(viewModel: SearchViewModel) { + public init(viewModel: SearchViewModel, searchQuery: String? = nil) { self.viewModel = viewModel + self.viewModel.searchText = searchQuery ?? "" + self.viewModel.isSearchActive = !(searchQuery?.isEmpty ?? false) } public var body: some View { @@ -34,7 +36,7 @@ public struct SearchView: View { HStack(spacing: 11) { Image(systemName: "magnifyingglass") .padding(.leading, 16) - .padding(.top, -1) + .padding(.top, 1) .foregroundColor( viewModel.isSearchActive ? Theme.Colors.accentColor @@ -68,7 +70,7 @@ public struct SearchView: View { } } .frame(minHeight: 48) - .frame(maxWidth: 532) + .frame(maxWidth: .infinity) .background( Theme.Shapes.textInputShape .fill(viewModel.isSearchActive @@ -156,6 +158,10 @@ public struct SearchView: View { } } } + + .onDisappear { + viewModel.searchText = "" + } .background(Theme.Colors.background.ignoresSafeArea()) .addTapToEndEditing(isForced: true) } diff --git a/Discovery/DiscoveryTests/DiscoveryMock.generated.swift b/Discovery/DiscoveryTests/DiscoveryMock.generated.swift index d49e7424f..b95cb9f0d 100644 --- a/Discovery/DiscoveryTests/DiscoveryMock.generated.swift +++ b/Discovery/DiscoveryTests/DiscoveryMock.generated.swift @@ -496,6 +496,12 @@ open class BaseRouterMock: BaseRouter, Mock { perform?() } + open func showStartupScreen() { + addInvocation(.m_showStartupScreen) + let perform = methodPerformValue(.m_showStartupScreen) as? () -> Void + perform?() + } + open func showLoginScreen() { addInvocation(.m_showLoginScreen) let perform = methodPerformValue(.m_showLoginScreen) as? () -> Void @@ -514,6 +520,12 @@ open class BaseRouterMock: BaseRouter, Mock { perform?() } + open func showDiscoveryScreen(searchQuery: String?, fromStartupScreen: Bool) { + addInvocation(.m_showDiscoveryScreen__searchQuery_searchQueryfromStartupScreen_fromStartupScreen(Parameter.value(`searchQuery`), Parameter.value(`fromStartupScreen`))) + let perform = methodPerformValue(.m_showDiscoveryScreen__searchQuery_searchQueryfromStartupScreen_fromStartupScreen(Parameter.value(`searchQuery`), Parameter.value(`fromStartupScreen`))) as? (String?, Bool) -> Void + perform?(`searchQuery`, `fromStartupScreen`) + } + open func presentAlert(alertTitle: String, alertMessage: String, positiveAction: String, onCloseTapped: @escaping () -> Void, okTapped: @escaping () -> Void, type: AlertViewType) { addInvocation(.m_presentAlert__alertTitle_alertTitlealertMessage_alertMessagepositiveAction_positiveActiononCloseTapped_onCloseTappedokTapped_okTappedtype_type(Parameter.value(`alertTitle`), Parameter.value(`alertMessage`), Parameter.value(`positiveAction`), Parameter<() -> Void>.value(`onCloseTapped`), Parameter<() -> Void>.value(`okTapped`), Parameter.value(`type`))) let perform = methodPerformValue(.m_presentAlert__alertTitle_alertTitlealertMessage_alertMessagepositiveAction_positiveActiononCloseTapped_onCloseTappedokTapped_okTappedtype_type(Parameter.value(`alertTitle`), Parameter.value(`alertMessage`), Parameter.value(`positiveAction`), Parameter<() -> Void>.value(`onCloseTapped`), Parameter<() -> Void>.value(`okTapped`), Parameter.value(`type`))) as? (String, String, String, @escaping () -> Void, @escaping () -> Void, AlertViewType) -> Void @@ -546,9 +558,11 @@ open class BaseRouterMock: BaseRouter, Mock { case m_dismiss__animated_animated(Parameter) case m_removeLastView__controllers_controllers(Parameter) case m_showMainOrWhatsNewScreen + case m_showStartupScreen case m_showLoginScreen case m_showRegisterScreen case m_showForgotPasswordScreen + case m_showDiscoveryScreen__searchQuery_searchQueryfromStartupScreen_fromStartupScreen(Parameter, Parameter) case m_presentAlert__alertTitle_alertTitlealertMessage_alertMessagepositiveAction_positiveActiononCloseTapped_onCloseTappedokTapped_okTappedtype_type(Parameter, Parameter, Parameter, Parameter<() -> Void>, Parameter<() -> Void>, Parameter) case m_presentAlert__alertTitle_alertTitlealertMessage_alertMessagenextSectionName_nextSectionNameaction_actionimage_imageonCloseTapped_onCloseTappedokTapped_okTappednextSectionTapped_nextSectionTapped(Parameter, Parameter, Parameter, Parameter, Parameter, Parameter<() -> Void>, Parameter<() -> Void>, Parameter<() -> Void>) case m_presentView__transitionStyle_transitionStyleview_view(Parameter, Parameter) @@ -580,12 +594,20 @@ open class BaseRouterMock: BaseRouter, Mock { case (.m_showMainOrWhatsNewScreen, .m_showMainOrWhatsNewScreen): return .match + case (.m_showStartupScreen, .m_showStartupScreen): return .match + case (.m_showLoginScreen, .m_showLoginScreen): return .match case (.m_showRegisterScreen, .m_showRegisterScreen): return .match case (.m_showForgotPasswordScreen, .m_showForgotPasswordScreen): return .match + case (.m_showDiscoveryScreen__searchQuery_searchQueryfromStartupScreen_fromStartupScreen(let lhsSearchquery, let lhsFromstartupscreen), .m_showDiscoveryScreen__searchQuery_searchQueryfromStartupScreen_fromStartupScreen(let rhsSearchquery, let rhsFromstartupscreen)): + var results: [Matcher.ParameterComparisonResult] = [] + results.append(Matcher.ParameterComparisonResult(Parameter.compare(lhs: lhsSearchquery, rhs: rhsSearchquery, with: matcher), lhsSearchquery, rhsSearchquery, "searchQuery")) + results.append(Matcher.ParameterComparisonResult(Parameter.compare(lhs: lhsFromstartupscreen, rhs: rhsFromstartupscreen, with: matcher), lhsFromstartupscreen, rhsFromstartupscreen, "fromStartupScreen")) + return Matcher.ComparisonResult(results) + case (.m_presentAlert__alertTitle_alertTitlealertMessage_alertMessagepositiveAction_positiveActiononCloseTapped_onCloseTappedokTapped_okTappedtype_type(let lhsAlerttitle, let lhsAlertmessage, let lhsPositiveaction, let lhsOnclosetapped, let lhsOktapped, let lhsType), .m_presentAlert__alertTitle_alertTitlealertMessage_alertMessagepositiveAction_positiveActiononCloseTapped_onCloseTappedokTapped_okTappedtype_type(let rhsAlerttitle, let rhsAlertmessage, let rhsPositiveaction, let rhsOnclosetapped, let rhsOktapped, let rhsType)): var results: [Matcher.ParameterComparisonResult] = [] results.append(Matcher.ParameterComparisonResult(Parameter.compare(lhs: lhsAlerttitle, rhs: rhsAlerttitle, with: matcher), lhsAlerttitle, rhsAlerttitle, "alertTitle")) @@ -631,9 +653,11 @@ open class BaseRouterMock: BaseRouter, Mock { case let .m_dismiss__animated_animated(p0): return p0.intValue case let .m_removeLastView__controllers_controllers(p0): return p0.intValue case .m_showMainOrWhatsNewScreen: return 0 + case .m_showStartupScreen: return 0 case .m_showLoginScreen: return 0 case .m_showRegisterScreen: return 0 case .m_showForgotPasswordScreen: return 0 + case let .m_showDiscoveryScreen__searchQuery_searchQueryfromStartupScreen_fromStartupScreen(p0, p1): return p0.intValue + p1.intValue case let .m_presentAlert__alertTitle_alertTitlealertMessage_alertMessagepositiveAction_positiveActiononCloseTapped_onCloseTappedokTapped_okTappedtype_type(p0, p1, p2, p3, p4, p5): return p0.intValue + p1.intValue + p2.intValue + p3.intValue + p4.intValue + p5.intValue case let .m_presentAlert__alertTitle_alertTitlealertMessage_alertMessagenextSectionName_nextSectionNameaction_actionimage_imageonCloseTapped_onCloseTappedokTapped_okTappednextSectionTapped_nextSectionTapped(p0, p1, p2, p3, p4, p5, p6, p7): return p0.intValue + p1.intValue + p2.intValue + p3.intValue + p4.intValue + p5.intValue + p6.intValue + p7.intValue case let .m_presentView__transitionStyle_transitionStyleview_view(p0, p1): return p0.intValue + p1.intValue @@ -648,9 +672,11 @@ open class BaseRouterMock: BaseRouter, Mock { case .m_dismiss__animated_animated: return ".dismiss(animated:)" case .m_removeLastView__controllers_controllers: return ".removeLastView(controllers:)" case .m_showMainOrWhatsNewScreen: return ".showMainOrWhatsNewScreen()" + case .m_showStartupScreen: return ".showStartupScreen()" case .m_showLoginScreen: return ".showLoginScreen()" case .m_showRegisterScreen: return ".showRegisterScreen()" case .m_showForgotPasswordScreen: return ".showForgotPasswordScreen()" + case .m_showDiscoveryScreen__searchQuery_searchQueryfromStartupScreen_fromStartupScreen: return ".showDiscoveryScreen(searchQuery:fromStartupScreen:)" case .m_presentAlert__alertTitle_alertTitlealertMessage_alertMessagepositiveAction_positiveActiononCloseTapped_onCloseTappedokTapped_okTappedtype_type: return ".presentAlert(alertTitle:alertMessage:positiveAction:onCloseTapped:okTapped:type:)" case .m_presentAlert__alertTitle_alertTitlealertMessage_alertMessagenextSectionName_nextSectionNameaction_actionimage_imageonCloseTapped_onCloseTappedokTapped_okTappednextSectionTapped_nextSectionTapped: return ".presentAlert(alertTitle:alertMessage:nextSectionName:action:image:onCloseTapped:okTapped:nextSectionTapped:)" case .m_presentView__transitionStyle_transitionStyleview_view: return ".presentView(transitionStyle:view:)" @@ -679,9 +705,11 @@ open class BaseRouterMock: BaseRouter, Mock { public static func dismiss(animated: Parameter) -> Verify { return Verify(method: .m_dismiss__animated_animated(`animated`))} public static func removeLastView(controllers: Parameter) -> Verify { return Verify(method: .m_removeLastView__controllers_controllers(`controllers`))} public static func showMainOrWhatsNewScreen() -> Verify { return Verify(method: .m_showMainOrWhatsNewScreen)} + public static func showStartupScreen() -> Verify { return Verify(method: .m_showStartupScreen)} public static func showLoginScreen() -> Verify { return Verify(method: .m_showLoginScreen)} public static func showRegisterScreen() -> Verify { return Verify(method: .m_showRegisterScreen)} public static func showForgotPasswordScreen() -> Verify { return Verify(method: .m_showForgotPasswordScreen)} + public static func showDiscoveryScreen(searchQuery: Parameter, fromStartupScreen: Parameter) -> Verify { return Verify(method: .m_showDiscoveryScreen__searchQuery_searchQueryfromStartupScreen_fromStartupScreen(`searchQuery`, `fromStartupScreen`))} public static func presentAlert(alertTitle: Parameter, alertMessage: Parameter, positiveAction: Parameter, onCloseTapped: Parameter<() -> Void>, okTapped: Parameter<() -> Void>, type: Parameter) -> Verify { return Verify(method: .m_presentAlert__alertTitle_alertTitlealertMessage_alertMessagepositiveAction_positiveActiononCloseTapped_onCloseTappedokTapped_okTappedtype_type(`alertTitle`, `alertMessage`, `positiveAction`, `onCloseTapped`, `okTapped`, `type`))} public static func presentAlert(alertTitle: Parameter, alertMessage: Parameter, nextSectionName: Parameter, action: Parameter, image: Parameter, onCloseTapped: Parameter<() -> Void>, okTapped: Parameter<() -> Void>, nextSectionTapped: Parameter<() -> Void>) -> Verify { return Verify(method: .m_presentAlert__alertTitle_alertTitlealertMessage_alertMessagenextSectionName_nextSectionNameaction_actionimage_imageonCloseTapped_onCloseTappedokTapped_okTappednextSectionTapped_nextSectionTapped(`alertTitle`, `alertMessage`, `nextSectionName`, `action`, `image`, `onCloseTapped`, `okTapped`, `nextSectionTapped`))} public static func presentView(transitionStyle: Parameter, view: Parameter) -> Verify { return Verify(method: .m_presentView__transitionStyle_transitionStyleview_view(`transitionStyle`, `view`))} @@ -710,6 +738,9 @@ open class BaseRouterMock: BaseRouter, Mock { public static func showMainOrWhatsNewScreen(perform: @escaping () -> Void) -> Perform { return Perform(method: .m_showMainOrWhatsNewScreen, performs: perform) } + public static func showStartupScreen(perform: @escaping () -> Void) -> Perform { + return Perform(method: .m_showStartupScreen, performs: perform) + } public static func showLoginScreen(perform: @escaping () -> Void) -> Perform { return Perform(method: .m_showLoginScreen, performs: perform) } @@ -719,6 +750,9 @@ open class BaseRouterMock: BaseRouter, Mock { public static func showForgotPasswordScreen(perform: @escaping () -> Void) -> Perform { return Perform(method: .m_showForgotPasswordScreen, performs: perform) } + public static func showDiscoveryScreen(searchQuery: Parameter, fromStartupScreen: Parameter, perform: @escaping (String?, Bool) -> Void) -> Perform { + return Perform(method: .m_showDiscoveryScreen__searchQuery_searchQueryfromStartupScreen_fromStartupScreen(`searchQuery`, `fromStartupScreen`), performs: perform) + } public static func presentAlert(alertTitle: Parameter, alertMessage: Parameter, positiveAction: Parameter, onCloseTapped: Parameter<() -> Void>, okTapped: Parameter<() -> Void>, type: Parameter, perform: @escaping (String, String, String, @escaping () -> Void, @escaping () -> Void, AlertViewType) -> Void) -> Perform { return Perform(method: .m_presentAlert__alertTitle_alertTitlealertMessage_alertMessagepositiveAction_positiveActiononCloseTapped_onCloseTappedokTapped_okTappedtype_type(`alertTitle`, `alertMessage`, `positiveAction`, `onCloseTapped`, `okTapped`, `type`), performs: perform) } diff --git a/Discussion/DiscussionTests/DiscussionMock.generated.swift b/Discussion/DiscussionTests/DiscussionMock.generated.swift index 775ffc794..5f2e17f42 100644 --- a/Discussion/DiscussionTests/DiscussionMock.generated.swift +++ b/Discussion/DiscussionTests/DiscussionMock.generated.swift @@ -496,6 +496,12 @@ open class BaseRouterMock: BaseRouter, Mock { perform?() } + open func showStartupScreen() { + addInvocation(.m_showStartupScreen) + let perform = methodPerformValue(.m_showStartupScreen) as? () -> Void + perform?() + } + open func showLoginScreen() { addInvocation(.m_showLoginScreen) let perform = methodPerformValue(.m_showLoginScreen) as? () -> Void @@ -514,6 +520,12 @@ open class BaseRouterMock: BaseRouter, Mock { perform?() } + open func showDiscoveryScreen(searchQuery: String?, fromStartupScreen: Bool) { + addInvocation(.m_showDiscoveryScreen__searchQuery_searchQueryfromStartupScreen_fromStartupScreen(Parameter.value(`searchQuery`), Parameter.value(`fromStartupScreen`))) + let perform = methodPerformValue(.m_showDiscoveryScreen__searchQuery_searchQueryfromStartupScreen_fromStartupScreen(Parameter.value(`searchQuery`), Parameter.value(`fromStartupScreen`))) as? (String?, Bool) -> Void + perform?(`searchQuery`, `fromStartupScreen`) + } + open func presentAlert(alertTitle: String, alertMessage: String, positiveAction: String, onCloseTapped: @escaping () -> Void, okTapped: @escaping () -> Void, type: AlertViewType) { addInvocation(.m_presentAlert__alertTitle_alertTitlealertMessage_alertMessagepositiveAction_positiveActiononCloseTapped_onCloseTappedokTapped_okTappedtype_type(Parameter.value(`alertTitle`), Parameter.value(`alertMessage`), Parameter.value(`positiveAction`), Parameter<() -> Void>.value(`onCloseTapped`), Parameter<() -> Void>.value(`okTapped`), Parameter.value(`type`))) let perform = methodPerformValue(.m_presentAlert__alertTitle_alertTitlealertMessage_alertMessagepositiveAction_positiveActiononCloseTapped_onCloseTappedokTapped_okTappedtype_type(Parameter.value(`alertTitle`), Parameter.value(`alertMessage`), Parameter.value(`positiveAction`), Parameter<() -> Void>.value(`onCloseTapped`), Parameter<() -> Void>.value(`okTapped`), Parameter.value(`type`))) as? (String, String, String, @escaping () -> Void, @escaping () -> Void, AlertViewType) -> Void @@ -546,9 +558,11 @@ open class BaseRouterMock: BaseRouter, Mock { case m_dismiss__animated_animated(Parameter) case m_removeLastView__controllers_controllers(Parameter) case m_showMainOrWhatsNewScreen + case m_showStartupScreen case m_showLoginScreen case m_showRegisterScreen case m_showForgotPasswordScreen + case m_showDiscoveryScreen__searchQuery_searchQueryfromStartupScreen_fromStartupScreen(Parameter, Parameter) case m_presentAlert__alertTitle_alertTitlealertMessage_alertMessagepositiveAction_positiveActiononCloseTapped_onCloseTappedokTapped_okTappedtype_type(Parameter, Parameter, Parameter, Parameter<() -> Void>, Parameter<() -> Void>, Parameter) case m_presentAlert__alertTitle_alertTitlealertMessage_alertMessagenextSectionName_nextSectionNameaction_actionimage_imageonCloseTapped_onCloseTappedokTapped_okTappednextSectionTapped_nextSectionTapped(Parameter, Parameter, Parameter, Parameter, Parameter, Parameter<() -> Void>, Parameter<() -> Void>, Parameter<() -> Void>) case m_presentView__transitionStyle_transitionStyleview_view(Parameter, Parameter) @@ -580,12 +594,20 @@ open class BaseRouterMock: BaseRouter, Mock { case (.m_showMainOrWhatsNewScreen, .m_showMainOrWhatsNewScreen): return .match + case (.m_showStartupScreen, .m_showStartupScreen): return .match + case (.m_showLoginScreen, .m_showLoginScreen): return .match case (.m_showRegisterScreen, .m_showRegisterScreen): return .match case (.m_showForgotPasswordScreen, .m_showForgotPasswordScreen): return .match + case (.m_showDiscoveryScreen__searchQuery_searchQueryfromStartupScreen_fromStartupScreen(let lhsSearchquery, let lhsFromstartupscreen), .m_showDiscoveryScreen__searchQuery_searchQueryfromStartupScreen_fromStartupScreen(let rhsSearchquery, let rhsFromstartupscreen)): + var results: [Matcher.ParameterComparisonResult] = [] + results.append(Matcher.ParameterComparisonResult(Parameter.compare(lhs: lhsSearchquery, rhs: rhsSearchquery, with: matcher), lhsSearchquery, rhsSearchquery, "searchQuery")) + results.append(Matcher.ParameterComparisonResult(Parameter.compare(lhs: lhsFromstartupscreen, rhs: rhsFromstartupscreen, with: matcher), lhsFromstartupscreen, rhsFromstartupscreen, "fromStartupScreen")) + return Matcher.ComparisonResult(results) + case (.m_presentAlert__alertTitle_alertTitlealertMessage_alertMessagepositiveAction_positiveActiononCloseTapped_onCloseTappedokTapped_okTappedtype_type(let lhsAlerttitle, let lhsAlertmessage, let lhsPositiveaction, let lhsOnclosetapped, let lhsOktapped, let lhsType), .m_presentAlert__alertTitle_alertTitlealertMessage_alertMessagepositiveAction_positiveActiononCloseTapped_onCloseTappedokTapped_okTappedtype_type(let rhsAlerttitle, let rhsAlertmessage, let rhsPositiveaction, let rhsOnclosetapped, let rhsOktapped, let rhsType)): var results: [Matcher.ParameterComparisonResult] = [] results.append(Matcher.ParameterComparisonResult(Parameter.compare(lhs: lhsAlerttitle, rhs: rhsAlerttitle, with: matcher), lhsAlerttitle, rhsAlerttitle, "alertTitle")) @@ -631,9 +653,11 @@ open class BaseRouterMock: BaseRouter, Mock { case let .m_dismiss__animated_animated(p0): return p0.intValue case let .m_removeLastView__controllers_controllers(p0): return p0.intValue case .m_showMainOrWhatsNewScreen: return 0 + case .m_showStartupScreen: return 0 case .m_showLoginScreen: return 0 case .m_showRegisterScreen: return 0 case .m_showForgotPasswordScreen: return 0 + case let .m_showDiscoveryScreen__searchQuery_searchQueryfromStartupScreen_fromStartupScreen(p0, p1): return p0.intValue + p1.intValue case let .m_presentAlert__alertTitle_alertTitlealertMessage_alertMessagepositiveAction_positiveActiononCloseTapped_onCloseTappedokTapped_okTappedtype_type(p0, p1, p2, p3, p4, p5): return p0.intValue + p1.intValue + p2.intValue + p3.intValue + p4.intValue + p5.intValue case let .m_presentAlert__alertTitle_alertTitlealertMessage_alertMessagenextSectionName_nextSectionNameaction_actionimage_imageonCloseTapped_onCloseTappedokTapped_okTappednextSectionTapped_nextSectionTapped(p0, p1, p2, p3, p4, p5, p6, p7): return p0.intValue + p1.intValue + p2.intValue + p3.intValue + p4.intValue + p5.intValue + p6.intValue + p7.intValue case let .m_presentView__transitionStyle_transitionStyleview_view(p0, p1): return p0.intValue + p1.intValue @@ -648,9 +672,11 @@ open class BaseRouterMock: BaseRouter, Mock { case .m_dismiss__animated_animated: return ".dismiss(animated:)" case .m_removeLastView__controllers_controllers: return ".removeLastView(controllers:)" case .m_showMainOrWhatsNewScreen: return ".showMainOrWhatsNewScreen()" + case .m_showStartupScreen: return ".showStartupScreen()" case .m_showLoginScreen: return ".showLoginScreen()" case .m_showRegisterScreen: return ".showRegisterScreen()" case .m_showForgotPasswordScreen: return ".showForgotPasswordScreen()" + case .m_showDiscoveryScreen__searchQuery_searchQueryfromStartupScreen_fromStartupScreen: return ".showDiscoveryScreen(searchQuery:fromStartupScreen:)" case .m_presentAlert__alertTitle_alertTitlealertMessage_alertMessagepositiveAction_positiveActiononCloseTapped_onCloseTappedokTapped_okTappedtype_type: return ".presentAlert(alertTitle:alertMessage:positiveAction:onCloseTapped:okTapped:type:)" case .m_presentAlert__alertTitle_alertTitlealertMessage_alertMessagenextSectionName_nextSectionNameaction_actionimage_imageonCloseTapped_onCloseTappedokTapped_okTappednextSectionTapped_nextSectionTapped: return ".presentAlert(alertTitle:alertMessage:nextSectionName:action:image:onCloseTapped:okTapped:nextSectionTapped:)" case .m_presentView__transitionStyle_transitionStyleview_view: return ".presentView(transitionStyle:view:)" @@ -679,9 +705,11 @@ open class BaseRouterMock: BaseRouter, Mock { public static func dismiss(animated: Parameter) -> Verify { return Verify(method: .m_dismiss__animated_animated(`animated`))} public static func removeLastView(controllers: Parameter) -> Verify { return Verify(method: .m_removeLastView__controllers_controllers(`controllers`))} public static func showMainOrWhatsNewScreen() -> Verify { return Verify(method: .m_showMainOrWhatsNewScreen)} + public static func showStartupScreen() -> Verify { return Verify(method: .m_showStartupScreen)} public static func showLoginScreen() -> Verify { return Verify(method: .m_showLoginScreen)} public static func showRegisterScreen() -> Verify { return Verify(method: .m_showRegisterScreen)} public static func showForgotPasswordScreen() -> Verify { return Verify(method: .m_showForgotPasswordScreen)} + public static func showDiscoveryScreen(searchQuery: Parameter, fromStartupScreen: Parameter) -> Verify { return Verify(method: .m_showDiscoveryScreen__searchQuery_searchQueryfromStartupScreen_fromStartupScreen(`searchQuery`, `fromStartupScreen`))} public static func presentAlert(alertTitle: Parameter, alertMessage: Parameter, positiveAction: Parameter, onCloseTapped: Parameter<() -> Void>, okTapped: Parameter<() -> Void>, type: Parameter) -> Verify { return Verify(method: .m_presentAlert__alertTitle_alertTitlealertMessage_alertMessagepositiveAction_positiveActiononCloseTapped_onCloseTappedokTapped_okTappedtype_type(`alertTitle`, `alertMessage`, `positiveAction`, `onCloseTapped`, `okTapped`, `type`))} public static func presentAlert(alertTitle: Parameter, alertMessage: Parameter, nextSectionName: Parameter, action: Parameter, image: Parameter, onCloseTapped: Parameter<() -> Void>, okTapped: Parameter<() -> Void>, nextSectionTapped: Parameter<() -> Void>) -> Verify { return Verify(method: .m_presentAlert__alertTitle_alertTitlealertMessage_alertMessagenextSectionName_nextSectionNameaction_actionimage_imageonCloseTapped_onCloseTappedokTapped_okTappednextSectionTapped_nextSectionTapped(`alertTitle`, `alertMessage`, `nextSectionName`, `action`, `image`, `onCloseTapped`, `okTapped`, `nextSectionTapped`))} public static func presentView(transitionStyle: Parameter, view: Parameter) -> Verify { return Verify(method: .m_presentView__transitionStyle_transitionStyleview_view(`transitionStyle`, `view`))} @@ -710,6 +738,9 @@ open class BaseRouterMock: BaseRouter, Mock { public static func showMainOrWhatsNewScreen(perform: @escaping () -> Void) -> Perform { return Perform(method: .m_showMainOrWhatsNewScreen, performs: perform) } + public static func showStartupScreen(perform: @escaping () -> Void) -> Perform { + return Perform(method: .m_showStartupScreen, performs: perform) + } public static func showLoginScreen(perform: @escaping () -> Void) -> Perform { return Perform(method: .m_showLoginScreen, performs: perform) } @@ -719,6 +750,9 @@ open class BaseRouterMock: BaseRouter, Mock { public static func showForgotPasswordScreen(perform: @escaping () -> Void) -> Perform { return Perform(method: .m_showForgotPasswordScreen, performs: perform) } + public static func showDiscoveryScreen(searchQuery: Parameter, fromStartupScreen: Parameter, perform: @escaping (String?, Bool) -> Void) -> Perform { + return Perform(method: .m_showDiscoveryScreen__searchQuery_searchQueryfromStartupScreen_fromStartupScreen(`searchQuery`, `fromStartupScreen`), performs: perform) + } public static func presentAlert(alertTitle: Parameter, alertMessage: Parameter, positiveAction: Parameter, onCloseTapped: Parameter<() -> Void>, okTapped: Parameter<() -> Void>, type: Parameter, perform: @escaping (String, String, String, @escaping () -> Void, @escaping () -> Void, AlertViewType) -> Void) -> Perform { return Perform(method: .m_presentAlert__alertTitle_alertTitlealertMessage_alertMessagepositiveAction_positiveActiononCloseTapped_onCloseTappedokTapped_okTappedtype_type(`alertTitle`, `alertMessage`, `positiveAction`, `onCloseTapped`, `okTapped`, `type`), performs: perform) } @@ -2039,6 +2073,12 @@ open class DiscussionRouterMock: DiscussionRouter, Mock { perform?() } + open func showStartupScreen() { + addInvocation(.m_showStartupScreen) + let perform = methodPerformValue(.m_showStartupScreen) as? () -> Void + perform?() + } + open func showLoginScreen() { addInvocation(.m_showLoginScreen) let perform = methodPerformValue(.m_showLoginScreen) as? () -> Void @@ -2057,6 +2097,12 @@ open class DiscussionRouterMock: DiscussionRouter, Mock { perform?() } + open func showDiscoveryScreen(searchQuery: String?, fromStartupScreen: Bool) { + addInvocation(.m_showDiscoveryScreen__searchQuery_searchQueryfromStartupScreen_fromStartupScreen(Parameter.value(`searchQuery`), Parameter.value(`fromStartupScreen`))) + let perform = methodPerformValue(.m_showDiscoveryScreen__searchQuery_searchQueryfromStartupScreen_fromStartupScreen(Parameter.value(`searchQuery`), Parameter.value(`fromStartupScreen`))) as? (String?, Bool) -> Void + perform?(`searchQuery`, `fromStartupScreen`) + } + open func presentAlert(alertTitle: String, alertMessage: String, positiveAction: String, onCloseTapped: @escaping () -> Void, okTapped: @escaping () -> Void, type: AlertViewType) { addInvocation(.m_presentAlert__alertTitle_alertTitlealertMessage_alertMessagepositiveAction_positiveActiononCloseTapped_onCloseTappedokTapped_okTappedtype_type(Parameter.value(`alertTitle`), Parameter.value(`alertMessage`), Parameter.value(`positiveAction`), Parameter<() -> Void>.value(`onCloseTapped`), Parameter<() -> Void>.value(`okTapped`), Parameter.value(`type`))) let perform = methodPerformValue(.m_presentAlert__alertTitle_alertTitlealertMessage_alertMessagepositiveAction_positiveActiononCloseTapped_onCloseTappedokTapped_okTappedtype_type(Parameter.value(`alertTitle`), Parameter.value(`alertMessage`), Parameter.value(`positiveAction`), Parameter<() -> Void>.value(`onCloseTapped`), Parameter<() -> Void>.value(`okTapped`), Parameter.value(`type`))) as? (String, String, String, @escaping () -> Void, @escaping () -> Void, AlertViewType) -> Void @@ -2095,9 +2141,11 @@ open class DiscussionRouterMock: DiscussionRouter, Mock { case m_dismiss__animated_animated(Parameter) case m_removeLastView__controllers_controllers(Parameter) case m_showMainOrWhatsNewScreen + case m_showStartupScreen case m_showLoginScreen case m_showRegisterScreen case m_showForgotPasswordScreen + case m_showDiscoveryScreen__searchQuery_searchQueryfromStartupScreen_fromStartupScreen(Parameter, Parameter) case m_presentAlert__alertTitle_alertTitlealertMessage_alertMessagepositiveAction_positiveActiononCloseTapped_onCloseTappedokTapped_okTappedtype_type(Parameter, Parameter, Parameter, Parameter<() -> Void>, Parameter<() -> Void>, Parameter) case m_presentAlert__alertTitle_alertTitlealertMessage_alertMessagenextSectionName_nextSectionNameaction_actionimage_imageonCloseTapped_onCloseTappedokTapped_okTappednextSectionTapped_nextSectionTapped(Parameter, Parameter, Parameter, Parameter, Parameter, Parameter<() -> Void>, Parameter<() -> Void>, Parameter<() -> Void>) case m_presentView__transitionStyle_transitionStyleview_view(Parameter, Parameter) @@ -2167,12 +2215,20 @@ open class DiscussionRouterMock: DiscussionRouter, Mock { case (.m_showMainOrWhatsNewScreen, .m_showMainOrWhatsNewScreen): return .match + case (.m_showStartupScreen, .m_showStartupScreen): return .match + case (.m_showLoginScreen, .m_showLoginScreen): return .match case (.m_showRegisterScreen, .m_showRegisterScreen): return .match case (.m_showForgotPasswordScreen, .m_showForgotPasswordScreen): return .match + case (.m_showDiscoveryScreen__searchQuery_searchQueryfromStartupScreen_fromStartupScreen(let lhsSearchquery, let lhsFromstartupscreen), .m_showDiscoveryScreen__searchQuery_searchQueryfromStartupScreen_fromStartupScreen(let rhsSearchquery, let rhsFromstartupscreen)): + var results: [Matcher.ParameterComparisonResult] = [] + results.append(Matcher.ParameterComparisonResult(Parameter.compare(lhs: lhsSearchquery, rhs: rhsSearchquery, with: matcher), lhsSearchquery, rhsSearchquery, "searchQuery")) + results.append(Matcher.ParameterComparisonResult(Parameter.compare(lhs: lhsFromstartupscreen, rhs: rhsFromstartupscreen, with: matcher), lhsFromstartupscreen, rhsFromstartupscreen, "fromStartupScreen")) + return Matcher.ComparisonResult(results) + case (.m_presentAlert__alertTitle_alertTitlealertMessage_alertMessagepositiveAction_positiveActiononCloseTapped_onCloseTappedokTapped_okTappedtype_type(let lhsAlerttitle, let lhsAlertmessage, let lhsPositiveaction, let lhsOnclosetapped, let lhsOktapped, let lhsType), .m_presentAlert__alertTitle_alertTitlealertMessage_alertMessagepositiveAction_positiveActiononCloseTapped_onCloseTappedokTapped_okTappedtype_type(let rhsAlerttitle, let rhsAlertmessage, let rhsPositiveaction, let rhsOnclosetapped, let rhsOktapped, let rhsType)): var results: [Matcher.ParameterComparisonResult] = [] results.append(Matcher.ParameterComparisonResult(Parameter.compare(lhs: lhsAlerttitle, rhs: rhsAlerttitle, with: matcher), lhsAlerttitle, rhsAlerttitle, "alertTitle")) @@ -2224,9 +2280,11 @@ open class DiscussionRouterMock: DiscussionRouter, Mock { case let .m_dismiss__animated_animated(p0): return p0.intValue case let .m_removeLastView__controllers_controllers(p0): return p0.intValue case .m_showMainOrWhatsNewScreen: return 0 + case .m_showStartupScreen: return 0 case .m_showLoginScreen: return 0 case .m_showRegisterScreen: return 0 case .m_showForgotPasswordScreen: return 0 + case let .m_showDiscoveryScreen__searchQuery_searchQueryfromStartupScreen_fromStartupScreen(p0, p1): return p0.intValue + p1.intValue case let .m_presentAlert__alertTitle_alertTitlealertMessage_alertMessagepositiveAction_positiveActiononCloseTapped_onCloseTappedokTapped_okTappedtype_type(p0, p1, p2, p3, p4, p5): return p0.intValue + p1.intValue + p2.intValue + p3.intValue + p4.intValue + p5.intValue case let .m_presentAlert__alertTitle_alertTitlealertMessage_alertMessagenextSectionName_nextSectionNameaction_actionimage_imageonCloseTapped_onCloseTappedokTapped_okTappednextSectionTapped_nextSectionTapped(p0, p1, p2, p3, p4, p5, p6, p7): return p0.intValue + p1.intValue + p2.intValue + p3.intValue + p4.intValue + p5.intValue + p6.intValue + p7.intValue case let .m_presentView__transitionStyle_transitionStyleview_view(p0, p1): return p0.intValue + p1.intValue @@ -2247,9 +2305,11 @@ open class DiscussionRouterMock: DiscussionRouter, Mock { case .m_dismiss__animated_animated: return ".dismiss(animated:)" case .m_removeLastView__controllers_controllers: return ".removeLastView(controllers:)" case .m_showMainOrWhatsNewScreen: return ".showMainOrWhatsNewScreen()" + case .m_showStartupScreen: return ".showStartupScreen()" case .m_showLoginScreen: return ".showLoginScreen()" case .m_showRegisterScreen: return ".showRegisterScreen()" case .m_showForgotPasswordScreen: return ".showForgotPasswordScreen()" + case .m_showDiscoveryScreen__searchQuery_searchQueryfromStartupScreen_fromStartupScreen: return ".showDiscoveryScreen(searchQuery:fromStartupScreen:)" case .m_presentAlert__alertTitle_alertTitlealertMessage_alertMessagepositiveAction_positiveActiononCloseTapped_onCloseTappedokTapped_okTappedtype_type: return ".presentAlert(alertTitle:alertMessage:positiveAction:onCloseTapped:okTapped:type:)" case .m_presentAlert__alertTitle_alertTitlealertMessage_alertMessagenextSectionName_nextSectionNameaction_actionimage_imageonCloseTapped_onCloseTappedokTapped_okTappednextSectionTapped_nextSectionTapped: return ".presentAlert(alertTitle:alertMessage:nextSectionName:action:image:onCloseTapped:okTapped:nextSectionTapped:)" case .m_presentView__transitionStyle_transitionStyleview_view: return ".presentView(transitionStyle:view:)" @@ -2284,9 +2344,11 @@ open class DiscussionRouterMock: DiscussionRouter, Mock { public static func dismiss(animated: Parameter) -> Verify { return Verify(method: .m_dismiss__animated_animated(`animated`))} public static func removeLastView(controllers: Parameter) -> Verify { return Verify(method: .m_removeLastView__controllers_controllers(`controllers`))} public static func showMainOrWhatsNewScreen() -> Verify { return Verify(method: .m_showMainOrWhatsNewScreen)} + public static func showStartupScreen() -> Verify { return Verify(method: .m_showStartupScreen)} public static func showLoginScreen() -> Verify { return Verify(method: .m_showLoginScreen)} public static func showRegisterScreen() -> Verify { return Verify(method: .m_showRegisterScreen)} public static func showForgotPasswordScreen() -> Verify { return Verify(method: .m_showForgotPasswordScreen)} + public static func showDiscoveryScreen(searchQuery: Parameter, fromStartupScreen: Parameter) -> Verify { return Verify(method: .m_showDiscoveryScreen__searchQuery_searchQueryfromStartupScreen_fromStartupScreen(`searchQuery`, `fromStartupScreen`))} public static func presentAlert(alertTitle: Parameter, alertMessage: Parameter, positiveAction: Parameter, onCloseTapped: Parameter<() -> Void>, okTapped: Parameter<() -> Void>, type: Parameter) -> Verify { return Verify(method: .m_presentAlert__alertTitle_alertTitlealertMessage_alertMessagepositiveAction_positiveActiononCloseTapped_onCloseTappedokTapped_okTappedtype_type(`alertTitle`, `alertMessage`, `positiveAction`, `onCloseTapped`, `okTapped`, `type`))} public static func presentAlert(alertTitle: Parameter, alertMessage: Parameter, nextSectionName: Parameter, action: Parameter, image: Parameter, onCloseTapped: Parameter<() -> Void>, okTapped: Parameter<() -> Void>, nextSectionTapped: Parameter<() -> Void>) -> Verify { return Verify(method: .m_presentAlert__alertTitle_alertTitlealertMessage_alertMessagenextSectionName_nextSectionNameaction_actionimage_imageonCloseTapped_onCloseTappedokTapped_okTappednextSectionTapped_nextSectionTapped(`alertTitle`, `alertMessage`, `nextSectionName`, `action`, `image`, `onCloseTapped`, `okTapped`, `nextSectionTapped`))} public static func presentView(transitionStyle: Parameter, view: Parameter) -> Verify { return Verify(method: .m_presentView__transitionStyle_transitionStyleview_view(`transitionStyle`, `view`))} @@ -2333,6 +2395,9 @@ open class DiscussionRouterMock: DiscussionRouter, Mock { public static func showMainOrWhatsNewScreen(perform: @escaping () -> Void) -> Perform { return Perform(method: .m_showMainOrWhatsNewScreen, performs: perform) } + public static func showStartupScreen(perform: @escaping () -> Void) -> Perform { + return Perform(method: .m_showStartupScreen, performs: perform) + } public static func showLoginScreen(perform: @escaping () -> Void) -> Perform { return Perform(method: .m_showLoginScreen, performs: perform) } @@ -2342,6 +2407,9 @@ open class DiscussionRouterMock: DiscussionRouter, Mock { public static func showForgotPasswordScreen(perform: @escaping () -> Void) -> Perform { return Perform(method: .m_showForgotPasswordScreen, performs: perform) } + public static func showDiscoveryScreen(searchQuery: Parameter, fromStartupScreen: Parameter, perform: @escaping (String?, Bool) -> Void) -> Perform { + return Perform(method: .m_showDiscoveryScreen__searchQuery_searchQueryfromStartupScreen_fromStartupScreen(`searchQuery`, `fromStartupScreen`), performs: perform) + } public static func presentAlert(alertTitle: Parameter, alertMessage: Parameter, positiveAction: Parameter, onCloseTapped: Parameter<() -> Void>, okTapped: Parameter<() -> Void>, type: Parameter, perform: @escaping (String, String, String, @escaping () -> Void, @escaping () -> Void, AlertViewType) -> Void) -> Perform { return Perform(method: .m_presentAlert__alertTitle_alertTitlealertMessage_alertMessagepositiveAction_positiveActiononCloseTapped_onCloseTappedokTapped_okTappedtype_type(`alertTitle`, `alertMessage`, `positiveAction`, `onCloseTapped`, `okTapped`, `type`), performs: perform) } diff --git a/OpenEdX/DI/ScreenAssembly.swift b/OpenEdX/DI/ScreenAssembly.swift index c50f7e0f0..b87fa2956 100644 --- a/OpenEdX/DI/ScreenAssembly.swift +++ b/OpenEdX/DI/ScreenAssembly.swift @@ -41,6 +41,14 @@ class ScreenAssembly: Assembly { profileInteractor: r.resolve(ProfileInteractorProtocol.self)! ) } + // MARK: Startup screen + container.register(StartupViewModel.self) { r in + StartupViewModel( + interactor: r.resolve(AuthInteractorProtocol.self)!, + router: r.resolve(AuthorizationRouter.self)!, + analytics: r.resolve(AuthorizationAnalytics.self)! + ) + } // MARK: SignIn container.register(SignInViewModel.self) { r in diff --git a/OpenEdX/RouteController.swift b/OpenEdX/RouteController.swift index 7478fac65..d86e7bb6d 100644 --- a/OpenEdX/RouteController.swift +++ b/OpenEdX/RouteController.swift @@ -36,17 +36,24 @@ class RouteController: UIViewController { } } else { DispatchQueue.main.async { - self.showAuthorization() + self.showStartupScreen() } } } - private func showAuthorization() { - let controller = UIHostingController( - rootView: SignInView(viewModel: diContainer.resolve(SignInViewModel.self)!) - ) - navigation.viewControllers = [controller] - present(navigation, animated: false) + private func showStartupScreen() { + if let config = Container.shared.resolve(ConfigProtocol.self), config.features.startupScreenEnabled { + let controller = UIHostingController( + rootView: StartupView(viewModel: diContainer.resolve(StartupViewModel.self)!)) + navigation.viewControllers = [controller] + present(navigation, animated: false) + } else { + let controller = UIHostingController( + rootView: SignInView(viewModel: diContainer.resolve(SignInViewModel.self)!) + ) + navigation.viewControllers = [controller] + present(navigation, animated: false) + } } private func showMainOrWhatsNewScreen() { diff --git a/OpenEdX/Router.swift b/OpenEdX/Router.swift index 389531979..6746ec652 100644 --- a/OpenEdX/Router.swift +++ b/OpenEdX/Router.swift @@ -85,7 +85,19 @@ public class Router: AuthorizationRouter, public func showLoginScreen() { let view = SignInView(viewModel: Container.shared.resolve(SignInViewModel.self)!) let controller = UIHostingController(rootView: view) - navigationController.setViewControllers([controller], animated: false) + navigationController.pushViewController(controller, animated: true) + } + + public func showStartupScreen() { + if let config = Container.shared.resolve(ConfigProtocol.self), config.features.startupScreenEnabled { + let view = StartupView(viewModel: Container.shared.resolve(StartupViewModel.self)!) + let controller = UIHostingController(rootView: view) + navigationController.setViewControllers([controller], animated: true) + } else { + let view = SignInView(viewModel: Container.shared.resolve(SignInViewModel.self)!) + let controller = UIHostingController(rootView: view) + navigationController.setViewControllers([controller], animated: false) + } } public func presentAppReview() { @@ -175,14 +187,25 @@ public class Router: AuthorizationRouter, navigationController.pushViewController(controller, animated: true) } - public func showDiscoverySearch() { + public func showDiscoverySearch(searchQuery: String? = nil) { let viewModel = Container.shared.resolve(SearchViewModel.self)! - let view = SearchView(viewModel: viewModel) + let view = SearchView(viewModel: viewModel, searchQuery: searchQuery) let controller = UIHostingController(rootView: view) navigationController.pushFade(viewController: controller) } + public func showDiscoveryScreen(searchQuery: String? = nil, fromStartupScreen: Bool = false) { + let view = DiscoveryView( + viewModel: Container.shared.resolve(DiscoveryViewModel.self)!, + router: Container.shared.resolve(DiscoveryRouter.self)!, + searchQuery: searchQuery, + fromStartupScreen: fromStartupScreen + ) + let controller = UIHostingController(rootView: view) + navigationController.pushViewController(controller, animated: true) + } + public func showDiscussionsSearch(courseID: String) { let viewModel = Container.shared.resolve(DiscussionSearchTopicsViewModel.self, argument: courseID)! let view = DiscussionSearchTopicsView(viewModel: viewModel) diff --git a/OpenEdX/View/MainScreenView.swift b/OpenEdX/View/MainScreenView.swift index 2d19c0c8f..db915cdb6 100644 --- a/OpenEdX/View/MainScreenView.swift +++ b/OpenEdX/View/MainScreenView.swift @@ -41,7 +41,8 @@ struct MainScreenView: View { var body: some View { TabView(selection: $selection) { ZStack { - DiscoveryView(viewModel: Container.shared.resolve(DiscoveryViewModel.self)!) + DiscoveryView(viewModel: Container.shared.resolve(DiscoveryViewModel.self)!, + router: Container.shared.resolve(DiscoveryRouter.self)!) if updateAvaliable { UpdateNotificationView(config: viewModel.config) } diff --git a/Profile/Profile/Presentation/Profile/ProfileViewModel.swift b/Profile/Profile/Presentation/Profile/ProfileViewModel.swift index a7647e7df..c5879e0aa 100644 --- a/Profile/Profile/Presentation/Profile/ProfileViewModel.swift +++ b/Profile/Profile/Presentation/Profile/ProfileViewModel.swift @@ -119,7 +119,7 @@ public class ProfileViewModel: ObservableObject { @MainActor func logOut() async { try? await interactor.logOut() - router.showLoginScreen() + router.showStartupScreen() analytics.userLogout(force: false) } diff --git a/Profile/ProfileTests/Presentation/Profile/ProfileViewModelTests.swift b/Profile/ProfileTests/Presentation/Profile/ProfileViewModelTests.swift index a66d1929a..c6888fcaf 100644 --- a/Profile/ProfileTests/Presentation/Profile/ProfileViewModelTests.swift +++ b/Profile/ProfileTests/Presentation/Profile/ProfileViewModelTests.swift @@ -241,7 +241,7 @@ final class ProfileViewModelTests: XCTestCase { await viewModel.logOut() - Verify(router, .showLoginScreen()) + Verify(router, .showStartupScreen()) XCTAssertFalse(viewModel.showError) } diff --git a/Profile/ProfileTests/ProfileMock.generated.swift b/Profile/ProfileTests/ProfileMock.generated.swift index 1321a7d0f..0ebcec11c 100644 --- a/Profile/ProfileTests/ProfileMock.generated.swift +++ b/Profile/ProfileTests/ProfileMock.generated.swift @@ -496,6 +496,12 @@ open class BaseRouterMock: BaseRouter, Mock { perform?() } + open func showStartupScreen() { + addInvocation(.m_showStartupScreen) + let perform = methodPerformValue(.m_showStartupScreen) as? () -> Void + perform?() + } + open func showLoginScreen() { addInvocation(.m_showLoginScreen) let perform = methodPerformValue(.m_showLoginScreen) as? () -> Void @@ -514,6 +520,12 @@ open class BaseRouterMock: BaseRouter, Mock { perform?() } + open func showDiscoveryScreen(searchQuery: String?, fromStartupScreen: Bool) { + addInvocation(.m_showDiscoveryScreen__searchQuery_searchQueryfromStartupScreen_fromStartupScreen(Parameter.value(`searchQuery`), Parameter.value(`fromStartupScreen`))) + let perform = methodPerformValue(.m_showDiscoveryScreen__searchQuery_searchQueryfromStartupScreen_fromStartupScreen(Parameter.value(`searchQuery`), Parameter.value(`fromStartupScreen`))) as? (String?, Bool) -> Void + perform?(`searchQuery`, `fromStartupScreen`) + } + open func presentAlert(alertTitle: String, alertMessage: String, positiveAction: String, onCloseTapped: @escaping () -> Void, okTapped: @escaping () -> Void, type: AlertViewType) { addInvocation(.m_presentAlert__alertTitle_alertTitlealertMessage_alertMessagepositiveAction_positiveActiononCloseTapped_onCloseTappedokTapped_okTappedtype_type(Parameter.value(`alertTitle`), Parameter.value(`alertMessage`), Parameter.value(`positiveAction`), Parameter<() -> Void>.value(`onCloseTapped`), Parameter<() -> Void>.value(`okTapped`), Parameter.value(`type`))) let perform = methodPerformValue(.m_presentAlert__alertTitle_alertTitlealertMessage_alertMessagepositiveAction_positiveActiononCloseTapped_onCloseTappedokTapped_okTappedtype_type(Parameter.value(`alertTitle`), Parameter.value(`alertMessage`), Parameter.value(`positiveAction`), Parameter<() -> Void>.value(`onCloseTapped`), Parameter<() -> Void>.value(`okTapped`), Parameter.value(`type`))) as? (String, String, String, @escaping () -> Void, @escaping () -> Void, AlertViewType) -> Void @@ -546,9 +558,11 @@ open class BaseRouterMock: BaseRouter, Mock { case m_dismiss__animated_animated(Parameter) case m_removeLastView__controllers_controllers(Parameter) case m_showMainOrWhatsNewScreen + case m_showStartupScreen case m_showLoginScreen case m_showRegisterScreen case m_showForgotPasswordScreen + case m_showDiscoveryScreen__searchQuery_searchQueryfromStartupScreen_fromStartupScreen(Parameter, Parameter) case m_presentAlert__alertTitle_alertTitlealertMessage_alertMessagepositiveAction_positiveActiononCloseTapped_onCloseTappedokTapped_okTappedtype_type(Parameter, Parameter, Parameter, Parameter<() -> Void>, Parameter<() -> Void>, Parameter) case m_presentAlert__alertTitle_alertTitlealertMessage_alertMessagenextSectionName_nextSectionNameaction_actionimage_imageonCloseTapped_onCloseTappedokTapped_okTappednextSectionTapped_nextSectionTapped(Parameter, Parameter, Parameter, Parameter, Parameter, Parameter<() -> Void>, Parameter<() -> Void>, Parameter<() -> Void>) case m_presentView__transitionStyle_transitionStyleview_view(Parameter, Parameter) @@ -580,12 +594,20 @@ open class BaseRouterMock: BaseRouter, Mock { case (.m_showMainOrWhatsNewScreen, .m_showMainOrWhatsNewScreen): return .match + case (.m_showStartupScreen, .m_showStartupScreen): return .match + case (.m_showLoginScreen, .m_showLoginScreen): return .match case (.m_showRegisterScreen, .m_showRegisterScreen): return .match case (.m_showForgotPasswordScreen, .m_showForgotPasswordScreen): return .match + case (.m_showDiscoveryScreen__searchQuery_searchQueryfromStartupScreen_fromStartupScreen(let lhsSearchquery, let lhsFromstartupscreen), .m_showDiscoveryScreen__searchQuery_searchQueryfromStartupScreen_fromStartupScreen(let rhsSearchquery, let rhsFromstartupscreen)): + var results: [Matcher.ParameterComparisonResult] = [] + results.append(Matcher.ParameterComparisonResult(Parameter.compare(lhs: lhsSearchquery, rhs: rhsSearchquery, with: matcher), lhsSearchquery, rhsSearchquery, "searchQuery")) + results.append(Matcher.ParameterComparisonResult(Parameter.compare(lhs: lhsFromstartupscreen, rhs: rhsFromstartupscreen, with: matcher), lhsFromstartupscreen, rhsFromstartupscreen, "fromStartupScreen")) + return Matcher.ComparisonResult(results) + case (.m_presentAlert__alertTitle_alertTitlealertMessage_alertMessagepositiveAction_positiveActiononCloseTapped_onCloseTappedokTapped_okTappedtype_type(let lhsAlerttitle, let lhsAlertmessage, let lhsPositiveaction, let lhsOnclosetapped, let lhsOktapped, let lhsType), .m_presentAlert__alertTitle_alertTitlealertMessage_alertMessagepositiveAction_positiveActiononCloseTapped_onCloseTappedokTapped_okTappedtype_type(let rhsAlerttitle, let rhsAlertmessage, let rhsPositiveaction, let rhsOnclosetapped, let rhsOktapped, let rhsType)): var results: [Matcher.ParameterComparisonResult] = [] results.append(Matcher.ParameterComparisonResult(Parameter.compare(lhs: lhsAlerttitle, rhs: rhsAlerttitle, with: matcher), lhsAlerttitle, rhsAlerttitle, "alertTitle")) @@ -631,9 +653,11 @@ open class BaseRouterMock: BaseRouter, Mock { case let .m_dismiss__animated_animated(p0): return p0.intValue case let .m_removeLastView__controllers_controllers(p0): return p0.intValue case .m_showMainOrWhatsNewScreen: return 0 + case .m_showStartupScreen: return 0 case .m_showLoginScreen: return 0 case .m_showRegisterScreen: return 0 case .m_showForgotPasswordScreen: return 0 + case let .m_showDiscoveryScreen__searchQuery_searchQueryfromStartupScreen_fromStartupScreen(p0, p1): return p0.intValue + p1.intValue case let .m_presentAlert__alertTitle_alertTitlealertMessage_alertMessagepositiveAction_positiveActiononCloseTapped_onCloseTappedokTapped_okTappedtype_type(p0, p1, p2, p3, p4, p5): return p0.intValue + p1.intValue + p2.intValue + p3.intValue + p4.intValue + p5.intValue case let .m_presentAlert__alertTitle_alertTitlealertMessage_alertMessagenextSectionName_nextSectionNameaction_actionimage_imageonCloseTapped_onCloseTappedokTapped_okTappednextSectionTapped_nextSectionTapped(p0, p1, p2, p3, p4, p5, p6, p7): return p0.intValue + p1.intValue + p2.intValue + p3.intValue + p4.intValue + p5.intValue + p6.intValue + p7.intValue case let .m_presentView__transitionStyle_transitionStyleview_view(p0, p1): return p0.intValue + p1.intValue @@ -648,9 +672,11 @@ open class BaseRouterMock: BaseRouter, Mock { case .m_dismiss__animated_animated: return ".dismiss(animated:)" case .m_removeLastView__controllers_controllers: return ".removeLastView(controllers:)" case .m_showMainOrWhatsNewScreen: return ".showMainOrWhatsNewScreen()" + case .m_showStartupScreen: return ".showStartupScreen()" case .m_showLoginScreen: return ".showLoginScreen()" case .m_showRegisterScreen: return ".showRegisterScreen()" case .m_showForgotPasswordScreen: return ".showForgotPasswordScreen()" + case .m_showDiscoveryScreen__searchQuery_searchQueryfromStartupScreen_fromStartupScreen: return ".showDiscoveryScreen(searchQuery:fromStartupScreen:)" case .m_presentAlert__alertTitle_alertTitlealertMessage_alertMessagepositiveAction_positiveActiononCloseTapped_onCloseTappedokTapped_okTappedtype_type: return ".presentAlert(alertTitle:alertMessage:positiveAction:onCloseTapped:okTapped:type:)" case .m_presentAlert__alertTitle_alertTitlealertMessage_alertMessagenextSectionName_nextSectionNameaction_actionimage_imageonCloseTapped_onCloseTappedokTapped_okTappednextSectionTapped_nextSectionTapped: return ".presentAlert(alertTitle:alertMessage:nextSectionName:action:image:onCloseTapped:okTapped:nextSectionTapped:)" case .m_presentView__transitionStyle_transitionStyleview_view: return ".presentView(transitionStyle:view:)" @@ -679,9 +705,11 @@ open class BaseRouterMock: BaseRouter, Mock { public static func dismiss(animated: Parameter) -> Verify { return Verify(method: .m_dismiss__animated_animated(`animated`))} public static func removeLastView(controllers: Parameter) -> Verify { return Verify(method: .m_removeLastView__controllers_controllers(`controllers`))} public static func showMainOrWhatsNewScreen() -> Verify { return Verify(method: .m_showMainOrWhatsNewScreen)} + public static func showStartupScreen() -> Verify { return Verify(method: .m_showStartupScreen)} public static func showLoginScreen() -> Verify { return Verify(method: .m_showLoginScreen)} public static func showRegisterScreen() -> Verify { return Verify(method: .m_showRegisterScreen)} public static func showForgotPasswordScreen() -> Verify { return Verify(method: .m_showForgotPasswordScreen)} + public static func showDiscoveryScreen(searchQuery: Parameter, fromStartupScreen: Parameter) -> Verify { return Verify(method: .m_showDiscoveryScreen__searchQuery_searchQueryfromStartupScreen_fromStartupScreen(`searchQuery`, `fromStartupScreen`))} public static func presentAlert(alertTitle: Parameter, alertMessage: Parameter, positiveAction: Parameter, onCloseTapped: Parameter<() -> Void>, okTapped: Parameter<() -> Void>, type: Parameter) -> Verify { return Verify(method: .m_presentAlert__alertTitle_alertTitlealertMessage_alertMessagepositiveAction_positiveActiononCloseTapped_onCloseTappedokTapped_okTappedtype_type(`alertTitle`, `alertMessage`, `positiveAction`, `onCloseTapped`, `okTapped`, `type`))} public static func presentAlert(alertTitle: Parameter, alertMessage: Parameter, nextSectionName: Parameter, action: Parameter, image: Parameter, onCloseTapped: Parameter<() -> Void>, okTapped: Parameter<() -> Void>, nextSectionTapped: Parameter<() -> Void>) -> Verify { return Verify(method: .m_presentAlert__alertTitle_alertTitlealertMessage_alertMessagenextSectionName_nextSectionNameaction_actionimage_imageonCloseTapped_onCloseTappedokTapped_okTappednextSectionTapped_nextSectionTapped(`alertTitle`, `alertMessage`, `nextSectionName`, `action`, `image`, `onCloseTapped`, `okTapped`, `nextSectionTapped`))} public static func presentView(transitionStyle: Parameter, view: Parameter) -> Verify { return Verify(method: .m_presentView__transitionStyle_transitionStyleview_view(`transitionStyle`, `view`))} @@ -710,6 +738,9 @@ open class BaseRouterMock: BaseRouter, Mock { public static func showMainOrWhatsNewScreen(perform: @escaping () -> Void) -> Perform { return Perform(method: .m_showMainOrWhatsNewScreen, performs: perform) } + public static func showStartupScreen(perform: @escaping () -> Void) -> Perform { + return Perform(method: .m_showStartupScreen, performs: perform) + } public static func showLoginScreen(perform: @escaping () -> Void) -> Perform { return Perform(method: .m_showLoginScreen, performs: perform) } @@ -719,6 +750,9 @@ open class BaseRouterMock: BaseRouter, Mock { public static func showForgotPasswordScreen(perform: @escaping () -> Void) -> Perform { return Perform(method: .m_showForgotPasswordScreen, performs: perform) } + public static func showDiscoveryScreen(searchQuery: Parameter, fromStartupScreen: Parameter, perform: @escaping (String?, Bool) -> Void) -> Perform { + return Perform(method: .m_showDiscoveryScreen__searchQuery_searchQueryfromStartupScreen_fromStartupScreen(`searchQuery`, `fromStartupScreen`), performs: perform) + } public static func presentAlert(alertTitle: Parameter, alertMessage: Parameter, positiveAction: Parameter, onCloseTapped: Parameter<() -> Void>, okTapped: Parameter<() -> Void>, type: Parameter, perform: @escaping (String, String, String, @escaping () -> Void, @escaping () -> Void, AlertViewType) -> Void) -> Perform { return Perform(method: .m_presentAlert__alertTitle_alertTitlealertMessage_alertMessagepositiveAction_positiveActiononCloseTapped_onCloseTappedokTapped_okTappedtype_type(`alertTitle`, `alertMessage`, `positiveAction`, `onCloseTapped`, `okTapped`, `type`), performs: perform) } @@ -2370,6 +2404,12 @@ open class ProfileRouterMock: ProfileRouter, Mock { perform?() } + open func showStartupScreen() { + addInvocation(.m_showStartupScreen) + let perform = methodPerformValue(.m_showStartupScreen) as? () -> Void + perform?() + } + open func showLoginScreen() { addInvocation(.m_showLoginScreen) let perform = methodPerformValue(.m_showLoginScreen) as? () -> Void @@ -2388,6 +2428,12 @@ open class ProfileRouterMock: ProfileRouter, Mock { perform?() } + open func showDiscoveryScreen(searchQuery: String?, fromStartupScreen: Bool) { + addInvocation(.m_showDiscoveryScreen__searchQuery_searchQueryfromStartupScreen_fromStartupScreen(Parameter.value(`searchQuery`), Parameter.value(`fromStartupScreen`))) + let perform = methodPerformValue(.m_showDiscoveryScreen__searchQuery_searchQueryfromStartupScreen_fromStartupScreen(Parameter.value(`searchQuery`), Parameter.value(`fromStartupScreen`))) as? (String?, Bool) -> Void + perform?(`searchQuery`, `fromStartupScreen`) + } + open func presentAlert(alertTitle: String, alertMessage: String, positiveAction: String, onCloseTapped: @escaping () -> Void, okTapped: @escaping () -> Void, type: AlertViewType) { addInvocation(.m_presentAlert__alertTitle_alertTitlealertMessage_alertMessagepositiveAction_positiveActiononCloseTapped_onCloseTappedokTapped_okTappedtype_type(Parameter.value(`alertTitle`), Parameter.value(`alertMessage`), Parameter.value(`positiveAction`), Parameter<() -> Void>.value(`onCloseTapped`), Parameter<() -> Void>.value(`okTapped`), Parameter.value(`type`))) let perform = methodPerformValue(.m_presentAlert__alertTitle_alertTitlealertMessage_alertMessagepositiveAction_positiveActiononCloseTapped_onCloseTappedokTapped_okTappedtype_type(Parameter.value(`alertTitle`), Parameter.value(`alertMessage`), Parameter.value(`positiveAction`), Parameter<() -> Void>.value(`onCloseTapped`), Parameter<() -> Void>.value(`okTapped`), Parameter.value(`type`))) as? (String, String, String, @escaping () -> Void, @escaping () -> Void, AlertViewType) -> Void @@ -2424,9 +2470,11 @@ open class ProfileRouterMock: ProfileRouter, Mock { case m_dismiss__animated_animated(Parameter) case m_removeLastView__controllers_controllers(Parameter) case m_showMainOrWhatsNewScreen + case m_showStartupScreen case m_showLoginScreen case m_showRegisterScreen case m_showForgotPasswordScreen + case m_showDiscoveryScreen__searchQuery_searchQueryfromStartupScreen_fromStartupScreen(Parameter, Parameter) case m_presentAlert__alertTitle_alertTitlealertMessage_alertMessagepositiveAction_positiveActiononCloseTapped_onCloseTappedokTapped_okTappedtype_type(Parameter, Parameter, Parameter, Parameter<() -> Void>, Parameter<() -> Void>, Parameter) case m_presentAlert__alertTitle_alertTitlealertMessage_alertMessagenextSectionName_nextSectionNameaction_actionimage_imageonCloseTapped_onCloseTappedokTapped_okTappednextSectionTapped_nextSectionTapped(Parameter, Parameter, Parameter, Parameter, Parameter, Parameter<() -> Void>, Parameter<() -> Void>, Parameter<() -> Void>) case m_presentView__transitionStyle_transitionStyleview_view(Parameter, Parameter) @@ -2474,12 +2522,20 @@ open class ProfileRouterMock: ProfileRouter, Mock { case (.m_showMainOrWhatsNewScreen, .m_showMainOrWhatsNewScreen): return .match + case (.m_showStartupScreen, .m_showStartupScreen): return .match + case (.m_showLoginScreen, .m_showLoginScreen): return .match case (.m_showRegisterScreen, .m_showRegisterScreen): return .match case (.m_showForgotPasswordScreen, .m_showForgotPasswordScreen): return .match + case (.m_showDiscoveryScreen__searchQuery_searchQueryfromStartupScreen_fromStartupScreen(let lhsSearchquery, let lhsFromstartupscreen), .m_showDiscoveryScreen__searchQuery_searchQueryfromStartupScreen_fromStartupScreen(let rhsSearchquery, let rhsFromstartupscreen)): + var results: [Matcher.ParameterComparisonResult] = [] + results.append(Matcher.ParameterComparisonResult(Parameter.compare(lhs: lhsSearchquery, rhs: rhsSearchquery, with: matcher), lhsSearchquery, rhsSearchquery, "searchQuery")) + results.append(Matcher.ParameterComparisonResult(Parameter.compare(lhs: lhsFromstartupscreen, rhs: rhsFromstartupscreen, with: matcher), lhsFromstartupscreen, rhsFromstartupscreen, "fromStartupScreen")) + return Matcher.ComparisonResult(results) + case (.m_presentAlert__alertTitle_alertTitlealertMessage_alertMessagepositiveAction_positiveActiononCloseTapped_onCloseTappedokTapped_okTappedtype_type(let lhsAlerttitle, let lhsAlertmessage, let lhsPositiveaction, let lhsOnclosetapped, let lhsOktapped, let lhsType), .m_presentAlert__alertTitle_alertTitlealertMessage_alertMessagepositiveAction_positiveActiononCloseTapped_onCloseTappedokTapped_okTappedtype_type(let rhsAlerttitle, let rhsAlertmessage, let rhsPositiveaction, let rhsOnclosetapped, let rhsOktapped, let rhsType)): var results: [Matcher.ParameterComparisonResult] = [] results.append(Matcher.ParameterComparisonResult(Parameter.compare(lhs: lhsAlerttitle, rhs: rhsAlerttitle, with: matcher), lhsAlerttitle, rhsAlerttitle, "alertTitle")) @@ -2529,9 +2585,11 @@ open class ProfileRouterMock: ProfileRouter, Mock { case let .m_dismiss__animated_animated(p0): return p0.intValue case let .m_removeLastView__controllers_controllers(p0): return p0.intValue case .m_showMainOrWhatsNewScreen: return 0 + case .m_showStartupScreen: return 0 case .m_showLoginScreen: return 0 case .m_showRegisterScreen: return 0 case .m_showForgotPasswordScreen: return 0 + case let .m_showDiscoveryScreen__searchQuery_searchQueryfromStartupScreen_fromStartupScreen(p0, p1): return p0.intValue + p1.intValue case let .m_presentAlert__alertTitle_alertTitlealertMessage_alertMessagepositiveAction_positiveActiononCloseTapped_onCloseTappedokTapped_okTappedtype_type(p0, p1, p2, p3, p4, p5): return p0.intValue + p1.intValue + p2.intValue + p3.intValue + p4.intValue + p5.intValue case let .m_presentAlert__alertTitle_alertTitlealertMessage_alertMessagenextSectionName_nextSectionNameaction_actionimage_imageonCloseTapped_onCloseTappedokTapped_okTappednextSectionTapped_nextSectionTapped(p0, p1, p2, p3, p4, p5, p6, p7): return p0.intValue + p1.intValue + p2.intValue + p3.intValue + p4.intValue + p5.intValue + p6.intValue + p7.intValue case let .m_presentView__transitionStyle_transitionStyleview_view(p0, p1): return p0.intValue + p1.intValue @@ -2550,9 +2608,11 @@ open class ProfileRouterMock: ProfileRouter, Mock { case .m_dismiss__animated_animated: return ".dismiss(animated:)" case .m_removeLastView__controllers_controllers: return ".removeLastView(controllers:)" case .m_showMainOrWhatsNewScreen: return ".showMainOrWhatsNewScreen()" + case .m_showStartupScreen: return ".showStartupScreen()" case .m_showLoginScreen: return ".showLoginScreen()" case .m_showRegisterScreen: return ".showRegisterScreen()" case .m_showForgotPasswordScreen: return ".showForgotPasswordScreen()" + case .m_showDiscoveryScreen__searchQuery_searchQueryfromStartupScreen_fromStartupScreen: return ".showDiscoveryScreen(searchQuery:fromStartupScreen:)" case .m_presentAlert__alertTitle_alertTitlealertMessage_alertMessagepositiveAction_positiveActiononCloseTapped_onCloseTappedokTapped_okTappedtype_type: return ".presentAlert(alertTitle:alertMessage:positiveAction:onCloseTapped:okTapped:type:)" case .m_presentAlert__alertTitle_alertTitlealertMessage_alertMessagenextSectionName_nextSectionNameaction_actionimage_imageonCloseTapped_onCloseTappedokTapped_okTappednextSectionTapped_nextSectionTapped: return ".presentAlert(alertTitle:alertMessage:nextSectionName:action:image:onCloseTapped:okTapped:nextSectionTapped:)" case .m_presentView__transitionStyle_transitionStyleview_view: return ".presentView(transitionStyle:view:)" @@ -2585,9 +2645,11 @@ open class ProfileRouterMock: ProfileRouter, Mock { public static func dismiss(animated: Parameter) -> Verify { return Verify(method: .m_dismiss__animated_animated(`animated`))} public static func removeLastView(controllers: Parameter) -> Verify { return Verify(method: .m_removeLastView__controllers_controllers(`controllers`))} public static func showMainOrWhatsNewScreen() -> Verify { return Verify(method: .m_showMainOrWhatsNewScreen)} + public static func showStartupScreen() -> Verify { return Verify(method: .m_showStartupScreen)} public static func showLoginScreen() -> Verify { return Verify(method: .m_showLoginScreen)} public static func showRegisterScreen() -> Verify { return Verify(method: .m_showRegisterScreen)} public static func showForgotPasswordScreen() -> Verify { return Verify(method: .m_showForgotPasswordScreen)} + public static func showDiscoveryScreen(searchQuery: Parameter, fromStartupScreen: Parameter) -> Verify { return Verify(method: .m_showDiscoveryScreen__searchQuery_searchQueryfromStartupScreen_fromStartupScreen(`searchQuery`, `fromStartupScreen`))} public static func presentAlert(alertTitle: Parameter, alertMessage: Parameter, positiveAction: Parameter, onCloseTapped: Parameter<() -> Void>, okTapped: Parameter<() -> Void>, type: Parameter) -> Verify { return Verify(method: .m_presentAlert__alertTitle_alertTitlealertMessage_alertMessagepositiveAction_positiveActiononCloseTapped_onCloseTappedokTapped_okTappedtype_type(`alertTitle`, `alertMessage`, `positiveAction`, `onCloseTapped`, `okTapped`, `type`))} public static func presentAlert(alertTitle: Parameter, alertMessage: Parameter, nextSectionName: Parameter, action: Parameter, image: Parameter, onCloseTapped: Parameter<() -> Void>, okTapped: Parameter<() -> Void>, nextSectionTapped: Parameter<() -> Void>) -> Verify { return Verify(method: .m_presentAlert__alertTitle_alertTitlealertMessage_alertMessagenextSectionName_nextSectionNameaction_actionimage_imageonCloseTapped_onCloseTappedokTapped_okTappednextSectionTapped_nextSectionTapped(`alertTitle`, `alertMessage`, `nextSectionName`, `action`, `image`, `onCloseTapped`, `okTapped`, `nextSectionTapped`))} public static func presentView(transitionStyle: Parameter, view: Parameter) -> Verify { return Verify(method: .m_presentView__transitionStyle_transitionStyleview_view(`transitionStyle`, `view`))} @@ -2628,6 +2690,9 @@ open class ProfileRouterMock: ProfileRouter, Mock { public static func showMainOrWhatsNewScreen(perform: @escaping () -> Void) -> Perform { return Perform(method: .m_showMainOrWhatsNewScreen, performs: perform) } + public static func showStartupScreen(perform: @escaping () -> Void) -> Perform { + return Perform(method: .m_showStartupScreen, performs: perform) + } public static func showLoginScreen(perform: @escaping () -> Void) -> Perform { return Perform(method: .m_showLoginScreen, performs: perform) } @@ -2637,6 +2702,9 @@ open class ProfileRouterMock: ProfileRouter, Mock { public static func showForgotPasswordScreen(perform: @escaping () -> Void) -> Perform { return Perform(method: .m_showForgotPasswordScreen, performs: perform) } + public static func showDiscoveryScreen(searchQuery: Parameter, fromStartupScreen: Parameter, perform: @escaping (String?, Bool) -> Void) -> Perform { + return Perform(method: .m_showDiscoveryScreen__searchQuery_searchQueryfromStartupScreen_fromStartupScreen(`searchQuery`, `fromStartupScreen`), performs: perform) + } public static func presentAlert(alertTitle: Parameter, alertMessage: Parameter, positiveAction: Parameter, onCloseTapped: Parameter<() -> Void>, okTapped: Parameter<() -> Void>, type: Parameter, perform: @escaping (String, String, String, @escaping () -> Void, @escaping () -> Void, AlertViewType) -> Void) -> Perform { return Perform(method: .m_presentAlert__alertTitle_alertTitlealertMessage_alertMessagepositiveAction_positiveActiononCloseTapped_onCloseTappedokTapped_okTappedtype_type(`alertTitle`, `alertMessage`, `positiveAction`, `onCloseTapped`, `okTapped`, `type`), performs: perform) } diff --git a/ci_scripts/ci_prepare_env.sh b/ci_scripts/ci_prepare_env.sh index 477bd65a3..a340aabb9 100644 --- a/ci_scripts/ci_prepare_env.sh +++ b/ci_scripts/ci_prepare_env.sh @@ -35,7 +35,6 @@ install_xcode_cloud_brew_dependencies () { setup_github_actions_environment() { # brew update && brew install xcodegen git-lfs imagemagick - brew update && brew install xcodegen git-lfs bundle config path vendor/bundle