[POS as a tab i2] Update WC plugin matching to use the file name in plugin path instead of matching by full plugin path #15931
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.

For WOOMOB-899
Just one review is required.
Why
A (likely edge case) scenario was brought up when the WooComemrce plugin's plugin path can be altered by certain hosts or another plugin, like WooCommerce Beta Tester plugin as in WOOMOB-896. This means that one of the common plugin matching patterns in the app using the full plugin path wouldn't work anymore, resulting in unexpected behavior like the store not being able to access POS.
How
From a previous discussion pdfdoF-3pF-p2#comment-4655 with the web team, we concluded that matching by just the filename without extension (e.g.
*/woocommerce.*in the example of WC plugin) in the plugin path is the most durable solution so far. This PR just updates the plugin matching for the POS use case, while leaving other use cases for the Backlog.Implementation
This PR adds a new storage extension method
loadSystemPlugin(siteID:fileNameWithoutExtension:active:)to support POS plugin matching by file name without extension.The implementation uses regex pattern matching with
NSPredicateformatMATCHESfor precise filename matching to support:plugin-name.phpfolder/plugin-name.phpNSRegularExpression.escapedPattern(for:)to safely handle regex metacharacters in filenamesSteps to reproduce
Prerequisite: set up a JN store using the Woo Beta Tester plugin targeting trunk or a branch (example options screenshot in WOOMOB-896):
Testing information
Tested in iPad mini iOS 18.5 simulator with WP store credentials login.
Screenshots
RELEASE-NOTES.txtif necessary.