-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Fix WP.com post deeplink not opening in app #20304
Conversation
You can test the changes in Jetpack from this Pull Request by:
|
You can test the changes in WordPress from this Pull Request by:
|
Environment 1: Both apps are installed@dvdchr I've tested all cases and most of them worked as expected. The 4th case however, didn't open the Jetpack app, nor WordPress. Instead, it just opened Safari with a page saying that I don't have access to read that post. This is definitely not issue but it's not the expected behavior mentioned in the table. Environment 2: Only one app installedI deleted Jetpack and kept WordPress. Tested all cases and everything worked as expected. But the 4th case behaved the same way as in Environment 1. Although the 4th case didn't open Jetpack or WordPress, I guess that should be fine. LGTM! 🚀 Update Turns out the 4th case behaved that way because tampermonkey interfered with the post link. @dvdchr DMed me another link and the case worked as expected. |
Yep. Turns out the original P2 link got automatically shorthanded by the extension. I've now updated the URL in case no. 4. Thanks @salimbraksa! |
I haven't tested this PR after changing the base branch from Merging to get the hotfix shipped. |
Fixes #20293
Refs #20213, p1678384048655429-slack-C011BKNU1V5, p1678278001563359-slack-C0180B5PRJ4
This fixes an issue where post links with subdomain hosts (i.e.,
*.wordpress.com
) no longer open in the app after #20213 is merged. This is due to thecanHandle
method inUniversalLinkRouter
checking if the host is exactlywordpress.com
orjetpack.com
:WordPress-iOS/WordPress/Classes/Utility/Universal Links/UniversalLinkRouter.swift
Lines 132 to 135 in 28ebe98
To prevent further side effects, the issue is fixed by avoiding the usage of
canHandle
, thus bringing the logic closer to before #20213 is merged while still solving the original issue.To Test
This will be using a similar test scenario from #20213, but with an added test case for better coverage.
Note that the recommended way is to compile the app under test to your device, and have the counterpart app installed from TestFlight or AppStore. If you wish to fully test from the simulator, I'd recommend temporarily modifying these values in
UIApplication+AppAvailability
:wordpress://
->wpdebug://
jetpack://
->jpdebug://
WordPress-iOS/WordPress/Classes/Extensions/UIApplication+AppAvailability.swift
Lines 3 to 7 in 28ebe98
And don't forget to also compile both apps to the Simulator when testing for Environment 1 below.
Environment 1: Both apps are installed
wordpress.com/post/:siteURL/:postID
)wordpress.com/post/:siteID/:postID
)*.wordpress.com
link that leads to a private site with insufficient access, e.g. https://dvcyp2general.wordpress.com/2023/03/10/looking-back-at-wordpress/*.wordpress.com
link that you have read access to, e.g. https://dvdchrtest.wordpress.com/2023/03/10/hello-wordpress/wordpress.com
deeplink route, e.g.: https://wordpress.com/mewordpress.com
deeplink route, e.g.: https://wordpress.com/read/feeds/000000Environment 2: Only one app installed
/post/:siteURL/:postID
)/post/:siteID/:postID
)*.wordpress.com
link that leads to a private site with insufficient access, e.g. https://dvcyp2general.wordpress.com/2023/03/10/looking-back-at-wordpress/*.wordpress.com
link that you have read access to, e.g. https://dvdchrtest.wordpress.com/2023/03/10/hello-wordpress/wordpress.com
deeplink route, for example: https://wordpress.com/mewordpress.com
deeplink route, e.g.: https://wordpress.com/read/feeds/000000Regression Notes
Potential unintended areas of impact
Should be none. The implementation is now closer to before Fix: Do not bounce to Safari when both apps are installed #20213 is implemented.
What I did to test those areas of impact (or what existing automated tests I relied on)
Manually tested various deeplink scenarios.
What automated tests I added (or what prevented me from doing so)
N/A.
PR submission checklist:
RELEASE-NOTES.txt
if necessary.Footnotes
This depends on how the error is handled on the specific route. But the key point here is that the infinite redirect between WP and JP should no longer be happening. ↩ ↩2