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

fix(android): set initial notification for quick actions #605

Merged
merged 1 commit into from Dec 9, 2022

Conversation

haisamMH
Copy link
Contributor

@haisamMH haisamMH commented Dec 5, 2022

Hi, I have noticed I don't get any press actions on the initial notification event, after some debugging with LogCat I found handleNotificationPressIntent doesn't have InitialNotificationEvent.

tested version "@notifee/react-native": "^7.1.0"

…onIntent to get initial notification actions
@CLAassistant
Copy link

CLAassistant commented Dec 5, 2022

CLA assistant check
All committers have signed the CLA.

@helenaford
Copy link
Member

Hi, I'm not sure if I follow. Please can you explain why this is needed, with some code snippets?

@izakfilmalter
Copy link

izakfilmalter commented Dec 7, 2022

@helenaford I was having an issue that this solved for me.

  1. App is closed and receives a notification type notification.
  2. await notifee.getInitialNotification() returns undefined without the changes in this pr.

I pulled @Hysham's branch, built it, copied it over, and did the following patch:

diff --git a/node_modules/@notifee/react-native/android/libs/app/notifee/core/.DS_Store b/node_modules/@notifee/react-native/android/libs/app/notifee/core/.DS_Store
new file mode 100644
index 0000000..2d92b36
Binary files /dev/null and b/node_modules/@notifee/react-native/android/libs/app/notifee/core/.DS_Store differ
diff --git a/node_modules/@notifee/react-native/android/libs/app/notifee/core/202108261754/core-202108261754.aar b/node_modules/@notifee/react-native/android/libs/app/notifee/core/202108261754/core-202108261754.aar
index 9f13d46..a1eb12c 100644
Binary files a/node_modules/@notifee/react-native/android/libs/app/notifee/core/202108261754/core-202108261754.aar and b/node_modules/@notifee/react-native/android/libs/app/notifee/core/202108261754/core-202108261754.aar differ
diff --git a/node_modules/@notifee/react-native/android/libs/app/notifee/core/202108261754/core-202108261754.aar.md5 b/node_modules/@notifee/react-native/android/libs/app/notifee/core/202108261754/core-202108261754.aar.md5
index 51d7032..e38e60f 100644
--- a/node_modules/@notifee/react-native/android/libs/app/notifee/core/202108261754/core-202108261754.aar.md5
+++ b/node_modules/@notifee/react-native/android/libs/app/notifee/core/202108261754/core-202108261754.aar.md5
@@ -1 +1 @@
-ddf6dbeb6a31d1f2c7e5ffacd890af67
\ No newline at end of file
+15e985decf47e51739921a7778a654bf
\ No newline at end of file
diff --git a/node_modules/@notifee/react-native/android/libs/app/notifee/core/202108261754/core-202108261754.aar.sha1 b/node_modules/@notifee/react-native/android/libs/app/notifee/core/202108261754/core-202108261754.aar.sha1
index 31874c1..614a473 100644
--- a/node_modules/@notifee/react-native/android/libs/app/notifee/core/202108261754/core-202108261754.aar.sha1
+++ b/node_modules/@notifee/react-native/android/libs/app/notifee/core/202108261754/core-202108261754.aar.sha1
@@ -1 +1 @@
-4acdd2f0404da1bb5583a5aa9bad531f8e3e37b7
\ No newline at end of file
+e93ddca2d7d3f0acc1f37439b1f73257b0c5323a
\ No newline at end of file
diff --git a/node_modules/@notifee/react-native/android/libs/app/notifee/core/202108261754/core-202108261754.aar.sha256 b/node_modules/@notifee/react-native/android/libs/app/notifee/core/202108261754/core-202108261754.aar.sha256
index edf6504..babe991 100644
--- a/node_modules/@notifee/react-native/android/libs/app/notifee/core/202108261754/core-202108261754.aar.sha256
+++ b/node_modules/@notifee/react-native/android/libs/app/notifee/core/202108261754/core-202108261754.aar.sha256
@@ -1 +1 @@
-e9c6ca090ac7aed4404e8d05c54cc720d30f5111256aba3dab89a608302ebef9
\ No newline at end of file
+0ab9331b71fc89ddd04c2cc500834de5cf3968c44522b8415839d94f76974240
\ No newline at end of file
diff --git a/node_modules/@notifee/react-native/android/libs/app/notifee/core/202108261754/core-202108261754.aar.sha512 b/node_modules/@notifee/react-native/android/libs/app/notifee/core/202108261754/core-202108261754.aar.sha512
index db58138..c2a6653 100644
--- a/node_modules/@notifee/react-native/android/libs/app/notifee/core/202108261754/core-202108261754.aar.sha512
+++ b/node_modules/@notifee/react-native/android/libs/app/notifee/core/202108261754/core-202108261754.aar.sha512
@@ -1 +1 @@
-789603e1af8a65bb29a8f8839a0f49962c65b595953dea4aece9bd29bf3ac60b2fa466d1a3d04effafb77136e7f999dcb828d38b0fbc689e0613385b359ffb18
\ No newline at end of file
+bb8d1c9ab043610a6d5b8863a851de40b4fe756fec613b903524bc612601ba67ac234689b08dda08e151379deed46d12cf7eb710706d1c27f3686706dcd49ca8
\ No newline at end of file
diff --git a/node_modules/@notifee/react-native/android/libs/app/notifee/core/maven-metadata.xml b/node_modules/@notifee/react-native/android/libs/app/notifee/core/maven-metadata.xml
index 34f1fb1..78a20ab 100644
--- a/node_modules/@notifee/react-native/android/libs/app/notifee/core/maven-metadata.xml
+++ b/node_modules/@notifee/react-native/android/libs/app/notifee/core/maven-metadata.xml
@@ -8,6 +8,6 @@
     <versions>
       <version>202108261754</version>
     </versions>
-    <lastUpdated>20221205105912</lastUpdated>
+    <lastUpdated>20221207193818</lastUpdated>
   </versioning>
 </metadata>
diff --git a/node_modules/@notifee/react-native/android/libs/app/notifee/core/maven-metadata.xml.md5 b/node_modules/@notifee/react-native/android/libs/app/notifee/core/maven-metadata.xml.md5
index ef7792f..e226849 100644
--- a/node_modules/@notifee/react-native/android/libs/app/notifee/core/maven-metadata.xml.md5
+++ b/node_modules/@notifee/react-native/android/libs/app/notifee/core/maven-metadata.xml.md5
@@ -1 +1 @@
-d9af808cf47da2d86ecb58bb99a3bfa4
\ No newline at end of file
+358357b697e1f0fe2dfa3d52b27c8dfb
\ No newline at end of file
diff --git a/node_modules/@notifee/react-native/android/libs/app/notifee/core/maven-metadata.xml.sha1 b/node_modules/@notifee/react-native/android/libs/app/notifee/core/maven-metadata.xml.sha1
index 86813f9..4073edb 100644
--- a/node_modules/@notifee/react-native/android/libs/app/notifee/core/maven-metadata.xml.sha1
+++ b/node_modules/@notifee/react-native/android/libs/app/notifee/core/maven-metadata.xml.sha1
@@ -1 +1 @@
-7bf2aba0c25438a3d4782cbf46a7f776fd032c8d
\ No newline at end of file
+5d74a3ded6f437826cb1c757a4c0f82de398f95a
\ No newline at end of file
diff --git a/node_modules/@notifee/react-native/android/libs/app/notifee/core/maven-metadata.xml.sha256 b/node_modules/@notifee/react-native/android/libs/app/notifee/core/maven-metadata.xml.sha256
index c7259e2..abe21ca 100644
--- a/node_modules/@notifee/react-native/android/libs/app/notifee/core/maven-metadata.xml.sha256
+++ b/node_modules/@notifee/react-native/android/libs/app/notifee/core/maven-metadata.xml.sha256
@@ -1 +1 @@
-38233839425b0bf2f6e80610c4da3b1f5651a81189f6b326ea44692dfb3ab353
\ No newline at end of file
+b4b1c067a6d9e67cbd35ff53e16072e48d61eab923d6f3fd6b63e8f01921dadb
\ No newline at end of file
diff --git a/node_modules/@notifee/react-native/android/libs/app/notifee/core/maven-metadata.xml.sha512 b/node_modules/@notifee/react-native/android/libs/app/notifee/core/maven-metadata.xml.sha512
index bd819e2..f037a6b 100644
--- a/node_modules/@notifee/react-native/android/libs/app/notifee/core/maven-metadata.xml.sha512
+++ b/node_modules/@notifee/react-native/android/libs/app/notifee/core/maven-metadata.xml.sha512
@@ -1 +1 @@
-c89e1c178d95d8b8734422af3cd068388a5f3cdf39bd8b4f219bd1e7f20779a17478a0d8ca4f866425d3211c6e9165c6215ea454b05b7c226f322e6d30d02bfc
\ No newline at end of file
+fdcc7a46c68a7e824f427958d7881e8d2b5ae349d2650024e7fbd281f75875077cdd23d9f10cfa6357f60757a1ea2b898e2fa392ee1608c3802d3d146788b872
\ No newline at end of file

After building again, await notifee.getInitialNotification() returns the notification when you open the app.

This seems to work for both notification type notifications from firebase and await notifee.displayNotification while the app is in the background or focused.

@helenaford helenaford changed the title initial notification event should be called in handleNotificationActionIntent fix(android): set initial notification for quick actions Dec 9, 2022
@helenaford
Copy link
Member

thanks! ah so i think this is for quick actions right?

@codecov
Copy link

codecov bot commented Dec 9, 2022

Codecov Report

Merging #605 (6fe027a) into main (6dfc923) will not change coverage.
The diff coverage is n/a.

@@           Coverage Diff           @@
##             main     #605   +/-   ##
=======================================
  Coverage   77.24%   77.24%           
=======================================
  Files          34       34           
  Lines        1700     1700           
  Branches      546      546           
=======================================
  Hits         1313     1313           
  Misses        386      386           
  Partials        1        1           

@helenaford helenaford merged commit af61949 into invertase:main Dec 9, 2022
@helenaford
Copy link
Member

@Hysham thanks for the contribution. will release shortly

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

Successfully merging this pull request may close these issues.

None yet

4 participants