mirror of
https://gitee.com/openharmony/applications_dlp_manager
synced 2025-02-26 05:26:13 +00:00
commit
39a2d61a98
@ -27,7 +27,6 @@ export default class AlertAbility extends UIAbility {
|
||||
onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void {
|
||||
HiLog.info(TAG, `onCreate`);
|
||||
GlobalContext.store('abilityWant', want);
|
||||
GlobalContext.store('alertContext', this.context)
|
||||
}
|
||||
|
||||
onDestroy(): void {
|
||||
@ -38,7 +37,7 @@ export default class AlertAbility extends UIAbility {
|
||||
// Main window is created, set main page for this ability
|
||||
HiLog.info(TAG, `onWindowStageCreate`);
|
||||
windowStage.loadContent('pages/alert', (err: BusinessError) => {
|
||||
if (err.code !== 0) {
|
||||
if (err && err.code !== 0) {
|
||||
HiLog.error(TAG, `setUIContent failed: ${JSON.stringify(err)}`);
|
||||
}
|
||||
});
|
||||
@ -46,7 +45,7 @@ export default class AlertAbility extends UIAbility {
|
||||
let mainWindow: window.Window | undefined = undefined;
|
||||
|
||||
windowStage.getMainWindow((err, data) => {
|
||||
if (err.code) {
|
||||
if (err && err.code) {
|
||||
HiLog.error(TAG, `Failed to obtain the main window. Cause: ${JSON.stringify(err)}`);
|
||||
return;
|
||||
}
|
||||
@ -60,7 +59,7 @@ export default class AlertAbility extends UIAbility {
|
||||
|
||||
let enabled = false;
|
||||
mainWindow.setResizeByDragEnabled(enabled, (err: BusinessError) => {
|
||||
if (err.code) {
|
||||
if (err && err.code) {
|
||||
HiLog.error(TAG, `Failed to set the function of disabling the resize by dragg window. Cause: ${JSON.stringify(err)}`);
|
||||
return;
|
||||
}
|
||||
|
@ -14,8 +14,6 @@
|
||||
*/
|
||||
|
||||
import UIAbility from '@ohos.app.ability.UIAbility';
|
||||
import abilityAccessCtrl from '@ohos.abilityAccessCtrl';
|
||||
import { Permissions } from '@ohos.abilityAccessCtrl';
|
||||
import dlpPermission from '@ohos.dlpPermission';
|
||||
import emitter from '@ohos.events.emitter';
|
||||
import Want from '@ohos.app.ability.Want';
|
||||
@ -62,10 +60,6 @@ export default class MainAbility extends UIAbility {
|
||||
if (!GlobalContext.load('fileOpenHistoryFromMain')) {
|
||||
GlobalContext.store('fileOpenHistoryFromMain', new Map<string, string>());
|
||||
}
|
||||
if (GlobalContext.load('fileOpenHistoryFromMain').has(want.uri)) {
|
||||
await showErrorDialogAndExit({ code: Constants.ERR_JS_APP_ENCRYPTING } as BusinessError);
|
||||
return;
|
||||
}
|
||||
GlobalContext.store('context', this.context);
|
||||
GlobalContext.store('uri', want.uri ?? '');
|
||||
direction = this.context.config.direction ?? -1;
|
||||
@ -114,26 +108,26 @@ export default class MainAbility extends UIAbility {
|
||||
AppStorage.setOrCreate('validity', GlobalContext.load('dlpProperty').expireTime)
|
||||
if (this.authPerm < dlpPermission.DLPFileAccess.READ_ONLY ||
|
||||
this.authPerm > dlpPermission.DLPFileAccess.FULL_CONTROL) {
|
||||
await showErrorDialogAndExit({ code: Constants.ERR_JS_APP_INSIDE_ERROR } as BusinessError);
|
||||
await showErrorDialogAndExit(windowStage, { code: Constants.ERR_JS_APP_INSIDE_ERROR } as BusinessError);
|
||||
return;
|
||||
}
|
||||
if (this.authPerm === dlpPermission.DLPFileAccess.FULL_CONTROL) {
|
||||
if (this.domainAccount) {
|
||||
try {
|
||||
await this.checkValidEnterpriseAndAccount();
|
||||
await this.checkValidEnterpriseAndAccount(windowStage);
|
||||
} catch {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
windowStage.loadContent('pages/changeEncryption', (err: BusinessError) =>{
|
||||
if (err.code !== 0) {
|
||||
if (err && err.code !== 0) {
|
||||
HiLog.error(TAG, `loadContent failed: ${JSON.stringify(err)}`);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
windowStage.loadContent('pages/permissionStatus', (err: BusinessError) =>{
|
||||
if (err.code !== 0) {
|
||||
if (err && err.code !== 0) {
|
||||
HiLog.error(TAG, `loadContent failed: ${JSON.stringify(err)}`);
|
||||
}
|
||||
});
|
||||
@ -181,7 +175,7 @@ export default class MainAbility extends UIAbility {
|
||||
return true;
|
||||
}
|
||||
|
||||
async checkValidEnterpriseAndAccount(): Promise<void> {
|
||||
async checkValidEnterpriseAndAccount(windowStage: window.WindowStage): Promise<void> {
|
||||
return new Promise(async (resolve, reject) => {
|
||||
let accountInfo: osAccount.OsAccountInfo = GlobalContext.load('accountInfo');
|
||||
AccountTipsConfig.getAccountInfo(accountInfo.domainInfo.accountName)
|
||||
@ -189,7 +183,7 @@ export default class MainAbility extends UIAbility {
|
||||
resolve();
|
||||
})
|
||||
.catch(async (error: BusinessError) => {
|
||||
await showErrorDialogAndExit(error);
|
||||
await showErrorDialogAndExit(windowStage, error);
|
||||
reject();
|
||||
return;
|
||||
})
|
||||
@ -238,7 +232,7 @@ export default class MainAbility extends UIAbility {
|
||||
GlobalContext.store('abilityWant', want);
|
||||
GlobalContext.store('uri', (GlobalContext.load('abilityWant') as Want).uri as string);
|
||||
sendDlpManagerAccountLogin(0);
|
||||
let requestIsFromSandBox: boolean = await judgeIsSandBox();
|
||||
let requestIsFromSandBox: boolean = await judgeIsSandBox(want);
|
||||
GlobalContext.store('requestIsFromSandBox', requestIsFromSandBox);
|
||||
HiLog.info(TAG, `request is from sandbox: ${requestIsFromSandBox}`);
|
||||
if (requestIsFromSandBox) {
|
||||
@ -260,9 +254,9 @@ export default class MainAbility extends UIAbility {
|
||||
GlobalContext.store('dlpFileName', dlpFileName);
|
||||
GlobalContext.store('linkFileName', linkFileName);
|
||||
GlobalContext.store('dlpProperty', data);
|
||||
GlobalContext.store('permanent', data.expireTime === 0);
|
||||
AppStorage.setOrCreate('permanent', data.expireTime === 0);
|
||||
if (data.expireTime !== 0) {
|
||||
GlobalContext.store('validity', new Date(data.expireTime as number));
|
||||
AppStorage.setOrCreate('validity', new Date(data.expireTime as number));
|
||||
}
|
||||
GlobalContext.store('uri', uri ?? '');
|
||||
this.gotoPage(windowStage);
|
||||
@ -276,7 +270,7 @@ export default class MainAbility extends UIAbility {
|
||||
try {
|
||||
isDlpSuffix = await FileUtils.isDLPFile(GlobalContext.load('uri'));
|
||||
} catch {
|
||||
await showErrorDialogAndExit({ code: Constants.ERR_JS_APP_INSIDE_ERROR } as BusinessError);
|
||||
await showErrorDialogAndExit(windowStage, { code: Constants.ERR_JS_APP_INSIDE_ERROR } as BusinessError);
|
||||
return;
|
||||
}
|
||||
if (!isDlpSuffix) {
|
||||
@ -284,7 +278,7 @@ export default class MainAbility extends UIAbility {
|
||||
GlobalContext.store('originFileName', fileName);
|
||||
GlobalContext.store('originFd', getFileFd(GlobalContext.load('uri') as string));
|
||||
windowStage.loadContent('pages/encryptionProtection', (err: BusinessError) =>{
|
||||
if (err.code !== 0) {
|
||||
if (err && err.code !== 0) {
|
||||
HiLog.error(TAG, `loadContent failed: ${JSON.stringify(err)}`);
|
||||
}
|
||||
});
|
||||
@ -300,7 +294,7 @@ export default class MainAbility extends UIAbility {
|
||||
async dlpFilesToEncrypt(windowStage: window.WindowStage): Promise<void> {
|
||||
let uri: string = GlobalContext.load('uri') as string;
|
||||
try {
|
||||
await this.findFileOpenHistoryHome(uri);
|
||||
await this.findFileOpenHistoryHome(windowStage, uri);
|
||||
} catch {
|
||||
return;
|
||||
}
|
||||
@ -324,14 +318,14 @@ export default class MainAbility extends UIAbility {
|
||||
name: '',
|
||||
message: msg,
|
||||
}
|
||||
await showErrorDialogAndExit(ansErr);
|
||||
await showErrorDialogAndExit(windowStage, ansErr);
|
||||
return;
|
||||
} else {
|
||||
GlobalContext.store('dlpProperty', data);
|
||||
GlobalContext.store('permanent', data.expireTime === 0);
|
||||
AppStorage.setOrCreate('permanent', data.expireTime === 0);
|
||||
GlobalContext.store('fileOpenHistoryFromMain', new Map<string, string>());
|
||||
if (data.expireTime !== 0) {
|
||||
GlobalContext.store('validity', new Date(data.expireTime as number));
|
||||
AppStorage.setOrCreate('validity', new Date(data.expireTime as number));
|
||||
}
|
||||
let fileOpenHistoryFromMain: Map<string, string> =
|
||||
GlobalContext.load('fileOpenHistoryFromMain') as Map<string, string>;
|
||||
@ -342,11 +336,11 @@ export default class MainAbility extends UIAbility {
|
||||
})
|
||||
}
|
||||
|
||||
findFileOpenHistoryHome(uri: string): Promise<void> {
|
||||
findFileOpenHistoryHome(windowStage: window.WindowStage, uri: string): Promise<void> {
|
||||
return new Promise<void>((resolve, reject) => {
|
||||
this.homeFeature.fileOpenHistoryHome(uri, async (err: number) => {
|
||||
if (err === 0) {
|
||||
await showErrorDialogAndExit({ code: Constants.ERR_JS_APP_OPEN_REJECTED } as BusinessError);
|
||||
await showErrorDialogAndExit(windowStage, { code: Constants.ERR_JS_APP_OPEN_REJECTED } as BusinessError);
|
||||
reject();
|
||||
}
|
||||
resolve();
|
||||
|
@ -75,7 +75,7 @@ export default class MainAbility extends UIExtensionAbility {
|
||||
GlobalContext.store('homeFeature', this.homeFeature);
|
||||
|
||||
this.homeFeature.connectServiceExtAbility(()=>{
|
||||
this.getNewWantPage(session);
|
||||
this.getNewWantPage(want, session);
|
||||
});
|
||||
}
|
||||
|
||||
@ -99,7 +99,6 @@ export default class MainAbility extends UIExtensionAbility {
|
||||
if (session !== GlobalContext.load('session')) {
|
||||
return;
|
||||
}
|
||||
GlobalContext.store('session', '');
|
||||
if (!(GlobalContext.load('requestIsFromSandBox') as boolean)) {
|
||||
this.homeFeature.closeDLPFileHome(GlobalContext.load('uri'), (err: number) => {
|
||||
if (err !== 0) {
|
||||
@ -107,6 +106,7 @@ export default class MainAbility extends UIExtensionAbility {
|
||||
}
|
||||
});
|
||||
}
|
||||
GlobalContext.store('session', '');
|
||||
}
|
||||
|
||||
async gotoPage(session: UIExtensionContentSession): Promise<void> {
|
||||
@ -246,7 +246,7 @@ export default class MainAbility extends UIExtensionAbility {
|
||||
})
|
||||
}
|
||||
|
||||
async getNewWantPage(session: UIExtensionContentSession): Promise<void> {
|
||||
async getNewWantPage(want: Want, session: UIExtensionContentSession): Promise<void> {
|
||||
HiLog.info(TAG, `getNewWantPage start`);
|
||||
try {
|
||||
await this.checkValidWantAndAccount(session)
|
||||
@ -260,7 +260,7 @@ export default class MainAbility extends UIExtensionAbility {
|
||||
{ code: codeMessage } as BusinessError, session);
|
||||
return;
|
||||
}
|
||||
let requestIsFromSandBox: boolean = await judgeIsSandBox();
|
||||
let requestIsFromSandBox: boolean = await judgeIsSandBox(want);
|
||||
GlobalContext.store('requestIsFromSandBox', requestIsFromSandBox);
|
||||
HiLog.info(TAG, `request is from sandbox: ${requestIsFromSandBox}`);
|
||||
if (requestIsFromSandBox) {
|
||||
@ -283,9 +283,9 @@ export default class MainAbility extends UIExtensionAbility {
|
||||
GlobalContext.store('linkFileName', linkFileName);
|
||||
GlobalContext.store('dlpProperty', data);
|
||||
GlobalContext.store('uri', uri ?? '');
|
||||
GlobalContext.store('permanent', data.expireTime === 0);
|
||||
AppStorage.setOrCreate('permanent', data.expireTime === 0);
|
||||
if (data.expireTime !== 0) {
|
||||
GlobalContext.store('validity', new Date(data.expireTime as number));
|
||||
AppStorage.setOrCreate('validity', new Date(data.expireTime as number));
|
||||
}
|
||||
this.gotoPage(session);
|
||||
});
|
||||
@ -350,7 +350,7 @@ export default class MainAbility extends UIExtensionAbility {
|
||||
message: msg,
|
||||
}
|
||||
let accountFlag: boolean = true;
|
||||
if (err === Constants.ERR_JS_USER_NO_PERMISSION) {
|
||||
if (this.domainAccount && err === Constants.ERR_JS_USER_NO_PERMISSION) {
|
||||
let accountName: string = msg.split(', contact:')?.[1];
|
||||
accountFlag = await GetAlertMessage.checkAccountInfo(accountName);
|
||||
}
|
||||
@ -364,9 +364,9 @@ export default class MainAbility extends UIExtensionAbility {
|
||||
return;
|
||||
} else {
|
||||
GlobalContext.store('dlpProperty', data);
|
||||
GlobalContext.store('permanent', data.expireTime === 0);
|
||||
AppStorage.setOrCreate('permanent', data.expireTime === 0);
|
||||
if (data.expireTime !== 0) {
|
||||
GlobalContext.store('validity', new Date(data.expireTime as number));
|
||||
AppStorage.setOrCreate('validity', new Date(data.expireTime as number));
|
||||
}
|
||||
this.gotoPage(session);
|
||||
}
|
||||
|
@ -14,26 +14,23 @@
|
||||
*/
|
||||
|
||||
import UIAbility from '@ohos.app.ability.UIAbility';
|
||||
import datafile from '@ohos.file.fileAccess';
|
||||
import picker from '@ohos.file.picker';
|
||||
import abilityAccessCtrl from '@ohos.abilityAccessCtrl';
|
||||
import { Permissions } from '@ohos.abilityAccessCtrl';
|
||||
import fileAccess from '@ohos.file.fileAccess';
|
||||
import Want from '@ohos.app.ability.Want';
|
||||
import common from '@ohos.app.ability.common';
|
||||
import AbilityConstant from '@ohos.app.ability.AbilityConstant';
|
||||
import window from '@ohos.window';
|
||||
import { BusinessError } from '@ohos.base';
|
||||
import ability from '@ohos.ability.ability';
|
||||
import dlpPermission from '@ohos.dlpPermission';
|
||||
import fs from '@ohos.file.fs';
|
||||
import fileUri from '@ohos.file.fileuri';
|
||||
import abilityManager from '@ohos.app.ability.abilityManager';
|
||||
import { getFileUriByPath, getFileFd, getAppId, isValidPath, defaultDlpFile } from '../common/utils';
|
||||
import { getFileUriByPath, getFileFd, getAppId, isValidPath, defaultDlpFile, isPC } from '../common/utils';
|
||||
import Constants from '../common/constant';
|
||||
import GlobalContext from '../common/GlobalContext';
|
||||
import zlib from '@ohos.zlib';
|
||||
import { GetAlertMessage } from '../common/GetAlertMessage';
|
||||
import { HiLog } from '../common/HiLog';
|
||||
import dialogRequest from '@ohos.app.ability.dialogRequest';
|
||||
|
||||
const TAG = 'SaveAs';
|
||||
|
||||
@ -104,22 +101,18 @@ export default class SaveAsAbility extends UIAbility {
|
||||
private newDlpFile: dlpPermission.DLPFile = defaultDlpFile;
|
||||
private srcFdPicker: number = -1;
|
||||
private linkFileName: string = '';
|
||||
private domainAccount: boolean = !isPC() ? false : true;
|
||||
|
||||
async onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): Promise<void> {
|
||||
HiLog.info(TAG, `onCreate`);
|
||||
GlobalContext.store('abilityWant', want);
|
||||
GlobalContext.store('context', this.context);
|
||||
GlobalContext
|
||||
.store('dsHelper', await datafile.createFileAccessHelper(GlobalContext
|
||||
.load('context') as common.UIAbilityContext));
|
||||
await this.prepareDlpFile();
|
||||
await this.prepareDlpFile(want);
|
||||
try {
|
||||
await abilityManager.notifySaveAsResult(this.result, this.requestCode);
|
||||
} catch (err) {
|
||||
HiLog.error(TAG, `notifySaveAsResult failed: ${JSON.stringify(err)}`);
|
||||
}
|
||||
if (this.isOK === true) {
|
||||
(GlobalContext.load('context') as common.UIAbilityContext).terminateSelf();
|
||||
if (this.isOK) {
|
||||
this.context.terminateSelf();
|
||||
}
|
||||
}
|
||||
|
||||
@ -147,35 +140,32 @@ export default class SaveAsAbility extends UIAbility {
|
||||
HiLog.info(TAG, `onBackground`);
|
||||
}
|
||||
|
||||
async parseParams(): Promise<boolean | void> {
|
||||
if (GlobalContext.load('abilityWant') === undefined ||
|
||||
(GlobalContext.load('abilityWant') as Want).parameters === undefined) {
|
||||
HiLog.error(TAG, `invalid abilityWant`);
|
||||
async parseParams(want: Want): Promise<boolean | void> {
|
||||
if (want.parameters === undefined) {
|
||||
HiLog.error(TAG, `invalid want`);
|
||||
return false;
|
||||
}
|
||||
|
||||
this.requestCode = (GlobalContext.load('abilityWant') as Want)
|
||||
.parameters?.['requestCode'] as number;
|
||||
this.requestCode = want.parameters?.['requestCode'] as number;
|
||||
if (this.requestCode === undefined) {
|
||||
HiLog.error(TAG, `invalid requestCode`);
|
||||
return false;
|
||||
}
|
||||
|
||||
this.tokenId = (GlobalContext.load('abilityWant') as Want)
|
||||
.parameters?.['ohos.aafwk.param.callerToken'] as number;
|
||||
this.tokenId = want.parameters?.['ohos.aafwk.param.callerToken'] as number;
|
||||
if (this.tokenId === undefined) {
|
||||
HiLog.error(TAG, `invalid tokenId`);
|
||||
return false;
|
||||
}
|
||||
try {
|
||||
await this.checkParseParams();
|
||||
await this.checkParseParams(want);
|
||||
return true;
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
checkParseParams(): Promise<void> {
|
||||
checkParseParams(want: Want): Promise<void> {
|
||||
return new Promise(async (resolve, reject) => {
|
||||
this.authPerm = (GlobalContext.load('token2File') as
|
||||
Map<number, (number | string | dlpPermission.DLPFile | dlpPermission.DLPFileAccess)[]>)
|
||||
@ -183,44 +173,44 @@ export default class SaveAsAbility extends UIAbility {
|
||||
let dlpFileInfo = (GlobalContext.load('token2File') as
|
||||
Map<number, (number | string | dlpPermission.DLPFile | dlpPermission.DLPFileAccess)[]>)
|
||||
.get(this.tokenId)?.[0] as dlpPermission.DLPFile;
|
||||
let ownerAccount = dlpFileInfo.dlpProperty.ownerAccount as string;
|
||||
|
||||
let contactAccount = dlpFileInfo.dlpProperty.contactAccount as string;
|
||||
if (this.authPerm != dlpPermission.DLPFileAccess.CONTENT_EDIT &&
|
||||
this.authPerm != dlpPermission.DLPFileAccess.FULL_CONTROL) {
|
||||
HiLog.error(TAG, `invalid authPerm: ${this.authPerm}`);
|
||||
this.isOK = false;
|
||||
AppStorage.setOrCreate('ownerAccount', ownerAccount);
|
||||
await GetAlertMessage.startAlertAbility(GlobalContext.load('context') as common.UIAbilityContext,
|
||||
{
|
||||
code: Constants.ERR_JS_DLP_FILE_READ_ONLY
|
||||
} as BusinessError);
|
||||
AppStorage.setOrCreate('contactAccount', contactAccount);
|
||||
let accountFlag: boolean = true;
|
||||
if (this.domainAccount) {
|
||||
accountFlag = await GetAlertMessage.checkAccountInfo(contactAccount);
|
||||
}
|
||||
if (!accountFlag) {
|
||||
await GetAlertMessage.startAlertAbility(this.context, {
|
||||
code: Constants.ERR_JS_APP_INSIDE_ERROR } as BusinessError);
|
||||
reject();
|
||||
}
|
||||
await GetAlertMessage.startAlertAbility(this.context,
|
||||
{ code: Constants.ERR_JS_DLP_FILE_READ_ONLY } as BusinessError);
|
||||
reject();
|
||||
return false;
|
||||
}
|
||||
if (!(GlobalContext.load('token2File') as Map<number, Object[]>).has(this.tokenId)) {
|
||||
HiLog.error(TAG, `invalid token2File`);
|
||||
reject();
|
||||
return;
|
||||
}
|
||||
this.fileName = (GlobalContext.load('abilityWant') as Want)
|
||||
.parameters?.['key_pick_file_name'] as string;
|
||||
if (this.fileName === undefined) {
|
||||
HiLog.error(TAG, `invalid fileName`);
|
||||
let newFileName = want.parameters?.['key_pick_file_name'] as [];
|
||||
if (newFileName === undefined) {
|
||||
HiLog.error(TAG, `invalid newFileName`);
|
||||
reject();
|
||||
return false;
|
||||
}
|
||||
this.fileName = String(this.fileName);
|
||||
this.fileName = newFileName.join('');
|
||||
let splitNames = this.fileName.split('.');
|
||||
HiLog.debug(TAG, `splitNames: ${splitNames}`);
|
||||
HiLog.info(TAG, `splitNames: ${splitNames}`);
|
||||
if (splitNames.length <= SUFFIX_INDEX) {
|
||||
HiLog.error(TAG, `get suffix failed`);
|
||||
reject();
|
||||
return;
|
||||
}
|
||||
this.suffix = splitNames[splitNames.length - SUFFIX_INDEX];
|
||||
HiLog.info(TAG, `suffix is: ${this.suffix}`);
|
||||
resolve();
|
||||
return true;
|
||||
})
|
||||
}
|
||||
|
||||
@ -247,7 +237,7 @@ export default class SaveAsAbility extends UIAbility {
|
||||
}
|
||||
|
||||
async copyDlpHead(srcFd: number, dstFd: number) {
|
||||
let appDir = (GlobalContext.load('context') as common.UIAbilityContext).filesDir + '/';
|
||||
let appDir = this.context.filesDir + '/';
|
||||
this.filePath = appDir + 'saveAs' + this.random;
|
||||
this.dirPath = appDir + 'saveAsUnzip' + this.random;
|
||||
this.encFile = this.dirPath + '/encrypted_data';
|
||||
@ -256,12 +246,12 @@ export default class SaveAsAbility extends UIAbility {
|
||||
try {
|
||||
await this.copyDlpHeadData(srcFd, dstFd);
|
||||
} catch (err) {
|
||||
HiLog.error(TAG, `copyDlpHead: ${JSON.stringify(err)}`);
|
||||
HiLog.error(TAG, `copyDlpHead: ${JSON.stringify(err)}, message: ${JSON.stringify(err.message)}`);
|
||||
try {
|
||||
await fs.close(this.ff);
|
||||
await fs.close(this.zf2);
|
||||
} catch (error) {
|
||||
HiLog.error(TAG, `close: ${JSON.stringify(err)}`);
|
||||
HiLog.error(TAG, `close: ${JSON.stringify(error)}`);
|
||||
}
|
||||
}
|
||||
if (this.zipFlag) {
|
||||
@ -344,13 +334,16 @@ export default class SaveAsAbility extends UIAbility {
|
||||
return config;
|
||||
}
|
||||
|
||||
getDocumentPickerSaveResult(args: ability.AbilityResult) {
|
||||
getDocumentPickerSaveResult(args: dialogRequest.RequestResult | ability.AbilityResult) {
|
||||
let saveResult: Record<string, BusinessError | string[]> = {
|
||||
'error': {} as BusinessError,
|
||||
'data': []
|
||||
};
|
||||
|
||||
if ((args.resultCode !== undefined && args.resultCode === 0)) {
|
||||
if (((args as dialogRequest.RequestResult).result !== undefined &&
|
||||
(args as dialogRequest.RequestResult).result === 0) ||
|
||||
((args as ability.AbilityResult).resultCode !== undefined &&
|
||||
(args as ability.AbilityResult).resultCode === 0)) {
|
||||
if (args.want && args.want.parameters) {
|
||||
if (args.want.parameters.pick_path_return) {
|
||||
saveResult.data = args.want.parameters.pick_path_return as string[];
|
||||
@ -358,7 +351,10 @@ export default class SaveAsAbility extends UIAbility {
|
||||
saveResult.data = args.want.parameters['ability.params.stream'] as string[];
|
||||
}
|
||||
}
|
||||
} else if ((args.resultCode !== undefined && args.resultCode === -1)) {
|
||||
} else if (((args as dialogRequest.RequestResult).result !== undefined &&
|
||||
(args as dialogRequest.RequestResult).result === 0) ||
|
||||
((args as ability.AbilityResult).resultCode !== undefined &&
|
||||
(args as ability.AbilityResult).resultCode === -1)) {
|
||||
saveResult.data = [];
|
||||
} else {
|
||||
saveResult.error = this.getErr(errCode.RESULT_ERROR) as BusinessError;
|
||||
@ -371,16 +367,15 @@ export default class SaveAsAbility extends UIAbility {
|
||||
getErr(errCode: number) {
|
||||
return {code: errCode, message: ERRCODE_MAP.get(errCode)} as BusinessError;
|
||||
}
|
||||
|
||||
async documentPickerSave(...args: Object[]): Promise<BusinessError | string[] | undefined> {
|
||||
let context = GlobalContext.load('context') as common.UIAbilityContext;
|
||||
let config: Record<string, string | Record<string, Object>>;
|
||||
let result: ability.AbilityResult;
|
||||
let result: dialogRequest.RequestResult | ability.AbilityResult;
|
||||
try {
|
||||
config = this.parseDocumentPickerSaveOption(args, ACTION.SAVE_ACTION_MODAL);
|
||||
config = this.parseDocumentPickerSaveOption(args, ACTION.SAVE_ACTION);
|
||||
result = await context.startAbilityForResult(config, {windowMode: 0});
|
||||
result = await this.context.startAbilityForResult(config, {windowMode: 0});
|
||||
} catch (error) {
|
||||
HiLog.info(TAG, `[picker] error: ${error}`);
|
||||
HiLog.info(TAG, `startAbilityForResult${JSON.stringify(error)}`);
|
||||
return undefined;
|
||||
}
|
||||
HiLog.info(TAG, `[picker] Save result: ${JSON.stringify(result)}`);
|
||||
@ -404,18 +399,19 @@ export default class SaveAsAbility extends UIAbility {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
async prepareDlpFile(): Promise<void> {
|
||||
HiLog.info(TAG, `getFile start: ${JSON.stringify(GlobalContext.load('abilityWant'))}`);
|
||||
async prepareDlpFile(want: Want): Promise<void> {
|
||||
HiLog.info(TAG, `getFile start prepareDlpFile`);
|
||||
let uri = '';
|
||||
let displayName = '';
|
||||
|
||||
let ret = await this.parseParams();
|
||||
let ret = await this.parseParams(want);
|
||||
if (!ret) {
|
||||
HiLog.info(TAG, `parseParams failed`);
|
||||
return;
|
||||
}
|
||||
let documentSaveOptions = new picker.DocumentSaveOptions();
|
||||
displayName = this.fileName;
|
||||
documentSaveOptions.newFileNames = [displayName];
|
||||
documentSaveOptions.fileSuffixChoices = [`.${this.suffix}.dlp`];
|
||||
try {
|
||||
let saveRes: BusinessError | string[] | undefined = await this.documentPickerSave(documentSaveOptions);
|
||||
if (saveRes == undefined || (saveRes instanceof Array && saveRes.length == 0)) {
|
||||
@ -429,8 +425,9 @@ export default class SaveAsAbility extends UIAbility {
|
||||
}
|
||||
try {
|
||||
await this.fileOpen(uri);
|
||||
await this.pickerDialog(uri);
|
||||
await this.pickerDialog(uri, want);
|
||||
} catch {
|
||||
HiLog.info(TAG, `fileOpen or pickerDialog start failed`);
|
||||
return;
|
||||
}
|
||||
} catch (err) {
|
||||
@ -439,20 +436,18 @@ export default class SaveAsAbility extends UIAbility {
|
||||
if (this.file != undefined) {
|
||||
await fs.close(this.file);
|
||||
}
|
||||
await this.deleteUri(uri);
|
||||
} catch (err) {
|
||||
HiLog.info(TAG, `close fail: ${JSON.stringify(err)}`);
|
||||
}
|
||||
await (GlobalContext.load('dsHelper') as fileAccess.FileAccessHelper).delete(uri);
|
||||
this.isOK = false;
|
||||
await GetAlertMessage.startAlertAbility(GlobalContext.load('context') as common.UIAbilityContext,
|
||||
{
|
||||
code: Constants.ERR_JS_APP_INSIDE_ERROR
|
||||
} as BusinessError);
|
||||
await GetAlertMessage.startAlertAbility(this.context,
|
||||
{ code: Constants.ERR_JS_APP_INSIDE_ERROR } as BusinessError);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
pickerDialog(uri: string): Promise<void> {
|
||||
pickerDialog(uri: string, want: Want): Promise<void> {
|
||||
return new Promise(async (resolve, reject) => {
|
||||
let token2FileValue: (number | string | dlpPermission.DLPFile | dlpPermission.DLPFileAccess)[] =
|
||||
(GlobalContext
|
||||
@ -467,20 +462,18 @@ export default class SaveAsAbility extends UIAbility {
|
||||
if (!this.retVal) {
|
||||
try {
|
||||
await fs.close(this.file);
|
||||
await this.deleteUri(uri);
|
||||
} catch (err) {
|
||||
HiLog.info(TAG, `close fail: ${JSON.stringify(err)}`);
|
||||
}
|
||||
await (GlobalContext.load('dsHelper') as fileAccess.FileAccessHelper).delete(uri);
|
||||
fs.closeSync(this.srcFdPicker);
|
||||
this.isOK = false;
|
||||
await GetAlertMessage.startAlertAbility(GlobalContext.load('context') as common.UIAbilityContext,
|
||||
{
|
||||
code: Constants.ERR_JS_APP_INSIDE_ERROR
|
||||
} as BusinessError);
|
||||
await GetAlertMessage.startAlertAbility(this.context,
|
||||
{ code: Constants.ERR_JS_APP_INSIDE_ERROR } as BusinessError);
|
||||
reject();
|
||||
}
|
||||
try {
|
||||
await this.openDLPFile(uri);
|
||||
await this.openDLPFile(uri, want);
|
||||
await this.addDLPLinkFile(appId, uri);
|
||||
} catch {
|
||||
reject();
|
||||
@ -516,26 +509,23 @@ export default class SaveAsAbility extends UIAbility {
|
||||
if (this.file != undefined) {
|
||||
await fs.close(this.file);
|
||||
}
|
||||
await this.deleteUri(uri);
|
||||
} catch (err) {
|
||||
HiLog.info(TAG, `close fail: ${JSON.stringify(err)}`);
|
||||
}
|
||||
await (GlobalContext.load('dsHelper') as fileAccess.FileAccessHelper).delete(uri);
|
||||
this.isOK = false;
|
||||
await GetAlertMessage.startAlertAbility(GlobalContext.load('context') as common.UIAbilityContext,
|
||||
{
|
||||
code: Constants.ERR_JS_APP_INSIDE_ERROR
|
||||
} as BusinessError);
|
||||
await GetAlertMessage.startAlertAbility(this.context,
|
||||
{ code: Constants.ERR_JS_APP_INSIDE_ERROR } as BusinessError);
|
||||
reject();
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
openDLPFile(uri: string): Promise<void> {
|
||||
openDLPFile(uri: string, want: Want): Promise<void> {
|
||||
return new Promise(async (resolve, reject) => {
|
||||
let callerAppId: string;
|
||||
try {
|
||||
let callerBundleName =
|
||||
(GlobalContext.load('abilityWant') as Want).parameters?.['ohos.aafwk.param.callerBundleName'] as string;
|
||||
let callerBundleName = want.parameters?.['ohos.aafwk.param.callerBundleName'] as string;
|
||||
callerAppId = await getAppId(callerBundleName);
|
||||
HiLog.info(TAG, `get AppId: ${callerAppId}`);
|
||||
} catch {
|
||||
@ -546,16 +536,15 @@ export default class SaveAsAbility extends UIAbility {
|
||||
this.newDlpFile = await dlpPermission.openDLPFile(this.dstFdPicker, callerAppId);
|
||||
} catch (err) {
|
||||
HiLog.error(TAG, `generateDlpFile: ${this.dstFdPicker}, failed: ${JSON.stringify(err)}`);
|
||||
await GetAlertMessage.startAlertAbility(GlobalContext.load('context') as common.UIAbilityContext, err);
|
||||
await GetAlertMessage.startAlertAbility(this.context, err);
|
||||
try {
|
||||
await fs.close(this.file);
|
||||
await this.deleteUri(uri);
|
||||
} catch (err) {
|
||||
HiLog.info(TAG, `close fail: ${JSON.stringify(err)}`);
|
||||
}
|
||||
await (GlobalContext.load('dsHelper') as fileAccess.FileAccessHelper).delete(uri);
|
||||
fs.closeSync(this.srcFdPicker);
|
||||
reject();
|
||||
return;
|
||||
}
|
||||
resolve();
|
||||
})
|
||||
@ -582,18 +571,34 @@ export default class SaveAsAbility extends UIAbility {
|
||||
}
|
||||
try {
|
||||
await fs.close(this.file);
|
||||
await this.deleteUri(uri);
|
||||
} catch (err) {
|
||||
HiLog.info(TAG, `close fail: ${JSON.stringify(err)}`);
|
||||
}
|
||||
await (GlobalContext.load('dsHelper') as fileAccess.FileAccessHelper).delete(uri);
|
||||
fs.closeSync(this.srcFdPicker);
|
||||
this.isOK = false;
|
||||
await GetAlertMessage.startAlertAbility(GlobalContext.load('context') as common.UIAbilityContext,
|
||||
{
|
||||
code: Constants.ERR_JS_APP_INSIDE_ERROR
|
||||
} as BusinessError);
|
||||
await GetAlertMessage.startAlertAbility(this.context,
|
||||
{ code: Constants.ERR_JS_APP_INSIDE_ERROR } as BusinessError);
|
||||
reject();
|
||||
}
|
||||
resolve();
|
||||
})
|
||||
}
|
||||
|
||||
deleteUri(uri: string): Promise<void> {
|
||||
return new Promise(async (resolve, reject) => {
|
||||
let uriInfo: fileUri.FileUri = new fileUri.FileUri('');
|
||||
try {
|
||||
uriInfo = new fileUri.FileUri(uri);
|
||||
} catch (err) {
|
||||
HiLog.error(TAG, `fileUri fail: ${JSON.stringify(err)}`);
|
||||
reject();
|
||||
}
|
||||
try {
|
||||
await fs.unlink(uriInfo.path);
|
||||
} catch (err) {
|
||||
HiLog.error(TAG, `unlink fail: ${JSON.stringify(err)}`);
|
||||
reject();
|
||||
return;
|
||||
}
|
||||
resolve();
|
||||
})
|
||||
|
@ -22,7 +22,6 @@ import hiSysEvent from '@ohos.hiSysEvent';
|
||||
import wantConstant from '@ohos.app.ability.wantConstant';
|
||||
import fs from '@ohos.file.fs';
|
||||
import fileUri from '@ohos.file.fileuri';
|
||||
import common from '@ohos.app.ability.common';
|
||||
import { BusinessError } from '@ohos.base';
|
||||
import osAccount from '@ohos.account.osAccount';
|
||||
import uriPermissionManager from '@ohos.application.uriPermissionManager';
|
||||
@ -316,7 +315,7 @@ export default class ViewAbility extends ServiceExtensionAbility {
|
||||
Constants.DLP_FILE_PARSE_ERROR, this.sandboxBundleName, -1, (err as BusinessError<string>).data
|
||||
); // 103:DLP_FILE_PARSE_ERROR
|
||||
let accountFlag: boolean = true;
|
||||
if (err.code === Constants.ERR_JS_USER_NO_PERMISSION) {
|
||||
if (this.domainAccount && err.code === Constants.ERR_JS_USER_NO_PERMISSION) {
|
||||
let accountName: string = err.message.split(', contact:')?.[1];
|
||||
accountFlag = await GetAlertMessage.checkAccountInfo(accountName);
|
||||
}
|
||||
@ -568,7 +567,7 @@ export default class ViewAbility extends ServiceExtensionAbility {
|
||||
return new Promise(async (resolve, reject) => {
|
||||
this.callerBundleName = want.parameters?.['ohos.dlp.params.bundleName'] as string;
|
||||
AppStorage.setOrCreate('hiSandboxPkgName', this.callerBundleName);
|
||||
if ((GlobalContext.load('dlpFileMap') as Map<string, (string | number)[]>)?.has(want.uri ?? '')) {
|
||||
if ((AppStorage.get('dlpFileMap') as Map<string, (string | number)[]>)?.has(want.uri ?? '')) {
|
||||
await GetAlertMessage.startAlertAbility(this.context, {
|
||||
code: Constants.ERR_JS_APP_ENCRYPTION_REJECTED } as BusinessError);
|
||||
reject();
|
||||
@ -597,7 +596,6 @@ export default class ViewAbility extends ServiceExtensionAbility {
|
||||
let len: number = strArray.length;
|
||||
this.fileName = strArray[len - 1];
|
||||
this.dlpFd = getFileFd(this.uri);
|
||||
GlobalContext.store('uri', this.uri);
|
||||
HiLog.debug(TAG, `dlpFd: ${this.dlpFd}`);
|
||||
if (this.dlpFd === -1) {
|
||||
opening = false;
|
||||
|
@ -94,9 +94,9 @@ export class AccountTipsConfig {
|
||||
return new Promise((resolve, reject) => {
|
||||
try {
|
||||
let filePath: string = configPolicy.getOneCfgFileSync(AccountTipsConfig.ccmConfigPath);
|
||||
let isExitFile: boolean = fs.accessSync(filePath);
|
||||
let isExistFile: boolean = fs.accessSync(filePath);
|
||||
let configStr: string = '';
|
||||
if (isExitFile) {
|
||||
if (isExistFile) {
|
||||
configStr = fs.readTextSync(filePath);
|
||||
} else {
|
||||
let context: common.UIAbilityContext = GlobalContext.load('context') as common.UIAbilityContext;
|
||||
|
@ -54,7 +54,7 @@ export class GetAlertMessage {
|
||||
windowHeight
|
||||
}
|
||||
}, options, async (err: BusinessError) => {
|
||||
if (err.code !== 0) {
|
||||
if (err && err.code !== 0) {
|
||||
HiLog.error(TAG, `start AlertAbility failed: ${JSON.stringify(err)}`);
|
||||
}
|
||||
if (session) {
|
||||
@ -115,7 +115,7 @@ export class GetAlertMessage {
|
||||
}
|
||||
|
||||
public static getAlertMessage(err: BusinessError, defaultTitle?: Resource, defaultMessage?: Resource) {
|
||||
switch (err.code) {
|
||||
switch (err && err.code) {
|
||||
case Constants.ERR_JS_ACCOUNT_NOT_FOUND:
|
||||
case Constants.ERR_JS_GET_ACCOUNT_ERROR:
|
||||
return { 'msg': $r('app.string.MESSAGE_APP_GET_ACCOUNT_ERROR') } as Record<string, Resource>;
|
||||
@ -146,7 +146,7 @@ export class GetAlertMessage {
|
||||
}
|
||||
|
||||
public static getAlertTitleMessage(err: BusinessError) {
|
||||
switch (err.code) {
|
||||
switch (err && err.code) {
|
||||
case Constants.ERR_JS_USER_NO_PERMISSION:
|
||||
return {
|
||||
'title': $r('app.string.TITLE_APP_VISIT_FILE_ERROR'),
|
||||
@ -180,7 +180,7 @@ export class GetAlertMessage {
|
||||
case Constants.ERR_JS_DLP_FILE_READ_ONLY:
|
||||
return {
|
||||
'title': $r('app.string.TITLE_APP_VISIT_FILE_ERROR'),
|
||||
'msg': $r('app.string.MESSAGE_DLP_READ_ONLY', AppStorage.get('ownerAccount'))
|
||||
'msg': $r('app.string.MESSAGE_DLP_READ_ONLY', AppStorage.get('contactAccount'))
|
||||
} as Record<string, Resource>;
|
||||
case Constants.ERR_JS_SYSTEM_NEED_TO_BE_UPGRADED:
|
||||
return {
|
||||
@ -196,7 +196,7 @@ export class GetAlertMessage {
|
||||
}
|
||||
|
||||
public static getAlertButtonMessage(err: BusinessError) {
|
||||
switch (err.code) {
|
||||
switch (err && err.code) {
|
||||
case Constants.ERR_JS_APP_SYSTEM_IS_AUTHENTICATED:
|
||||
return {
|
||||
'title': $r('app.string.header_title'),
|
||||
@ -226,13 +226,16 @@ export class GetAlertMessage {
|
||||
domain: accountDomain,
|
||||
accountName: accountName
|
||||
};
|
||||
account_osAccount.DomainAccountManager.hasAccount(domainAccountInfo, (error: BusinessError, isExist: boolean) => {
|
||||
if (isExist) {
|
||||
resolve(true);
|
||||
} else {
|
||||
resolve(false);
|
||||
}
|
||||
})
|
||||
try {
|
||||
account_osAccount.DomainAccountManager.getAccountInfo(domainAccountInfo)
|
||||
.then((result: account_osAccount.DomainAccountInfo) => {
|
||||
resolve(true);
|
||||
}).catch((err: BusinessError) => {
|
||||
resolve(false);
|
||||
})
|
||||
} catch (err) {
|
||||
resolve(false);
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
@ -76,7 +76,7 @@ struct DlpAlertDialog {
|
||||
if (this.action != null) {
|
||||
this.action()
|
||||
} else {
|
||||
(GlobalContext.load('alertContext') as common.UIAbilityContext).terminateSelf();
|
||||
(getContext(this) as common.UIAbilityContext).terminateSelf();
|
||||
}
|
||||
})
|
||||
.margin({
|
||||
@ -89,7 +89,7 @@ struct DlpAlertDialog {
|
||||
.backgroundColor($r('sys.color.ohos_id_color_text_primary_activated'))
|
||||
.height(Constants.FOOTER_BUTTON_HEIGHT)
|
||||
.onClick(async (event) => {
|
||||
(GlobalContext.load('alertContext') as common.UIAbilityContext).terminateSelf();
|
||||
(getContext(this) as common.UIAbilityContext).terminateSelf();
|
||||
})
|
||||
.margin({ left: Constants.ENCRYPTION_PROTECTION_BUTTON_MARGIN })
|
||||
}
|
||||
|
@ -13,12 +13,9 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import osAccount from '@ohos.account.osAccount';
|
||||
import { BusinessError } from '@ohos.base';
|
||||
import account_osAccount from '@ohos.account.osAccount';
|
||||
import { staffItem } from './staff';
|
||||
import Constants from '../constant';
|
||||
import GlobalContext from '../GlobalContext';
|
||||
import { AccountTipsConfig } from '../AccountTipsConfig';
|
||||
import { HiLog } from '../HiLog';
|
||||
import { isPC } from '../utils';
|
||||
@ -133,26 +130,6 @@ struct AddStaff {
|
||||
}
|
||||
|
||||
private createStaffByDomain(i: number, startOffset: number[], endOffset: number[]) {
|
||||
return new Promise<void>((resolve, reject) => {
|
||||
let accountDomain = AppStorage.get('accountDomain') as string;
|
||||
let domainAccountInfo: osAccount.DomainAccountInfo = {
|
||||
domain: accountDomain,
|
||||
accountName: this.inputArray[i].toLocaleLowerCase().trim()
|
||||
};
|
||||
account_osAccount.DomainAccountManager.hasAccount(domainAccountInfo,
|
||||
async (error: BusinessError, isExist: boolean) => {
|
||||
if (isExist) {
|
||||
await this.createStaffItem(i, startOffset, endOffset);
|
||||
} else {
|
||||
HiLog.info(TAG, `hasAccount fail: ${JSON.stringify(error)}`);
|
||||
this.showErrInput(i, error, startOffset, endOffset);
|
||||
}
|
||||
resolve();
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
private createStaffItem(i: number, startOffset: number[], endOffset: number[]) {
|
||||
return new Promise<void>(async (resolve, reject) => {
|
||||
try {
|
||||
let result = await AccountTipsConfig.getAccountInfo(this.inputArray[i]);
|
||||
@ -310,7 +287,7 @@ struct AddStaff {
|
||||
let textNum: number = 0;
|
||||
for (let i = 0; i <= len; i++) {
|
||||
let buildSpan: RichEditorTextSpanResult = richEditorSpansAll[i] as RichEditorTextSpanResult;
|
||||
if (buildSpan.textStyle) {
|
||||
if (buildSpan?.textStyle) {
|
||||
textNum++;
|
||||
}
|
||||
}
|
||||
|
@ -16,9 +16,7 @@
|
||||
import account_osAccount from '@ohos.account.osAccount';
|
||||
import common from '@ohos.app.ability.common';
|
||||
import { BusinessError } from '@ohos.base';
|
||||
import osAccount from '@ohos.account.osAccount';
|
||||
import Constants from '../constant';
|
||||
import GlobalContext from '../GlobalContext';
|
||||
import { AccountTips, AccountTipsConfig } from '../AccountTipsConfig';
|
||||
import { GetAlertMessage } from '../GetAlertMessage';
|
||||
import { DlpAlertDialog } from '../components/dlp_alert_dialog';
|
||||
@ -119,15 +117,16 @@ struct staffItem {
|
||||
}
|
||||
|
||||
private splitContent() {
|
||||
if (this.domainAccount) {
|
||||
if (this.textContent) {
|
||||
if (this.textContent.length > Constants.TIPS_NAME_LENGTH) {
|
||||
return this.textContent.split('').join(Constants.TIPS_SPACE_ZERO)
|
||||
} else if (this.textContent.length === Constants.TIPS_NAME_LENGTH) {
|
||||
return this.textContent.split('').join(Constants.TIPS_SPACE_EM)
|
||||
} else {
|
||||
return Constants.TIPS_SPACE_EN + this.textContent;
|
||||
}
|
||||
if (!this.domainAccount) {
|
||||
return this.textContent;
|
||||
}
|
||||
if (this.textContent) {
|
||||
if (this.textContent.length > Constants.TIPS_NAME_LENGTH) {
|
||||
return this.textContent.split('').join(Constants.TIPS_SPACE_ZERO)
|
||||
} else if (this.textContent.length === Constants.TIPS_NAME_LENGTH) {
|
||||
return this.textContent.split('').join(Constants.TIPS_SPACE_EM)
|
||||
} else {
|
||||
return Constants.TIPS_SPACE_EN + this.textContent;
|
||||
}
|
||||
}
|
||||
return this.textContent;
|
||||
|
@ -154,17 +154,16 @@ function terminateSelfWithResult(resultCode: number, result: string): void {
|
||||
}
|
||||
}
|
||||
};
|
||||
(GlobalContext.load('context') as common.UIAbilityContext).terminateSelfWithResult(abilityResult);
|
||||
(getContext() as common.UIAbilityContext).terminateSelfWithResult(abilityResult);
|
||||
}
|
||||
|
||||
function judgeIsSandBox() {
|
||||
function judgeIsSandBox(want: Want) {
|
||||
return new Promise<boolean>(async resolve => {
|
||||
let abilityWant: Want = GlobalContext.load('abilityWant') as Want;
|
||||
let callerToken: number = abilityWant.parameters?.['ohos.aafwk.param.callerToken'] as number;
|
||||
let callerBundleName: string = abilityWant.parameters?.['ohos.aafwk.param.callerBundleName'] as string;
|
||||
GlobalContext.store('applicationInfo', await bundleManager.getApplicationInfo(
|
||||
callerBundleName, bundleManager.ApplicationFlag.GET_APPLICATION_INFO_DEFAULT));
|
||||
if (callerToken === (GlobalContext.load('applicationInfo') as bundleManager.ApplicationInfo).accessTokenId) {
|
||||
let callerToken: number = want.parameters?.['ohos.aafwk.param.callerToken'] as number;
|
||||
let callerBundleName: string = want.parameters?.['ohos.aafwk.param.callerBundleName'] as string;
|
||||
let applicationInfo = await bundleManager.getApplicationInfo(
|
||||
callerBundleName, bundleManager.ApplicationFlag.GET_APPLICATION_INFO_DEFAULT);
|
||||
if (callerToken === applicationInfo.accessTokenId) {
|
||||
resolve(false);
|
||||
}
|
||||
resolve(true);
|
||||
@ -237,14 +236,12 @@ function isPC(): boolean {
|
||||
return (deviceTypeName === 'tablet' || deviceTypeName === '2in1') && productModel?.startsWith('HYM') === true
|
||||
}
|
||||
|
||||
async function showErrorDialogAndExit(error: BusinessError): Promise<void> {
|
||||
async function showErrorDialogAndExit(windowStage: window.WindowStage, error: BusinessError): Promise<void> {
|
||||
let abilityWant = GlobalContext.load('abilityWant') as Want;
|
||||
if (abilityWant.parameters) {
|
||||
abilityWant.parameters.error = error;
|
||||
}
|
||||
let context: common.UIAbilityContext = GlobalContext.load('context') as common.UIAbilityContext;
|
||||
GlobalContext.store('alertContext', context);
|
||||
(GlobalContext.load('windowStage') as window.WindowStage).loadContent('pages/alert', (err: BusinessError) => {
|
||||
windowStage.loadContent('pages/alert', (err: BusinessError) => {
|
||||
if (err.code !== 0) {
|
||||
HiLog.error(TAG, `loadContent failed: ${JSON.stringify(err)}`);
|
||||
}
|
||||
@ -296,17 +293,22 @@ function getAppId(bundleName: string) {
|
||||
}
|
||||
|
||||
function getTime() {
|
||||
let permanent: boolean = GlobalContext.load('permanent');
|
||||
let permanent: boolean | undefined = AppStorage.get('permanent');
|
||||
if (permanent) {
|
||||
return $r('app.string.permanently');
|
||||
}
|
||||
let date: Date = GlobalContext.load('validity');
|
||||
let year = date.getFullYear();
|
||||
let month = date.getMonth() + 1;
|
||||
let day = date.getDate();
|
||||
let hour = date.getHours();
|
||||
let minute = date.getMinutes();
|
||||
return `${year}/${month}/${day} ${hour}:${minute}`;
|
||||
let dateTime: number | undefined = AppStorage.get('validity');
|
||||
if (dateTime !== undefined) {
|
||||
let date = new Date(dateTime);
|
||||
let year = date.getFullYear();
|
||||
let month = date.getMonth() + 1;
|
||||
let day = date.getDate();
|
||||
let hour = date.getHours();
|
||||
let minute = date.getMinutes();
|
||||
return `${year}/${month}/${day} ${hour}:${minute}`;
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
async function getFileSizeByUri(uri: string): Promise<number> {
|
||||
|
@ -209,7 +209,7 @@ struct Index {
|
||||
});
|
||||
} else {
|
||||
abilityResult.resultCode = 0;
|
||||
(GlobalContext.load('alertContext') as common.UIAbilityContext).terminateSelfWithResult(abilityResult);
|
||||
(getContext(this) as common.UIAbilityContext).terminateSelfWithResult(abilityResult);
|
||||
}
|
||||
})
|
||||
.margin({ right: Constants.ENCRYPTION_PROTECTION_BUTTON_MARGIN })
|
||||
@ -221,14 +221,14 @@ struct Index {
|
||||
.height(Constants.FOOTER_BUTTON_HEIGHT)
|
||||
.onClick(async (event) => {
|
||||
let error = (GlobalContext.load('abilityWant') as Want).parameters?.error as BusinessError;
|
||||
if (error.code === Constants.ERR_JS_OFFLINE) {
|
||||
if (error && error.code === Constants.ERR_JS_OFFLINE) {
|
||||
let want: Want = {
|
||||
action: 'action.system.home',
|
||||
entities: ['entity.system.home'],
|
||||
uri: 'wifi_entry'
|
||||
};
|
||||
(GlobalContext.load('alertContext') as common.UIAbilityContext).startAbility(want);
|
||||
(GlobalContext.load('alertContext') as common.UIAbilityContext).terminateSelf();
|
||||
(getContext(this) as common.UIAbilityContext).startAbility(want);
|
||||
(getContext(this) as common.UIAbilityContext).terminateSelf();
|
||||
return;
|
||||
}
|
||||
this.authWithPop();
|
||||
|
@ -39,7 +39,6 @@ import {
|
||||
import { DlpAlertDialog } from '../common/components/dlp_alert_dialog';
|
||||
import GlobalContext from '../common/GlobalContext';
|
||||
import HomeFeature from '../feature/HomeFeature';
|
||||
import emitter from '@ohos.events.emitter';
|
||||
import { AccountTipsConfig } from '../common/AccountTipsConfig';
|
||||
import { EncryptingPanel } from '../common/encryptionComponents/encrypting';
|
||||
import { GetAlertMessage } from '../common/GetAlertMessage';
|
||||
@ -322,14 +321,13 @@ struct changeEncryption {
|
||||
.delete(GlobalContext.load('uri') as string)
|
||||
}
|
||||
abilityResult.resultCode = 0;
|
||||
(GlobalContext.load('context') as common.UIAbilityContext).terminateSelfWithResult(abilityResult);
|
||||
(getContext(this) as common.UIAbilityContext).terminateSelfWithResult(abilityResult);
|
||||
}
|
||||
}
|
||||
|
||||
async showData(defaultDlpProperty: dlpPermission.DLPProperty) {
|
||||
this.permissionDict.forEach(async (item, index) => {
|
||||
this.permissionDict[index].value = $r((GlobalContext
|
||||
.load('context') as common.UIAbilityContext).resourceManager.getStringSync(item.value!.id))
|
||||
this.permissionDict[index].value = $r(getContext(this).resourceManager.getStringSync(item.value!.id))
|
||||
});
|
||||
let readOnlyData = (defaultDlpProperty.authUserList?.filter((item: dlpPermission.AuthUser) => {
|
||||
return item.dlpFileAccess === 1;
|
||||
@ -411,7 +409,7 @@ struct changeEncryption {
|
||||
}
|
||||
} catch (err) {
|
||||
let session: UIExtensionContentSession = GlobalContext.load('session') as UIExtensionContentSession;
|
||||
await GetAlertMessage.startAlertAbility(GlobalContext.load('context') as common.UIExtensionContext,
|
||||
await GetAlertMessage.startAlertAbility(getContext(this) as common.UIExtensionContext,
|
||||
err as BusinessError, session);
|
||||
return Promise.reject();
|
||||
}
|
||||
@ -428,7 +426,7 @@ struct changeEncryption {
|
||||
let errorInfo = GetAlertMessage.getAlertMessage({ code: Constants.ERR_JS_GET_ACCOUNT_ERROR } as BusinessError);
|
||||
this.showErrorDialog(errorInfo.title, errorInfo.msg);
|
||||
} else {
|
||||
await GetAlertMessage.startAlertAbility(GlobalContext.load('context') as common.UIAbilityContext,
|
||||
await GetAlertMessage.startAlertAbility(getContext(this) as common.UIExtensionContext,
|
||||
{ code: Constants.ERR_JS_GET_ACCOUNT_ERROR } as BusinessError);
|
||||
}
|
||||
return;
|
||||
@ -440,7 +438,7 @@ struct changeEncryption {
|
||||
{ code: Constants.ERR_JS_APP_NO_ACCOUNT_ERROR } as BusinessError);
|
||||
this.showErrorDialog(errorInfo.title, errorInfo.msg);
|
||||
} else {
|
||||
await GetAlertMessage.startAlertAbility(GlobalContext.load('context') as common.UIAbilityContext,
|
||||
await GetAlertMessage.startAlertAbility(getContext(this) as common.UIExtensionContext,
|
||||
{ code: Constants.ERR_JS_APP_NO_ACCOUNT_ERROR } as BusinessError);
|
||||
}
|
||||
return;
|
||||
@ -458,8 +456,7 @@ struct changeEncryption {
|
||||
this.prepareData = false;
|
||||
}, Constants.ENCRYPTION_SET_TIMEOUT_TIME)
|
||||
|
||||
this.directionStatus = (GlobalContext
|
||||
.load('context') as common.UIAbilityContext).config.direction ?? -1;
|
||||
this.directionStatus = (getContext(this) as common.UIExtensionContext).config.direction ?? -1;
|
||||
directionStatus((counter) => {
|
||||
this.directionStatus = counter;
|
||||
})
|
||||
|
@ -51,7 +51,6 @@ import GlobalContext from '../common/GlobalContext';
|
||||
import IDLDLPProperty from '../serviceExtensionAbility/sequenceable/dlpClass';
|
||||
import { IAuthUser } from '../serviceExtensionAbility/sequenceable/dlpClass';
|
||||
import HomeFeature from '../feature/HomeFeature';
|
||||
import emitter from '@ohos.events.emitter';
|
||||
import { GetAlertMessage } from '../common/GetAlertMessage';
|
||||
import { HiLog } from '../common/HiLog';
|
||||
import FileUtils, { FileMsg } from '../common/FileUtils';
|
||||
@ -100,8 +99,8 @@ struct DlpDialog {
|
||||
@State handlePopupEdit: boolean = false;
|
||||
@State processing: boolean = false;
|
||||
@State prepareData: boolean = false;
|
||||
@State validity: Date = GlobalContext.load('validity') || new Date();
|
||||
@State selectedIndex: number = GlobalContext.load('permanent') === false ? 1 : 0;
|
||||
@State validity: Date = AppStorage.get('validity') || new Date();
|
||||
@State selectedIndex: number = AppStorage.get('permanent') === false ? 1 : 0;
|
||||
@State domainOrCloudAccount: number = domainAccount ?
|
||||
dlpPermission.AccountType.DOMAIN_ACCOUNT : dlpPermission.AccountType.CLOUD_ACCOUNT
|
||||
@State permissionDict: PermissionType[] = [
|
||||
@ -263,7 +262,7 @@ struct DlpDialog {
|
||||
return;
|
||||
}
|
||||
}
|
||||
let filePath = (GlobalContext.load('context') as common.UIAbilityContext).filesDir + '/' + (new Date().getTime());
|
||||
let filePath = getContext(this).filesDir + '/' + (new Date().getTime());
|
||||
let file: fs.File;
|
||||
try {
|
||||
file = fs.openSync(filePath, fs.OpenMode.CREATE | fs.OpenMode.READ_WRITE);
|
||||
@ -459,7 +458,7 @@ struct DlpDialog {
|
||||
property.authUserList = [];
|
||||
property.everyoneAccessList = [];
|
||||
property.offlineAccess = this.selectedIndex === 0 ? true : false;
|
||||
property.expireTime = this.selectedIndex === 0 ? 0 : this.reconfigurationTime(this.validity).getTime();
|
||||
property.expireTime = this.selectedIndex === 0 ? 0 : this.reconfigurationTime(new Date(this.validity)).getTime();
|
||||
if (this.selectedPermissionTypeEdit.data === 'all') {
|
||||
property.everyoneAccessList = [dlpPermission.DLPFileAccess.CONTENT_EDIT];
|
||||
this.staffDataArrayReadOnly = [];
|
||||
@ -546,7 +545,7 @@ struct DlpDialog {
|
||||
let routerParams: Record<string, AuthAccount[]> = router.getParams() as Record<string, AuthAccount[]>;
|
||||
this.permissionDict.forEach(async (item, index) => {
|
||||
this.permissionDict[index].value =
|
||||
$r(await (GlobalContext.load('context') as common.UIAbilityContext).resourceManager.getStringValue(item.value.id))
|
||||
$r(await getContext(this).resourceManager.getStringValue(item.value.id))
|
||||
})
|
||||
let readOnlyData: dlpPermission.AuthUser[] =
|
||||
defaultDlpProperty.authUserList?.filter((item: dlpPermission.AuthUser) => {
|
||||
@ -587,7 +586,7 @@ struct DlpDialog {
|
||||
let errorInfo = GetAlertMessage.getAlertMessage({ code: Constants.ERR_JS_GET_ACCOUNT_ERROR } as BusinessError);
|
||||
this.showErrorDialog(errorInfo.title, errorInfo.msg);
|
||||
} else {
|
||||
await GetAlertMessage.startAlertAbility(GlobalContext.load('context') as common.UIAbilityContext,
|
||||
await GetAlertMessage.startAlertAbility(getContext(this) as common.UIAbilityContext,
|
||||
{ code: Constants.ERR_JS_GET_ACCOUNT_ERROR } as BusinessError);
|
||||
}
|
||||
return;
|
||||
@ -599,7 +598,7 @@ struct DlpDialog {
|
||||
{ code: Constants.ERR_JS_APP_NO_ACCOUNT_ERROR } as BusinessError);
|
||||
this.showErrorDialog(errorInfo.title, errorInfo.msg);
|
||||
} else {
|
||||
await GetAlertMessage.startAlertAbility(GlobalContext.load('context') as common.UIAbilityContext,
|
||||
await GetAlertMessage.startAlertAbility(getContext(this) as common.UIAbilityContext,
|
||||
{ code: Constants.ERR_JS_APP_NO_ACCOUNT_ERROR } as BusinessError);
|
||||
}
|
||||
return;
|
||||
@ -655,7 +654,7 @@ struct DlpDialog {
|
||||
this.prepareData = false;
|
||||
}, Constants.ENCRYPTION_SET_TIMEOUT_TIME)
|
||||
|
||||
this.directionStatus = (GlobalContext.load('context') as common.UIAbilityContext).config.direction ?? -1;
|
||||
this.directionStatus = (getContext(this) as common.UIAbilityContext).config.direction ?? -1;
|
||||
directionStatus((counter) => {
|
||||
this.directionStatus = counter;
|
||||
})
|
||||
@ -800,7 +799,7 @@ struct DlpDialog {
|
||||
.fontSize($r('sys.float.ohos_id_text_size_body1'))
|
||||
Blank()
|
||||
if (this.selectedIndex === 1) {
|
||||
CalendarPicker({ selected: this.validity })
|
||||
CalendarPicker({ selected: new Date(this.validity) })
|
||||
.onChange((value) => {
|
||||
this.validity = value;
|
||||
})
|
||||
@ -838,7 +837,7 @@ struct DlpDialog {
|
||||
Button($r('app.string.ban'), { type: ButtonType.Capsule, stateEffect: true })
|
||||
.backgroundColor($r('sys.color.ohos_id_color_button_normal'))
|
||||
.width(Constants.HEADER_TEXT_WIDTH)
|
||||
.focusable(false)
|
||||
.focusable(true)
|
||||
.fontColor($r('sys.color.ohos_id_color_text_primary_activated'))
|
||||
.height(Constants.FOOTER_HEIGHT)
|
||||
.onClick(async (event) => {
|
||||
@ -861,7 +860,7 @@ struct DlpDialog {
|
||||
(GlobalContext.load('fileOpenHistoryFromMain') as Map<string, Object>).delete(GlobalContext.load('uri') as string)
|
||||
}
|
||||
abilityResult.resultCode = 0;
|
||||
(GlobalContext.load('context') as common.UIAbilityContext).terminateSelfWithResult(abilityResult);
|
||||
(getContext(this) as common.UIAbilityContext).terminateSelfWithResult(abilityResult);
|
||||
}
|
||||
})
|
||||
.margin({ right: Constants.ENCRYPTION_PROTECTION_BUTTON_MARGIN })
|
||||
@ -870,7 +869,7 @@ struct DlpDialog {
|
||||
})
|
||||
.backgroundColor($r('sys.color.ohos_id_color_button_normal'))
|
||||
.width(Constants.HEADER_TEXT_WIDTH)
|
||||
.focusable(false)
|
||||
.focusable(true)
|
||||
.fontColor($r('sys.color.ohos_id_color_text_primary_activated'))
|
||||
.enabled(
|
||||
this.isAccountCheckSuccess &&
|
||||
@ -884,15 +883,15 @@ struct DlpDialog {
|
||||
AppStorage.setOrCreate('hiValidDate', false);
|
||||
if (this.selectedIndex === 1) {
|
||||
let currentTime = new Date().getTime();
|
||||
let validity = this.reconfigurationTime(this.validity).getTime();
|
||||
let validity = this.reconfigurationTime(new Date(this.validity)).getTime();
|
||||
if (currentTime >= validity) {
|
||||
this.showErrorDialogNoTitle($r('app.string.Timeout_is_not_supported'));
|
||||
return;
|
||||
}
|
||||
GlobalContext.store('validity', this.reconfigurationTime(this.validity));
|
||||
AppStorage.setOrCreate('validity', this.reconfigurationTime(new Date(this.validity)));
|
||||
AppStorage.setOrCreate('hiValidDate', true);
|
||||
}
|
||||
GlobalContext.store('permanent', this.selectedIndex ? false : true);
|
||||
AppStorage.setOrCreate('permanent', this.selectedIndex ? false : true);
|
||||
AppStorage.setOrCreate('hiAdvancedSettings', false);
|
||||
AppStorage.setOrCreate('hiStorePath', false);
|
||||
if (this.isDlpFile) {
|
||||
|
@ -29,9 +29,7 @@ import {
|
||||
isPC
|
||||
} from '../common/utils';
|
||||
import GlobalContext from '../common/GlobalContext';
|
||||
import { BusinessError } from '@ohos.base';
|
||||
import HomeFeature from '../feature/HomeFeature';
|
||||
import emitter from '@ohos.events.emitter';
|
||||
import { HiLog } from '../common/HiLog';
|
||||
|
||||
const TAG = 'EncSucc';
|
||||
@ -111,7 +109,7 @@ struct encryptionSuccess {
|
||||
|
||||
aboutToAppear() {
|
||||
HiLog.info(TAG, `aboutToAppear, encrypt success`);
|
||||
this.directionStatus = (GlobalContext.load('context') as common.UIAbilityContext).config.direction ?? -1;
|
||||
this.directionStatus = (getContext(this) as common.UIAbilityContext).config.direction ?? -1;
|
||||
directionStatus((counter) => {
|
||||
this.directionStatus = counter;
|
||||
})
|
||||
@ -573,7 +571,6 @@ struct encryptionSuccess {
|
||||
.margin({ bottom: Constants.ENCRYPTION_CHANGE_VALID_UNTIL_MARGIN_BOTTOM })
|
||||
}
|
||||
}
|
||||
.clip(true)
|
||||
}
|
||||
}.constraintSize({
|
||||
maxHeight: this.directionStatus ===
|
||||
@ -620,7 +617,7 @@ struct encryptionSuccess {
|
||||
(GlobalContext.load('fileOpenHistoryFromMain') as Map<string, Object>).delete(GlobalContext.load('uri') as string)
|
||||
}
|
||||
abilityResult.resultCode = 0;
|
||||
(GlobalContext.load('context') as common.UIAbilityContext).terminateSelfWithResult(abilityResult);
|
||||
(getContext(this) as common.UIAbilityContext).terminateSelfWithResult(abilityResult);
|
||||
}
|
||||
})
|
||||
}
|
||||
|
@ -19,7 +19,6 @@ import Constants from '../common/constant';
|
||||
import GlobalContext from '../common/GlobalContext';
|
||||
import { directionStatus, isPC } from '../common/utils';
|
||||
import common from '@ohos.app.ability.common';
|
||||
import emitter from '@ohos.events.emitter';
|
||||
import { HiLog } from '../common/HiLog';
|
||||
|
||||
const TAG = 'PermStat';
|
||||
@ -150,8 +149,7 @@ struct PermissionStatus {
|
||||
this.authPerm = AppStorage.get('authPerm') ?? 1;
|
||||
this.accountId = AppStorage.get('contactAccount') ?? '';
|
||||
this.validity = AppStorage.get('validity') ?? 0;
|
||||
this.directionStatus = (GlobalContext
|
||||
.load('context') as common.UIAbilityContext).config.direction ?? -1;
|
||||
this.directionStatus = (getContext(this) as common.UIAbilityContext).config.direction ?? -1;
|
||||
directionStatus((counter) => {
|
||||
this.directionStatus = counter;
|
||||
})
|
||||
@ -323,7 +321,7 @@ struct PermissionStatus {
|
||||
(GlobalContext.load('fileOpenHistoryFromMain') as Map<string, Object>).delete(GlobalContext.load('uri') as string)
|
||||
}
|
||||
abilityResult.resultCode = 0;
|
||||
(GlobalContext.load('context') as common.UIAbilityContext).terminateSelfWithResult(abilityResult);
|
||||
(getContext(this) as common.UIAbilityContext).terminateSelfWithResult(abilityResult);
|
||||
}
|
||||
})
|
||||
}
|
||||
|
@ -94,7 +94,7 @@ class DlpRpcServiceStub extends IdlDlpRpcServiceStub {
|
||||
let dlpFile = await dlpPermission.generateDLPFile(result.inFileFd, result.outFileFd, dlpP);
|
||||
if (!this.dlpFileMap.has(outputUri)) {
|
||||
this.dlpFileMap.set(outputUri, dlpFile);
|
||||
GlobalContext.store('dlpFileMap', this.dlpFileMap);
|
||||
AppStorage.setOrCreate('dlpFileMap', this.dlpFileMap);
|
||||
} else {
|
||||
HiLog.info(TAG, `map is overwrite: ${outputUri}`);
|
||||
let rawDlpFile = this.dlpFileMap.get(outputUri) ?? null;
|
||||
@ -108,7 +108,7 @@ class DlpRpcServiceStub extends IdlDlpRpcServiceStub {
|
||||
}
|
||||
this.dlpFileMap.delete(outputUri);
|
||||
this.dlpFileMap.set(outputUri, dlpFile);
|
||||
GlobalContext.store('dlpFileMap', this.dlpFileMap);
|
||||
AppStorage.setOrCreate('dlpFileMap', this.dlpFileMap);
|
||||
}
|
||||
callback(0);
|
||||
} catch (err) {
|
||||
@ -189,12 +189,12 @@ class DlpRpcServiceStub extends IdlDlpRpcServiceStub {
|
||||
callback(0, _dlp, '');
|
||||
if (!this.dlpFileMap.has(srcUri)) {
|
||||
this.dlpFileMap.set(srcUri, dlpFile);
|
||||
GlobalContext.store('dlpFileMap', this.dlpFileMap);
|
||||
AppStorage.setOrCreate('dlpFileMap', this.dlpFileMap);
|
||||
} else {
|
||||
HiLog.info(TAG, `map is overwrite`);
|
||||
this.dlpFileMap.delete(srcUri);
|
||||
this.dlpFileMap.set(srcUri, dlpFile);
|
||||
GlobalContext.store('dlpFileMap', this.dlpFileMap);
|
||||
AppStorage.setOrCreate('dlpFileMap', this.dlpFileMap);
|
||||
}
|
||||
} catch (err) {
|
||||
let _dlp = new IDLDLPProperty('', '', 0, [], '', true, [], 0);
|
||||
@ -267,7 +267,7 @@ class DlpRpcServiceStub extends IdlDlpRpcServiceStub {
|
||||
await dlpFile.closeDLPFile();
|
||||
if (this.dlpFileMap.has(srcUri)) {
|
||||
this.dlpFileMap.delete(srcUri);
|
||||
GlobalContext.store('dlpFileMap', this.dlpFileMap);
|
||||
AppStorage.setOrCreate('dlpFileMap', this.dlpFileMap);
|
||||
}
|
||||
callback(0);
|
||||
} catch (err) {
|
||||
|
@ -19,6 +19,18 @@
|
||||
}
|
||||
],
|
||||
"abilities": [
|
||||
{
|
||||
"name": "MainAbility",
|
||||
"srcEntry": "./ets/MainAbility/MainAbility.ets",
|
||||
"description": "$string:MainAbility_desc",
|
||||
"icon": "$media:app_icon",
|
||||
"label": "$string:MainAbility_label",
|
||||
"startWindowIcon": "$media:app_icon",
|
||||
"startWindowBackground": "$color:white",
|
||||
"orientation": "auto_rotation_restricted",
|
||||
"exported": true,
|
||||
"removeMissionAfterTerminate": true
|
||||
},
|
||||
{
|
||||
"name": "AlertAbility",
|
||||
"srcEntry": "./ets/AlertAbility/AlertAbility.ets",
|
||||
@ -37,18 +49,6 @@
|
||||
"label": "$string:MainAbility_label",
|
||||
"startWindowIcon": "$media:icon",
|
||||
"startWindowBackground": "$color:white"
|
||||
},
|
||||
{
|
||||
"name": "MainAbility",
|
||||
"srcEntry": "./ets/MainAbility/MainAbility.ets",
|
||||
"description": "$string:MainAbility_desc",
|
||||
"icon": "$media:app_icon",
|
||||
"label": "$string:MainAbility_label",
|
||||
"startWindowIcon": "$media:app_icon",
|
||||
"startWindowBackground": "$color:white",
|
||||
"orientation": "auto_rotation_restricted",
|
||||
"exported": true,
|
||||
"removeMissionAfterTerminate": true
|
||||
}
|
||||
],
|
||||
"extensionAbilities": [
|
||||
@ -97,14 +97,11 @@
|
||||
{
|
||||
"name": "ohos.permission.MANAGE_LOCAL_ACCOUNTS"
|
||||
},
|
||||
{
|
||||
"name": "ohos.permission.FILE_ACCESS_MANAGER"
|
||||
},
|
||||
{
|
||||
"name": "ohos.permission.START_ABILITIES_FROM_BACKGROUND"
|
||||
},
|
||||
{
|
||||
"name": "ohos.permission.GET_BUNDLE_INFO_PRIVILEGED"
|
||||
"name": "ohos.permission.GET_BUNDLE_INFO"
|
||||
},
|
||||
{
|
||||
"name": "ohos.permission.GET_DOMAIN_ACCOUNTS"
|
||||
|
@ -20,8 +20,7 @@
|
||||
"description": "$string:entry_desc",
|
||||
"deviceTypes": [
|
||||
"default",
|
||||
"tablet",
|
||||
"2in1"
|
||||
"tablet"
|
||||
],
|
||||
"deliveryWithInstall": true,
|
||||
"installationFree": false,
|
||||
@ -33,6 +32,18 @@
|
||||
}
|
||||
],
|
||||
"abilities": [
|
||||
{
|
||||
"name": "MainAbility",
|
||||
"srcEntry": "./ets/MainAbility/MainAbility.ets",
|
||||
"description": "$string:MainAbility_desc",
|
||||
"icon": "$media:app_icon",
|
||||
"label": "$string:MainAbility_label",
|
||||
"startWindowIcon": "$media:app_icon",
|
||||
"startWindowBackground": "$color:white",
|
||||
"orientation": "auto_rotation_restricted",
|
||||
"exported": true,
|
||||
"removeMissionAfterTerminate": true
|
||||
},
|
||||
{
|
||||
"name": "AlertAbility",
|
||||
"srcEntry": "./ets/AlertAbility/AlertAbility.ets",
|
||||
@ -51,18 +62,6 @@
|
||||
"label": "$string:MainAbility_label",
|
||||
"startWindowIcon": "$media:icon",
|
||||
"startWindowBackground": "$color:white"
|
||||
},
|
||||
{
|
||||
"name": "MainAbility",
|
||||
"srcEntry": "./ets/MainAbility/MainAbility.ets",
|
||||
"description": "$string:MainAbility_desc",
|
||||
"icon": "$media:app_icon",
|
||||
"label": "$string:MainAbility_label",
|
||||
"startWindowIcon": "$media:app_icon",
|
||||
"startWindowBackground": "$color:white",
|
||||
"orientation": "auto_rotation_restricted",
|
||||
"exported": true,
|
||||
"removeMissionAfterTerminate": true
|
||||
}
|
||||
],
|
||||
"extensionAbilities": [
|
||||
@ -111,14 +110,11 @@
|
||||
{
|
||||
"name": "ohos.permission.MANAGE_LOCAL_ACCOUNTS"
|
||||
},
|
||||
{
|
||||
"name": "ohos.permission.FILE_ACCESS_MANAGER"
|
||||
},
|
||||
{
|
||||
"name": "ohos.permission.START_ABILITIES_FROM_BACKGROUND"
|
||||
},
|
||||
{
|
||||
"name": "ohos.permission.GET_BUNDLE_INFO_PRIVILEGED"
|
||||
"name": "ohos.permission.GET_BUNDLE_INFO"
|
||||
},
|
||||
{
|
||||
"name": "ohos.permission.GET_DOMAIN_ACCOUNTS"
|
||||
|
@ -4,10 +4,6 @@
|
||||
"name":"save",
|
||||
"value":"ཉར་ཚགས།"
|
||||
},
|
||||
{
|
||||
"name":"export",
|
||||
"value":"ཕྱིར་འདྲེན།"
|
||||
},
|
||||
{
|
||||
"name":"MESSAGE_NOT_AUTHORIZED_APPLICATION",
|
||||
"value":"ཉེར་སྤྱོད་དེས་ཡིག་ཆ་འདི་ཁ་འབྱེད་མི་ཐུབ།"
|
||||
|
@ -4,10 +4,6 @@
|
||||
"name":"save",
|
||||
"value":"ساقلاش"
|
||||
},
|
||||
{
|
||||
"name":"export",
|
||||
"value":"چىقىرىش"
|
||||
},
|
||||
{
|
||||
"name":"MESSAGE_NOT_AUTHORIZED_APPLICATION",
|
||||
"value":"بۇ ئەپ بۇ ھۆججەتنى ئاچالمايدۇ."
|
||||
|
@ -4,10 +4,6 @@
|
||||
"name":"save",
|
||||
"value":"儲存"
|
||||
},
|
||||
{
|
||||
"name":"export",
|
||||
"value":"匯出"
|
||||
},
|
||||
{
|
||||
"name":"MESSAGE_NOT_AUTHORIZED_APPLICATION",
|
||||
"value":"此應用程式無法開啟此檔案。"
|
||||
|
@ -4,10 +4,6 @@
|
||||
"name":"save",
|
||||
"value":"儲存"
|
||||
},
|
||||
{
|
||||
"name":"export",
|
||||
"value":"匯出"
|
||||
},
|
||||
{
|
||||
"name":"MESSAGE_NOT_AUTHORIZED_APPLICATION",
|
||||
"value":"該應用程式無法開啟此檔案。"
|
||||
|
Loading…
x
Reference in New Issue
Block a user