expo-notifications 0.28.0 → 0.28.2
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 +10 -0
- package/android/build.gradle +2 -2
- package/android/src/main/java/expo/modules/notifications/NotificationsPackage.java +17 -1
- package/android/src/main/java/expo/modules/notifications/notifications/NotificationManager.java +22 -0
- package/android/src/main/java/expo/modules/notifications/notifications/NotificationSerializer.java +28 -5
- package/android/src/main/java/expo/modules/notifications/notifications/emitting/NotificationsEmitter.kt +9 -6
- package/android/src/main/java/expo/modules/notifications/notifications/interfaces/NotificationListener.java +10 -0
- package/android/src/main/java/expo/modules/notifications/service/delegates/ExpoNotificationLifecycleListener.java +76 -0
- package/build/BackgroundNotificationTasksModule.d.ts.map +1 -1
- package/build/BadgeModule.d.ts.map +1 -1
- package/build/BadgeModule.native.d.ts.map +1 -1
- package/build/BadgeModule.web.js.map +1 -1
- package/build/DevicePushTokenAutoRegistration.fx.js.map +1 -1
- package/build/NotificationChannelGroupManager.d.ts.map +1 -1
- package/build/NotificationChannelManager.d.ts.map +1 -1
- package/build/NotificationPermissions.js.map +1 -1
- package/build/NotificationPermissionsModule.d.ts.map +1 -1
- package/build/NotificationPermissionsModule.js.map +1 -1
- package/build/NotificationPresenterModule.d.ts.map +1 -1
- package/build/NotificationScheduler.d.ts.map +1 -1
- package/build/NotificationsEmitter.d.ts.map +1 -1
- package/build/NotificationsEmitter.js +15 -1
- package/build/NotificationsEmitter.js.map +1 -1
- package/build/NotificationsEmitterModule.d.ts.map +1 -1
- package/build/NotificationsEmitterModule.js.map +1 -1
- package/build/NotificationsHandler.js.map +1 -1
- package/build/NotificationsHandlerModule.d.ts.map +1 -1
- package/build/NotificationsHandlerModule.js.map +1 -1
- package/build/PushTokenManager.d.ts.map +1 -1
- package/build/PushTokenManager.js.map +1 -1
- package/build/ServerRegistrationModule.d.ts.map +1 -1
- package/build/ServerRegistrationModule.web.d.ts.map +1 -1
- package/build/ServerRegistrationModule.web.js.map +1 -1
- package/build/cancelAllScheduledNotificationsAsync.js.map +1 -1
- package/build/cancelScheduledNotificationAsync.js.map +1 -1
- package/build/deleteNotificationCategoryAsync.js.map +1 -1
- package/build/deleteNotificationChannelAsync.android.js.map +1 -1
- package/build/deleteNotificationChannelGroupAsync.android.js.map +1 -1
- package/build/dismissAllNotificationsAsync.js.map +1 -1
- package/build/dismissNotificationAsync.js.map +1 -1
- package/build/getAllScheduledNotificationsAsync.js.map +1 -1
- package/build/getBadgeCountAsync.js.map +1 -1
- package/build/getDevicePushTokenAsync.js.map +1 -1
- package/build/getDevicePushTokenAsync.web.js.map +1 -1
- package/build/getExpoPushTokenAsync.js.map +1 -1
- package/build/getNextTriggerDateAsync.js.map +1 -1
- package/build/getNotificationCategoriesAsync.js.map +1 -1
- package/build/getNotificationChannelAsync.android.js.map +1 -1
- package/build/getNotificationChannelGroupAsync.android.js.map +1 -1
- package/build/getNotificationChannelGroupsAsync.android.js.map +1 -1
- package/build/getNotificationChannelsAsync.android.js.map +1 -1
- package/build/getPresentedNotificationsAsync.js.map +1 -1
- package/build/presentNotificationAsync.js.map +1 -1
- package/build/registerTaskAsync.js.map +1 -1
- package/build/scheduleNotificationAsync.js +1 -1
- package/build/scheduleNotificationAsync.js.map +1 -1
- package/build/setBadgeCountAsync.js.map +1 -1
- package/build/setNotificationCategoryAsync.js.map +1 -1
- package/build/setNotificationChannelAsync.android.js.map +1 -1
- package/build/setNotificationChannelGroupAsync.android.js.map +1 -1
- package/build/unregisterForNotificationsAsync.js.map +1 -1
- package/build/unregisterTaskAsync.js.map +1 -1
- package/build/utils/updateDevicePushTokenAsync.js.map +1 -1
- package/package.json +2 -2
- package/plugin/build/withNotificationsAndroid.d.ts +2 -2
- package/plugin/build/withNotificationsAndroid.js +6 -6
- package/plugin/build/withNotificationsIOS.js +2 -2
- package/src/NotificationsEmitter.ts +16 -1
package/CHANGELOG.md
CHANGED
|
@@ -10,6 +10,16 @@
|
|
|
10
10
|
|
|
11
11
|
### 💡 Others
|
|
12
12
|
|
|
13
|
+
## 0.28.2 — 2024-05-15
|
|
14
|
+
|
|
15
|
+
### 🐛 Bug fixes
|
|
16
|
+
|
|
17
|
+
- [Android] fix response handling when app in background or not running. ([#28883](https://github.com/expo/expo/pull/28883) by [@douglowder](https://github.com/douglowder))
|
|
18
|
+
|
|
19
|
+
## 0.28.1 — 2024-04-23
|
|
20
|
+
|
|
21
|
+
_This version does not introduce any user-facing changes._
|
|
22
|
+
|
|
13
23
|
## 0.28.0 — 2024-04-18
|
|
14
24
|
|
|
15
25
|
### 🐛 Bug fixes
|
package/android/build.gradle
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
apply plugin: 'com.android.library'
|
|
2
2
|
|
|
3
3
|
group = 'host.exp.exponent'
|
|
4
|
-
version = '0.28.
|
|
4
|
+
version = '0.28.2'
|
|
5
5
|
|
|
6
6
|
def expoModulesCorePlugin = new File(project(":expo-modules-core").projectDir.absolutePath, "ExpoModulesCorePlugin.gradle")
|
|
7
7
|
apply from: expoModulesCorePlugin
|
|
@@ -14,7 +14,7 @@ android {
|
|
|
14
14
|
namespace "expo.modules.notifications"
|
|
15
15
|
defaultConfig {
|
|
16
16
|
versionCode 21
|
|
17
|
-
versionName '0.28.
|
|
17
|
+
versionName '0.28.2'
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
buildFeatures {
|
|
@@ -3,22 +3,32 @@ package expo.modules.notifications;
|
|
|
3
3
|
import android.content.Context;
|
|
4
4
|
|
|
5
5
|
import java.util.Arrays;
|
|
6
|
+
import java.util.Collections;
|
|
6
7
|
import java.util.List;
|
|
7
8
|
|
|
8
9
|
import expo.modules.core.BasePackage;
|
|
9
10
|
import expo.modules.core.interfaces.InternalModule;
|
|
11
|
+
import expo.modules.core.interfaces.ReactActivityLifecycleListener;
|
|
10
12
|
import expo.modules.core.interfaces.SingletonModule;
|
|
11
13
|
import expo.modules.notifications.notifications.NotificationManager;
|
|
12
14
|
import expo.modules.notifications.notifications.categories.serializers.ExpoNotificationsCategoriesSerializer;
|
|
13
15
|
import expo.modules.notifications.notifications.channels.AndroidXNotificationsChannelsProvider;
|
|
16
|
+
import expo.modules.notifications.service.delegates.ExpoNotificationLifecycleListener;
|
|
14
17
|
import expo.modules.notifications.tokens.PushTokenManager;
|
|
15
18
|
|
|
16
19
|
public class NotificationsPackage extends BasePackage {
|
|
20
|
+
|
|
21
|
+
private NotificationManager mNotificationManager;
|
|
22
|
+
|
|
23
|
+
public NotificationsPackage() {
|
|
24
|
+
mNotificationManager = new NotificationManager();
|
|
25
|
+
}
|
|
26
|
+
|
|
17
27
|
@Override
|
|
18
28
|
public List<SingletonModule> createSingletonModules(Context context) {
|
|
19
29
|
return Arrays.asList(
|
|
20
30
|
new PushTokenManager(),
|
|
21
|
-
|
|
31
|
+
mNotificationManager
|
|
22
32
|
);
|
|
23
33
|
}
|
|
24
34
|
|
|
@@ -29,4 +39,10 @@ public class NotificationsPackage extends BasePackage {
|
|
|
29
39
|
new ExpoNotificationsCategoriesSerializer()
|
|
30
40
|
);
|
|
31
41
|
}
|
|
42
|
+
|
|
43
|
+
@Override
|
|
44
|
+
public List<ReactActivityLifecycleListener> createReactActivityLifecycleListeners(Context activityContext) {
|
|
45
|
+
return Collections.singletonList(new ExpoNotificationLifecycleListener(activityContext, mNotificationManager));
|
|
46
|
+
}
|
|
32
47
|
}
|
|
48
|
+
|
package/android/src/main/java/expo/modules/notifications/notifications/NotificationManager.java
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
package expo.modules.notifications.notifications;
|
|
2
2
|
|
|
3
|
+
import android.os.Bundle;
|
|
4
|
+
import android.util.Log;
|
|
5
|
+
|
|
3
6
|
import expo.modules.core.interfaces.SingletonModule;
|
|
4
7
|
|
|
5
8
|
import java.lang.ref.WeakReference;
|
|
@@ -22,6 +25,7 @@ public class NotificationManager implements SingletonModule, expo.modules.notifi
|
|
|
22
25
|
*/
|
|
23
26
|
private WeakHashMap<NotificationListener, WeakReference<NotificationListener>> mListenerReferenceMap;
|
|
24
27
|
private Collection<NotificationResponse> mPendingNotificationResponses = new ArrayList<>();
|
|
28
|
+
private Collection<Bundle> mPendingNotificationResponsesFromExtras = new ArrayList<>();
|
|
25
29
|
|
|
26
30
|
public NotificationManager() {
|
|
27
31
|
mListenerReferenceMap = new WeakHashMap<>();
|
|
@@ -53,6 +57,11 @@ public class NotificationManager implements SingletonModule, expo.modules.notifi
|
|
|
53
57
|
listener.onNotificationResponseReceived(pendingResponse);
|
|
54
58
|
}
|
|
55
59
|
}
|
|
60
|
+
if (!mPendingNotificationResponsesFromExtras.isEmpty()) {
|
|
61
|
+
for (Bundle extras : mPendingNotificationResponsesFromExtras) {
|
|
62
|
+
listener.onNotificationResponseIntentReceived(extras);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
56
65
|
}
|
|
57
66
|
}
|
|
58
67
|
|
|
@@ -116,4 +125,17 @@ public class NotificationManager implements SingletonModule, expo.modules.notifi
|
|
|
116
125
|
}
|
|
117
126
|
}
|
|
118
127
|
}
|
|
128
|
+
|
|
129
|
+
public void onNotificationResponseFromExtras(Bundle extras) {
|
|
130
|
+
if (mPendingNotificationResponsesFromExtras.isEmpty()) {
|
|
131
|
+
mPendingNotificationResponsesFromExtras.add(extras);
|
|
132
|
+
} else {
|
|
133
|
+
for (WeakReference<NotificationListener> listenerReference : mListenerReferenceMap.values()) {
|
|
134
|
+
NotificationListener listener = listenerReference.get();
|
|
135
|
+
if (listener != null) {
|
|
136
|
+
listener.onNotificationResponseIntentReceived(extras);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
}
|
|
119
141
|
}
|
package/android/src/main/java/expo/modules/notifications/notifications/NotificationSerializer.java
CHANGED
|
@@ -3,9 +3,9 @@ package expo.modules.notifications.notifications;
|
|
|
3
3
|
import android.os.Build;
|
|
4
4
|
import android.os.Bundle;
|
|
5
5
|
|
|
6
|
-
import androidx.annotation.NonNull;
|
|
7
6
|
import androidx.annotation.Nullable;
|
|
8
7
|
|
|
8
|
+
import org.jetbrains.annotations.NotNull;
|
|
9
9
|
import org.json.JSONArray;
|
|
10
10
|
import org.json.JSONObject;
|
|
11
11
|
import expo.modules.core.arguments.MapArguments;
|
|
@@ -19,16 +19,12 @@ import java.util.Set;
|
|
|
19
19
|
|
|
20
20
|
import expo.modules.notifications.notifications.interfaces.NotificationTrigger;
|
|
21
21
|
import expo.modules.notifications.notifications.model.Notification;
|
|
22
|
-
import expo.modules.notifications.notifications.model.NotificationAction;
|
|
23
|
-
import expo.modules.notifications.notifications.model.NotificationCategory;
|
|
24
22
|
import expo.modules.notifications.notifications.model.NotificationContent;
|
|
25
23
|
import expo.modules.notifications.notifications.model.NotificationRequest;
|
|
26
24
|
import expo.modules.notifications.notifications.model.NotificationResponse;
|
|
27
|
-
import expo.modules.notifications.notifications.model.TextInputNotificationAction;
|
|
28
25
|
import expo.modules.notifications.notifications.model.TextInputNotificationResponse;
|
|
29
26
|
import expo.modules.notifications.notifications.model.triggers.FirebaseNotificationTrigger;
|
|
30
27
|
|
|
31
|
-
import expo.modules.notifications.notifications.triggers.ChannelAwareTrigger;
|
|
32
28
|
import expo.modules.notifications.notifications.triggers.DailyTrigger;
|
|
33
29
|
import expo.modules.notifications.notifications.triggers.DateTrigger;
|
|
34
30
|
import expo.modules.notifications.notifications.triggers.TimeIntervalTrigger;
|
|
@@ -199,4 +195,31 @@ public class NotificationSerializer {
|
|
|
199
195
|
}
|
|
200
196
|
return null;
|
|
201
197
|
}
|
|
198
|
+
|
|
199
|
+
@NotNull
|
|
200
|
+
public static Bundle toResponseBundleFromExtras(Bundle extras) {
|
|
201
|
+
Bundle serializedContent = new Bundle();
|
|
202
|
+
serializedContent.putString("title", extras.getString("title"));
|
|
203
|
+
serializedContent.putString("body", extras.getString("message"));
|
|
204
|
+
serializedContent.putString("dataString", extras.getString("body"));
|
|
205
|
+
|
|
206
|
+
Bundle serializedTrigger = new Bundle();
|
|
207
|
+
serializedTrigger.putString("type", "push");
|
|
208
|
+
serializedTrigger.putString("channelId", extras.getString("channelId"));
|
|
209
|
+
|
|
210
|
+
Bundle serializedRequest = new Bundle();
|
|
211
|
+
serializedRequest.putString("identifier", extras.getString("google.message_id"));
|
|
212
|
+
serializedRequest.putBundle("trigger", serializedTrigger);
|
|
213
|
+
serializedRequest.putBundle("content", serializedContent);
|
|
214
|
+
|
|
215
|
+
Bundle serializedNotification = new Bundle();
|
|
216
|
+
serializedNotification.putLong("date", extras.getLong("google.sent_time"));
|
|
217
|
+
serializedNotification.putBundle("request", serializedRequest);
|
|
218
|
+
|
|
219
|
+
Bundle serializedResponse = new Bundle();
|
|
220
|
+
serializedResponse.putString("actionIdentifier", "expo.modules.notifications.actions.DEFAULT");
|
|
221
|
+
serializedResponse.putBundle("notification", serializedNotification);
|
|
222
|
+
|
|
223
|
+
return serializedResponse;
|
|
224
|
+
}
|
|
202
225
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
package expo.modules.notifications.notifications.emitting
|
|
2
2
|
|
|
3
3
|
import android.os.Bundle
|
|
4
|
-
import expo.modules.core.interfaces.services.EventEmitter
|
|
5
4
|
import expo.modules.kotlin.modules.Module
|
|
6
5
|
import expo.modules.kotlin.modules.ModuleDefinition
|
|
7
6
|
import expo.modules.notifications.notifications.NotificationSerializer
|
|
@@ -16,8 +15,7 @@ private const val MESSAGES_DELETED_EVENT_NAME = "onNotificationsDeleted"
|
|
|
16
15
|
|
|
17
16
|
open class NotificationsEmitter : Module(), NotificationListener {
|
|
18
17
|
private lateinit var notificationManager: NotificationManager
|
|
19
|
-
private var
|
|
20
|
-
private var eventEmitter: EventEmitter? = null
|
|
18
|
+
private var lastNotificationResponseBundle: Bundle? = null
|
|
21
19
|
|
|
22
20
|
override fun definition() = ModuleDefinition {
|
|
23
21
|
Name("ExpoNotificationsEmitter")
|
|
@@ -40,7 +38,7 @@ open class NotificationsEmitter : Module(), NotificationListener {
|
|
|
40
38
|
}
|
|
41
39
|
|
|
42
40
|
AsyncFunction<Bundle?>("getLastNotificationResponseAsync") {
|
|
43
|
-
|
|
41
|
+
lastNotificationResponseBundle
|
|
44
42
|
}
|
|
45
43
|
}
|
|
46
44
|
|
|
@@ -62,11 +60,16 @@ open class NotificationsEmitter : Module(), NotificationListener {
|
|
|
62
60
|
* @return Whether notification has been handled
|
|
63
61
|
*/
|
|
64
62
|
override fun onNotificationResponseReceived(response: NotificationResponse): Boolean {
|
|
65
|
-
|
|
66
|
-
sendEvent(NEW_RESPONSE_EVENT_NAME,
|
|
63
|
+
lastNotificationResponseBundle = NotificationSerializer.toBundle(response)
|
|
64
|
+
sendEvent(NEW_RESPONSE_EVENT_NAME, lastNotificationResponseBundle)
|
|
67
65
|
return true
|
|
68
66
|
}
|
|
69
67
|
|
|
68
|
+
override fun onNotificationResponseIntentReceived(extras: Bundle?) {
|
|
69
|
+
lastNotificationResponseBundle = NotificationSerializer.toResponseBundleFromExtras(extras)
|
|
70
|
+
sendEvent(NEW_RESPONSE_EVENT_NAME, lastNotificationResponseBundle)
|
|
71
|
+
}
|
|
72
|
+
|
|
70
73
|
/**
|
|
71
74
|
* Callback called when [NotificationManager] gets informed of the fact of message dropping.
|
|
72
75
|
* Emits a [MESSAGES_DELETED_EVENT_NAME] event.
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
package expo.modules.notifications.notifications.interfaces;
|
|
2
2
|
|
|
3
|
+
import android.os.Bundle;
|
|
4
|
+
|
|
3
5
|
import com.google.firebase.messaging.FirebaseMessagingService;
|
|
4
6
|
|
|
5
7
|
import expo.modules.notifications.notifications.model.Notification;
|
|
@@ -28,6 +30,14 @@ public interface NotificationListener {
|
|
|
28
30
|
return false;
|
|
29
31
|
}
|
|
30
32
|
|
|
33
|
+
/**
|
|
34
|
+
* Callback called when notification response is received through package lifecycle listeners
|
|
35
|
+
*
|
|
36
|
+
* @param extras Bundle of extras from the lifecycle method
|
|
37
|
+
*/
|
|
38
|
+
default void onNotificationResponseIntentReceived(Bundle extras) {
|
|
39
|
+
}
|
|
40
|
+
|
|
31
41
|
/**
|
|
32
42
|
* Callback called when some notifications are dropped.
|
|
33
43
|
* See {@link FirebaseMessagingService#onDeletedMessages()}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
package expo.modules.notifications.service.delegates;
|
|
2
|
+
|
|
3
|
+
import android.app.Activity;
|
|
4
|
+
import android.app.NotificationChannel;
|
|
5
|
+
import android.app.PendingIntent;
|
|
6
|
+
import android.content.Context;
|
|
7
|
+
import android.content.Intent;
|
|
8
|
+
import android.os.Bundle;
|
|
9
|
+
import android.os.Parcel;
|
|
10
|
+
import android.util.Log;
|
|
11
|
+
|
|
12
|
+
import androidx.core.app.NotificationCompat;
|
|
13
|
+
|
|
14
|
+
import expo.modules.core.interfaces.ReactActivityLifecycleListener;
|
|
15
|
+
import expo.modules.notifications.notifications.NotificationManager;
|
|
16
|
+
import expo.modules.notifications.notifications.model.Notification;
|
|
17
|
+
import expo.modules.notifications.notifications.model.NotificationResponse;
|
|
18
|
+
|
|
19
|
+
public class ExpoNotificationLifecycleListener implements ReactActivityLifecycleListener {
|
|
20
|
+
|
|
21
|
+
private NotificationManager mNotificationManager;
|
|
22
|
+
|
|
23
|
+
public ExpoNotificationLifecycleListener(Context context, NotificationManager notificationManager) {
|
|
24
|
+
mNotificationManager = notificationManager;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* This will be triggered if the app is not running,
|
|
29
|
+
* and is started from clicking on a notification.
|
|
30
|
+
* <p>
|
|
31
|
+
* Notification data will be in activity.intent.extras
|
|
32
|
+
*
|
|
33
|
+
* @param activity
|
|
34
|
+
* @param savedInstanceState
|
|
35
|
+
*/
|
|
36
|
+
@Override
|
|
37
|
+
public void onCreate(Activity activity, Bundle savedInstanceState) {
|
|
38
|
+
Intent intent = activity.getIntent();
|
|
39
|
+
String actionIdentifier = intent.getAction();
|
|
40
|
+
if (intent != null) {
|
|
41
|
+
Bundle extras = intent.getExtras();
|
|
42
|
+
if (extras != null) {
|
|
43
|
+
logExtra("onCreate", extras);
|
|
44
|
+
mNotificationManager.onNotificationResponseFromExtras(extras);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* This will be triggered if the app is running and in the background,
|
|
51
|
+
* and the user clicks on a notification to open the app.
|
|
52
|
+
* <p>
|
|
53
|
+
* Notification data will be in intent.extras
|
|
54
|
+
*
|
|
55
|
+
* @param intent
|
|
56
|
+
* @return
|
|
57
|
+
*/
|
|
58
|
+
@Override
|
|
59
|
+
public boolean onNewIntent(Intent intent) {
|
|
60
|
+
Bundle extras = intent.getExtras();
|
|
61
|
+
String actionIdentifier = intent.getAction();
|
|
62
|
+
if (extras != null) {
|
|
63
|
+
logExtra("onNewIntent", extras);
|
|
64
|
+
mNotificationManager.onNotificationResponseFromExtras(extras);
|
|
65
|
+
}
|
|
66
|
+
return ReactActivityLifecycleListener.super.onNewIntent(intent);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
private void logExtra(String method, Bundle extra) {
|
|
70
|
+
Log.d("ExpoNotificationLifecycleListener", method + " : keys count = " + extra.keySet().size());
|
|
71
|
+
|
|
72
|
+
for (String key : extra.keySet()) {
|
|
73
|
+
Log.d("ExpoNotificationLifecycleListener", method + " : key = " + key + " = " + extra.get(key).toString());
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BackgroundNotificationTasksModule.d.ts","sourceRoot":"","sources":["../src/BackgroundNotificationTasksModule.ts"],"names":[],"mappings":";gCACoC,MAAM,GAAG,
|
|
1
|
+
{"version":3,"file":"BackgroundNotificationTasksModule.d.ts","sourceRoot":"","sources":["../src/BackgroundNotificationTasksModule.ts"],"names":[],"mappings":";gCACoC,MAAM,GAAG,QAAQ,IAAI,CAAC;kCAGpB,MAAM,GAAG,QAAQ,IAAI,CAAC;;AAJ5D,wBAOE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BadgeModule.d.ts","sourceRoot":"","sources":["../src/BadgeModule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC
|
|
1
|
+
{"version":3,"file":"BadgeModule.d.ts","sourceRoot":"","sources":["../src/BadgeModule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;;AAElD,wBAGiB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BadgeModule.native.d.ts","sourceRoot":"","sources":["../src/BadgeModule.native.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC
|
|
1
|
+
{"version":3,"file":"BadgeModule.native.d.ts","sourceRoot":"","sources":["../src/BadgeModule.native.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;;AAIlD,wBAQiB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BadgeModule.web.js","sourceRoot":"","sources":["../src/BadgeModule.web.ts"],"names":[],"mappings":"AAEA,IAAI,iBAAiB,GAAG,CAAC,CAAC;AAE1B,MAAM,WAAW,GAAgB;IAC/B,WAAW,EAAE,GAAG,EAAE,GAAE,CAAC;IACrB,eAAe,EAAE,GAAG,EAAE,GAAE,CAAC;IACzB,kBAAkB,EAAE,KAAK,IAAI,EAAE;QAC7B,OAAO,iBAAiB,CAAC;IAC3B,CAAC;IACD,kBAAkB,EAAE,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,EAAE;QAChD,uEAAuE;QACvE,kFAAkF;QAClF,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE
|
|
1
|
+
{"version":3,"file":"BadgeModule.web.js","sourceRoot":"","sources":["../src/BadgeModule.web.ts"],"names":[],"mappings":"AAEA,IAAI,iBAAiB,GAAG,CAAC,CAAC;AAE1B,MAAM,WAAW,GAAgB;IAC/B,WAAW,EAAE,GAAG,EAAE,GAAE,CAAC;IACrB,eAAe,EAAE,GAAG,EAAE,GAAE,CAAC;IACzB,kBAAkB,EAAE,KAAK,IAAI,EAAE;QAC7B,OAAO,iBAAiB,CAAC;IAC3B,CAAC;IACD,kBAAkB,EAAE,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,EAAE;QAChD,uEAAuE;QACvE,kFAAkF;QAClF,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE;YACjC,OAAO,KAAK,CAAC;SACd;QACD,MAAM,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;QACjC,IAAI,UAAU,GAAG,CAAC,EAAE;YAClB,MAAM,CAAC,GAAG,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;SACjC;aAAM;YACL,MAAM,CAAC,KAAK,EAAE,CAAC;SAChB;QACD,iBAAiB,GAAG,UAAU,CAAC;QAC/B,OAAO,IAAI,CAAC;IACd,CAAC;CACF,CAAC;AAEF,eAAe,WAAW,CAAC","sourcesContent":["import { BadgeModule } from './BadgeModule.types';\n\nlet lastSetBadgeCount = 0;\n\nconst badgeModule: BadgeModule = {\n addListener: () => {},\n removeListeners: () => {},\n getBadgeCountAsync: async () => {\n return lastSetBadgeCount;\n },\n setBadgeCountAsync: async (badgeCount, options) => {\n // If this module is loaded in SSR (NextJS), we can't modify the badge.\n // It also can't load the badgin module, that instantly invokes methods on window.\n if (typeof window === 'undefined') {\n return false;\n }\n const badgin = require('badgin');\n if (badgeCount > 0) {\n badgin.set(badgeCount, options);\n } else {\n badgin.clear();\n }\n lastSetBadgeCount = badgeCount;\n return true;\n },\n};\n\nexport default badgeModule;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DevicePushTokenAutoRegistration.fx.js","sourceRoot":"","sources":["../src/DevicePushTokenAutoRegistration.fx.ts"],"names":[],"mappings":"AAAA,OAAO,2BAA2B,C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,IAAI,wBAAwB,CAAC,wBAAwB,EAAE;IACrD,4DAA4D;IAC5D,+BAA+B;IAC/B,oBAAoB,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE;QACnC,IAAI;YACF,wEAAwE;YACxE,yEAAyE;YACzE,2BAA2B;YAC3B,MAAM,gBAAgB,GAAG,MAAM,wBAAwB,CAAC,wBAAyB,EAAE,CAAC;YAEpF,IAAI,CAAC,gBAAgB,EAAE;gBACrB,8BAA8B;gBAC9B,OAAO;aACR;YAED,MAAM,YAAY,GAAuC,IAAI,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC;YACtF,IAAI,YAAY,EAAE,SAAS,EAAE;gBAC3B,uCAAuC;gBACvC,+BAA+B;gBAC/B,MAAM,oBAAoB,CAAC,KAAK,CAAC,CAAC;aACnC;SACF;QAAC,OAAO,CAAC,EAAE;YACV,OAAO,CAAC,IAAI,CACV,0GAA0G,EAC1G,CAAC,CACF,CAAC;SACH;IACH,CAAC,CAAC,CAAC;IAEH,mCAAmC;IACnC,uCAAuC;IACvC,oCAAoC;IACpC,wBAAwB,CAAC,wBAAwB,EAAE,CAAC,IAAI,CAAC,sCAAsC,CAAC,CAAC;CAClG;KAAM;IACL,OAAO,CAAC,IAAI,CACV,2IAA2I,EAC3I,IAAI,mBAAmB,CAAC,0BAA0B,EAAE,0BAA0B,CAAC,CAChF,CAAC;CACH","sourcesContent":["import 'abort-controller/polyfill';\nimport { UnavailabilityError } from 'expo-modules-core';\n\nimport ServerRegistrationModule from './ServerRegistrationModule';\nimport { addPushTokenListener } from './TokenEmitter';\nimport { DevicePushToken } from './Tokens.types';\nimport getDevicePushTokenAsync from './getDevicePushTokenAsync';\nimport { updateDevicePushTokenAsync as updateDevicePushTokenAsyncWithSignal } from './utils/updateDevicePushTokenAsync';\n\nlet lastAbortController: AbortController | null = null;\nasync function updatePushTokenAsync(token: DevicePushToken) {\n // Abort current update process\n lastAbortController?.abort();\n lastAbortController = new AbortController();\n return await updateDevicePushTokenAsyncWithSignal(lastAbortController.signal, token);\n}\n\n/**\n * Encapsulates device server registration data\n */\nexport type DevicePushTokenRegistration = {\n isEnabled: boolean;\n};\n\n/**\n * Sets the registration information so that the device push token gets pushed\n * to the given registration endpoint\n * @param enabled\n */\nexport async function setAutoServerRegistrationEnabledAsync(enabled: boolean) {\n // We are overwriting registration, so we shouldn't let\n // any pending request complete.\n lastAbortController?.abort();\n\n if (!ServerRegistrationModule.setRegistrationInfoAsync) {\n throw new UnavailabilityError('ServerRegistrationModule', 'setRegistrationInfoAsync');\n }\n\n await ServerRegistrationModule.setRegistrationInfoAsync(\n enabled ? JSON.stringify({ isEnabled: enabled }) : null\n );\n}\n\n// note(Chmiela): This function is exported only for testing purposes.\nexport async function __handlePersistedRegistrationInfoAsync(\n registrationInfo: string | null | undefined\n) {\n if (!registrationInfo) {\n // No registration info, nothing to do\n return;\n }\n\n let registration: DevicePushTokenRegistration | null = null;\n try {\n registration = JSON.parse(registrationInfo);\n } catch (e) {\n console.warn(\n '[expo-notifications] Error encountered while fetching registration information for auto token updates.',\n e\n );\n }\n\n if (!registration?.isEnabled) {\n // Registration is invalid or not enabled, nothing more to do\n return;\n }\n\n try {\n // Since the registration is enabled, fetching a \"new\" device token\n // shouldn't be a problem.\n const latestDevicePushToken = await getDevicePushTokenAsync();\n await updatePushTokenAsync(latestDevicePushToken);\n } catch (e) {\n console.warn(\n '[expo-notifications] Error encountered while updating server registration with latest device push token.',\n e\n );\n }\n}\n\nif (ServerRegistrationModule.getRegistrationInfoAsync) {\n // A global scope (to get all the updates) device push token\n // subscription, never cleared.\n addPushTokenListener(async (token) => {\n try {\n // Before updating the push token on server we always check if we should\n // Since modules can't change their method availability while running, we\n // can assert it's defined.\n const registrationInfo = await ServerRegistrationModule.getRegistrationInfoAsync!();\n\n if (!registrationInfo) {\n // Registration is not enabled\n return;\n }\n\n const registration: DevicePushTokenRegistration | null = JSON.parse(registrationInfo);\n if (registration?.isEnabled) {\n // Dispatch an abortable task to update\n // registration with new token.\n await updatePushTokenAsync(token);\n }\n } catch (e) {\n console.warn(\n '[expo-notifications] Error encountered while updating server registration with latest device push token.',\n e\n );\n }\n });\n\n // Verify if persisted registration\n // has successfully uploaded last known\n // device push token. If not, retry.\n ServerRegistrationModule.getRegistrationInfoAsync().then(__handlePersistedRegistrationInfoAsync);\n} else {\n console.warn(\n `[expo-notifications] Error encountered while fetching auto-registration state, new tokens will not be automatically registered on server.`,\n new UnavailabilityError('ServerRegistrationModule', 'getRegistrationInfoAsync')\n );\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NotificationChannelGroupManager.d.ts","sourceRoot":"","sources":["../src/NotificationChannelGroupManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,+BAA+B,EAAE,MAAM,yCAAyC,CAAC
|
|
1
|
+
{"version":3,"file":"NotificationChannelGroupManager.d.ts","sourceRoot":"","sources":["../src/NotificationChannelGroupManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,+BAA+B,EAAE,MAAM,yCAAyC,CAAC;;AAE1F,wBAGqC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NotificationChannelManager.d.ts","sourceRoot":"","sources":["../src/NotificationChannelManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,0BAA0B,EAAE,MAAM,oCAAoC,CAAC
|
|
1
|
+
{"version":3,"file":"NotificationChannelManager.d.ts","sourceRoot":"","sources":["../src/NotificationChannelManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,0BAA0B,EAAE,MAAM,oCAAoC,CAAC;;AAEhF,wBAGgC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NotificationPermissions.js","sourceRoot":"","sources":["../src/NotificationPermissions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,QAAQ,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAMxF,OAAO,6BAA6B,MAAM,iCAAiC,CAAC;A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C","sourcesContent":["import { createPermissionHook, Platform, UnavailabilityError } from 'expo-modules-core';\n\nimport {\n NotificationPermissionsRequest,\n NotificationPermissionsStatus,\n} from './NotificationPermissions.types';\nimport NotificationPermissionsModule from './NotificationPermissionsModule';\n\n/**\n * Calling this function checks current permissions settings related to notifications.\n * It lets you verify whether the app is currently allowed to display alerts, play sounds, etc.\n * There is no user-facing effect of calling this.\n * @return It returns a `Promise` resolving to an object represents permission settings ([`NotificationPermissionsStatus`](#notificationpermissionsstatus)).\n * On iOS, make sure you [properly interpret the permissions response](#interpret-the-ios-permissions-response).\n * @example Check if the app is allowed to send any type of notifications (interrupting and non-interrupting–provisional on iOS).\n * ```ts\n * import * as Notifications from 'expo-notifications';\n *\n * export async function allowsNotificationsAsync() {\n * const settings = await Notifications.getPermissionsAsync();\n * return (\n * settings.granted || settings.ios?.status === Notifications.IosAuthorizationStatus.PROVISIONAL\n * );\n * }\n * ```\n * @header permissions\n */\nexport async function getPermissionsAsync() {\n if (!NotificationPermissionsModule.getPermissionsAsync) {\n throw new UnavailabilityError('Notifications', 'getPermissionsAsync');\n }\n\n return await NotificationPermissionsModule.getPermissionsAsync();\n}\n\n/**\n * Prompts the user for notification permissions according to request. **Request defaults to asking the user to allow displaying alerts,\n * setting badge count and playing sounds**.\n * @param permissions An object representing configuration for the request scope.\n * @return It returns a Promise resolving to an object represents permission settings ([`NotificationPermissionsStatus`](#notificationpermissionsstatus)).\n * On iOS, make sure you [properly interpret the permissions response](#interpret-the-ios-permissions-response).\n * @example Prompts the user to allow the app to show alerts, play sounds, set badge count and let Siri read out messages through AirPods.\n * ```ts\n * import * as Notifications from 'expo-notifications';\n *\n * export function requestPermissionsAsync() {\n * return await Notifications.requestPermissionsAsync({\n * ios: {\n * allowAlert: true,\n * allowBadge: true,\n * allowSound: true,\n * allowAnnouncements: true,\n * },\n * });\n * }\n * ```\n * @header permissions\n */\nexport async function requestPermissionsAsync(permissions?: NotificationPermissionsRequest) {\n if (!NotificationPermissionsModule.requestPermissionsAsync) {\n throw new UnavailabilityError('Notifications', 'requestPermissionsAsync');\n }\n\n const requestedPermissions = permissions ?? {\n ios: {\n allowAlert: true,\n allowBadge: true,\n allowSound: true,\n },\n };\n const requestedPlatformPermissions = requestedPermissions[Platform.OS];\n return await NotificationPermissionsModule.requestPermissionsAsync(requestedPlatformPermissions);\n}\n\n// @needsAudit\n/**\n * Check or request permissions to send and receive push notifications.\n * This uses both `requestPermissionsAsync` and `getPermissionsAsync` to interact with the permissions.\n * @example\n * ```ts\n * const [permissionResponse, requestPermission] = Notifications.usePermissions();\n * ```\n * @header permission\n */\nexport const usePermissions = createPermissionHook<\n NotificationPermissionsStatus,\n NotificationPermissionsRequest\n>({\n requestMethod: requestPermissionsAsync,\n getMethod: getPermissionsAsync,\n});\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NotificationPermissionsModule.d.ts","sourceRoot":"","sources":["../src/NotificationPermissionsModule.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,6BAA6B,EAAE,MAAM,uCAAuC,CAAC
|
|
1
|
+
{"version":3,"file":"NotificationPermissionsModule.d.ts","sourceRoot":"","sources":["../src/NotificationPermissionsModule.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,6BAA6B,EAAE,MAAM,uCAAuC,CAAC;;AAiEtF,wBAWmC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NotificationPermissionsModule.js","sourceRoot":"","sources":["../src/NotificationPermissionsModule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAQ/D,SAAS,uBAAuB,CAC9B,MAA0C;IAE1C,QAAQ,MAAM,EAAE
|
|
1
|
+
{"version":3,"file":"NotificationPermissionsModule.js","sourceRoot":"","sources":["../src/NotificationPermissionsModule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CA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E,KAAK,CAAC,MAAM,CAAC,CAAC;YAChF,CAAC,CAAC,CAAC;SACJ;QACD,OAAO,uBAAuB,CAAC,MAAM,CAAC,CAAC;KACxC;SAAM,IAAI,OAAO,SAAS,KAAK,WAAW,IAAI,SAAS,EAAE,WAAW,EAAE,KAAK,EAAE;QAC5E,8DAA8D;QAC9D,MAAM,KAAK,GAAG,MAAM,SAAS,CAAC,WAAW,CAAC,KAAK,CAAC,EAAE,IAAI,EAAE,eAAe,EAAE,CAAC,CAAC;QAC3E,OAAO,uBAAuB,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;KAC7C;IACD,0EAA0E;IAC1E,OAAO,uBAAuB,CAAC,QAAQ,CAAC,CAAC;AAC3C,CAAC;AAED,eAAe;IACb,WAAW,EAAE,GAAG,EAAE,GAAE,CAAC;IACrB,eAAe,EAAE,GAAG,EAAE,GAAE,CAAC;IACzB,KAAK,CAAC,mBAAmB;QACvB,OAAO,sBAAsB,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC,CAAC;IACtD,CAAC;IACD,KAAK,CAAC,uBAAuB,CAC3B,OAA6C;QAE7C,OAAO,sBAAsB,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IACrD,CAAC;CAC+B,CAAC","sourcesContent":["import { PermissionStatus, Platform } from 'expo-modules-core';\n\nimport {\n NativeNotificationPermissionsRequest,\n NotificationPermissionsStatus,\n} from './NotificationPermissions.types';\nimport { NotificationPermissionsModule } from './NotificationPermissionsModule.types';\n\nfunction convertPermissionStatus(\n status?: NotificationPermission | 'prompt'\n): NotificationPermissionsStatus {\n switch (status) {\n case 'granted':\n return {\n status: PermissionStatus.GRANTED,\n expires: 'never',\n canAskAgain: false,\n granted: true,\n };\n case 'denied':\n return {\n status: PermissionStatus.DENIED,\n expires: 'never',\n canAskAgain: false,\n granted: false,\n };\n default:\n return {\n status: PermissionStatus.UNDETERMINED,\n expires: 'never',\n canAskAgain: true,\n granted: false,\n };\n }\n}\n\nasync function resolvePermissionAsync({\n shouldAsk,\n}: {\n shouldAsk: boolean;\n}): Promise<NotificationPermissionsStatus> {\n if (!Platform.isDOMAvailable) {\n return convertPermissionStatus('denied');\n }\n\n const { Notification = {} } = window as any;\n if (typeof Notification.requestPermission !== 'undefined') {\n let status = Notification.permission;\n if (shouldAsk) {\n status = await new Promise((resolve, reject) => {\n let resolved = false;\n function resolveOnce(status: string) {\n if (!resolved) {\n resolved = true;\n resolve(status);\n }\n }\n // Some browsers require a callback argument and some return a Promise\n Notification.requestPermission(resolveOnce)?.then(resolveOnce)?.catch(reject);\n });\n }\n return convertPermissionStatus(status);\n } else if (typeof navigator !== 'undefined' && navigator?.permissions?.query) {\n // TODO(Bacon): Support `push` in the future when it's stable.\n const query = await navigator.permissions.query({ name: 'notifications' });\n return convertPermissionStatus(query.state);\n }\n // Platforms like iOS Safari don't support Notifications so return denied.\n return convertPermissionStatus('denied');\n}\n\nexport default {\n addListener: () => {},\n removeListeners: () => {},\n async getPermissionsAsync(): Promise<NotificationPermissionsStatus> {\n return resolvePermissionAsync({ shouldAsk: false });\n },\n async requestPermissionsAsync(\n request: NativeNotificationPermissionsRequest\n ): Promise<NotificationPermissionsStatus> {\n return resolvePermissionAsync({ shouldAsk: true });\n },\n} as NotificationPermissionsModule;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NotificationPresenterModule.d.ts","sourceRoot":"","sources":["../src/NotificationPresenterModule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,2BAA2B,EAAE,MAAM,qCAAqC,CAAC
|
|
1
|
+
{"version":3,"file":"NotificationPresenterModule.d.ts","sourceRoot":"","sources":["../src/NotificationPresenterModule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,2BAA2B,EAAE,MAAM,qCAAqC,CAAC;;AAElF,wBAGiC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NotificationScheduler.d.ts","sourceRoot":"","sources":["../src/NotificationScheduler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAC
|
|
1
|
+
{"version":3,"file":"NotificationScheduler.d.ts","sourceRoot":"","sources":["../src/NotificationScheduler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;;AAE5E,wBAGiC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NotificationsEmitter.d.ts","sourceRoot":"","sources":["../src/NotificationsEmitter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,YAAY,EAAuB,MAAM,mBAAmB,CAAC;AAEpF,OAAO,EAAE,YAAY,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAW3E,eAAO,MAAM,yBAAyB,+CAA+C,CAAC;AAEtF;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,+BAA+B,CAC7C,QAAQ,EAAE,CAAC,KAAK,EAAE,YAAY,KAAK,IAAI,GACtC,YAAY,CAEd;AAED;;;;;;;GAOG;AACH,wBAAgB,+BAA+B,CAAC,QAAQ,EAAE,MAAM,IAAI,GAAG,YAAY,CAElF;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,uCAAuC,CACrD,QAAQ,EAAE,CAAC,KAAK,EAAE,oBAAoB,KAAK,IAAI,GAC9C,YAAY,
|
|
1
|
+
{"version":3,"file":"NotificationsEmitter.d.ts","sourceRoot":"","sources":["../src/NotificationsEmitter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,YAAY,EAAuB,MAAM,mBAAmB,CAAC;AAEpF,OAAO,EAAE,YAAY,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAW3E,eAAO,MAAM,yBAAyB,+CAA+C,CAAC;AAEtF;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,+BAA+B,CAC7C,QAAQ,EAAE,CAAC,KAAK,EAAE,YAAY,KAAK,IAAI,GACtC,YAAY,CAEd;AAED;;;;;;;GAOG;AACH,wBAAgB,+BAA+B,CAAC,QAAQ,EAAE,MAAM,IAAI,GAAG,YAAY,CAElF;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,uCAAuC,CACrD,QAAQ,EAAE,CAAC,KAAK,EAAE,oBAAoB,KAAK,IAAI,GAC9C,YAAY,CAoBd;AAED;;;;GAIG;AACH,wBAAgB,8BAA8B,CAAC,YAAY,EAAE,YAAY,QAExE;AAGD;;GAEG;AACH,wBAAsB,gCAAgC,IAAI,OAAO,CAAC,oBAAoB,GAAG,IAAI,CAAC,CAK7F"}
|
|
@@ -72,7 +72,21 @@ export function addNotificationsDroppedListener(listener) {
|
|
|
72
72
|
* @header listen
|
|
73
73
|
*/
|
|
74
74
|
export function addNotificationResponseReceivedListener(listener) {
|
|
75
|
-
return emitter.addListener(didReceiveNotificationResponseEventName,
|
|
75
|
+
return emitter.addListener(didReceiveNotificationResponseEventName, (response) => {
|
|
76
|
+
const mappedResponse = { ...response };
|
|
77
|
+
try {
|
|
78
|
+
const dataString = mappedResponse?.notification?.request?.content['dataString'];
|
|
79
|
+
if (typeof dataString === 'string') {
|
|
80
|
+
mappedResponse.notification.request.content.data = JSON.parse(dataString);
|
|
81
|
+
delete mappedResponse.notification.request.content.dataString;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
catch (e) {
|
|
85
|
+
console.log(`Error in response: ${e}`);
|
|
86
|
+
}
|
|
87
|
+
console.log(`response received: ${JSON.stringify(mappedResponse, null, 2)}`);
|
|
88
|
+
listener(mappedResponse);
|
|
89
|
+
});
|
|
76
90
|
}
|
|
77
91
|
/**
|
|
78
92
|
* Removes a notification subscription returned by an `addNotificationListener` call.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NotificationsEmitter.js","sourceRoot":"","sources":["../src/NotificationsEmitter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAgB,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AAkB,CAAC,YAAY,CAAC,CAAC;AAC3C,CAAC;AAED,eAAe;AACf;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,gCAAgC;IACpD,IAAI,CAAC,0BAA0B,CAAC,gCAAgC,EAAE;QAChE,MAAM,IAAI,mBAAmB,CAAC,mBAAmB,EAAE,kCAAkC,CAAC,CAAC;KACxF;IACD,OAAO,MAAM,0BAA0B,CAAC,gCAAgC,EAAE,CAAC;AAC7E,CAAC","sourcesContent":["import { EventEmitter, Subscription, UnavailabilityError } from 'expo-modules-core';\n\nimport { Notification, NotificationResponse } from './Notifications.types';\nimport NotificationsEmitterModule from './NotificationsEmitterModule';\n\n// Web uses SyntheticEventEmitter\nconst emitter = new EventEmitter(NotificationsEmitterModule);\n\nconst didReceiveNotificationEventName = 'onDidReceiveNotification';\nconst didDropNotificationsEventName = 'onNotificationsDeleted';\nconst didReceiveNotificationResponseEventName = 'onDidReceiveNotificationResponse';\n\n// @docsMissing\nexport const DEFAULT_ACTION_IDENTIFIER = 'expo.modules.notifications.actions.DEFAULT';\n\n/**\n * Listeners registered by this method will be called whenever a notification is received while the app is running.\n * @param listener A function accepting a notification ([`Notification`](#notification)) as an argument.\n * @return A [`Subscription`](#subscription) object represents the subscription of the provided listener.\n * @example Registering a notification listener using a React hook:\n * ```jsx\n * import React from 'react';\n * import * as Notifications from 'expo-notifications';\n *\n * export default function App() {\n * React.useEffect(() => {\n * const subscription = Notifications.addNotificationReceivedListener(notification => {\n * console.log(notification);\n * });\n * return () => subscription.remove();\n * }, []);\n *\n * return (\n * // Your app content\n * );\n * }\n * ```\n * @header listen\n */\nexport function addNotificationReceivedListener(\n listener: (event: Notification) => void\n): Subscription {\n return emitter.addListener<Notification>(didReceiveNotificationEventName, listener);\n}\n\n/**\n * Listeners registered by this method will be called whenever some notifications have been dropped by the server.\n * Applicable only to Firebase Cloud Messaging which we use as a notifications service on Android. It corresponds to `onDeletedMessages()` callback.\n * More information can be found in [Firebase docs](https://firebase.google.com/docs/cloud-messaging/android/receive#override-ondeletedmessages).\n * @param listener A callback function.\n * @return A [`Subscription`](#subscription) object represents the subscription of the provided listener.\n * @header listen\n */\nexport function addNotificationsDroppedListener(listener: () => void): Subscription {\n return emitter.addListener<void>(didDropNotificationsEventName, listener);\n}\n\n/**\n * Listeners registered by this method will be called whenever a user interacts with a notification (for example, taps on it).\n * @param listener A function accepting notification response ([`NotificationResponse`](#notificationresponse)) as an argument.\n * @return A [`Subscription`](#subscription) object represents the subscription of the provided listener.\n * @example Register a notification responder listener:\n * ```jsx\n * import React from 'react';\n * import { Linking } from 'react-native';\n * import * as Notifications from 'expo-notifications';\n *\n * export default function Container() {\n * React.useEffect(() => {\n * const subscription = Notifications.addNotificationResponseReceivedListener(response => {\n * const url = response.notification.request.content.data.url;\n * Linking.openURL(url);\n * });\n * return () => subscription.remove();\n * }, []);\n *\n * return (\n * // Your app content\n * );\n * }\n * ```\n * @header listen\n */\nexport function addNotificationResponseReceivedListener(\n listener: (event: NotificationResponse) => void\n): Subscription {\n return emitter.addListener<NotificationResponse>(\n didReceiveNotificationResponseEventName,\n (response: NotificationResponse) => {\n const mappedResponse: NotificationResponse & {\n notification: { request: { content: { dataString?: string } } };\n } = { ...response };\n try {\n const dataString = mappedResponse?.notification?.request?.content['dataString'];\n if (typeof dataString === 'string') {\n mappedResponse.notification.request.content.data = JSON.parse(dataString);\n delete mappedResponse.notification.request.content.dataString;\n }\n } catch (e: any) {\n console.log(`Error in response: ${e}`);\n }\n console.log(`response received: ${JSON.stringify(mappedResponse, null, 2)}`);\n listener(mappedResponse);\n }\n );\n}\n\n/**\n * Removes a notification subscription returned by an `addNotificationListener` call.\n * @param subscription A subscription returned by `addNotificationListener` method.\n * @header listen\n */\nexport function removeNotificationSubscription(subscription: Subscription) {\n emitter.removeSubscription(subscription);\n}\n\n// @docsMissing\n/**\n * @header listen\n */\nexport async function getLastNotificationResponseAsync(): Promise<NotificationResponse | null> {\n if (!NotificationsEmitterModule.getLastNotificationResponseAsync) {\n throw new UnavailabilityError('ExpoNotifications', 'getLastNotificationResponseAsync');\n }\n return await NotificationsEmitterModule.getLastNotificationResponseAsync();\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NotificationsEmitterModule.d.ts","sourceRoot":"","sources":["../src/NotificationsEmitterModule.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,0BAA0B,EAAE,MAAM,oCAAoC,CAAC
|
|
1
|
+
{"version":3,"file":"NotificationsEmitterModule.d.ts","sourceRoot":"","sources":["../src/NotificationsEmitterModule.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,0BAA0B,EAAE,MAAM,oCAAoC,CAAC;;AAIhF,wBAUgC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NotificationsEmitterModule.js","sourceRoot":"","sources":["../src/NotificationsEmitterModule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAI7C,IAAI,mBAAmB,GAAG,KAAK,CAAC;AAEhC,eAAe;IACb,WAAW,EAAE,GAAG,EAAE;QAChB,IAAI,CAAC,mBAAmB,EAAE
|
|
1
|
+
{"version":3,"file":"NotificationsEmitterModule.js","sourceRoot":"","sources":["../src/NotificationsEmitterModule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAI7C,IAAI,mBAAmB,GAAG,KAAK,CAAC;AAEhC,eAAe;IACb,WAAW,EAAE,GAAG,EAAE;QAChB,IAAI,CAAC,mBAAmB,EAAE;YACxB,OAAO,CAAC,IAAI,CACV,6EAA6E,QAAQ,CAAC,EAAE,0CAA0C,CACnI,CAAC;YACF,mBAAmB,GAAG,IAAI,CAAC;SAC5B;IACH,CAAC;IACD,eAAe,EAAE,GAAG,EAAE,GAAE,CAAC;CACI,CAAC","sourcesContent":["import { Platform } from 'expo-modules-core';\n\nimport { NotificationsEmitterModule } from './NotificationsEmitterModule.types';\n\nlet warningHasBeenShown = false;\n\nexport default {\n addListener: () => {\n if (!warningHasBeenShown) {\n console.warn(\n `[expo-notifications] Emitting notifications is not yet fully supported on ${Platform.OS}. Adding a listener will have no effect.`\n );\n warningHasBeenShown = true;\n }\n },\n removeListeners: () => {},\n} as NotificationsEmitterModule;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NotificationsHandler.js","sourceRoot":"","sources":["../src/NotificationsHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAgB,UAAU,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAGhG,OAAO,0BAA0B,MAAM,8BAA8B,CAAC;AAEtE;;GAEG;AACH,MAAM,OAAO,wBAAyB,SAAQ,UAAU;IACtD,IAAI,CAA6C;IACjD,YAAY,cAAsB,EAAE,YAA0B;QAC5D,KAAK,CAAC,0BAA0B,EAAE,0CAA0C,cAAc,GAAG,CAAC,CAAC;QAC/F,IAAI,CAAC,IAAI,GAAG,EAAE,EAAE,EAAE,cAAc,EAAE,YAAY,EAAE,CAAC;IACnD,CAAC;CACF;AAgCD,iCAAiC;AACjC,MAAM,mBAAmB,GAAG,IAAI,YAAY,CAAC,0BAA0B,CAAC,CAAC;AAEzE,MAAM,2BAA2B,GAAG,sBAAsB,CAAC;AAC3D,MAAM,kCAAkC,GAAG,6BAA6B,CAAC;AAEzE,IAAI,kBAAkB,GAAwB,IAAI,CAAC;AACnD,IAAI,yBAAyB,GAAwB,IAAI,CAAC;AAE1D;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAM,UAAU,sBAAsB,CAAC,OAAmC;IACxE,IAAI,kBAAkB,EAAE
|
|
1
|
+
{"version":3,"file":"NotificationsHandler.js","sourceRoot":"","sources":["../src/NotificationsHandler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAgB,UAAU,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAGhG,OAAO,0BAA0B,MAAM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AA0B,CAAC,uBAAuB,CAAC,EAAE,EAAE,QAAQ,CAAC,CAAC;gBACvE,OAAO,CAAC,aAAa,EAAE,CAAC,EAAE,CAAC,CAAC;aAC7B;YAAC,OAAO,KAAK,EAAE;gBACd,OAAO,CAAC,WAAW,EAAE,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC;aAClC;QACH,CAAC,CACF,CAAC;QAEF,yBAAyB,GAAG,mBAAmB,CAAC,WAAW,CACzD,kCAAkC,EAClC,CAAC,EAAE,EAAE,EAAE,YAAY,EAAE,EAAE,EAAE,CACvB,OAAO,CAAC,WAAW,EAAE,CAAC,EAAE,EAAE,IAAI,wBAAwB,CAAC,EAAE,EAAE,YAAY,CAAC,CAAC,CAC5E,CAAC;KACH;AACH,CAAC","sourcesContent":["import { EventEmitter, Subscription, CodedError, UnavailabilityError } from 'expo-modules-core';\n\nimport { Notification, NotificationBehavior } from './Notifications.types';\nimport NotificationsHandlerModule from './NotificationsHandlerModule';\n\n/**\n * @hidden\n */\nexport class NotificationTimeoutError extends CodedError {\n info: { notification: Notification; id: string };\n constructor(notificationId: string, notification: Notification) {\n super('ERR_NOTIFICATION_TIMEOUT', `Notification handling timed out for ID ${notificationId}.`);\n this.info = { id: notificationId, notification };\n }\n}\n\n// @docsMissing\nexport type NotificationHandlingError = NotificationTimeoutError | Error;\n\nexport interface NotificationHandler {\n /**\n * A function accepting an incoming notification returning a `Promise` resolving to a behavior ([`NotificationBehavior`](#notificationbehavior))\n * applicable to the notification\n * @param notification An object representing the notification.\n */\n handleNotification: (notification: Notification) => Promise<NotificationBehavior>;\n /**\n * A function called whenever an incoming notification is handled successfully.\n * @param notificationId Identifier of the notification.\n */\n handleSuccess?: (notificationId: string) => void;\n /**\n * A function called whenever handling of an incoming notification fails.\n * @param notificationId Identifier of the notification.\n * @param error An error which occurred in form of `NotificationHandlingError` object.\n */\n handleError?: (notificationId: string, error: NotificationHandlingError) => void;\n}\n\ntype HandleNotificationEvent = {\n id: string;\n notification: Notification;\n};\n\ntype HandleNotificationTimeoutEvent = HandleNotificationEvent;\n\n// Web uses SyntheticEventEmitter\nconst notificationEmitter = new EventEmitter(NotificationsHandlerModule);\n\nconst handleNotificationEventName = 'onHandleNotification';\nconst handleNotificationTimeoutEventName = 'onHandleNotificationTimeout';\n\nlet handleSubscription: Subscription | null = null;\nlet handleTimeoutSubscription: Subscription | null = null;\n\n/**\n * When a notification is received while the app is running, using this function you can set a callback that will decide\n * whether the notification should be shown to the user or not.\n *\n * When a notification is received, `handleNotification` is called with the incoming notification as an argument.\n * The function should respond with a behavior object within 3 seconds, otherwise, the notification will be discarded.\n * If the notification is handled successfully, `handleSuccess` is called with the identifier of the notification,\n * otherwise (or on timeout) `handleError` will be called.\n *\n * The default behavior when the handler is not set or does not respond in time is not to show the notification.\n * @param handler A single parameter which should be either `null` (if you want to clear the handler) or a [`NotificationHandler`](#notificationhandler) object.\n *\n * @example Implementing a notification handler that always shows the notification when it is received.\n * ```jsx\n * import * as Notifications from 'expo-notifications';\n *\n * Notifications.setNotificationHandler({\n * handleNotification: async () => ({\n * shouldShowAlert: true,\n * shouldPlaySound: false,\n * shouldSetBadge: false,\n * }),\n * });\n * ```\n * @header inForeground\n */\nexport function setNotificationHandler(handler: NotificationHandler | null): void {\n if (handleSubscription) {\n handleSubscription.remove();\n handleSubscription = null;\n }\n if (handleTimeoutSubscription) {\n handleTimeoutSubscription.remove();\n handleTimeoutSubscription = null;\n }\n\n if (handler) {\n handleSubscription = notificationEmitter.addListener<HandleNotificationEvent>(\n handleNotificationEventName,\n async ({ id, notification }) => {\n if (!NotificationsHandlerModule.handleNotificationAsync) {\n handler.handleError?.(\n id,\n new UnavailabilityError('Notifications', 'handleNotificationAsync')\n );\n return;\n }\n\n try {\n const behavior = await handler.handleNotification(notification);\n await NotificationsHandlerModule.handleNotificationAsync(id, behavior);\n handler.handleSuccess?.(id);\n } catch (error) {\n handler.handleError?.(id, error);\n }\n }\n );\n\n handleTimeoutSubscription = notificationEmitter.addListener<HandleNotificationTimeoutEvent>(\n handleNotificationTimeoutEventName,\n ({ id, notification }) =>\n handler.handleError?.(id, new NotificationTimeoutError(id, notification))\n );\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NotificationsHandlerModule.d.ts","sourceRoot":"","sources":["../src/NotificationsHandlerModule.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,0BAA0B,EAAE,MAAM,oCAAoC,CAAC
|
|
1
|
+
{"version":3,"file":"NotificationsHandlerModule.d.ts","sourceRoot":"","sources":["../src/NotificationsHandlerModule.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,0BAA0B,EAAE,MAAM,oCAAoC,CAAC;;AAIhF,wBAUgC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NotificationsHandlerModule.js","sourceRoot":"","sources":["../src/NotificationsHandlerModule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAI7C,IAAI,mBAAmB,GAAG,KAAK,CAAC;AAEhC,eAAe;IACb,WAAW,EAAE,GAAG,EAAE;QAChB,IAAI,CAAC,mBAAmB,EAAE
|
|
1
|
+
{"version":3,"file":"NotificationsHandlerModule.js","sourceRoot":"","sources":["../src/NotificationsHandlerModule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAI7C,IAAI,mBAAmB,GAAG,KAAK,CAAC;AAEhC,eAAe;IACb,WAAW,EAAE,GAAG,EAAE;QAChB,IAAI,CAAC,mBAAmB,EAAE;YACxB,OAAO,CAAC,IAAI,CACV,6EAA6E,QAAQ,CAAC,EAAE,+CAA+C,CACxI,CAAC;YACF,mBAAmB,GAAG,IAAI,CAAC;SAC5B;IACH,CAAC;IACD,eAAe,EAAE,GAAG,EAAE,GAAE,CAAC;CACI,CAAC","sourcesContent":["import { Platform } from 'expo-modules-core';\n\nimport { NotificationsHandlerModule } from './NotificationsHandlerModule.types';\n\nlet warningHasBeenShown = false;\n\nexport default {\n addListener: () => {\n if (!warningHasBeenShown) {\n console.warn(\n `[expo-notifications] Notifications handling is not yet fully supported on ${Platform.OS}. Handling notifications will have no effect.`\n );\n warningHasBeenShown = true;\n }\n },\n removeListeners: () => {},\n} as NotificationsHandlerModule;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PushTokenManager.d.ts","sourceRoot":"","sources":["../src/PushTokenManager.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC
|
|
1
|
+
{"version":3,"file":"PushTokenManager.d.ts","sourceRoot":"","sources":["../src/PushTokenManager.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;;AAIlE,wBAU4B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PushTokenManager.js","sourceRoot":"","sources":["../src/PushTokenManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAI7C,IAAI,mBAAmB,GAAG,KAAK,CAAC;AAEhC,eAAe;IACb,WAAW,EAAE,GAAG,EAAE;QAChB,IAAI,CAAC,mBAAmB,EAAE
|
|
1
|
+
{"version":3,"file":"PushTokenManager.js","sourceRoot":"","sources":["../src/PushTokenManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAI7C,IAAI,mBAAmB,GAAG,KAAK,CAAC;AAEhC,eAAe;IACb,WAAW,EAAE,GAAG,EAAE;QAChB,IAAI,CAAC,mBAAmB,EAAE;YACxB,OAAO,CAAC,IAAI,CACV,sFAAsF,QAAQ,CAAC,EAAE,0CAA0C,CAC5I,CAAC;YACF,mBAAmB,GAAG,IAAI,CAAC;SAC5B;IACH,CAAC;IACD,eAAe,EAAE,GAAG,EAAE,GAAE,CAAC;CACA,CAAC","sourcesContent":["import { Platform } from 'expo-modules-core';\n\nimport { PushTokenManagerModule } from './PushTokenManager.types';\n\nlet warningHasBeenShown = false;\n\nexport default {\n addListener: () => {\n if (!warningHasBeenShown) {\n console.warn(\n `[expo-notifications] Listening to push token changes is not yet fully supported on ${Platform.OS}. Adding a listener will have no effect.`\n );\n warningHasBeenShown = true;\n }\n },\n removeListeners: () => {},\n} as PushTokenManagerModule;\n"]}
|