amplify-js
amplify-js copied to clipboard
Pass deeplink URL from pinpoint to killed react-native app
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
- Configure notifications for your app via
pinpoint
+amplify
- write
const initialURL = await Linking.getInitialURL()
somewhere in your app where you're handling deep linking and log it toconsole
for example - "Kill" the app
- Send notification to the app
- Tap on your notification
- 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.
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
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 I'll rebase my branch. Hope, it won't take 8 months