-
Notifications
You must be signed in to change notification settings - Fork 121
[POS as a tab i2] Move i1 eligibility checker to LegacyPOSTabEligibilityChecker with i1 only implementation
#15864
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
[POS as a tab i2] Move i1 eligibility checker to LegacyPOSTabEligibilityChecker with i1 only implementation
#15864
Conversation
|
|
…STabEligibilityCheckerI2` for i2 that still contains i1 logic.
…`POSTabEligibilityChecker` for i1.
…arated to another PR for easier review.
POSTabEligibilityChecker to i1 implementation only
POSTabEligibilityChecker to i1 implementation onlyPOSTabEligibilityChecker to i1 implementation only
joshheald
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works as expected, some minor suggestions/questions inline but nothing blocking, all up to you.
| private var siteSettingsEligibility: POSEligibilityState? | ||
| private var featureFlagEligibility: POSEligibilityState? | ||
| /// Legacy enum containing POS invisible reasons + POSIneligibleReason cases for i1. | ||
| private enum LegacyPOSIneligibleReason: Equatable { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good choice making the duplicate the legacy, for source control history purposes.
| } | ||
|
|
||
| /// POS tab eligibility checker for i1. Will be replaced by `POSTabEligibilityCheckerI2` when removing `pointOfSaleAsATabi2` feature flag. | ||
| final class POSTabEligibilityChecker: POSEntryPointEligibilityCheckerProtocol { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not the biggest problem to do it this way around, but source history for the code we keep can be (more) linear if you were to duplicate POSTabEligibilityChecker to a new LegacyPOSTabEligibilityChecker file now, and make the changes there. Then update POSTabEligibilityChecker to have the i2 rules.
The downside is that you'd need to update the callsite to use LegacyPOSTabEligibilityChecker for now.
Not a must-have – it's not as though we'll make a big problem with the history doing it this way.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was debating the two approaches, but went the other way because of the large first PR and just kept going. But great point on keeping the git history more granular if we move i1 to a separate class and make changes to i2 in POSTabEligibilityChecker. LegacyPOSTabEligibilityChecker is a better fit for i1 too since the internal enums are already named Legacy*. It wasn't a hard change, so I went with your suggestion with just moving file content without code changes:
- Copy and paste the current
POSTabEligibilityCheckerfrom this branch (i1 only, reviewed in this PR) toLegacyPOSTabEligibilityChecker. Same for the tests. - Copy and paste the
POSTabEligibilityCheckerin trunk (i1 + i2) toPOSTabEligibilityCheckerin this branch. Same for the tests. There are no diffs on these two files now. - Later in POSTabEligibilityCheckerI2: i2 logic #15865, the
POSTabEligibilityCheckerI2content (i2 only, reviewed in that PR) will be copied toPOSTabEligibilityChecker. Same for the tests.
|
|
||
| struct POSEntryPointControllerTests { | ||
| @available(iOS 17.0, *) | ||
| @Test func eligibilityState_is_set_to_eligible_when_i2_feature_is_disabled() async throws { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test is a bit confusing... why do we set it to eligible if the feature's disabled?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yea the test case name sounds confusing now that I read it a bit after implementation. This is for the behavior of directly returning eligible for POS entry point for i1 since the store already meets the eligibility check if POS tab is visible / being tapped.
I updated the name to eligibilityState_is_always_eligible_when_i2_feature_is_disabled_regardless_of_eligibility_checker in 24412fc, hopefully it's easier to read.
…ker*` for i1 implementation.
…t is separated to another PR for easier review." This reverts commit 9e611a7.
…unk. Will be modified to i2 in the next PR.
POSTabEligibilityChecker to i1 implementation onlyLegacyPOSTabEligibilityChecker with i1 only implementation
|
Thanks for the review and suggestions, Josh! I updated the PR and the description with most changes in #15864 (comment) moving content around, tested again, and I am going to merge it. |

Part 1 of WOOMOB-756
Just one review is required.
Now that the differences between POS as a tab i1 and i2 result in more code changes, I am working on a 2-part refactoring with the ultimate goal to remove cases for the tab visibility check from the POS ineligible enum in WOOMOB-756 while not affecting i1 significantly. In retrospect, I could have created a separate
POSTabEligibilityCheckerfor i1/i2 at the beginning with the tradeoff of some duplicate code. Before making more changes that touch on i1, I decided to updatePOSTabEligibilityCheckerto only contain the i2 logic, and move the i1 only logic toLegacyPOSTabEligibilityChecker. i2 only implementation will be in the next PR.To hopefully make it easier to understand the differences between i1 and i2:
This PR focuses on duplicating
POSTabEligibilityCheckertoLegacyPOSTabEligibilityChecker, then updatingLegacyPOSTabEligibilityCheckerto be just i1 implementation. Same for the unit tests.Steps to reproduce
POS tab visibility/eligibility behavior should be the same as before:
Store eligible for POS
Store in eligible country but not eligible for POS
Store not in eligible country
Testing information
RELEASE-NOTES.txtif necessary.