amplify-js icon indicating copy to clipboard operation
amplify-js copied to clipboard

Pass deeplink URL from pinpoint to killed react-native app

Open isnifer opened this issue 2 years ago • 3 comments

Description of changes

This PR brings deeplink information to Intent that opens application from notification. Existing intent configuration just doing plain application opening, my PR pass information about deeplink to it. After this change Linking.getInitialURL() started to get this initialURL and user is available to use this information on JS side.

Issue #, if available

This PR closes (already closed, but not resolved) issue #1849

Description of how you validated changes

  1. Configure notifications for your app via pinpoint + amplify
  2. write const initialURL = await Linking.getInitialURL() somewhere in your app where you're handling deep linking and log it to console for example
  3. "Kill" the app
  4. Send notification to the app
  5. Tap on your notification
  6. Watch to your terminal where console.log will prove the change

Checklist

  • [x] PR description included
  • [ ] yarn test passes
  • [ ] Tests are changed or added
  • [ ] Relevant documentation is changed or added (and PR referenced)

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

isnifer avatar May 30 '22 14:05 isnifer

After my success I have found that aws-sdk-android repo has almost the same code — https://github.com/aws-amplify/aws-sdk-android/blob/e5b43ab848bc304c452324772af4310c3b0cb972/aws-android-sdk-pinpoint/src/main/java/com/amazonaws/mobileconnectors/pinpoint/targeting/notification/NotificationClientBase.java#L812-L813

isnifer avatar May 30 '22 15:05 isnifer

Hi @isnifer we recently had to make changes to the push notifications packages to address some issues with Android 12. As a result, your PR will need to be updated as the changes reside in a broadcast receiver that notifications now basically ignore due to Notification trampoline restrictions. Do you think you can adapt your changes so that they can go into the RNPushNotificationHelper instead?

cshfang avatar Feb 01 '23 00:02 cshfang

@cshfang I'll rebase my branch. Hope, it won't take 8 months

isnifer avatar Feb 01 '23 07:02 isnifer