1f6acc11ab
* package upgrades
* upgrade system ui
* update patches
* rename patch
* rm
* use .set/.set
* resolve yarnlock
* fix accidentally removed package
* fix use permissions hook
* fix some type errors
* type fixes
* more tweaking
* clean
* Discard changes to src/screens/Onboarding/StepProfile/index.tsx
* oops
* fix splash
* use ios/android in config
* Fix tests
* add back patch
* add to rn patch
* fullscreen?
* Revert "add to rn patch"
This reverts commit 4716d2c643.
* try this
* test with revert
* test
* maybe this
* fix config
* Bump @react-native-picker/picker
* Bump some packages
* Rm unused
* Update lockfile
* Rename expo-notifications+0.29.8.patch.md to expo-notifications+0.29.10.patch.md
* Update react-native+0.76.3.patch.md
* Update react-native+0.76.3.patch.md
* Inline splash configs
Jumping around the file is annoying and makes it harder to understand how this is structured.
* Start fixing Android splash
* Downgrade compressor
This version isn't building for me due to https://github.com/numandev1/react-native-compressor/issues/322.
* Make Android splash empty for now
* Work around a bug
* Bump the compressor
* Bump again
* Include splash fixes
* Try updating
* No custom Android splash
* Revert to using icons
* welp
* Fix sizes
* Make sizing work
* Bump size
---------
Co-authored-by: Dan Abramov <dan.abramov@gmail.com>
170 lines
9.3 KiB
Diff
170 lines
9.3 KiB
Diff
diff --git a/node_modules/expo-notifications/android/build.gradle b/node_modules/expo-notifications/android/build.gradle
|
|
index 5dd0c61..bf536dd 100644
|
|
--- a/node_modules/expo-notifications/android/build.gradle
|
|
+++ b/node_modules/expo-notifications/android/build.gradle
|
|
@@ -46,6 +46,7 @@ dependencies {
|
|
implementation 'com.google.firebase:firebase-messaging:24.0.1'
|
|
|
|
implementation 'me.leolin:ShortcutBadger:1.1.22@aar'
|
|
+ implementation project(':expo-background-notification-handler')
|
|
|
|
if (project.findProject(':expo-modules-test-core')) {
|
|
testImplementation project(':expo-modules-test-core')
|
|
diff --git a/node_modules/expo-notifications/android/src/main/java/expo/modules/notifications/notifications/interfaces/INotificationContent.kt b/node_modules/expo-notifications/android/src/main/java/expo/modules/notifications/notifications/interfaces/INotificationContent.kt
|
|
index 7b99e6c..45a450d 100644
|
|
--- a/node_modules/expo-notifications/android/src/main/java/expo/modules/notifications/notifications/interfaces/INotificationContent.kt
|
|
+++ b/node_modules/expo-notifications/android/src/main/java/expo/modules/notifications/notifications/interfaces/INotificationContent.kt
|
|
@@ -15,6 +15,7 @@ import org.json.JSONObject
|
|
* This interface exists to provide a common API for both classes.
|
|
* */
|
|
interface INotificationContent : Parcelable {
|
|
+ val channelId: String?
|
|
val title: String?
|
|
val text: String?
|
|
val subText: String?
|
|
diff --git a/node_modules/expo-notifications/android/src/main/java/expo/modules/notifications/notifications/model/NotificationContent.java b/node_modules/expo-notifications/android/src/main/java/expo/modules/notifications/notifications/model/NotificationContent.java
|
|
index 191b64e..fe8b3c5 100644
|
|
--- a/node_modules/expo-notifications/android/src/main/java/expo/modules/notifications/notifications/model/NotificationContent.java
|
|
+++ b/node_modules/expo-notifications/android/src/main/java/expo/modules/notifications/notifications/model/NotificationContent.java
|
|
@@ -35,6 +35,7 @@ import kotlin.coroutines.Continuation;
|
|
* Refactoring this class may require a migration strategy for the data stored in SharedPreferences.
|
|
*/
|
|
public class NotificationContent implements Parcelable, Serializable, INotificationContent {
|
|
+ private String mChannelId;
|
|
private String mTitle;
|
|
private String mText;
|
|
private String mSubtitle;
|
|
@@ -65,6 +66,11 @@ public class NotificationContent implements Parcelable, Serializable, INotificat
|
|
}
|
|
};
|
|
|
|
+ @Nullable
|
|
+ public String getChannelId() {
|
|
+ return mChannelId;
|
|
+ }
|
|
+
|
|
@Nullable
|
|
public String getTitle() {
|
|
return mTitle;
|
|
@@ -158,6 +164,7 @@ public class NotificationContent implements Parcelable, Serializable, INotificat
|
|
}
|
|
|
|
protected NotificationContent(Parcel in) {
|
|
+ mChannelId = in.readString();
|
|
mTitle = in.readString();
|
|
mText = in.readString();
|
|
mSubtitle = in.readString();
|
|
@@ -183,6 +190,7 @@ public class NotificationContent implements Parcelable, Serializable, INotificat
|
|
|
|
@Override
|
|
public void writeToParcel(Parcel dest, int flags) {
|
|
+ dest.writeString(mChannelId);
|
|
dest.writeString(mTitle);
|
|
dest.writeString(mText);
|
|
dest.writeString(mSubtitle);
|
|
@@ -203,6 +211,7 @@ public class NotificationContent implements Parcelable, Serializable, INotificat
|
|
private static final long serialVersionUID = 397666843266836802L;
|
|
|
|
private void writeObject(java.io.ObjectOutputStream out) throws IOException {
|
|
+ out.writeObject(mChannelId);
|
|
out.writeObject(mTitle);
|
|
out.writeObject(mText);
|
|
out.writeObject(mSubtitle);
|
|
@@ -285,6 +294,11 @@ public class NotificationContent implements Parcelable, Serializable, INotificat
|
|
useDefaultVibrationPattern();
|
|
}
|
|
|
|
+ public Builder setChannelId(String channelId) {
|
|
+ content.mChannelId = channelId;
|
|
+ return this;
|
|
+ }
|
|
+
|
|
public Builder setTitle(String title) {
|
|
content.mTitle = title;
|
|
return this;
|
|
diff --git a/node_modules/expo-notifications/android/src/main/java/expo/modules/notifications/notifications/model/NotificationData.kt b/node_modules/expo-notifications/android/src/main/java/expo/modules/notifications/notifications/model/NotificationData.kt
|
|
index 39b5aad..e50797d 100644
|
|
--- a/node_modules/expo-notifications/android/src/main/java/expo/modules/notifications/notifications/model/NotificationData.kt
|
|
+++ b/node_modules/expo-notifications/android/src/main/java/expo/modules/notifications/notifications/model/NotificationData.kt
|
|
@@ -11,6 +11,9 @@ import org.json.JSONObject
|
|
* */
|
|
@JvmInline
|
|
value class NotificationData(private val data: Map<String, String>) {
|
|
+ val channelId: String?
|
|
+ get() = data["channelId"]
|
|
+
|
|
val title: String?
|
|
get() = data["title"]
|
|
|
|
diff --git a/node_modules/expo-notifications/android/src/main/java/expo/modules/notifications/notifications/model/RemoteNotificationContent.kt b/node_modules/expo-notifications/android/src/main/java/expo/modules/notifications/notifications/model/RemoteNotificationContent.kt
|
|
index d2cc6cf..6a48ff2 100644
|
|
--- a/node_modules/expo-notifications/android/src/main/java/expo/modules/notifications/notifications/model/RemoteNotificationContent.kt
|
|
+++ b/node_modules/expo-notifications/android/src/main/java/expo/modules/notifications/notifications/model/RemoteNotificationContent.kt
|
|
@@ -31,6 +31,8 @@ class RemoteNotificationContent(private val remoteMessage: RemoteMessage) : INot
|
|
return remoteMessage.notification?.imageUrl != null
|
|
}
|
|
|
|
+ override val channelId = remoteMessage.notification?.channelId ?: notificationData.channelId
|
|
+
|
|
override val title = remoteMessage.notification?.title ?: notificationData.title
|
|
|
|
override val text = remoteMessage.notification?.body ?: notificationData.message
|
|
diff --git a/node_modules/expo-notifications/android/src/main/java/expo/modules/notifications/notifications/presentation/builders/ExpoNotificationBuilder.kt b/node_modules/expo-notifications/android/src/main/java/expo/modules/notifications/notifications/presentation/builders/ExpoNotificationBuilder.kt
|
|
index 8ca6ec5..57c3599 100644
|
|
--- a/node_modules/expo-notifications/android/src/main/java/expo/modules/notifications/notifications/presentation/builders/ExpoNotificationBuilder.kt
|
|
+++ b/node_modules/expo-notifications/android/src/main/java/expo/modules/notifications/notifications/presentation/builders/ExpoNotificationBuilder.kt
|
|
@@ -101,6 +101,9 @@ open class ExpoNotificationBuilder(
|
|
builder.setOngoing(content.isSticky)
|
|
|
|
// see "Notification anatomy" https://developer.android.com/develop/ui/views/notifications#Templates
|
|
+ content.channelId?.let {
|
|
+ builder.setChannelId(it)
|
|
+ }
|
|
builder.setContentTitle(content.title)
|
|
builder.setContentText(content.text)
|
|
builder.setSubText(content.subText)
|
|
diff --git a/node_modules/expo-notifications/android/src/main/java/expo/modules/notifications/service/delegates/FirebaseMessagingDelegate.kt b/node_modules/expo-notifications/android/src/main/java/expo/modules/notifications/service/delegates/FirebaseMessagingDelegate.kt
|
|
index 9f22441..5f92f80 100644
|
|
--- a/node_modules/expo-notifications/android/src/main/java/expo/modules/notifications/service/delegates/FirebaseMessagingDelegate.kt
|
|
+++ b/node_modules/expo-notifications/android/src/main/java/expo/modules/notifications/service/delegates/FirebaseMessagingDelegate.kt
|
|
@@ -2,6 +2,9 @@ package expo.modules.notifications.service.delegates
|
|
|
|
import android.content.Context
|
|
import com.google.firebase.messaging.RemoteMessage
|
|
+import expo.modules.backgroundnotificationhandler.BackgroundNotificationHandler
|
|
+import expo.modules.backgroundnotificationhandler.BackgroundNotificationHandlerInterface
|
|
+import expo.modules.backgroundnotificationhandler.ExpoBackgroundNotificationHandlerModule
|
|
import expo.modules.interfaces.taskManager.TaskServiceProviderHelper
|
|
import expo.modules.notifications.notifications.RemoteMessageSerializer
|
|
import expo.modules.notifications.notifications.background.BackgroundRemoteNotificationTaskConsumer
|
|
@@ -17,7 +20,8 @@ import expo.modules.notifications.tokens.interfaces.FirebaseTokenListener
|
|
import java.lang.ref.WeakReference
|
|
import java.util.*
|
|
|
|
-open class FirebaseMessagingDelegate(protected val context: Context) : FirebaseMessagingDelegate {
|
|
+open class FirebaseMessagingDelegate(protected val context: Context) : FirebaseMessagingDelegate,
|
|
+ BackgroundNotificationHandlerInterface {
|
|
companion object {
|
|
// Unfortunately we cannot save state between instances of a service other way
|
|
// than by static properties. Fortunately, using weak references we can
|
|
@@ -94,8 +98,17 @@ open class FirebaseMessagingDelegate(protected val context: Context) : FirebaseM
|
|
DebugLogging.logRemoteMessage("FirebaseMessagingDelegate.onMessageReceived: message", remoteMessage)
|
|
val notification = createNotification(remoteMessage)
|
|
DebugLogging.logNotification("FirebaseMessagingDelegate.onMessageReceived: notification", notification)
|
|
- NotificationsService.receive(context, notification)
|
|
- runTaskManagerTasks(remoteMessage)
|
|
+
|
|
+ if (!ExpoBackgroundNotificationHandlerModule.isForegrounded) {
|
|
+ BackgroundNotificationHandler(context, this).handleMessage(remoteMessage)
|
|
+ } else {
|
|
+ showMessage(remoteMessage)
|
|
+ runTaskManagerTasks(remoteMessage)
|
|
+ }
|
|
+ }
|
|
+
|
|
+ override fun showMessage(remoteMessage: RemoteMessage) {
|
|
+ NotificationsService.receive(context, createNotification(remoteMessage))
|
|
}
|
|
|
|
private fun runTaskManagerTasks(remoteMessage: RemoteMessage) {
|