弹窗去掉icon图标

Signed-off-by: li-li-wang <wangliliang5@huawei.com>
This commit is contained in:
li-li-wang 2024-09-18 10:33:07 +08:00
parent 295860e7d6
commit ac93d147ae
11 changed files with 202 additions and 95 deletions

View File

@ -2,8 +2,8 @@
"app": {
"bundleName": "com.ohos.dlpmanager",
"vendor": "example",
"versionCode": 1000107,
"versionName": "1.0.1.07",
"versionCode": 1000108,
"versionName": "1.0.1.08",
"icon": "$media:app_icon",
"label": "$string:app_name",
"minAPIVersion": 12,

View File

@ -16,8 +16,8 @@
"app": {
"bundleName": "com.ohos.dlpmanager",
"vendor": "example",
"versionCode": 1000107,
"versionName": "1.0.1.07",
"versionCode": 1000108,
"versionName": "1.0.1.08",
"icon": "$media:app_icon",
"label": "$string:app_name",
"minAPIVersion": 12,

View File

@ -0,0 +1,52 @@
/*
* Copyright (c) 2024 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import UIExtensionContentSession from '@ohos.app.ability.UIExtensionContentSession';
import UIExtensionAbility from '@ohos.app.ability.UIExtensionAbility';
import { HiLog } from '../common/HiLog';
import Constants from '../common/constant';
import GlobalContext from '../common/GlobalContext';
const TAG = 'DialogUIExt';
export default class DialogUIExtAbility extends UIExtensionAbility {
async onSessionCreate(want: Want, session: UIExtensionContentSession): Promise<void>{
HiLog.info(TAG, `onSessionCreate start`);
GlobalContext.store('dialogUIExtWant', want);
try {
session.loadContent('pages/alert');
session.setWindowBackgroundColor(Constants.TRANSPARENT_BACKGROUND_COLOR);
} catch (exception) {
HiLog.error(TAG, `Failed to set the background color. Cause: ${JSON.stringify(exception)}`);
}
}
onSessionDestroy(session: UIExtensionContentSession): void{
HiLog.info(TAG, `onSessionDestroy`);
}
onWindowStageDestroy(): void{
HiLog.info(TAG, `onWindowStageDestroy`);
}
onForeground(): void{
HiLog.info(TAG, `onForeground`);
}
onBackground(){
HiLog.info(TAG, `onBackground`);
}
};

View File

@ -55,10 +55,9 @@ export default class MainAbility extends UIExtensionAbility {
async onSessionCreate(want: Want, session: UIExtensionContentSession): Promise<void> {
HiLog.info(TAG, `onSessionCreate start`);
if (GlobalContext.load('session')) {
await GetAlertMessage.startAlertAbility(this.context as common.UIExtensionContext,
{ code: Constants.ERR_JS_APP_ENCRYPTING,
this.gotoAlertPage(session, { code: Constants.ERR_JS_APP_ENCRYPTING,
data: GlobalContext.load('abilityWant').parameters?.displayName
} as BusinessError, session);
} as BusinessError);
return;
}
GlobalContext.store('session', session);
@ -117,8 +116,7 @@ export default class MainAbility extends UIExtensionAbility {
AppStorage.setOrCreate('validity', GlobalContext.load('dlpProperty').expireTime)
if (this.authPerm < dlpPermission.DLPFileAccess.READ_ONLY ||
this.authPerm > dlpPermission.DLPFileAccess.FULL_CONTROL) {
await GetAlertMessage.startAlertAbility(this.context,
{ code: Constants.ERR_JS_APP_INSIDE_ERROR } as BusinessError, session);
this.gotoAlertPage(session, { code: Constants.ERR_JS_APP_INSIDE_ERROR } as BusinessError);
return;
}
if (this.authPerm === dlpPermission.DLPFileAccess.FULL_CONTROL) {
@ -209,7 +207,7 @@ export default class MainAbility extends UIExtensionAbility {
resolve();
})
.catch(async (error: BusinessError) => {
await GetAlertMessage.startAlertAbility(this.context, error, session);
this.gotoAlertPage(session, error);
reject();
return;
})
@ -219,8 +217,7 @@ export default class MainAbility extends UIExtensionAbility {
async checkValidWantAndAccount(session: UIExtensionContentSession, want: Want): Promise<void> {
return new Promise(async (resolve, reject) => {
if (!this.checkValidWant(want)) {
await GetAlertMessage.startAlertAbility(this.context,
{ code: Constants.ERR_JS_APP_PARAM_ERROR } as BusinessError, session);
this.gotoAlertPage(session, { code: Constants.ERR_JS_APP_PARAM_ERROR } as BusinessError);
reject();
return;
}
@ -232,8 +229,7 @@ export default class MainAbility extends UIExtensionAbility {
resolve();
} catch (err) {
HiLog.error(TAG, `getOsAccountInfo failed: ${JSON.stringify(err)}`);
await GetAlertMessage.startAlertAbility(this.context,
{ code: Constants.ERR_JS_GET_ACCOUNT_ERROR } as BusinessError, session);
this.gotoAlertPage(session, { code: Constants.ERR_JS_GET_ACCOUNT_ERROR } as BusinessError);
reject();
return;
}
@ -250,8 +246,7 @@ export default class MainAbility extends UIExtensionAbility {
let codeMessage = checkDomainAccountInfo(GlobalContext.load('accountInfo'));
sendDlpManagerAccountLogin(0);
if (codeMessage) {
await GetAlertMessage.startAlertAbility(this.context,
{ code: codeMessage } as BusinessError, session);
this.gotoAlertPage(session, { code: codeMessage } as BusinessError);
return;
}
let requestIsFromSandBox: boolean = await judgeIsSandBox(want);
@ -290,8 +285,7 @@ export default class MainAbility extends UIExtensionAbility {
try {
isDlpSuffix = await FileUtils.isDLPFile(GlobalContext.load('uri'));
} catch {
await GetAlertMessage.startAlertAbility(this.context,
{ code: Constants.ERR_JS_APP_INSIDE_ERROR } as BusinessError, session);
this.gotoAlertPage(session, { code: Constants.ERR_JS_APP_INSIDE_ERROR } as BusinessError);
return;
}
HiLog.info(TAG, `isDlpSuffix: ${isDlpSuffix}`);
@ -357,11 +351,10 @@ export default class MainAbility extends UIExtensionAbility {
accountFlag = await GetAlertMessage.checkAccountInfo(accountName);
}
if (!accountFlag) {
await GetAlertMessage.startAlertAbility(this.context, {
code: Constants.ERR_JS_APP_INSIDE_ERROR } as BusinessError);
this.gotoAlertPage(session, { code: Constants.ERR_JS_APP_INSIDE_ERROR } as BusinessError);
return;
}
await GetAlertMessage.startAlertAbility(this.context, ansErr as BusinessError, session);
this.gotoAlertPage(session, ansErr as BusinessError);
return;
} else {
this.getOwnerAccountTypeInfo(data, session);
@ -378,8 +371,7 @@ export default class MainAbility extends UIExtensionAbility {
if (data.ownerAccountType === dlpPermission.AccountType.DOMAIN_ACCOUNT) {
this.gotoPage(session);
} else {
await GetAlertMessage.startAlertAbility(this.context, {
code: Constants.ERR_JS_APP_INSIDE_ERROR } as BusinessError);
this.gotoAlertPage(session, { code: Constants.ERR_JS_APP_INSIDE_ERROR } as BusinessError);
}
}
@ -387,8 +379,7 @@ export default class MainAbility extends UIExtensionAbility {
return new Promise<void>((resolve, reject) => {
this.homeFeature.fileOpenHistoryHome(uri, async (err: number) => {
if (err === 0) {
await GetAlertMessage.startAlertAbility(this.context,
{ code: Constants.ERR_JS_APP_OPEN_REJECTED } as BusinessError, session);
this.gotoAlertPage(session, { code: Constants.ERR_JS_APP_OPEN_REJECTED } as BusinessError);
reject();
}
resolve();
@ -396,6 +387,19 @@ export default class MainAbility extends UIExtensionAbility {
})
}
gotoAlertPage(session: UIExtensionContentSession, error: BusinessError){
let storage: LocalStorage = new LocalStorage({
'session': session,
'error': error
} as Record<string, UIExtensionContentSession | string | object>);
try {
session.loadContent('pages/alert', storage);
session.setWindowBackgroundColor(Constants.TRANSPARENT_BACKGROUND_COLOR);
} catch (exception) {
HiLog.error(TAG, `Failed to set the background color. Cause: ${JSON.stringify(exception)}`);
}
}
onWindowStageDestroy(): void {
HiLog.info(TAG, `onWindowStageDestroy`);
}

View File

@ -149,7 +149,7 @@ export default class ViewAbility extends ServiceExtensionAbility {
if (err.code === Constants.ERR_JS_APP_NOT_EXIST) {
await this.deleteData(true, false);
}
await GetAlertMessage.startAlertAbility(this.context,
await GetAlertMessage.requestModalUIExtension(this.context,
{code: Constants.ERR_JS_APP_INSIDE_ERROR } as BusinessError);
await this.sendDlpFileOpenFault(Constants.DLP_START_SANDBOX_ERROR, this.sandboxBundleName, this.appIndex,
undefined); // 105: DLP_START_SANDBOX_ERROR
@ -297,7 +297,7 @@ export default class ViewAbility extends ServiceExtensionAbility {
try {
await checkNetworkStatus();
} catch {
GetAlertMessage.startAlertAbility(this.context, {
GetAlertMessage.requestModalUIExtension(this.context, {
code: Constants.ERR_JS_APP_NETWORK_INVALID } as BusinessError);
return;
};
@ -323,7 +323,7 @@ export default class ViewAbility extends ServiceExtensionAbility {
hiTraceMeter.finishTrace('DlpGetOsAccountJs', startId);
hiTraceMeter.finishTrace('DlpOpenFileJs', startId);
opening = false;
await GetAlertMessage.startAlertAbility(this.context, {
await GetAlertMessage.requestModalUIExtension(this.context, {
code: Constants.ERR_JS_GET_ACCOUNT_ERROR } as BusinessError);
fileio.closeSync(this.dlpFd);
reject(err);
@ -346,7 +346,7 @@ export default class ViewAbility extends ServiceExtensionAbility {
if (codeMessage) {
hiTraceMeter.finishTrace('DlpOpenFileJs', startId);
opening = false;
await GetAlertMessage.startAlertAbility(this.context, {
await GetAlertMessage.requestModalUIExtension(this.context, {
code: codeMessage } as BusinessError);
fileio.closeSync(this.dlpFd);
reject();
@ -357,8 +357,7 @@ export default class ViewAbility extends ServiceExtensionAbility {
}
async callAlertAbility(errCode: BusinessError): Promise<void> {
await GetAlertMessage.startAlertAbility(this.context, errCode);
return;
await GetAlertMessage.requestModalUIExtension(this.context, errCode);
}
async getOpenedDLPFile(startId: number): Promise<void> {
@ -378,7 +377,7 @@ export default class ViewAbility extends ServiceExtensionAbility {
this.dlpFile = await dlpPermission.openDLPFile(this.dlpFd, callerAppId);
this.accountType = this.dlpFile.dlpProperty.ownerAccountType;
} catch (err) {
HiLog.error(TAG, `openDLPFile: ${this.fileName}, failed: ${JSON.stringify(err)}`);
HiLog.error(TAG, `openDLPFile: ${decodeURIComponent(this.fileName)}, failed: ${JSON.stringify(err)}`);
hiTraceMeter.finishTrace('DlpOpenDlpFileJs', startId);
hiTraceMeter.finishTrace('DlpOpenFileJs', startId);
opening = false;
@ -422,7 +421,7 @@ export default class ViewAbility extends ServiceExtensionAbility {
if (this.authPerm < dlpPermission.DLPFileAccess.READ_ONLY ||
this.authPerm > dlpPermission.DLPFileAccess.FULL_CONTROL) {
opening = false;
await GetAlertMessage.startAlertAbility(this.context, {
await GetAlertMessage.requestModalUIExtension(this.context, {
code: Constants.ERR_JS_APP_INSIDE_ERROR } as BusinessError);
await this.closeFile();
reject();
@ -501,7 +500,7 @@ export default class ViewAbility extends ServiceExtensionAbility {
await this.sendDlpFileOpenFault(
Constants.DLP_INSTALL_SANDBOX_ERROR, this.sandboxBundleName, -1, (err as BusinessError<string>).data
); // 104:DLP_INSTALL_SANDBOX_ERROR
await GetAlertMessage.startAlertAbility(this.context, {
await GetAlertMessage.requestModalUIExtension(this.context, {
code: Constants.ERR_JS_APP_INSIDE_ERROR } as BusinessError);
await this.closeFile();
reject();
@ -526,7 +525,7 @@ export default class ViewAbility extends ServiceExtensionAbility {
if (splitNames.length <= SUFFIX_INDEX) {
hiTraceMeter.finishTrace('DlpOpenFileJs', startId);
opening = false;
await GetAlertMessage.startAlertAbility(this.context, {
await GetAlertMessage.requestModalUIExtension(this.context, {
code: Constants.ERR_JS_APP_INSIDE_ERROR } as BusinessError);
await this.closeFile();
reject('');
@ -602,7 +601,7 @@ export default class ViewAbility extends ServiceExtensionAbility {
HiLog.error(TAG, `closeDLPFile failed: ${JSON.stringify(err)}`);
}
opening = false;
await GetAlertMessage.startAlertAbility(this.context, error);
await GetAlertMessage.requestModalUIExtension(this.context, error);
hiTraceMeter.finishTrace('DlpAddLinkFileJs', startId);
hiTraceMeter.finishTrace('DlpOpenFileJs', startId);
await this.closeFile();
@ -620,7 +619,7 @@ export default class ViewAbility extends ServiceExtensionAbility {
} catch (error) {
hiTraceMeter.finishTrace('DlpOpenFileJs', startId);
opening = false;
await GetAlertMessage.startAlertAbility(this.context, {
await GetAlertMessage.requestModalUIExtension(this.context, {
code: Constants.ERR_JS_APP_GET_FILE_ASSET_ERROR } as BusinessError);
await this.closeFile();
HiLog.error(TAG, `open: ${this.uri}, failed: ${JSON.stringify(error)}`);
@ -651,11 +650,12 @@ export default class ViewAbility extends ServiceExtensionAbility {
this.callerBundleName = want.parameters?.['ohos.dlp.params.bundleName'] as string;
AppStorage.setOrCreate('hiSandboxPkgName', this.callerBundleName);
if ((AppStorage.get('dlpFileMap') as Map<string, (string | number)[]>)?.has(want.uri ?? '')) {
await GetAlertMessage.startAlertAbility(this.context, {
await GetAlertMessage.requestModalUIExtension(this.context, {
code: Constants.ERR_JS_APP_ENCRYPTION_REJECTED } as BusinessError);
reject();
return;
}
this.uri = want.uri as string;
if (opening) {
HiLog.info(TAG, `file is opening: ${this.uri}`);
reject();
@ -664,7 +664,6 @@ export default class ViewAbility extends ServiceExtensionAbility {
opening = true;
HiLog.info(TAG, `file is opened: ${this.uri}`);
}
this.uri = want.uri as string;
if (!isValidPath(this.uri)) {
opening = false;
HiLog.error(TAG, `invalid uri in want.uri`);
@ -704,6 +703,8 @@ export default class ViewAbility extends ServiceExtensionAbility {
async onRequest(want: Want, startId: number): Promise<void> {
HiLog.debug(TAG, `enter onRequest`);
let paramCallerBundleName = want.parameters?.['ohos.aafwk.param.callerBundleName'] as string;
AppStorage.setOrCreate('paramCallerBundleName', paramCallerBundleName);
try {
await this.dlpFileMapHistory(want);
this.accountType = await getAccountType(this.context, this.dlpFd);
@ -733,7 +734,7 @@ export default class ViewAbility extends ServiceExtensionAbility {
if (this.sandboxBundleName !== value[Constants.FILE_OPEN_HISTORY_ZERO] as string) {
HiLog.error(TAG, `other app is opening this file`);
opening = false;
await GetAlertMessage.startAlertAbility(this.context, {
await GetAlertMessage.requestModalUIExtension(this.context, {
code: Constants.ERR_JS_OTHER_APP_OPEN_FILE } as BusinessError);
return;
}

View File

@ -246,4 +246,37 @@ export class GetAlertMessage {
}
})
}
public static async requestModalUIExtension(
context: common.UIAbilityContext | common.ServiceExtensionContext, error: BusinessError
){
if (deviceInfo.deviceType !== '2in1') {
GetAlertMessage.phoneHandle(context, error);
return;
};
let uiExtWant: Want = {
bundleName: Constants.DLP_MANAGER_BUNDLE_NAME,
abilityName: 'DialogUIExtAbility',
moduleName: 'entry',
parameters: {
'bundleName': AppStorage.get('paramCallerBundleName') ?? '',
'ability.want.params.uiExtensionType': 'sys/commonUI',
'error': error,
'accountType': GlobalContext.load('accountType')
}
};
try {
context.requestModalUIExtension(uiExtWant)
.then(() => {
HiLog.info(TAG, 'requestModalUIExtension succeed');
})
.catch((err: BusinessError) => {
HiLog.error(TAG, `requestModalUIExtension failed. Cause: ${JSON.stringify(err)}`);
})
} catch (err) {
let code = (err as BusinessError).code;
let message = (err as BusinessError).message;
HiLog.error(TAG, `requestModalUIExtension failed. Cause: ${JSON.stringify(err)}`);
}
}
}

View File

@ -13,6 +13,7 @@
* limitations under the License.
*/
import UIExtensionContentSession from '@ohos.app.ability.UIExtensionContentSession';
import { CustomContentDialog, ButtonOptions } from '@ohos.arkui.advanced.Dialog';
import GlobalContext from '../common/GlobalContext';
import { GetAlertMessage } from '../common/GetAlertMessage';
@ -36,7 +37,9 @@ let storage = LocalStorage.getShared();
@Entry(storage)
@Component
struct Index {
@State alertWant: Want | undefined = GlobalContext.load('alertWant');
@State dialogUIExtWant: Want | undefined = GlobalContext.load('dialogUIExtWant');
@State session: UIExtensionContentSession | undefined =
storage === undefined ? undefined : storage.get<UIExtensionContentSession>('session');
@State title: ResourceStr = '';
@State message: ResourceStr = '';
@State cancel: ResourceStr = '';
@ -51,8 +54,8 @@ struct Index {
},
buttons: this.buttonOptions
}),
showInSubWindow: true,
isModal: true,
autoCancel: false,
maskColor: Constants.TRANSPARENT_BACKGROUND_COLOR
});
async authWithPop(): Promise<void> {
@ -90,48 +93,61 @@ struct Index {
}
}
getErrInfo(messageCode: number, errorMsg: BusinessError, accountType: number){
let errInfo: Record<string, Resource> = {};
if ([
Constants.ERR_JS_APP_PARAM_ERROR,
Constants.ERR_JS_APP_OPEN_REJECTED,
Constants.ERR_JS_APP_ENCRYPTION_REJECTED,
Constants.ERR_JS_APP_ENCRYPTING,
Constants.ERR_JS_FILE_EXPIRATION,
Constants.ERR_JS_DLP_FILE_READ_ONLY,
Constants.ERR_JS_SYSTEM_NEED_TO_BE_UPGRADED,
].includes(messageCode)) {
errInfo = GetAlertMessage.getAlertTitleMessage(errorMsg);
} else if ([Constants.ERR_JS_APP_SYSTEM_IS_AUTHENTICATED].includes(messageCode)) {
errInfo = GetAlertMessage.getAlertButtonMessage(errorMsg);
} else if ([Constants.ERR_JS_USER_NO_PERMISSION].includes(messageCode)) {
errInfo = accountType === dlpPermission.AccountType.CLOUD_ACCOUNT ?
GetAlertMessage.getAlertMessage(errorMsg) : GetAlertMessage.getAlertTitleMessage(errorMsg);
} else {
errInfo = GetAlertMessage.getAlertMessage(errorMsg);
}
this.title = errInfo.title;
this.message = errInfo.msg;
this.cancel = errInfo.cancel;
this.actionButton = errInfo.ok;
this.buttonOptions = [{
value: this.cancel ? this.cancel : $r('app.string.da_button'),
background: $r('sys.color.ohos_id_color_button_normal'), action: () => {
abilityResult.resultCode = 0;
(getContext(this) as common.UIExtensionContext).terminateSelfWithResult(abilityResult);
}}];
if (errInfo.ok) {
this.buttonOptions.push({ value: this.actionButton, background: $r('sys.color.ohos_id_color_text_primary_activated'),
fontColor: $r('sys.color.font_on_primary'), action: () => {
this.authWithPop();
}});
}
this.dialogControllerButton?.open();
}
async aboutToAppear() {
HiLog.info(TAG, `alert aboutToAppear start`);
try {
let messageCode = (this.alertWant?.parameters?.error as BusinessError).code;
let errorMsg = this.alertWant?.parameters?.error as BusinessError;
let accountType = this.alertWant?.parameters?.accountType as number;
let errInfo: Record<string, Resource> = {};
if ([
Constants.ERR_JS_APP_PARAM_ERROR,
Constants.ERR_JS_APP_OPEN_REJECTED,
Constants.ERR_JS_APP_ENCRYPTION_REJECTED,
Constants.ERR_JS_APP_ENCRYPTING,
Constants.ERR_JS_FILE_EXPIRATION,
Constants.ERR_JS_DLP_FILE_READ_ONLY,
Constants.ERR_JS_SYSTEM_NEED_TO_BE_UPGRADED,
].includes(messageCode)) {
errInfo = GetAlertMessage.getAlertTitleMessage(errorMsg);
} else if ([Constants.ERR_JS_APP_SYSTEM_IS_AUTHENTICATED].includes(messageCode)) {
errInfo = GetAlertMessage.getAlertButtonMessage(errorMsg);
} else if ([Constants.ERR_JS_USER_NO_PERMISSION].includes(messageCode)) {
errInfo = accountType === dlpPermission.AccountType.CLOUD_ACCOUNT ?
GetAlertMessage.getAlertMessage(errorMsg) : GetAlertMessage.getAlertTitleMessage(errorMsg);
let messageCode = -1;
let errorMsg = {} as BusinessError;
let accountType = -1;
if (this.session === undefined) {
errorMsg = this.dialogUIExtWant?.parameters?.error as BusinessError;
messageCode = errorMsg.code;
accountType = this.dialogUIExtWant?.parameters?.accountType as number;
} else {
errInfo = GetAlertMessage.getAlertMessage(errorMsg);
errorMsg = storage.get('error') as BusinessError;
messageCode = errorMsg.code;
accountType = dlpPermission.AccountType.DOMAIN_ACCOUNT;
}
this.title = errInfo.title;
this.message = errInfo.msg;
this.cancel = errInfo.cancel;
this.actionButton = errInfo.ok;
this.buttonOptions = [{
value: this.cancel ? this.cancel : $r('app.string.da_button'),
background: $r('sys.color.ohos_id_color_button_normal'), action: () => {
abilityResult.resultCode = 0;
(getContext(this) as common.UIAbilityContext).terminateSelfWithResult(abilityResult);
}}];
if (errInfo.ok) {
this.buttonOptions.push({ value: this.actionButton, background: $r('sys.color.ohos_id_color_text_primary_activated'),
fontColor: $r('sys.color.font_on_primary'), action: () => {
this.authWithPop();
}});
}
this.dialogControllerButton?.open();
this.getErrInfo(messageCode, errorMsg, accountType);
} catch (err) {
HiLog.error(TAG, `showErrorDialog failed: ${JSON.stringify(err)}`);
}

View File

@ -387,9 +387,6 @@ struct changeEncryption {
return Promise.resolve();
}
} catch (err) {
let session: UIExtensionContentSession = GlobalContext.load('session') as UIExtensionContentSession;
await GetAlertMessage.startAlertAbility(getContext(this) as common.UIExtensionContext,
err as BusinessError, session);
return Promise.reject();
}
}
@ -404,9 +401,6 @@ struct changeEncryption {
if (this.session !== undefined) {
let errorInfo = GetAlertMessage.getAlertMessage({ code: Constants.ERR_JS_GET_ACCOUNT_ERROR } as BusinessError);
this.showErrorDialog(errorInfo.title, errorInfo.msg);
} else {
await GetAlertMessage.startAlertAbility(getContext(this) as common.UIExtensionContext,
{ code: Constants.ERR_JS_GET_ACCOUNT_ERROR } as BusinessError);
}
return;
}
@ -416,9 +410,6 @@ struct changeEncryption {
let errorInfo = GetAlertMessage.getAlertMessage(
{ code: codeMessage } as BusinessError);
this.showErrorDialog(errorInfo.title, errorInfo.msg);
} else {
await GetAlertMessage.startAlertAbility(getContext(this) as common.UIExtensionContext,
{ code: codeMessage } as BusinessError);
}
return;
}

View File

@ -576,9 +576,6 @@ struct DlpDialog {
if (this.session !== undefined) {
let errorInfo = GetAlertMessage.getAlertMessage({ code: Constants.ERR_JS_GET_ACCOUNT_ERROR } as BusinessError);
this.showErrorDialog(errorInfo.title, errorInfo.msg);
} else {
await GetAlertMessage.startAlertAbility(getContext(this) as common.UIAbilityContext,
{ code: Constants.ERR_JS_GET_ACCOUNT_ERROR } as BusinessError);
}
return;
}
@ -588,9 +585,6 @@ struct DlpDialog {
let errorInfo = GetAlertMessage.getAlertMessage(
{ code: codeMessage } as BusinessError);
this.showErrorDialog(errorInfo.title, errorInfo.msg);
} else {
await GetAlertMessage.startAlertAbility(getContext(this) as common.UIAbilityContext,
{ code: codeMessage } as BusinessError);
}
return;
}

View File

@ -42,6 +42,14 @@
}
],
"extensionAbilities": [
{
"name": "DialogUIExtAbility",
"icon": "$media:icon",
"description": "DialogUIExtAbility",
"type": "sys/commonUI",
"exported": true,
"srcEntry": "./ets/DialogUIExtAbility/DialogUIExtAbility.ets"
},
{
"name": "MainAbilityEx",
"icon": "$media:icon",

View File

@ -56,6 +56,14 @@
}
],
"extensionAbilities": [
{
"name": "DialogUIExtAbility",
"icon": "$media:icon",
"description": "DialogUIExtAbility",
"type": "sys/commonUI",
"exported": true,
"srcEntry": "./ets/DialogUIExtAbility/DialogUIExtAbility.ets"
},
{
"name": "MainAbilityEx",
"icon": "$media:icon",