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

Restrict NewDot deep/universal links to specific paths on Android #6068

Merged
merged 6 commits into from
Oct 28, 2021

Conversation

Julesssss
Copy link
Contributor

@Julesssss Julesssss commented Oct 26, 2021

Details

We need to restrict universal/deep-link handling to specific, supported paths. This is because the NewDot app was intercepting every web URL to open the app, but did not handle these links gracefully. For example, the N6 inbox card should open the NewDot webpage and create a new workspace automatically. The NewDot mobile app was intercepting the link but showing erros and getting stuck at the homepage.

This already works correctly for iOS, so this PR aligns Android with iOS. Restricting deep links to specific paths fixes the above issue AND aligns NewDot with OldDot.

Part 1 of a three part issue

Later on we will probably want to intercept additional URLs and handle them within the app, but this is a lot of work and not yet necessary.

Fixed Issues

https://github.com/Expensify/Expensify/issues/179366

Tests

Run these tests on Android only

  • Install both the NewDot (build from this branch) and OldDot (any version/environment is fine) mobile apps
  • Send this text as an email to yourself (ideally using Gmail)
https://expensify.com > open browser
https://expensify.com/inbox > open OldDot app
https://expensify.com/anUnhandledPath > open browser

https://new.expensify.com > open browser
https://new.expensify.com/settings > open NewDot app
https://new.expensify.com/anUnhandledPath > open browser
  • On mobile, open the email and tap the links, one by one
  • Each link should open the app or browser (this is attached to each link)
  • You might see the 'Which app would you like to open' prompt, which is a special case:
    • If the desired outcome is 'open browser' and you have the option to open in app, this is a fail
    • If the desired outcome is 'NewDot / OldDot app' and you have the option to open in both apps, this is a fail
    • If the desired outcome is 'NewDot / OldDot app' and you have the option to open in app or browser, this is a success

Android
https://user-images.githubusercontent.com/10736861/139106960-22338e5e-f870-4eb7-83b6-6c54db7b3f2a.mp4

iOS
https://user-images.githubusercontent.com/10736861/139107214-69d91793-30a1-4b51-ae48-f4e2bf329636.mp4

QA Steps

Run the test steps listed above

Tested On

  • Web
  • Mobile Web
  • Desktop
  • iOS
  • Android

Screenshots

Web

Mobile Web

Screenshot 2021-10-27 at 17 26 54

Desktop

Screenshot 2021-10-27 at 17 23 57

iOS

^ see screencast in issue description

Android

^ see screencast in issue description

@Julesssss Julesssss self-assigned this Oct 26, 2021
@Julesssss Julesssss changed the title Restrict NewDot deep/universal links to specific paths Restrict NewDot deep/universal links to specific paths on Android Oct 27, 2021
@Julesssss Julesssss requested a review from a team October 27, 2021 16:38
@Julesssss Julesssss marked this pull request as ready for review October 27, 2021 16:38
@MelvinBot MelvinBot requested review from Jag96 and removed request for a team October 27, 2021 16:38
Comment on lines -47 to -51
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.BROWSABLE"/>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We only need one intent filter for each scheme.

Copy link
Contributor

@Jag96 Jag96 left a comment

Choose a reason for hiding this comment

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

Looking good, just one question about the setpassword path

<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>

<!-- Custom URI handlers. Used to intercept Urban Airship deep links. -->
Copy link
Contributor

Choose a reason for hiding this comment

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

I was wondering if we could remove the expensify-cash scheme here, but looks like that's going to be handled in https://github.com/Expensify/Expensify/issues/176081 👍

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah good spot. I was going to do this separately. Thanks for the existing issue link!

android/app/src/main/AndroidManifest.xml Outdated Show resolved Hide resolved
@Julesssss Julesssss requested a review from a team as a code owner October 28, 2021 10:15
@MelvinBot MelvinBot requested review from TomatoToaster and removed request for a team October 28, 2021 10:15
@Julesssss Julesssss force-pushed the jules-makeDeepLinksSpecific branch from 6f0e1a2 to 6adaff3 Compare October 28, 2021 10:20
Copy link
Contributor

@TomatoToaster TomatoToaster left a comment

Choose a reason for hiding this comment

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

This LGTM, but how is this working for iOS is you're only changing AndroidManifest.xml?

@Julesssss
Copy link
Contributor Author

@TomatoToaster I should have made this clearer, but iOS was already restricting the universal links which can open the app.

@TomatoToaster TomatoToaster merged commit 4525a24 into main Oct 28, 2021
@TomatoToaster TomatoToaster deleted the jules-makeDeepLinksSpecific branch October 28, 2021 15:31
@TomatoToaster
Copy link
Contributor

Sorry I saw the iOS but just now read Run these tests on Android only Merged!

@OSBotify
Copy link
Contributor

✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release.

@OSBotify
Copy link
Contributor

🚀 Deployed to staging by @TomatoToaster in version: 1.1.10-3 🚀

platform result
🤖 android 🤖 success ✅
🖥 desktop 🖥 success ✅
🍎 iOS 🍎 failure ❌
🕸 web 🕸 success ✅

@mvtglobally
Copy link

@Julesssss @Jag96 @TomatoToaster Should we QA this on Android only or across all platforms? Description in test steps is referring to Android only.

@Julesssss
Copy link
Contributor Author

Hi @mvtglobally, this only needs to be tested on Android. We have some follow-up PRs that will ensure the other platforms are tested.

@OSBotify
Copy link
Contributor

🚀 Deployed to production by @roryabraham in version: 1.1.11-1 🚀

platform result
🤖 android 🤖 success ✅
🖥 desktop 🖥 success ✅
🍎 iOS 🍎 success ✅
🕸 web 🕸 success ✅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants