diff --git a/Authorization/Authorization/Presentation/AuthorizationAnalytics.swift b/Authorization/Authorization/Presentation/AuthorizationAnalytics.swift index 240f60fa..103d64a1 100644 --- a/Authorization/Authorization/Presentation/AuthorizationAnalytics.swift +++ b/Authorization/Authorization/Presentation/AuthorizationAnalytics.swift @@ -12,7 +12,7 @@ import OEXFoundation public enum AuthMethod: Equatable { case password case SSO - case socailAuth(SocialAuthMethod) + case socialAuth(SocialAuthMethod) public var analyticsValue: String { switch self { @@ -20,7 +20,7 @@ public enum AuthMethod: Equatable { "password" case .SSO: "SSO" - case .socailAuth(let socialAuthMethod): + case .socialAuth(let socialAuthMethod): socialAuthMethod.rawValue } } diff --git a/Authorization/Authorization/Presentation/Login/SignInViewModel.swift b/Authorization/Authorization/Presentation/Login/SignInViewModel.swift index d0538670..17180a06 100644 --- a/Authorization/Authorization/Presentation/Login/SignInViewModel.swift +++ b/Authorization/Authorization/Presentation/Login/SignInViewModel.swift @@ -86,7 +86,7 @@ public class SignInViewModel: ObservableObject { let user = try await interactor.login(username: username, password: password) analytics.identify(id: "\(user.id)", username: user.username, email: user.email) analytics.userLogin(method: .password) - router.showMainOrWhatsNewScreen(sourceScreen: sourceScreen, authMethod: nil) + router.showMainOrWhatsNewScreen(sourceScreen: sourceScreen, postLoginData: nil) NotificationCenter.default.post(name: .userAuthorized, object: nil) } catch let error { failure(error) @@ -101,7 +101,7 @@ public class SignInViewModel: ObservableObject { let user = try await interactor.login(ssoToken: "") analytics.identify(id: "\(user.id)", username: user.username, email: user.email) analytics.userLogin(method: .password) - router.showMainOrWhatsNewScreen(sourceScreen: sourceScreen, authMethod: nil) + router.showMainOrWhatsNewScreen(sourceScreen: sourceScreen, postLoginData: nil) } catch let error { failure(error) } @@ -132,14 +132,11 @@ public class SignInViewModel: ObservableObject { let user = try await interactor.login(externalToken: externalToken, backend: backend) analytics.identify(id: "\(user.id)", username: user.username, email: user.email) analytics.userLogin(method: authMethod) - var socialAuthMethod: String? - if case AuthMethod.socailAuth(let method) = authMethod { - socialAuthMethod = method.rawValue + var postLoginData: PostLoginData? + if case .socialAuth(let socialMethod) = authMethod { + postLoginData = PostLoginData(authMethod: socialMethod.rawValue, showSocialRegisterBanner: false) } - router.showMainOrWhatsNewScreen( - sourceScreen: sourceScreen, - authMethod: socialAuthMethod - ) + router.showMainOrWhatsNewScreen(sourceScreen: sourceScreen, postLoginData: postLoginData) NotificationCenter.default.post(name: .userAuthorized, object: nil) } catch let error { failure(error, authMethod: authMethod) diff --git a/Authorization/Authorization/Presentation/Registration/SignUpViewModel.swift b/Authorization/Authorization/Presentation/Registration/SignUpViewModel.swift index 51d2db3f..88af3477 100644 --- a/Authorization/Authorization/Presentation/Registration/SignUpViewModel.swift +++ b/Authorization/Authorization/Presentation/Registration/SignUpViewModel.swift @@ -140,14 +140,11 @@ public final class SignUpViewModel: ObservableObject { analytics.identify(id: "\(user.id)", username: user.username, email: user.email) analytics.registrationSuccess(method: authMetod.analyticsValue) isShowProgress = false - var socialAuthMethod: String? - if case AuthMethod.socailAuth(let method) = authMethod { - socialAuthMethod = method.rawValue + var postLoginData: PostLoginData? + if case .socialAuth(let socialMethod) = authMethod { + postLoginData = PostLoginData(authMethod: socialMethod.rawValue, showSocialRegisterBanner: false) } - router.showMainOrWhatsNewScreen( - sourceScreen: sourceScreen, - authMethod: socialAuthMethod - ) + router.showMainOrWhatsNewScreen(sourceScreen: sourceScreen, postLoginData: postLoginData) NotificationCenter.default.post(name: .userAuthorized, object: nil) } catch let error { isShowProgress = false @@ -204,21 +201,12 @@ public final class SignUpViewModel: ObservableObject { analytics.identify(id: "\(user.id)", username: user.username, email: user.email) analytics.userLogin(method: authMethod) isShowProgress = false - var socialAuthMethod: String? - if case AuthMethod.socailAuth(let method) = authMethod { - socialAuthMethod = method.rawValue + var postLoginData: PostLoginData? + if case .socialAuth(let socialMethod) = authMethod { + postLoginData = PostLoginData(authMethod: socialMethod.rawValue, showSocialRegisterBanner: true) } - router.showMainOrWhatsNewScreen( - sourceScreen: sourceScreen, - authMethod: socialAuthMethod - ) - NotificationCenter.default.post( - name: .userAuthorized, - object: [ - "authMethod": authMethod, - "showSocialRegisterBanner": true - ] - ) + router.showMainOrWhatsNewScreen(sourceScreen: sourceScreen, postLoginData: postLoginData) + NotificationCenter.default.post(name: .userAuthorized, object: nil) } catch { update(fullName: response.name, email: response.email) self.externalToken = response.token diff --git a/Authorization/Authorization/Presentation/SSO/SSOWebViewModel.swift b/Authorization/Authorization/Presentation/SSO/SSOWebViewModel.swift index 198766e2..a1bd5793 100644 --- a/Authorization/Authorization/Presentation/SSO/SSOWebViewModel.swift +++ b/Authorization/Authorization/Presentation/SSO/SSOWebViewModel.swift @@ -82,7 +82,7 @@ public class SSOWebViewModel: ObservableObject { let user = try await interactor.login(ssoToken: "\(payload).\(signature)") analytics.identify(id: "\(user.id)", username: user.username, email: user.email) analytics.userLogin(method: .SSO) - router.showMainOrWhatsNewScreen(sourceScreen: sourceScreen, authMethod: nil) + router.showMainOrWhatsNewScreen(sourceScreen: sourceScreen, postLoginData: nil) } catch let error { failure(error, authMethod: .SSO) } diff --git a/Authorization/Authorization/Presentation/SocialAuth/SocialAuthViewModel.swift b/Authorization/Authorization/Presentation/SocialAuth/SocialAuthViewModel.swift index 4182c390..8ebd6e35 100644 --- a/Authorization/Authorization/Presentation/SocialAuth/SocialAuthViewModel.swift +++ b/Authorization/Authorization/Presentation/SocialAuth/SocialAuthViewModel.swift @@ -35,13 +35,13 @@ enum SocialAuthDetails { var authMethod: AuthMethod { switch self { case .apple: - .socailAuth(.apple) + .socialAuth(.apple) case .facebook: - .socailAuth(.facebook) + .socialAuth(.facebook) case .google: - .socailAuth(.google) + .socialAuth(.google) case .microsoft: - .socailAuth(.microsoft) + .socialAuth(.microsoft) } } diff --git a/Authorization/AuthorizationTests/AuthorizationMock.generated.swift b/Authorization/AuthorizationTests/AuthorizationMock.generated.swift index df20635a..00af73a9 100644 --- a/Authorization/AuthorizationTests/AuthorizationMock.generated.swift +++ b/Authorization/AuthorizationTests/AuthorizationMock.generated.swift @@ -927,10 +927,10 @@ open class AuthorizationRouterMock: AuthorizationRouter, Mock { perform?(`controllers`) } - open func showMainOrWhatsNewScreen(sourceScreen: LogistrationSourceScreen, authMethod: String?) { - addInvocation(.m_showMainOrWhatsNewScreen__sourceScreen_sourceScreenauthMethod_authMethod(Parameter.value(`sourceScreen`), Parameter.value(`authMethod`))) - let perform = methodPerformValue(.m_showMainOrWhatsNewScreen__sourceScreen_sourceScreenauthMethod_authMethod(Parameter.value(`sourceScreen`), Parameter.value(`authMethod`))) as? (LogistrationSourceScreen, String?) -> Void - perform?(`sourceScreen`, `authMethod`) + open func showMainOrWhatsNewScreen(sourceScreen: LogistrationSourceScreen, postLoginData: PostLoginData?) { + addInvocation(.m_showMainOrWhatsNewScreen__sourceScreen_sourceScreenpostLoginData_postLoginData(Parameter.value(`sourceScreen`), Parameter.value(`postLoginData`))) + let perform = methodPerformValue(.m_showMainOrWhatsNewScreen__sourceScreen_sourceScreenpostLoginData_postLoginData(Parameter.value(`sourceScreen`), Parameter.value(`postLoginData`))) as? (LogistrationSourceScreen, PostLoginData?) -> Void + perform?(`sourceScreen`, `postLoginData`) } open func showStartupScreen() { @@ -1007,7 +1007,7 @@ open class AuthorizationRouterMock: AuthorizationRouter, Mock { case m_backWithFade case m_dismiss__animated_animated(Parameter) case m_removeLastView__controllers_controllers(Parameter) - case m_showMainOrWhatsNewScreen__sourceScreen_sourceScreenauthMethod_authMethod(Parameter, Parameter) + case m_showMainOrWhatsNewScreen__sourceScreen_sourceScreenpostLoginData_postLoginData(Parameter, Parameter) case m_showStartupScreen case m_showLoginScreen__sourceScreen_sourceScreen(Parameter) case m_showRegisterScreen__sourceScreen_sourceScreen(Parameter) @@ -1049,10 +1049,10 @@ open class AuthorizationRouterMock: AuthorizationRouter, Mock { results.append(Matcher.ParameterComparisonResult(Parameter.compare(lhs: lhsControllers, rhs: rhsControllers, with: matcher), lhsControllers, rhsControllers, "controllers")) return Matcher.ComparisonResult(results) - case (.m_showMainOrWhatsNewScreen__sourceScreen_sourceScreenauthMethod_authMethod(let lhsSourcescreen, let lhsAuthmethod), .m_showMainOrWhatsNewScreen__sourceScreen_sourceScreenauthMethod_authMethod(let rhsSourcescreen, let rhsAuthmethod)): + case (.m_showMainOrWhatsNewScreen__sourceScreen_sourceScreenpostLoginData_postLoginData(let lhsSourcescreen, let lhsPostlogindata), .m_showMainOrWhatsNewScreen__sourceScreen_sourceScreenpostLoginData_postLoginData(let rhsSourcescreen, let rhsPostlogindata)): var results: [Matcher.ParameterComparisonResult] = [] results.append(Matcher.ParameterComparisonResult(Parameter.compare(lhs: lhsSourcescreen, rhs: rhsSourcescreen, with: matcher), lhsSourcescreen, rhsSourcescreen, "sourceScreen")) - results.append(Matcher.ParameterComparisonResult(Parameter.compare(lhs: lhsAuthmethod, rhs: rhsAuthmethod, with: matcher), lhsAuthmethod, rhsAuthmethod, "authMethod")) + results.append(Matcher.ParameterComparisonResult(Parameter.compare(lhs: lhsPostlogindata, rhs: rhsPostlogindata, with: matcher), lhsPostlogindata, rhsPostlogindata, "postLoginData")) return Matcher.ComparisonResult(results) case (.m_showStartupScreen, .m_showStartupScreen): return .match @@ -1133,7 +1133,7 @@ open class AuthorizationRouterMock: AuthorizationRouter, Mock { case .m_backWithFade: return 0 case let .m_dismiss__animated_animated(p0): return p0.intValue case let .m_removeLastView__controllers_controllers(p0): return p0.intValue - case let .m_showMainOrWhatsNewScreen__sourceScreen_sourceScreenauthMethod_authMethod(p0, p1): return p0.intValue + p1.intValue + case let .m_showMainOrWhatsNewScreen__sourceScreen_sourceScreenpostLoginData_postLoginData(p0, p1): return p0.intValue + p1.intValue case .m_showStartupScreen: return 0 case let .m_showLoginScreen__sourceScreen_sourceScreen(p0): return p0.intValue case let .m_showRegisterScreen__sourceScreen_sourceScreen(p0): return p0.intValue @@ -1155,7 +1155,7 @@ open class AuthorizationRouterMock: AuthorizationRouter, Mock { case .m_backWithFade: return ".backWithFade()" case .m_dismiss__animated_animated: return ".dismiss(animated:)" case .m_removeLastView__controllers_controllers: return ".removeLastView(controllers:)" - case .m_showMainOrWhatsNewScreen__sourceScreen_sourceScreenauthMethod_authMethod: return ".showMainOrWhatsNewScreen(sourceScreen:authMethod:)" + case .m_showMainOrWhatsNewScreen__sourceScreen_sourceScreenpostLoginData_postLoginData: return ".showMainOrWhatsNewScreen(sourceScreen:postLoginData:)" case .m_showStartupScreen: return ".showStartupScreen()" case .m_showLoginScreen__sourceScreen_sourceScreen: return ".showLoginScreen(sourceScreen:)" case .m_showRegisterScreen__sourceScreen_sourceScreen: return ".showRegisterScreen(sourceScreen:)" @@ -1191,7 +1191,7 @@ open class AuthorizationRouterMock: AuthorizationRouter, Mock { public static func backWithFade() -> Verify { return Verify(method: .m_backWithFade)} 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(sourceScreen: Parameter, authMethod: Parameter) -> Verify { return Verify(method: .m_showMainOrWhatsNewScreen__sourceScreen_sourceScreenauthMethod_authMethod(`sourceScreen`, `authMethod`))} + public static func showMainOrWhatsNewScreen(sourceScreen: Parameter, postLoginData: Parameter) -> Verify { return Verify(method: .m_showMainOrWhatsNewScreen__sourceScreen_sourceScreenpostLoginData_postLoginData(`sourceScreen`, `postLoginData`))} public static func showStartupScreen() -> Verify { return Verify(method: .m_showStartupScreen)} public static func showLoginScreen(sourceScreen: Parameter) -> Verify { return Verify(method: .m_showLoginScreen__sourceScreen_sourceScreen(`sourceScreen`))} public static func showRegisterScreen(sourceScreen: Parameter) -> Verify { return Verify(method: .m_showRegisterScreen__sourceScreen_sourceScreen(`sourceScreen`))} @@ -1227,8 +1227,8 @@ open class AuthorizationRouterMock: AuthorizationRouter, Mock { public static func removeLastView(controllers: Parameter, perform: @escaping (Int) -> Void) -> Perform { return Perform(method: .m_removeLastView__controllers_controllers(`controllers`), performs: perform) } - public static func showMainOrWhatsNewScreen(sourceScreen: Parameter, authMethod: Parameter, perform: @escaping (LogistrationSourceScreen, String?) -> Void) -> Perform { - return Perform(method: .m_showMainOrWhatsNewScreen__sourceScreen_sourceScreenauthMethod_authMethod(`sourceScreen`, `authMethod`), performs: perform) + public static func showMainOrWhatsNewScreen(sourceScreen: Parameter, postLoginData: Parameter, perform: @escaping (LogistrationSourceScreen, PostLoginData?) -> Void) -> Perform { + return Perform(method: .m_showMainOrWhatsNewScreen__sourceScreen_sourceScreenpostLoginData_postLoginData(`sourceScreen`, `postLoginData`), performs: perform) } public static func showStartupScreen(perform: @escaping () -> Void) -> Perform { return Perform(method: .m_showStartupScreen, performs: perform) @@ -1412,10 +1412,10 @@ open class BaseRouterMock: BaseRouter, Mock { perform?(`controllers`) } - open func showMainOrWhatsNewScreen(sourceScreen: LogistrationSourceScreen, authMethod: String?) { - addInvocation(.m_showMainOrWhatsNewScreen__sourceScreen_sourceScreenauthMethod_authMethod(Parameter.value(`sourceScreen`), Parameter.value(`authMethod`))) - let perform = methodPerformValue(.m_showMainOrWhatsNewScreen__sourceScreen_sourceScreenauthMethod_authMethod(Parameter.value(`sourceScreen`), Parameter.value(`authMethod`))) as? (LogistrationSourceScreen, String?) -> Void - perform?(`sourceScreen`, `authMethod`) + open func showMainOrWhatsNewScreen(sourceScreen: LogistrationSourceScreen, postLoginData: PostLoginData?) { + addInvocation(.m_showMainOrWhatsNewScreen__sourceScreen_sourceScreenpostLoginData_postLoginData(Parameter.value(`sourceScreen`), Parameter.value(`postLoginData`))) + let perform = methodPerformValue(.m_showMainOrWhatsNewScreen__sourceScreen_sourceScreenpostLoginData_postLoginData(Parameter.value(`sourceScreen`), Parameter.value(`postLoginData`))) as? (LogistrationSourceScreen, PostLoginData?) -> Void + perform?(`sourceScreen`, `postLoginData`) } open func showStartupScreen() { @@ -1491,7 +1491,7 @@ open class BaseRouterMock: BaseRouter, Mock { case m_backWithFade case m_dismiss__animated_animated(Parameter) case m_removeLastView__controllers_controllers(Parameter) - case m_showMainOrWhatsNewScreen__sourceScreen_sourceScreenauthMethod_authMethod(Parameter, Parameter) + case m_showMainOrWhatsNewScreen__sourceScreen_sourceScreenpostLoginData_postLoginData(Parameter, Parameter) case m_showStartupScreen case m_showLoginScreen__sourceScreen_sourceScreen(Parameter) case m_showRegisterScreen__sourceScreen_sourceScreen(Parameter) @@ -1528,10 +1528,10 @@ open class BaseRouterMock: BaseRouter, Mock { results.append(Matcher.ParameterComparisonResult(Parameter.compare(lhs: lhsControllers, rhs: rhsControllers, with: matcher), lhsControllers, rhsControllers, "controllers")) return Matcher.ComparisonResult(results) - case (.m_showMainOrWhatsNewScreen__sourceScreen_sourceScreenauthMethod_authMethod(let lhsSourcescreen, let lhsAuthmethod), .m_showMainOrWhatsNewScreen__sourceScreen_sourceScreenauthMethod_authMethod(let rhsSourcescreen, let rhsAuthmethod)): + case (.m_showMainOrWhatsNewScreen__sourceScreen_sourceScreenpostLoginData_postLoginData(let lhsSourcescreen, let lhsPostlogindata), .m_showMainOrWhatsNewScreen__sourceScreen_sourceScreenpostLoginData_postLoginData(let rhsSourcescreen, let rhsPostlogindata)): var results: [Matcher.ParameterComparisonResult] = [] results.append(Matcher.ParameterComparisonResult(Parameter.compare(lhs: lhsSourcescreen, rhs: rhsSourcescreen, with: matcher), lhsSourcescreen, rhsSourcescreen, "sourceScreen")) - results.append(Matcher.ParameterComparisonResult(Parameter.compare(lhs: lhsAuthmethod, rhs: rhsAuthmethod, with: matcher), lhsAuthmethod, rhsAuthmethod, "authMethod")) + results.append(Matcher.ParameterComparisonResult(Parameter.compare(lhs: lhsPostlogindata, rhs: rhsPostlogindata, with: matcher), lhsPostlogindata, rhsPostlogindata, "postLoginData")) return Matcher.ComparisonResult(results) case (.m_showStartupScreen, .m_showStartupScreen): return .match @@ -1611,7 +1611,7 @@ open class BaseRouterMock: BaseRouter, Mock { case .m_backWithFade: return 0 case let .m_dismiss__animated_animated(p0): return p0.intValue case let .m_removeLastView__controllers_controllers(p0): return p0.intValue - case let .m_showMainOrWhatsNewScreen__sourceScreen_sourceScreenauthMethod_authMethod(p0, p1): return p0.intValue + p1.intValue + case let .m_showMainOrWhatsNewScreen__sourceScreen_sourceScreenpostLoginData_postLoginData(p0, p1): return p0.intValue + p1.intValue case .m_showStartupScreen: return 0 case let .m_showLoginScreen__sourceScreen_sourceScreen(p0): return p0.intValue case let .m_showRegisterScreen__sourceScreen_sourceScreen(p0): return p0.intValue @@ -1632,7 +1632,7 @@ open class BaseRouterMock: BaseRouter, Mock { case .m_backWithFade: return ".backWithFade()" case .m_dismiss__animated_animated: return ".dismiss(animated:)" case .m_removeLastView__controllers_controllers: return ".removeLastView(controllers:)" - case .m_showMainOrWhatsNewScreen__sourceScreen_sourceScreenauthMethod_authMethod: return ".showMainOrWhatsNewScreen(sourceScreen:authMethod:)" + case .m_showMainOrWhatsNewScreen__sourceScreen_sourceScreenpostLoginData_postLoginData: return ".showMainOrWhatsNewScreen(sourceScreen:postLoginData:)" case .m_showStartupScreen: return ".showStartupScreen()" case .m_showLoginScreen__sourceScreen_sourceScreen: return ".showLoginScreen(sourceScreen:)" case .m_showRegisterScreen__sourceScreen_sourceScreen: return ".showRegisterScreen(sourceScreen:)" @@ -1667,7 +1667,7 @@ open class BaseRouterMock: BaseRouter, Mock { public static func backWithFade() -> Verify { return Verify(method: .m_backWithFade)} 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(sourceScreen: Parameter, authMethod: Parameter) -> Verify { return Verify(method: .m_showMainOrWhatsNewScreen__sourceScreen_sourceScreenauthMethod_authMethod(`sourceScreen`, `authMethod`))} + public static func showMainOrWhatsNewScreen(sourceScreen: Parameter, postLoginData: Parameter) -> Verify { return Verify(method: .m_showMainOrWhatsNewScreen__sourceScreen_sourceScreenpostLoginData_postLoginData(`sourceScreen`, `postLoginData`))} public static func showStartupScreen() -> Verify { return Verify(method: .m_showStartupScreen)} public static func showLoginScreen(sourceScreen: Parameter) -> Verify { return Verify(method: .m_showLoginScreen__sourceScreen_sourceScreen(`sourceScreen`))} public static func showRegisterScreen(sourceScreen: Parameter) -> Verify { return Verify(method: .m_showRegisterScreen__sourceScreen_sourceScreen(`sourceScreen`))} @@ -1700,8 +1700,8 @@ open class BaseRouterMock: BaseRouter, Mock { public static func removeLastView(controllers: Parameter, perform: @escaping (Int) -> Void) -> Perform { return Perform(method: .m_removeLastView__controllers_controllers(`controllers`), performs: perform) } - public static func showMainOrWhatsNewScreen(sourceScreen: Parameter, authMethod: Parameter, perform: @escaping (LogistrationSourceScreen, String?) -> Void) -> Perform { - return Perform(method: .m_showMainOrWhatsNewScreen__sourceScreen_sourceScreenauthMethod_authMethod(`sourceScreen`, `authMethod`), performs: perform) + public static func showMainOrWhatsNewScreen(sourceScreen: Parameter, postLoginData: Parameter, perform: @escaping (LogistrationSourceScreen, PostLoginData?) -> Void) -> Perform { + return Perform(method: .m_showMainOrWhatsNewScreen__sourceScreen_sourceScreenpostLoginData_postLoginData(`sourceScreen`, `postLoginData`), performs: perform) } public static func showStartupScreen(perform: @escaping () -> Void) -> Perform { return Perform(method: .m_showStartupScreen, performs: perform) diff --git a/Authorization/AuthorizationTests/Presentation/Login/SignInViewModelTests.swift b/Authorization/AuthorizationTests/Presentation/Login/SignInViewModelTests.swift index e9e558d0..116864cc 100644 --- a/Authorization/AuthorizationTests/Presentation/Login/SignInViewModelTests.swift +++ b/Authorization/AuthorizationTests/Presentation/Login/SignInViewModelTests.swift @@ -42,7 +42,7 @@ final class SignInViewModelTests: XCTestCase { await viewModel.login(username: "", password: "") Verify(interactor, 0, .login(username: .any, password: .any)) - Verify(router, 0, .showMainOrWhatsNewScreen(sourceScreen: .any, authMethod: .any)) + Verify(router, 0, .showMainOrWhatsNewScreen(sourceScreen: .any, postLoginData: .any)) XCTAssertEqual(viewModel.errorMessage, AuthLocalization.Error.invalidEmailAddressOrUsername) XCTAssertEqual(viewModel.isShowProgress, false) @@ -65,7 +65,7 @@ final class SignInViewModelTests: XCTestCase { await viewModel.login(username: "edxUser@edx.com", password: "") Verify(interactor, 0, .login(username: .any, password: .any)) - Verify(router, 0, .showMainOrWhatsNewScreen(sourceScreen: .any, authMethod: .any)) + Verify(router, 0, .showMainOrWhatsNewScreen(sourceScreen: .any, postLoginData: .any)) XCTAssertEqual(viewModel.errorMessage, AuthLocalization.Error.invalidPasswordLenght) XCTAssertEqual(viewModel.isShowProgress, false) @@ -93,7 +93,7 @@ final class SignInViewModelTests: XCTestCase { Verify(interactor, 1, .login(username: .any, password: .any)) Verify(analytics, .userLogin(method: .any)) - Verify(router, 1, .showMainOrWhatsNewScreen(sourceScreen: .any, authMethod: .any)) + Verify(router, 1, .showMainOrWhatsNewScreen(sourceScreen: .any, postLoginData: .any)) XCTAssertEqual(viewModel.errorMessage, nil) XCTAssertEqual(viewModel.isShowProgress, true) @@ -120,7 +120,7 @@ final class SignInViewModelTests: XCTestCase { await viewModel.ssoLogin(title: "Riyadah") Verify(interactor, 1, .login(ssoToken: .any)) - Verify(router, 1, .showMainOrWhatsNewScreen(sourceScreen: .any, authMethod: .any)) + Verify(router, 1, .showMainOrWhatsNewScreen(sourceScreen: .any, postLoginData: .any)) XCTAssertEqual(viewModel.errorMessage, nil) XCTAssertEqual(viewModel.isShowProgress, true) @@ -152,7 +152,7 @@ final class SignInViewModelTests: XCTestCase { Verify(interactor, 1, .login(externalToken: .any, backend: .any)) Verify(analytics, .userLogin(method: .any)) - Verify(router, 1, .showMainOrWhatsNewScreen(sourceScreen: .any, authMethod: .any)) + Verify(router, 1, .showMainOrWhatsNewScreen(sourceScreen: .any, postLoginData: .any)) XCTAssertEqual(viewModel.errorMessage, nil) XCTAssertEqual(viewModel.isShowProgress, true) @@ -177,7 +177,7 @@ final class SignInViewModelTests: XCTestCase { .apple(.init(name: "name", email: "email", token: "239i2oi3jrf2jflkj23lf2f")) ) let validationErrorMessage = AuthLocalization.Error.accountNotRegistered( - AuthMethod.socailAuth(.apple).analyticsValue, + AuthMethod.socialAuth(.apple).analyticsValue, viewModel.config.platformName ) let validationError = CustomValidationError(statusCode: 400, data: ["error_description": validationErrorMessage]) @@ -188,7 +188,7 @@ final class SignInViewModelTests: XCTestCase { await viewModel.login(with: result) Verify(interactor, 1, .login(externalToken: .any, backend: .any)) - Verify(router, 0, .showMainOrWhatsNewScreen(sourceScreen: .any, authMethod: .any)) + Verify(router, 0, .showMainOrWhatsNewScreen(sourceScreen: .any, postLoginData: .any)) XCTAssertEqual(viewModel.errorMessage, validationErrorMessage) XCTAssertEqual(viewModel.isShowProgress, false) @@ -218,7 +218,7 @@ final class SignInViewModelTests: XCTestCase { await viewModel.login(username: "edxUser@edx.com", password: "password123") Verify(interactor, 1, .login(username: .any, password: .any)) - Verify(router, 0, .showMainOrWhatsNewScreen(sourceScreen: .any, authMethod: .any)) + Verify(router, 0, .showMainOrWhatsNewScreen(sourceScreen: .any, postLoginData: .any)) XCTAssertEqual(viewModel.errorMessage, validationErrorMessage) XCTAssertEqual(viewModel.isShowProgress, false) @@ -244,7 +244,7 @@ final class SignInViewModelTests: XCTestCase { await viewModel.login(username: "edxUser@edx.com", password: "password123") Verify(interactor, 1, .login(username: .any, password: .any)) - Verify(router, 0, .showMainOrWhatsNewScreen(sourceScreen: .any, authMethod: .any)) + Verify(router, 0, .showMainOrWhatsNewScreen(sourceScreen: .any, postLoginData: .any)) XCTAssertEqual(viewModel.errorMessage, CoreLocalization.Error.invalidCredentials) XCTAssertEqual(viewModel.isShowProgress, false) @@ -270,7 +270,7 @@ final class SignInViewModelTests: XCTestCase { await viewModel.login(username: "edxUser@edx.com", password: "password123") Verify(interactor, 1, .login(username: .any, password: .any)) - Verify(router, 0, .showMainOrWhatsNewScreen(sourceScreen: .any, authMethod: .any)) + Verify(router, 0, .showMainOrWhatsNewScreen(sourceScreen: .any, postLoginData: .any)) XCTAssertEqual(viewModel.errorMessage, CoreLocalization.Error.unknownError) XCTAssertEqual(viewModel.isShowProgress, false) @@ -298,7 +298,7 @@ final class SignInViewModelTests: XCTestCase { await viewModel.login(username: "edxUser@edx.com", password: "password123") Verify(interactor, 1, .login(username: .any, password: .any)) - Verify(router, 0, .showMainOrWhatsNewScreen(sourceScreen: .any, authMethod: .any)) + Verify(router, 0, .showMainOrWhatsNewScreen(sourceScreen: .any, postLoginData: .any)) XCTAssertEqual(viewModel.errorMessage, CoreLocalization.Error.slowOrNoInternetConnection) XCTAssertEqual(viewModel.isShowProgress, false) diff --git a/Authorization/AuthorizationTests/Presentation/Register/SignUpViewModelTests.swift b/Authorization/AuthorizationTests/Presentation/Register/SignUpViewModelTests.swift index 15128c7a..ecde343e 100644 --- a/Authorization/AuthorizationTests/Presentation/Register/SignUpViewModelTests.swift +++ b/Authorization/AuthorizationTests/Presentation/Register/SignUpViewModelTests.swift @@ -138,7 +138,7 @@ final class SignUpViewModelTests: XCTestCase { Verify(interactor, 1, .validateRegistrationFields(fields: .any)) Verify(interactor, 1, .registerUser(fields: .any, isSocial: .any)) - Verify(router, 1, .showMainOrWhatsNewScreen(sourceScreen: .any, authMethod: .any)) + Verify(router, 1, .showMainOrWhatsNewScreen(sourceScreen: .any, postLoginData: .any)) XCTAssertEqual(viewModel.isShowProgress, false) XCTAssertEqual(viewModel.showError, false) @@ -176,7 +176,7 @@ final class SignUpViewModelTests: XCTestCase { Verify(interactor, 1, .validateRegistrationFields(fields: .any)) Verify(interactor, 0, .registerUser(fields: .any, isSocial: .any)) - Verify(router, 0, .showMainOrWhatsNewScreen(sourceScreen: .any, authMethod: .any)) + Verify(router, 0, .showMainOrWhatsNewScreen(sourceScreen: .any, postLoginData: .any)) XCTAssertEqual(viewModel.isShowProgress, false) XCTAssertEqual(viewModel.showError, false) @@ -206,7 +206,7 @@ final class SignUpViewModelTests: XCTestCase { Verify(interactor, 1, .validateRegistrationFields(fields: .any)) Verify(interactor, 1, .registerUser(fields: .any, isSocial: .any)) - Verify(router, 0, .showMainOrWhatsNewScreen(sourceScreen: .any, authMethod: .any)) + Verify(router, 0, .showMainOrWhatsNewScreen(sourceScreen: .any, postLoginData: .any)) XCTAssertEqual(viewModel.isShowProgress, false) XCTAssertEqual(viewModel.showError, true) @@ -236,7 +236,7 @@ final class SignUpViewModelTests: XCTestCase { Verify(interactor, 1, .validateRegistrationFields(fields: .any)) Verify(interactor, 1, .registerUser(fields: .any, isSocial: .any)) - Verify(router, 0, .showMainOrWhatsNewScreen(sourceScreen: .any, authMethod: .any)) + Verify(router, 0, .showMainOrWhatsNewScreen(sourceScreen: .any, postLoginData: .any)) XCTAssertEqual(viewModel.isShowProgress, false) XCTAssertEqual(viewModel.showError, true) @@ -268,7 +268,7 @@ final class SignUpViewModelTests: XCTestCase { Verify(interactor, 1, .validateRegistrationFields(fields: .any)) Verify(interactor, 1, .registerUser(fields: .any, isSocial: .any)) - Verify(router, 0, .showMainOrWhatsNewScreen(sourceScreen: .any, authMethod: .any)) + Verify(router, 0, .showMainOrWhatsNewScreen(sourceScreen: .any, postLoginData: .any)) XCTAssertEqual(viewModel.isShowProgress, false) XCTAssertEqual(viewModel.showError, true) diff --git a/Core/Core/Configuration/BaseRouter.swift b/Core/Core/Configuration/BaseRouter.swift index 0f592e75..c40f4fcf 100644 --- a/Core/Core/Configuration/BaseRouter.swift +++ b/Core/Core/Configuration/BaseRouter.swift @@ -22,10 +22,7 @@ public protocol BaseRouter: Sendable { func removeLastView(controllers: Int) - func showMainOrWhatsNewScreen( - sourceScreen: LogistrationSourceScreen, - authMethod: String? - ) + func showMainOrWhatsNewScreen(sourceScreen: LogistrationSourceScreen, postLoginData: PostLoginData?) func showStartupScreen() @@ -85,10 +82,7 @@ open class BaseRouterMock: BaseRouter { public func dismiss(animated: Bool) {} - public func showMainOrWhatsNewScreen( - sourceScreen: LogistrationSourceScreen, - authMethod: String? - ) {} + public func showMainOrWhatsNewScreen(sourceScreen: LogistrationSourceScreen, postLoginData: PostLoginData?) {} public func showStartupScreen() {} diff --git a/Core/Core/View/Base/LogistrationBottomView.swift b/Core/Core/View/Base/LogistrationBottomView.swift index c902a1b4..08b6197b 100644 --- a/Core/Core/View/Base/LogistrationBottomView.swift +++ b/Core/Core/View/Base/LogistrationBottomView.swift @@ -27,6 +27,16 @@ public enum LogistrationAction: Sendable { case register } +public struct PostLoginData: Sendable { + public let authMethod: String + public var showSocialRegisterBanner: Bool + + public init(authMethod: String = "", showSocialRegisterBanner: Bool = false) { + self.authMethod = authMethod + self.showSocialRegisterBanner = showSocialRegisterBanner + } +} + public struct LogistrationBottomView: View { private let action: (LogistrationAction) -> Void private let ssoEnabled: Bool diff --git a/Core/CoreTests/CoreMock.generated.swift b/Core/CoreTests/CoreMock.generated.swift index d483cb7b..fb0546e8 100644 --- a/Core/CoreTests/CoreMock.generated.swift +++ b/Core/CoreTests/CoreMock.generated.swift @@ -579,10 +579,10 @@ open class BaseRouterMock: BaseRouter, Mock { perform?(`controllers`) } - open func showMainOrWhatsNewScreen(sourceScreen: LogistrationSourceScreen, authMethod: String?) { - addInvocation(.m_showMainOrWhatsNewScreen__sourceScreen_sourceScreenauthMethod_authMethod(Parameter.value(`sourceScreen`), Parameter.value(`authMethod`))) - let perform = methodPerformValue(.m_showMainOrWhatsNewScreen__sourceScreen_sourceScreenauthMethod_authMethod(Parameter.value(`sourceScreen`), Parameter.value(`authMethod`))) as? (LogistrationSourceScreen, String?) -> Void - perform?(`sourceScreen`, `authMethod`) + open func showMainOrWhatsNewScreen(sourceScreen: LogistrationSourceScreen, postLoginData: PostLoginData?) { + addInvocation(.m_showMainOrWhatsNewScreen__sourceScreen_sourceScreenpostLoginData_postLoginData(Parameter.value(`sourceScreen`), Parameter.value(`postLoginData`))) + let perform = methodPerformValue(.m_showMainOrWhatsNewScreen__sourceScreen_sourceScreenpostLoginData_postLoginData(Parameter.value(`sourceScreen`), Parameter.value(`postLoginData`))) as? (LogistrationSourceScreen, PostLoginData?) -> Void + perform?(`sourceScreen`, `postLoginData`) } open func showStartupScreen() { @@ -658,7 +658,7 @@ open class BaseRouterMock: BaseRouter, Mock { case m_backWithFade case m_dismiss__animated_animated(Parameter) case m_removeLastView__controllers_controllers(Parameter) - case m_showMainOrWhatsNewScreen__sourceScreen_sourceScreenauthMethod_authMethod(Parameter, Parameter) + case m_showMainOrWhatsNewScreen__sourceScreen_sourceScreenpostLoginData_postLoginData(Parameter, Parameter) case m_showStartupScreen case m_showLoginScreen__sourceScreen_sourceScreen(Parameter) case m_showRegisterScreen__sourceScreen_sourceScreen(Parameter) @@ -695,10 +695,10 @@ open class BaseRouterMock: BaseRouter, Mock { results.append(Matcher.ParameterComparisonResult(Parameter.compare(lhs: lhsControllers, rhs: rhsControllers, with: matcher), lhsControllers, rhsControllers, "controllers")) return Matcher.ComparisonResult(results) - case (.m_showMainOrWhatsNewScreen__sourceScreen_sourceScreenauthMethod_authMethod(let lhsSourcescreen, let lhsAuthmethod), .m_showMainOrWhatsNewScreen__sourceScreen_sourceScreenauthMethod_authMethod(let rhsSourcescreen, let rhsAuthmethod)): + case (.m_showMainOrWhatsNewScreen__sourceScreen_sourceScreenpostLoginData_postLoginData(let lhsSourcescreen, let lhsPostlogindata), .m_showMainOrWhatsNewScreen__sourceScreen_sourceScreenpostLoginData_postLoginData(let rhsSourcescreen, let rhsPostlogindata)): var results: [Matcher.ParameterComparisonResult] = [] results.append(Matcher.ParameterComparisonResult(Parameter.compare(lhs: lhsSourcescreen, rhs: rhsSourcescreen, with: matcher), lhsSourcescreen, rhsSourcescreen, "sourceScreen")) - results.append(Matcher.ParameterComparisonResult(Parameter.compare(lhs: lhsAuthmethod, rhs: rhsAuthmethod, with: matcher), lhsAuthmethod, rhsAuthmethod, "authMethod")) + results.append(Matcher.ParameterComparisonResult(Parameter.compare(lhs: lhsPostlogindata, rhs: rhsPostlogindata, with: matcher), lhsPostlogindata, rhsPostlogindata, "postLoginData")) return Matcher.ComparisonResult(results) case (.m_showStartupScreen, .m_showStartupScreen): return .match @@ -778,7 +778,7 @@ open class BaseRouterMock: BaseRouter, Mock { case .m_backWithFade: return 0 case let .m_dismiss__animated_animated(p0): return p0.intValue case let .m_removeLastView__controllers_controllers(p0): return p0.intValue - case let .m_showMainOrWhatsNewScreen__sourceScreen_sourceScreenauthMethod_authMethod(p0, p1): return p0.intValue + p1.intValue + case let .m_showMainOrWhatsNewScreen__sourceScreen_sourceScreenpostLoginData_postLoginData(p0, p1): return p0.intValue + p1.intValue case .m_showStartupScreen: return 0 case let .m_showLoginScreen__sourceScreen_sourceScreen(p0): return p0.intValue case let .m_showRegisterScreen__sourceScreen_sourceScreen(p0): return p0.intValue @@ -799,7 +799,7 @@ open class BaseRouterMock: BaseRouter, Mock { case .m_backWithFade: return ".backWithFade()" case .m_dismiss__animated_animated: return ".dismiss(animated:)" case .m_removeLastView__controllers_controllers: return ".removeLastView(controllers:)" - case .m_showMainOrWhatsNewScreen__sourceScreen_sourceScreenauthMethod_authMethod: return ".showMainOrWhatsNewScreen(sourceScreen:authMethod:)" + case .m_showMainOrWhatsNewScreen__sourceScreen_sourceScreenpostLoginData_postLoginData: return ".showMainOrWhatsNewScreen(sourceScreen:postLoginData:)" case .m_showStartupScreen: return ".showStartupScreen()" case .m_showLoginScreen__sourceScreen_sourceScreen: return ".showLoginScreen(sourceScreen:)" case .m_showRegisterScreen__sourceScreen_sourceScreen: return ".showRegisterScreen(sourceScreen:)" @@ -834,7 +834,7 @@ open class BaseRouterMock: BaseRouter, Mock { public static func backWithFade() -> Verify { return Verify(method: .m_backWithFade)} 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(sourceScreen: Parameter, authMethod: Parameter) -> Verify { return Verify(method: .m_showMainOrWhatsNewScreen__sourceScreen_sourceScreenauthMethod_authMethod(`sourceScreen`, `authMethod`))} + public static func showMainOrWhatsNewScreen(sourceScreen: Parameter, postLoginData: Parameter) -> Verify { return Verify(method: .m_showMainOrWhatsNewScreen__sourceScreen_sourceScreenpostLoginData_postLoginData(`sourceScreen`, `postLoginData`))} public static func showStartupScreen() -> Verify { return Verify(method: .m_showStartupScreen)} public static func showLoginScreen(sourceScreen: Parameter) -> Verify { return Verify(method: .m_showLoginScreen__sourceScreen_sourceScreen(`sourceScreen`))} public static func showRegisterScreen(sourceScreen: Parameter) -> Verify { return Verify(method: .m_showRegisterScreen__sourceScreen_sourceScreen(`sourceScreen`))} @@ -867,8 +867,8 @@ open class BaseRouterMock: BaseRouter, Mock { public static func removeLastView(controllers: Parameter, perform: @escaping (Int) -> Void) -> Perform { return Perform(method: .m_removeLastView__controllers_controllers(`controllers`), performs: perform) } - public static func showMainOrWhatsNewScreen(sourceScreen: Parameter, authMethod: Parameter, perform: @escaping (LogistrationSourceScreen, String?) -> Void) -> Perform { - return Perform(method: .m_showMainOrWhatsNewScreen__sourceScreen_sourceScreenauthMethod_authMethod(`sourceScreen`, `authMethod`), performs: perform) + public static func showMainOrWhatsNewScreen(sourceScreen: Parameter, postLoginData: Parameter, perform: @escaping (LogistrationSourceScreen, PostLoginData?) -> Void) -> Perform { + return Perform(method: .m_showMainOrWhatsNewScreen__sourceScreen_sourceScreenpostLoginData_postLoginData(`sourceScreen`, `postLoginData`), performs: perform) } public static func showStartupScreen(perform: @escaping () -> Void) -> Perform { return Perform(method: .m_showStartupScreen, performs: perform) diff --git a/Course/CourseTests/CourseMock.generated.swift b/Course/CourseTests/CourseMock.generated.swift index b521e972..65fb0860 100644 --- a/Course/CourseTests/CourseMock.generated.swift +++ b/Course/CourseTests/CourseMock.generated.swift @@ -581,10 +581,10 @@ open class BaseRouterMock: BaseRouter, Mock { perform?(`controllers`) } - open func showMainOrWhatsNewScreen(sourceScreen: LogistrationSourceScreen, authMethod: String?) { - addInvocation(.m_showMainOrWhatsNewScreen__sourceScreen_sourceScreenauthMethod_authMethod(Parameter.value(`sourceScreen`), Parameter.value(`authMethod`))) - let perform = methodPerformValue(.m_showMainOrWhatsNewScreen__sourceScreen_sourceScreenauthMethod_authMethod(Parameter.value(`sourceScreen`), Parameter.value(`authMethod`))) as? (LogistrationSourceScreen, String?) -> Void - perform?(`sourceScreen`, `authMethod`) + open func showMainOrWhatsNewScreen(sourceScreen: LogistrationSourceScreen, postLoginData: PostLoginData?) { + addInvocation(.m_showMainOrWhatsNewScreen__sourceScreen_sourceScreenpostLoginData_postLoginData(Parameter.value(`sourceScreen`), Parameter.value(`postLoginData`))) + let perform = methodPerformValue(.m_showMainOrWhatsNewScreen__sourceScreen_sourceScreenpostLoginData_postLoginData(Parameter.value(`sourceScreen`), Parameter.value(`postLoginData`))) as? (LogistrationSourceScreen, PostLoginData?) -> Void + perform?(`sourceScreen`, `postLoginData`) } open func showStartupScreen() { @@ -660,7 +660,7 @@ open class BaseRouterMock: BaseRouter, Mock { case m_backWithFade case m_dismiss__animated_animated(Parameter) case m_removeLastView__controllers_controllers(Parameter) - case m_showMainOrWhatsNewScreen__sourceScreen_sourceScreenauthMethod_authMethod(Parameter, Parameter) + case m_showMainOrWhatsNewScreen__sourceScreen_sourceScreenpostLoginData_postLoginData(Parameter, Parameter) case m_showStartupScreen case m_showLoginScreen__sourceScreen_sourceScreen(Parameter) case m_showRegisterScreen__sourceScreen_sourceScreen(Parameter) @@ -697,10 +697,10 @@ open class BaseRouterMock: BaseRouter, Mock { results.append(Matcher.ParameterComparisonResult(Parameter.compare(lhs: lhsControllers, rhs: rhsControllers, with: matcher), lhsControllers, rhsControllers, "controllers")) return Matcher.ComparisonResult(results) - case (.m_showMainOrWhatsNewScreen__sourceScreen_sourceScreenauthMethod_authMethod(let lhsSourcescreen, let lhsAuthmethod), .m_showMainOrWhatsNewScreen__sourceScreen_sourceScreenauthMethod_authMethod(let rhsSourcescreen, let rhsAuthmethod)): + case (.m_showMainOrWhatsNewScreen__sourceScreen_sourceScreenpostLoginData_postLoginData(let lhsSourcescreen, let lhsPostlogindata), .m_showMainOrWhatsNewScreen__sourceScreen_sourceScreenpostLoginData_postLoginData(let rhsSourcescreen, let rhsPostlogindata)): var results: [Matcher.ParameterComparisonResult] = [] results.append(Matcher.ParameterComparisonResult(Parameter.compare(lhs: lhsSourcescreen, rhs: rhsSourcescreen, with: matcher), lhsSourcescreen, rhsSourcescreen, "sourceScreen")) - results.append(Matcher.ParameterComparisonResult(Parameter.compare(lhs: lhsAuthmethod, rhs: rhsAuthmethod, with: matcher), lhsAuthmethod, rhsAuthmethod, "authMethod")) + results.append(Matcher.ParameterComparisonResult(Parameter.compare(lhs: lhsPostlogindata, rhs: rhsPostlogindata, with: matcher), lhsPostlogindata, rhsPostlogindata, "postLoginData")) return Matcher.ComparisonResult(results) case (.m_showStartupScreen, .m_showStartupScreen): return .match @@ -780,7 +780,7 @@ open class BaseRouterMock: BaseRouter, Mock { case .m_backWithFade: return 0 case let .m_dismiss__animated_animated(p0): return p0.intValue case let .m_removeLastView__controllers_controllers(p0): return p0.intValue - case let .m_showMainOrWhatsNewScreen__sourceScreen_sourceScreenauthMethod_authMethod(p0, p1): return p0.intValue + p1.intValue + case let .m_showMainOrWhatsNewScreen__sourceScreen_sourceScreenpostLoginData_postLoginData(p0, p1): return p0.intValue + p1.intValue case .m_showStartupScreen: return 0 case let .m_showLoginScreen__sourceScreen_sourceScreen(p0): return p0.intValue case let .m_showRegisterScreen__sourceScreen_sourceScreen(p0): return p0.intValue @@ -801,7 +801,7 @@ open class BaseRouterMock: BaseRouter, Mock { case .m_backWithFade: return ".backWithFade()" case .m_dismiss__animated_animated: return ".dismiss(animated:)" case .m_removeLastView__controllers_controllers: return ".removeLastView(controllers:)" - case .m_showMainOrWhatsNewScreen__sourceScreen_sourceScreenauthMethod_authMethod: return ".showMainOrWhatsNewScreen(sourceScreen:authMethod:)" + case .m_showMainOrWhatsNewScreen__sourceScreen_sourceScreenpostLoginData_postLoginData: return ".showMainOrWhatsNewScreen(sourceScreen:postLoginData:)" case .m_showStartupScreen: return ".showStartupScreen()" case .m_showLoginScreen__sourceScreen_sourceScreen: return ".showLoginScreen(sourceScreen:)" case .m_showRegisterScreen__sourceScreen_sourceScreen: return ".showRegisterScreen(sourceScreen:)" @@ -836,7 +836,7 @@ open class BaseRouterMock: BaseRouter, Mock { public static func backWithFade() -> Verify { return Verify(method: .m_backWithFade)} 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(sourceScreen: Parameter, authMethod: Parameter) -> Verify { return Verify(method: .m_showMainOrWhatsNewScreen__sourceScreen_sourceScreenauthMethod_authMethod(`sourceScreen`, `authMethod`))} + public static func showMainOrWhatsNewScreen(sourceScreen: Parameter, postLoginData: Parameter) -> Verify { return Verify(method: .m_showMainOrWhatsNewScreen__sourceScreen_sourceScreenpostLoginData_postLoginData(`sourceScreen`, `postLoginData`))} public static func showStartupScreen() -> Verify { return Verify(method: .m_showStartupScreen)} public static func showLoginScreen(sourceScreen: Parameter) -> Verify { return Verify(method: .m_showLoginScreen__sourceScreen_sourceScreen(`sourceScreen`))} public static func showRegisterScreen(sourceScreen: Parameter) -> Verify { return Verify(method: .m_showRegisterScreen__sourceScreen_sourceScreen(`sourceScreen`))} @@ -869,8 +869,8 @@ open class BaseRouterMock: BaseRouter, Mock { public static func removeLastView(controllers: Parameter, perform: @escaping (Int) -> Void) -> Perform { return Perform(method: .m_removeLastView__controllers_controllers(`controllers`), performs: perform) } - public static func showMainOrWhatsNewScreen(sourceScreen: Parameter, authMethod: Parameter, perform: @escaping (LogistrationSourceScreen, String?) -> Void) -> Perform { - return Perform(method: .m_showMainOrWhatsNewScreen__sourceScreen_sourceScreenauthMethod_authMethod(`sourceScreen`, `authMethod`), performs: perform) + public static func showMainOrWhatsNewScreen(sourceScreen: Parameter, postLoginData: Parameter, perform: @escaping (LogistrationSourceScreen, PostLoginData?) -> Void) -> Perform { + return Perform(method: .m_showMainOrWhatsNewScreen__sourceScreen_sourceScreenpostLoginData_postLoginData(`sourceScreen`, `postLoginData`), performs: perform) } public static func showStartupScreen(perform: @escaping () -> Void) -> Perform { return Perform(method: .m_showStartupScreen, performs: perform) diff --git a/Dashboard/DashboardTests/DashboardMock.generated.swift b/Dashboard/DashboardTests/DashboardMock.generated.swift index 291eb6e8..888d63f2 100644 --- a/Dashboard/DashboardTests/DashboardMock.generated.swift +++ b/Dashboard/DashboardTests/DashboardMock.generated.swift @@ -581,10 +581,10 @@ open class BaseRouterMock: BaseRouter, Mock { perform?(`controllers`) } - open func showMainOrWhatsNewScreen(sourceScreen: LogistrationSourceScreen, authMethod: String?) { - addInvocation(.m_showMainOrWhatsNewScreen__sourceScreen_sourceScreenauthMethod_authMethod(Parameter.value(`sourceScreen`), Parameter.value(`authMethod`))) - let perform = methodPerformValue(.m_showMainOrWhatsNewScreen__sourceScreen_sourceScreenauthMethod_authMethod(Parameter.value(`sourceScreen`), Parameter.value(`authMethod`))) as? (LogistrationSourceScreen, String?) -> Void - perform?(`sourceScreen`, `authMethod`) + open func showMainOrWhatsNewScreen(sourceScreen: LogistrationSourceScreen, postLoginData: PostLoginData?) { + addInvocation(.m_showMainOrWhatsNewScreen__sourceScreen_sourceScreenpostLoginData_postLoginData(Parameter.value(`sourceScreen`), Parameter.value(`postLoginData`))) + let perform = methodPerformValue(.m_showMainOrWhatsNewScreen__sourceScreen_sourceScreenpostLoginData_postLoginData(Parameter.value(`sourceScreen`), Parameter.value(`postLoginData`))) as? (LogistrationSourceScreen, PostLoginData?) -> Void + perform?(`sourceScreen`, `postLoginData`) } open func showStartupScreen() { @@ -660,7 +660,7 @@ open class BaseRouterMock: BaseRouter, Mock { case m_backWithFade case m_dismiss__animated_animated(Parameter) case m_removeLastView__controllers_controllers(Parameter) - case m_showMainOrWhatsNewScreen__sourceScreen_sourceScreenauthMethod_authMethod(Parameter, Parameter) + case m_showMainOrWhatsNewScreen__sourceScreen_sourceScreenpostLoginData_postLoginData(Parameter, Parameter) case m_showStartupScreen case m_showLoginScreen__sourceScreen_sourceScreen(Parameter) case m_showRegisterScreen__sourceScreen_sourceScreen(Parameter) @@ -697,10 +697,10 @@ open class BaseRouterMock: BaseRouter, Mock { results.append(Matcher.ParameterComparisonResult(Parameter.compare(lhs: lhsControllers, rhs: rhsControllers, with: matcher), lhsControllers, rhsControllers, "controllers")) return Matcher.ComparisonResult(results) - case (.m_showMainOrWhatsNewScreen__sourceScreen_sourceScreenauthMethod_authMethod(let lhsSourcescreen, let lhsAuthmethod), .m_showMainOrWhatsNewScreen__sourceScreen_sourceScreenauthMethod_authMethod(let rhsSourcescreen, let rhsAuthmethod)): + case (.m_showMainOrWhatsNewScreen__sourceScreen_sourceScreenpostLoginData_postLoginData(let lhsSourcescreen, let lhsPostlogindata), .m_showMainOrWhatsNewScreen__sourceScreen_sourceScreenpostLoginData_postLoginData(let rhsSourcescreen, let rhsPostlogindata)): var results: [Matcher.ParameterComparisonResult] = [] results.append(Matcher.ParameterComparisonResult(Parameter.compare(lhs: lhsSourcescreen, rhs: rhsSourcescreen, with: matcher), lhsSourcescreen, rhsSourcescreen, "sourceScreen")) - results.append(Matcher.ParameterComparisonResult(Parameter.compare(lhs: lhsAuthmethod, rhs: rhsAuthmethod, with: matcher), lhsAuthmethod, rhsAuthmethod, "authMethod")) + results.append(Matcher.ParameterComparisonResult(Parameter.compare(lhs: lhsPostlogindata, rhs: rhsPostlogindata, with: matcher), lhsPostlogindata, rhsPostlogindata, "postLoginData")) return Matcher.ComparisonResult(results) case (.m_showStartupScreen, .m_showStartupScreen): return .match @@ -780,7 +780,7 @@ open class BaseRouterMock: BaseRouter, Mock { case .m_backWithFade: return 0 case let .m_dismiss__animated_animated(p0): return p0.intValue case let .m_removeLastView__controllers_controllers(p0): return p0.intValue - case let .m_showMainOrWhatsNewScreen__sourceScreen_sourceScreenauthMethod_authMethod(p0, p1): return p0.intValue + p1.intValue + case let .m_showMainOrWhatsNewScreen__sourceScreen_sourceScreenpostLoginData_postLoginData(p0, p1): return p0.intValue + p1.intValue case .m_showStartupScreen: return 0 case let .m_showLoginScreen__sourceScreen_sourceScreen(p0): return p0.intValue case let .m_showRegisterScreen__sourceScreen_sourceScreen(p0): return p0.intValue @@ -801,7 +801,7 @@ open class BaseRouterMock: BaseRouter, Mock { case .m_backWithFade: return ".backWithFade()" case .m_dismiss__animated_animated: return ".dismiss(animated:)" case .m_removeLastView__controllers_controllers: return ".removeLastView(controllers:)" - case .m_showMainOrWhatsNewScreen__sourceScreen_sourceScreenauthMethod_authMethod: return ".showMainOrWhatsNewScreen(sourceScreen:authMethod:)" + case .m_showMainOrWhatsNewScreen__sourceScreen_sourceScreenpostLoginData_postLoginData: return ".showMainOrWhatsNewScreen(sourceScreen:postLoginData:)" case .m_showStartupScreen: return ".showStartupScreen()" case .m_showLoginScreen__sourceScreen_sourceScreen: return ".showLoginScreen(sourceScreen:)" case .m_showRegisterScreen__sourceScreen_sourceScreen: return ".showRegisterScreen(sourceScreen:)" @@ -836,7 +836,7 @@ open class BaseRouterMock: BaseRouter, Mock { public static func backWithFade() -> Verify { return Verify(method: .m_backWithFade)} 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(sourceScreen: Parameter, authMethod: Parameter) -> Verify { return Verify(method: .m_showMainOrWhatsNewScreen__sourceScreen_sourceScreenauthMethod_authMethod(`sourceScreen`, `authMethod`))} + public static func showMainOrWhatsNewScreen(sourceScreen: Parameter, postLoginData: Parameter) -> Verify { return Verify(method: .m_showMainOrWhatsNewScreen__sourceScreen_sourceScreenpostLoginData_postLoginData(`sourceScreen`, `postLoginData`))} public static func showStartupScreen() -> Verify { return Verify(method: .m_showStartupScreen)} public static func showLoginScreen(sourceScreen: Parameter) -> Verify { return Verify(method: .m_showLoginScreen__sourceScreen_sourceScreen(`sourceScreen`))} public static func showRegisterScreen(sourceScreen: Parameter) -> Verify { return Verify(method: .m_showRegisterScreen__sourceScreen_sourceScreen(`sourceScreen`))} @@ -869,8 +869,8 @@ open class BaseRouterMock: BaseRouter, Mock { public static func removeLastView(controllers: Parameter, perform: @escaping (Int) -> Void) -> Perform { return Perform(method: .m_removeLastView__controllers_controllers(`controllers`), performs: perform) } - public static func showMainOrWhatsNewScreen(sourceScreen: Parameter, authMethod: Parameter, perform: @escaping (LogistrationSourceScreen, String?) -> Void) -> Perform { - return Perform(method: .m_showMainOrWhatsNewScreen__sourceScreen_sourceScreenauthMethod_authMethod(`sourceScreen`, `authMethod`), performs: perform) + public static func showMainOrWhatsNewScreen(sourceScreen: Parameter, postLoginData: Parameter, perform: @escaping (LogistrationSourceScreen, PostLoginData?) -> Void) -> Perform { + return Perform(method: .m_showMainOrWhatsNewScreen__sourceScreen_sourceScreenpostLoginData_postLoginData(`sourceScreen`, `postLoginData`), performs: perform) } public static func showStartupScreen(perform: @escaping () -> Void) -> Perform { return Perform(method: .m_showStartupScreen, performs: perform) diff --git a/Discovery/DiscoveryTests/DiscoveryMock.generated.swift b/Discovery/DiscoveryTests/DiscoveryMock.generated.swift index 1aabd586..9938d2ec 100644 --- a/Discovery/DiscoveryTests/DiscoveryMock.generated.swift +++ b/Discovery/DiscoveryTests/DiscoveryMock.generated.swift @@ -581,10 +581,10 @@ open class BaseRouterMock: BaseRouter, Mock { perform?(`controllers`) } - open func showMainOrWhatsNewScreen(sourceScreen: LogistrationSourceScreen, authMethod: String?) { - addInvocation(.m_showMainOrWhatsNewScreen__sourceScreen_sourceScreenauthMethod_authMethod(Parameter.value(`sourceScreen`), Parameter.value(`authMethod`))) - let perform = methodPerformValue(.m_showMainOrWhatsNewScreen__sourceScreen_sourceScreenauthMethod_authMethod(Parameter.value(`sourceScreen`), Parameter.value(`authMethod`))) as? (LogistrationSourceScreen, String?) -> Void - perform?(`sourceScreen`, `authMethod`) + open func showMainOrWhatsNewScreen(sourceScreen: LogistrationSourceScreen, postLoginData: PostLoginData?) { + addInvocation(.m_showMainOrWhatsNewScreen__sourceScreen_sourceScreenpostLoginData_postLoginData(Parameter.value(`sourceScreen`), Parameter.value(`postLoginData`))) + let perform = methodPerformValue(.m_showMainOrWhatsNewScreen__sourceScreen_sourceScreenpostLoginData_postLoginData(Parameter.value(`sourceScreen`), Parameter.value(`postLoginData`))) as? (LogistrationSourceScreen, PostLoginData?) -> Void + perform?(`sourceScreen`, `postLoginData`) } open func showStartupScreen() { @@ -660,7 +660,7 @@ open class BaseRouterMock: BaseRouter, Mock { case m_backWithFade case m_dismiss__animated_animated(Parameter) case m_removeLastView__controllers_controllers(Parameter) - case m_showMainOrWhatsNewScreen__sourceScreen_sourceScreenauthMethod_authMethod(Parameter, Parameter) + case m_showMainOrWhatsNewScreen__sourceScreen_sourceScreenpostLoginData_postLoginData(Parameter, Parameter) case m_showStartupScreen case m_showLoginScreen__sourceScreen_sourceScreen(Parameter) case m_showRegisterScreen__sourceScreen_sourceScreen(Parameter) @@ -697,10 +697,10 @@ open class BaseRouterMock: BaseRouter, Mock { results.append(Matcher.ParameterComparisonResult(Parameter.compare(lhs: lhsControllers, rhs: rhsControllers, with: matcher), lhsControllers, rhsControllers, "controllers")) return Matcher.ComparisonResult(results) - case (.m_showMainOrWhatsNewScreen__sourceScreen_sourceScreenauthMethod_authMethod(let lhsSourcescreen, let lhsAuthmethod), .m_showMainOrWhatsNewScreen__sourceScreen_sourceScreenauthMethod_authMethod(let rhsSourcescreen, let rhsAuthmethod)): + case (.m_showMainOrWhatsNewScreen__sourceScreen_sourceScreenpostLoginData_postLoginData(let lhsSourcescreen, let lhsPostlogindata), .m_showMainOrWhatsNewScreen__sourceScreen_sourceScreenpostLoginData_postLoginData(let rhsSourcescreen, let rhsPostlogindata)): var results: [Matcher.ParameterComparisonResult] = [] results.append(Matcher.ParameterComparisonResult(Parameter.compare(lhs: lhsSourcescreen, rhs: rhsSourcescreen, with: matcher), lhsSourcescreen, rhsSourcescreen, "sourceScreen")) - results.append(Matcher.ParameterComparisonResult(Parameter.compare(lhs: lhsAuthmethod, rhs: rhsAuthmethod, with: matcher), lhsAuthmethod, rhsAuthmethod, "authMethod")) + results.append(Matcher.ParameterComparisonResult(Parameter.compare(lhs: lhsPostlogindata, rhs: rhsPostlogindata, with: matcher), lhsPostlogindata, rhsPostlogindata, "postLoginData")) return Matcher.ComparisonResult(results) case (.m_showStartupScreen, .m_showStartupScreen): return .match @@ -780,7 +780,7 @@ open class BaseRouterMock: BaseRouter, Mock { case .m_backWithFade: return 0 case let .m_dismiss__animated_animated(p0): return p0.intValue case let .m_removeLastView__controllers_controllers(p0): return p0.intValue - case let .m_showMainOrWhatsNewScreen__sourceScreen_sourceScreenauthMethod_authMethod(p0, p1): return p0.intValue + p1.intValue + case let .m_showMainOrWhatsNewScreen__sourceScreen_sourceScreenpostLoginData_postLoginData(p0, p1): return p0.intValue + p1.intValue case .m_showStartupScreen: return 0 case let .m_showLoginScreen__sourceScreen_sourceScreen(p0): return p0.intValue case let .m_showRegisterScreen__sourceScreen_sourceScreen(p0): return p0.intValue @@ -801,7 +801,7 @@ open class BaseRouterMock: BaseRouter, Mock { case .m_backWithFade: return ".backWithFade()" case .m_dismiss__animated_animated: return ".dismiss(animated:)" case .m_removeLastView__controllers_controllers: return ".removeLastView(controllers:)" - case .m_showMainOrWhatsNewScreen__sourceScreen_sourceScreenauthMethod_authMethod: return ".showMainOrWhatsNewScreen(sourceScreen:authMethod:)" + case .m_showMainOrWhatsNewScreen__sourceScreen_sourceScreenpostLoginData_postLoginData: return ".showMainOrWhatsNewScreen(sourceScreen:postLoginData:)" case .m_showStartupScreen: return ".showStartupScreen()" case .m_showLoginScreen__sourceScreen_sourceScreen: return ".showLoginScreen(sourceScreen:)" case .m_showRegisterScreen__sourceScreen_sourceScreen: return ".showRegisterScreen(sourceScreen:)" @@ -836,7 +836,7 @@ open class BaseRouterMock: BaseRouter, Mock { public static func backWithFade() -> Verify { return Verify(method: .m_backWithFade)} 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(sourceScreen: Parameter, authMethod: Parameter) -> Verify { return Verify(method: .m_showMainOrWhatsNewScreen__sourceScreen_sourceScreenauthMethod_authMethod(`sourceScreen`, `authMethod`))} + public static func showMainOrWhatsNewScreen(sourceScreen: Parameter, postLoginData: Parameter) -> Verify { return Verify(method: .m_showMainOrWhatsNewScreen__sourceScreen_sourceScreenpostLoginData_postLoginData(`sourceScreen`, `postLoginData`))} public static func showStartupScreen() -> Verify { return Verify(method: .m_showStartupScreen)} public static func showLoginScreen(sourceScreen: Parameter) -> Verify { return Verify(method: .m_showLoginScreen__sourceScreen_sourceScreen(`sourceScreen`))} public static func showRegisterScreen(sourceScreen: Parameter) -> Verify { return Verify(method: .m_showRegisterScreen__sourceScreen_sourceScreen(`sourceScreen`))} @@ -869,8 +869,8 @@ open class BaseRouterMock: BaseRouter, Mock { public static func removeLastView(controllers: Parameter, perform: @escaping (Int) -> Void) -> Perform { return Perform(method: .m_removeLastView__controllers_controllers(`controllers`), performs: perform) } - public static func showMainOrWhatsNewScreen(sourceScreen: Parameter, authMethod: Parameter, perform: @escaping (LogistrationSourceScreen, String?) -> Void) -> Perform { - return Perform(method: .m_showMainOrWhatsNewScreen__sourceScreen_sourceScreenauthMethod_authMethod(`sourceScreen`, `authMethod`), performs: perform) + public static func showMainOrWhatsNewScreen(sourceScreen: Parameter, postLoginData: Parameter, perform: @escaping (LogistrationSourceScreen, PostLoginData?) -> Void) -> Perform { + return Perform(method: .m_showMainOrWhatsNewScreen__sourceScreen_sourceScreenpostLoginData_postLoginData(`sourceScreen`, `postLoginData`), performs: perform) } public static func showStartupScreen(perform: @escaping () -> Void) -> Perform { return Perform(method: .m_showStartupScreen, performs: perform) diff --git a/Discussion/DiscussionTests/DiscussionMock.generated.swift b/Discussion/DiscussionTests/DiscussionMock.generated.swift index 17383de1..352630d1 100644 --- a/Discussion/DiscussionTests/DiscussionMock.generated.swift +++ b/Discussion/DiscussionTests/DiscussionMock.generated.swift @@ -581,10 +581,10 @@ open class BaseRouterMock: BaseRouter, Mock { perform?(`controllers`) } - open func showMainOrWhatsNewScreen(sourceScreen: LogistrationSourceScreen, authMethod: String?) { - addInvocation(.m_showMainOrWhatsNewScreen__sourceScreen_sourceScreenauthMethod_authMethod(Parameter.value(`sourceScreen`), Parameter.value(`authMethod`))) - let perform = methodPerformValue(.m_showMainOrWhatsNewScreen__sourceScreen_sourceScreenauthMethod_authMethod(Parameter.value(`sourceScreen`), Parameter.value(`authMethod`))) as? (LogistrationSourceScreen, String?) -> Void - perform?(`sourceScreen`, `authMethod`) + open func showMainOrWhatsNewScreen(sourceScreen: LogistrationSourceScreen, postLoginData: PostLoginData?) { + addInvocation(.m_showMainOrWhatsNewScreen__sourceScreen_sourceScreenpostLoginData_postLoginData(Parameter.value(`sourceScreen`), Parameter.value(`postLoginData`))) + let perform = methodPerformValue(.m_showMainOrWhatsNewScreen__sourceScreen_sourceScreenpostLoginData_postLoginData(Parameter.value(`sourceScreen`), Parameter.value(`postLoginData`))) as? (LogistrationSourceScreen, PostLoginData?) -> Void + perform?(`sourceScreen`, `postLoginData`) } open func showStartupScreen() { @@ -660,7 +660,7 @@ open class BaseRouterMock: BaseRouter, Mock { case m_backWithFade case m_dismiss__animated_animated(Parameter) case m_removeLastView__controllers_controllers(Parameter) - case m_showMainOrWhatsNewScreen__sourceScreen_sourceScreenauthMethod_authMethod(Parameter, Parameter) + case m_showMainOrWhatsNewScreen__sourceScreen_sourceScreenpostLoginData_postLoginData(Parameter, Parameter) case m_showStartupScreen case m_showLoginScreen__sourceScreen_sourceScreen(Parameter) case m_showRegisterScreen__sourceScreen_sourceScreen(Parameter) @@ -697,10 +697,10 @@ open class BaseRouterMock: BaseRouter, Mock { results.append(Matcher.ParameterComparisonResult(Parameter.compare(lhs: lhsControllers, rhs: rhsControllers, with: matcher), lhsControllers, rhsControllers, "controllers")) return Matcher.ComparisonResult(results) - case (.m_showMainOrWhatsNewScreen__sourceScreen_sourceScreenauthMethod_authMethod(let lhsSourcescreen, let lhsAuthmethod), .m_showMainOrWhatsNewScreen__sourceScreen_sourceScreenauthMethod_authMethod(let rhsSourcescreen, let rhsAuthmethod)): + case (.m_showMainOrWhatsNewScreen__sourceScreen_sourceScreenpostLoginData_postLoginData(let lhsSourcescreen, let lhsPostlogindata), .m_showMainOrWhatsNewScreen__sourceScreen_sourceScreenpostLoginData_postLoginData(let rhsSourcescreen, let rhsPostlogindata)): var results: [Matcher.ParameterComparisonResult] = [] results.append(Matcher.ParameterComparisonResult(Parameter.compare(lhs: lhsSourcescreen, rhs: rhsSourcescreen, with: matcher), lhsSourcescreen, rhsSourcescreen, "sourceScreen")) - results.append(Matcher.ParameterComparisonResult(Parameter.compare(lhs: lhsAuthmethod, rhs: rhsAuthmethod, with: matcher), lhsAuthmethod, rhsAuthmethod, "authMethod")) + results.append(Matcher.ParameterComparisonResult(Parameter.compare(lhs: lhsPostlogindata, rhs: rhsPostlogindata, with: matcher), lhsPostlogindata, rhsPostlogindata, "postLoginData")) return Matcher.ComparisonResult(results) case (.m_showStartupScreen, .m_showStartupScreen): return .match @@ -780,7 +780,7 @@ open class BaseRouterMock: BaseRouter, Mock { case .m_backWithFade: return 0 case let .m_dismiss__animated_animated(p0): return p0.intValue case let .m_removeLastView__controllers_controllers(p0): return p0.intValue - case let .m_showMainOrWhatsNewScreen__sourceScreen_sourceScreenauthMethod_authMethod(p0, p1): return p0.intValue + p1.intValue + case let .m_showMainOrWhatsNewScreen__sourceScreen_sourceScreenpostLoginData_postLoginData(p0, p1): return p0.intValue + p1.intValue case .m_showStartupScreen: return 0 case let .m_showLoginScreen__sourceScreen_sourceScreen(p0): return p0.intValue case let .m_showRegisterScreen__sourceScreen_sourceScreen(p0): return p0.intValue @@ -801,7 +801,7 @@ open class BaseRouterMock: BaseRouter, Mock { case .m_backWithFade: return ".backWithFade()" case .m_dismiss__animated_animated: return ".dismiss(animated:)" case .m_removeLastView__controllers_controllers: return ".removeLastView(controllers:)" - case .m_showMainOrWhatsNewScreen__sourceScreen_sourceScreenauthMethod_authMethod: return ".showMainOrWhatsNewScreen(sourceScreen:authMethod:)" + case .m_showMainOrWhatsNewScreen__sourceScreen_sourceScreenpostLoginData_postLoginData: return ".showMainOrWhatsNewScreen(sourceScreen:postLoginData:)" case .m_showStartupScreen: return ".showStartupScreen()" case .m_showLoginScreen__sourceScreen_sourceScreen: return ".showLoginScreen(sourceScreen:)" case .m_showRegisterScreen__sourceScreen_sourceScreen: return ".showRegisterScreen(sourceScreen:)" @@ -836,7 +836,7 @@ open class BaseRouterMock: BaseRouter, Mock { public static func backWithFade() -> Verify { return Verify(method: .m_backWithFade)} 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(sourceScreen: Parameter, authMethod: Parameter) -> Verify { return Verify(method: .m_showMainOrWhatsNewScreen__sourceScreen_sourceScreenauthMethod_authMethod(`sourceScreen`, `authMethod`))} + public static func showMainOrWhatsNewScreen(sourceScreen: Parameter, postLoginData: Parameter) -> Verify { return Verify(method: .m_showMainOrWhatsNewScreen__sourceScreen_sourceScreenpostLoginData_postLoginData(`sourceScreen`, `postLoginData`))} public static func showStartupScreen() -> Verify { return Verify(method: .m_showStartupScreen)} public static func showLoginScreen(sourceScreen: Parameter) -> Verify { return Verify(method: .m_showLoginScreen__sourceScreen_sourceScreen(`sourceScreen`))} public static func showRegisterScreen(sourceScreen: Parameter) -> Verify { return Verify(method: .m_showRegisterScreen__sourceScreen_sourceScreen(`sourceScreen`))} @@ -869,8 +869,8 @@ open class BaseRouterMock: BaseRouter, Mock { public static func removeLastView(controllers: Parameter, perform: @escaping (Int) -> Void) -> Perform { return Perform(method: .m_removeLastView__controllers_controllers(`controllers`), performs: perform) } - public static func showMainOrWhatsNewScreen(sourceScreen: Parameter, authMethod: Parameter, perform: @escaping (LogistrationSourceScreen, String?) -> Void) -> Perform { - return Perform(method: .m_showMainOrWhatsNewScreen__sourceScreen_sourceScreenauthMethod_authMethod(`sourceScreen`, `authMethod`), performs: perform) + public static func showMainOrWhatsNewScreen(sourceScreen: Parameter, postLoginData: Parameter, perform: @escaping (LogistrationSourceScreen, PostLoginData?) -> Void) -> Perform { + return Perform(method: .m_showMainOrWhatsNewScreen__sourceScreen_sourceScreenpostLoginData_postLoginData(`sourceScreen`, `postLoginData`), performs: perform) } public static func showStartupScreen(perform: @escaping () -> Void) -> Perform { return Perform(method: .m_showStartupScreen, performs: perform) @@ -4759,10 +4759,10 @@ open class DiscussionRouterMock: DiscussionRouter, Mock { perform?(`controllers`) } - open func showMainOrWhatsNewScreen(sourceScreen: LogistrationSourceScreen, authMethod: String?) { - addInvocation(.m_showMainOrWhatsNewScreen__sourceScreen_sourceScreenauthMethod_authMethod(Parameter.value(`sourceScreen`), Parameter.value(`authMethod`))) - let perform = methodPerformValue(.m_showMainOrWhatsNewScreen__sourceScreen_sourceScreenauthMethod_authMethod(Parameter.value(`sourceScreen`), Parameter.value(`authMethod`))) as? (LogistrationSourceScreen, String?) -> Void - perform?(`sourceScreen`, `authMethod`) + open func showMainOrWhatsNewScreen(sourceScreen: LogistrationSourceScreen, postLoginData: PostLoginData?) { + addInvocation(.m_showMainOrWhatsNewScreen__sourceScreen_sourceScreenpostLoginData_postLoginData(Parameter.value(`sourceScreen`), Parameter.value(`postLoginData`))) + let perform = methodPerformValue(.m_showMainOrWhatsNewScreen__sourceScreen_sourceScreenpostLoginData_postLoginData(Parameter.value(`sourceScreen`), Parameter.value(`postLoginData`))) as? (LogistrationSourceScreen, PostLoginData?) -> Void + perform?(`sourceScreen`, `postLoginData`) } open func showStartupScreen() { @@ -4844,7 +4844,7 @@ open class DiscussionRouterMock: DiscussionRouter, Mock { case m_backWithFade case m_dismiss__animated_animated(Parameter) case m_removeLastView__controllers_controllers(Parameter) - case m_showMainOrWhatsNewScreen__sourceScreen_sourceScreenauthMethod_authMethod(Parameter, Parameter) + case m_showMainOrWhatsNewScreen__sourceScreen_sourceScreenpostLoginData_postLoginData(Parameter, Parameter) case m_showStartupScreen case m_showLoginScreen__sourceScreen_sourceScreen(Parameter) case m_showRegisterScreen__sourceScreen_sourceScreen(Parameter) @@ -4927,10 +4927,10 @@ open class DiscussionRouterMock: DiscussionRouter, Mock { results.append(Matcher.ParameterComparisonResult(Parameter.compare(lhs: lhsControllers, rhs: rhsControllers, with: matcher), lhsControllers, rhsControllers, "controllers")) return Matcher.ComparisonResult(results) - case (.m_showMainOrWhatsNewScreen__sourceScreen_sourceScreenauthMethod_authMethod(let lhsSourcescreen, let lhsAuthmethod), .m_showMainOrWhatsNewScreen__sourceScreen_sourceScreenauthMethod_authMethod(let rhsSourcescreen, let rhsAuthmethod)): + case (.m_showMainOrWhatsNewScreen__sourceScreen_sourceScreenpostLoginData_postLoginData(let lhsSourcescreen, let lhsPostlogindata), .m_showMainOrWhatsNewScreen__sourceScreen_sourceScreenpostLoginData_postLoginData(let rhsSourcescreen, let rhsPostlogindata)): var results: [Matcher.ParameterComparisonResult] = [] results.append(Matcher.ParameterComparisonResult(Parameter.compare(lhs: lhsSourcescreen, rhs: rhsSourcescreen, with: matcher), lhsSourcescreen, rhsSourcescreen, "sourceScreen")) - results.append(Matcher.ParameterComparisonResult(Parameter.compare(lhs: lhsAuthmethod, rhs: rhsAuthmethod, with: matcher), lhsAuthmethod, rhsAuthmethod, "authMethod")) + results.append(Matcher.ParameterComparisonResult(Parameter.compare(lhs: lhsPostlogindata, rhs: rhsPostlogindata, with: matcher), lhsPostlogindata, rhsPostlogindata, "postLoginData")) return Matcher.ComparisonResult(results) case (.m_showStartupScreen, .m_showStartupScreen): return .match @@ -5016,7 +5016,7 @@ open class DiscussionRouterMock: DiscussionRouter, Mock { case .m_backWithFade: return 0 case let .m_dismiss__animated_animated(p0): return p0.intValue case let .m_removeLastView__controllers_controllers(p0): return p0.intValue - case let .m_showMainOrWhatsNewScreen__sourceScreen_sourceScreenauthMethod_authMethod(p0, p1): return p0.intValue + p1.intValue + case let .m_showMainOrWhatsNewScreen__sourceScreen_sourceScreenpostLoginData_postLoginData(p0, p1): return p0.intValue + p1.intValue case .m_showStartupScreen: return 0 case let .m_showLoginScreen__sourceScreen_sourceScreen(p0): return p0.intValue case let .m_showRegisterScreen__sourceScreen_sourceScreen(p0): return p0.intValue @@ -5043,7 +5043,7 @@ open class DiscussionRouterMock: DiscussionRouter, Mock { case .m_backWithFade: return ".backWithFade()" case .m_dismiss__animated_animated: return ".dismiss(animated:)" case .m_removeLastView__controllers_controllers: return ".removeLastView(controllers:)" - case .m_showMainOrWhatsNewScreen__sourceScreen_sourceScreenauthMethod_authMethod: return ".showMainOrWhatsNewScreen(sourceScreen:authMethod:)" + case .m_showMainOrWhatsNewScreen__sourceScreen_sourceScreenpostLoginData_postLoginData: return ".showMainOrWhatsNewScreen(sourceScreen:postLoginData:)" case .m_showStartupScreen: return ".showStartupScreen()" case .m_showLoginScreen__sourceScreen_sourceScreen: return ".showLoginScreen(sourceScreen:)" case .m_showRegisterScreen__sourceScreen_sourceScreen: return ".showRegisterScreen(sourceScreen:)" @@ -5084,7 +5084,7 @@ open class DiscussionRouterMock: DiscussionRouter, Mock { public static func backWithFade() -> Verify { return Verify(method: .m_backWithFade)} 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(sourceScreen: Parameter, authMethod: Parameter) -> Verify { return Verify(method: .m_showMainOrWhatsNewScreen__sourceScreen_sourceScreenauthMethod_authMethod(`sourceScreen`, `authMethod`))} + public static func showMainOrWhatsNewScreen(sourceScreen: Parameter, postLoginData: Parameter) -> Verify { return Verify(method: .m_showMainOrWhatsNewScreen__sourceScreen_sourceScreenpostLoginData_postLoginData(`sourceScreen`, `postLoginData`))} public static func showStartupScreen() -> Verify { return Verify(method: .m_showStartupScreen)} public static func showLoginScreen(sourceScreen: Parameter) -> Verify { return Verify(method: .m_showLoginScreen__sourceScreen_sourceScreen(`sourceScreen`))} public static func showRegisterScreen(sourceScreen: Parameter) -> Verify { return Verify(method: .m_showRegisterScreen__sourceScreen_sourceScreen(`sourceScreen`))} @@ -5135,8 +5135,8 @@ open class DiscussionRouterMock: DiscussionRouter, Mock { public static func removeLastView(controllers: Parameter, perform: @escaping (Int) -> Void) -> Perform { return Perform(method: .m_removeLastView__controllers_controllers(`controllers`), performs: perform) } - public static func showMainOrWhatsNewScreen(sourceScreen: Parameter, authMethod: Parameter, perform: @escaping (LogistrationSourceScreen, String?) -> Void) -> Perform { - return Perform(method: .m_showMainOrWhatsNewScreen__sourceScreen_sourceScreenauthMethod_authMethod(`sourceScreen`, `authMethod`), performs: perform) + public static func showMainOrWhatsNewScreen(sourceScreen: Parameter, postLoginData: Parameter, perform: @escaping (LogistrationSourceScreen, PostLoginData?) -> Void) -> Perform { + return Perform(method: .m_showMainOrWhatsNewScreen__sourceScreen_sourceScreenpostLoginData_postLoginData(`sourceScreen`, `postLoginData`), performs: perform) } public static func showStartupScreen(perform: @escaping () -> Void) -> Perform { return Perform(method: .m_showStartupScreen, performs: perform) diff --git a/OpenEdX/DI/ScreenAssembly.swift b/OpenEdX/DI/ScreenAssembly.swift index 683d6474..1e642fac 100644 --- a/OpenEdX/DI/ScreenAssembly.swift +++ b/OpenEdX/DI/ScreenAssembly.swift @@ -57,7 +57,7 @@ class ScreenAssembly: Assembly { } // MARK: MainScreenView - container.register(MainScreenViewModel.self) { @MainActor r, sourceScreen in + container.register(MainScreenViewModel.self) { @MainActor r, sourceScreen, postLoginData in MainScreenViewModel( analytics: r.resolve(MainScreenAnalytics.self)!, config: r.resolve(ConfigProtocol.self)!, @@ -67,7 +67,8 @@ class ScreenAssembly: Assembly { courseInteractor: r.resolve(CourseInteractorProtocol.self)!, appStorage: r.resolve(AppStorage.self)!, calendarManager: r.resolve(CalendarManagerProtocol.self)!, - sourceScreen: sourceScreen + sourceScreen: sourceScreen, + postLoginData: postLoginData ) } // MARK: Startup screen diff --git a/OpenEdX/RouteController.swift b/OpenEdX/RouteController.swift index 6df0b22c..f9a377ff 100644 --- a/OpenEdX/RouteController.swift +++ b/OpenEdX/RouteController.swift @@ -91,9 +91,11 @@ class RouteController: UIViewController { let controller = UIHostingController(rootView: whatsNewView) navigation.viewControllers = [controller] } else { + let postLoginDataDefault: PostLoginData? = PostLoginData() let viewModel = Container.shared.resolve( MainScreenViewModel.self, - argument: LogistrationSourceScreen.default + arguments: LogistrationSourceScreen.default, + postLoginDataDefault )! let controller = UIHostingController(rootView: MainScreenView(viewModel: viewModel)) navigation.viewControllers = [controller] diff --git a/OpenEdX/Router.swift b/OpenEdX/Router.swift index a675d621..fb23efbb 100644 --- a/OpenEdX/Router.swift +++ b/OpenEdX/Router.swift @@ -64,10 +64,7 @@ public class Router: AuthorizationRouter, navigationController.setViewControllers(viewControllers, animated: true) } - public func showMainOrWhatsNewScreen( - sourceScreen: LogistrationSourceScreen, - authMethod: String? - ) { + public func showMainOrWhatsNewScreen(sourceScreen: LogistrationSourceScreen, postLoginData: PostLoginData?) { showToolBar() var whatsNewStorage = Container.shared.resolve(WhatsNewStorage.self)! let config = Container.shared.resolve(ConfigProtocol.self)! @@ -79,11 +76,16 @@ public class Router: AuthorizationRouter, persistence.set(userId: userId) } - if let authMethod = authMethod { + if let authMethod = postLoginData?.authMethod { coreStorage.lastUsedSocialAuth = authMethod } - let viewModel = WhatsNewViewModel(storage: whatsNewStorage, sourceScreen: sourceScreen, analytics: analytics) + let viewModel = WhatsNewViewModel( + storage: whatsNewStorage, + sourceScreen: sourceScreen, + analytics: analytics, + postLoginData: postLoginData + ) let whatsNew = WhatsNewView(router: Container.shared.resolve(WhatsNewRouter.self)!, viewModel: viewModel) let shouldShowWhatsNew = viewModel.shouldShowWhatsNew() @@ -97,7 +99,8 @@ public class Router: AuthorizationRouter, } else { let viewModel = Container.shared.resolve( MainScreenViewModel.self, - argument: sourceScreen + arguments: sourceScreen, + postLoginData )! let controller = UIHostingController(rootView: MainScreenView(viewModel: viewModel)) diff --git a/OpenEdX/View/MainScreenViewModel.swift b/OpenEdX/View/MainScreenViewModel.swift index 7dab5536..7a705373 100644 --- a/OpenEdX/View/MainScreenViewModel.swift +++ b/OpenEdX/View/MainScreenViewModel.swift @@ -34,14 +34,11 @@ final class MainScreenViewModel: ObservableObject { private var appStorage: CoreStorage & ProfileStorage private let calendarManager: CalendarManagerProtocol private var cancellables = Set() + private var postLoginData: PostLoginData? @Published var selection: MainTab = .dashboard @Published var showRegisterBanner: Bool = false - private var shouldShowRegisterBanner: Bool = false - private var authMethod: AuthMethod? - private var cancellations: [AnyCancellable] = [] - init(analytics: MainScreenAnalytics, config: ConfigProtocol, router: BaseRouter, @@ -50,7 +47,8 @@ final class MainScreenViewModel: ObservableObject { courseInteractor: CourseInteractorProtocol, appStorage: CoreStorage & ProfileStorage, calendarManager: CalendarManagerProtocol, - sourceScreen: LogistrationSourceScreen = .default + sourceScreen: LogistrationSourceScreen = .default, + postLoginData: PostLoginData? = nil ) { self.analytics = analytics self.config = config @@ -61,6 +59,7 @@ final class MainScreenViewModel: ObservableObject { self.appStorage = appStorage self.calendarManager = calendarManager self.sourceScreen = sourceScreen + self.postLoginData = postLoginData NotificationCenter.default.publisher(for: .shiftCourseDates, object: nil) .sink { notification in @@ -70,21 +69,6 @@ final class MainScreenViewModel: ObservableObject { } } .store(in: &cancellables) - addObservers() - } - - private func addObservers() { - NotificationCenter.default - .publisher(for: .userAuthorized) - .sink { [weak self] object in - guard let self, - let dict = object.object as? [String: Any], - let authMethod = dict["authMethod"] as? AuthMethod - else { return } - self.shouldShowRegisterBanner = dict["showSocialRegisterBanner"] as? Bool ?? false - self.authMethod = authMethod - } - .store(in: &cancellations) } public func select(tab: MainTab) { @@ -143,20 +127,19 @@ final class MainScreenViewModel: ObservableObject { } public func checkIfNeedToShowRegisterBanner() { - if shouldShowRegisterBanner && !registerBannerText.isEmpty { + if postLoginData?.showSocialRegisterBanner == true && !registerBannerText.isEmpty { showRegisterBanner = true } } public func registerBannerWasShowed() { - shouldShowRegisterBanner = false + postLoginData?.showSocialRegisterBanner = false showRegisterBanner = false } public var registerBannerText: String { - guard !config.platformName.isEmpty, - case .socailAuth(let socialMethod) = authMethod, - !socialMethod.rawValue.isEmpty + guard let socialAuthMethodName = postLoginData?.authMethod, + !socialAuthMethodName.isEmpty else { return "" } - return CoreLocalization.Mainscreen.socialRegisterBanner(config.platformName, socialMethod.rawValue.capitalized) + return CoreLocalization.Mainscreen.socialRegisterBanner(config.platformName, socialAuthMethodName.capitalized) } @MainActor diff --git a/Profile/ProfileTests/ProfileMock.generated.swift b/Profile/ProfileTests/ProfileMock.generated.swift index 54f9df0d..a5da4e70 100644 --- a/Profile/ProfileTests/ProfileMock.generated.swift +++ b/Profile/ProfileTests/ProfileMock.generated.swift @@ -581,10 +581,10 @@ open class BaseRouterMock: BaseRouter, Mock { perform?(`controllers`) } - open func showMainOrWhatsNewScreen(sourceScreen: LogistrationSourceScreen, authMethod: String?) { - addInvocation(.m_showMainOrWhatsNewScreen__sourceScreen_sourceScreenauthMethod_authMethod(Parameter.value(`sourceScreen`), Parameter.value(`authMethod`))) - let perform = methodPerformValue(.m_showMainOrWhatsNewScreen__sourceScreen_sourceScreenauthMethod_authMethod(Parameter.value(`sourceScreen`), Parameter.value(`authMethod`))) as? (LogistrationSourceScreen, String?) -> Void - perform?(`sourceScreen`, `authMethod`) + open func showMainOrWhatsNewScreen(sourceScreen: LogistrationSourceScreen, postLoginData: PostLoginData?) { + addInvocation(.m_showMainOrWhatsNewScreen__sourceScreen_sourceScreenpostLoginData_postLoginData(Parameter.value(`sourceScreen`), Parameter.value(`postLoginData`))) + let perform = methodPerformValue(.m_showMainOrWhatsNewScreen__sourceScreen_sourceScreenpostLoginData_postLoginData(Parameter.value(`sourceScreen`), Parameter.value(`postLoginData`))) as? (LogistrationSourceScreen, PostLoginData?) -> Void + perform?(`sourceScreen`, `postLoginData`) } open func showStartupScreen() { @@ -660,7 +660,7 @@ open class BaseRouterMock: BaseRouter, Mock { case m_backWithFade case m_dismiss__animated_animated(Parameter) case m_removeLastView__controllers_controllers(Parameter) - case m_showMainOrWhatsNewScreen__sourceScreen_sourceScreenauthMethod_authMethod(Parameter, Parameter) + case m_showMainOrWhatsNewScreen__sourceScreen_sourceScreenpostLoginData_postLoginData(Parameter, Parameter) case m_showStartupScreen case m_showLoginScreen__sourceScreen_sourceScreen(Parameter) case m_showRegisterScreen__sourceScreen_sourceScreen(Parameter) @@ -697,10 +697,10 @@ open class BaseRouterMock: BaseRouter, Mock { results.append(Matcher.ParameterComparisonResult(Parameter.compare(lhs: lhsControllers, rhs: rhsControllers, with: matcher), lhsControllers, rhsControllers, "controllers")) return Matcher.ComparisonResult(results) - case (.m_showMainOrWhatsNewScreen__sourceScreen_sourceScreenauthMethod_authMethod(let lhsSourcescreen, let lhsAuthmethod), .m_showMainOrWhatsNewScreen__sourceScreen_sourceScreenauthMethod_authMethod(let rhsSourcescreen, let rhsAuthmethod)): + case (.m_showMainOrWhatsNewScreen__sourceScreen_sourceScreenpostLoginData_postLoginData(let lhsSourcescreen, let lhsPostlogindata), .m_showMainOrWhatsNewScreen__sourceScreen_sourceScreenpostLoginData_postLoginData(let rhsSourcescreen, let rhsPostlogindata)): var results: [Matcher.ParameterComparisonResult] = [] results.append(Matcher.ParameterComparisonResult(Parameter.compare(lhs: lhsSourcescreen, rhs: rhsSourcescreen, with: matcher), lhsSourcescreen, rhsSourcescreen, "sourceScreen")) - results.append(Matcher.ParameterComparisonResult(Parameter.compare(lhs: lhsAuthmethod, rhs: rhsAuthmethod, with: matcher), lhsAuthmethod, rhsAuthmethod, "authMethod")) + results.append(Matcher.ParameterComparisonResult(Parameter.compare(lhs: lhsPostlogindata, rhs: rhsPostlogindata, with: matcher), lhsPostlogindata, rhsPostlogindata, "postLoginData")) return Matcher.ComparisonResult(results) case (.m_showStartupScreen, .m_showStartupScreen): return .match @@ -780,7 +780,7 @@ open class BaseRouterMock: BaseRouter, Mock { case .m_backWithFade: return 0 case let .m_dismiss__animated_animated(p0): return p0.intValue case let .m_removeLastView__controllers_controllers(p0): return p0.intValue - case let .m_showMainOrWhatsNewScreen__sourceScreen_sourceScreenauthMethod_authMethod(p0, p1): return p0.intValue + p1.intValue + case let .m_showMainOrWhatsNewScreen__sourceScreen_sourceScreenpostLoginData_postLoginData(p0, p1): return p0.intValue + p1.intValue case .m_showStartupScreen: return 0 case let .m_showLoginScreen__sourceScreen_sourceScreen(p0): return p0.intValue case let .m_showRegisterScreen__sourceScreen_sourceScreen(p0): return p0.intValue @@ -801,7 +801,7 @@ open class BaseRouterMock: BaseRouter, Mock { case .m_backWithFade: return ".backWithFade()" case .m_dismiss__animated_animated: return ".dismiss(animated:)" case .m_removeLastView__controllers_controllers: return ".removeLastView(controllers:)" - case .m_showMainOrWhatsNewScreen__sourceScreen_sourceScreenauthMethod_authMethod: return ".showMainOrWhatsNewScreen(sourceScreen:authMethod:)" + case .m_showMainOrWhatsNewScreen__sourceScreen_sourceScreenpostLoginData_postLoginData: return ".showMainOrWhatsNewScreen(sourceScreen:postLoginData:)" case .m_showStartupScreen: return ".showStartupScreen()" case .m_showLoginScreen__sourceScreen_sourceScreen: return ".showLoginScreen(sourceScreen:)" case .m_showRegisterScreen__sourceScreen_sourceScreen: return ".showRegisterScreen(sourceScreen:)" @@ -836,7 +836,7 @@ open class BaseRouterMock: BaseRouter, Mock { public static func backWithFade() -> Verify { return Verify(method: .m_backWithFade)} 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(sourceScreen: Parameter, authMethod: Parameter) -> Verify { return Verify(method: .m_showMainOrWhatsNewScreen__sourceScreen_sourceScreenauthMethod_authMethod(`sourceScreen`, `authMethod`))} + public static func showMainOrWhatsNewScreen(sourceScreen: Parameter, postLoginData: Parameter) -> Verify { return Verify(method: .m_showMainOrWhatsNewScreen__sourceScreen_sourceScreenpostLoginData_postLoginData(`sourceScreen`, `postLoginData`))} public static func showStartupScreen() -> Verify { return Verify(method: .m_showStartupScreen)} public static func showLoginScreen(sourceScreen: Parameter) -> Verify { return Verify(method: .m_showLoginScreen__sourceScreen_sourceScreen(`sourceScreen`))} public static func showRegisterScreen(sourceScreen: Parameter) -> Verify { return Verify(method: .m_showRegisterScreen__sourceScreen_sourceScreen(`sourceScreen`))} @@ -869,8 +869,8 @@ open class BaseRouterMock: BaseRouter, Mock { public static func removeLastView(controllers: Parameter, perform: @escaping (Int) -> Void) -> Perform { return Perform(method: .m_removeLastView__controllers_controllers(`controllers`), performs: perform) } - public static func showMainOrWhatsNewScreen(sourceScreen: Parameter, authMethod: Parameter, perform: @escaping (LogistrationSourceScreen, String?) -> Void) -> Perform { - return Perform(method: .m_showMainOrWhatsNewScreen__sourceScreen_sourceScreenauthMethod_authMethod(`sourceScreen`, `authMethod`), performs: perform) + public static func showMainOrWhatsNewScreen(sourceScreen: Parameter, postLoginData: Parameter, perform: @escaping (LogistrationSourceScreen, PostLoginData?) -> Void) -> Perform { + return Perform(method: .m_showMainOrWhatsNewScreen__sourceScreen_sourceScreenpostLoginData_postLoginData(`sourceScreen`, `postLoginData`), performs: perform) } public static func showStartupScreen(perform: @escaping () -> Void) -> Perform { return Perform(method: .m_showStartupScreen, performs: perform) @@ -5878,10 +5878,10 @@ open class ProfileRouterMock: ProfileRouter, Mock { perform?(`controllers`) } - open func showMainOrWhatsNewScreen(sourceScreen: LogistrationSourceScreen, authMethod: String?) { - addInvocation(.m_showMainOrWhatsNewScreen__sourceScreen_sourceScreenauthMethod_authMethod(Parameter.value(`sourceScreen`), Parameter.value(`authMethod`))) - let perform = methodPerformValue(.m_showMainOrWhatsNewScreen__sourceScreen_sourceScreenauthMethod_authMethod(Parameter.value(`sourceScreen`), Parameter.value(`authMethod`))) as? (LogistrationSourceScreen, String?) -> Void - perform?(`sourceScreen`, `authMethod`) + open func showMainOrWhatsNewScreen(sourceScreen: LogistrationSourceScreen, postLoginData: PostLoginData?) { + addInvocation(.m_showMainOrWhatsNewScreen__sourceScreen_sourceScreenpostLoginData_postLoginData(Parameter.value(`sourceScreen`), Parameter.value(`postLoginData`))) + let perform = methodPerformValue(.m_showMainOrWhatsNewScreen__sourceScreen_sourceScreenpostLoginData_postLoginData(Parameter.value(`sourceScreen`), Parameter.value(`postLoginData`))) as? (LogistrationSourceScreen, PostLoginData?) -> Void + perform?(`sourceScreen`, `postLoginData`) } open func showStartupScreen() { @@ -5967,7 +5967,7 @@ open class ProfileRouterMock: ProfileRouter, Mock { case m_backWithFade case m_dismiss__animated_animated(Parameter) case m_removeLastView__controllers_controllers(Parameter) - case m_showMainOrWhatsNewScreen__sourceScreen_sourceScreenauthMethod_authMethod(Parameter, Parameter) + case m_showMainOrWhatsNewScreen__sourceScreen_sourceScreenpostLoginData_postLoginData(Parameter, Parameter) case m_showStartupScreen case m_showLoginScreen__sourceScreen_sourceScreen(Parameter) case m_showRegisterScreen__sourceScreen_sourceScreen(Parameter) @@ -6037,10 +6037,10 @@ open class ProfileRouterMock: ProfileRouter, Mock { results.append(Matcher.ParameterComparisonResult(Parameter.compare(lhs: lhsControllers, rhs: rhsControllers, with: matcher), lhsControllers, rhsControllers, "controllers")) return Matcher.ComparisonResult(results) - case (.m_showMainOrWhatsNewScreen__sourceScreen_sourceScreenauthMethod_authMethod(let lhsSourcescreen, let lhsAuthmethod), .m_showMainOrWhatsNewScreen__sourceScreen_sourceScreenauthMethod_authMethod(let rhsSourcescreen, let rhsAuthmethod)): + case (.m_showMainOrWhatsNewScreen__sourceScreen_sourceScreenpostLoginData_postLoginData(let lhsSourcescreen, let lhsPostlogindata), .m_showMainOrWhatsNewScreen__sourceScreen_sourceScreenpostLoginData_postLoginData(let rhsSourcescreen, let rhsPostlogindata)): var results: [Matcher.ParameterComparisonResult] = [] results.append(Matcher.ParameterComparisonResult(Parameter.compare(lhs: lhsSourcescreen, rhs: rhsSourcescreen, with: matcher), lhsSourcescreen, rhsSourcescreen, "sourceScreen")) - results.append(Matcher.ParameterComparisonResult(Parameter.compare(lhs: lhsAuthmethod, rhs: rhsAuthmethod, with: matcher), lhsAuthmethod, rhsAuthmethod, "authMethod")) + results.append(Matcher.ParameterComparisonResult(Parameter.compare(lhs: lhsPostlogindata, rhs: rhsPostlogindata, with: matcher), lhsPostlogindata, rhsPostlogindata, "postLoginData")) return Matcher.ComparisonResult(results) case (.m_showStartupScreen, .m_showStartupScreen): return .match @@ -6130,7 +6130,7 @@ open class ProfileRouterMock: ProfileRouter, Mock { case .m_backWithFade: return 0 case let .m_dismiss__animated_animated(p0): return p0.intValue case let .m_removeLastView__controllers_controllers(p0): return p0.intValue - case let .m_showMainOrWhatsNewScreen__sourceScreen_sourceScreenauthMethod_authMethod(p0, p1): return p0.intValue + p1.intValue + case let .m_showMainOrWhatsNewScreen__sourceScreen_sourceScreenpostLoginData_postLoginData(p0, p1): return p0.intValue + p1.intValue case .m_showStartupScreen: return 0 case let .m_showLoginScreen__sourceScreen_sourceScreen(p0): return p0.intValue case let .m_showRegisterScreen__sourceScreen_sourceScreen(p0): return p0.intValue @@ -6161,7 +6161,7 @@ open class ProfileRouterMock: ProfileRouter, Mock { case .m_backWithFade: return ".backWithFade()" case .m_dismiss__animated_animated: return ".dismiss(animated:)" case .m_removeLastView__controllers_controllers: return ".removeLastView(controllers:)" - case .m_showMainOrWhatsNewScreen__sourceScreen_sourceScreenauthMethod_authMethod: return ".showMainOrWhatsNewScreen(sourceScreen:authMethod:)" + case .m_showMainOrWhatsNewScreen__sourceScreen_sourceScreenpostLoginData_postLoginData: return ".showMainOrWhatsNewScreen(sourceScreen:postLoginData:)" case .m_showStartupScreen: return ".showStartupScreen()" case .m_showLoginScreen__sourceScreen_sourceScreen: return ".showLoginScreen(sourceScreen:)" case .m_showRegisterScreen__sourceScreen_sourceScreen: return ".showRegisterScreen(sourceScreen:)" @@ -6206,7 +6206,7 @@ open class ProfileRouterMock: ProfileRouter, Mock { public static func backWithFade() -> Verify { return Verify(method: .m_backWithFade)} 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(sourceScreen: Parameter, authMethod: Parameter) -> Verify { return Verify(method: .m_showMainOrWhatsNewScreen__sourceScreen_sourceScreenauthMethod_authMethod(`sourceScreen`, `authMethod`))} + public static func showMainOrWhatsNewScreen(sourceScreen: Parameter, postLoginData: Parameter) -> Verify { return Verify(method: .m_showMainOrWhatsNewScreen__sourceScreen_sourceScreenpostLoginData_postLoginData(`sourceScreen`, `postLoginData`))} public static func showStartupScreen() -> Verify { return Verify(method: .m_showStartupScreen)} public static func showLoginScreen(sourceScreen: Parameter) -> Verify { return Verify(method: .m_showLoginScreen__sourceScreen_sourceScreen(`sourceScreen`))} public static func showRegisterScreen(sourceScreen: Parameter) -> Verify { return Verify(method: .m_showRegisterScreen__sourceScreen_sourceScreen(`sourceScreen`))} @@ -6269,8 +6269,8 @@ open class ProfileRouterMock: ProfileRouter, Mock { public static func removeLastView(controllers: Parameter, perform: @escaping (Int) -> Void) -> Perform { return Perform(method: .m_removeLastView__controllers_controllers(`controllers`), performs: perform) } - public static func showMainOrWhatsNewScreen(sourceScreen: Parameter, authMethod: Parameter, perform: @escaping (LogistrationSourceScreen, String?) -> Void) -> Perform { - return Perform(method: .m_showMainOrWhatsNewScreen__sourceScreen_sourceScreenauthMethod_authMethod(`sourceScreen`, `authMethod`), performs: perform) + public static func showMainOrWhatsNewScreen(sourceScreen: Parameter, postLoginData: Parameter, perform: @escaping (LogistrationSourceScreen, PostLoginData?) -> Void) -> Perform { + return Perform(method: .m_showMainOrWhatsNewScreen__sourceScreen_sourceScreenpostLoginData_postLoginData(`sourceScreen`, `postLoginData`), performs: perform) } public static func showStartupScreen(perform: @escaping () -> Void) -> Perform { return Perform(method: .m_showStartupScreen, performs: perform) diff --git a/WhatsNew/WhatsNew/Presentation/WhatsNewView.swift b/WhatsNew/WhatsNew/Presentation/WhatsNewView.swift index 31c25b79..feb9e987 100644 --- a/WhatsNew/WhatsNew/Presentation/WhatsNewView.swift +++ b/WhatsNew/WhatsNew/Presentation/WhatsNewView.swift @@ -112,7 +112,7 @@ public struct WhatsNewView: View { } else { router.showMainOrWhatsNewScreen( sourceScreen: viewModel.sourceScreen, - authMethod: nil + postLoginData: viewModel.postLoginData ) } @@ -154,7 +154,7 @@ public struct WhatsNewView: View { action: { router.showMainOrWhatsNewScreen( sourceScreen: viewModel.sourceScreen, - authMethod: nil + postLoginData: viewModel.postLoginData ) viewModel.logWhatsNewClose() }, diff --git a/WhatsNew/WhatsNew/Presentation/WhatsNewViewModel.swift b/WhatsNew/WhatsNew/Presentation/WhatsNewViewModel.swift index 4cedf506..8c9086b3 100644 --- a/WhatsNew/WhatsNew/Presentation/WhatsNewViewModel.swift +++ b/WhatsNew/WhatsNew/Presentation/WhatsNewViewModel.swift @@ -16,15 +16,18 @@ public class WhatsNewViewModel: ObservableObject { private let storage: WhatsNewStorage var sourceScreen: LogistrationSourceScreen let analytics: WhatsNewAnalytics + let postLoginData: PostLoginData? public init( storage: WhatsNewStorage, sourceScreen: LogistrationSourceScreen = .default, - analytics: WhatsNewAnalytics + analytics: WhatsNewAnalytics, + postLoginData: PostLoginData? = nil ) { self.storage = storage self.sourceScreen = sourceScreen self.analytics = analytics + self.postLoginData = postLoginData newItems = loadWhatsNew() }