From a2117ee70aa6a1e3d5e8b9ba09301242fb9b4048 Mon Sep 17 00:00:00 2001 From: Cesar Tardaguila <2722505+ctarda@users.noreply.github.com> Date: Fri, 4 Dec 2020 10:53:40 +0800 Subject: [PATCH 01/17] Point WPAuthenticator to branch that supports intercepting the signup flow --- Podfile | 4 ++-- Podfile.lock | 15 ++++++++++++--- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/Podfile b/Podfile index b314bc242bb..21683ad6520 100644 --- a/Podfile +++ b/Podfile @@ -38,9 +38,9 @@ target 'WooCommerce' do pod 'Gridicons', '~> 1.0' # To allow pod to pick up beta versions use -beta. E.g., 1.1.7-beta.1 - pod 'WordPressAuthenticator', '~> 1.31.0-beta.2' + # pod 'WordPressAuthenticator', '~> 1.31.0-beta.2' # pod 'WordPressAuthenticator', :git => 'https://github.com/wordpress-mobile/WordPressAuthenticator-iOS.git', :commit => '' - # pod 'WordPressAuthenticator', :git => 'https://github.com/wordpress-mobile/WordPressAuthenticator-iOS.git', :branch => 'develop' + pod 'WordPressAuthenticator', :git => 'https://github.com/wordpress-mobile/WordPressAuthenticator-iOS.git', :branch => 'issue/no-wp-signup' # pod 'WordPressAuthenticator', :path => '../WordPressAuthenticator-iOS' pod 'WordPressShared', '~> 1.12' diff --git a/Podfile.lock b/Podfile.lock index ef2b5145895..d6c5544d697 100644 --- a/Podfile.lock +++ b/Podfile.lock @@ -107,7 +107,7 @@ DEPENDENCIES: - Kingfisher (~> 5.11.0) - Sourcery (~> 0.18) - WordPress-Editor-iOS (~> 1.11.0) - - WordPressAuthenticator (~> 1.31.0-beta.2) + - WordPressAuthenticator (from `https://github.com/wordpress-mobile/WordPressAuthenticator-iOS.git`, branch `issue/no-wp-signup`) - WordPressShared (~> 1.12) - WordPressUI (~> 1.7.2) - Wormholy (~> 1.6.2) @@ -141,7 +141,6 @@ SPEC REPOS: - UIDeviceIdentifier - WordPress-Aztec-iOS - WordPress-Editor-iOS - - WordPressAuthenticator - WordPressKit - WordPressShared - WordPressUI @@ -157,6 +156,16 @@ SPEC REPOS: - ZendeskSupportProvidersSDK - ZendeskSupportSDK +EXTERNAL SOURCES: + WordPressAuthenticator: + :branch: issue/no-wp-signup + :git: https://github.com/wordpress-mobile/WordPressAuthenticator-iOS.git + +CHECKOUT OPTIONS: + WordPressAuthenticator: + :commit: 791b5d0ad0462fe428c9657e16b8147c67efad45 + :git: https://github.com/wordpress-mobile/WordPressAuthenticator-iOS.git + SPEC CHECKSUMS: 1PasswordExtension: f97cc80ae58053c331b2b6dc8843ba7103b33794 Alamofire: 3ec537f71edc9804815215393ae2b1a8ea33a844 @@ -198,6 +207,6 @@ SPEC CHECKSUMS: ZendeskSupportProvidersSDK: 51c9d4a826f7bd87e3109e5c801c602a6b62c762 ZendeskSupportSDK: dcb2596ad05a63d662e8c7924357babbf327b421 -PODFILE CHECKSUM: 983b843c2b4973c3d8e6ea4353ae0f2ccdf945f1 +PODFILE CHECKSUM: be61ac9fb361a77f1ba8f756dcb32bf6f05632a2 COCOAPODS: 1.9.1 From 492eb4314036b686691a389aa45c6bcbc47a9fe2 Mon Sep 17 00:00:00 2001 From: Cesar Tardaguila <2722505+ctarda@users.noreply.github.com> Date: Fri, 4 Dec 2020 10:53:54 +0800 Subject: [PATCH 02/17] Extract view model instantation to a private method --- .../AuthenticationManager.swift | 31 ++++++++++++++----- 1 file changed, 24 insertions(+), 7 deletions(-) diff --git a/WooCommerce/Classes/Authentication/AuthenticationManager.swift b/WooCommerce/Classes/Authentication/AuthenticationManager.swift index 29dedfbaefd..a64d48d3d5b 100644 --- a/WooCommerce/Classes/Authentication/AuthenticationManager.swift +++ b/WooCommerce/Classes/Authentication/AuthenticationManager.swift @@ -179,16 +179,12 @@ extension AuthenticationManager: WordPressAuthenticatorDelegate { func createdWordPressComAccount(username: String, authToken: String) { } func shouldHandleError(_ error: Error) -> Bool { - guard AuthenticationError.make(with: error) == .notWPSite else { - return false - } - - return true + return isSupportedError(error) } func handleError(_ error: Error, onCompletion: @escaping (UIViewController) -> Void) { - let viewModel = NotWPErrorViewModel() - let noWPErrorUI = ULErrorViewController(viewModel: viewModel) + let errorViewModel = viewModel(error) + let noWPErrorUI = ULErrorViewController(viewModel: errorViewModel) onCompletion(noWPErrorUI) } @@ -342,6 +338,7 @@ private extension AuthenticationManager { /// Maps error codes emitted by WPAuthenticator to a domain error object enum AuthenticationError: Int, Error { + case emailDoesNotMatchWPAcount = 7 case notWPSite = 406 case unknown @@ -349,6 +346,8 @@ private extension AuthenticationManager { let error = error as NSError switch error.code { + case emailDoesNotMatchWPAcount.rawValue: + return .emailDoesNotMatchWPAcount case notWPSite.rawValue: return .notWPSite default: @@ -356,4 +355,22 @@ private extension AuthenticationManager { } } } + + func isSupportedError(_ error: Error) -> Bool { + let wooAuthError = AuthenticationError.make(with: error) + return wooAuthError == .emailDoesNotMatchWPAcount || wooAuthError == .notWPSite + } + + func viewModel(_ error: Error) -> ULErrorViewModel { + let wooAuthError = AuthenticationError.make(with: error) + + switch wooAuthError { + case .emailDoesNotMatchWPAcount: + return NotWPErrorViewModel() + case .notWPSite: + return NotWPErrorViewModel() + default: + return NotWPErrorViewModel() + } + } } From 0f9e69b6fcaf660e69012ad2574acff0e6b2f959 Mon Sep 17 00:00:00 2001 From: Cesar Tardaguila <2722505+ctarda@users.noreply.github.com> Date: Fri, 4 Dec 2020 11:11:24 +0800 Subject: [PATCH 03/17] First iteration of viewmodel specific for error presented when the email address does not match a wp.com account --- .../AuthenticationManager.swift | 2 +- .../NotWPAccountViewModel.swift | 60 +++++++++++++++++++ .../WooCommerce.xcodeproj/project.pbxproj | 12 ++-- 3 files changed, 69 insertions(+), 5 deletions(-) create mode 100644 WooCommerce/Classes/Authentication/Navigation Exceptions/NotWPAccountViewModel.swift diff --git a/WooCommerce/Classes/Authentication/AuthenticationManager.swift b/WooCommerce/Classes/Authentication/AuthenticationManager.swift index a64d48d3d5b..1d3b7881327 100644 --- a/WooCommerce/Classes/Authentication/AuthenticationManager.swift +++ b/WooCommerce/Classes/Authentication/AuthenticationManager.swift @@ -366,7 +366,7 @@ private extension AuthenticationManager { switch wooAuthError { case .emailDoesNotMatchWPAcount: - return NotWPErrorViewModel() + return NotWPAccountViewModel() case .notWPSite: return NotWPErrorViewModel() default: diff --git a/WooCommerce/Classes/Authentication/Navigation Exceptions/NotWPAccountViewModel.swift b/WooCommerce/Classes/Authentication/Navigation Exceptions/NotWPAccountViewModel.swift new file mode 100644 index 00000000000..831cea7b332 --- /dev/null +++ b/WooCommerce/Classes/Authentication/Navigation Exceptions/NotWPAccountViewModel.swift @@ -0,0 +1,60 @@ +import UIKit +import SafariServices +import WordPressAuthenticator +import WordPressUI + + +/// Configuration and actions for an ULErrorViewController, modeling +/// an error when user attempts to log in with an invalid WordPressAccount +struct NotWPAccountViewModel: ULErrorViewModel { + // MARK: - Data and configuration + let image: UIImage = .loginNoWordPressError + + let text: NSAttributedString = NSMutableAttributedString(string: Localization.errorMessage) + + let isAuxiliaryButtonHidden = false + + let auxiliaryButtonTitle = Localization.needHelpFindingEmail + + let primaryButtonTitle = Localization.primaryButtonTitle + + let secondaryButtonTitle = Localization.secondaryButtonTitle + + // MARK: - Actions + func didTapPrimaryButton(in viewController: UIViewController?) { + let popCommand = NavigateBack() + popCommand.execute(from: viewController) + } + + func didTapSecondaryButton(in viewController: UIViewController?) { + let refreshCommand = NavigateToRoot() + refreshCommand.execute(from: viewController) + } + + func didTapAuxiliaryButton(in viewController: UIViewController?) { + + } +} + + +// MARK: - Private data structures +private extension NotWPAccountViewModel { + enum Localization { + static let errorMessage = NSLocalizedString("It looks like this email isn't associated with a WordPress.com account.", + comment: "Message explaining that an email is not associated with a WordPress.com account. " + + "Presented when logging in with an email address that is not a WordPress.com account") + + static let needHelpFindingEmail = NSLocalizedString("Need help finding the connected email?", + comment: "Button linking to webview that explains what Jetpack is" + + "Presented when logging in with a site address that does not have a valid Jetpack installation") + + static let primaryButtonTitle = NSLocalizedString("Enter Your Store Address", + comment: "Action button linking to instructions for enter another store." + + "Presented when logging in with an email address that is not a WordPress.com account") + + static let secondaryButtonTitle = NSLocalizedString("Log In With Another Account", + comment: "Action button that will restart the login flow." + + "Presented when logging in with an email address that does not match a WordPress.com account") + + } +} diff --git a/WooCommerce/WooCommerce.xcodeproj/project.pbxproj b/WooCommerce/WooCommerce.xcodeproj/project.pbxproj index c6ab5234209..4b18924c0e9 100644 --- a/WooCommerce/WooCommerce.xcodeproj/project.pbxproj +++ b/WooCommerce/WooCommerce.xcodeproj/project.pbxproj @@ -49,11 +49,11 @@ 020DD49123239DD6005822B1 /* PaginatedListViewControllerStateCoordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 020DD49023239DD6005822B1 /* PaginatedListViewControllerStateCoordinator.swift */; }; 020F41E523163C0100776C4D /* TopBannerViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 020F41E323163C0100776C4D /* TopBannerViewModel.swift */; }; 020F41E623163C0100776C4D /* TopBannerView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 020F41E423163C0100776C4D /* TopBannerView.swift */; }; + 0211252825773F220075AD2A /* Models+Copiable.generated.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0211252725773F220075AD2A /* Models+Copiable.generated.swift */; }; + 0211252E25773FB00075AD2A /* MockAggregateOrderItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0211252D25773FB00075AD2A /* MockAggregateOrderItem.swift */; }; 0211254125778BDF0075AD2A /* ShippingLabelDetailsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0211253F25778BDF0075AD2A /* ShippingLabelDetailsViewController.swift */; }; 0211254225778BDF0075AD2A /* ShippingLabelDetailsViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 0211254025778BDF0075AD2A /* ShippingLabelDetailsViewController.xib */; }; 021125482577CC650075AD2A /* ShippingLabelDetailsViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 021125472577CC650075AD2A /* ShippingLabelDetailsViewModel.swift */; }; - 0211252825773F220075AD2A /* Models+Copiable.generated.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0211252725773F220075AD2A /* Models+Copiable.generated.swift */; }; - 0211252E25773FB00075AD2A /* MockAggregateOrderItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0211252D25773FB00075AD2A /* MockAggregateOrderItem.swift */; }; 0212275C244972660042161F /* BottomSheetListSelectorSectionHeaderView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0212275B244972660042161F /* BottomSheetListSelectorSectionHeaderView.swift */; }; 0212275E2449728A0042161F /* BottomSheetListSelectorSectionHeaderView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 0212275D2449728A0042161F /* BottomSheetListSelectorSectionHeaderView.xib */; }; 0212276124498A270042161F /* ProductFormBottomSheetListSelectorCommand.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0212276024498A270042161F /* ProductFormBottomSheetListSelectorCommand.swift */; }; @@ -963,6 +963,7 @@ D8736B7522F1FE1600A14A29 /* BadgeLabel.swift in Sources */ = {isa = PBXBuildFile; fileRef = D8736B7422F1FE1600A14A29 /* BadgeLabel.swift */; }; D881A31B256B5CC500FE5605 /* ULErrorViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D881A319256B5CC500FE5605 /* ULErrorViewController.swift */; }; D881A31C256B5CC500FE5605 /* ULErrorViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = D881A31A256B5CC500FE5605 /* ULErrorViewController.xib */; }; + D881FE062579DC78008DE6F2 /* NotWPAccountViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = D881FE052579DC78008DE6F2 /* NotWPAccountViewModel.swift */; }; D88CA756237CE515005D2F44 /* UITabBar+Appearance.swift in Sources */ = {isa = PBXBuildFile; fileRef = D88CA755237CE515005D2F44 /* UITabBar+Appearance.swift */; }; D88CA758237D1C27005D2F44 /* Ghost+Woo.swift in Sources */ = {isa = PBXBuildFile; fileRef = D88CA757237D1C27005D2F44 /* Ghost+Woo.swift */; }; D88D5A3B230B5D63007B6E01 /* MockAnalyticsProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 746791652108D87B007CF1DC /* MockAnalyticsProvider.swift */; }; @@ -1104,11 +1105,11 @@ 020DD49023239DD6005822B1 /* PaginatedListViewControllerStateCoordinator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PaginatedListViewControllerStateCoordinator.swift; sourceTree = ""; }; 020F41E323163C0100776C4D /* TopBannerViewModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TopBannerViewModel.swift; sourceTree = ""; }; 020F41E423163C0100776C4D /* TopBannerView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TopBannerView.swift; sourceTree = ""; }; + 0211252725773F220075AD2A /* Models+Copiable.generated.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Models+Copiable.generated.swift"; sourceTree = ""; }; + 0211252D25773FB00075AD2A /* MockAggregateOrderItem.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MockAggregateOrderItem.swift; sourceTree = ""; }; 0211253F25778BDF0075AD2A /* ShippingLabelDetailsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShippingLabelDetailsViewController.swift; sourceTree = ""; }; 0211254025778BDF0075AD2A /* ShippingLabelDetailsViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = ShippingLabelDetailsViewController.xib; sourceTree = ""; }; 021125472577CC650075AD2A /* ShippingLabelDetailsViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShippingLabelDetailsViewModel.swift; sourceTree = ""; }; - 0211252725773F220075AD2A /* Models+Copiable.generated.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Models+Copiable.generated.swift"; sourceTree = ""; }; - 0211252D25773FB00075AD2A /* MockAggregateOrderItem.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MockAggregateOrderItem.swift; sourceTree = ""; }; 0212275B244972660042161F /* BottomSheetListSelectorSectionHeaderView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BottomSheetListSelectorSectionHeaderView.swift; sourceTree = ""; }; 0212275D2449728A0042161F /* BottomSheetListSelectorSectionHeaderView.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = BottomSheetListSelectorSectionHeaderView.xib; sourceTree = ""; }; 0212276024498A270042161F /* ProductFormBottomSheetListSelectorCommand.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProductFormBottomSheetListSelectorCommand.swift; sourceTree = ""; }; @@ -2036,6 +2037,7 @@ D8736B7422F1FE1600A14A29 /* BadgeLabel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BadgeLabel.swift; sourceTree = ""; }; D881A319256B5CC500FE5605 /* ULErrorViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ULErrorViewController.swift; sourceTree = ""; }; D881A31A256B5CC500FE5605 /* ULErrorViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = ULErrorViewController.xib; sourceTree = ""; }; + D881FE052579DC78008DE6F2 /* NotWPAccountViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NotWPAccountViewModel.swift; sourceTree = ""; }; D88CA755237CE515005D2F44 /* UITabBar+Appearance.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UITabBar+Appearance.swift"; sourceTree = ""; }; D88CA757237D1C27005D2F44 /* Ghost+Woo.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Ghost+Woo.swift"; sourceTree = ""; }; D88D5A3C230B5E85007B6E01 /* ServiceLocatorTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ServiceLocatorTests.swift; sourceTree = ""; }; @@ -4880,6 +4882,7 @@ D8610BCB256F284700A5DF27 /* ULErrorViewModel.swift */, D8610BD1256F291000A5DF27 /* JetpackErrorViewModel.swift */, D8610D752570AE1F00A5DF27 /* NotWPErrorViewModel.swift */, + D881FE052579DC78008DE6F2 /* NotWPAccountViewModel.swift */, ); path = "Navigation Exceptions"; sourceTree = ""; @@ -5726,6 +5729,7 @@ B541B2172189EED4008FE7C1 /* NSMutableAttributedString+Helpers.swift in Sources */, B586906621A5F4B1001F1EFC /* UINavigationController+Woo.swift in Sources */, 45FBDF3A238D3F8B00127F77 /* ExtendedAddProductImageCollectionViewCell.swift in Sources */, + D881FE062579DC78008DE6F2 /* NotWPAccountViewModel.swift in Sources */, 02C0CD2A23B5BB1C00F880B1 /* ImageService.swift in Sources */, 26ABCE532518EAF300721CB0 /* IssueRefundTableViewCell.swift in Sources */, 02482A8B237BE8C7007E73ED /* LinkSettingsViewController.swift in Sources */, From f07918b88c394c547a3c2c57cb7c6f5e0c93f887 Mon Sep 17 00:00:00 2001 From: Cesar Tardaguila <2722505+ctarda@users.noreply.github.com> Date: Fri, 4 Dec 2020 11:12:39 +0800 Subject: [PATCH 04/17] Make primary button navigate to enter site --- .../Navigation Exceptions/NotWPAccountViewModel.swift | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/WooCommerce/Classes/Authentication/Navigation Exceptions/NotWPAccountViewModel.swift b/WooCommerce/Classes/Authentication/Navigation Exceptions/NotWPAccountViewModel.swift index 831cea7b332..a81389f365a 100644 --- a/WooCommerce/Classes/Authentication/Navigation Exceptions/NotWPAccountViewModel.swift +++ b/WooCommerce/Classes/Authentication/Navigation Exceptions/NotWPAccountViewModel.swift @@ -22,7 +22,7 @@ struct NotWPAccountViewModel: ULErrorViewModel { // MARK: - Actions func didTapPrimaryButton(in viewController: UIViewController?) { - let popCommand = NavigateBack() + let popCommand = NavigateToEnterSite() popCommand.execute(from: viewController) } @@ -32,7 +32,6 @@ struct NotWPAccountViewModel: ULErrorViewModel { } func didTapAuxiliaryButton(in viewController: UIViewController?) { - } } From b6b2ef7a569bc4d86e6b432e7109d3f397617751 Mon Sep 17 00:00:00 2001 From: Cesar Tardaguila <2722505+ctarda@users.noreply.github.com> Date: Fri, 4 Dec 2020 11:32:35 +0800 Subject: [PATCH 05/17] Bail out when there in an unkown error --- .../Classes/Authentication/AuthenticationManager.swift | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/WooCommerce/Classes/Authentication/AuthenticationManager.swift b/WooCommerce/Classes/Authentication/AuthenticationManager.swift index 1d3b7881327..2bda0baf151 100644 --- a/WooCommerce/Classes/Authentication/AuthenticationManager.swift +++ b/WooCommerce/Classes/Authentication/AuthenticationManager.swift @@ -183,7 +183,10 @@ extension AuthenticationManager: WordPressAuthenticatorDelegate { } func handleError(_ error: Error, onCompletion: @escaping (UIViewController) -> Void) { - let errorViewModel = viewModel(error) + guard let errorViewModel = viewModel(error) else { + return + } + let noWPErrorUI = ULErrorViewController(viewModel: errorViewModel) onCompletion(noWPErrorUI) @@ -361,7 +364,7 @@ private extension AuthenticationManager { return wooAuthError == .emailDoesNotMatchWPAcount || wooAuthError == .notWPSite } - func viewModel(_ error: Error) -> ULErrorViewModel { + func viewModel(_ error: Error) -> ULErrorViewModel? { let wooAuthError = AuthenticationError.make(with: error) switch wooAuthError { @@ -370,7 +373,7 @@ private extension AuthenticationManager { case .notWPSite: return NotWPErrorViewModel() default: - return NotWPErrorViewModel() + return nil } } } From b6ec3ce5f542051c2acd41d786a0a822f36b9be3 Mon Sep 17 00:00:00 2001 From: Cesar Tardaguila <2722505+ctarda@users.noreply.github.com> Date: Fri, 4 Dec 2020 11:54:02 +0800 Subject: [PATCH 06/17] Add fancy alert for a mismatched email address --- ...ancyAlertViewController+UnifiedLogin.swift | 50 ++++++++++++++++++- 1 file changed, 48 insertions(+), 2 deletions(-) diff --git a/WooCommerce/Classes/ViewRelated/Fancy Alerts/FancyAlertViewController+UnifiedLogin.swift b/WooCommerce/Classes/ViewRelated/Fancy Alerts/FancyAlertViewController+UnifiedLogin.swift index e2996cb8e88..6c34790635a 100644 --- a/WooCommerce/Classes/ViewRelated/Fancy Alerts/FancyAlertViewController+UnifiedLogin.swift +++ b/WooCommerce/Classes/ViewRelated/Fancy Alerts/FancyAlertViewController+UnifiedLogin.swift @@ -6,7 +6,7 @@ public extension FancyAlertViewController { let dismissButton = makeDismissButtonConfig() let moreInfoButton = makeMoreInfoButtonConfig() let config = FancyAlertViewController.Config(titleText: Localization.whatIsJetpack, - bodyText: Localization.longDescription, + bodyText: Localization.whatIsJetpackLongDescription, headerImage: .whatIsJetpackImage, dividerPosition: .top, defaultButton: dismissButton, @@ -17,6 +17,23 @@ public extension FancyAlertViewController { let controller = FancyAlertViewController.controllerWithConfiguration(configuration: config) return controller } + + static func makeNeedHelpFindingEmailAlertController() -> FancyAlertViewController { + let dismissButton = makeDismissButtonConfig() + let moreHelpButton = makeNeedMoreHelpButton() + let config = FancyAlertViewController.Config(titleText: Localization.whatEmailDoIUse, + bodyText: Localization.whatEmailDoIUseLongDescription, + headerImage: nil, + dividerPosition: .top, + defaultButton: dismissButton, + cancelButton: nil, + moreInfoButton: moreHelpButton, + dismissAction: {}) + + let controller = FancyAlertViewController.controllerWithConfiguration(configuration: config) + return controller + + } } @@ -27,7 +44,7 @@ private extension FancyAlertViewController { comment: "Title of alert informing users of what Jetpack is. Presented when users attempt to log in without Jetpack installed or connected" ) - static let longDescription = NSLocalizedString( + static let whatIsJetpackLongDescription = NSLocalizedString( "Jetpack is a free WordPress plugin that connects your store with tools needed to give you the best mobile experience, " + "including push notifications and stats", comment: "Long description of what Jetpack is. Presented when users attempt to log in without Jetpack installed or connected" @@ -42,12 +59,29 @@ private extension FancyAlertViewController { "Continue", comment: "Title of dismiss button presented when users attempt to log in without Jetpack installed or connected" ) + + static let whatEmailDoIUse = NSLocalizedString( + "What email do I use to sign in?", + comment: "Title of alert informing users of what email they can use to sign in. Presented when users attempt to log in with an email that does not match a WP.com account" + ) + + static let whatEmailDoIUseLongDescription = NSLocalizedString( + "In your site admin you can fing the email you used to connect to WordPress.com from the Jetpack Dashboard under Connections > Account Connection", + comment: "Long descriptions of alert informing users of what email they can use to sign in. Presented when users attempt to log in with an email that does not match a WP.com account" + ) + + static let needMoreHelp = NSLocalizedString( + "Need more help?", + comment: "Title of button to learn more presented when users attempt to log in with an email address that does not match a WP.com account" + ) } enum Strings { static let instructionsURLString = "https://docs.woocommerce.com/document/jetpack-setup-instructions-for-the-woocommerce-mobile-app/" static let whatsJetpackURLString = "https://jetpack.com/about/" + + static let needMoreHelpURLString = "https://jetpack.com/support/primary-user/" } } @@ -70,4 +104,16 @@ private extension FancyAlertViewController { controller.present(safariViewController, animated: true) } } + + static func makeNeedMoreHelpButton() -> FancyAlertViewController.Config.ButtonConfig { + return FancyAlertViewController.Config.ButtonConfig(Localization.needMoreHelp) { controller, _ in + guard let url = URL(string: Strings.needMoreHelpURLString) else { + return + } + + let safariViewController = SFSafariViewController(url: url) + safariViewController.modalPresentationStyle = .pageSheet + controller.present(safariViewController, animated: true) + } + } } From 00d24e584a09bb4017fbfe68df60caa9ad7c831f Mon Sep 17 00:00:00 2001 From: Cesar Tardaguila <2722505+ctarda@users.noreply.github.com> Date: Fri, 4 Dec 2020 11:55:54 +0800 Subject: [PATCH 07/17] Present alert --- .../Navigation Exceptions/NotWPAccountViewModel.swift | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/WooCommerce/Classes/Authentication/Navigation Exceptions/NotWPAccountViewModel.swift b/WooCommerce/Classes/Authentication/Navigation Exceptions/NotWPAccountViewModel.swift index a81389f365a..ad859d38260 100644 --- a/WooCommerce/Classes/Authentication/Navigation Exceptions/NotWPAccountViewModel.swift +++ b/WooCommerce/Classes/Authentication/Navigation Exceptions/NotWPAccountViewModel.swift @@ -32,6 +32,10 @@ struct NotWPAccountViewModel: ULErrorViewModel { } func didTapAuxiliaryButton(in viewController: UIViewController?) { + let fancyAlert = FancyAlertViewController.makeNeedHelpFindingEmailAlertController() + fancyAlert.modalPresentationStyle = .custom + fancyAlert.transitioningDelegate = AppDelegate.shared.tabBarController + viewController?.present(fancyAlert, animated: true) } } From 473501427c691191f30c1d60a5b6eba9fcfbcee9 Mon Sep 17 00:00:00 2001 From: Cesar Tardaguila <2722505+ctarda@users.noreply.github.com> Date: Fri, 4 Dec 2020 11:57:00 +0800 Subject: [PATCH 08/17] fix a typo and silence two line lenght violation warnings --- .../FancyAlertViewController+UnifiedLogin.swift | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/WooCommerce/Classes/ViewRelated/Fancy Alerts/FancyAlertViewController+UnifiedLogin.swift b/WooCommerce/Classes/ViewRelated/Fancy Alerts/FancyAlertViewController+UnifiedLogin.swift index 6c34790635a..258cbbe2441 100644 --- a/WooCommerce/Classes/ViewRelated/Fancy Alerts/FancyAlertViewController+UnifiedLogin.swift +++ b/WooCommerce/Classes/ViewRelated/Fancy Alerts/FancyAlertViewController+UnifiedLogin.swift @@ -62,12 +62,14 @@ private extension FancyAlertViewController { static let whatEmailDoIUse = NSLocalizedString( "What email do I use to sign in?", - comment: "Title of alert informing users of what email they can use to sign in. Presented when users attempt to log in with an email that does not match a WP.com account" + comment: "Title of alert informing users of what email they can use to sign in." + + "Presented when users attempt to log in with an email that does not match a WP.com account" ) static let whatEmailDoIUseLongDescription = NSLocalizedString( - "In your site admin you can fing the email you used to connect to WordPress.com from the Jetpack Dashboard under Connections > Account Connection", - comment: "Long descriptions of alert informing users of what email they can use to sign in. Presented when users attempt to log in with an email that does not match a WP.com account" + "In your site admin you can find the email you used to connect to WordPress.com from the Jetpack Dashboard under Connections > Account Connection", + comment: "Long descriptions of alert informing users of what email they can use to sign in." + + "Presented when users attempt to log in with an email that does not match a WP.com account" ) static let needMoreHelp = NSLocalizedString( From d2e9187fe7c8818652ef1ec617ed4ce41e9564b6 Mon Sep 17 00:00:00 2001 From: Cesar Tardaguila <2722505+ctarda@users.noreply.github.com> Date: Fri, 4 Dec 2020 12:08:01 +0800 Subject: [PATCH 09/17] Update dependency --- Podfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Podfile.lock b/Podfile.lock index d6c5544d697..e84b6f38b4a 100644 --- a/Podfile.lock +++ b/Podfile.lock @@ -163,7 +163,7 @@ EXTERNAL SOURCES: CHECKOUT OPTIONS: WordPressAuthenticator: - :commit: 791b5d0ad0462fe428c9657e16b8147c67efad45 + :commit: 34aee56c56900fd9eecca26a4bfe430433196b82 :git: https://github.com/wordpress-mobile/WordPressAuthenticator-iOS.git SPEC CHECKSUMS: From b57d110bb215e5ad9b2de64b398edb92e20706de Mon Sep 17 00:00:00 2001 From: Cesar Tardaguila <2722505+ctarda@users.noreply.github.com> Date: Fri, 4 Dec 2020 12:32:10 +0800 Subject: [PATCH 10/17] Add custom insets to extra info button to ensure it expands to cover all available horzontal space --- .../ULErrorViewController.swift | 8 ++++++++ .../ULErrorViewController.xib | 14 +++++++------- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/WooCommerce/Classes/Authentication/Navigation Exceptions/ULErrorViewController.swift b/WooCommerce/Classes/Authentication/Navigation Exceptions/ULErrorViewController.swift index c8a360cb91d..bf6e3023394 100644 --- a/WooCommerce/Classes/Authentication/Navigation Exceptions/ULErrorViewController.swift +++ b/WooCommerce/Classes/Authentication/Navigation Exceptions/ULErrorViewController.swift @@ -58,6 +58,7 @@ private extension ULErrorViewController { } extraInfoButton.applyLinkButtonStyle() + extraInfoButton.contentEdgeInsets = Constants.extraInfoCustomInsets extraInfoButton.setTitle(viewModel.auxiliaryButtonTitle, for: .normal) extraInfoButton.on(.touchUpInside) { [weak self] _ in self?.didTapAuxiliaryButton() @@ -97,6 +98,13 @@ private extension ULErrorViewController { } +// MARK: - Constants +private extension ULErrorViewController { + enum Constants { + static let extraInfoCustomInsets = UIEdgeInsets(top: 12, left: 10, bottom: 12, right: 10) + } +} + // MARK: - Tests extension ULErrorViewController { func getImageView() -> UIImageView { diff --git a/WooCommerce/Classes/Authentication/Navigation Exceptions/ULErrorViewController.xib b/WooCommerce/Classes/Authentication/Navigation Exceptions/ULErrorViewController.xib index 44d9f0bc77c..36d4d9d257d 100644 --- a/WooCommerce/Classes/Authentication/Navigation Exceptions/ULErrorViewController.xib +++ b/WooCommerce/Classes/Authentication/Navigation Exceptions/ULErrorViewController.xib @@ -67,22 +67,22 @@ - + - + @@ -94,9 +94,9 @@ - + - + From 51eae2a72f688f303784273e98564391ab0cc6a2 Mon Sep 17 00:00:00 2001 From: Cesar Tardaguila <2722505+ctarda@users.noreply.github.com> Date: Mon, 7 Dec 2020 10:04:29 +0800 Subject: [PATCH 11/17] Point WPAuthenticator to 1.31.0-beta.3 --- Podfile | 4 ++-- Podfile.lock | 23 +++++++---------------- 2 files changed, 9 insertions(+), 18 deletions(-) diff --git a/Podfile b/Podfile index 21683ad6520..4a0d5a35b1d 100644 --- a/Podfile +++ b/Podfile @@ -38,9 +38,9 @@ target 'WooCommerce' do pod 'Gridicons', '~> 1.0' # To allow pod to pick up beta versions use -beta. E.g., 1.1.7-beta.1 - # pod 'WordPressAuthenticator', '~> 1.31.0-beta.2' + pod 'WordPressAuthenticator', '~> 1.31.0-beta.3' # pod 'WordPressAuthenticator', :git => 'https://github.com/wordpress-mobile/WordPressAuthenticator-iOS.git', :commit => '' - pod 'WordPressAuthenticator', :git => 'https://github.com/wordpress-mobile/WordPressAuthenticator-iOS.git', :branch => 'issue/no-wp-signup' + # pod 'WordPressAuthenticator', :git => 'https://github.com/wordpress-mobile/WordPressAuthenticator-iOS.git', :branch => 'issue/no-wp-signup' # pod 'WordPressAuthenticator', :path => '../WordPressAuthenticator-iOS' pod 'WordPressShared', '~> 1.12' diff --git a/Podfile.lock b/Podfile.lock index e84b6f38b4a..7b3bff33d13 100644 --- a/Podfile.lock +++ b/Podfile.lock @@ -54,7 +54,7 @@ PODS: - WordPress-Aztec-iOS (1.11.0) - WordPress-Editor-iOS (1.11.0): - WordPress-Aztec-iOS (= 1.11.0) - - WordPressAuthenticator (1.31.0-beta.2): + - WordPressAuthenticator (1.31.0-beta.3): - 1PasswordExtension (= 1.8.6) - Alamofire (= 4.8) - CocoaLumberjack (~> 3.5) @@ -66,7 +66,7 @@ PODS: - WordPressKit (~> 4.18-beta) - WordPressShared (~> 1.12-beta) - WordPressUI (~> 1.7.0) - - WordPressKit (4.23.0-beta.1): + - WordPressKit (4.23.0-beta.4): - Alamofire (~> 4.8.0) - CocoaLumberjack (~> 3.4) - NSObject-SafeExpectations (= 0.0.4) @@ -107,7 +107,7 @@ DEPENDENCIES: - Kingfisher (~> 5.11.0) - Sourcery (~> 0.18) - WordPress-Editor-iOS (~> 1.11.0) - - WordPressAuthenticator (from `https://github.com/wordpress-mobile/WordPressAuthenticator-iOS.git`, branch `issue/no-wp-signup`) + - WordPressAuthenticator (~> 1.31.0-beta.3) - WordPressShared (~> 1.12) - WordPressUI (~> 1.7.2) - Wormholy (~> 1.6.2) @@ -141,6 +141,7 @@ SPEC REPOS: - UIDeviceIdentifier - WordPress-Aztec-iOS - WordPress-Editor-iOS + - WordPressAuthenticator - WordPressKit - WordPressShared - WordPressUI @@ -156,16 +157,6 @@ SPEC REPOS: - ZendeskSupportProvidersSDK - ZendeskSupportSDK -EXTERNAL SOURCES: - WordPressAuthenticator: - :branch: issue/no-wp-signup - :git: https://github.com/wordpress-mobile/WordPressAuthenticator-iOS.git - -CHECKOUT OPTIONS: - WordPressAuthenticator: - :commit: 34aee56c56900fd9eecca26a4bfe430433196b82 - :git: https://github.com/wordpress-mobile/WordPressAuthenticator-iOS.git - SPEC CHECKSUMS: 1PasswordExtension: f97cc80ae58053c331b2b6dc8843ba7103b33794 Alamofire: 3ec537f71edc9804815215393ae2b1a8ea33a844 @@ -191,8 +182,8 @@ SPEC CHECKSUMS: UIDeviceIdentifier: f4bf3b343581a1beacdbf5fb1a8825bd5f05a4a4 WordPress-Aztec-iOS: 050b34d4c3adfb7c60363849049b13d60683b348 WordPress-Editor-iOS: 304098424f1051cb271546c99f906aac296b1b81 - WordPressAuthenticator: 6144728478567e3ecb9514ac0ac434d203e7f26b - WordPressKit: d67438d29c84960585ecef9a595e9f214b42cc87 + WordPressAuthenticator: b43cd7f1ec8eb0bd2efd5b7b93d16d72be402046 + WordPressKit: 3cba388ffed57891c3821e1efc08a2b71382b214 WordPressShared: 532ad68f954d37ea901e8c7e3ca62913c43ff787 WordPressUI: 07ad23f17631bdce0171383e533eb7c4c29280aa Wormholy: bfc1c8679eefd0edd92638758e21c3961b1b3b50 @@ -207,6 +198,6 @@ SPEC CHECKSUMS: ZendeskSupportProvidersSDK: 51c9d4a826f7bd87e3109e5c801c602a6b62c762 ZendeskSupportSDK: dcb2596ad05a63d662e8c7924357babbf327b421 -PODFILE CHECKSUM: be61ac9fb361a77f1ba8f756dcb32bf6f05632a2 +PODFILE CHECKSUM: b3db053d3409a9e53cdc40fdc31208901a62dd3d COCOAPODS: 1.9.1 From c633949eca6d85ff59bec2fb940358fe1fc0d175 Mon Sep 17 00:00:00 2001 From: Cesar Tardaguila <2722505+ctarda@users.noreply.github.com> Date: Mon, 7 Dec 2020 10:16:00 +0800 Subject: [PATCH 12/17] Present Help view controller odally when tapping "need more help" in the alert --- .../FancyAlertViewController+UnifiedLogin.swift | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/WooCommerce/Classes/ViewRelated/Fancy Alerts/FancyAlertViewController+UnifiedLogin.swift b/WooCommerce/Classes/ViewRelated/Fancy Alerts/FancyAlertViewController+UnifiedLogin.swift index 258cbbe2441..6db583b0bb8 100644 --- a/WooCommerce/Classes/ViewRelated/Fancy Alerts/FancyAlertViewController+UnifiedLogin.swift +++ b/WooCommerce/Classes/ViewRelated/Fancy Alerts/FancyAlertViewController+UnifiedLogin.swift @@ -82,8 +82,6 @@ private extension FancyAlertViewController { static let instructionsURLString = "https://docs.woocommerce.com/document/jetpack-setup-instructions-for-the-woocommerce-mobile-app/" static let whatsJetpackURLString = "https://jetpack.com/about/" - - static let needMoreHelpURLString = "https://jetpack.com/support/primary-user/" } } @@ -109,13 +107,17 @@ private extension FancyAlertViewController { static func makeNeedMoreHelpButton() -> FancyAlertViewController.Config.ButtonConfig { return FancyAlertViewController.Config.ButtonConfig(Localization.needMoreHelp) { controller, _ in - guard let url = URL(string: Strings.needMoreHelpURLString) else { + let identifier = HelpAndSupportViewController.classNameWithoutNamespaces + guard let supportViewController = UIStoryboard.dashboard.instantiateViewController(withIdentifier: identifier) as? HelpAndSupportViewController else { return } - let safariViewController = SFSafariViewController(url: url) - safariViewController.modalPresentationStyle = .pageSheet - controller.present(safariViewController, animated: true) + supportViewController.displaysDismissAction = true + + let navController = UINavigationController(rootViewController: supportViewController) + navController.modalPresentationStyle = .formSheet + + controller.present(navController, animated: true, completion: nil) } } } From 28abbb5738f67e6ef231fb7315237e8e754fa643 Mon Sep 17 00:00:00 2001 From: Cesar Tardaguila <2722505+ctarda@users.noreply.github.com> Date: Mon, 7 Dec 2020 10:18:11 +0800 Subject: [PATCH 13/17] Silence a linter warning --- .../Fancy Alerts/FancyAlertViewController+UnifiedLogin.swift | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/WooCommerce/Classes/ViewRelated/Fancy Alerts/FancyAlertViewController+UnifiedLogin.swift b/WooCommerce/Classes/ViewRelated/Fancy Alerts/FancyAlertViewController+UnifiedLogin.swift index 6db583b0bb8..6e704a07f79 100644 --- a/WooCommerce/Classes/ViewRelated/Fancy Alerts/FancyAlertViewController+UnifiedLogin.swift +++ b/WooCommerce/Classes/ViewRelated/Fancy Alerts/FancyAlertViewController+UnifiedLogin.swift @@ -108,7 +108,9 @@ private extension FancyAlertViewController { static func makeNeedMoreHelpButton() -> FancyAlertViewController.Config.ButtonConfig { return FancyAlertViewController.Config.ButtonConfig(Localization.needMoreHelp) { controller, _ in let identifier = HelpAndSupportViewController.classNameWithoutNamespaces - guard let supportViewController = UIStoryboard.dashboard.instantiateViewController(withIdentifier: identifier) as? HelpAndSupportViewController else { + guard let supportViewController = UIStoryboard + .dashboard + .instantiateViewController(withIdentifier: identifier) as? HelpAndSupportViewController else { return } From 8817acc4b7139eedb92b09aa90c6e658615fe7ee Mon Sep 17 00:00:00 2001 From: Cesar Tardaguila <2722505+ctarda@users.noreply.github.com> Date: Mon, 7 Dec 2020 11:31:44 +0800 Subject: [PATCH 14/17] A bit of cleanup of the Podfile. A good side effect is that this should trigger a new build on CI --- Podfile | 2 +- Podfile.lock | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Podfile b/Podfile index 4a0d5a35b1d..172cdb2c5ef 100644 --- a/Podfile +++ b/Podfile @@ -40,7 +40,7 @@ target 'WooCommerce' do # To allow pod to pick up beta versions use -beta. E.g., 1.1.7-beta.1 pod 'WordPressAuthenticator', '~> 1.31.0-beta.3' # pod 'WordPressAuthenticator', :git => 'https://github.com/wordpress-mobile/WordPressAuthenticator-iOS.git', :commit => '' - # pod 'WordPressAuthenticator', :git => 'https://github.com/wordpress-mobile/WordPressAuthenticator-iOS.git', :branch => 'issue/no-wp-signup' + # pod 'WordPressAuthenticator', :git => 'https://github.com/wordpress-mobile/WordPressAuthenticator-iOS.git', :branch => '' # pod 'WordPressAuthenticator', :path => '../WordPressAuthenticator-iOS' pod 'WordPressShared', '~> 1.12' diff --git a/Podfile.lock b/Podfile.lock index 7b3bff33d13..f4ce9f5fa52 100644 --- a/Podfile.lock +++ b/Podfile.lock @@ -198,6 +198,6 @@ SPEC CHECKSUMS: ZendeskSupportProvidersSDK: 51c9d4a826f7bd87e3109e5c801c602a6b62c762 ZendeskSupportSDK: dcb2596ad05a63d662e8c7924357babbf327b421 -PODFILE CHECKSUM: b3db053d3409a9e53cdc40fdc31208901a62dd3d +PODFILE CHECKSUM: 25565253d6035bcea3995dcf6c1d42ac1e060c27 COCOAPODS: 1.9.1 From 45b66295443b976726f935a69fe8705831c05087 Mon Sep 17 00:00:00 2001 From: Cesar Tardaguila <2722505+ctarda@users.noreply.github.com> Date: Tue, 8 Dec 2020 07:05:18 +0800 Subject: [PATCH 15/17] Fix typo in emailDoesNotMatchWPAcount --- .../Classes/Authentication/AuthenticationManager.swift | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/WooCommerce/Classes/Authentication/AuthenticationManager.swift b/WooCommerce/Classes/Authentication/AuthenticationManager.swift index 7b70565b25b..052addc8d2a 100644 --- a/WooCommerce/Classes/Authentication/AuthenticationManager.swift +++ b/WooCommerce/Classes/Authentication/AuthenticationManager.swift @@ -340,7 +340,7 @@ private extension AuthenticationManager { /// Maps error codes emitted by WPAuthenticator to a domain error object enum AuthenticationError: Int, Error { - case emailDoesNotMatchWPAcount = 7 + case emailDoesNotMatchWPAccount = 7 case notWPSite = 406 case unknown @@ -348,8 +348,8 @@ private extension AuthenticationManager { let error = error as NSError switch error.code { - case emailDoesNotMatchWPAcount.rawValue: - return .emailDoesNotMatchWPAcount + case emailDoesNotMatchWPAccount.rawValue: + return .emailDoesNotMatchWPAccount case notWPSite.rawValue: return .notWPSite default: @@ -360,14 +360,14 @@ private extension AuthenticationManager { func isSupportedError(_ error: Error) -> Bool { let wooAuthError = AuthenticationError.make(with: error) - return wooAuthError == .emailDoesNotMatchWPAcount || wooAuthError == .notWPSite + return wooAuthError == .emailDoesNotMatchWPAccount || wooAuthError == .notWPSite } func viewModel(_ error: Error) -> ULErrorViewModel? { let wooAuthError = AuthenticationError.make(with: error) switch wooAuthError { - case .emailDoesNotMatchWPAcount: + case .emailDoesNotMatchWPAccount: return NotWPAccountViewModel() case .notWPSite: return NotWPErrorViewModel() From ae1404fccc519fe792deaab61c072a571fc81daf Mon Sep 17 00:00:00 2001 From: Cesar Tardaguila <2722505+ctarda@users.noreply.github.com> Date: Tue, 8 Dec 2020 07:07:54 +0800 Subject: [PATCH 16/17] Update logic deciding what errors are supported --- WooCommerce/Classes/Authentication/AuthenticationManager.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/WooCommerce/Classes/Authentication/AuthenticationManager.swift b/WooCommerce/Classes/Authentication/AuthenticationManager.swift index 052addc8d2a..475b19d6b43 100644 --- a/WooCommerce/Classes/Authentication/AuthenticationManager.swift +++ b/WooCommerce/Classes/Authentication/AuthenticationManager.swift @@ -360,7 +360,7 @@ private extension AuthenticationManager { func isSupportedError(_ error: Error) -> Bool { let wooAuthError = AuthenticationError.make(with: error) - return wooAuthError == .emailDoesNotMatchWPAccount || wooAuthError == .notWPSite + return wooAuthError != .unknown } func viewModel(_ error: Error) -> ULErrorViewModel? { From 43ae1405e5bc4a9eaa3da673f0cb11fbc4356757 Mon Sep 17 00:00:00 2001 From: Cesar Tardaguila <2722505+ctarda@users.noreply.github.com> Date: Tue, 8 Dec 2020 07:08:10 +0800 Subject: [PATCH 17/17] Instaintate non-mutable string --- .../Navigation Exceptions/NotWPAccountViewModel.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/WooCommerce/Classes/Authentication/Navigation Exceptions/NotWPAccountViewModel.swift b/WooCommerce/Classes/Authentication/Navigation Exceptions/NotWPAccountViewModel.swift index ad859d38260..8b7678d8f15 100644 --- a/WooCommerce/Classes/Authentication/Navigation Exceptions/NotWPAccountViewModel.swift +++ b/WooCommerce/Classes/Authentication/Navigation Exceptions/NotWPAccountViewModel.swift @@ -10,7 +10,7 @@ struct NotWPAccountViewModel: ULErrorViewModel { // MARK: - Data and configuration let image: UIImage = .loginNoWordPressError - let text: NSAttributedString = NSMutableAttributedString(string: Localization.errorMessage) + let text: NSAttributedString = .init(string: Localization.errorMessage) let isAuxiliaryButtonHidden = false