From 4d3e1025cbb4da882556800aaedd4a7158635fd8 Mon Sep 17 00:00:00 2001 From: rjh <15191819693@163.com> Date: Fri, 23 Aug 2024 09:31:35 +0800 Subject: [PATCH 1/2] =?UTF-8?q?docs:=20[Issue:=20#IALWXG]=E6=96=B0?= =?UTF-8?q?=E5=A2=9Epush-notification-ios=E7=9A=84=E6=8C=87=E5=AF=BC?= =?UTF-8?q?=E6=96=87=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...-native-community-push-notification-ios.md | 51 ++++++++++++------- 1 file changed, 34 insertions(+), 17 deletions(-) diff --git a/zh-cn/react-native-community-push-notification-ios.md b/zh-cn/react-native-community-push-notification-ios.md index e0cc9e96..3203bb95 100644 --- a/zh-cn/react-native-community-push-notification-ios.md +++ b/zh-cn/react-native-community-push-notification-ios.md @@ -1,12 +1,12 @@ - -> 模板版本:v0.1.3 +> 模板版本:v0.2.2

@react-native-community/push-notification-ios

+

- Supported platforms + Supported platforms License @@ -169,6 +169,17 @@ export const App = () => { 首先需要使用 DevEco Studio 打开项目里的 HarmonyOS 工程 `harmony` +### 在工程根目录的 `oh-package.json5` 添加 overrides 字段 + +```json +{ + ... + "overrides": { + "@rnoh/react-native-openharmony" : "./react_native_openharmony" + } +} +``` + ### 引入原生端代码 目前有两种方法: @@ -288,9 +299,6 @@ ohpm install 请到三方库相应的 Releases 发布地址查看 Release 配套的版本信息:[<@react-native-oh-tpl/push-notification-ios> Releases](https://github.com/react-native-oh-library/react-native-push-notification-ios/releases)) -本文档内容基于以下版本验证通过: - -RNOH:0.72.13; SDK:HarmonyOS NEXT Developer Preview1; IDE:DevEco Studio 4.1.3.500; ROM:2.0.0.58; ## API @@ -301,10 +309,16 @@ RNOH:0.72.13; SDK:HarmonyOS NEXT Developer Preview1; IDE:DevEco Studio 4.1 | Name | Description | Type | Required | Platform | HarmonyOS Support | | ------------------------------- | ----------------------------------------------------------------------------------------------------------------- | -------- | -------- | ------------- | ----------------- | | addNotificationRequest | Sends notificationRequest to notification center at specified firedate. Fires immediately if firedate is not set. | function | no | IOS/HarmonyOS | yes | -| setApplicationIconBadgeNumber | Sets the badge number for the app icon on the home screen | function | no | All | yes | -| getDeliveredNotifications | Provides you with a list of the app’s notifications that are still displayed in Notification Center | function | no | All | yes | -| removeAllDeliveredNotifications | Remove all delivered notifications from Notification Center | function | no | All | yes | -| removeDeliveredNotifications | Removes the specified delivered notifications from Notification Center | function | no | All | yes | +| getDeliveredNotifications | Provides you with a list of the app’s notifications that are still displayed in Notification Center | function | no | IOS/HarmonyOS | yes | +| removeAllDeliveredNotifications | Remove all delivered notifications from Notification Center | function | no | IOS/HarmonyOS | yes | +| removeDeliveredNotifications | Removes the specified delivered notifications from Notification Center | function | no | IOS/HarmonyOS | yes | +| setApplicationIconBadgeNumber | Sets the badge number for the app icon on the home screen | function | no | IOS/HarmonyOS | yes | +| getApplicationIconBadgeNumber | Gets the current badge number for the app icon on the home screen | function | no | IOS | no | +| cancelLocalNotifications | Cancel local notifications | function | no | IOS | no | +| requestPermissions | Requests notification permissions from iOS, prompting the user's dialog box. By default, it will request all notification permissions, but a subset of these can be requested by passing a map of requested permissions. The following permissions are supported | function | no | IOS | no | +| abandonPermissions | Unregister for all remote notifications received via Apple Push Notification service | function | no | IOS | no | +| checkPermissions | See what push permissions are currently enabled | function | no | IOS | no | +| getInitialNotification | This method returns a promise. If the app was launched by a push notification, this promise resolves to an object of type PushNotificationIOS. Otherwise, it resolves to null. | function | no | IOS | no | ## 属性 @@ -312,7 +326,6 @@ RNOH:0.72.13; SDK:HarmonyOS NEXT Developer Preview1; IDE:DevEco Studio 4.1 > [!tip] "HarmonyOS Support"列为 yes 表示 HarmonyOS 平台支持该属性;no 则表示不支持;partially 表示部分支持。使用方法跨平台一致,效果对标 iOS 或 Android 的效果。 -以下属性已验证,更多属性详情请查看 [react-native-push-notification-ios 的文档介绍](https://github.com/react-native-oh-library/react-native-push-notification) **Parameters:** @@ -322,15 +335,21 @@ _NotificationRequest:_ | ---------- | ----------------------------------------------------------------- | ------- | -------- | -------- | ----------------- | | `id` | Identifier of the notification | string | yes | All | yes | | `title` | A short description of the reason for the notification | string | yes | All | yes | -| `subtitle` | A secondary description of the reason for the notification | string | no | All | yes | +| `subtitle` | A secondary description of the reason for the notification | string | no | All | no | | `body` | The message displayed in the notificatio | string | yes | All | yes | | `badge` | The number to display as the app's icon badge | number | no | All | yes | | `fireDate` | The date and time when the system should deliver the notification | object | no | All | yes | -| `repeats` | Sets notification to repeat | boolean | no | All | yes | +| `repeats` | Sets notification to repeat | boolean | no | All | no | +| `repeatsComponent` | An object indicating which parts of fireDate should be repeated | object | no | All | no | +| `sound` | The sound played when the notification is fired | string | no | All | yes | +| `category` | The category of this notification, required for actionable notifications | string | no | All | no | | `isSilent` | If true, the notification will appear without sound | boolean | no | All | yes | +| `isCritical` | If true, the notification sound be played even when the device is locked, muted, or has Do Not Disturb enabled | boolean | no | All | no | +| `criticalSoundVolume` | A number between 0 and 1 for volume of critical notification. Default volume will be used if not specified | number | no | All | no | | `userInfo` | An object containing additional notification data | object | no | All | yes | +| `isTimeZoneAgnostic` | If true, fireDate adjusted automatically upon time zone changes (e.g. for an alarm clock) | boolean | no | All | no | +| `interruptionLevel` | A string specifying the interruption level. Valid values are `'active'`, `'passive'`, `'timeSensitive'`, or `'critical'` | string | no | All | no | ---- ## 遗留问题 @@ -341,6 +360,4 @@ _NotificationRequest:_ ## 开源协议 -本项目基于 [The MIT License (MIT)](https://github.com/react-native-push-notification/ios/blob/master/LICENSE) ,请自由地享受和参与开源。 - - \ No newline at end of file +本项目基于 [The MIT License (MIT)](https://github.com/react-native-oh-library/react-native-push-notification-ios/blob/sig/LICENSE) ,请自由地享受和参与开源。 \ No newline at end of file -- Gitee From 3c44614afae921dacf116e73b44178b7c2299aaa Mon Sep 17 00:00:00 2001 From: rjh <15191819693@163.com> Date: Fri, 23 Aug 2024 11:33:40 +0800 Subject: [PATCH 2/2] =?UTF-8?q?docs:=20[Issue:=20#IALWXG]=E4=BF=AE?= =?UTF-8?q?=E6=94=B9push-notification-ios=E7=9A=84=E6=8C=87=E5=AF=BC?= =?UTF-8?q?=E6=96=87=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...-native-community-push-notification-ios.md | 38 +++++++++---------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/zh-cn/react-native-community-push-notification-ios.md b/zh-cn/react-native-community-push-notification-ios.md index 3203bb95..cd1ba5b4 100644 --- a/zh-cn/react-native-community-push-notification-ios.md +++ b/zh-cn/react-native-community-push-notification-ios.md @@ -13,7 +13,7 @@

-> [!TIP] [Github 地址](https://github.com/react-native-push-notification/ios) +> [!TIP] [Github 地址](https://github.com/react-native-oh-library/react-native-push-notification-ios) ## 安装与使用 @@ -187,7 +187,7 @@ export const App = () => { 1. 通过 har 包引入(在 IDE 完善相关功能后该方法会被遗弃,目前首选此方法); 2. 直接链接源码。 -方法一:通过 har 包引入 +方法一:通过 har 包引入(推荐) > [!TIP] har 包位于三方库安装路径的 `harmony` 文件夹下。 @@ -197,7 +197,7 @@ export const App = () => { "dependencies": { "@rnoh/react-native-openharmony": "file:../react_native_openharmony", - "rnoh-push-notification": "file:../../node_modules/@react-native-oh-tpl/push-notification-ios/harmony/push_notification.har" + "@react-native-oh-tpl/push-notification-ios": "file:../../node_modules/@react-native-oh-tpl/push-notification-ios/harmony/push_notification.har" } ``` @@ -229,7 +229,7 @@ add_subdirectory("${RNOH_CPP_DIR}" ./rn) # RNOH_BEGIN: add_package_subdirectories add_subdirectory("../../../../sample_package/src/main/cpp" ./sample-package) -+ add_subdirectory("${OH_MODULE_DIR}/rnoh-push-notification/src/main/cpp" ./push_notification) ++ add_subdirectory("${OH_MODULES}/@react-native-oh-tpl/push-notification-ios/src/main/cpp" ./push_notification) # RNOH_END: add_package_subdirectories add_library(rnoh_app SHARED @@ -268,7 +268,7 @@ std::vector> PackageProvider::getPackages(Package::Cont ```diff ... -+ import { PushNotificationPackage } from 'rnoh-push-notification/ts'; ++ import { PushNotificationPackage } from '@react-native-oh-tpl/push-notification-ios/ts'; export function createRNPackages(ctx: RNPackageContext): RNPackage[] { return [ @@ -308,17 +308,18 @@ ohpm install | Name | Description | Type | Required | Platform | HarmonyOS Support | | ------------------------------- | ----------------------------------------------------------------------------------------------------------------- | -------- | -------- | ------------- | ----------------- | -| addNotificationRequest | Sends notificationRequest to notification center at specified firedate. Fires immediately if firedate is not set. | function | no | IOS/HarmonyOS | yes | -| getDeliveredNotifications | Provides you with a list of the app’s notifications that are still displayed in Notification Center | function | no | IOS/HarmonyOS | yes | -| removeAllDeliveredNotifications | Remove all delivered notifications from Notification Center | function | no | IOS/HarmonyOS | yes | -| removeDeliveredNotifications | Removes the specified delivered notifications from Notification Center | function | no | IOS/HarmonyOS | yes | -| setApplicationIconBadgeNumber | Sets the badge number for the app icon on the home screen | function | no | IOS/HarmonyOS | yes | -| getApplicationIconBadgeNumber | Gets the current badge number for the app icon on the home screen | function | no | IOS | no | -| cancelLocalNotifications | Cancel local notifications | function | no | IOS | no | -| requestPermissions | Requests notification permissions from iOS, prompting the user's dialog box. By default, it will request all notification permissions, but a subset of these can be requested by passing a map of requested permissions. The following permissions are supported | function | no | IOS | no | -| abandonPermissions | Unregister for all remote notifications received via Apple Push Notification service | function | no | IOS | no | -| checkPermissions | See what push permissions are currently enabled | function | no | IOS | no | -| getInitialNotification | This method returns a promise. If the app was launched by a push notification, this promise resolves to an object of type PushNotificationIOS. Otherwise, it resolves to null. | function | no | IOS | no | +| addNotificationRequest | Sends notificationRequest to notification center at specified firedate. Fires immediately if firedate is not set. | function | no | iOS | yes | +| getDeliveredNotifications | Provides you with a list of the app’s notifications that are still displayed in Notification Center | function | no | iOS | yes | +| removeAllDeliveredNotifications | Remove all delivered notifications from Notification Center | function | no | iOS | yes | +| removeDeliveredNotifications | Removes the specified delivered notifications from Notification Center | function | no | iOS | yes | +| setApplicationIconBadgeNumber | Sets the badge number for the app icon on the home screen | function | no | iOS | yes | +| getApplicationIconBadgeNumber | Gets the current badge number for the app icon on the home screen | function | no | iOS | no | +| cancelLocalNotifications | Cancel local notifications | function | no | iOS | no | +| requestPermissions | Requests notification permissions from iOS, prompting the user's dialog box. By default, it will request all notification permissions, but a subset of these can be requested by passing a map of requested permissions. The following permissions are supported | function | no | iOS | no | +| abandonPermissions | Unregister for all remote notifications received via Apple Push Notification service | function | no | iOS | no | +| checkPermissions | See what push permissions are currently enabled | function | no | iOS | no | +| getInitialNotification | This method returns a promise. If the app was launched by a push notification, this promise resolves to an object of type PushNotificationIOS. Otherwise, it resolves to null. | function | no | iOS | no | +| getScheduledLocalNotifications | Gets the local notifications that are currently scheduled | function | no | iOS | no | ## 属性 @@ -350,11 +351,10 @@ _NotificationRequest:_ | `isTimeZoneAgnostic` | If true, fireDate adjusted automatically upon time zone changes (e.g. for an alarm clock) | boolean | no | All | no | | `interruptionLevel` | A string specifying the interruption level. Valid values are `'active'`, `'passive'`, `'timeSensitive'`, or `'critical'` | string | no | All | no | - ## 遗留问题 -- [ ] HarmonyOS 的 NotificationManager 的规格和 IOS 不一致,其 NotificationRequest 所含参数,在 HarmonyOS 上部分没有适配对应参数,问题: [issue#1](https://github.com/react-native-oh-library/react-native-push-notification/issues/1) -- [ ] 原库部分接口在 HarmonyOS 中没有对应接口处理相关逻辑,问题: [issue#2](https://github.com/react-native-oh-library/react-native-push-notification/issues/2) +- [ ] HarmonyOS 的 NotificationManager 的规格和 IOS 不一致,其 NotificationRequest 所含参数,在 HarmonyOS 上部分没有适配对应参数,问题: [issue#1](https://github.com/react-native-oh-library/react-native-push-notification-ios/issues/4) +- [ ] 原库部分接口在 HarmonyOS 中没有对应接口处理相关逻辑,问题: [issue#2](https://github.com/react-native-oh-library/react-native-push-notification-ios/issues/3) ## 其他 -- Gitee