Trigger Migration Flow when launching the app from deep links - #17742
Conversation
When the app is opened from a deep link, the deep link data is passed through the migration flow so at the end of the flow we can navigate to the screen specified in the deep link.
…17653-jp-migration-web-links # Conflicts: # WordPress/src/main/java/org/wordpress/android/ui/main/WPMainActivity.java # WordPress/src/main/java/org/wordpress/android/ui/main/jetpack/migration/JetpackMigrationFragment.kt # WordPress/src/main/java/org/wordpress/android/ui/main/jetpack/migration/JetpackMigrationViewModel.kt
Simplified the logic to handle deep link opening after the migration flow is completed by relying only on the deep link data class
This fix was required to make sure the notifications permission dialog is presented when launching the migration flow from a deep link, similar to the default behavior when the app is normally started.
# Conflicts: # WordPress/src/main/java/org/wordpress/android/ui/main/jetpack/migration/JetpackMigrationActivity.kt # WordPress/src/main/java/org/wordpress/android/ui/main/jetpack/migration/JetpackMigrationFragment.kt # WordPress/src/main/java/org/wordpress/android/ui/main/jetpack/migration/JetpackMigrationViewModel.kt
This change ensures the WordPress app compatibility is tracked
|
|||||||||||
| 💡 Scan this QR code with your Android phone to download and install the APK directly on it. | ||
| App | Jetpack | |
| Build Flavor | Jalapeno | |
| Build Type | Debug | |
| Commit | f23ac99 | |
|
|||||||||||
| 💡 Scan this QR code with your Android phone to download and install the APK directly on it. | ||
| App | WordPress | |
| Build Flavor | Jalapeno | |
| Build Type | Debug | |
| Commit | f23ac99 | |
|
@ovitrif - I am stuck on the first test because neither app has been verified to handle web links, so the link opens with the browser. I can manually assign Jetpack or WP as the default handler for verified web links, but not both. I found the best way to test the seamless redirect scenarios was to create release versions of each app, not sure that is an option here. In addition I didn't see a link in your test html for the following type of links. Coming into WP from a link like this will launch the Open Links with Jetpack overlay. |
Thank you for your remarks @zwarm 👍 While testing using Android Studio debug builds locally I could open the links in the app if using a physical device. This didn't work in the emulator for me as well. I also tested now with the pre-alpha builds (WordPress & Jetpack from the PR. I was thinking if perhaps the issue you're encountering is because the Browser is set to open such links by default on your device, but it seems to still be possible to open the links with the apps on my device even if that's enabled:
Thank you for informing me to add such links 🙇 , I'll add this tomorrow to the testing HTML and add/change a test to use such links 👍. |
I am using a physical device (Pixel 5 running Android 13.). I had to go into the app setting for WP and set the verified links manually, but then JP doesn't open them by default. Which app should be the default handler for the above tests? When using release builds, both apps will handle the links; however it the most recently installed app that will actually launch.
I am not prompted with the disambiguation dialog; I go straight to the browser. FYI: The link I shared has a different receiver and is handled in Here are the steps I took for the 1st test |
Thank you for the additional info! That means there should be logic to trigger the migration also from
Thanks, I'll test this flow and share my findings 👍
The handler should be the app that is mentioned, in the case of the first test, Jetpack app. In any case if this proves to be an issue for testing, I'll adapt the steps according to what would be the better option:
|
@zwarm In my tests following this steps opened the migration flow 🤷 . Anyways I've updated the testing instructions with steps to set which app to handle verified links and went through all testing scenarios with the |
UpdateAs discussed with @mkevins although the PR seems ready, the plan is to:
This way we avoid introducing unexpected cases where users could migrate to the Jetpack App via a |
Migration can be re-enabled after logging out by either deleting the app, or clearing app data.
This change was needed to fix the issues where
|
Thanks for these updates Ovi 👍 . Since conflicts have arisen, I created a new branch with a rebase of this branch (which resolves the conflicts, and also splits out the ❌ These tests were performed on a Pixel 3a (physical device) with preconditionsWordPress app settings were changed:
1. ✅ Jetpack App: Complete migration flow from
|
@mkevins 👋 Thank you for preparing a better version history for these changes and for your effort to validate the PR over the latest updates on
Good thing we're retesting this together with language migration, as now even more things are coming together and it was expectable there might be a chance some of the fixes that were tested individually will need adjustments to integrate correctly with the others.
I agree, 5️⃣ should definitely be improved! I hope I'll have time this afternoon to re-test and investigate what causes the unexpected behavior 👍. Thanks a lot for the detailed reporting, it's definitely great to be able to narrow down the scope of the investigation already thanks to your work 🥇 |
Since the blogging reminders migration were standardised, the prefs flag marking if syncing was attempted should be reset in order to enable resuming the flow after force-closing the app, just like it's done for all the other data migration flags.
0ceead3 to
ef7467c
Compare
|
@mkevins Thank you for all the help! I've tested your rebase branch and the same test cases failed for me as well. After looking into what's working unexpected, I found a few incompatibilities with newer changes on
Both fixes address issues that I suspect to reproduce on I also added an intent of type |
This reverts commit f8378e7.
Generated by 🚫 dangerJS |
mkevins
left a comment
There was a problem hiding this comment.
After looking into what's working unexpected, I found a few incompatibilities with newer changes on trunk and proceeded to adjust that code. The following changes fixed the failing test cases for me
Awesome!! Great work tracking down the source of the issues and restoring the behavior to it's working state! The code looks good, and all tests (including the most recent one with the intent link) are testing very well for me.
I tested the following on a Pixel 3a (physical device):
1. ✅ Jetpack App: Complete migration flow from web link
2. ✅ Jetpack App: Complete migration flow from deep link
3. ✅ Jetpack App: Complete migration flow from post link
4. ✅ Jetpack App: Interrupt and resume migration from web link
5. ✅ Jetpack App: Force close migration from web link and restart
6. ✅ Jetpack App: Exit migration and login from web link
- Prerequisite: WordPress app installed and logged in (should be the case)
- 🆕 Clear Jetpack app data
- ☑️ Set Jetpack app to handle verified links (should be the case)
↗️ OpenNotificationsweb link- Expect to see migration flow
- On the migration screen navigate back
- Expect to see login screen
- Login
- Expect to land on the
My Sitescreen - Verify that your data is not migrated (if you used the same account from WP app)
I landed on the notifications screen after login. I think this is a feature, though, and not a bug. 👍
7. ✅ Jetpack App: Open from web link without migration
8. ✅ WordPress App: Open web link in WordPress app then Jetpack via Open links in Jetpack
9. ✅ Regression: Jetpack App migration not eligible with Local Draft Content
10. ✅ Perform step 1, but with the Jetpack Home link instead
As a bonus, I also tested these scenarios with the WordPress app having a different "per-app" language setting and theme from the OS default, and everything works as expected with those conditions as well 🎉 .
Note: I pushed one single revert (f23ac99), since also was intentionally used (instead of let). The reason is that this way, if the return type of ActivityLauncher.openDeepLinkAfterJPMigration is ever changed to an optional, it will not result evaluation of the RHS of the elvis operator (whereas with let it could, e.g. if the block evaluates to null).
Thanks for all your effort in writing the test scenarios, performing them, and working to find a solution to the issues after the merge!



Fixes #17653
This PR implements the logic to:
To Test
Prerequisites & Setup
🆕 How to clear app data?
App InfoStorage/Storage & cache(whichever presented)Clear data/Clear storage(whichever presented)☑️ How to set app to handle verified links?
App InfoOpen by default+ Add linkAdd1. Jetpack App: Complete migration flow from
web linkwordpressWasabiDebug)Statsweb linkStatsscreen2. Jetpack App: Complete migration flow from
deep linkJetpack Readerdeep link with Jetpack app (just once)Readerscreen3. Jetpack App: Complete migration flow from
post linkPostweb linkReaderscreen with the postPost deep link testopen4. Jetpack App: Interrupt and resume migration from
web linkNotificationsweb linkdark modePut the Jetpack app in background and bring it back to foreground(skip this step)continuedark themeNotificationsscreen5. Jetpack App: Force close migration from
web linkand restartStatsweb linkMy SitescreenNote: Even though it could be an option to land on the screen from the web link (
Stats), this wouldn't be ideal because users could open the Jetpack app after a long time.6. Jetpack App: Exit migration and login from
web linkNotificationsweb linkMy Sitescreen7. Jetpack App: Open from
web linkwithout migrationStatsweb linkStatsscreen8. WordPress App: Open
web linkin WordPress app then Jetpack viaOpen links in JetpackNotificationsweb linkOpen links in Jetpack?screenOpen links in JetpackNotificationsscreen9. Regression: Jetpack App migration not eligible with Local Draft Content
Postsbackfrom the editor to save the post as local draftEventually think of other regression testing scenarios that could occur during the migration flow and when opening the app from deep links and test them.
Regression Notes
Potential unintended areas of impact
Migration flow & deep link flows.
What I did to test those areas of impact (or what existing automated tests I relied on)
Manual testing & relied on existing migration and deep links tests.
What automated tests I added (or what prevented me from doing so)
Added test for the updated logic in
JetpackAppMigrationFlowUtilsTest.PR submission checklist:
RELEASE-NOTES.txtif necessary.