Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Woo POS] Hide POS mode for ineligible users #12641

Merged
merged 8 commits into from
Sep 20, 2024

Conversation

samiuelson
Copy link
Collaborator

@samiuelson samiuelson commented Sep 18, 2024

Closes: #12189

Description

This PR:

  1. Adds the woo_pos remote feature flag
  2. Removes woo_pos local feature flag
  3. Switches to using the remote feature flag for gating users to the POS entry point in the "More menu" screen

Steps to reproduce

  • In debug build variant verify that the "Point of Sale Mode" button is visible without any difference.
  • In release build though the "Point of Sale Mode" button should be visible only for the allow-listed emails (e.g. @automattic.com emails).

Testing information

The tests that have been performed

Device: Samsung Galaxy Tab S9, Android 14

  1. I tested that "Point of Sale Mode" button is visible without any difference in a debug build variant.
  2. I verified that the button is visible for the @automattic.com account in a release build.
  3. I verified that the button is not for the [email protected] account in a release build.
  • I have considered if this change warrants release notes and have added them to RELEASE-NOTES.txt if necessary. Use the "[Internal]" label for non-user-facing changes.

Reviewer (or Author, in the case of optional code reviews):

Please make sure these conditions are met before approving the PR, or request changes if the PR needs improvement:

  • The PR is small and has a clear, single focus, or a valid explanation is provided in the description. If needed, please request to split it into smaller PRs.
  • Ensure Adequate Unit Test Coverage: The changes are reasonably covered by unit tests or an explanation is provided in the PR description.
  • Manual Testing: The author listed all the tests they ran, including smoke tests when needed (e.g., for refactorings). The reviewer confirmed that the PR works as expected on big (tablet) and small (phone) in case of UI changes, and no regressions are added.

@samiuelson samiuelson linked an issue Sep 18, 2024 that may be closed by this pull request
@wpmobilebot
Copy link
Collaborator

wpmobilebot commented Sep 18, 2024

📲 You can test the changes from this Pull Request in WooCommerce-Wear Android by scanning the QR code below to install the corresponding build.
App Name WooCommerce-Wear Android
Platform⌚️ Wear OS
FlavorJalapeno
Build TypeDebug
Commit0e8113a
Direct Downloadwoocommerce-wear-prototype-build-pr12641-0e8113a.apk

@wpmobilebot
Copy link
Collaborator

wpmobilebot commented Sep 19, 2024

📲 You can test the changes from this Pull Request in WooCommerce Android by scanning the QR code below to install the corresponding build.

App Name WooCommerce Android
Platform📱 Mobile
FlavorJalapeno
Build TypeDebug
Commit0e8113a
Direct Downloadwoocommerce-prototype-build-pr12641-0e8113a.apk

@codecov-commenter
Copy link

codecov-commenter commented Sep 19, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 40.64%. Comparing base (39e1aea) to head (0e8113a).
Report is 43 commits behind head on trunk.

Additional details and impacted files
@@            Coverage Diff            @@
##              trunk   #12641   +/-   ##
=========================================
  Coverage     40.63%   40.64%           
- Complexity     5674     5675    +1     
=========================================
  Files          1230     1229    -1     
  Lines         69166    69162    -4     
  Branches       9579     9578    -1     
=========================================
+ Hits          28105    28110    +5     
+ Misses        38476    38468    -8     
+ Partials       2585     2584    -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@samiuelson samiuelson changed the title [Woo POS] 12189 woo pos m2 hide pos mode for ineligible users [Woo POS] Hide pos mode for ineligible users Sep 19, 2024
@samiuelson samiuelson changed the title [Woo POS] Hide pos mode for ineligible users [Woo POS] Hide POS mode for ineligible users Sep 19, 2024
@samiuelson samiuelson marked this pull request as ready for review September 19, 2024 16:06
@samiuelson samiuelson added this to the 20.6 milestone Sep 19, 2024
@kidinov kidinov self-assigned this Sep 20, 2024
} else {
initialState[MoreMenuItemButton.Type.WooPos] = MoreMenuItemButton.State.Hidden
}
flows += doCheckAvailability(MoreMenuItemButton.Type.WooPos) { isWooPosEnabled() }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That plus thing was here only because of the local FF, now we can simplify this:

    private fun checkFeaturesAvailability(): Flow<Map<MoreMenuItemButton.Type, MoreMenuItemButton.State>> {
        val initialState = MoreMenuItemButton.Type.entries.associateWith { MoreMenuItemButton.State.Loading }
            .toMutableMap()

        return listOf(
            doCheckAvailability(MoreMenuItemButton.Type.Blaze) { isBlazeEnabled() },
            doCheckAvailability(MoreMenuItemButton.Type.GoogleForWoo) { isGoogleForWooEnabled() },
            doCheckAvailability(MoreMenuItemButton.Type.Inbox) { moreMenuRepository.isInboxEnabled() },
            doCheckAvailability(MoreMenuItemButton.Type.Settings) { moreMenuRepository.isUpgradesEnabled() },
            doCheckAvailability(MoreMenuItemButton.Type.WooPos) { isWooPosEnabled() },
        ).merge()
            .map { update ->
                initialState[update.first] = update.second
                initialState
            }
            .onStart { emit(initialState) }
    }

@kidinov kidinov self-requested a review September 20, 2024 10:12
Copy link
Contributor

@kidinov kidinov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@samiuelson samiuelson merged commit d6c8879 into trunk Sep 20, 2024
15 checks passed
@samiuelson samiuelson deleted the 12189-woo-pos-m2-hide-pos-mode-for-ineligible-users branch September 20, 2024 10:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Woo POS] M2: Hide POS Mode for ineligible users
4 participants