@react-native-firebase/messaging 21.7.3 → 21.8.0
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 +12 -0
- package/lib/modular/index.js +3 -3
- package/lib/version.js +1 -1
- package/package.json +3 -3
- package/__tests__/messaging.test.ts +0 -153
- package/plugin/__tests__/androidPlugin.test.ts +0 -63
- package/plugin/__tests__/fixtures/application-example.ts +0 -12
- package/plugin/__tests__/fixtures/expo-config-example.ts +0 -15
package/CHANGELOG.md
CHANGED
@@ -3,6 +3,18 @@
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
5
5
|
|
6
|
+
## [21.8.0](https://github.com/invertase/react-native-firebase/compare/v21.7.4...v21.8.0) (2025-02-10)
|
7
|
+
|
8
|
+
### Bug Fixes
|
9
|
+
|
10
|
+
- do not ship unit tests in released packages ([e71dadf](https://github.com/invertase/react-native-firebase/commit/e71dadfc1c0cad2e89c94100913af31ddf7d9c91))
|
11
|
+
|
12
|
+
## [21.7.4](https://github.com/invertase/react-native-firebase/compare/v21.7.3...v21.7.4) (2025-02-08)
|
13
|
+
|
14
|
+
### Bug Fixes
|
15
|
+
|
16
|
+
- the init calls for modular should use modular getApp() ([79da98b](https://github.com/invertase/react-native-firebase/commit/79da98bf4ecf7860db61b2813b87673f1cd0adfd))
|
17
|
+
|
6
18
|
## [21.7.3](https://github.com/invertase/react-native-firebase/compare/v21.7.2...v21.7.3) (2025-02-08)
|
7
19
|
|
8
20
|
### Bug Fixes
|
package/lib/modular/index.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
import {
|
1
|
+
import { getApp } from '@react-native-firebase/app';
|
2
2
|
|
3
3
|
/**
|
4
4
|
* @typedef {import('..').FirebaseMessagingTypes} FirebaseMessagingTypes
|
@@ -19,10 +19,10 @@ import { firebase } from '..';
|
|
19
19
|
*/
|
20
20
|
export function getMessaging(app) {
|
21
21
|
if (app) {
|
22
|
-
return
|
22
|
+
return getApp(app.name).messaging();
|
23
23
|
}
|
24
24
|
|
25
|
-
return
|
25
|
+
return getApp().messaging();
|
26
26
|
}
|
27
27
|
|
28
28
|
/**
|
package/lib/version.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1
1
|
// Generated by genversion.
|
2
|
-
module.exports = '21.
|
2
|
+
module.exports = '21.8.0';
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@react-native-firebase/messaging",
|
3
|
-
"version": "21.
|
3
|
+
"version": "21.8.0",
|
4
4
|
"author": "Invertase <oss@invertase.io> (http://invertase.io)",
|
5
5
|
"description": "React Native Firebase - React Native Firebase provides native integration of Firebase Cloud Messaging (FCM) for both Android & iOS. FCM is a cost free service, allowing for server-device and device-device communication. The React Native Firebase Messaging module provides a simple JavaScript API to interact with FCM.",
|
6
6
|
"main": "lib/index.js",
|
@@ -24,7 +24,7 @@
|
|
24
24
|
"messaging"
|
25
25
|
],
|
26
26
|
"peerDependencies": {
|
27
|
-
"@react-native-firebase/app": "21.
|
27
|
+
"@react-native-firebase/app": "21.8.0",
|
28
28
|
"expo": ">=47.0.0"
|
29
29
|
},
|
30
30
|
"devDependencies": {
|
@@ -38,5 +38,5 @@
|
|
38
38
|
"publishConfig": {
|
39
39
|
"access": "public"
|
40
40
|
},
|
41
|
-
"gitHead": "
|
41
|
+
"gitHead": "14ebd5c2d2e0f284397c331f909e533c47f2ec62"
|
42
42
|
}
|
@@ -1,153 +0,0 @@
|
|
1
|
-
import { describe, expect, it } from '@jest/globals';
|
2
|
-
|
3
|
-
import {
|
4
|
-
getMessaging,
|
5
|
-
deleteToken,
|
6
|
-
getToken,
|
7
|
-
onMessage,
|
8
|
-
onNotificationOpenedApp,
|
9
|
-
onTokenRefresh,
|
10
|
-
requestPermission,
|
11
|
-
isAutoInitEnabled,
|
12
|
-
setAutoInitEnabled,
|
13
|
-
getInitialNotification,
|
14
|
-
getDidOpenSettingsForNotification,
|
15
|
-
getIsHeadless,
|
16
|
-
registerDeviceForRemoteMessages,
|
17
|
-
isDeviceRegisteredForRemoteMessages,
|
18
|
-
unregisterDeviceForRemoteMessages,
|
19
|
-
getAPNSToken,
|
20
|
-
setAPNSToken,
|
21
|
-
hasPermission,
|
22
|
-
onDeletedMessages,
|
23
|
-
onMessageSent,
|
24
|
-
onSendError,
|
25
|
-
setBackgroundMessageHandler,
|
26
|
-
setOpenSettingsForNotificationsHandler,
|
27
|
-
sendMessage,
|
28
|
-
subscribeToTopic,
|
29
|
-
unsubscribeFromTopic,
|
30
|
-
isDeliveryMetricsExportToBigQueryEnabled,
|
31
|
-
isSupported,
|
32
|
-
experimentalSetDeliveryMetricsExportedToBigQueryEnabled,
|
33
|
-
} from '../lib';
|
34
|
-
|
35
|
-
describe('Firestore', function () {
|
36
|
-
describe('modular', function () {
|
37
|
-
it('`getMessaging` function is properly exposed to end user', function () {
|
38
|
-
expect(getMessaging).toBeDefined();
|
39
|
-
});
|
40
|
-
|
41
|
-
it('`deleteToken` function is properly exposed to end user', function () {
|
42
|
-
expect(deleteToken).toBeDefined();
|
43
|
-
});
|
44
|
-
|
45
|
-
it('`getToken` function is properly exposed to end user', function () {
|
46
|
-
expect(getToken).toBeDefined();
|
47
|
-
});
|
48
|
-
|
49
|
-
it('`onMessage` function is properly exposed to end user', function () {
|
50
|
-
expect(onMessage).toBeDefined();
|
51
|
-
});
|
52
|
-
|
53
|
-
it('`onNotificationOpenedApp` function is properly exposed to end user', function () {
|
54
|
-
expect(onNotificationOpenedApp).toBeDefined();
|
55
|
-
});
|
56
|
-
|
57
|
-
it('`onTokenRefresh` function is properly exposed to end user', function () {
|
58
|
-
expect(onTokenRefresh).toBeDefined();
|
59
|
-
});
|
60
|
-
|
61
|
-
it('`requestPermission` function is properly exposed to end user', function () {
|
62
|
-
expect(requestPermission).toBeDefined();
|
63
|
-
});
|
64
|
-
|
65
|
-
it('`isAutoInitEnabled` function is properly exposed to end user', function () {
|
66
|
-
expect(isAutoInitEnabled).toBeDefined();
|
67
|
-
});
|
68
|
-
|
69
|
-
it('`setAutoInitEnabled` function is properly exposed to end user', function () {
|
70
|
-
expect(setAutoInitEnabled).toBeDefined();
|
71
|
-
});
|
72
|
-
|
73
|
-
it('`getInitialNotification` function is properly exposed to end user', function () {
|
74
|
-
expect(getInitialNotification).toBeDefined();
|
75
|
-
});
|
76
|
-
|
77
|
-
it('`getDidOpenSettingsForNotification` function is properly exposed to end user', function () {
|
78
|
-
expect(getDidOpenSettingsForNotification).toBeDefined();
|
79
|
-
});
|
80
|
-
|
81
|
-
it('`getIsHeadless` function is properly exposed to end user', function () {
|
82
|
-
expect(getIsHeadless).toBeDefined();
|
83
|
-
});
|
84
|
-
|
85
|
-
it('`registerDeviceForRemoteMessages` function is properly exposed to end user', function () {
|
86
|
-
expect(registerDeviceForRemoteMessages).toBeDefined();
|
87
|
-
});
|
88
|
-
|
89
|
-
it('`isDeviceRegisteredForRemoteMessages` function is properly exposed to end user', function () {
|
90
|
-
expect(isDeviceRegisteredForRemoteMessages).toBeDefined();
|
91
|
-
});
|
92
|
-
|
93
|
-
it('`unregisterDeviceForRemoteMessages` function is properly exposed to end user', function () {
|
94
|
-
expect(unregisterDeviceForRemoteMessages).toBeDefined();
|
95
|
-
});
|
96
|
-
|
97
|
-
it('`getAPNSToken` function is properly exposed to end user', function () {
|
98
|
-
expect(getAPNSToken).toBeDefined();
|
99
|
-
});
|
100
|
-
|
101
|
-
it('`setAPNSToken` function is properly exposed to end user', function () {
|
102
|
-
expect(setAPNSToken).toBeDefined();
|
103
|
-
});
|
104
|
-
|
105
|
-
it('`hasPermission` function is properly exposed to end user', function () {
|
106
|
-
expect(hasPermission).toBeDefined();
|
107
|
-
});
|
108
|
-
|
109
|
-
it('`onDeletedMessages` function is properly exposed to end user', function () {
|
110
|
-
expect(onDeletedMessages).toBeDefined();
|
111
|
-
});
|
112
|
-
|
113
|
-
it('`onMessageSent` function is properly exposed to end user', function () {
|
114
|
-
expect(onMessageSent).toBeDefined();
|
115
|
-
});
|
116
|
-
|
117
|
-
it('`onSendError` function is properly exposed to end user', function () {
|
118
|
-
expect(onSendError).toBeDefined();
|
119
|
-
});
|
120
|
-
|
121
|
-
it('`setBackgroundMessageHandler` function is properly exposed to end user', function () {
|
122
|
-
expect(setBackgroundMessageHandler).toBeDefined();
|
123
|
-
});
|
124
|
-
|
125
|
-
it('`setOpenSettingsForNotificationsHandler` function is properly exposed to end user', function () {
|
126
|
-
expect(setOpenSettingsForNotificationsHandler).toBeDefined();
|
127
|
-
});
|
128
|
-
|
129
|
-
it('`sendMessage` function is properly exposed to end user', function () {
|
130
|
-
expect(sendMessage).toBeDefined();
|
131
|
-
});
|
132
|
-
|
133
|
-
it('`subscribeToTopic` function is properly exposed to end user', function () {
|
134
|
-
expect(subscribeToTopic).toBeDefined();
|
135
|
-
});
|
136
|
-
|
137
|
-
it('`unsubscribeFromTopic` function is properly exposed to end user', function () {
|
138
|
-
expect(unsubscribeFromTopic).toBeDefined();
|
139
|
-
});
|
140
|
-
|
141
|
-
it('`isDeliveryMetricsExportToBigQueryEnabled` function is properly exposed to end user', function () {
|
142
|
-
expect(isDeliveryMetricsExportToBigQueryEnabled).toBeDefined();
|
143
|
-
});
|
144
|
-
|
145
|
-
it('`isSupported` function is properly exposed to end user', function () {
|
146
|
-
expect(isSupported).toBeDefined();
|
147
|
-
});
|
148
|
-
|
149
|
-
it('`experimentalSetDeliveryMetricsExportedToBigQueryEnabled` function is properly exposed to end user', function () {
|
150
|
-
expect(experimentalSetDeliveryMetricsExportedToBigQueryEnabled).toBeDefined();
|
151
|
-
});
|
152
|
-
});
|
153
|
-
});
|
@@ -1,63 +0,0 @@
|
|
1
|
-
import { describe, expect, it, jest } from '@jest/globals';
|
2
|
-
import { setFireBaseMessagingAndroidManifest } from '../src/android/setupFirebaseNotifationIcon';
|
3
|
-
import { ExpoConfig } from '@expo/config-types';
|
4
|
-
import expoConfigExample from './fixtures/expo-config-example';
|
5
|
-
import manifestApplicationExample from './fixtures/application-example';
|
6
|
-
import { ManifestApplication } from '@expo/config-plugins/build/android/Manifest';
|
7
|
-
|
8
|
-
describe('Config Plugin Android Tests', function () {
|
9
|
-
it('applies changes to app/src/main/AndroidManifest.xml with color', async function () {
|
10
|
-
const config: ExpoConfig = JSON.parse(JSON.stringify(expoConfigExample));
|
11
|
-
const manifestApplication: ManifestApplication = JSON.parse(
|
12
|
-
JSON.stringify(manifestApplicationExample),
|
13
|
-
);
|
14
|
-
setFireBaseMessagingAndroidManifest(config, manifestApplication);
|
15
|
-
expect(manifestApplication['meta-data']).toContainEqual({
|
16
|
-
$: {
|
17
|
-
'android:name': 'com.google.firebase.messaging.default_notification_icon',
|
18
|
-
'android:resource': '@drawable/notification_icon',
|
19
|
-
},
|
20
|
-
});
|
21
|
-
expect(manifestApplication['meta-data']).toContainEqual({
|
22
|
-
$: {
|
23
|
-
'android:name': 'com.google.firebase.messaging.default_notification_color',
|
24
|
-
'android:resource': '@color/notification_icon_color',
|
25
|
-
'tools:replace': 'android:resource',
|
26
|
-
},
|
27
|
-
});
|
28
|
-
});
|
29
|
-
|
30
|
-
it('applies changes to app/src/main/AndroidManifest.xml without color', async function () {
|
31
|
-
const config = JSON.parse(JSON.stringify(expoConfigExample));
|
32
|
-
const manifestApplication: ManifestApplication = JSON.parse(
|
33
|
-
JSON.stringify(manifestApplicationExample),
|
34
|
-
);
|
35
|
-
config.notification!.color = undefined;
|
36
|
-
setFireBaseMessagingAndroidManifest(config, manifestApplication);
|
37
|
-
expect(manifestApplication['meta-data']).toContainEqual({
|
38
|
-
$: {
|
39
|
-
'android:name': 'com.google.firebase.messaging.default_notification_icon',
|
40
|
-
'android:resource': '@drawable/notification_icon',
|
41
|
-
},
|
42
|
-
});
|
43
|
-
expect(manifestApplication['meta-data']).not.toContainEqual({
|
44
|
-
$: {
|
45
|
-
'android:name': 'com.google.firebase.messaging.default_notification_icon',
|
46
|
-
'android:resource': '@drawable/notification_icon_color',
|
47
|
-
'tools:replace': 'android:resource',
|
48
|
-
},
|
49
|
-
});
|
50
|
-
});
|
51
|
-
|
52
|
-
it('applies changes to app/src/main/AndroidManifest.xml without notification', async function () {
|
53
|
-
const warnSpy = jest.spyOn(console, 'warn');
|
54
|
-
const config: ExpoConfig = JSON.parse(JSON.stringify(expoConfigExample));
|
55
|
-
const manifestApplication: ManifestApplication = JSON.parse(
|
56
|
-
JSON.stringify(manifestApplicationExample),
|
57
|
-
);
|
58
|
-
config.notification = undefined;
|
59
|
-
setFireBaseMessagingAndroidManifest(config, manifestApplication);
|
60
|
-
expect(warnSpy).toHaveBeenCalled();
|
61
|
-
warnSpy.mockRestore();
|
62
|
-
});
|
63
|
-
});
|
@@ -1,12 +0,0 @@
|
|
1
|
-
import { ManifestApplication } from '@expo/config-plugins/build/android/Manifest';
|
2
|
-
|
3
|
-
/**
|
4
|
-
* @type {import('"@expo/config-plugins/build/android/Manifest"').ManifestApplication}
|
5
|
-
*/
|
6
|
-
const manifestApplicationExample: ManifestApplication = {
|
7
|
-
$: {
|
8
|
-
'android:name': '',
|
9
|
-
},
|
10
|
-
};
|
11
|
-
|
12
|
-
export default manifestApplicationExample;
|
@@ -1,15 +0,0 @@
|
|
1
|
-
import { ExpoConfig } from '@expo/config-types';
|
2
|
-
|
3
|
-
/**
|
4
|
-
* @type {import('@expo/config-types').ExpoConfig}
|
5
|
-
*/
|
6
|
-
const expoConfigExample: ExpoConfig = {
|
7
|
-
name: 'FirebaseMessagingTest',
|
8
|
-
slug: 'fire-base-messaging-test',
|
9
|
-
notification: {
|
10
|
-
icon: 'IconAsset',
|
11
|
-
color: '#1D172D',
|
12
|
-
},
|
13
|
-
};
|
14
|
-
|
15
|
-
export default expoConfigExample;
|