Bluesky app fork with some witchin' additions 馃挮
witchsky.app
bluesky
fork
client
1diff --git a/node_modules/expo-notifications/android/build.gradle b/node_modules/expo-notifications/android/build.gradle
2index bc479ee..1ebfa00 100644
3--- a/node_modules/expo-notifications/android/build.gradle
4+++ b/node_modules/expo-notifications/android/build.gradle
5@@ -42,6 +42,7 @@ dependencies {
6 implementation 'com.google.firebase:firebase-messaging:24.0.1'
7
8 implementation 'me.leolin:ShortcutBadger:1.1.22@aar'
9+ implementation project(':expo-background-notification-handler')
10
11 if (project.findProject(':expo-modules-test-core')) {
12 testImplementation project(':expo-modules-test-core')
13diff --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
14index 7b99e6c..45a450d 100644
15--- a/node_modules/expo-notifications/android/src/main/java/expo/modules/notifications/notifications/interfaces/INotificationContent.kt
16+++ b/node_modules/expo-notifications/android/src/main/java/expo/modules/notifications/notifications/interfaces/INotificationContent.kt
17@@ -15,6 +15,7 @@ import org.json.JSONObject
18 * This interface exists to provide a common API for both classes.
19 * */
20 interface INotificationContent : Parcelable {
21+ val channelId: String?
22 val title: String?
23 val text: String?
24 val subText: String?
25diff --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
26index 191b64e..fe8b3c5 100644
27--- a/node_modules/expo-notifications/android/src/main/java/expo/modules/notifications/notifications/model/NotificationContent.java
28+++ b/node_modules/expo-notifications/android/src/main/java/expo/modules/notifications/notifications/model/NotificationContent.java
29@@ -35,6 +35,7 @@ import kotlin.coroutines.Continuation;
30 * Refactoring this class may require a migration strategy for the data stored in SharedPreferences.
31 */
32 public class NotificationContent implements Parcelable, Serializable, INotificationContent {
33+ private String mChannelId;
34 private String mTitle;
35 private String mText;
36 private String mSubtitle;
37@@ -65,6 +66,11 @@ public class NotificationContent implements Parcelable, Serializable, INotificat
38 }
39 };
40
41+ @Nullable
42+ public String getChannelId() {
43+ return mChannelId;
44+ }
45+
46 @Nullable
47 public String getTitle() {
48 return mTitle;
49@@ -158,6 +164,7 @@ public class NotificationContent implements Parcelable, Serializable, INotificat
50 }
51
52 protected NotificationContent(Parcel in) {
53+ mChannelId = in.readString();
54 mTitle = in.readString();
55 mText = in.readString();
56 mSubtitle = in.readString();
57@@ -183,6 +190,7 @@ public class NotificationContent implements Parcelable, Serializable, INotificat
58
59 @Override
60 public void writeToParcel(Parcel dest, int flags) {
61+ dest.writeString(mChannelId);
62 dest.writeString(mTitle);
63 dest.writeString(mText);
64 dest.writeString(mSubtitle);
65@@ -203,6 +211,7 @@ public class NotificationContent implements Parcelable, Serializable, INotificat
66 private static final long serialVersionUID = 397666843266836802L;
67
68 private void writeObject(java.io.ObjectOutputStream out) throws IOException {
69+ out.writeObject(mChannelId);
70 out.writeObject(mTitle);
71 out.writeObject(mText);
72 out.writeObject(mSubtitle);
73@@ -285,6 +294,11 @@ public class NotificationContent implements Parcelable, Serializable, INotificat
74 useDefaultVibrationPattern();
75 }
76
77+ public Builder setChannelId(String channelId) {
78+ content.mChannelId = channelId;
79+ return this;
80+ }
81+
82 public Builder setTitle(String title) {
83 content.mTitle = title;
84 return this;
85diff --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
86index 3af254c..3c77e9d 100644
87--- a/node_modules/expo-notifications/android/src/main/java/expo/modules/notifications/notifications/model/NotificationData.kt
88+++ b/node_modules/expo-notifications/android/src/main/java/expo/modules/notifications/notifications/model/NotificationData.kt
89@@ -11,6 +11,9 @@ import org.json.JSONObject
90 * */
91 @JvmInline
92 value class NotificationData(private val data: Map<String, String>) {
93+ val channelId: String?
94+ get() = data["channelId"]
95+
96 val title: String?
97 get() = data["title"]
98
99diff --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
100index d2cc6cf..6a48ff2 100644
101--- a/node_modules/expo-notifications/android/src/main/java/expo/modules/notifications/notifications/model/RemoteNotificationContent.kt
102+++ b/node_modules/expo-notifications/android/src/main/java/expo/modules/notifications/notifications/model/RemoteNotificationContent.kt
103@@ -31,6 +31,8 @@ class RemoteNotificationContent(private val remoteMessage: RemoteMessage) : INot
104 return remoteMessage.notification?.imageUrl != null
105 }
106
107+ override val channelId = remoteMessage.notification?.channelId ?: notificationData.channelId
108+
109 override val title = remoteMessage.notification?.title ?: notificationData.title
110
111 override val text = remoteMessage.notification?.body ?: notificationData.message
112diff --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
113index 98f003f..2f745e8 100644
114--- a/node_modules/expo-notifications/android/src/main/java/expo/modules/notifications/notifications/presentation/builders/ExpoNotificationBuilder.kt
115+++ b/node_modules/expo-notifications/android/src/main/java/expo/modules/notifications/notifications/presentation/builders/ExpoNotificationBuilder.kt
116@@ -101,6 +101,9 @@ open class ExpoNotificationBuilder(
117 builder.setOngoing(content.isSticky)
118
119 // see "Notification anatomy" https://developer.android.com/develop/ui/views/notifications#Templates
120+ content.channelId?.let {
121+ builder.setChannelId(it)
122+ }
123 builder.setContentTitle(content.title)
124 builder.setContentText(content.text)
125 builder.setSubText(content.subText)
126diff --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
127index 90ca4ff..9d4cb09 100644
128--- a/node_modules/expo-notifications/android/src/main/java/expo/modules/notifications/service/delegates/FirebaseMessagingDelegate.kt
129+++ b/node_modules/expo-notifications/android/src/main/java/expo/modules/notifications/service/delegates/FirebaseMessagingDelegate.kt
130@@ -3,6 +3,9 @@ package expo.modules.notifications.service.delegates
131 import android.content.Context
132 import android.os.Bundle
133 import com.google.firebase.messaging.RemoteMessage
134+import expo.modules.backgroundnotificationhandler.BackgroundNotificationHandler
135+import expo.modules.backgroundnotificationhandler.BackgroundNotificationHandlerInterface
136+import expo.modules.backgroundnotificationhandler.ExpoBackgroundNotificationHandlerModule
137 import expo.modules.interfaces.taskManager.TaskServiceProviderHelper
138 import expo.modules.notifications.notifications.RemoteMessageSerializer
139 import expo.modules.notifications.notifications.background.BackgroundRemoteNotificationTaskConsumer
140@@ -18,7 +21,7 @@ import expo.modules.notifications.tokens.interfaces.FirebaseTokenListener
141 import java.lang.ref.WeakReference
142 import java.util.*
143
144-open class FirebaseMessagingDelegate(protected val context: Context) : FirebaseMessagingDelegate {
145+open class FirebaseMessagingDelegate(protected val context: Context) : FirebaseMessagingDelegate, BackgroundNotificationHandlerInterface{
146 companion object {
147 // Unfortunately we cannot save state between instances of a service other way
148 // than by static properties. Fortunately, using weak references we can
149@@ -105,8 +108,19 @@ open class FirebaseMessagingDelegate(protected val context: Context) : FirebaseM
150 DebugLogging.logRemoteMessage("FirebaseMessagingDelegate.onMessageReceived: message", remoteMessage)
151 val notification = createNotification(remoteMessage)
152 DebugLogging.logNotification("FirebaseMessagingDelegate.onMessageReceived: notification", notification)
153- NotificationsService.receive(context, notification)
154- runTaskManagerTasks(context.applicationContext, RemoteMessageSerializer.toBundle(remoteMessage))
155+ if (!ExpoBackgroundNotificationHandlerModule.isForegrounded) {
156+ BackgroundNotificationHandler(context, this).handleMessage(remoteMessage)
157+ } else {
158+ NotificationsService.receive(context, notification)
159+ runTaskManagerTasks(
160+ context.applicationContext,
161+ RemoteMessageSerializer.toBundle(remoteMessage)
162+ )
163+ }
164+ }
165+
166+ override fun showMessage(remoteMessage: RemoteMessage) {
167+ NotificationsService.receive(context, createNotification(remoteMessage))
168 }
169
170 protected fun createNotification(remoteMessage: RemoteMessage): Notification {