@react-native-firebase/messaging 15.1.1 → 15.2.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
CHANGED
@@ -3,6 +3,12 @@
|
|
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
|
+
# [15.2.0](https://github.com/invertase/react-native-firebase/compare/v15.1.1...v15.2.0) (2022-07-21)
|
7
|
+
|
8
|
+
### Features
|
9
|
+
|
10
|
+
- **ios, messaging:** Allow notifications in foreground on iOS, configure in firebase.json ([#6407](https://github.com/invertase/react-native-firebase/issues/6407)) ([71dee2b](https://github.com/invertase/react-native-firebase/commit/71dee2bac7a2ea58e51605a249cab7f1ac5fa7d7))
|
11
|
+
|
6
12
|
## [15.1.1](https://github.com/invertase/react-native-firebase/compare/v15.1.0...v15.1.1) (2022-06-28)
|
7
13
|
|
8
14
|
**Note:** Version bump only for package @react-native-firebase/messaging
|
package/android/build.gradle
CHANGED
@@ -34,7 +34,6 @@ def firebaseBomVersion = appPackageJson['sdkVersions']['android']['firebase']
|
|
34
34
|
def jsonMinSdk = appPackageJson['sdkVersions']['android']['minSdk']
|
35
35
|
def jsonTargetSdk = appPackageJson['sdkVersions']['android']['targetSdk']
|
36
36
|
def jsonCompileSdk = appPackageJson['sdkVersions']['android']['compileSdk']
|
37
|
-
def jsonBuildTools = appPackageJson['sdkVersions']['android']['buildTools']
|
38
37
|
def coreVersionDetected = appPackageJson['version']
|
39
38
|
def coreVersionRequired = packageJson['peerDependencies'][appPackageJson['name']]
|
40
39
|
// Only log after build completed so log warning appears at the end
|
@@ -51,9 +50,6 @@ project.ext {
|
|
51
50
|
minSdk : jsonMinSdk,
|
52
51
|
targetSdk : jsonTargetSdk,
|
53
52
|
compileSdk: jsonCompileSdk,
|
54
|
-
// optional as gradle.buildTools comes with one by default
|
55
|
-
// overriding here though to match the version RN uses
|
56
|
-
buildTools: jsonBuildTools
|
57
53
|
],
|
58
54
|
|
59
55
|
firebase: [
|
@@ -17,6 +17,7 @@
|
|
17
17
|
|
18
18
|
#import <RNFBApp/RNFBRCTEventEmitter.h>
|
19
19
|
|
20
|
+
#import "RNFBJSON.h"
|
20
21
|
#import "RNFBMessaging+UNUserNotificationCenter.h"
|
21
22
|
#import "RNFBMessagingSerializer.h"
|
22
23
|
|
@@ -82,6 +83,50 @@ struct {
|
|
82
83
|
willPresentNotification:(UNNotification *)notification
|
83
84
|
withCompletionHandler:
|
84
85
|
(void (^)(UNNotificationPresentationOptions options))completionHandler {
|
86
|
+
NSArray *presentationOptionsConfig =
|
87
|
+
[[RNFBJSON shared] getArrayValue:@"messaging_ios_foreground_presentation_options"
|
88
|
+
defaultValue:@[]];
|
89
|
+
|
90
|
+
UNNotificationPresentationOptions presentationOptions = UNNotificationPresentationOptionNone;
|
91
|
+
|
92
|
+
BOOL badge = [presentationOptionsConfig containsObject:@"badge"];
|
93
|
+
BOOL sound = [presentationOptionsConfig containsObject:@"sound"];
|
94
|
+
BOOL alert = [presentationOptionsConfig containsObject:@"alert"];
|
95
|
+
BOOL list = [presentationOptionsConfig containsObject:@"list"];
|
96
|
+
BOOL banner = [presentationOptionsConfig containsObject:@"banner"];
|
97
|
+
|
98
|
+
if (badge) {
|
99
|
+
presentationOptions |= UNNotificationPresentationOptionBadge;
|
100
|
+
}
|
101
|
+
|
102
|
+
if (sound) {
|
103
|
+
presentationOptions |= UNNotificationPresentationOptionSound;
|
104
|
+
}
|
105
|
+
|
106
|
+
// if list or banner is true, ignore `alert` property
|
107
|
+
if (banner || list) {
|
108
|
+
if (banner) {
|
109
|
+
if (@available(iOS 14, *)) {
|
110
|
+
presentationOptions |= UNNotificationPresentationOptionBanner;
|
111
|
+
} else {
|
112
|
+
// for iOS 13 we need to set `alert`
|
113
|
+
presentationOptions |= UNNotificationPresentationOptionAlert;
|
114
|
+
}
|
115
|
+
}
|
116
|
+
|
117
|
+
if (list) {
|
118
|
+
if (@available(iOS 14, *)) {
|
119
|
+
presentationOptions |= UNNotificationPresentationOptionList;
|
120
|
+
} else {
|
121
|
+
// for iOS 13 we need to set `alert`
|
122
|
+
presentationOptions |= UNNotificationPresentationOptionAlert;
|
123
|
+
}
|
124
|
+
}
|
125
|
+
} else if (alert) {
|
126
|
+
// TODO: Remove `alert` once iOS 14 becomes the minimum deployment target
|
127
|
+
presentationOptions |= UNNotificationPresentationOptionAlert;
|
128
|
+
}
|
129
|
+
|
85
130
|
if (notification.request.content.userInfo[@"gcm.message_id"]) {
|
86
131
|
NSDictionary *notificationDict = [RNFBMessagingSerializer notificationToDict:notification];
|
87
132
|
|
@@ -91,9 +136,7 @@ struct {
|
|
91
136
|
[[RNFBRCTEventEmitter shared] sendEventWithName:@"messaging_message_received"
|
92
137
|
body:notificationDict];
|
93
138
|
}
|
94
|
-
|
95
|
-
// TODO in a later version allow customising completion options in JS code
|
96
|
-
completionHandler(UNNotificationPresentationOptionNone);
|
139
|
+
completionHandler(presentationOptions);
|
97
140
|
}
|
98
141
|
|
99
142
|
if (_originalDelegate != nil && originalDelegateRespondsTo.willPresentNotification) {
|
@@ -101,7 +144,7 @@ struct {
|
|
101
144
|
willPresentNotification:notification
|
102
145
|
withCompletionHandler:completionHandler];
|
103
146
|
} else {
|
104
|
-
completionHandler(
|
147
|
+
completionHandler(presentationOptions);
|
105
148
|
}
|
106
149
|
}
|
107
150
|
|
package/lib/version.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1
1
|
// Generated by genversion.
|
2
|
-
module.exports = '15.
|
2
|
+
module.exports = '15.2.0';
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@react-native-firebase/messaging",
|
3
|
-
"version": "15.
|
3
|
+
"version": "15.2.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",
|
@@ -22,10 +22,10 @@
|
|
22
22
|
"messaging"
|
23
23
|
],
|
24
24
|
"peerDependencies": {
|
25
|
-
"@react-native-firebase/app": "15.
|
25
|
+
"@react-native-firebase/app": "15.2.0"
|
26
26
|
},
|
27
27
|
"publishConfig": {
|
28
28
|
"access": "public"
|
29
29
|
},
|
30
|
-
"gitHead": "
|
30
|
+
"gitHead": "8fb859fb000d5c2c6bbb81dffc685e94ef1ba350"
|
31
31
|
}
|