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

Commit

Permalink
Fixes #1878
Browse files Browse the repository at this point in the history
  • Loading branch information
Dallas62 committed Mar 4, 2021
1 parent 4b7e095 commit a97635e
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 8 deletions.
18 changes: 12 additions & 6 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,36 +12,42 @@ This project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html

### Fixed

## [7.2.2] 2021-03-04

### Fixed

- (Android) Fix: Could not invoke RNPushNotification.getDeliveredNotifications. [#1878](https://github.com/zo0r/react-native-push-notification/issues/1878)

## [7.2.1] 2021-02-11

### Fixed

- (iOS) Fix `playSound` options on local notifications. [1858](https://github.com/zo0r/react-native-push-notification/issues/1858#issuecomment-775714298)
- (iOS) Fix `playSound` options on local notifications. [#1858](https://github.com/zo0r/react-native-push-notification/issues/1858#issuecomment-775714298)

## [7.2.0] 2021-01-24

### Features

- (Android) Handle localization for notification title and body [1837](https://github.com/zo0r/react-native-push-notification/pull/1837)
- (Android) Handle localization for notification title and body [#1837](https://github.com/zo0r/react-native-push-notification/pull/1837)

## [7.1.1] 2021-01-20

### Fixed

- (Android) unsubscribeFromTopic function fix [1831](https://github.com/zo0r/react-native-push-notification/pull/1831)
- (Android) unsubscribeFromTopic function fix [#1831](https://github.com/zo0r/react-native-push-notification/pull/1831)

## [7.1.0] 2021-01-16

# Features

- (Android) Add hooks to intent handling and bundle parsing [1819](https://github.com/zo0r/react-native-push-notification/pull/1819)
- (Android) Add hooks to intent handling and bundle parsing [#1819](https://github.com/zo0r/react-native-push-notification/pull/1819)

## [7.0.0] 2020-12-23

### Breaking changes

- (iOS) Replace deprecated local notification methods on iOS [1751](https://github.com/zo0r/react-native-push-notification/pull/1751)
- (Android) Rename the Android package from `RNPushNotification` to `ReactNativePushNotification` resolve [893](https://github.com/zo0r/react-native-push-notification/issues/893)
- (iOS) Replace deprecated local notification methods on iOS [#1751](https://github.com/zo0r/react-native-push-notification/pull/1751)
- (Android) Rename the Android package from `RNPushNotification` to `ReactNativePushNotification` resolve [#893](https://github.com/zo0r/react-native-push-notification/issues/893)
- (Android) Allow `userInfo` to be stored in scheduled notification as in iOS (mapped as `data` on press or list scheduled notifications).

### Features
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -723,10 +723,15 @@ public void clearDeliveredNotifications(ReadableArray identifiers) {

@RequiresApi(api = Build.VERSION_CODES.M)
public WritableArray getDeliveredNotifications() {
WritableArray result = Arguments.createArray();

if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) {
return result;
}

NotificationManager notificationManager = notificationManager();
StatusBarNotification delivered[] = notificationManager.getActiveNotifications();
Log.i(LOG_TAG, "Found " + delivered.length + " delivered notifications");
WritableArray result = Arguments.createArray();
/*
* stay consistent to the return structure in
* https://facebook.github.io/react-native/docs/pushnotificationios.html#getdeliverednotifications
Expand Down
7 changes: 7 additions & 0 deletions example/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,13 @@ export default class App extends Component {
}}>
<Text>Console.Log Scheduled Local Notifications</Text>
</TouchableOpacity>
<TouchableOpacity
style={styles.button}
onPress={() => {
this.notif.getDeliveredNotifications(notifs => console.log(notifs));
}}>
<Text>Console.Log Delivered Notifications</Text>
</TouchableOpacity>
<TouchableOpacity
style={styles.button}
onPress={() => {
Expand Down
4 changes: 4 additions & 0 deletions example/NotifService.js
Original file line number Diff line number Diff line change
Expand Up @@ -170,4 +170,8 @@ export default class NotifService {
getScheduledLocalNotifications(callback) {
PushNotification.getScheduledLocalNotifications(callback);
}

getDeliveredNotifications(callback) {
PushNotification.getDeliveredNotifications(callback);
}
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-native-push-notification",
"version": "7.2.1",
"version": "7.2.2",
"description": "React Native Local and Remote Notifications",
"main": "index.js",
"scripts": {
Expand Down

0 comments on commit a97635e

Please sign in to comment.