expo-notifications 1.0.0-canary-20250131-5c4e588 → 1.0.0-canary-20250207-8bc5146
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md
CHANGED
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
|
|
13
13
|
### 💡 Others
|
|
14
14
|
|
|
15
|
+
- Add better error when Firebase is not set up ([#34694](https://github.com/expo/expo/pull/34694) by [@vonovak](https://github.com/vonovak))
|
|
15
16
|
- [apple] Migrate remaining `expo-module.config.json` to unified platform syntax. ([#34445](https://github.com/expo/expo/pull/34445) by [@reichhartd](https://github.com/reichhartd))
|
|
16
17
|
- [iOS] Swift conversion 6: refactor Record classes. ([#34413](https://github.com/expo/expo/pull/34413) by [@douglowder](https://github.com/douglowder))
|
|
17
18
|
|
|
@@ -44,15 +44,15 @@ class PushTokenModule : Module(), PushTokenListener {
|
|
|
44
44
|
* @param promise Promise to be resolved with the token.
|
|
45
45
|
*/
|
|
46
46
|
AsyncFunction("getDevicePushTokenAsync") { promise: Promise ->
|
|
47
|
-
|
|
47
|
+
val instance = getFirebaseMessagingInstance(promise) ?: return@AsyncFunction
|
|
48
|
+
instance.token
|
|
48
49
|
.addOnCompleteListener { task ->
|
|
49
50
|
if (!task.isSuccessful) {
|
|
50
51
|
val exception = task.exception
|
|
51
52
|
promise.reject(REGISTRATION_FAIL_CODE, "Fetching the token failed: ${exception?.message ?: "unknown"}", exception)
|
|
52
53
|
return@addOnCompleteListener
|
|
53
54
|
}
|
|
54
|
-
val token = task.result
|
|
55
|
-
if (token == null) {
|
|
55
|
+
val token = task.result ?: run {
|
|
56
56
|
promise.reject(REGISTRATION_FAIL_CODE, "Fetching the token failed. Invalid token.", null)
|
|
57
57
|
return@addOnCompleteListener
|
|
58
58
|
}
|
|
@@ -63,7 +63,8 @@ class PushTokenModule : Module(), PushTokenListener {
|
|
|
63
63
|
}
|
|
64
64
|
|
|
65
65
|
AsyncFunction("unregisterForNotificationsAsync") { promise: Promise ->
|
|
66
|
-
|
|
66
|
+
val instance = getFirebaseMessagingInstance(promise) ?: return@AsyncFunction
|
|
67
|
+
instance.deleteToken()
|
|
67
68
|
.addOnCompleteListener { task ->
|
|
68
69
|
if (!task.isSuccessful) {
|
|
69
70
|
val exception = task.exception
|
|
@@ -75,6 +76,19 @@ class PushTokenModule : Module(), PushTokenListener {
|
|
|
75
76
|
}
|
|
76
77
|
}
|
|
77
78
|
|
|
79
|
+
private fun getFirebaseMessagingInstance(promise: Promise): FirebaseMessaging? {
|
|
80
|
+
return try {
|
|
81
|
+
FirebaseMessaging.getInstance()
|
|
82
|
+
} catch (e: IllegalStateException) {
|
|
83
|
+
promise.reject(
|
|
84
|
+
REGISTRATION_FAIL_CODE,
|
|
85
|
+
"Make sure to complete the guide at https://docs.expo.dev/push-notifications/fcm-credentials/ : ${e.message}",
|
|
86
|
+
e
|
|
87
|
+
)
|
|
88
|
+
null
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
78
92
|
/**
|
|
79
93
|
* Callback called when [PushTokenManager] gets notified of a new token.
|
|
80
94
|
* Emits a [NEW_TOKEN_EVENT_NAME] event.
|
package/expo-module.config.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "expo-notifications",
|
|
3
|
-
"version": "1.0.0-canary-
|
|
3
|
+
"version": "1.0.0-canary-20250207-8bc5146",
|
|
4
4
|
"description": "Provides an API to fetch push notification tokens and to present, schedule, receive, and respond to notifications.",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"types": "build/index.d.ts",
|
|
@@ -38,21 +38,22 @@
|
|
|
38
38
|
"preset": "expo-module-scripts/ios"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@expo/image-utils": "0.6.5-canary-
|
|
41
|
+
"@expo/image-utils": "0.6.5-canary-20250207-8bc5146",
|
|
42
42
|
"@ide/backoff": "^1.0.0",
|
|
43
43
|
"abort-controller": "^3.0.0",
|
|
44
44
|
"assert": "^2.0.0",
|
|
45
45
|
"badgin": "^1.1.5",
|
|
46
|
-
"expo-application": "6.0.3-canary-
|
|
47
|
-
"expo-constants": "17.0.6-canary-
|
|
46
|
+
"expo-application": "6.0.3-canary-20250207-8bc5146",
|
|
47
|
+
"expo-constants": "17.0.6-canary-20250207-8bc5146"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
|
-
"expo-module-scripts": "4.0.4-canary-
|
|
50
|
+
"expo-module-scripts": "4.0.4-canary-20250207-8bc5146",
|
|
51
51
|
"memfs": "^3.2.0"
|
|
52
52
|
},
|
|
53
53
|
"peerDependencies": {
|
|
54
|
-
"expo": "53.0.0-canary-
|
|
54
|
+
"expo": "53.0.0-canary-20250207-8bc5146",
|
|
55
55
|
"react": "*",
|
|
56
56
|
"react-native": "*"
|
|
57
|
-
}
|
|
57
|
+
},
|
|
58
|
+
"gitHead": "8bc5146852ccd7033138bac9ef8d3c41ae85a211"
|
|
58
59
|
}
|