Skip to content

Commit 66f8e13

Browse files
authored
Merge pull request #7774 from woocommerce/fix/7758-dont-show-feature-carousel-after-onboarding
Login Prologue: feature carousel should not be shown right after onboarding
2 parents 7a8bb13 + 390a67f commit 66f8e13

File tree

7 files changed

+16
-12
lines changed

7 files changed

+16
-12
lines changed

WooCommerce/Classes/Authentication/AuthenticationManager.swift

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,12 @@ class AuthenticationManager: Authentication {
4343

4444
/// Initializes the WordPress Authenticator.
4545
///
46-
func initialize() {
46+
func initialize(loggedOutAppSettings: LoggedOutAppSettingsProtocol) {
4747
let isWPComMagicLinkPreferredToPassword = ServiceLocator.featureFlagService.isFeatureFlagEnabled(.loginMagicLinkEmphasis)
4848
let isWPComMagicLinkShownAsSecondaryActionOnPasswordScreen = ServiceLocator.featureFlagService.isFeatureFlagEnabled(.loginMagicLinkEmphasisM2)
4949
let continueWithSiteAddressFirst = ABTest.loginPrologueButtonOrder.variation == .control
50+
let isFeatureCarouselShown = ServiceLocator.featureFlagService.isFeatureFlagEnabled(.loginPrologueOnboarding) == false
51+
|| loggedOutAppSettings.hasFinishedOnboarding == true
5052
let configuration = WordPressAuthenticatorConfiguration(wpcomClientId: ApiCredentials.dotcomAppId,
5153
wpcomSecret: ApiCredentials.dotcomSecret,
5254
wpcomScheme: ApiCredentials.dotcomAuthScheme,
@@ -97,7 +99,8 @@ class AuthenticationManager: Authentication {
9799
navBarImage: StyleManager.navBarImage,
98100
navBarBadgeColor: .primary,
99101
navBarBackgroundColor: .appBar,
100-
prologueTopContainerChildViewController: LoginPrologueViewController(),
102+
prologueTopContainerChildViewController:
103+
LoginPrologueViewController(isFeatureCarouselShown: isFeatureCarouselShown),
101104
statusBarStyle: .default)
102105

103106
let displayStrings = WordPressAuthenticatorDisplayStrings(emailLoginInstructions: AuthenticationConstants.emailInstructions,

WooCommerce/Classes/Authentication/Prologue/LoginPrologueViewController.swift

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ import Experiments
88
///
99
final class LoginPrologueViewController: UIViewController {
1010
private let isNewToWooCommerceButtonShown: Bool
11-
private let isOnboardingFeatureShown: Bool
11+
/// The feature carousel is not shown right after finishing the onboarding.
12+
private let isFeatureCarouselShown: Bool
1213
private let analytics: Analytics
1314

1415
/// Background View, to be placed surrounding the bottom area.
@@ -36,10 +37,10 @@ final class LoginPrologueViewController: UIViewController {
3637
// MARK: - Overridden Methods
3738

3839
init(analytics: Analytics = ServiceLocator.analytics,
39-
loggedOutAppSettings: LoggedOutAppSettingsProtocol = LoggedOutAppSettings(userDefaults: .standard),
40+
isFeatureCarouselShown: Bool,
4041
featureFlagService: FeatureFlagService = ServiceLocator.featureFlagService) {
4142
isNewToWooCommerceButtonShown = featureFlagService.isFeatureFlagEnabled(.newToWooCommerceLinkInLoginPrologue)
42-
isOnboardingFeatureShown = featureFlagService.isFeatureFlagEnabled(.loginPrologueOnboarding) && loggedOutAppSettings.hasFinishedOnboarding == false
43+
self.isFeatureCarouselShown = isFeatureCarouselShown
4344
self.analytics = analytics
4445
super.init(nibName: nil, bundle: nil)
4546
}
@@ -91,8 +92,8 @@ private extension LoginPrologueViewController {
9192
/// This is contained in a child view so that this view's background doesn't scroll.
9293
///
9394
func setupCarousel(isNewToWooCommerceButtonShown: Bool) {
94-
let pageTypes: [LoginProloguePageType] = isOnboardingFeatureShown ? [.getStarted] : [.stats, .orderManagement, .products, .reviews]
95-
let carousel = LoginProloguePageViewController(pageTypes: pageTypes, showsSubtitle: isOnboardingFeatureShown)
95+
let pageTypes: [LoginProloguePageType] = isFeatureCarouselShown ? [.stats, .orderManagement, .products, .reviews]: [.getStarted]
96+
let carousel = LoginProloguePageViewController(pageTypes: pageTypes, showsSubtitle: !isFeatureCarouselShown)
9697
carousel.view.translatesAutoresizingMaskIntoConstraints = false
9798

9899
addChild(carousel)

WooCommerce/Classes/ServiceLocator/Authentication.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ protocol Authentication {
2828

2929
/// Initializes the WordPress Authenticator.
3030
///
31-
func initialize()
31+
func initialize(loggedOutAppSettings: LoggedOutAppSettingsProtocol)
3232

3333
/// Injects `loggedOutAppSettings`
3434
///

WooCommerce/Classes/ViewRelated/AppCoordinator.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ private extension AppCoordinator {
155155

156156
/// Configures the WPAuthenticator for usage in both logged-in and logged-out states.
157157
func configureAuthenticator() {
158-
authenticationManager.initialize()
158+
authenticationManager.initialize(loggedOutAppSettings: loggedOutAppSettings)
159159
appleIDCredentialChecker.observeLoggedInStateForAppleIDObservations()
160160
}
161161

WooCommerce/WooCommerceTests/AppCoordinatorTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ final class AppCoordinatorTests: XCTestCase {
2323
stores = MockStoresManager(sessionManager: sessionManager)
2424
storageManager = MockStorageManager()
2525
authenticationManager = AuthenticationManager()
26-
authenticationManager.initialize()
26+
authenticationManager.initialize(loggedOutAppSettings: MockLoggedOutAppSettings())
2727
}
2828

2929
override func tearDown() {

WooCommerce/WooCommerceTests/Mocks/MockAuthentication.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ final class MockAuthentication: Authentication {
2323
UIViewController()
2424
}
2525

26-
func initialize() {
26+
func initialize(loggedOutAppSettings: LoggedOutAppSettingsProtocol) {
2727
// no-op
2828
}
2929

WooCommerce/WooCommerceTests/ViewRelated/CardPresentPayments/CardPresentPaymentsModalViewControllerTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ final class CardPresentPaymentsModalViewControllerTests: XCTestCase {
55
override func setUp() {
66
super.setUp()
77
// The NUX buttons require WordPressAuthenticator to be initialized
8-
AuthenticationManager().initialize()
8+
AuthenticationManager().initialize(loggedOutAppSettings: MockLoggedOutAppSettings())
99
}
1010

1111
func test_viewcontroller_presents_top_title_provided_by_viewmodel() throws {

0 commit comments

Comments
 (0)