diff --git a/zh-cn/react-native-cameraroll.md b/zh-cn/react-native-cameraroll.md index fece090a730c38de591786aaa5d6a77449728e5c..a436c43850c1ce159817eefcb40568d410b1f90c 100644 --- a/zh-cn/react-native-cameraroll.md +++ b/zh-cn/react-native-cameraroll.md @@ -20,9 +20,7 @@ 进入到工程目录并输入以下命令: -> [!TIP] # 处替换为 tgz 包的路径 - - +> [!tip] # 处替换为 tgz 包的路径 #### **npm** @@ -36,8 +34,6 @@ npm install @react-native-oh-tpl/camera-roll@file:# yarn add @react-native-oh-tpl/camera-roll@file:# ``` - - 下面的代码展示了这个库的基本使用场景: > [!WARNING] 使用时 import 的库名不变。 @@ -127,7 +123,6 @@ export default function App() { "@react-native-oh-tpl/camera-roll": "file:../../node_modules/@react-native-oh-tpl/camera-roll/harmony/camera_roll.har" } ``` - 点击右上角的 `sync` 按钮 或者在终端执行: @@ -136,10 +131,9 @@ export default function App() { cd entry ohpm install ``` - 方法二:直接链接源码 -> [!TIP] 如需使用直接链接源码,请参考[直接链接源码说明](/zh-cn/link-source-code.md) +> [!tip] 如需使用直接链接源码,请参考[直接链接源码说明](/zh-cn/link-source-code.md) ### 配置 CMakeLists 和引入 CameraRollPackage @@ -181,7 +175,7 @@ target_link_libraries(rnoh_app PUBLIC rnoh_sample_package) # RNOH_END: manual_package_linking_2 ``` -打开 `entry/src/main/cpp/PackageProvider.cpp`,添加: +打开 `entry/src/main/cpp/PackageProvider.cpp` 或 ,添加: ```diff #include "RNOH/PackageProvider.h" @@ -200,7 +194,11 @@ std::vector> PackageProvider::getPackages(Package::Cont ### 在 ArkTs 侧引入 CameraRollPackage -打开 `entry/src/main/ets/RNPackagesFactory.ts`,添加: +打开 + `entry/src/main/ets/RNPackagesFactory.ts`, + 或 +`entry/src/main/ets/rn/RNPackagesFactory.cpp`, +添加: ```diff ... @@ -213,7 +211,6 @@ export function createRNPackages(ctx: RNPackageContext): RNPackage[] { ]; } ``` - ### 应用权限申请 > [!tip] "ohos.permission.READ_IMAGEVIDEO","ohos.permission.WRITE_IMAGEVIDEO"权限等级为system_basic,授权方式为user_grant,[使用 ACL 签名的配置指导](https://developer.harmonyos.com/cn/docs/documentation/doc-guides-V3/signing-0000001587684945-V3#section157591551175916) @@ -266,7 +263,6 @@ export function createRNPackages(ctx: RNPackageContext): RNPackage[] { + ] } ``` - ### 运行 点击右上角的 `sync` 按钮 @@ -277,7 +273,6 @@ export function createRNPackages(ctx: RNPackageContext): RNPackage[] { cd entry ohpm install ``` - 然后编译、运行即可。 ## 约束与限制 @@ -297,12 +292,12 @@ ohpm install **CameraRoll** | Name | Description | Type | Required | Platform | HarmonyOS Support | | ---- | ----------- | ---- | -------- | -------- | ------------------ | -| save | 保存图片/视频 | function | no | android,ios | partially | -| getPhotos | 查找图片/视频 | function | no | android,ios | partially | -| getAlbums | 查找相册 | function | no | android,ios | partially | -| deletePhotos | 删除图片/视频 | function | no | android,ios | no | -| iosGetImageDataById | 获取图片数据 | function | no | ios | partially | -| getPhotoThumbnail | 获取缩略图 | function | no | ios | partially | +| save | 保存图片/视频 | function | no | Android、iOS | partially | +| getPhotos | 查找图片/视频 | function | no |Android、iOS |no | +| getAlbums | 查找相册 | function | no | Android、iOS |no | +| deletePhotos | 删除图片/视频 | function | no | Android、iOS | no | +| iosGetImageDataById | 获取图片数据 | function | no | iOS |no | +| getPhotoThumbnail | 获取缩略图 | function | no | iOS |no | ## API @@ -312,18 +307,18 @@ ohpm install | Name | Description | Type | Required | Platform | HarmonyOS Support | | ------------------------------------------ | ------------------------------------------ | -------- | -------- | -------- | ----------------- | -| `iosReadGalleryPermission` | 权限验证 | function | no | ios | no | -| `iosRequestReadWriteGalleryPermission` | 读写权限申请 | function | no | ios | no | -| `iosRequestAddOnlyGalleryPermission` | 添加权限申请 | function | no | ios | no | -| `iosRefreshGallerySelection` | 图片列表刷新 | function | no | ios | no | -| `harmonyReadGalleryPermission` | 对比`iosReadGalleryPermission` | function | no | harmony | yes | -| `harmonyRequestReadWriteGalleryPermission` | 对比`iosRequestReadWriteGalleryPermission` | function | no | harmony | yes | -| `harmonyRequestAddOnlyGalleryPermission` | 对比`iosRequestAddOnlyGalleryPermission` | function | no | harmony | yes | +| `iosReadGalleryPermission` | 权限验证 | function | no | iOS | no | +| `iosRequestReadWriteGalleryPermission` | 读写权限申请 | function | no | iOS | no | +| `iosRequestAddOnlyGalleryPermission` | 添加权限申请 | function | no | iOS | no | +| `iosRefreshGallerySelection` | 图片列表刷新 | function | no | iOS | no | +| `harmonyReadGalleryPermission` | 对比`iosReadGalleryPermission` | function | no | harmony | no | +| `harmonyRequestReadWriteGalleryPermission` | 对比`iosRequestReadWriteGalleryPermission` | function | no | harmony | no | +| `harmonyRequestAddOnlyGalleryPermission` | 对比`iosRequestAddOnlyGalleryPermission` | function | no | harmony | no | | `harmonyRefreshGallerySelection` | 对比`iosRefreshGallerySelection` | function | no | harmony | no | ## 遗留问题 -- [ ] deletePhotos删除图片/视频,未实现 HarmonyOS 化: [issue#5](https://github.com/react-native-oh-library/react-native-cameraroll/issues/5) +- [ ] 仅save已HarmonyOS 化,其他方法未实现 HarmonyOS 化: [issue#5](https://github.com/react-native-oh-library/react-native-cameraroll/issues/12) ## 其他