react-native-push-notification
Advanced tools
Comparing version 7.2.3 to 7.3.0
@@ -15,2 +15,11 @@ # Changelog | ||
## [7.3.0] 2021-05-12 | ||
### Features | ||
- (Android) Add constants for notification importance [#1959](https://github.com/zo0r/react-native-push-notification/pull/1959) | ||
### Fixed | ||
- (Android) Fix: Task :react-native-push-notification:compileDebugJavaWithJavac FAILED [#1979](https://github.com/zo0r/react-native-push-notification/issues/1979) | ||
## [7.2.3] 2021-03-18 | ||
@@ -17,0 +26,0 @@ |
10
index.js
@@ -607,2 +607,12 @@ /** | ||
// https://developer.android.com/reference/android/app/NotificationManager#IMPORTANCE_DEFAULT | ||
Notifications.Importance = Object.freeze({ | ||
DEFAULT: 3, | ||
HIGH: 4, | ||
LOW: 2, | ||
MIN: 1, | ||
NONE: 0, | ||
UNSPECIFIED: -1000, | ||
}); | ||
module.exports = Notifications; |
{ | ||
"name": "react-native-push-notification", | ||
"version": "7.2.3", | ||
"version": "7.3.0", | ||
"description": "React Native Local and Remote Notifications", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -61,21 +61,2 @@ # React Native Push Notifications | ||
When done, modify the following method in the file `AppDelegate.m`: | ||
```objective-c | ||
// Called when a notification is delivered to a foreground app. | ||
-(void)userNotificationCenter:(UNUserNotificationCenter *)center | ||
willPresentNotification:(UNNotification *)notification | ||
withCompletionHandler:(void (^)(UNNotificationPresentationOptions options))completionHandler | ||
{ | ||
// Still call the JS onNotification handler so it can display the new message right away | ||
NSDictionary *userInfo = notification.request.content.userInfo; | ||
[RNCPushNotificationIOS didReceiveRemoteNotification:userInfo | ||
fetchCompletionHandler:^void (UIBackgroundFetchResult result){}]; | ||
// allow showing foreground notifications | ||
completionHandler(UNNotificationPresentationOptionSound | UNNotificationPresentationOptionAlert | UNNotificationPresentationOptionBadge); | ||
// or if you wish to hide all notification while in foreground replace it with | ||
// completionHandler(UNNotificationPresentationOptionNone); | ||
} | ||
``` | ||
## Android manual Installation | ||
@@ -146,2 +127,13 @@ | ||
If your app has an @Override on onNewIntent in `MainActivity.java` ensure that function includes a super call on onNewIntent (if your `MainActivity.java` does not have an @Override for onNewIntent skip this): | ||
```java | ||
@Override | ||
public void onNewIntent(Intent intent) { | ||
... | ||
super.onNewIntent(intent); | ||
... | ||
} | ||
``` | ||
### If you use remote notifications | ||
@@ -222,6 +214,6 @@ | ||
return Arrays.<ReactPackage>asList( | ||
new MainReactPackage(), | ||
new ReactNativePushNotificationPackage() // <---- Add the Package | ||
); | ||
return Arrays.<ReactPackage>asList( | ||
new MainReactPackage(), | ||
new ReactNativePushNotificationPackage() // <---- Add the Package | ||
); | ||
} | ||
@@ -417,2 +409,4 @@ }; | ||
```javascript | ||
import PushNotification, {Importance} from 'react-native-push-notification'; | ||
... | ||
PushNotification.createChannel( | ||
@@ -425,3 +419,3 @@ { | ||
soundName: "default", // (optional) See `soundName` parameter of `localNotification` function | ||
importance: 4, // (optional) default: 4. Int value of the Android notification importance | ||
importance: Importance.HIGH, // (optional) default: Importance.HIGH. Int value of the Android notification importance | ||
vibrate: true, // (optional) default: true. Creates the default vibration patten if true. | ||
@@ -606,6 +600,6 @@ }, | ||
"max" = NotficationCompat.PRIORITY_MAX | ||
"high" = NotficationCompat.PRIORITY_HIGH | ||
"low" = NotficationCompat.PRIORITY_LOW | ||
"min" = NotficationCompat.PRIORITY_MIN | ||
"max" = NotficationCompat.PRIORITY_MAX\ | ||
"high" = NotficationCompat.PRIORITY_HIGH\ | ||
"low" = NotficationCompat.PRIORITY_LOW\ | ||
"min" = NotficationCompat.PRIORITY_MIN\ | ||
"default" = NotficationCompat.PRIORITY_DEFAULT | ||
@@ -621,5 +615,5 @@ | ||
"private" = NotficationCompat.VISIBILITY_PRIVATE | ||
"public" = NotficationCompat.VISIBILITY_PUBLIC | ||
"secret" = NotficationCompat.VISIBILITY_SECRET | ||
"private" = NotficationCompat.VISIBILITY_PRIVATE\ | ||
"public" = NotficationCompat.VISIBILITY_PUBLIC\ | ||
"secret" = NotficationCompat.VISIBILITY_SECRET | ||
@@ -630,13 +624,13 @@ More information: https://developer.android.com/reference/android/app/Notification.html#VISIBILITY_PRIVATE | ||
(optional) Specify `importance` to set importance of notification. Default value: "high" | ||
(optional) Specify `importance` to set importance of notification. Default value: Importance.HIGH | ||
Constants available on the `Importance` object. `import PushNotification, {Importance} from 'react-native-push-notification';` | ||
Available options: | ||
"default" = NotificationManager.IMPORTANCE_DEFAULT | ||
"max" = NotificationManager.IMPORTANCE_MAX | ||
"high" = NotificationManager.IMPORTANCE_HIGH | ||
"low" = NotificationManager.IMPORTANCE_LOW | ||
"min" = NotificationManager.IMPORTANCE_MIN | ||
"none" = NotificationManager.IMPORTANCE_NONE | ||
"unspecified" = NotificationManager.IMPORTANCE_UNSPECIFIED | ||
Importance.DEFAULT = NotificationManager.IMPORTANCE_DEFAULT\ | ||
Importance.HIGH = NotificationManager.IMPORTANCE_HIGH\ | ||
Importance.LOW = NotificationManager.IMPORTANCE_LOW\ | ||
Importance.MIN = NotificationManager.IMPORTANCE_MIN\ | ||
Importance.NONE= NotificationManager.IMPORTANCE_NONE\ | ||
Importance.UNSPECIFIED = NotificationManager.IMPORTANCE_UNSPECIFIED | ||
@@ -643,0 +637,0 @@ More information: https://developer.android.com/reference/android/app/NotificationManager#IMPORTANCE_DEFAULT |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
679
277800
779