1/* 2 * Copyright (c) 2022-2024 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"), 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16/** 17 * @file 18 * @kit AbilityKit 19 */ 20 21/** 22 * The result of requestPermissionsFromUser with asynchronous callback. 23 * 24 * @syscap SystemCapability.Security.AccessToken 25 * @stagemodelonly 26 * @since 9 27 */ 28/** 29 * The result of requestPermissionsFromUser with asynchronous callback. 30 * 31 * @syscap SystemCapability.Security.AccessToken 32 * @stagemodelonly 33 * @crossplatform 34 * @since 10 35 */ 36/** 37 * The result of requestPermissionsFromUser with asynchronous callback. 38 * 39 * @syscap SystemCapability.Security.AccessToken 40 * @stagemodelonly 41 * @crossplatform 42 * @atomicservice 43 * @since 11 44 */ 45export default class PermissionRequestResult { 46 /** 47 * The permissions passed in by the user. 48 * 49 * @type { Array<string> } 50 * @syscap SystemCapability.Security.AccessToken 51 * @stagemodelonly 52 * @since 9 53 */ 54 /** 55 * The permissions passed in by the user. 56 * 57 * @type { Array<string> } 58 * @syscap SystemCapability.Security.AccessToken 59 * @stagemodelonly 60 * @crossplatform 61 * @since 10 62 */ 63 /** 64 * The permissions passed in by the user. 65 * 66 * @type { Array<string> } 67 * @syscap SystemCapability.Security.AccessToken 68 * @stagemodelonly 69 * @crossplatform 70 * @atomicservice 71 * @since 11 72 */ 73 permissions: Array<string>; 74 75 /** 76 * The results for the corresponding request permissions. The value 0 indicates that a 77 * permission is granted, the value -1 indicates not, and the value 2 indicates the request is invalid. 78 * 79 * @type { Array<number> } 80 * @syscap SystemCapability.Security.AccessToken 81 * @stagemodelonly 82 * @since 9 83 */ 84 /** 85 * The results for the corresponding request permissions. The value 0 indicates that a 86 * permission is granted, the value -1 indicates not, and the value 2 indicates the request is invalid. 87 * 88 * @type { Array<number> } 89 * @syscap SystemCapability.Security.AccessToken 90 * @stagemodelonly 91 * @crossplatform 92 * @since 10 93 */ 94 /** 95 * The results for the corresponding request permissions. The value 0 indicates that a 96 * permission is granted, the value -1 indicates not, and the value 2 indicates the request is invalid. 97 * 98 * @type { Array<number> } 99 * @syscap SystemCapability.Security.AccessToken 100 * @stagemodelonly 101 * @crossplatform 102 * @atomicservice 103 * @since 11 104 */ 105 authResults: Array<number>; 106 107 /** 108 * Specifies whether a dialog box is shown for each requested permission. 109 * The value true means that a dialog box is shown, and false means the opposite. 110 * 111 * @type { ?Array<boolean> } 112 * @syscap SystemCapability.Security.AccessToken 113 * @stagemodelonly 114 * @atomicservice 115 * @since 12 116 */ 117 dialogShownResults?: Array<boolean>; 118 119 /** 120 * Enumerates the return values of the permission request operation. 121 * 0 The operation is successful. 122 * 1 The permission name is invalid. 123 * 2 The requested permission has not been declared. 124 * 3 The conditions for requesting the permission are not met. 125 * 4 The user does not agree to the Privacy Statement. 126 * 5 The permission cannot be requested in a pop-up window. 127 * 12 The service is abnormal. 128 * 129 * @type { ?Array<number> } 130 * @syscap SystemCapability.Security.AccessToken 131 * @stagemodelonly 132 * @crossplatform 133 * @atomicservice 134 * @since 18 135 */ 136 errorReasons?: Array<number>; 137}