Skip to content
This repository was archived by the owner on Jan 14, 2025. It is now read-only.

Commit 64e2a67

Browse files
committed
Merge branch 'master' into dev and prepare 6.0.0
* master: Upgrade to 5.1.1. Fix #1641 Add explanation to DO NOT USE `.configure()` INSIDE A COMPONENT, EVEN `App` # Conflicts: # CHANGELOG.md
2 parents a4ba5ba + a99269c commit 64e2a67

File tree

6 files changed

+18
-52
lines changed

6 files changed

+18
-52
lines changed

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,15 @@ This project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html
4343

4444
### Fixed
4545

46+
<<<<<<< HEAD
4647
- (iOS) upgrade `@react-native-community/push-notification-ios`, fixe the value of `userInteraction` [@react-native-community/push-notification-ios#122](https://github.com/react-native-community/push-notification-ios/pull/122).
48+
=======
49+
## [5.1.1] 2020-09-15
50+
51+
### Fixed
52+
53+
- (Android) Fatal Exception: java.lang.NullPointerException [#1641](https://github.com/zo0r/react-native-push-notification/issues/1641)
54+
>>>>>>> master
4755
4856
## [5.1.0] 2020-08-31
4957

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
React Native Local and Remote Notifications for iOS and Android
77

88

9-
## 🎉 Version 5.x is live ! 🎉
9+
## 🎉 Version 6.x is live ! 🎉
1010

11-
Check out for changes in the CHANGELOG:
11+
Check out for changes and migration in the CHANGELOG:
1212

1313
[Changelog](https://github.com/zo0r/react-native-push-notification/blob/master/CHANGELOG.md)
1414

@@ -214,6 +214,8 @@ public class MainApplication extends Application implements ReactApplication {
214214
## Usage
215215

216216
**DO NOT USE `.configure()` INSIDE A COMPONENT, EVEN `App`**
217+
> If you do, notification handlers will not fire, because they are not loaded. Instead, use `.configure()` in the app's first file, usually `index.js`.
218+
217219

218220
```javascript
219221
import PushNotificationIOS from "@react-native-community/push-notification-ios";

android/src/main/java/com/dieam/reactnativepushnotification/modules/RNPushNotificationAttributes.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,9 +157,9 @@ private RNPushNotificationAttributes(JSONObject jsonObject) {
157157
tag = jsonObject.has(TAG) ? jsonObject.getString(TAG) : null;
158158
repeatType = jsonObject.has(REPEAT_TYPE) ? jsonObject.getString(REPEAT_TYPE) : null;
159159
repeatTime = jsonObject.has(REPEAT_TIME) ? jsonObject.getDouble(REPEAT_TIME) : 0.0;
160-
when = jsonObject.has(WHEN) ? jsonObject.getDouble(WHEN) : null;
160+
when = jsonObject.has(WHEN) ? jsonObject.getDouble(WHEN) : -1;
161161
usesChronometer = jsonObject.has(USES_CHRONOMETER) ? jsonObject.getBoolean(USES_CHRONOMETER) : false;
162-
timeoutAfter = jsonObject.has(TIMEOUT_AFTER) ? jsonObject.getDouble(TIMEOUT_AFTER) : null;
162+
timeoutAfter = jsonObject.has(TIMEOUT_AFTER) ? jsonObject.getDouble(TIMEOUT_AFTER) : -1;
163163
onlyAlertOnce = jsonObject.has(ONLY_ALERT_ONCE) ? jsonObject.getBoolean(ONLY_ALERT_ONCE) : false;
164164
ongoing = jsonObject.has(ONGOING) ? jsonObject.getBoolean(ONGOING) : false;
165165
allowWhileIdle = jsonObject.has(ALLOW_WHILE_IDLE) ? jsonObject.getBoolean(ALLOW_WHILE_IDLE) : false;

android/src/main/java/com/dieam/reactnativepushnotification/modules/RNPushNotificationHelper.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -457,14 +457,14 @@ public void sendToNotificationCentreWithPicture(Bundle bundle, Bitmap largeIconB
457457

458458
Long timeoutAfter = (long) bundle.getDouble("timeoutAfter");
459459

460-
if (timeoutAfter != null) {
460+
if (timeoutAfter != null && timeoutAfter >= 0) {
461461
notification.setTimeoutAfter(timeoutAfter);
462462
}
463463
}
464464

465465
Long when = (long) bundle.getDouble("when");
466466

467-
if (when != null) {
467+
if (when != null && when >= 0) {
468468
notification.setWhen(when);
469469
}
470470

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-native-push-notification",
3-
"version": "5.1.0",
3+
"version": "6.0.0",
44
"description": "React Native Local and Remote Notifications",
55
"main": "index.js",
66
"scripts": {

trouble-shooting.md

Lines changed: 1 addition & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ Known bugs and issues:
5050

5151
# About notifications...
5252

53-
There are a number of different types of notifications, and they have subtly different behaviours. There are essentially 4 types, let's call them _local notifications_ (1), _noisy remote push notifications_ (2), _silent remote push notifications_ (3) and _mixed remote push notifications_ (4).
53+
There are a number of different types of notifications, and they have subtly different behaviours. There are essentially 4 types, let's call them _local notifications_ (1), _noisy remote push notifications_ (2) and _silent remote push notifications_ (3).
5454

5555
## 1. local notifications
5656

@@ -203,50 +203,6 @@ The crucial bit of an iOS silent notification is presence of the `"content-avail
203203

204204
After you have processed the notification you must call isn't `finish` method (as of RN 0.38).
205205

206-
## 4. _mixed_ remote push notifications
207-
208-
_Mixed_ remote push notifications are both delivered to your app AND to the notification center.
209-
210-
#### Android _mixed_ remote push notifications
211-
212-
Android doesn't directly support mixed notifications. If you try to combine the above approaches you will see a _noisy_ notification but it will not be delivered to your app. This library does however provide a basic work-around. By adding `message` field to a _silent_ notification the library will synthesize a local notification as well as deliver a _silent_ notification to your app. Something like this:
213-
214-
```json
215-
{
216-
"to": "<token>",
217-
"time_to_live": 86400,
218-
"collapse_key": "new_message",
219-
"delay_while_idle": false,
220-
"data": {
221-
"title": "title",
222-
"message": "this is a mixed test 14:03:29.676",
223-
"your-key": "your-value"
224-
}
225-
}
226-
```
227-
228-
The resulting local notification will include the message as well as a few other (optional) fields: _title_, _sound_ and _colour_
229-
230-
#### iOS _mixed_ remote push notifications
231-
232-
Just combine the above _silent_ and _noisy_ notifications and send to APNS:
233-
234-
```json
235-
{
236-
"aps": {
237-
"alert": {
238-
"body": "body 16:03:49.889",
239-
"title": "title"
240-
},
241-
"badge": 1,
242-
"sound": "default"
243-
},
244-
"payload": "{\"your-key\":\"your-value\"}"
245-
}
246-
```
247-
248-
It will be delivered to both the notification centre **and** your app if the app is running in the background, but only to your app if it's running in the foreground.
249-
250206
#### Some useful links
251207

252208
* http://www.fantageek.com/blog/2016/04/15/push-notification-in-practice/

0 commit comments

Comments
 (0)