Description:notice user when account not login

Match-id-ea64d98fb40b87041f5839fae4b86cb6c19b635b
This commit is contained in:
li-li-wang 2022-11-21 19:04:37 +08:00
parent 020d947ca6
commit 8b35cf383d
3 changed files with 10 additions and 0 deletions

View File

@ -146,6 +146,11 @@ export default class ViewAbility extends ServiceExtensionAbility {
return
}
hiTraceMeter.finishTrace("DlpGetOsAccountJs", startId);
if (accountInfo.distributedInfo.name == "ohosAnonymousName" && accountInfo.distributedInfo.id == "ohosAnonymousUid") {
startAlertAbility(Constants.APP_ERROR, Constants.APP_NO_ACCOUNT_ERROR)
hiTraceMeter.finishTrace("DlpOpenFileJs", startId);
return
}
hiTraceMeter.startTrace("DlpOpenDlpFileJs", startId);
try {
this.dlpFile = await dlpPermission.openDlpFile(srcFd)

View File

@ -154,6 +154,7 @@ export default class Constants {
static RECOVER_DLP_ERROR = '删除文档权限失败,请重试。';
static APP_INSIDE_ERROR = '应用内部错误,请重试。';
static APP_GET_ACCOUNT_ERROR = '获取帐号信息失败,请重试。';
static APP_NO_ACCOUNT_ERROR = '帐号未登录,请登录账号后重试。';
static APP_OPEN_DLP_ERROR= '打开加密文件失败,请重试。';
static APP_PERMISSION_ERROR= '权限拒绝,请重试。';
static APP_VISIT_FILE_ERROR= '无法访问此文件';

View File

@ -79,6 +79,10 @@ struct DlpDialog {
console.info(TAG + "aboutToAppear")
try {
globalThis.accountInfo = await getOsAccountInfo()
if (globalThis.accountInfo.distributedInfo.name == "ohosAnonymousName" && globalThis.accountInfo.distributedInfo.id == "ohosAnonymousUid") {
this.showDlpAlertDialog(Constants.APP_ERROR, Constants.APP_NO_ACCOUNT_ERROR)
return
}
} catch (err) {
console.info(TAG + "getOsAccountInfo error: " + JSON.stringify(err))
terminateSelfWithResult(100, "get account info failed")