From 6fa6b8377302c9eb389b1d9d4fa9caf67177a673 Mon Sep 17 00:00:00 2001 From: zWX1317523 Date: Wed, 4 Dec 2024 16:43:06 +0800 Subject: [PATCH] =?UTF-8?q?docs:=20[Issues:=20#IB92CP]=20=E4=BF=AE?= =?UTF-8?q?=E6=94=B9react-native-permissions=E6=8C=87=E5=AF=BC=E6=96=87?= =?UTF-8?q?=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- en/react-native-permissions.md | 84 +++++++++++++++---------------- zh-cn/react-native-permissions.md | 84 +++++++++++++++---------------- 2 files changed, 80 insertions(+), 88 deletions(-) diff --git a/en/react-native-permissions.md b/en/react-native-permissions.md index 532c93ae..c0deac7e 100644 --- a/en/react-native-permissions.md +++ b/en/react-native-permissions.md @@ -266,48 +266,44 @@ Check the release version information in the release address of the third-party 当用户授予应用所需权限后,应用可成功访问目标数据或执行目标操作。 ``` - ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓ - ┃ check(ohos.permission.CAMERA) ┃ - ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛ - │ - Is the feature available - on this device ? - │ ╔════╗ - ├───────────║ NO ║──────────────┐ - │ ╚════╝ │ - ╔═════╗ ▼ - ║ YES ║ ┌─────────────────────┐ - ╚═════╝ │ RESULTS.UNAVAILABLE │ - │ └─────────────────────┘ - Is the permission - requestable ? - │ ╔════╗ - ├───────────║ NO ║──────────────┐ - │ ╚════╝ │ - ╔═════╗ ▼ - ║ YES ║ ┌───────────────────┐ - ╚═════╝ │ RESULTS.BLOCKED / │ - │ │ RESULTS.GRANTED │ - │ └───────────────────┘ - │ - ▼ - ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓ - ┃ request(ohos.permission.CAMERA) ┃ - ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛ - │ - Does the user accept - the request ? - │ ╔════╗ - ├───────────║ NO ║──────────────┐ - │ ╚════╝ │ - ╔═════╗ ▼ - ║ YES ║ ┌─────────────────┐ - ╚═════╝ │ RESULTS.BLOCKED │ - │ └─────────────────┘ - ▼ - ┌─────────────────┐ - │ RESULTS.GRANTED │ - └─────────────────┘ + ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓ + ┃ check(ohos.permission.CAMERA) ┃ + ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛ + │ ┌─────────────────────┐ + Is the feature available ──────── NO ─────▶ │ RESULTS.UNAVAILABLE │ + on this device ? └─────────────────────┘ + │ + YES + │ ┌─────────────────┐ + Is the permission ─────────── YES ─────▶ │ RESULTS.GRANTED │ + already granted ? └─────────────────┘ + │ + NO + │ + Is the permission requestable ? + │ + YES + │ + ▼ + ┌────────────────┐ + │ RESULTS.DENIED │ + └────────────────┘ + │ + ▼ +┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓ +┃ request(ohos.permission.CAMERA) ┃◀—————————————————————┐ +┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛ │ + │ YES + │ │ + Did the user see and ──────── NO ──────── Is the permission + accept the request ? still requestable ? + │ │ + YES NO + │ │ + ▼ ▼ + ┌─────────────────┐ ┌─────────────────┐ + │ RESULTS.GRANTED │ │ RESULTS.BLOCKED │ + └─────────────────┘ └─────────────────┘ ``` ### 权限要求 @@ -317,7 +313,7 @@ Check the release version information in the release address of the third-party ``` "requestPermissions": [ { - "name" : "ohos.permission.PERMISSION1", + "name" : "ohos.permission.CAMERA", "reason": "$string:reason", "usedScene": { "abilities": [ @@ -327,7 +323,7 @@ Check the release version information in the release address of the third-party } }, { - "name" : "ohos.permission.PERMISSION2", + "name" : "ohos.permission.ACCESS_BLUETOOTH", "reason": "$string:reason", "usedScene": { "abilities": [ diff --git a/zh-cn/react-native-permissions.md b/zh-cn/react-native-permissions.md index 9d6e28de..f4f2bc54 100644 --- a/zh-cn/react-native-permissions.md +++ b/zh-cn/react-native-permissions.md @@ -272,48 +272,44 @@ ohpm install 当用户授予应用所需权限后,应用可成功访问目标数据或执行目标操作。 ``` - ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓ - ┃ check(ohos.permission.CAMERA) ┃ - ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛ - │ - Is the feature available - on this device ? - │ ╔════╗ - ├───────────║ NO ║──────────────┐ - │ ╚════╝ │ - ╔═════╗ ▼ - ║ YES ║ ┌─────────────────────┐ - ╚═════╝ │ RESULTS.UNAVAILABLE │ - │ └─────────────────────┘ - Is the permission - requestable ? - │ ╔════╗ - ├───────────║ NO ║──────────────┐ - │ ╚════╝ │ - ╔═════╗ ▼ - ║ YES ║ ┌───────────────────┐ - ╚═════╝ │ RESULTS.BLOCKED / │ - │ │ RESULTS.GRANTED │ - │ └───────────────────┘ - │ - ▼ - ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓ - ┃ request(ohos.permission.CAMERA) ┃ - ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛ - │ - Does the user accept - the request ? - │ ╔════╗ - ├───────────║ NO ║──────────────┐ - │ ╚════╝ │ - ╔═════╗ ▼ - ║ YES ║ ┌─────────────────┐ - ╚═════╝ │ RESULTS.BLOCKED │ - │ └─────────────────┘ - ▼ - ┌─────────────────┐ - │ RESULTS.GRANTED │ - └─────────────────┘ + ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓ + ┃ check(ohos.permission.CAMERA) ┃ + ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛ + │ ┌─────────────────────┐ + Is the feature available ──────── NO ─────▶ │ RESULTS.UNAVAILABLE │ + on this device ? └─────────────────────┘ + │ + YES + │ ┌─────────────────┐ + Is the permission ─────────── YES ─────▶ │ RESULTS.GRANTED │ + already granted ? └─────────────────┘ + │ + NO + │ + Is the permission requestable ? + │ + YES + │ + ▼ + ┌────────────────┐ + │ RESULTS.DENIED │ + └────────────────┘ + │ + ▼ +┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓ +┃ request(ohos.permission.CAMERA) ┃◀—————————————————————┐ +┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛ │ + │ YES + │ │ + Did the user see and ──────── NO ──────── Is the permission + accept the request ? still requestable ? + │ │ + YES NO + │ │ + ▼ ▼ + ┌─────────────────┐ ┌─────────────────┐ + │ RESULTS.GRANTED │ │ RESULTS.BLOCKED │ + └─────────────────┘ └─────────────────┘ ``` ### 权限要求 @@ -323,7 +319,7 @@ ohpm install ``` "requestPermissions": [ { - "name" : "ohos.permission.PERMISSION1", + "name" : "ohos.permission.CAMERA", "reason": "$string:reason", "usedScene": { "abilities": [ @@ -333,7 +329,7 @@ ohpm install } }, { - "name" : "ohos.permission.PERMISSION2", + "name" : "ohos.permission.ACCESS_BLUETOOTH", "reason": "$string:reason", "usedScene": { "abilities": [ -- Gitee