expo-notifications 0.15.3 → 0.15.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -10,6 +10,10 @@
10
10
 
11
11
  ### 💡 Others
12
12
 
13
+ ## 0.15.4 — 2022-06-27
14
+
15
+ _This version does not introduce any user-facing changes._
16
+
13
17
  ## 0.15.3 — 2022-06-17
14
18
 
15
19
  ### 🐛 Bug fixes
@@ -18,6 +22,7 @@
18
22
  - Fixed Android data-only FCM notifications (i.e. notifications without a title and message) appearing in the notification drawer ([#17707](https://github.com/expo/expo/pull/17707) by [@sausti](https://github.com/sausti))
19
23
  - Add support for unregistering from push notifications on Android and iOS ([#17812](https://github.com/expo/expo/pull/17812) by [@sausti](https://github.com/sausti))
20
24
  - Fix another Android 12+ trampoline issue from push notifications. ([#17871](https://github.com/expo/expo/pull/17871) by [@kudo](https://github.com/kudo))
25
+ - Fixed `useLastNotificationResponse` returns latest received notification but not the clicked notification on Android. ([#17974](https://github.com/expo/expo/pull/17974) by [@kudo](https://github.com/kudo))
21
26
 
22
27
  ## 0.15.2 — 2022-05-05
23
28
 
@@ -3,7 +3,7 @@ apply plugin: 'kotlin-android'
3
3
  apply plugin: 'maven-publish'
4
4
 
5
5
  group = 'host.exp.exponent'
6
- version = '0.15.3'
6
+ version = '0.15.4'
7
7
 
8
8
  buildscript {
9
9
  def expoModulesCorePlugin = new File(project(":expo-modules-core").projectDir.absolutePath, "ExpoModulesCorePlugin.gradle")
@@ -74,7 +74,7 @@ android {
74
74
  minSdkVersion safeExtGet("minSdkVersion", 21)
75
75
  targetSdkVersion safeExtGet("targetSdkVersion", 31)
76
76
  versionCode 21
77
- versionName '0.15.3'
77
+ versionName '0.15.4'
78
78
  }
79
79
 
80
80
  lintOptions {
@@ -34,6 +34,7 @@
34
34
  android:excludeFromRecents="true"
35
35
  android:noHistory="true"
36
36
  android:launchMode="standard"
37
+ android:taskAffinity=""
37
38
  />
38
39
  </application>
39
40
  </manifest>
@@ -4,6 +4,7 @@ import android.app.Activity
4
4
  import android.content.Intent
5
5
  import android.os.Bundle
6
6
  import expo.modules.notifications.BuildConfig
7
+ import expo.modules.notifications.service.delegates.ExpoHandlingDelegate
7
8
 
8
9
  /**
9
10
  * An internal Activity that passes given Intent extras from
@@ -15,6 +16,8 @@ class NotificationForwarderActivity : Activity() {
15
16
  super.onCreate(savedInstanceState)
16
17
  val broadcastIntent =
17
18
  NotificationsService.createNotificationResponseBroadcastIntent(applicationContext, intent.extras)
19
+ val notificationResponse = NotificationsService.getNotificationResponseFromBroadcastIntent(broadcastIntent)
20
+ ExpoHandlingDelegate.openAppToForeground(this, notificationResponse)
18
21
  sendBroadcast(broadcastIntent)
19
22
  finish()
20
23
  }
@@ -67,15 +67,23 @@ class ExpoHandlingDelegate(protected val context: Context) : HandlingDelegate {
67
67
  // For intent with RemoteInput, it should be mutable.
68
68
  intentFlags = intentFlags or PendingIntent.FLAG_MUTABLE
69
69
  }
70
- val foregroundActivityIntent = getNotificationActionLauncher(context) ?: getMainActivityLauncher(context) ?: run {
71
- Log.w("expo-notifications", "No launch intent found for application. Interacting with the notification won't open the app. The implementation uses `getLaunchIntentForPackage` to find appropriate activity.")
72
- Intent()
73
- }
74
- foregroundActivityIntent.flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_MULTIPLE_TASK
75
- NotificationsService.setNotificationResponseToIntent(foregroundActivityIntent, notificationResponse)
70
+
76
71
  val backgroundActivityIntent = Intent(context, NotificationForwarderActivity::class.java)
72
+ backgroundActivityIntent.data = broadcastIntent.data
73
+ backgroundActivityIntent.flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_MULTIPLE_TASK
77
74
  backgroundActivityIntent.putExtras(broadcastIntent)
78
- return PendingIntent.getActivities(context, 0, arrayOf(foregroundActivityIntent, backgroundActivityIntent), intentFlags)
75
+ val requestCode = broadcastIntent.component?.className?.hashCode() ?: NotificationsService::class.java.hashCode()
76
+ return PendingIntent.getActivity(context, requestCode, backgroundActivityIntent, intentFlags)
77
+ }
78
+
79
+ fun openAppToForeground(context: Context, notificationResponse: NotificationResponse) {
80
+ (getNotificationActionLauncher(context) ?: getMainActivityLauncher(context))?.let { intent ->
81
+ NotificationsService.setNotificationResponseToIntent(intent, notificationResponse)
82
+ context.startActivity(intent)
83
+ return
84
+ }
85
+
86
+ Log.w("expo-notifications", "No launch intent found for application. Interacting with the notification won't open the app. The implementation uses `getLaunchIntentForPackage` to find appropriate activity.")
79
87
  }
80
88
 
81
89
  private fun getNotificationActionLauncher(context: Context): Intent? {
@@ -130,16 +138,6 @@ class ExpoHandlingDelegate(protected val context: Context) : HandlingDelegate {
130
138
  }
131
139
  }
132
140
 
133
- protected fun openAppToForeground(context: Context, notificationResponse: NotificationResponse) {
134
- (getNotificationActionLauncher(context) ?: getMainActivityLauncher(context))?.let { intent ->
135
- NotificationsService.setNotificationResponseToIntent(intent, notificationResponse)
136
- context.startActivity(intent)
137
- return
138
- }
139
-
140
- Log.w("expo-notifications", "No launch intent found for application. Interacting with the notification won't open the app. The implementation uses `getLaunchIntentForPackage` to find appropriate activity.")
141
- }
142
-
143
141
  override fun handleNotificationsDropped() {
144
142
  getListeners().forEach {
145
143
  it.onNotificationsDropped()
@@ -6,30 +6,30 @@
6
6
  <array>
7
7
  <dict>
8
8
  <key>LibraryIdentifier</key>
9
- <string>ios-arm64</string>
9
+ <string>ios-arm64_x86_64-simulator</string>
10
10
  <key>LibraryPath</key>
11
11
  <string>EXNotifications.framework</string>
12
12
  <key>SupportedArchitectures</key>
13
13
  <array>
14
14
  <string>arm64</string>
15
+ <string>x86_64</string>
15
16
  </array>
16
17
  <key>SupportedPlatform</key>
17
18
  <string>ios</string>
19
+ <key>SupportedPlatformVariant</key>
20
+ <string>simulator</string>
18
21
  </dict>
19
22
  <dict>
20
23
  <key>LibraryIdentifier</key>
21
- <string>ios-arm64_x86_64-simulator</string>
24
+ <string>ios-arm64</string>
22
25
  <key>LibraryPath</key>
23
26
  <string>EXNotifications.framework</string>
24
27
  <key>SupportedArchitectures</key>
25
28
  <array>
26
29
  <string>arm64</string>
27
- <string>x86_64</string>
28
30
  </array>
29
31
  <key>SupportedPlatform</key>
30
32
  <string>ios</string>
31
- <key>SupportedPlatformVariant</key>
32
- <string>simulator</string>
33
33
  </dict>
34
34
  </array>
35
35
  <key>CFBundlePackageType</key>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "expo-notifications",
3
- "version": "0.15.3",
3
+ "version": "0.15.4",
4
4
  "description": "Notifications module",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",
@@ -58,5 +58,5 @@
58
58
  "peerDependencies": {
59
59
  "expo": "*"
60
60
  },
61
- "gitHead": "aa4163b5cb533fd4b3fc583e3958b36eaa97617c"
61
+ "gitHead": "702fddee92d0d96c29fc8144fa08d07ba0995492"
62
62
  }