From 49013d0769a46f02ffcf2bbe6d9054e4a53f4f2d Mon Sep 17 00:00:00 2001 From: CaiJingLong Date: Tue, 19 Sep 2023 11:35:32 +0800 Subject: [PATCH] docs: Update README --- README-ZH.md | 17 ++++++++++++++--- README.md | 23 ++++++++++++++++++----- 2 files changed, 32 insertions(+), 8 deletions(-) diff --git a/README-ZH.md b/README-ZH.md index b8806496..a91f8631 100644 --- a/README-ZH.md +++ b/README-ZH.md @@ -213,8 +213,11 @@ Android 10 引入了 **Scoped Storage**,导致原始资源文件不能通过 ```dart final PermissionState ps = await PhotoManager.requestPermissionExtend(); -if (ps.hasAccess) { +if (ps.isAuth) { + // 已获取到权限 +} else if (ps.hasAccess) { // 已获取到权限(哪怕只是有限的访问权限)。 + // iOS Android 目前都已经有了部分权限的概念。 } else { // 权限受限制(iOS)或者被拒绝,使用 `==` 能够更准确的判断是受限还是拒绝。 // 你可以使用 `PhotoManager.openSetting()` 打开系统设置页面进行进一步的逻辑定制。 @@ -228,14 +231,22 @@ PhotoManager.setIgnorePermissionCheck(true); 对于一些后台操作(应用未启动等)而言,忽略检查是比较合适的做法。 -#### iOS 受限的资源权限 +#### 受限的资源权限 + +##### iOS 受限的资源权限 iOS14 引入了部分资源限制的权限 (`PermissionState.limited`)。 `PhotoManager.requestPermissionExtend()` 会返回当前的权限状态 `PermissionState`。 详情请参阅 [PHAuthorizationStatus][]。 如果你想要重新选择在应用里能够读取到的资源,你可以使用 `PhotoManager.presentLimited()` 重新选择资源, -这个方法仅在 iOS 14 以上的版本生效,其他平台或版本无法调用这个方法。 +这个方法对于 iOS 14 以上的版本生效。 + +##### Android 受限的资源权限 + +和 iOS 类似,安卓 14(API 34) 中也加入了这个概念,dart 端的使用方法也完全一致。 + +但行为上略有不同(基于模拟器),安卓中一旦授予某个资源的访问权限,就无法撤销,即使再次使用 `presentLimited` 时不选中也一样。 ### 获取相簿或图集 (`AssetPathEntity`) diff --git a/README.md b/README.md index a6b24f6d..12f8f5c7 100644 --- a/README.md +++ b/README.md @@ -223,8 +223,11 @@ Most of the APIs can only use with granted permission. ```dart final PermissionState ps = await PhotoManager.requestPermissionExtend(); // the method can use optional param `permission`. -if (ps.hasAccess) { - // Granted or limited. +if (ps.isAuth) { + // Granted + // You can to get assets here. +} else if (ps.hasAccess) { + // Access will continue, but the amount visible depends on the user's selection. } else { // Limited(iOS) or Rejected, use `==` for more precise judgements. // You can call `PhotoManager.openSetting()` to open settings for further steps. @@ -240,7 +243,9 @@ PhotoManager.setIgnorePermissionCheck(true); For background processing (such as when the app is not in the foreground), ignore permissions check would be proper solution. -#### Limited entities access on iOS +#### Limited entities access + +##### Limited entities access on iOS With iOS 14 released, Apple brought a "Limited Photos Library" permission (`PermissionState.limited`) to iOS. @@ -251,8 +256,16 @@ To reselect accessible entities for the app, use `PhotoManager.presentLimited()` to call the modal of accessible entities' management. This method only available for iOS 14+ and when the permission state -is limited (`PermissionState.limited`), -other platform won't make a valid call. +is limited (`PermissionState.limited`). + +##### Limited entities access on android + +Similar to iOS, Android 14 (API 34) has also introduced this concept, and the usage on the Dart side is completely identical. + +However, there is a slight difference in behavior (based on the emulator). + +In Android, once access permission to a certain resource is granted, it cannot be revoked, +even if you do not select it again when using `presentLimited`. ### Get albums/folders (`AssetPathEntity`)