diff --git a/zh-cn/application-dev/reference/apis/js-apis-appAccount-authorizationExtensionAbility.md b/zh-cn/application-dev/reference/apis/js-apis-appAccount-authorizationExtensionAbility.md index bb71697648ff81861f484ead8d64972876221f11..71b538b4df8cb984c6b506ec7386fd6896efd8d6 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-appAccount-authorizationExtensionAbility.md +++ b/zh-cn/application-dev/reference/apis/js-apis-appAccount-authorizationExtensionAbility.md @@ -57,13 +57,23 @@ onStartAuthorization(request: AuthorizationRequest, callback: AuthorizationCallb **示例:** ```ts +import appAccount from '@ohos.account.appAccount'; + +class MyResponse extends appAccount.AccountCapabilityResponse { + name: string; + scopes: string[]; + + constructor(request: appAccount.AccountCapabilityRequest) { + super(request); + } +}; + class MyAuthorizationExtensionAbility extends AuthorizationExtensionAbility { onStartAuthorization(request: AuthorizationRequest, callback: AuthorizationCallback) { console.log('onStartAuthorization, callerUid: ' + request.callerUid + ', parameters: ' + request.parameters); - let response = { - name: 'xxxx', - scopes: ['xxx', 'xxx'] - }; + let response = new MyResponse(null); + response.name = 'xxx'; + response.scopes = ['xxx', 'xxx']; callback.onResult(null, response); } }; diff --git a/zh-cn/application-dev/reference/apis/js-apis-osAccount.md b/zh-cn/application-dev/reference/apis/js-apis-osAccount.md index a060724ea6a44e80d7fdf8780d3c40600d71995c..6c431ca954f2a262dc7ab6d87ce1b0458bfd8831 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-osAccount.md +++ b/zh-cn/application-dev/reference/apis/js-apis-osAccount.md @@ -473,7 +473,7 @@ checkOsAccountTestable(): Promise<boolean> checkOsAccountVerified(callback: AsyncCallback<boolean>): void -检查当前系统帐号是否已验证。使用callback异步回调。 +检查当前系统帐号是否已认证解锁。使用callback异步回调。 **系统能力:** SystemCapability.Account.OsAccount @@ -481,7 +481,7 @@ checkOsAccountVerified(callback: AsyncCallback<boolean>): void | 参数名 | 类型 | 必填 | 说明 | | -------- | ---------------------------- | ---- | ------------------------------------------------------------- | -| callback | AsyncCallback<boolean> | 是 | 回调函数。返回true表示当前帐号已验证;返回false表示当前帐号未验证。 | +| callback | AsyncCallback<boolean> | 是 | 回调函数。返回true表示当前帐号已认证解锁;返回false表示当前帐号未认证解锁。 | **错误码:** @@ -508,6 +508,41 @@ checkOsAccountVerified(callback: AsyncCallback<boolean>): void ### checkOsAccountVerified9+ +checkOsAccountVerified(): Promise<boolean> + +检查当前系统帐号是否已认证解锁。使用Promise异步回调。 + +**系统能力:** SystemCapability.Account.OsAccount + +**返回值:** + +| 类型 | 说明 | +| ---------------------- | ------------------------------------------------------------------------ | +| Promise<boolean> | Promise对象。返回true表示当前帐号已认证解锁;返回false表示当前帐号未认证解锁。 | + +**错误码:** + +| 错误码ID | 错误信息 | +| -------- | ------------------- | +| 12300001 | System service exception. | + +**示例:** + + ```js + let accountManager = account_osAccount.getAccountManager(); + try { + accountManager.checkOsAccountVerified().then((isVerified) => { + console.log('checkOsAccountVerified successfully, isVerified: ' + isVerified); + }).catch((err) => { + console.log('checkOsAccountVerified failed, error: ' + JSON.stringify(err)); + }); + } catch (err) { + console.log('checkOsAccountVerified exception: ' + JSON.stringify(err)); + } + ``` + +### checkOsAccountVerified9+ + checkOsAccountVerified(localId: number, callback: AsyncCallback<boolean>): void 检查指定系统帐号是否已验证。使用callback异步回调。 @@ -521,7 +556,7 @@ checkOsAccountVerified(localId: number, callback: AsyncCallback<boolean>): | 参数名 | 类型 | 必填 | 说明 | | -------- | ---------------------------- | ---- | ------------------------------------------------------------- | | localId | number | 是 | 系统帐号ID。 | -| callback | AsyncCallback<boolean> | 是 | 回调函数。返回true表示指定帐号已验证;返回false表示指定帐号未验证。 | +| callback | AsyncCallback<boolean> | 是 | 回调函数。返回true表示当前帐号已认证解锁;返回false表示当前帐号未认证解锁。 | **错误码:** @@ -569,7 +604,7 @@ checkOsAccountVerified(localId: number): Promise<boolean> | 类型 | 说明 | | ---------------------- | ----------------------------------------------------------------- | -| Promise<boolean> | Promise对象。返回true表示指定帐号已验证;返回false表示指定帐号未验证。 | +| Promise<boolean> | Promise对象。返回true表示当前帐号已认证解锁;返回false表示当前帐号未认证解锁。 | **错误码:**