expo-notifications 0.27.7 → 0.28.1
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 +14 -12
- package/README.md +1 -1
- package/android/build.gradle +7 -93
- package/android/src/main/java/expo/modules/notifications/NotificationsPackage.java +0 -2
- package/android/src/main/java/expo/modules/notifications/badge/BadgeModule.kt +1 -1
- package/android/src/main/java/expo/modules/notifications/notifications/channels/NotificationChannelGroupManagerModule.kt +2 -1
- package/android/src/main/java/expo/modules/notifications/notifications/channels/NotificationChannelManagerModule.kt +1 -1
- package/android/src/main/java/expo/modules/notifications/notifications/emitting/NotificationsEmitter.kt +5 -12
- package/android/src/main/java/expo/modules/notifications/notifications/handling/NotificationsHandler.kt +7 -1
- package/android/src/main/java/expo/modules/notifications/notifications/handling/SingleNotificationHandlerTask.java +8 -4
- package/android/src/main/java/expo/modules/notifications/serverregistration/ServerRegistrationModule.kt +2 -2
- package/android/src/main/java/expo/modules/notifications/service/NotificationsService.kt +0 -1
- package/build/NotificationChannelManager.types.d.ts +1 -2
- package/build/NotificationChannelManager.types.d.ts.map +1 -1
- package/build/NotificationChannelManager.types.js.map +1 -1
- package/build/NotificationScheduler.types.d.ts +2 -14
- package/build/NotificationScheduler.types.d.ts.map +1 -1
- package/build/NotificationScheduler.types.js.map +1 -1
- package/build/Notifications.types.d.ts +25 -14
- package/build/Notifications.types.d.ts.map +1 -1
- package/build/Notifications.types.js.map +1 -1
- package/build/Tokens.types.d.ts +8 -8
- package/build/Tokens.types.d.ts.map +1 -1
- package/build/Tokens.types.js.map +1 -1
- package/build/getDevicePushTokenAsync.web.js +2 -2
- package/build/getDevicePushTokenAsync.web.js.map +1 -1
- package/build/useLastNotificationResponse.d.ts +2 -1
- package/build/useLastNotificationResponse.d.ts.map +1 -1
- package/build/useLastNotificationResponse.js +2 -1
- package/build/useLastNotificationResponse.js.map +1 -1
- package/package.json +5 -5
- package/src/NotificationChannelManager.types.ts +1 -1
- package/src/NotificationScheduler.types.ts +6 -16
- package/src/Notifications.types.ts +28 -13
- package/src/Tokens.types.ts +12 -8
- package/src/getDevicePushTokenAsync.web.ts +2 -2
- package/src/useLastNotificationResponse.ts +2 -1
package/CHANGELOG.md
CHANGED
|
@@ -10,25 +10,27 @@
|
|
|
10
10
|
|
|
11
11
|
### 💡 Others
|
|
12
12
|
|
|
13
|
-
## 0.
|
|
13
|
+
## 0.28.1 — 2024-04-23
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
- [iOS] Add privacy manifest describing required reason API usage. ([#27770](https://github.com/expo/expo/pull/27770) by [@aleqsio](https://github.com/aleqsio))
|
|
15
|
+
_This version does not introduce any user-facing changes._
|
|
18
16
|
|
|
19
|
-
## 0.
|
|
17
|
+
## 0.28.0 — 2024-04-18
|
|
20
18
|
|
|
21
19
|
### 🐛 Bug fixes
|
|
22
20
|
|
|
23
|
-
-
|
|
24
|
-
|
|
25
|
-
|
|
21
|
+
- [Android] Fix notifications events were using an incorrect event emitter. ([#28207](https://github.com/expo/expo/pull/28207) by [@lukmccall](https://github.com/lukmccall))
|
|
22
|
+
|
|
23
|
+
### 💡 Others
|
|
24
|
+
|
|
25
|
+
- [iOS] Add privacy manifest describing required reason API usage. ([#27770](https://github.com/expo/expo/pull/27770) by [@aleqsio](https://github.com/aleqsio))
|
|
26
|
+
- drop unused web `name` property. ([#27437](https://github.com/expo/expo/pull/27437) by [@EvanBacon](https://github.com/EvanBacon))
|
|
27
|
+
- Removed deprecated backward compatible Gradle settings. ([#28083](https://github.com/expo/expo/pull/28083) by [@kudo](https://github.com/kudo))
|
|
26
28
|
|
|
27
|
-
## 0.27.5
|
|
29
|
+
## 0.27.5 - 2024-01-25
|
|
28
30
|
|
|
29
31
|
_This version does not introduce any user-facing changes._
|
|
30
32
|
|
|
31
|
-
## 0.27.4
|
|
33
|
+
## 0.27.4 - 2024-01-20
|
|
32
34
|
|
|
33
35
|
### 🐛 Bug fixes
|
|
34
36
|
|
|
@@ -36,13 +38,13 @@ _This version does not introduce any user-facing changes._
|
|
|
36
38
|
- Remove `.native` hardcoded platform imports ([#26511](https://github.com/expo/expo/pull/26511) by [@marklawlor](https://github.com/marklawlor))
|
|
37
39
|
- On `Android`, added events to module definition to clear warnings. ([#26654](https://github.com/expo/expo/pull/26654) by [@alanjhughes](https://github.com/alanjhughes))
|
|
38
40
|
|
|
39
|
-
## 0.27.3
|
|
41
|
+
## 0.27.3 - 2024-01-10
|
|
40
42
|
|
|
41
43
|
### 🐛 Bug fixes
|
|
42
44
|
|
|
43
45
|
- [Android] Fix `expo-notifications` requiring the `expo-task-manager` module to start. ([#26227](https://github.com/expo/expo/pull/26227) by [@behenate](https://github.com/behenate))
|
|
44
46
|
|
|
45
|
-
## 0.27.2
|
|
47
|
+
## 0.27.2 - 2023-12-19
|
|
46
48
|
|
|
47
49
|
_This version does not introduce any user-facing changes._
|
|
48
50
|
|
package/README.md
CHANGED
|
@@ -517,7 +517,7 @@ A single and required argument is a subscription returned by `addPushTokenListen
|
|
|
517
517
|
|
|
518
518
|
## Listening to notification events
|
|
519
519
|
|
|
520
|
-
Notification events include incoming notifications, interactions your users perform with notifications (this can be tapping on a notification, or interacting with it via [notification categories](#
|
|
520
|
+
Notification events include incoming notifications, interactions your users perform with notifications (this can be tapping on a notification, or interacting with it via [notification categories](#manage-notification-categories-interactive-notifications)), and rare occasions when your notifications may be dropped.
|
|
521
521
|
|
|
522
522
|
A few different listeners are exposed, so we've provided a chart below which will hopefully help you understand when you can expect each one to be triggered:
|
|
523
523
|
|
package/android/build.gradle
CHANGED
|
@@ -1,100 +1,20 @@
|
|
|
1
1
|
apply plugin: 'com.android.library'
|
|
2
|
-
apply plugin: 'kotlin-android'
|
|
3
|
-
apply plugin: 'maven-publish'
|
|
4
2
|
|
|
5
3
|
group = 'host.exp.exponent'
|
|
6
|
-
version = '0.
|
|
4
|
+
version = '0.28.1'
|
|
7
5
|
|
|
8
6
|
def expoModulesCorePlugin = new File(project(":expo-modules-core").projectDir.absolutePath, "ExpoModulesCorePlugin.gradle")
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
useExpoPublishing()
|
|
15
|
-
useCoreDependencies()
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
buildscript {
|
|
20
|
-
// Simple helper that allows the root project to override versions declared by this library.
|
|
21
|
-
ext.safeExtGet = { prop, fallback ->
|
|
22
|
-
rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
// Ensures backward compatibility
|
|
26
|
-
ext.getKotlinVersion = {
|
|
27
|
-
if (ext.has("kotlinVersion")) {
|
|
28
|
-
ext.kotlinVersion()
|
|
29
|
-
} else {
|
|
30
|
-
ext.safeExtGet("kotlinVersion", "1.8.10")
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
repositories {
|
|
35
|
-
mavenCentral()
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
dependencies {
|
|
39
|
-
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${getKotlinVersion()}")
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
// Remove this if and it's contents, when support for SDK49 is dropped
|
|
44
|
-
if (!safeExtGet("expoProvidesDefaultConfig", false)) {
|
|
45
|
-
afterEvaluate {
|
|
46
|
-
publishing {
|
|
47
|
-
publications {
|
|
48
|
-
release(MavenPublication) {
|
|
49
|
-
from components.release
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
repositories {
|
|
53
|
-
maven {
|
|
54
|
-
url = mavenLocal().url
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
}
|
|
7
|
+
apply from: expoModulesCorePlugin
|
|
8
|
+
applyKotlinExpoModulesCorePlugin()
|
|
9
|
+
useCoreDependencies()
|
|
10
|
+
useDefaultAndroidSdkVersions()
|
|
11
|
+
useExpoPublishing()
|
|
60
12
|
|
|
61
13
|
android {
|
|
62
|
-
// Remove this if and it's contents, when support for SDK49 is dropped
|
|
63
|
-
if (!safeExtGet("expoProvidesDefaultConfig", false)) {
|
|
64
|
-
compileSdkVersion safeExtGet("compileSdkVersion", 34)
|
|
65
|
-
|
|
66
|
-
defaultConfig {
|
|
67
|
-
minSdkVersion safeExtGet("minSdkVersion", 23)
|
|
68
|
-
targetSdkVersion safeExtGet("targetSdkVersion", 34)
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
publishing {
|
|
72
|
-
singleVariant("release") {
|
|
73
|
-
withSourcesJar()
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
lintOptions {
|
|
78
|
-
abortOnError false
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
def agpVersion = com.android.Version.ANDROID_GRADLE_PLUGIN_VERSION
|
|
83
|
-
if (agpVersion.tokenize('.')[0].toInteger() < 8) {
|
|
84
|
-
compileOptions {
|
|
85
|
-
sourceCompatibility JavaVersion.VERSION_11
|
|
86
|
-
targetCompatibility JavaVersion.VERSION_11
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
kotlinOptions {
|
|
90
|
-
jvmTarget = JavaVersion.VERSION_11.majorVersion
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
|
|
94
14
|
namespace "expo.modules.notifications"
|
|
95
15
|
defaultConfig {
|
|
96
16
|
versionCode 21
|
|
97
|
-
versionName '0.
|
|
17
|
+
versionName '0.28.1'
|
|
98
18
|
}
|
|
99
19
|
|
|
100
20
|
buildFeatures {
|
|
@@ -103,12 +23,6 @@ android {
|
|
|
103
23
|
}
|
|
104
24
|
|
|
105
25
|
dependencies {
|
|
106
|
-
// Remove this if and it's contents, when support for SDK49 is dropped
|
|
107
|
-
if (!safeExtGet("expoProvidesDefaultConfig", false)) {
|
|
108
|
-
implementation project(':expo-modules-core')
|
|
109
|
-
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:${getKotlinVersion()}"
|
|
110
|
-
}
|
|
111
|
-
|
|
112
26
|
api 'androidx.core:core:1.5.0'
|
|
113
27
|
api 'androidx.lifecycle:lifecycle-runtime:2.2.0'
|
|
114
28
|
api 'androidx.lifecycle:lifecycle-process:2.2.0'
|
|
@@ -6,11 +6,9 @@ import java.util.Arrays;
|
|
|
6
6
|
import java.util.List;
|
|
7
7
|
|
|
8
8
|
import expo.modules.core.BasePackage;
|
|
9
|
-
import expo.modules.core.ExportedModule;
|
|
10
9
|
import expo.modules.core.interfaces.InternalModule;
|
|
11
10
|
import expo.modules.core.interfaces.SingletonModule;
|
|
12
11
|
import expo.modules.notifications.notifications.NotificationManager;
|
|
13
|
-
import expo.modules.notifications.notifications.categories.ExpoNotificationCategoriesModule;
|
|
14
12
|
import expo.modules.notifications.notifications.categories.serializers.ExpoNotificationsCategoriesSerializer;
|
|
15
13
|
import expo.modules.notifications.notifications.channels.AndroidXNotificationsChannelsProvider;
|
|
16
14
|
import expo.modules.notifications.tokens.PushTokenManager;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
package expo.modules.notifications.notifications.channels
|
|
2
2
|
|
|
3
3
|
import android.os.Build
|
|
4
|
+
import android.os.Bundle
|
|
4
5
|
import expo.modules.core.arguments.ReadableArguments
|
|
5
6
|
import expo.modules.kotlin.modules.Module
|
|
6
7
|
import expo.modules.kotlin.modules.ModuleDefinition
|
|
@@ -34,7 +35,7 @@ class NotificationChannelGroupManagerModule : Module() {
|
|
|
34
35
|
}
|
|
35
36
|
}
|
|
36
37
|
|
|
37
|
-
AsyncFunction("getNotificationChannelGroupsAsync") {
|
|
38
|
+
AsyncFunction<List<Bundle?>?>("getNotificationChannelGroupsAsync") {
|
|
38
39
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
|
39
40
|
groupManager
|
|
40
41
|
.notificationChannelGroups
|
|
@@ -30,7 +30,7 @@ open class NotificationChannelManagerModule : Module() {
|
|
|
30
30
|
channelSerializer = provider.channelSerializer
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
AsyncFunction("getNotificationChannelsAsync") {
|
|
33
|
+
AsyncFunction<List<Bundle?>>("getNotificationChannelsAsync") {
|
|
34
34
|
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) {
|
|
35
35
|
return@AsyncFunction emptyList<Bundle>()
|
|
36
36
|
}
|
|
@@ -4,7 +4,6 @@ import android.os.Bundle
|
|
|
4
4
|
import expo.modules.core.interfaces.services.EventEmitter
|
|
5
5
|
import expo.modules.kotlin.modules.Module
|
|
6
6
|
import expo.modules.kotlin.modules.ModuleDefinition
|
|
7
|
-
import expo.modules.notifications.ModuleNotFoundException
|
|
8
7
|
import expo.modules.notifications.notifications.NotificationSerializer
|
|
9
8
|
import expo.modules.notifications.notifications.interfaces.NotificationListener
|
|
10
9
|
import expo.modules.notifications.notifications.interfaces.NotificationManager
|
|
@@ -30,9 +29,6 @@ open class NotificationsEmitter : Module(), NotificationListener {
|
|
|
30
29
|
)
|
|
31
30
|
|
|
32
31
|
OnCreate {
|
|
33
|
-
eventEmitter = appContext.legacyModule<EventEmitter>()
|
|
34
|
-
?: throw ModuleNotFoundException(EventEmitter::class)
|
|
35
|
-
|
|
36
32
|
// Register the module as a listener in NotificationManager singleton module.
|
|
37
33
|
// Deregistration happens in onDestroy callback.
|
|
38
34
|
notificationManager = requireNotNull(appContext.legacyModuleRegistry.getSingletonModule("NotificationManager", NotificationManager::class.java))
|
|
@@ -43,7 +39,7 @@ open class NotificationsEmitter : Module(), NotificationListener {
|
|
|
43
39
|
notificationManager.removeListener(this@NotificationsEmitter)
|
|
44
40
|
}
|
|
45
41
|
|
|
46
|
-
AsyncFunction("getLastNotificationResponseAsync") {
|
|
42
|
+
AsyncFunction<Bundle?>("getLastNotificationResponseAsync") {
|
|
47
43
|
lastNotificationResponse?.let(NotificationSerializer::toBundle)
|
|
48
44
|
}
|
|
49
45
|
}
|
|
@@ -55,7 +51,7 @@ open class NotificationsEmitter : Module(), NotificationListener {
|
|
|
55
51
|
* @param notification Notification received
|
|
56
52
|
*/
|
|
57
53
|
override fun onNotificationReceived(notification: Notification) {
|
|
58
|
-
|
|
54
|
+
sendEvent(NEW_MESSAGE_EVENT_NAME, NotificationSerializer.toBundle(notification))
|
|
59
55
|
}
|
|
60
56
|
|
|
61
57
|
/**
|
|
@@ -67,11 +63,8 @@ open class NotificationsEmitter : Module(), NotificationListener {
|
|
|
67
63
|
*/
|
|
68
64
|
override fun onNotificationResponseReceived(response: NotificationResponse): Boolean {
|
|
69
65
|
lastNotificationResponse = response
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
return true
|
|
73
|
-
}
|
|
74
|
-
return false
|
|
66
|
+
sendEvent(NEW_RESPONSE_EVENT_NAME, NotificationSerializer.toBundle(response))
|
|
67
|
+
return true
|
|
75
68
|
}
|
|
76
69
|
|
|
77
70
|
/**
|
|
@@ -79,6 +72,6 @@ open class NotificationsEmitter : Module(), NotificationListener {
|
|
|
79
72
|
* Emits a [MESSAGES_DELETED_EVENT_NAME] event.
|
|
80
73
|
*/
|
|
81
74
|
override fun onNotificationsDropped() {
|
|
82
|
-
|
|
75
|
+
sendEvent(MESSAGES_DELETED_EVENT_NAME, Bundle.EMPTY)
|
|
83
76
|
}
|
|
84
77
|
}
|
|
@@ -115,7 +115,13 @@ open class NotificationsHandler : Module(), NotificationListener {
|
|
|
115
115
|
*/
|
|
116
116
|
override fun onNotificationReceived(notification: Notification) {
|
|
117
117
|
val context = appContext.reactContext ?: return
|
|
118
|
-
val task = SingleNotificationHandlerTask(
|
|
118
|
+
val task = SingleNotificationHandlerTask(
|
|
119
|
+
context,
|
|
120
|
+
appContext.eventEmitter(this),
|
|
121
|
+
handler,
|
|
122
|
+
notification,
|
|
123
|
+
this
|
|
124
|
+
)
|
|
119
125
|
tasksMap[task.identifier] = task
|
|
120
126
|
task.start()
|
|
121
127
|
}
|
|
@@ -5,10 +5,8 @@ import android.os.Bundle;
|
|
|
5
5
|
import android.os.Handler;
|
|
6
6
|
import android.os.ResultReceiver;
|
|
7
7
|
|
|
8
|
-
import expo.modules.core.ModuleRegistry;
|
|
9
8
|
import expo.modules.core.Promise;
|
|
10
9
|
import expo.modules.core.interfaces.services.EventEmitter;
|
|
11
|
-
|
|
12
10
|
import expo.modules.notifications.notifications.NotificationSerializer;
|
|
13
11
|
import expo.modules.notifications.notifications.model.Notification;
|
|
14
12
|
import expo.modules.notifications.notifications.model.NotificationBehavior;
|
|
@@ -42,10 +40,16 @@ public class SingleNotificationHandlerTask {
|
|
|
42
40
|
|
|
43
41
|
private Runnable mTimeoutRunnable = SingleNotificationHandlerTask.this::handleTimeout;
|
|
44
42
|
|
|
45
|
-
/* package */ SingleNotificationHandlerTask(
|
|
43
|
+
/* package */ SingleNotificationHandlerTask(
|
|
44
|
+
Context context,
|
|
45
|
+
EventEmitter eventEmitter,
|
|
46
|
+
Handler handler,
|
|
47
|
+
Notification notification,
|
|
48
|
+
NotificationsHandler delegate
|
|
49
|
+
) {
|
|
46
50
|
mContext = context;
|
|
47
51
|
mHandler = handler;
|
|
48
|
-
mEventEmitter =
|
|
52
|
+
mEventEmitter = eventEmitter;
|
|
49
53
|
mNotification = notification;
|
|
50
54
|
mDelegate = delegate;
|
|
51
55
|
}
|
|
@@ -15,9 +15,9 @@ open class ServerRegistrationModule : Module() {
|
|
|
15
15
|
override fun definition() = ModuleDefinition {
|
|
16
16
|
Name("NotificationsServerRegistrationModule")
|
|
17
17
|
|
|
18
|
-
AsyncFunction("getInstallationIdAsync", this@ServerRegistrationModule::getInstallationId)
|
|
18
|
+
AsyncFunction<String>("getInstallationIdAsync", this@ServerRegistrationModule::getInstallationId)
|
|
19
19
|
|
|
20
|
-
AsyncFunction("getRegistrationInfoAsync") {
|
|
20
|
+
AsyncFunction<String?>("getRegistrationInfoAsync") {
|
|
21
21
|
mRegistrationInfo.get()
|
|
22
22
|
}
|
|
23
23
|
|
|
@@ -593,7 +593,6 @@ open class NotificationsService : BroadcastReceiver() {
|
|
|
593
593
|
}
|
|
594
594
|
|
|
595
595
|
open fun handleIntent(context: Context, intent: Intent?) {
|
|
596
|
-
Log.e("dupa", intent.toString())
|
|
597
596
|
if (intent != null && SETUP_ACTIONS.contains(intent.action)) {
|
|
598
597
|
onSetupScheduledNotifications(context, intent)
|
|
599
598
|
} else if (intent?.action === NOTIFICATION_EVENT_ACTION) {
|
|
@@ -72,7 +72,7 @@ export interface NotificationChannel {
|
|
|
72
72
|
enableLights: boolean;
|
|
73
73
|
enableVibrate: boolean;
|
|
74
74
|
}
|
|
75
|
-
type RequiredBy<T, K extends keyof T> = Partial<Omit<T, K>> & Required<Pick<T, K>>;
|
|
75
|
+
export type RequiredBy<T, K extends keyof T> = Partial<Omit<T, K>> & Required<Pick<T, K>>;
|
|
76
76
|
/**
|
|
77
77
|
* An object represents a notification channel to be set.
|
|
78
78
|
* @platform android
|
|
@@ -87,5 +87,4 @@ export interface NotificationChannelManager extends ProxyNativeModule {
|
|
|
87
87
|
setNotificationChannelAsync?: (channelId: string, channelConfiguration: NotificationChannelInput) => Promise<NotificationChannel | null>;
|
|
88
88
|
deleteNotificationChannelAsync?: (channelId: string) => Promise<void>;
|
|
89
89
|
}
|
|
90
|
-
export {};
|
|
91
90
|
//# sourceMappingURL=NotificationChannelManager.types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NotificationChannelManager.types.d.ts","sourceRoot":"","sources":["../src/NotificationChannelManager.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAGtD,oBAAY,6BAA6B;IACvC,OAAO,IAAI;IACX,MAAM,IAAI;IACV,OAAO,IAAI;IACX,MAAM,IAAI;CACX;AAGD,oBAAY,uBAAuB;IACjC,OAAO,IAAI;IACX,MAAM,IAAI;IACV,KAAK,IAAI;IACT,KAAK,IAAI;IACT,YAA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ACjC,gBAAgB,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;IAClC,YAAY,EAAE,OAAO,CAAC;IACtB,aAAa,EAAE,OAAO,CAAC;CACxB;AAED,
|
|
1
|
+
{"version":3,"file":"NotificationChannelManager.types.d.ts","sourceRoot":"","sources":["../src/NotificationChannelManager.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAGtD,oBAAY,6BAA6B;IACvC,OAAO,IAAI;IACX,MAAM,IAAI;IACV,OAAO,IAAI;IACX,MAAM,IAAI;CACX;AAGD,oBAAY,uBAAuB;IACjC,OAAO,IAAI;IACX,MAAM,IAAI;IACV,KAAK,IAAI;IACT,KAAK,IAAI;IACT,YAAY,IAAI;CACjB;AAGD,oBAAY,iBAAiB;IAC3B,OAAO,IAAI;IACX,WAAW,IAAI;IACf,IAAI,IAAI;IACR,GAAG,IAAI;IACP,GAAG,IAAI;IACP,OAAO,IAAI;IACX;;OAEG;IACH,QAAQ,IAAI;IACZ,IAAI,IAAI;IACR,GAAG,IAAI;CACR;AAGD,oBAAY,iBAAiB;IAC3B,OAAO,IAAI;IACX,KAAK,IAAI;IACT,mBAAmB,IAAI;IACvB,8BAA8B,IAAI;IAClC,KAAK,IAAI;IACT,YAAY,IAAI;IAChB,qBAAqB,IAAI;IACzB,kCAAkC,IAAI;IACtC,kCAAkC,IAAI;IACtC,kCAAkC,IAAI;IACtC,kBAAkB,KAAK;IACvB,wBAAwB,KAAK;IAC7B,8BAA8B,KAAK;IACnC,uBAAuB,KAAK;IAC5B,IAAI,KAAK;CACV;AAGD,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,iBAAiB,CAAC;IACzB,WAAW,EAAE,uBAAuB,CAAC;IACrC,KAAK,EAAE;QACL,iBAAiB,EAAE,OAAO,CAAC;QAC3B,wCAAwC,EAAE,OAAO,CAAC;KACnD,CAAC;CACH;AAKD,MAAM,MAAM,oBAAoB,GAAG,OAAO,CAAC,e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B,GAAG,IAAI,CAAC,CAAC;IACzF,2BAA2B,CAAC,EAAE,CAC5B,SAAS,EAAE,MAAM,EACjB,oBAAoB,EAAE,wBAAwB,KAC3C,OAAO,CAAC,mBAAmB,GAAG,IAAI,CAAC,CAAC;IACzC,8BAA8B,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CACvE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NotificationChannelManager.types.js","sourceRoot":"","sources":["../src/NotificationChannelManager.types.ts"],"names":[],"mappings":"AAEA,eAAe;AACf,MAAM,CAAN,IAAY,6BAKX;AALD,WAAY,6BAA6B;IACvC,uFAAW,CAAA;IACX,qFAAU,CAAA;IACV,uFAAW,CAAA;IACX,qFAAU,CAAA;AACZ,CAAC,EALW,6BAA6B,KAA7B,6BAA6B,QAKxC;AAED,eAAe;AACf,MAAM,CAAN,IAAY,uBAMX;AAND,WAAY,uBAAuB;IACjC,2EAAW,CAAA;IACX,yEAAU,CAAA;IACV,uEAAS,CAAA;IACT,uEAAS,CAAA;IACT,qFAAgB,CAAA;AAClB,CAAC,EANW,uBAAuB,KAAvB,uBAAuB,QAMlC;AAED,eAAe;AACf,MAAM,CAAN,IAAY,iBAaX;AAbD,WAAY,iBAAiB;IAC3B,+DAAW,CAAA;IACX,uEAAe,CAAA;IACf,yDAAQ,CAAA;IACR,uDAAO,CAAA;IACP,uDAAO,CAAA;IACP,+DAAW,CAAA;IACX;;OAEG;IACH,iEAAY,CAAA;IACZ,yDAAQ,CAAA;IACR,uDAAO,CAAA;AACT,CAAC,EAbW,iBAAiB,KAAjB,iBAAiB,QAa5B;AAED,eAAe;AACf,MAAM,CAAN,IAAY,iBAgBX;AAhBD,WAAY,iBAAiB;IAC3B,+DAAW,CAAA;IACX,2DAAS,CAAA;IACT,uFAAuB,CAAA;IACvB,6GAAkC,CAAA;IAClC,2DAAS,CAAA;IACT,yEAAgB,CAAA;IAChB,2FAAyB,CAAA;IACzB,qHAAsC,CAAA;IACtC,qHAAsC,CAAA;IACtC,qHAAsC,CAAA;IACtC,sFAAuB,CAAA;IACvB,kGAA6B,CAAA;IAC7B,8GAAmC,CAAA;IACnC,gGAA4B,CAAA;IAC5B,0DAAS,CAAA;AACX,CAAC,EAhBW,iBAAiB,KAAjB,iBAAiB,QAgB5B","sourcesContent":["import { ProxyNativeModule } from 'expo-modules-core';\n\n// @docsMissing\nexport enum AndroidNotificationVisibility {\n UNKNOWN = 0,\n PUBLIC = 1,\n PRIVATE = 2,\n SECRET = 3,\n}\n\n// @docsMissing\nexport enum AndroidAudioContentType {\n UNKNOWN = 0,\n SPEECH = 1,\n MUSIC = 2,\n MOVIE = 3,\n SONIFICATION = 4,\n}\n\n// @docsMissing\nexport enum AndroidImportance {\n UNKNOWN = 0,\n UNSPECIFIED = 1,\n NONE = 2,\n MIN = 3,\n LOW = 4,\n DEFAULT = 5,\n /**\n * @deprecated Use `DEFAULT` instead.\n */\n DEEFAULT = 5,\n HIGH = 6,\n MAX = 7,\n}\n\n// @docsMissing\nexport enum AndroidAudioUsage {\n UNKNOWN = 0,\n MEDIA = 1,\n VOICE_COMMUNICATION = 2,\n VOICE_COMMUNICATION_SIGNALLING = 3,\n ALARM = 4,\n NOTIFICATION = 5,\n NOTIFICATION_RINGTONE = 6,\n NOTIFICATION_COMMUNICATION_REQUEST = 7,\n NOTIFICATION_COMMUNICATION_INSTANT = 8,\n NOTIFICATION_COMMUNICATION_DELAYED = 9,\n NOTIFICATION_EVENT = 10,\n ASSISTANCE_ACCESSIBILITY = 11,\n ASSISTANCE_NAVIGATION_GUIDANCE = 12,\n ASSISTANCE_SONIFICATION = 13,\n GAME = 14,\n}\n\n// @docsMissing\nexport interface AudioAttributes {\n usage: AndroidAudioUsage;\n contentType: AndroidAudioContentType;\n flags: {\n enforceAudibility: boolean;\n requestHardwareAudioVideoSynchronization: boolean;\n };\n}\n\n// We're making inner flags required to set intentionally.\n// Not providing `true` for a flag makes it false, it doesn't make sense\n// to let it be left undefined.\nexport type AudioAttributesInput = Partial<AudioAttributes>;\n\n/**\n * An object represents a notification channel.\n * @platform android\n */\nexport interface NotificationChannel {\n id: string;\n name: string | null;\n importance: AndroidImportance;\n bypassDnd: boolean;\n description: string | null;\n groupId?: string | null;\n lightColor: string;\n lockscreenVisibility: AndroidNotificationVisibility;\n showBadge: boolean;\n sound: 'default' | 'custom' | null;\n audioAttributes: AudioAttributes;\n vibrationPattern: number[] | null;\n enableLights: boolean;\n enableVibrate: boolean;\n}\n\
|
|
1
|
+
{"version":3,"file":"NotificationChannelManager.types.js","sourceRoot":"","sources":["../src/NotificationChannelManager.types.ts"],"names":[],"mappings":"AAEA,eAAe;AACf,MAAM,CAAN,IAAY,6BAKX;AALD,WAAY,6BAA6B;IACvC,uFAAW,CAAA;IACX,qFAAU,CAAA;IACV,uFAAW,CAAA;IACX,qFAAU,CAAA;AACZ,CAAC,EALW,6BAA6B,KAA7B,6BAA6B,QAKxC;AAED,eAAe;AACf,MAAM,CAAN,IAAY,uBAMX;AAND,WAAY,uBAAuB;IACjC,2EAAW,CAAA;IACX,yEAAU,CAAA;IACV,uEAAS,CAAA;IACT,uEAAS,CAAA;IACT,qFAAgB,CAAA;AAClB,CAAC,EANW,uBAAuB,KAAvB,uBAAuB,QAMlC;AAED,eAAe;AACf,MAAM,CAAN,IAAY,iBAaX;AAbD,WAAY,iBAAiB;IAC3B,+DAAW,CAAA;IACX,uEAAe,CAAA;IACf,yDAAQ,CAAA;IACR,uDAAO,CAAA;IACP,uDAAO,CAAA;IACP,+DAAW,CAAA;IACX;;OAEG;IACH,iEAAY,CAAA;IACZ,yDAAQ,CAAA;IACR,uDAAO,CAAA;AACT,CAAC,EAbW,iBAAiB,KAAjB,iBAAiB,QAa5B;AAED,eAAe;AACf,MAAM,CAAN,IAAY,iBAgBX;AAhBD,WAAY,iBAAiB;IAC3B,+DAAW,CAAA;IACX,2DAAS,CAAA;IACT,uFAAuB,CAAA;IACvB,6GAAkC,CAAA;IAClC,2DAAS,CAAA;IACT,yEAAgB,CAAA;IAChB,2FAAyB,CAAA;IACzB,qHAAsC,CAAA;IACtC,qHAAsC,CAAA;IACtC,qHAAsC,CAAA;IACtC,sFAAuB,CAAA;IACvB,kGAA6B,CAAA;IAC7B,8GAAmC,CAAA;IACnC,gGAA4B,CAAA;IAC5B,0DAAS,CAAA;AACX,CAAC,EAhBW,iBAAiB,KAAjB,iBAAiB,QAgB5B","sourcesContent":["import { ProxyNativeModule } from 'expo-modules-core';\n\n// @docsMissing\nexport enum AndroidNotificationVisibility {\n UNKNOWN = 0,\n PUBLIC = 1,\n PRIVATE = 2,\n SECRET = 3,\n}\n\n// @docsMissing\nexport enum AndroidAudioContentType {\n UNKNOWN = 0,\n SPEECH = 1,\n MUSIC = 2,\n MOVIE = 3,\n SONIFICATION = 4,\n}\n\n// @docsMissing\nexport enum AndroidImportance {\n UNKNOWN = 0,\n UNSPECIFIED = 1,\n NONE = 2,\n MIN = 3,\n LOW = 4,\n DEFAULT = 5,\n /**\n * @deprecated Use `DEFAULT` instead.\n */\n DEEFAULT = 5,\n HIGH = 6,\n MAX = 7,\n}\n\n// @docsMissing\nexport enum AndroidAudioUsage {\n UNKNOWN = 0,\n MEDIA = 1,\n VOICE_COMMUNICATION = 2,\n VOICE_COMMUNICATION_SIGNALLING = 3,\n ALARM = 4,\n NOTIFICATION = 5,\n NOTIFICATION_RINGTONE = 6,\n NOTIFICATION_COMMUNICATION_REQUEST = 7,\n NOTIFICATION_COMMUNICATION_INSTANT = 8,\n NOTIFICATION_COMMUNICATION_DELAYED = 9,\n NOTIFICATION_EVENT = 10,\n ASSISTANCE_ACCESSIBILITY = 11,\n ASSISTANCE_NAVIGATION_GUIDANCE = 12,\n ASSISTANCE_SONIFICATION = 13,\n GAME = 14,\n}\n\n// @docsMissing\nexport interface AudioAttributes {\n usage: AndroidAudioUsage;\n contentType: AndroidAudioContentType;\n flags: {\n enforceAudibility: boolean;\n requestHardwareAudioVideoSynchronization: boolean;\n };\n}\n\n// We're making inner flags required to set intentionally.\n// Not providing `true` for a flag makes it false, it doesn't make sense\n// to let it be left undefined.\nexport type AudioAttributesInput = Partial<AudioAttributes>;\n\n/**\n * An object represents a notification channel.\n * @platform android\n */\nexport interface NotificationChannel {\n id: string;\n name: string | null;\n importance: AndroidImportance;\n bypassDnd: boolean;\n description: string | null;\n groupId?: string | null;\n lightColor: string;\n lockscreenVisibility: AndroidNotificationVisibility;\n showBadge: boolean;\n sound: 'default' | 'custom' | null;\n audioAttributes: AudioAttributes;\n vibrationPattern: number[] | null;\n enableLights: boolean;\n enableVibrate: boolean;\n}\n\nexport type RequiredBy<T, K extends keyof T> = Partial<Omit<T, K>> & Required<Pick<T, K>>;\n\n/**\n * An object represents a notification channel to be set.\n * @platform android\n */\nexport type NotificationChannelInput = RequiredBy<\n Omit<\n NotificationChannel,\n | 'id' // id is handled separately as a function argument\n | 'audioAttributes' // need to make it AudioAttributesInput\n | 'sound'\n > & { audioAttributes?: AudioAttributesInput; sound?: string | null },\n 'name' | 'importance'\n>;\n\nexport interface NotificationChannelManager extends ProxyNativeModule {\n getNotificationChannelsAsync?: () => Promise<NotificationChannel[] | null>;\n getNotificationChannelAsync?: (channelId: string) => Promise<NotificationChannel | null>;\n setNotificationChannelAsync?: (\n channelId: string,\n channelConfiguration: NotificationChannelInput\n ) => Promise<NotificationChannel | null>;\n deleteNotificationChannelAsync?: (channelId: string) => Promise<void>;\n}\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ProxyNativeModule } from 'expo-modules-core';
|
|
2
|
-
import { NotificationRequest, NotificationContentInput } from './Notifications.types';
|
|
2
|
+
import { NotificationRequest, NotificationContentInput, CalendarTriggerInputValue } from './Notifications.types';
|
|
3
3
|
export interface NotificationSchedulerModule extends ProxyNativeModule {
|
|
4
4
|
getAllScheduledNotificationsAsync?: () => Promise<NotificationRequest[]>;
|
|
5
5
|
scheduleNotificationAsync?: (identifier: string, notificationContent: NotificationContentInput, trigger: NotificationTriggerInput) => Promise<string>;
|
|
@@ -15,19 +15,7 @@ export interface CalendarTriggerInput {
|
|
|
15
15
|
type: 'calendar';
|
|
16
16
|
channelId?: string;
|
|
17
17
|
repeats?: boolean;
|
|
18
|
-
value:
|
|
19
|
-
timezone?: string;
|
|
20
|
-
year?: number;
|
|
21
|
-
month?: number;
|
|
22
|
-
weekday?: number;
|
|
23
|
-
weekOfMonth?: number;
|
|
24
|
-
weekOfYear?: number;
|
|
25
|
-
weekdayOrdinal?: number;
|
|
26
|
-
day?: number;
|
|
27
|
-
hour?: number;
|
|
28
|
-
minute?: number;
|
|
29
|
-
second?: number;
|
|
30
|
-
};
|
|
18
|
+
value: CalendarTriggerInputValue;
|
|
31
19
|
}
|
|
32
20
|
export interface TimeIntervalTriggerInput {
|
|
33
21
|
type: 'timeInterval';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NotificationScheduler.types.d.ts","sourceRoot":"","sources":["../src/NotificationScheduler.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAEtD,OAAO,
|
|
1
|
+
{"version":3,"file":"NotificationScheduler.types.d.ts","sourceRoot":"","sources":["../src/NotificationScheduler.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAEtD,OAAO,EACL,mBAAmB,EACnB,wBAAwB,EACxB,yBAAyB,EAC1B,MAAM,uBAAuB,CAAC;AAE/B,MAAM,WAAW,2BAA4B,SAAQ,iBAAiB;IACpE,iCAAiC,CAAC,EAAE,MAAM,OAAO,CAAC,mBAAmB,EAAE,CAAC,CAAC;IACzE,yBAAyB,CAAC,EAAE,CAC1B,UAAU,EAAE,MAAM,EAClB,mBAAmB,EAAE,wBAAwB,EAC7C,OAAO,EAAE,wBAAwB,KAC9B,OAAO,CAAC,MAAM,CAAC,CAAC;IACrB,gCAAgC,CAAC,EAAE,CAA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,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,MAAM,wBAAwB,GAChC,IAAI,GACJ,wBAAwB,GACxB,gBAAgB,GAChB,oBAAoB,GACpB,wBAAwB,GACxB,iBAAiB,GACjB,kBAAkB,GAClB,kBAAkB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NotificationScheduler.types.js","sourceRoot":"","sources":["../src/NotificationScheduler.types.ts"],"names":[],"mappings":"","sourcesContent":["import { ProxyNativeModule } from 'expo-modules-core';\n\nimport {
|
|
1
|
+
{"version":3,"file":"NotificationScheduler.types.js","sourceRoot":"","sources":["../src/NotificationScheduler.types.ts"],"names":[],"mappings":"","sourcesContent":["import { ProxyNativeModule } from 'expo-modules-core';\n\nimport {\n NotificationRequest,\n NotificationContentInput,\n CalendarTriggerInputValue,\n} from './Notifications.types';\n\nexport interface NotificationSchedulerModule extends ProxyNativeModule {\n getAllScheduledNotificationsAsync?: () => Promise<NotificationRequest[]>;\n scheduleNotificationAsync?: (\n identifier: string,\n notificationContent: NotificationContentInput,\n trigger: NotificationTriggerInput\n ) => Promise<string>;\n cancelScheduledNotificationAsync?: (identifier: string) => Promise<void>;\n cancelAllScheduledNotificationsAsync?: () => Promise<void>;\n getNextTriggerDateAsync?: (trigger: NotificationTriggerInput) => Promise<number>;\n}\n\nexport interface ChannelAwareTriggerInput {\n type: 'channel';\n channelId?: string;\n}\n\n// ISO8601 calendar pattern-matching\nexport interface CalendarTriggerInput {\n type: 'calendar';\n channelId?: string;\n repeats?: boolean;\n value: CalendarTriggerInputValue;\n}\n\nexport interface TimeIntervalTriggerInput {\n type: 'timeInterval';\n channelId?: string;\n repeats: boolean;\n seconds: number;\n}\n\nexport interface DailyTriggerInput {\n type: 'daily';\n channelId?: string;\n hour: number;\n minute: number;\n}\n\nexport interface WeeklyTriggerInput {\n type: 'weekly';\n channelId?: string;\n weekday: number;\n hour: number;\n minute: number;\n}\n\nexport interface YearlyTriggerInput {\n type: 'yearly';\n channelId?: string;\n day: number;\n month: number;\n hour: number;\n minute: number;\n}\n\nexport interface DateTriggerInput {\n type: 'date';\n channelId?: string;\n timestamp: number; // seconds since 1970\n}\n\nexport type NotificationTriggerInput =\n | null\n | ChannelAwareTriggerInput\n | DateTriggerInput\n | CalendarTriggerInput\n | TimeIntervalTriggerInput\n | DailyTriggerInput\n | WeeklyTriggerInput\n | YearlyTriggerInput;\n"]}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type { PermissionExpiration, PermissionResponse, PermissionStatus, Subscription } from 'expo-modules-core';
|
|
2
|
-
import { CalendarTriggerInput as NativeCalendarTriggerInput } from './NotificationScheduler.types';
|
|
3
2
|
/**
|
|
4
3
|
* An object represents a notification delivered by a push notification system.
|
|
5
4
|
*
|
|
@@ -49,7 +48,7 @@ export interface CalendarNotificationTrigger {
|
|
|
49
48
|
* The region used to determine when the system sends the notification.
|
|
50
49
|
* @platform ios
|
|
51
50
|
*/
|
|
52
|
-
interface Region {
|
|
51
|
+
export interface Region {
|
|
53
52
|
type: string;
|
|
54
53
|
/**
|
|
55
54
|
* The identifier for the region object.
|
|
@@ -168,9 +167,7 @@ export interface YearlyNotificationTrigger {
|
|
|
168
167
|
*/
|
|
169
168
|
export interface FirebaseRemoteMessage {
|
|
170
169
|
collapseKey: string | null;
|
|
171
|
-
data:
|
|
172
|
-
[key: string]: string;
|
|
173
|
-
};
|
|
170
|
+
data: Record<string, string>;
|
|
174
171
|
from: string | null;
|
|
175
172
|
messageId: string | null;
|
|
176
173
|
messageType: string | null;
|
|
@@ -225,12 +222,25 @@ export type NotificationTrigger = PushNotificationTrigger | CalendarNotification
|
|
|
225
222
|
export type ChannelAwareTriggerInput = {
|
|
226
223
|
channelId: string;
|
|
227
224
|
};
|
|
225
|
+
export type CalendarTriggerInputValue = {
|
|
226
|
+
timezone?: string;
|
|
227
|
+
year?: number;
|
|
228
|
+
month?: number;
|
|
229
|
+
weekday?: number;
|
|
230
|
+
weekOfMonth?: number;
|
|
231
|
+
weekOfYear?: number;
|
|
232
|
+
weekdayOrdinal?: number;
|
|
233
|
+
day?: number;
|
|
234
|
+
hour?: number;
|
|
235
|
+
minute?: number;
|
|
236
|
+
second?: number;
|
|
237
|
+
};
|
|
228
238
|
/**
|
|
229
239
|
* A trigger that will cause the notification to be delivered once or many times when the date components match the specified values.
|
|
230
240
|
* Corresponds to native [`UNCalendarNotificationTrigger`](https://developer.apple.com/documentation/usernotifications/uncalendarnotificationtrigger?language=objc).
|
|
231
241
|
* @platform ios
|
|
232
242
|
*/
|
|
233
|
-
export type CalendarTriggerInput =
|
|
243
|
+
export type CalendarTriggerInput = CalendarTriggerInputValue & {
|
|
234
244
|
channelId?: string;
|
|
235
245
|
repeats?: boolean;
|
|
236
246
|
};
|
|
@@ -462,9 +472,11 @@ export type NotificationContentInput = {
|
|
|
462
472
|
*/
|
|
463
473
|
color?: string;
|
|
464
474
|
/**
|
|
465
|
-
* If set to `
|
|
466
|
-
*
|
|
467
|
-
*
|
|
475
|
+
* If set to `false`, the notification will not be automatically dismissed when clicked.
|
|
476
|
+
* The setting will be used when the value is not provided or is invalid is set to `true`, and the notification
|
|
477
|
+
* will be dismissed automatically anyway. Corresponds directly to Android's `setAutoCancel` behavior.
|
|
478
|
+
*
|
|
479
|
+
* See [Android developer documentation](https://developer.android.com/reference/android/app/Notification.Builder#setAutoCancel(boolean))
|
|
468
480
|
* for more details.
|
|
469
481
|
* @platform android
|
|
470
482
|
*/
|
|
@@ -475,12 +487,11 @@ export type NotificationContentInput = {
|
|
|
475
487
|
*/
|
|
476
488
|
categoryIdentifier?: string;
|
|
477
489
|
/**
|
|
478
|
-
* If set to `
|
|
479
|
-
*
|
|
480
|
-
*
|
|
481
|
-
* behavior. In Firebase terms this property of a notification is called `sticky`.
|
|
490
|
+
* If set to `true`, the notification cannot be dismissed by swipe. This setting defaults
|
|
491
|
+
* to `false` if not provided or is invalid. Corresponds directly do Android's `isOngoing` behavior.
|
|
492
|
+
* In Firebase terms this property of a notification is called `sticky`.
|
|
482
493
|
*
|
|
483
|
-
* See [Android developer documentation](https://developer.android.com/reference/android/app/Notification.Builder#
|
|
494
|
+
* See [Android developer documentation](https://developer.android.com/reference/android/app/Notification.Builder#setOngoing(boolean))
|
|
484
495
|
* and [Firebase documentation](https://firebase.google.com/docs/reference/fcm/rest/v1/projects.messages#AndroidNotification.FIELDS.sticky)
|
|
485
496
|
* for more details.
|
|
486
497
|
* @platform android
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Notifications.types.d.ts","sourceRoot":"","sources":["../src/Notifications.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,oBAAoB,EACpB,kBAAkB,EAClB,gBAAgB,EAChB,YAAY,EACb,MAAM,mBAAmB,CAAC;AAE3B
|
|
1
|
+
{"version":3,"file":"Notifications.types.d.ts","sourceRoot":"","sources":["../src/Notifications.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,oBAAoB,EACpB,kBAAkB,EAClB,gBAAgB,EAChB,YAAY,EACb,MAAM,mBAAmB,CAAC;AAE3B;;;;;;GAMG;AACH,MAAM,MAAM,uBAAuB,GAAG;IACpC,IAAI,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAClC;;OAEG;IACH,aAAa,CAAC,EAAE,qBAAqB,CAAC;CACvC,CAAC;AAEF;;;GAGG;AACH,MAAM,WAAW,2BAA2B;IAC1C,IAAI,EAAE,UAAU,CAAC;IACjB,OAAO,EAAE,OAAO,CAAC;IACjB,cAAc,EAAE;QACd,GAAG,CAAC,EAAE,MAAM,CAAC;QACb,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,GAAG,CAAC,EAAE,MAAM,CAAC;QACb,IAAI,CAAC,EAAE,M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;;OAIG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B;;;OAGG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;;OAGG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB;;;OAGG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC7B,CAAC;AAEF,YAAY,EAAE,YAAY,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Notifications.types.js","sourceRoot":"","sources":["../src/Notifications.types.ts"],"names":[],"mappings":"AAmVA;;GAEG;AACH,MAAM,CAAN,IAAY,2BAMX;AAND,WAAY,2BAA2B;IACrC,0CAAW,CAAA;IACX,0CAAW,CAAA;IACX,kDAAmB,CAAA;IACnB,4CAAa,CAAA;IACb,0CAAW,CAAA;AACb,CAAC,EANW,2BAA2B,KAA3B,2BAA2B,QAMtC","sourcesContent":["import type {\n PermissionExpiration,\n PermissionResponse,\n PermissionStatus,\n Subscription,\n} from 'expo-modules-core';\n\nimport { CalendarTriggerInput as NativeCalendarTriggerInput } from './NotificationScheduler.types';\n\n/**\n * An object represents a notification delivered by a push notification system.\n *\n * On Android under `remoteMessage` field a JS version of the Firebase `RemoteMessage` may be accessed.\n * On iOS under `payload` you may find full contents of [`UNNotificationContent`'s](https://developer.apple.com/documentation/usernotifications/unnotificationcontent?language=objc) [`userInfo`](https://developer.apple.com/documentation/usernotifications/unnotificationcontent/1649869-userinfo?language=objc), for example [remote notification payload](https://developer.apple.com/library/archive/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/CreatingtheNotificationPayload.html)\n * On web there is no extra data.\n */\nexport type PushNotificationTrigger = {\n type: 'push';\n /**\n * @platform ios\n */\n payload?: Record<string, unknown>;\n /**\n * @platform android\n */\n remoteMessage?: FirebaseRemoteMessage;\n};\n\n/**\n * A trigger related to a [`UNCalendarNotificationTrigger`](https://developer.apple.com/documentation/usernotifications/uncalendarnotificationtrigger?language=objc).\n * @platform ios\n */\nexport interface CalendarNotificationTrigger {\n type: 'calendar';\n repeats: boolean;\n dateComponents: {\n era?: number;\n year?: number;\n month?: number;\n day?: number;\n hour?: number;\n minute?: number;\n second?: number;\n weekday?: number;\n weekdayOrdinal?: number;\n quarter?: number;\n weekOfMonth?: number;\n weekOfYear?: number;\n yearForWeekOfYear?: number;\n nanosecond?: number;\n isLeapMonth: boolean;\n timeZone?: string;\n calendar?: string;\n };\n}\n\n/**\n * The region used to determine when the system sends the notification.\n * @platform ios\n */\ninterface Region {\n type: string;\n /**\n * The identifier for the region object.\n */\n identifier: string;\n /**\n * A Boolean indicating that notifications are generated upon entry into the region.\n */\n notifyOnEntry: boolean;\n /**\n * A Boolean indicating that notifications are generated upon exit from the region.\n */\n notifyOnExit: boolean;\n}\n\n/**\n * A circular geographic region, specified as a center point and radius. Based on Core Location [`CLCircularRegion`](https://developer.apple.com/documentation/corelocation/clcircularregion) class.\n * @platform ios\n */\nexport interface CircularRegion extends Region {\n type: 'circular';\n /**\n * The radius (measured in meters) that defines the geographic area’s outer boundary.\n */\n radius: number;\n /**\n * The center point of the geographic area.\n */\n center: {\n latitude: number;\n longitude: number;\n };\n}\n\n/**\n * A region used to detect the presence of iBeacon devices. Based on Core Location [`CLBeaconRegion`](https://developer.apple.com/documentation/corelocation/clbeaconregion) class.\n * @platform ios\n */\nexport interface BeaconRegion extends Region {\n type: 'beacon';\n /**\n * A Boolean value that indicates whether Core Location sends beacon notifications when the device’s display is on.\n */\n notifyEntryStateOnDisplay: boolean;\n /**\n * The major value from the beacon identity constraint that defines the beacon region.\n */\n major: number | null;\n /**\n * The minor value from the beacon identity constraint that defines the beacon region.\n */\n minor: number | null;\n /**\n * The UUID value from the beacon identity constraint that defines the beacon region.\n */\n uuid?: string;\n /**\n * The beacon identity constraint that defines the beacon region.\n */\n beaconIdentityConstraint?: {\n uuid: string;\n major: number | null;\n minor: number | null;\n };\n}\n\n/**\n * A trigger related to a [`UNLocationNotificationTrigger`](https://developer.apple.com/documentation/usernotifications/unlocationnotificationtrigger?language=objc).\n * @platform ios\n */\nexport interface LocationNotificationTrigger {\n type: 'location';\n repeats: boolean;\n region: CircularRegion | BeaconRegion;\n}\n\n/**\n * A trigger related to an elapsed time interval. May be repeating (see `repeats` field).\n */\nexport interface TimeIntervalNotificationTrigger {\n type: 'timeInterval';\n repeats: boolean;\n seconds: number;\n}\n\n/**\n * A trigger related to a daily notification.\n * > The same functionality will be achieved on iOS with a `CalendarNotificationTrigger`.\n * @platform android\n */\nexport interface DailyNotificationTrigger {\n type: 'daily';\n hour: number;\n minute: number;\n}\n\n/**\n * A trigger related to a weekly notification.\n * > The same functionality will be achieved on iOS with a `CalendarNotificationTrigger`.\n * @platform android\n */\nexport interface WeeklyNotificationTrigger {\n type: 'weekly';\n weekday: number;\n hour: number;\n minute: number;\n}\n\n/**\n * A trigger related to a yearly notification.\n * > The same functionality will be achieved on iOS with a `CalendarNotificationTrigger`.\n * @platform android\n */\nexport interface YearlyNotificationTrigger {\n type: 'yearly';\n day: number;\n month: number;\n hour: number;\n minute: number;\n}\n\n// @docsMissing\n/**\n * A Firebase `RemoteMessage` that caused the notification to be delivered to the app.\n */\nexport interface FirebaseRemoteMessage {\n collapseKey: string | null;\n data: { [key: string]: string };\n from: string | null;\n messageId: string | null;\n messageType: string | null;\n originalPriority: number;\n priority: number;\n sentTime: number;\n to: string | null;\n ttl: number;\n notification: null | FirebaseRemoteMessageNotification;\n}\n\n// @docsMissing\nexport interface FirebaseRemoteMessageNotification {\n body: string | null;\n bodyLocalizationArgs: string[] | null;\n bodyLocalizationKey: string | null;\n channelId: string | null;\n clickAction: string | null;\n color: string | null;\n usesDefaultLightSettings: boolean;\n usesDefaultSound: boolean;\n usesDefaultVibrateSettings: boolean;\n eventTime: number | null;\n icon: string | null;\n imageUrl: string | null;\n lightSettings: number[] | null;\n link: string | null;\n localOnly: boolean;\n notificationCount: number | null;\n notificationPriority: number | null;\n sound: string | null;\n sticky: boolean;\n tag: string | null;\n ticker: string | null;\n title: string | null;\n titleLocalizationArgs: string[] | null;\n titleLocalizationKey: string | null;\n vibrateTimings: number[] | null;\n visibility: number | null;\n}\n\n/**\n * Represents a notification trigger that is unknown to `expo-notifications` and that it didn't know how to serialize for JS.\n */\nexport interface UnknownNotificationTrigger {\n type: 'unknown';\n}\n\n/**\n * A union type containing different triggers which may cause the notification to be delivered to the application.\n */\nexport type NotificationTrigger =\n | PushNotificationTrigger\n | CalendarNotificationTrigger\n | LocationNotificationTrigger\n | TimeIntervalNotificationTrigger\n | DailyNotificationTrigger\n | WeeklyNotificationTrigger\n | YearlyNotificationTrigger\n | UnknownNotificationTrigger;\n\n/**\n * A trigger that will cause the notification to be delivered immediately.\n */\nexport type ChannelAwareTriggerInput = {\n channelId: string;\n};\n\n/**\n * A trigger that will cause the notification to be delivered once or many times when the date components match the specified values.\n * Corresponds to native [`UNCalendarNotificationTrigger`](https://developer.apple.com/documentation/usernotifications/uncalendarnotificationtrigger?language=objc).\n * @platform ios\n */\nexport type CalendarTriggerInput = NativeCalendarTriggerInput['value'] & {\n channelId?: string;\n repeats?: boolean;\n};\n\n/**\n * A trigger that will cause the notification to be delivered once or many times (depends on the `repeats` field) after `seconds` time elapse.\n * > **On iOS**, when `repeats` is `true`, the time interval must be 60 seconds or greater. Otherwise, the notification won't be triggered.\n */\nexport interface TimeIntervalTriggerInput {\n channelId?: string;\n repeats?: boolean;\n seconds: number;\n}\n\n/**\n * A trigger that will cause the notification to be delivered once per day.\n */\nexport interface DailyTriggerInput {\n channelId?: string;\n hour: number;\n minute: number;\n repeats: true;\n}\n\n/**\n * A trigger that will cause the notification to be delivered once every week.\n * > **Note:** Weekdays are specified with a number from `1` through `7`, with `1` indicating Sunday.\n */\nexport interface WeeklyTriggerInput {\n channelId?: string;\n weekday: number;\n hour: number;\n minute: number;\n repeats: true;\n}\n\n/**\n * A trigger that will cause the notification to be delivered once every year.\n * > **Note:** all properties are specified in JavaScript Date's ranges.\n */\nexport interface YearlyTriggerInput {\n channelId?: string;\n day: number;\n month: number;\n hour: number;\n minute: number;\n repeats: true;\n}\n\n/**\n * A trigger that will cause the notification to be delivered once at the specified `Date`.\n * If you pass in a `number` it will be interpreted as a Unix timestamp.\n */\nexport type DateTriggerInput = Date | number | { channelId?: string; date: Date | number };\n\n/**\n * A type represents time-based, schedulable triggers. For these triggers you can check the next trigger date\n * with [`getNextTriggerDateAsync`](#notificationsgetnexttriggerdateasynctrigger).\n */\nexport type SchedulableNotificationTriggerInput =\n | DateTriggerInput\n | TimeIntervalTriggerInput\n | DailyTriggerInput\n | WeeklyTriggerInput\n | YearlyTriggerInput\n | CalendarTriggerInput;\n\n/**\n * A type represents possible triggers with which you can schedule notifications.\n * A `null` trigger means that the notification should be scheduled for delivery immediately.\n */\nexport type NotificationTriggerInput =\n | null\n | ChannelAwareTriggerInput\n | SchedulableNotificationTriggerInput;\n\n/**\n * An enum corresponding to values appropriate for Android's [`Notification#priority`](https://developer.android.com/reference/android/app/Notification#priority) field.\n */\nexport enum AndroidNotificationPriority {\n MIN = 'min',\n LOW = 'low',\n DEFAULT = 'default',\n HIGH = 'high',\n MAX = 'max',\n}\n\n/**\n * An object represents notification's content.\n */\nexport type NotificationContent = {\n /**\n * Notification title - the bold text displayed above the rest of the content.\n */\n title: string | null;\n /**\n * On Android: `subText` - the display depends on the device.\n *\n * On iOS: `subtitle` - the bold text displayed between title and the rest of the content.\n */\n subtitle: string | null;\n /**\n * Notification body - the main content of the notification.\n */\n body: string | null;\n /**\n * Data associated with the notification, not displayed\n */\n data: Record<string, any>;\n sound: 'default' | 'defaultCritical' | 'custom' | null;\n} & (NotificationContentIos | NotificationContentAndroid);\n\n/**\n * See [Apple documentation](https://developer.apple.com/documentation/usernotifications/unnotificationcontent?language=objc) for more information on specific fields.\n */\nexport type NotificationContentIos = {\n /**\n * The name of the image or storyboard to use when your app launches because of the notification.\n */\n launchImageName: string | null;\n /**\n * The number that your app’s icon displays.\n */\n badge: number | null;\n /**\n * The visual and audio attachments to display alongside the notification’s main content.\n */\n attachments: NotificationContentAttachmentIos[];\n /**\n * The text the system adds to the notification summary to provide additional context.\n */\n summaryArgument?: string | null;\n /**\n * The number the system adds to the notification summary when the notification represents multiple items.\n */\n summaryArgumentCount?: number;\n /**\n * The identifier of the notification’s category.\n */\n categoryIdentifier: string | null;\n /**\n * The identifier that groups related notifications.\n */\n threadIdentifier: string | null;\n /**\n * The value your app uses to determine which scene to display to handle the notification.\n */\n targetContentIdentifier?: string;\n};\n\n// @docsMissing\n/**\n * @platform ios\n */\nexport type NotificationContentAttachmentIos = {\n identifier: string | null;\n url: string | null;\n type: string | null;\n typeHint?: string;\n hideThumbnail?: boolean;\n thumbnailClipArea?: { x: number; y: number; width: number; height: number };\n thumbnailTime?: number;\n};\n\n/**\n * See [Android developer documentation](https://developer.android.com/reference/android/app/Notification#fields) for more information on specific fields.\n */\nexport type NotificationContentAndroid = {\n /**\n * Application badge number associated with the notification.\n */\n badge?: number;\n /**\n * Accent color (in `#AARRGGBB` or `#RRGGBB` format) to be applied by the standard Style templates when presenting this notification.\n */\n color?: string;\n /**\n * Relative priority for this notification. Priority is an indication of how much of the user's valuable attention should be consumed by this notification.\n * Low-priority notifications may be hidden from the user in certain situations, while the user might be interrupted for a higher-priority notification.\n * The system will make a determination about how to interpret this priority when presenting the notification.\n */\n priority?: AndroidNotificationPriority;\n /**\n * The pattern with which to vibrate.\n */\n vibrationPattern?: number[];\n};\n\n/**\n * An object represents a request to present a notification. It has content — how it's being represented, and a trigger — what triggers the notification.\n * Many notifications ([`Notification`](#notification)) may be triggered with the same request (for example, a repeating notification).\n */\nexport interface NotificationRequest {\n identifier: string;\n content: NotificationContent;\n trigger: NotificationTrigger;\n}\n\n// TODO(simek): asses if we can base this type on `NotificationContent`, since most of the fields looks like repetition\n/**\n * An object represents notification content that you pass in to `presentNotificationAsync` or as a part of `NotificationRequestInput`.\n */\nexport type NotificationContentInput = {\n /**\n * Notification title - the bold text displayed above the rest of the content.\n */\n title?: string | null;\n /**\n * On Android: `subText` - the display depends on the device.\n *\n * On iOS: `subtitle` - the bold text displayed between title and the rest of the content.\n */\n subtitle?: string | null;\n /**\n * The main content of the notification.\n */\n body?: string | null;\n /**\n * Data associated with the notification, not displayed.\n */\n data?: Record<string, any>;\n /**\n * Application badge number associated with the notification.\n */\n badge?: number;\n sound?: boolean | string;\n /**\n * The name of the image or storyboard to use when your app launches because of the notification.\n */\n launchImageName?: string;\n /**\n * The pattern with which to vibrate.\n * @platform android\n */\n vibrate?: number[];\n /**\n * Relative priority for this notification. Priority is an indication of how much of the user's valuable attention should be consumed by this notification.\n * Low-priority notifications may be hidden from the user in certain situations, while the user might be interrupted for a higher-priority notification.\n * The system will make a determination about how to interpret this priority when presenting the notification.\n * @platform android\n */\n priority?: string;\n /**\n * Accent color (in `#AARRGGBB` or `#RRGGBB` format) to be applied by the standard Style templates when presenting this notification.\n * @platform android\n */\n color?: string;\n /**\n * If set to `true`, the notification cannot be dismissed by swipe. This setting defaults\n * to `false` if not provided or is invalid. Corresponds directly do Android's `isOngoing` behavior.\n * See [Android developer documentation](https://developer.android.com/reference/android/app/Notification.Builder#setOngoing(boolean))\n * for more details.\n * @platform android\n */\n autoDismiss?: boolean;\n /**\n * The identifier of the notification’s category.\n * @platform ios\n */\n categoryIdentifier?: string;\n /**\n * If set to `false`, the notification will not be automatically dismissed when clicked.\n * the setting used when the value is not provided or is invalid is `true` (the notification\n * will be dismissed automatically). Corresponds directly to Android's `setAutoCancel`\n * behavior. In Firebase terms this property of a notification is called `sticky`.\n *\n * See [Android developer documentation](https://developer.android.com/reference/android/app/Notification.Builder#setAutoCancel(boolean))\n * and [Firebase documentation](https://firebase.google.com/docs/reference/fcm/rest/v1/projects.messages#AndroidNotification.FIELDS.sticky)\n * for more details.\n * @platform android\n */\n sticky?: boolean;\n /**\n * The visual and audio attachments to display alongside the notification’s main content.\n * @platform ios\n */\n attachments?: NotificationContentAttachmentIos[];\n};\n\n/**\n * An object represents a notification request you can pass into `scheduleNotificationAsync`.\n */\nexport interface NotificationRequestInput {\n identifier?: string;\n content: NotificationContentInput;\n trigger: NotificationTriggerInput;\n}\n\n/**\n * An object represents a single notification that has been triggered by some request ([`NotificationRequest`](#notificationrequest)) at some point in time.\n */\nexport interface Notification {\n date: number;\n request: NotificationRequest;\n}\n\n/**\n * An object represents user's interaction with the notification.\n * > **Note:** If the user taps on a notification `actionIdentifier` will be equal to [`Notifications.DEFAULT_ACTION_IDENTIFIER`](#notificationsdefault_action_identifier).\n */\nexport interface NotificationResponse {\n notification: Notification;\n actionIdentifier: string;\n userText?: string;\n}\n\n/**\n * An object represents behavior that should be applied to the incoming notification.\n * > On Android, setting `shouldPlaySound: false` will result in the drop-down notification alert **not** showing, no matter what the priority is.\n * > This setting will also override any channel-specific sounds you may have configured.\n */\nexport interface NotificationBehavior {\n shouldShowAlert: boolean;\n shouldPlaySound: boolean;\n shouldSetBadge: boolean;\n priority?: AndroidNotificationPriority;\n}\n\nexport interface NotificationAction {\n /**\n * A unique string that identifies this action. If a user takes this action (for example, selects this button in the system's Notification UI),\n * your app will receive this `actionIdentifier` via the [`NotificationResponseReceivedListener`](#addnotificationresponsereceivedlistenerlistener).\n */\n identifier: string;\n /**\n * The title of the button triggering this action.\n */\n buttonTitle: string;\n /**\n * Object which, if provided, will result in a button that prompts the user for a text response.\n */\n textInput?: {\n /**\n * A string which will be used as the title for the button used for submitting the text response.\n * @platform ios\n */\n submitButtonTitle: string;\n /**\n * A string that serves as a placeholder until the user begins typing. Defaults to no placeholder string.\n */\n placeholder: string;\n };\n /**\n * Object representing the additional configuration options.\n */\n options?: {\n /**\n * Boolean indicating whether the button title will be highlighted a different color (usually red).\n * This usually signifies a destructive action such as deleting data.\n * @platform ios\n */\n isDestructive?: boolean;\n /**\n * Boolean indicating whether triggering the action will require authentication from the user.\n * @platform ios\n */\n isAuthenticationRequired?: boolean;\n /**\n * Boolean indicating whether triggering this action foregrounds the app.\n * If `false` and your app is killed (not just backgrounded), [`NotificationResponseReceived` listeners](#addnotificationresponsereceivedlistenerlistener)\n * will not be triggered when a user selects this action.\n * @default true\n */\n opensAppToForeground?: boolean;\n };\n}\n\n// @docsMissing\nexport interface NotificationCategory {\n identifier: string;\n actions: NotificationAction[];\n options?: NotificationCategoryOptions;\n}\n\n/**\n * @platform ios\n */\nexport type NotificationCategoryOptions = {\n /**\n * Customizable placeholder for the notification preview text. This is shown if the user has disabled notification previews for the app.\n * Defaults to the localized iOS system default placeholder (`Notification`).\n */\n previewPlaceholder?: string;\n /**\n * Array of [Intent Class Identifiers](https://developer.apple.com/documentation/sirikit/intent_class_identifiers). When a notification is delivered,\n * the presence of an intent identifier lets the system know that the notification is potentially related to the handling of a request made through Siri.\n * @default []\n */\n intentIdentifiers?: string[];\n /**\n * A format string for the summary description used when the system groups the category’s notifications.\n */\n categorySummaryFormat?: string;\n /**\n * A boolean indicating whether to send actions for handling when the notification is dismissed (the user must explicitly dismiss\n * the notification interface - ignoring a notification or flicking away a notification banner does not trigger this action).\n * @default false\n */\n customDismissAction?: boolean;\n /**\n * A boolean indicating whether to allow CarPlay to display notifications of this type. **Apps must be approved for CarPlay to make use of this feature.**\n * @default false\n */\n allowInCarPlay?: boolean;\n /**\n * A boolean indicating whether to show the notification's title, even if the user has disabled notification previews for the app.\n * @default false\n */\n showTitle?: boolean;\n /**\n * A boolean indicating whether to show the notification's subtitle, even if the user has disabled notification previews for the app.\n * @default false\n */\n showSubtitle?: boolean;\n /**\n * A boolean indicating whether to allow notifications to be automatically read by Siri when the user is using AirPods.\n * @default false\n */\n allowAnnouncement?: boolean;\n};\n\nexport type { Subscription, PermissionResponse, PermissionStatus, PermissionExpiration };\n"]}
|
|
1
|
+
{"version":3,"file":"Notifications.types.js","sourceRoot":"","sources":["../src/Notifications.types.ts"],"names":[],"mappings":"AAgWA;;GAEG;AACH,MAAM,CAAN,IAAY,2BAMX;AAND,WAAY,2BAA2B;IACrC,0CAAW,CAAA;IACX,0CAAW,CAAA;IACX,kDAAmB,CAAA;IACnB,4CAAa,CAAA;IACb,0CAAW,CAAA;AACb,CAAC,EANW,2BAA2B,KAA3B,2BAA2B,QAMtC","sourcesContent":["import type {\n PermissionExpiration,\n PermissionResponse,\n PermissionStatus,\n Subscription,\n} from 'expo-modules-core';\n\n/**\n * An object represents a notification delivered by a push notification system.\n *\n * On Android under `remoteMessage` field a JS version of the Firebase `RemoteMessage` may be accessed.\n * On iOS under `payload` you may find full contents of [`UNNotificationContent`'s](https://developer.apple.com/documentation/usernotifications/unnotificationcontent?language=objc) [`userInfo`](https://developer.apple.com/documentation/usernotifications/unnotificationcontent/1649869-userinfo?language=objc), for example [remote notification payload](https://developer.apple.com/library/archive/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/CreatingtheNotificationPayload.html)\n * On web there is no extra data.\n */\nexport type PushNotificationTrigger = {\n type: 'push';\n /**\n * @platform ios\n */\n payload?: Record<string, unknown>;\n /**\n * @platform android\n */\n remoteMessage?: FirebaseRemoteMessage;\n};\n\n/**\n * A trigger related to a [`UNCalendarNotificationTrigger`](https://developer.apple.com/documentation/usernotifications/uncalendarnotificationtrigger?language=objc).\n * @platform ios\n */\nexport interface CalendarNotificationTrigger {\n type: 'calendar';\n repeats: boolean;\n dateComponents: {\n era?: number;\n year?: number;\n month?: number;\n day?: number;\n hour?: number;\n minute?: number;\n second?: number;\n weekday?: number;\n weekdayOrdinal?: number;\n quarter?: number;\n weekOfMonth?: number;\n weekOfYear?: number;\n yearForWeekOfYear?: number;\n nanosecond?: number;\n isLeapMonth: boolean;\n timeZone?: string;\n calendar?: string;\n };\n}\n\n/**\n * The region used to determine when the system sends the notification.\n * @platform ios\n */\nexport interface Region {\n type: string;\n /**\n * The identifier for the region object.\n */\n identifier: string;\n /**\n * A Boolean indicating that notifications are generated upon entry into the region.\n */\n notifyOnEntry: boolean;\n /**\n * A Boolean indicating that notifications are generated upon exit from the region.\n */\n notifyOnExit: boolean;\n}\n\n/**\n * A circular geographic region, specified as a center point and radius. Based on Core Location [`CLCircularRegion`](https://developer.apple.com/documentation/corelocation/clcircularregion) class.\n * @platform ios\n */\nexport interface CircularRegion extends Region {\n type: 'circular';\n /**\n * The radius (measured in meters) that defines the geographic area’s outer boundary.\n */\n radius: number;\n /**\n * The center point of the geographic area.\n */\n center: {\n latitude: number;\n longitude: number;\n };\n}\n\n/**\n * A region used to detect the presence of iBeacon devices. Based on Core Location [`CLBeaconRegion`](https://developer.apple.com/documentation/corelocation/clbeaconregion) class.\n * @platform ios\n */\nexport interface BeaconRegion extends Region {\n type: 'beacon';\n /**\n * A Boolean value that indicates whether Core Location sends beacon notifications when the device’s display is on.\n */\n notifyEntryStateOnDisplay: boolean;\n /**\n * The major value from the beacon identity constraint that defines the beacon region.\n */\n major: number | null;\n /**\n * The minor value from the beacon identity constraint that defines the beacon region.\n */\n minor: number | null;\n /**\n * The UUID value from the beacon identity constraint that defines the beacon region.\n */\n uuid?: string;\n /**\n * The beacon identity constraint that defines the beacon region.\n */\n beaconIdentityConstraint?: {\n uuid: string;\n major: number | null;\n minor: number | null;\n };\n}\n\n/**\n * A trigger related to a [`UNLocationNotificationTrigger`](https://developer.apple.com/documentation/usernotifications/unlocationnotificationtrigger?language=objc).\n * @platform ios\n */\nexport interface LocationNotificationTrigger {\n type: 'location';\n repeats: boolean;\n region: CircularRegion | BeaconRegion;\n}\n\n/**\n * A trigger related to an elapsed time interval. May be repeating (see `repeats` field).\n */\nexport interface TimeIntervalNotificationTrigger {\n type: 'timeInterval';\n repeats: boolean;\n seconds: number;\n}\n\n/**\n * A trigger related to a daily notification.\n * > The same functionality will be achieved on iOS with a `CalendarNotificationTrigger`.\n * @platform android\n */\nexport interface DailyNotificationTrigger {\n type: 'daily';\n hour: number;\n minute: number;\n}\n\n/**\n * A trigger related to a weekly notification.\n * > The same functionality will be achieved on iOS with a `CalendarNotificationTrigger`.\n * @platform android\n */\nexport interface WeeklyNotificationTrigger {\n type: 'weekly';\n weekday: number;\n hour: number;\n minute: number;\n}\n\n/**\n * A trigger related to a yearly notification.\n * > The same functionality will be achieved on iOS with a `CalendarNotificationTrigger`.\n * @platform android\n */\nexport interface YearlyNotificationTrigger {\n type: 'yearly';\n day: number;\n month: number;\n hour: number;\n minute: number;\n}\n\n// @docsMissing\n/**\n * A Firebase `RemoteMessage` that caused the notification to be delivered to the app.\n */\nexport interface FirebaseRemoteMessage {\n collapseKey: string | null;\n data: Record<string, string>;\n from: string | null;\n messageId: string | null;\n messageType: string | null;\n originalPriority: number;\n priority: number;\n sentTime: number;\n to: string | null;\n ttl: number;\n notification: null | FirebaseRemoteMessageNotification;\n}\n\n// @docsMissing\nexport interface FirebaseRemoteMessageNotification {\n body: string | null;\n bodyLocalizationArgs: string[] | null;\n bodyLocalizationKey: string | null;\n channelId: string | null;\n clickAction: string | null;\n color: string | null;\n usesDefaultLightSettings: boolean;\n usesDefaultSound: boolean;\n usesDefaultVibrateSettings: boolean;\n eventTime: number | null;\n icon: string | null;\n imageUrl: string | null;\n lightSettings: number[] | null;\n link: string | null;\n localOnly: boolean;\n notificationCount: number | null;\n notificationPriority: number | null;\n sound: string | null;\n sticky: boolean;\n tag: string | null;\n ticker: string | null;\n title: string | null;\n titleLocalizationArgs: string[] | null;\n titleLocalizationKey: string | null;\n vibrateTimings: number[] | null;\n visibility: number | null;\n}\n\n/**\n * Represents a notification trigger that is unknown to `expo-notifications` and that it didn't know how to serialize for JS.\n */\nexport interface UnknownNotificationTrigger {\n type: 'unknown';\n}\n\n/**\n * A union type containing different triggers which may cause the notification to be delivered to the application.\n */\nexport type NotificationTrigger =\n | PushNotificationTrigger\n | CalendarNotificationTrigger\n | LocationNotificationTrigger\n | TimeIntervalNotificationTrigger\n | DailyNotificationTrigger\n | WeeklyNotificationTrigger\n | YearlyNotificationTrigger\n | UnknownNotificationTrigger;\n\n/**\n * A trigger that will cause the notification to be delivered immediately.\n */\nexport type ChannelAwareTriggerInput = {\n channelId: string;\n};\n\n// @docsMissing\nexport type CalendarTriggerInputValue = {\n timezone?: string;\n year?: number;\n month?: number;\n weekday?: number;\n weekOfMonth?: number;\n weekOfYear?: number;\n weekdayOrdinal?: number;\n day?: number;\n hour?: number;\n minute?: number;\n second?: number;\n};\n\n/**\n * A trigger that will cause the notification to be delivered once or many times when the date components match the specified values.\n * Corresponds to native [`UNCalendarNotificationTrigger`](https://developer.apple.com/documentation/usernotifications/uncalendarnotificationtrigger?language=objc).\n * @platform ios\n */\nexport type CalendarTriggerInput = CalendarTriggerInputValue & {\n channelId?: string;\n repeats?: boolean;\n};\n\n/**\n * A trigger that will cause the notification to be delivered once or many times (depends on the `repeats` field) after `seconds` time elapse.\n * > **On iOS**, when `repeats` is `true`, the time interval must be 60 seconds or greater. Otherwise, the notification won't be triggered.\n */\nexport interface TimeIntervalTriggerInput {\n channelId?: string;\n repeats?: boolean;\n seconds: number;\n}\n\n/**\n * A trigger that will cause the notification to be delivered once per day.\n */\nexport interface DailyTriggerInput {\n channelId?: string;\n hour: number;\n minute: number;\n repeats: true;\n}\n\n/**\n * A trigger that will cause the notification to be delivered once every week.\n * > **Note:** Weekdays are specified with a number from `1` through `7`, with `1` indicating Sunday.\n */\nexport interface WeeklyTriggerInput {\n channelId?: string;\n weekday: number;\n hour: number;\n minute: number;\n repeats: true;\n}\n\n/**\n * A trigger that will cause the notification to be delivered once every year.\n * > **Note:** all properties are specified in JavaScript Date's ranges.\n */\nexport interface YearlyTriggerInput {\n channelId?: string;\n day: number;\n month: number;\n hour: number;\n minute: number;\n repeats: true;\n}\n\n/**\n * A trigger that will cause the notification to be delivered once at the specified `Date`.\n * If you pass in a `number` it will be interpreted as a Unix timestamp.\n */\nexport type DateTriggerInput = Date | number | { channelId?: string; date: Date | number };\n\n/**\n * A type represents time-based, schedulable triggers. For these triggers you can check the next trigger date\n * with [`getNextTriggerDateAsync`](#notificationsgetnexttriggerdateasynctrigger).\n */\nexport type SchedulableNotificationTriggerInput =\n | DateTriggerInput\n | TimeIntervalTriggerInput\n | DailyTriggerInput\n | WeeklyTriggerInput\n | YearlyTriggerInput\n | CalendarTriggerInput;\n\n/**\n * A type represents possible triggers with which you can schedule notifications.\n * A `null` trigger means that the notification should be scheduled for delivery immediately.\n */\nexport type NotificationTriggerInput =\n | null\n | ChannelAwareTriggerInput\n | SchedulableNotificationTriggerInput;\n\n/**\n * An enum corresponding to values appropriate for Android's [`Notification#priority`](https://developer.android.com/reference/android/app/Notification#priority) field.\n */\nexport enum AndroidNotificationPriority {\n MIN = 'min',\n LOW = 'low',\n DEFAULT = 'default',\n HIGH = 'high',\n MAX = 'max',\n}\n\n/**\n * An object represents notification's content.\n */\nexport type NotificationContent = {\n /**\n * Notification title - the bold text displayed above the rest of the content.\n */\n title: string | null;\n /**\n * On Android: `subText` - the display depends on the device.\n *\n * On iOS: `subtitle` - the bold text displayed between title and the rest of the content.\n */\n subtitle: string | null;\n /**\n * Notification body - the main content of the notification.\n */\n body: string | null;\n /**\n * Data associated with the notification, not displayed\n */\n data: Record<string, any>;\n // @docsMissing\n sound: 'default' | 'defaultCritical' | 'custom' | null;\n} & (NotificationContentIos | NotificationContentAndroid);\n\n/**\n * See [Apple documentation](https://developer.apple.com/documentation/usernotifications/unnotificationcontent?language=objc) for more information on specific fields.\n */\nexport type NotificationContentIos = {\n /**\n * The name of the image or storyboard to use when your app launches because of the notification.\n */\n launchImageName: string | null;\n /**\n * The number that your app’s icon displays.\n */\n badge: number | null;\n /**\n * The visual and audio attachments to display alongside the notification’s main content.\n */\n attachments: NotificationContentAttachmentIos[];\n /**\n * The text the system adds to the notification summary to provide additional context.\n */\n summaryArgument?: string | null;\n /**\n * The number the system adds to the notification summary when the notification represents multiple items.\n */\n summaryArgumentCount?: number;\n /**\n * The identifier of the notification’s category.\n */\n categoryIdentifier: string | null;\n /**\n * The identifier that groups related notifications.\n */\n threadIdentifier: string | null;\n /**\n * The value your app uses to determine which scene to display to handle the notification.\n */\n targetContentIdentifier?: string;\n};\n\n// @docsMissing\n/**\n * @platform ios\n */\nexport type NotificationContentAttachmentIos = {\n identifier: string | null;\n url: string | null;\n type: string | null;\n typeHint?: string;\n hideThumbnail?: boolean;\n thumbnailClipArea?: { x: number; y: number; width: number; height: number };\n thumbnailTime?: number;\n};\n\n/**\n * See [Android developer documentation](https://developer.android.com/reference/android/app/Notification#fields) for more information on specific fields.\n */\nexport type NotificationContentAndroid = {\n /**\n * Application badge number associated with the notification.\n */\n badge?: number;\n /**\n * Accent color (in `#AARRGGBB` or `#RRGGBB` format) to be applied by the standard Style templates when presenting this notification.\n */\n color?: string;\n /**\n * Relative priority for this notification. Priority is an indication of how much of the user's valuable attention should be consumed by this notification.\n * Low-priority notifications may be hidden from the user in certain situations, while the user might be interrupted for a higher-priority notification.\n * The system will make a determination about how to interpret this priority when presenting the notification.\n */\n priority?: AndroidNotificationPriority;\n /**\n * The pattern with which to vibrate.\n */\n vibrationPattern?: number[];\n};\n\n/**\n * An object represents a request to present a notification. It has content — how it's being represented, and a trigger — what triggers the notification.\n * Many notifications ([`Notification`](#notification)) may be triggered with the same request (for example, a repeating notification).\n */\nexport interface NotificationRequest {\n identifier: string;\n content: NotificationContent;\n trigger: NotificationTrigger;\n}\n\n// TODO(simek): asses if we can base this type on `NotificationContent`, since most of the fields looks like repetition\n/**\n * An object represents notification content that you pass in to `presentNotificationAsync` or as a part of `NotificationRequestInput`.\n */\nexport type NotificationContentInput = {\n /**\n * Notification title - the bold text displayed above the rest of the content.\n */\n title?: string | null;\n /**\n * On Android: `subText` - the display depends on the device.\n *\n * On iOS: `subtitle` - the bold text displayed between title and the rest of the content.\n */\n subtitle?: string | null;\n /**\n * The main content of the notification.\n */\n body?: string | null;\n /**\n * Data associated with the notification, not displayed.\n */\n data?: Record<string, any>;\n /**\n * Application badge number associated with the notification.\n */\n badge?: number;\n sound?: boolean | string;\n /**\n * The name of the image or storyboard to use when your app launches because of the notification.\n */\n launchImageName?: string;\n /**\n * The pattern with which to vibrate.\n * @platform android\n */\n vibrate?: number[];\n /**\n * Relative priority for this notification. Priority is an indication of how much of the user's valuable attention should be consumed by this notification.\n * Low-priority notifications may be hidden from the user in certain situations, while the user might be interrupted for a higher-priority notification.\n * The system will make a determination about how to interpret this priority when presenting the notification.\n * @platform android\n */\n priority?: string;\n /**\n * Accent color (in `#AARRGGBB` or `#RRGGBB` format) to be applied by the standard Style templates when presenting this notification.\n * @platform android\n */\n color?: string;\n /**\n * If set to `false`, the notification will not be automatically dismissed when clicked.\n * The setting will be used when the value is not provided or is invalid is set to `true`, and the notification\n * will be dismissed automatically anyway. Corresponds directly to Android's `setAutoCancel` behavior.\n *\n * See [Android developer documentation](https://developer.android.com/reference/android/app/Notification.Builder#setAutoCancel(boolean))\n * for more details.\n * @platform android\n */\n autoDismiss?: boolean;\n /**\n * The identifier of the notification’s category.\n * @platform ios\n */\n categoryIdentifier?: string;\n /**\n * If set to `true`, the notification cannot be dismissed by swipe. This setting defaults\n * to `false` if not provided or is invalid. Corresponds directly do Android's `isOngoing` behavior.\n * In Firebase terms this property of a notification is called `sticky`.\n *\n * See [Android developer documentation](https://developer.android.com/reference/android/app/Notification.Builder#setOngoing(boolean))\n * and [Firebase documentation](https://firebase.google.com/docs/reference/fcm/rest/v1/projects.messages#AndroidNotification.FIELDS.sticky)\n * for more details.\n * @platform android\n */\n sticky?: boolean;\n /**\n * The visual and audio attachments to display alongside the notification’s main content.\n * @platform ios\n */\n attachments?: NotificationContentAttachmentIos[];\n};\n\n/**\n * An object represents a notification request you can pass into `scheduleNotificationAsync`.\n */\nexport interface NotificationRequestInput {\n identifier?: string;\n content: NotificationContentInput;\n trigger: NotificationTriggerInput;\n}\n\n/**\n * An object represents a single notification that has been triggered by some request ([`NotificationRequest`](#notificationrequest)) at some point in time.\n */\nexport interface Notification {\n date: number;\n request: NotificationRequest;\n}\n\n/**\n * An object represents user's interaction with the notification.\n * > **Note:** If the user taps on a notification `actionIdentifier` will be equal to [`Notifications.DEFAULT_ACTION_IDENTIFIER`](#notificationsdefault_action_identifier).\n */\nexport interface NotificationResponse {\n notification: Notification;\n actionIdentifier: string;\n userText?: string;\n}\n\n/**\n * An object represents behavior that should be applied to the incoming notification.\n * > On Android, setting `shouldPlaySound: false` will result in the drop-down notification alert **not** showing, no matter what the priority is.\n * > This setting will also override any channel-specific sounds you may have configured.\n */\nexport interface NotificationBehavior {\n shouldShowAlert: boolean;\n shouldPlaySound: boolean;\n shouldSetBadge: boolean;\n priority?: AndroidNotificationPriority;\n}\n\nexport interface NotificationAction {\n /**\n * A unique string that identifies this action. If a user takes this action (for example, selects this button in the system's Notification UI),\n * your app will receive this `actionIdentifier` via the [`NotificationResponseReceivedListener`](#addnotificationresponsereceivedlistenerlistener).\n */\n identifier: string;\n /**\n * The title of the button triggering this action.\n */\n buttonTitle: string;\n /**\n * Object which, if provided, will result in a button that prompts the user for a text response.\n */\n textInput?: {\n /**\n * A string which will be used as the title for the button used for submitting the text response.\n * @platform ios\n */\n submitButtonTitle: string;\n /**\n * A string that serves as a placeholder until the user begins typing. Defaults to no placeholder string.\n */\n placeholder: string;\n };\n /**\n * Object representing the additional configuration options.\n */\n options?: {\n /**\n * Boolean indicating whether the button title will be highlighted a different color (usually red).\n * This usually signifies a destructive action such as deleting data.\n * @platform ios\n */\n isDestructive?: boolean;\n /**\n * Boolean indicating whether triggering the action will require authentication from the user.\n * @platform ios\n */\n isAuthenticationRequired?: boolean;\n /**\n * Boolean indicating whether triggering this action foregrounds the app.\n * If `false` and your app is killed (not just backgrounded), [`NotificationResponseReceived` listeners](#addnotificationresponsereceivedlistenerlistener)\n * will not be triggered when a user selects this action.\n * @default true\n */\n opensAppToForeground?: boolean;\n };\n}\n\n// @docsMissing\nexport interface NotificationCategory {\n identifier: string;\n actions: NotificationAction[];\n options?: NotificationCategoryOptions;\n}\n\n/**\n * @platform ios\n */\nexport type NotificationCategoryOptions = {\n /**\n * Customizable placeholder for the notification preview text. This is shown if the user has disabled notification previews for the app.\n * Defaults to the localized iOS system default placeholder (`Notification`).\n */\n previewPlaceholder?: string;\n /**\n * Array of [Intent Class Identifiers](https://developer.apple.com/documentation/sirikit/intent_class_identifiers). When a notification is delivered,\n * the presence of an intent identifier lets the system know that the notification is potentially related to the handling of a request made through Siri.\n * @default []\n */\n intentIdentifiers?: string[];\n /**\n * A format string for the summary description used when the system groups the category’s notifications.\n */\n categorySummaryFormat?: string;\n /**\n * A boolean indicating whether to send actions for handling when the notification is dismissed (the user must explicitly dismiss\n * the notification interface - ignoring a notification or flicking away a notification banner does not trigger this action).\n * @default false\n */\n customDismissAction?: boolean;\n /**\n * A boolean indicating whether to allow CarPlay to display notifications of this type. **Apps must be approved for CarPlay to make use of this feature.**\n * @default false\n */\n allowInCarPlay?: boolean;\n /**\n * A boolean indicating whether to show the notification's title, even if the user has disabled notification previews for the app.\n * @default false\n */\n showTitle?: boolean;\n /**\n * A boolean indicating whether to show the notification's subtitle, even if the user has disabled notification previews for the app.\n * @default false\n */\n showSubtitle?: boolean;\n /**\n * A boolean indicating whether to allow notifications to be automatically read by Siri when the user is using AirPods.\n * @default false\n */\n allowAnnouncement?: boolean;\n};\n\nexport type { Subscription, PermissionResponse, PermissionStatus, PermissionExpiration };\n"]}
|
package/build/Tokens.types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Platform } from 'expo-modules-core';
|
|
1
|
+
import { type Platform } from 'expo-modules-core';
|
|
2
2
|
export interface NativeDevicePushToken {
|
|
3
3
|
type: 'ios' | 'android';
|
|
4
4
|
data: string;
|
|
@@ -7,14 +7,15 @@ export interface WebDevicePushToken {
|
|
|
7
7
|
type: 'web';
|
|
8
8
|
data: {
|
|
9
9
|
endpoint: string;
|
|
10
|
-
keys:
|
|
11
|
-
p256dh: string;
|
|
12
|
-
auth: string;
|
|
13
|
-
};
|
|
10
|
+
keys: WebDevicePushTokenKeys;
|
|
14
11
|
};
|
|
15
12
|
}
|
|
16
|
-
type
|
|
17
|
-
|
|
13
|
+
export type WebDevicePushTokenKeys = {
|
|
14
|
+
p256dh: string;
|
|
15
|
+
auth: string;
|
|
16
|
+
};
|
|
17
|
+
export type ExplicitlySupportedDevicePushToken = NativeDevicePushToken | WebDevicePushToken;
|
|
18
|
+
export type ImplicitlySupportedDevicePushToken = {
|
|
18
19
|
/**
|
|
19
20
|
* Either `android`, `ios` or `web`.
|
|
20
21
|
*/
|
|
@@ -95,5 +96,4 @@ export interface ExpoPushTokenOptions {
|
|
|
95
96
|
*/
|
|
96
97
|
devicePushToken?: DevicePushToken;
|
|
97
98
|
}
|
|
98
|
-
export {};
|
|
99
99
|
//# sourceMappingURL=Tokens.types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tokens.types.d.ts","sourceRoot":"","sources":["../src/Tokens.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"Tokens.types.d.ts","sourceRoot":"","sources":["../src/Tokens.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAGlD,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,KAAK,GAAG,SAAS,CAAC;IACxB,IAAI,EAAE,MAAM,CAAC;CACd;AAGD,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,KAAK,CAAC;IACZ,IAAI,EAAE;QACJ,QAAQ,EAAE,MAAM,CAAC;QACjB,IAAI,EAAE,sBAAsB,CAAC;KAC9B,CAAC;CACH;AAGD,MAAM,MAAM,sBAAsB,GAAG;IACnC,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAGF,MAAM,MAAM,kCAAkC,GAAG,qBAAqB,GAAG,kBAAkB,CAAC;AAE5F,MAAM,MAAM,kCAAkC,GAAG;IAC/C;;OAEG;IACH,IAAI,EAAE,OAAO,CAAC,OAAO,QAAQ,CAAC,EAAE,EAAE,kCAAkC,CAAC,MAAM,CAAC,CAAC,CAAC;IAC9E;;;;;;;;;;;OAWG;IACH,IAAI,EAAE,GAAG,CAAC;CACX,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,eAAe,GACvB,kCAAkC,GAClC,kCAAkC,CAAC;AAEvC;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;CACd;AAGD,MAAM,WAAW,oBAAoB;IACnC;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;;;;;OAOG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB;;;;;;;;OAQG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;;OAGG;IACH,eAAe,CAAC,EAAE,eAAe,CAAC;CACnC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tokens.types.js","sourceRoot":"","sources":["../src/Tokens.types.ts"],"names":[],"mappings":"","sourcesContent":["import { Platform } from 'expo-modules-core';\n\n// @docsMissing\nexport interface NativeDevicePushToken {\n type: 'ios' | 'android';\n data: string;\n}\n\n// @docsMissing\nexport interface WebDevicePushToken {\n type: 'web';\n data: {\n endpoint: string;\n keys: {\n
|
|
1
|
+
{"version":3,"file":"Tokens.types.js","sourceRoot":"","sources":["../src/Tokens.types.ts"],"names":[],"mappings":"","sourcesContent":["import { type Platform } from 'expo-modules-core';\n\n// @docsMissing\nexport interface NativeDevicePushToken {\n type: 'ios' | 'android';\n data: string;\n}\n\n// @docsMissing\nexport interface WebDevicePushToken {\n type: 'web';\n data: {\n endpoint: string;\n keys: WebDevicePushTokenKeys;\n };\n}\n\n// @docsMissing\nexport type WebDevicePushTokenKeys = {\n p256dh: string;\n auth: string;\n};\n\n// @docsMissing\nexport type ExplicitlySupportedDevicePushToken = NativeDevicePushToken | WebDevicePushToken;\n\nexport type ImplicitlySupportedDevicePushToken = {\n /**\n * Either `android`, `ios` or `web`.\n */\n type: Exclude<typeof Platform.OS, ExplicitlySupportedDevicePushToken['type']>;\n /**\n * Either the push token as a string (when for native platforms), or an object conforming to the type below (for web):\n * ```ts\n * {\n * endpoint: string;\n * keys: {\n * p256dh: string;\n * auth: string;\n * }\n * }\n * ```\n */\n data: any;\n};\n\n/**\n * In simple terms, an object of `type: Platform.OS` and `data: any`. The `data` type depends on the environment - on a native device it will be a string,\n * which you can then use to send notifications via Firebase Cloud Messaging (Android) or APNs (iOS); on web it will be a registration object (VAPID).\n */\nexport type DevicePushToken =\n | ExplicitlySupportedDevicePushToken\n | ImplicitlySupportedDevicePushToken;\n\n/**\n * Borrowing structure from `DevicePushToken` a little. You can use the `data` value to send notifications via Expo Notifications service.\n */\nexport interface ExpoPushToken {\n /**\n * Always set to `\"expo\"`.\n */\n type: 'expo';\n /**\n * The acquired push token.\n */\n data: string;\n}\n\n// @needsAudit\nexport interface ExpoPushTokenOptions {\n /**\n * Endpoint URL override.\n */\n baseUrl?: string;\n /**\n * Request URL override.\n */\n url?: string;\n /**\n * Request body override.\n */\n type?: string;\n // @docsMissing\n deviceId?: string;\n /**\n * Makes sense only on iOS, where there are two push notification services: \"sandbox\" and \"production\".\n * This defines whether the push token is supposed to be used with the sandbox platform notification service.\n * Defaults to [`Application.getIosPushNotificationServiceEnvironmentAsync()`](./application/#applicationgetiospushnotificationserviceenvironmentasync)\n * exposed by `expo-application` or `false`. Most probably you won't need to customize that.\n * You may want to customize that if you don't want to install `expo-application` and still use the sandbox APNs.\n * @platform ios\n */\n development?: boolean;\n /**\n * The ID of the project to which the token should be attributed.\n * Defaults to [`Constants.expoConfig.extra.eas.projectId`](./constants/#easconfig) exposed by `expo-constants`.\n *\n * When using EAS Build, this value is automatically set. However, it is\n * **recommended** to set it manually. Once you have EAS Build configured, you can find\n * the value in **app.json** under `extra.eas.projectId`. You can copy and paste it into your code.\n * If you are not using EAS Build, it will fallback to [`Constants.expoConfig?.extra?.eas?.projectId`](./constants/#manifest).\n */\n projectId?: string;\n /**\n * The ID of the application to which the token should be attributed.\n * Defaults to [`Application.applicationId`](./application/#applicationapplicationid) exposed by `expo-application`.\n */\n applicationId?: string;\n /**\n * The device push token with which to register at the backend.\n * Defaults to a token fetched with [`getDevicePushTokenAsync()`](#getdevicepushtokenasync).\n */\n devicePushToken?: DevicePushToken;\n}\n"]}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import Constants from 'expo-constants';
|
|
2
|
-
import { CodedError,
|
|
2
|
+
import { CodedError, DeviceEventEmitter, Platform } from 'expo-modules-core';
|
|
3
3
|
export default async function getDevicePushTokenAsync() {
|
|
4
4
|
const data = await _subscribeDeviceToPushNotificationsAsync();
|
|
5
|
-
|
|
5
|
+
DeviceEventEmitter.emit('onDevicePushToken', { devicePushToken: data });
|
|
6
6
|
return { type: Platform.OS, data };
|
|
7
7
|
}
|
|
8
8
|
function guardPermission() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getDevicePushTokenAsync.web.js","sourceRoot":"","sources":["../src/getDevicePushTokenAsync.web.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,gBAAgB,CAAC;AACvC,OAAO,EAAE,UAAU,EAAE,
|
|
1
|
+
{"version":3,"file":"getDevicePushTokenAsync.web.js","sourceRoot":"","sources":["../src/getDevicePushTokenAsync.web.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,gBAAgB,CAAC;AACvC,OAAO,EAAE,UAAU,EAAE,kBAAkB,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAI7E,MAAM,CAAC,OAAO,CAAC,KAAK,UAAU,uBAAuB;IACnD,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AAsB,CAAC,YAAoB;IAClD,MAAM,OAAO,GAAG,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,YAAY,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;IAChE,MAAM,MAAM,GAAG,CAAC,YAAY,GAAG,OAAO,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;IAE9E,MAAM,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACpC,MAAM,WAAW,GAAG,IAAI,UAAU,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IAEnD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,EAAE;QACvC,WAAW,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;KACxC;IACD,OAAO,WAAW,CAAC;AACrB,CAAC","sourcesContent":["import Constants from 'expo-constants';\nimport { CodedError, DeviceEventEmitter, Platform } from 'expo-modules-core';\n\nimport { DevicePushToken } from './Tokens.types';\n\nexport default async function getDevicePushTokenAsync(): Promise<DevicePushToken> {\n const data = await _subscribeDeviceToPushNotificationsAsync();\n DeviceEventEmitter.emit('onDevicePushToken', { devicePushToken: data });\n return { type: Platform.OS, data };\n}\n\nfunction guardPermission() {\n if (!('Notification' in window)) {\n throw new CodedError(\n 'ERR_UNAVAILABLE',\n 'The Web Notifications API is not available on this device.'\n );\n }\n if (!navigator.serviceWorker) {\n throw new CodedError(\n 'ERR_UNAVAILABLE',\n 'Notifications cannot be used because the service worker API is not supported on this device. This might also happen because your web page does not support HTTPS.'\n );\n }\n if (Notification.permission !== 'granted') {\n throw new CodedError(\n 'ERR_NOTIFICATIONS_PERMISSION_DENIED',\n `Cannot use web notifications without permissions granted. Request permissions with \"expo-permissions\".`\n );\n }\n}\n\nasync function _subscribeDeviceToPushNotificationsAsync(): Promise<DevicePushToken['data']> {\n // @ts-expect-error: TODO: not on the schema\n const vapidPublicKey: string | null = Constants.expoConfig?.notification?.vapidPublicKey;\n if (!vapidPublicKey) {\n throw new CodedError(\n 'ERR_NOTIFICATIONS_PUSH_WEB_MISSING_CONFIG',\n 'You must provide `notification.vapidPublicKey` in `app.json` to use push notifications on web. Learn more: https://docs.expo.dev/versions/latest/guides/using-vapid/.'\n );\n }\n\n // @ts-expect-error: TODO: not on the schema\n const serviceWorkerPath = Constants.expoConfig?.notification?.serviceWorkerPath;\n if (!serviceWorkerPath) {\n throw new CodedError(\n 'ERR_NOTIFICATIONS_PUSH_MISSING_CONFIGURATION',\n 'You must specify `notification.serviceWorkerPath` in `app.json` to use push notifications on the web. Please provide the path to the service worker that will handle notifications.'\n );\n }\n guardPermission();\n\n let registration: ServiceWorkerRegistration | null = null;\n try {\n registration = await navigator.serviceWorker.register(serviceWorkerPath);\n } catch (error) {\n throw new CodedError(\n 'ERR_NOTIFICATIONS_PUSH_REGISTRATION_FAILED',\n `Could not register this device for push notifications because the service worker (${serviceWorkerPath}) could not be registered: ${error}`\n );\n }\n await navigator.serviceWorker.ready;\n\n if (!registration.active) {\n throw new CodedError(\n 'ERR_NOTIFICATIONS_PUSH_REGISTRATION_FAILED',\n 'Could not register this device for push notifications because the service worker is not active.'\n );\n }\n\n const subscribeOptions = {\n userVisibleOnly: true,\n applicationServerKey: _urlBase64ToUint8Array(vapidPublicKey),\n };\n let pushSubscription: PushSubscription | null = null;\n try {\n pushSubscription = await registration.pushManager.subscribe(subscribeOptions);\n } catch (error) {\n throw new CodedError(\n 'ERR_NOTIFICATIONS_PUSH_REGISTRATION_FAILED',\n 'The device was unable to register for remote notifications with the browser endpoint. (' +\n error +\n ')'\n );\n }\n const pushSubscriptionJson = pushSubscription.toJSON();\n\n const subscriptionObject = {\n endpoint: pushSubscriptionJson.endpoint,\n keys: {\n p256dh: pushSubscriptionJson.keys!.p256dh,\n auth: pushSubscriptionJson.keys!.auth,\n },\n };\n\n // Store notification icon string in service worker.\n // This message is received by `/expo-service-worker.js`.\n // We wrap it with `fromExpoWebClient` to make sure other message\n // will not override content such as `notificationIcon`.\n // https://stackoverflow.com/a/35729334/2603230\n const notificationIcon = (Constants.expoConfig?.notification ?? {}).icon;\n await registration.active.postMessage(\n JSON.stringify({ fromExpoWebClient: { notificationIcon } })\n );\n\n return subscriptionObject;\n}\n\n// https://github.com/web-push-libs/web-push#using-vapid-key-for-applicationserverkey\nfunction _urlBase64ToUint8Array(base64String: string): Uint8Array {\n const padding = '='.repeat((4 - (base64String.length % 4)) % 4);\n const base64 = (base64String + padding).replace(/-/g, '+').replace(/_/g, '/');\n\n const rawData = window.atob(base64);\n const outputArray = new Uint8Array(rawData.length);\n\n for (let i = 0; i < rawData.length; ++i) {\n outputArray[i] = rawData.charCodeAt(i);\n }\n return outputArray;\n}\n"]}
|
|
@@ -10,7 +10,8 @@ import { NotificationResponse } from './Notifications.types';
|
|
|
10
10
|
* - `null` - if no notification response has been received yet,
|
|
11
11
|
* - a [`NotificationResponse`](#notificationresponse) object - if a notification response was received.
|
|
12
12
|
*
|
|
13
|
-
* @example
|
|
13
|
+
* @example
|
|
14
|
+
* Responding to a notification tap by opening a URL that could be put into the notification's `data`
|
|
14
15
|
* (opening the URL is your responsibility and is not a part of the `expo-notifications` API):
|
|
15
16
|
* ```jsx
|
|
16
17
|
* import * as Notifications from 'expo-notifications';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useLastNotificationResponse.d.ts","sourceRoot":"","sources":["../src/useLastNotificationResponse.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAI7D
|
|
1
|
+
{"version":3,"file":"useLastNotificationResponse.d.ts","sourceRoot":"","sources":["../src/useLastNotificationResponse.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAI7D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,MAAM,CAAC,OAAO,UAAU,2BAA2B,4CA4BlD"}
|
|
@@ -12,7 +12,8 @@ import NotificationsEmitterModule from './NotificationsEmitterModule';
|
|
|
12
12
|
* - `null` - if no notification response has been received yet,
|
|
13
13
|
* - a [`NotificationResponse`](#notificationresponse) object - if a notification response was received.
|
|
14
14
|
*
|
|
15
|
-
* @example
|
|
15
|
+
* @example
|
|
16
|
+
* Responding to a notification tap by opening a URL that could be put into the notification's `data`
|
|
16
17
|
* (opening the URL is your responsibility and is not a part of the `expo-notifications` API):
|
|
17
18
|
* ```jsx
|
|
18
19
|
* import * as Notifications from 'expo-notifications';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useLastNotificationResponse.js","sourceRoot":"","sources":["../src/useLastNotificationResponse.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAG7D,OAAO,EAAE,uCAAuC,EAAE,MAAM,wBAAwB,CAAC;AACjF,OAAO,0BAA0B,MAAM,8BAA8B,CAAC;AAEtE
|
|
1
|
+
{"version":3,"file":"useLastNotificationResponse.js","sourceRoot":"","sources":["../src/useLastNotificationResponse.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAG7D,OAAO,EAAE,uCAAuC,EAAE,MAAM,wBAAwB,CAAC;AACjF,OAAO,0BAA0B,MAAM,8BAA8B,CAAC;AAEtE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,MAAM,CAAC,OAAO,UAAU,2BAA2B;IACjD,MAAM,CAAC,wBAAwB,EAAE,2BAA2B,CAAC,GAAG,QAAQ,CAEtE,SAAS,CAAC,CAAC;IAEb,yEAAyE;IACzE,eAAe,CAAC,GAAG,EAAE;QACnB,MAAM,YAAY,GAAG,uCAAuC,CAAC,CAAC,QAAQ,EAAE,EAAE;YACxE,2BAA2B,CAAC,QAAQ,CAAC,CAAC;QACxC,CAAC,CAAC,CAAC;QACH,OAAO,GAAG,EAAE;YACV,YAAY,CAAC,MAAM,EAAE,CAAC;QACxB,CAAC,CAAC;IACJ,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,iEAAiE;IACjE,8DAA8D;IAC9D,+CAA+C;IAC/C,SAAS,CAAC,GAAG,EAAE;QACb,0BAA0B,CAAC,gCAAgC,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE;YAChF,kEAAkE;YAClE,iFAAiF;YACjF,wCAAwC;YACxC,2BAA2B,CAAC,CAAC,eAAe,EAAE,EAAE,CAAC,eAAe,IAAI,QAAQ,CAAC,CAAC;QAChF,CAAC,CAAC,CAAC;IACL,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO,wBAAwB,CAAC;AAClC,CAAC","sourcesContent":["import { useEffect, useLayoutEffect, useState } from 'react';\n\nimport { NotificationResponse } from './Notifications.types';\nimport { addNotificationResponseReceivedListener } from './NotificationsEmitter';\nimport NotificationsEmitterModule from './NotificationsEmitterModule';\n\n/**\n * A React hook always returns the notification response that was received most recently\n * (a notification response designates an interaction with a notification, such as tapping on it).\n *\n * > If you don't want to use a hook, you can use `Notifications.getLastNotificationResponseAsync()` instead.\n *\n * @return The hook may return one of these three types/values:\n * - `undefined` - until we're sure of what to return,\n * - `null` - if no notification response has been received yet,\n * - a [`NotificationResponse`](#notificationresponse) object - if a notification response was received.\n *\n * @example\n * Responding to a notification tap by opening a URL that could be put into the notification's `data`\n * (opening the URL is your responsibility and is not a part of the `expo-notifications` API):\n * ```jsx\n * import * as Notifications from 'expo-notifications';\n * import { Linking } from 'react-native';\n *\n * export default function App() {\n * const lastNotificationResponse = Notifications.useLastNotificationResponse();\n * React.useEffect(() => {\n * if (\n * lastNotificationResponse &&\n * lastNotificationResponse.notification.request.content.data.url &&\n * lastNotificationResponse.actionIdentifier === Notifications.DEFAULT_ACTION_IDENTIFIER\n * ) {\n * Linking.openURL(lastNotificationResponse.notification.request.content.data.url);\n * }\n * }, [lastNotificationResponse]);\n * return (\n * // Your app content\n * );\n * }\n * ```\n * @header listen\n */\nexport default function useLastNotificationResponse() {\n const [lastNotificationResponse, setLastNotificationResponse] = useState<\n NotificationResponse | null | undefined\n >(undefined);\n\n // useLayoutEffect ensures the listener is registered as soon as possible\n useLayoutEffect(() => {\n const subscription = addNotificationResponseReceivedListener((response) => {\n setLastNotificationResponse(response);\n });\n return () => {\n subscription.remove();\n };\n }, []);\n\n // On each mount of this hook we fetch last notification response\n // from the native module which is an \"always active listener\"\n // and always returns the most recent response.\n useEffect(() => {\n NotificationsEmitterModule.getLastNotificationResponseAsync?.().then((response) => {\n // We only update the state with the resolved value if it's empty,\n // because if it's not empty it must have been populated by the `useLayoutEffect`\n // listener which returns \"live\" values.\n setLastNotificationResponse((currentResponse) => currentResponse ?? response);\n });\n }, []);\n\n return lastNotificationResponse;\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "expo-notifications",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.28.1",
|
|
4
4
|
"description": "Notifications module",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"types": "build/index.d.ts",
|
|
@@ -37,13 +37,13 @@
|
|
|
37
37
|
"preset": "expo-module-scripts/ios"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@expo/image-utils": "^0.
|
|
40
|
+
"@expo/image-utils": "^0.5.0",
|
|
41
41
|
"@ide/backoff": "^1.0.0",
|
|
42
42
|
"abort-controller": "^3.0.0",
|
|
43
43
|
"assert": "^2.0.0",
|
|
44
44
|
"badgin": "^1.1.5",
|
|
45
|
-
"expo-application": "~5.
|
|
46
|
-
"expo-constants": "~
|
|
45
|
+
"expo-application": "~5.9.0",
|
|
46
|
+
"expo-constants": "~16.0.0",
|
|
47
47
|
"fs-extra": "^9.1.0"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
@@ -55,5 +55,5 @@
|
|
|
55
55
|
"peerDependencies": {
|
|
56
56
|
"expo": "*"
|
|
57
57
|
},
|
|
58
|
-
"gitHead": "
|
|
58
|
+
"gitHead": "ee4f30ef3b5fa567ad1bf94794197f7683fdd481"
|
|
59
59
|
}
|
|
@@ -88,7 +88,7 @@ export interface NotificationChannel {
|
|
|
88
88
|
enableVibrate: boolean;
|
|
89
89
|
}
|
|
90
90
|
|
|
91
|
-
type RequiredBy<T, K extends keyof T> = Partial<Omit<T, K>> & Required<Pick<T, K>>;
|
|
91
|
+
export type RequiredBy<T, K extends keyof T> = Partial<Omit<T, K>> & Required<Pick<T, K>>;
|
|
92
92
|
|
|
93
93
|
/**
|
|
94
94
|
* An object represents a notification channel to be set.
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { ProxyNativeModule } from 'expo-modules-core';
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
NotificationRequest,
|
|
5
|
+
NotificationContentInput,
|
|
6
|
+
CalendarTriggerInputValue,
|
|
7
|
+
} from './Notifications.types';
|
|
4
8
|
|
|
5
9
|
export interface NotificationSchedulerModule extends ProxyNativeModule {
|
|
6
10
|
getAllScheduledNotificationsAsync?: () => Promise<NotificationRequest[]>;
|
|
@@ -24,21 +28,7 @@ export interface CalendarTriggerInput {
|
|
|
24
28
|
type: 'calendar';
|
|
25
29
|
channelId?: string;
|
|
26
30
|
repeats?: boolean;
|
|
27
|
-
value:
|
|
28
|
-
timezone?: string;
|
|
29
|
-
|
|
30
|
-
year?: number;
|
|
31
|
-
month?: number;
|
|
32
|
-
weekday?: number;
|
|
33
|
-
weekOfMonth?: number;
|
|
34
|
-
weekOfYear?: number;
|
|
35
|
-
weekdayOrdinal?: number;
|
|
36
|
-
day?: number;
|
|
37
|
-
|
|
38
|
-
hour?: number;
|
|
39
|
-
minute?: number;
|
|
40
|
-
second?: number;
|
|
41
|
-
};
|
|
31
|
+
value: CalendarTriggerInputValue;
|
|
42
32
|
}
|
|
43
33
|
|
|
44
34
|
export interface TimeIntervalTriggerInput {
|
|
@@ -5,8 +5,6 @@ import type {
|
|
|
5
5
|
Subscription,
|
|
6
6
|
} from 'expo-modules-core';
|
|
7
7
|
|
|
8
|
-
import { CalendarTriggerInput as NativeCalendarTriggerInput } from './NotificationScheduler.types';
|
|
9
|
-
|
|
10
8
|
/**
|
|
11
9
|
* An object represents a notification delivered by a push notification system.
|
|
12
10
|
*
|
|
@@ -58,7 +56,7 @@ export interface CalendarNotificationTrigger {
|
|
|
58
56
|
* The region used to determine when the system sends the notification.
|
|
59
57
|
* @platform ios
|
|
60
58
|
*/
|
|
61
|
-
interface Region {
|
|
59
|
+
export interface Region {
|
|
62
60
|
type: string;
|
|
63
61
|
/**
|
|
64
62
|
* The identifier for the region object.
|
|
@@ -186,7 +184,7 @@ export interface YearlyNotificationTrigger {
|
|
|
186
184
|
*/
|
|
187
185
|
export interface FirebaseRemoteMessage {
|
|
188
186
|
collapseKey: string | null;
|
|
189
|
-
data:
|
|
187
|
+
data: Record<string, string>;
|
|
190
188
|
from: string | null;
|
|
191
189
|
messageId: string | null;
|
|
192
190
|
messageType: string | null;
|
|
@@ -255,12 +253,27 @@ export type ChannelAwareTriggerInput = {
|
|
|
255
253
|
channelId: string;
|
|
256
254
|
};
|
|
257
255
|
|
|
256
|
+
// @docsMissing
|
|
257
|
+
export type CalendarTriggerInputValue = {
|
|
258
|
+
timezone?: string;
|
|
259
|
+
year?: number;
|
|
260
|
+
month?: number;
|
|
261
|
+
weekday?: number;
|
|
262
|
+
weekOfMonth?: number;
|
|
263
|
+
weekOfYear?: number;
|
|
264
|
+
weekdayOrdinal?: number;
|
|
265
|
+
day?: number;
|
|
266
|
+
hour?: number;
|
|
267
|
+
minute?: number;
|
|
268
|
+
second?: number;
|
|
269
|
+
};
|
|
270
|
+
|
|
258
271
|
/**
|
|
259
272
|
* A trigger that will cause the notification to be delivered once or many times when the date components match the specified values.
|
|
260
273
|
* Corresponds to native [`UNCalendarNotificationTrigger`](https://developer.apple.com/documentation/usernotifications/uncalendarnotificationtrigger?language=objc).
|
|
261
274
|
* @platform ios
|
|
262
275
|
*/
|
|
263
|
-
export type CalendarTriggerInput =
|
|
276
|
+
export type CalendarTriggerInput = CalendarTriggerInputValue & {
|
|
264
277
|
channelId?: string;
|
|
265
278
|
repeats?: boolean;
|
|
266
279
|
};
|
|
@@ -370,6 +383,7 @@ export type NotificationContent = {
|
|
|
370
383
|
* Data associated with the notification, not displayed
|
|
371
384
|
*/
|
|
372
385
|
data: Record<string, any>;
|
|
386
|
+
// @docsMissing
|
|
373
387
|
sound: 'default' | 'defaultCritical' | 'custom' | null;
|
|
374
388
|
} & (NotificationContentIos | NotificationContentAndroid);
|
|
375
389
|
|
|
@@ -509,9 +523,11 @@ export type NotificationContentInput = {
|
|
|
509
523
|
*/
|
|
510
524
|
color?: string;
|
|
511
525
|
/**
|
|
512
|
-
* If set to `
|
|
513
|
-
*
|
|
514
|
-
*
|
|
526
|
+
* If set to `false`, the notification will not be automatically dismissed when clicked.
|
|
527
|
+
* The setting will be used when the value is not provided or is invalid is set to `true`, and the notification
|
|
528
|
+
* will be dismissed automatically anyway. Corresponds directly to Android's `setAutoCancel` behavior.
|
|
529
|
+
*
|
|
530
|
+
* See [Android developer documentation](https://developer.android.com/reference/android/app/Notification.Builder#setAutoCancel(boolean))
|
|
515
531
|
* for more details.
|
|
516
532
|
* @platform android
|
|
517
533
|
*/
|
|
@@ -522,12 +538,11 @@ export type NotificationContentInput = {
|
|
|
522
538
|
*/
|
|
523
539
|
categoryIdentifier?: string;
|
|
524
540
|
/**
|
|
525
|
-
* If set to `
|
|
526
|
-
*
|
|
527
|
-
*
|
|
528
|
-
* behavior. In Firebase terms this property of a notification is called `sticky`.
|
|
541
|
+
* If set to `true`, the notification cannot be dismissed by swipe. This setting defaults
|
|
542
|
+
* to `false` if not provided or is invalid. Corresponds directly do Android's `isOngoing` behavior.
|
|
543
|
+
* In Firebase terms this property of a notification is called `sticky`.
|
|
529
544
|
*
|
|
530
|
-
* See [Android developer documentation](https://developer.android.com/reference/android/app/Notification.Builder#
|
|
545
|
+
* See [Android developer documentation](https://developer.android.com/reference/android/app/Notification.Builder#setOngoing(boolean))
|
|
531
546
|
* and [Firebase documentation](https://firebase.google.com/docs/reference/fcm/rest/v1/projects.messages#AndroidNotification.FIELDS.sticky)
|
|
532
547
|
* for more details.
|
|
533
548
|
* @platform android
|
package/src/Tokens.types.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Platform } from 'expo-modules-core';
|
|
1
|
+
import { type Platform } from 'expo-modules-core';
|
|
2
2
|
|
|
3
3
|
// @docsMissing
|
|
4
4
|
export interface NativeDevicePushToken {
|
|
@@ -11,17 +11,20 @@ export interface WebDevicePushToken {
|
|
|
11
11
|
type: 'web';
|
|
12
12
|
data: {
|
|
13
13
|
endpoint: string;
|
|
14
|
-
keys:
|
|
15
|
-
p256dh: string;
|
|
16
|
-
auth: string;
|
|
17
|
-
};
|
|
14
|
+
keys: WebDevicePushTokenKeys;
|
|
18
15
|
};
|
|
19
16
|
}
|
|
20
17
|
|
|
21
18
|
// @docsMissing
|
|
22
|
-
type
|
|
19
|
+
export type WebDevicePushTokenKeys = {
|
|
20
|
+
p256dh: string;
|
|
21
|
+
auth: string;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
// @docsMissing
|
|
25
|
+
export type ExplicitlySupportedDevicePushToken = NativeDevicePushToken | WebDevicePushToken;
|
|
23
26
|
|
|
24
|
-
type ImplicitlySupportedDevicePushToken = {
|
|
27
|
+
export type ImplicitlySupportedDevicePushToken = {
|
|
25
28
|
/**
|
|
26
29
|
* Either `android`, `ios` or `web`.
|
|
27
30
|
*/
|
|
@@ -63,6 +66,7 @@ export interface ExpoPushToken {
|
|
|
63
66
|
data: string;
|
|
64
67
|
}
|
|
65
68
|
|
|
69
|
+
// @needsAudit
|
|
66
70
|
export interface ExpoPushTokenOptions {
|
|
67
71
|
/**
|
|
68
72
|
* Endpoint URL override.
|
|
@@ -76,7 +80,7 @@ export interface ExpoPushTokenOptions {
|
|
|
76
80
|
* Request body override.
|
|
77
81
|
*/
|
|
78
82
|
type?: string;
|
|
79
|
-
// @
|
|
83
|
+
// @docsMissing
|
|
80
84
|
deviceId?: string;
|
|
81
85
|
/**
|
|
82
86
|
* Makes sense only on iOS, where there are two push notification services: "sandbox" and "production".
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import Constants from 'expo-constants';
|
|
2
|
-
import { CodedError,
|
|
2
|
+
import { CodedError, DeviceEventEmitter, Platform } from 'expo-modules-core';
|
|
3
3
|
|
|
4
4
|
import { DevicePushToken } from './Tokens.types';
|
|
5
5
|
|
|
6
6
|
export default async function getDevicePushTokenAsync(): Promise<DevicePushToken> {
|
|
7
7
|
const data = await _subscribeDeviceToPushNotificationsAsync();
|
|
8
|
-
|
|
8
|
+
DeviceEventEmitter.emit('onDevicePushToken', { devicePushToken: data });
|
|
9
9
|
return { type: Platform.OS, data };
|
|
10
10
|
}
|
|
11
11
|
|
|
@@ -15,7 +15,8 @@ import NotificationsEmitterModule from './NotificationsEmitterModule';
|
|
|
15
15
|
* - `null` - if no notification response has been received yet,
|
|
16
16
|
* - a [`NotificationResponse`](#notificationresponse) object - if a notification response was received.
|
|
17
17
|
*
|
|
18
|
-
* @example
|
|
18
|
+
* @example
|
|
19
|
+
* Responding to a notification tap by opening a URL that could be put into the notification's `data`
|
|
19
20
|
* (opening the URL is your responsibility and is not a part of the `expo-notifications` API):
|
|
20
21
|
* ```jsx
|
|
21
22
|
* import * as Notifications from 'expo-notifications';
|