From fcc229dceb5dfe24f3a011d1c3bf9f82a0b5badc Mon Sep 17 00:00:00 2001 From: Boris Tacyniak Date: Fri, 3 Sep 2021 11:30:35 +0200 Subject: [PATCH] Upgrade to 8.1.0. Closes #2123 --- CHANGELOG.md | 11 +++++++++++ README.md | 5 ++++- example/NotifService.js | 2 +- example/ios/Podfile.lock | 4 ++-- index.js | 16 +++++++++++----- package.json | 4 ++-- 6 files changed, 31 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 05a4b8e35..9b9d9d2a9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,17 @@ This project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html ### Fixed +## [8.1.0] 2021-09-03 + +### Features + +- (iOS) Upgrade `@react-native-community/push-notification-ios` to version [1.10.0](https://github.com/react-native-push-notification/ios/releases/tag/v1.10.0) +- (iOS) Allow `month`, `week`, `day`, `hour`, `minute` as `repeatType` for iOS. + +### Fixed + +- (Android): Fix Android 12 PendingIntent [#2130](https://github.com/zo0r/react-native-push-notification/pull/2130) + ## [8.0.1] 2021-08-24 ### Fixed diff --git a/README.md b/README.md index fbee2bfb0..16e61401b 100644 --- a/README.md +++ b/README.md @@ -643,13 +643,16 @@ https://developer.android.com/training/monitoring-device-state/doze-standby (optional) Specify `repeatType` and optionally `repeatTime` (Android-only) while scheduling the local notification. Check the local notification example above. ### iOS -Property `repeatType` can only be `day`. +Property `repeatType` can only be `month`, `week`, `day`, `hour`, `minute`. + +NOTE: `repeatTime` do not work with iOS. ### Android Property `repeatType` could be one of `month`, `week`, `day`, `hour`, `minute`, `time`. The interval used can be configured to a different interval using `repeatTime`. If `repeatType` is `time`, `repeatTime` must be specified as the number of milliseconds between each interval. For example, to configure a notification every other day + ```javascript PushNotification.localNotificationSchedule({ ... diff --git a/example/NotifService.js b/example/NotifService.js index 481f628a9..6935285c1 100644 --- a/example/NotifService.js +++ b/example/NotifService.js @@ -118,7 +118,7 @@ export default class NotifService { autoCancel: true, // (optional) default: true largeIcon: 'ic_launcher', // (optional) default: "ic_launcher" smallIcon: 'ic_notification', // (optional) default: "ic_notification" with fallback for "ic_launcher" - bigText: 'My big text that will be shown when notification is expanded', // (optional) default: "message" prop + bigText: 'My big text that will be shown when notification is expanded', // (optional) default: "message" prop subText: 'This is a subText', // (optional) default: none color: 'blue', // (optional) default: system default vibrate: true, // (optional) default: true diff --git a/example/ios/Podfile.lock b/example/ios/Podfile.lock index 6801cbc8e..dc6736ba2 100644 --- a/example/ios/Podfile.lock +++ b/example/ios/Podfile.lock @@ -245,7 +245,7 @@ PODS: - React-Core (= 0.63.3) - React-cxxreact (= 0.63.3) - React-jsi (= 0.63.3) - - RNCPushNotificationIOS (1.9.0): + - RNCPushNotificationIOS (1.10.0): - React-Core - Yoga (1.14.0) @@ -367,7 +367,7 @@ SPEC CHECKSUMS: React-RCTText: 65a6de06a7389098ce24340d1d3556015c38f746 React-RCTVibration: 8e9fb25724a0805107fc1acc9075e26f814df454 ReactCommon: 4167844018c9ed375cc01a843e9ee564399e53c3 - RNCPushNotificationIOS: 5bffde624d1fd15bfc8b2fd202b012a517a6dc9b + RNCPushNotificationIOS: 5ee247e594d0b5df3cd7be74b51035a0d91807eb Yoga: 7d13633d129fd179e01b8953d38d47be90db185a PODFILE CHECKSUM: 9f7efe26f7ad5184f28ac62478069370942924e2 diff --git a/index.js b/index.js index 594c12e32..4fb2522d2 100644 --- a/index.js +++ b/index.js @@ -250,6 +250,14 @@ Notifications.localNotificationSchedule = function({...details}) { details.userInfo = details.userInfo || {}; details.userInfo.image = details.picture; } + + const repeatsComponent = { + second: details.repeatType == "minute", + minute: details.repeatType == "hour", + hour: details.repeatType == "day", + day: details.repeatType == "month", + dayOfWeek: details.repeatType == "week", + }; const iosDetails = { id: (!details.id ? Math.floor(Math.random() * Math.pow(2, 32)).toString() : details.id), @@ -261,7 +269,8 @@ Notifications.localNotificationSchedule = function({...details}) { isSilent: details.playSound === false, category: details.category, userInfo: details.userInfo, - repeats: (details.repeatType && details.repeatType == "day"), + repeats: ['minute', 'hour', 'day', 'week', 'month'].includes(details.repeatType), + repeatsComponent: repeatsComponent }; if (details.number) { @@ -304,10 +313,7 @@ Notifications.localNotificationSchedule = function({...details}) { details.fireDate = details.date.getTime(); delete details.date; - // ignore iOS only repeatType - if (['year'].includes(details.repeatType)) { - delete details.repeatType; - } + this.handler.scheduleLocalNotification(details); } }; diff --git a/package.json b/package.json index c29c26a71..d48a19e8a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "react-native-push-notification", - "version": "8.0.1", + "version": "8.1.0", "description": "React Native Local and Remote Notifications", "main": "index.js", "scripts": { @@ -24,7 +24,7 @@ "url": "git+ssh://git@github.com:zo0r/react-native-push-notification.git" }, "peerDependencies": { - "@react-native-community/push-notification-ios": "^1.9.0", + "@react-native-community/push-notification-ios": "^1.10.0", "react-native": ">=0.33" }, "author": "zo0r ",