mirror of
https://gitee.com/openharmony/applications_dlp_manager
synced 2024-11-24 02:19:49 +00:00
2c分享加密
Signed-off-by: li-li-wang <wangliliang5@huawei.com>
This commit is contained in:
parent
646b32a456
commit
b97e0dd832
@ -0,0 +1,79 @@
|
||||
/*
|
||||
* 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 ActionExtensionAbility from '@ohos.app.ability.ActionExtensionAbility';
|
||||
import UIExtensionContentSession from '@ohos.app.ability.UIExtensionContentSession';
|
||||
import Want from '@ohos.app.ability.Want';
|
||||
import { HiLog } from '../common/HiLog';
|
||||
import { getDLPInfo, DLPInfo, sendDlpManager2CAccountLogin } from '../common/utils';
|
||||
|
||||
const TAG = 'share';
|
||||
const BG_COLOR = '#00000000';
|
||||
|
||||
export default class EncryptedSharingAbility extends ActionExtensionAbility {
|
||||
|
||||
onForeground(): void {
|
||||
HiLog.info(TAG, `EncryptedSharingAbility onForeground.`);
|
||||
}
|
||||
|
||||
onBackground(): void {
|
||||
HiLog.info(TAG, `EncryptedSharingAbility onBackground.`);
|
||||
}
|
||||
|
||||
checkValidSharedRecords(want: Want): Promise<void> {
|
||||
return new Promise((resolve, reject) => {
|
||||
let parameters = want.parameters as Record<string, Object>;
|
||||
let callerToken = parameters['ohos.aafwk.param.callerToken'] as number;
|
||||
let callerBundleName: string = parameters['ohos.aafwk.param.callerBundleName'] as string;
|
||||
if (callerToken === undefined || callerBundleName === undefined) {
|
||||
HiLog.error(TAG, `need caller info in want.parameters`);
|
||||
reject(); return;
|
||||
}
|
||||
AppStorage.setOrCreate('hiPkgName', callerBundleName);
|
||||
resolve(); return;
|
||||
})
|
||||
}
|
||||
|
||||
async onSessionCreate(want: Want, session: UIExtensionContentSession): Promise<void> {
|
||||
HiLog.info(TAG, `EncryptedSharingAbility onSessionCreate. want: ${JSON.stringify(want)}`);
|
||||
try {
|
||||
await this.checkValidSharedRecords(want);
|
||||
} catch {
|
||||
return;
|
||||
}
|
||||
let dlpInfo: DLPInfo = await getDLPInfo();
|
||||
AppStorage.setOrCreate('hiPNameId', dlpInfo.name);
|
||||
AppStorage.setOrCreate('hiPVersionId', dlpInfo.versionCode);
|
||||
sendDlpManager2CAccountLogin(0);
|
||||
let storage: LocalStorage = new LocalStorage({
|
||||
'session': session,
|
||||
'actionWant': want
|
||||
} as Record<string, UIExtensionContentSession | Want>);
|
||||
try {
|
||||
session.loadContent('pages/encryptedSharing', storage);
|
||||
session.setWindowBackgroundColor(BG_COLOR);
|
||||
} catch (exception) {
|
||||
HiLog.error(TAG, `Failed to set the background color. Cause: ${JSON.stringify(exception)}`);
|
||||
}
|
||||
}
|
||||
|
||||
onSessionDestroy(): void {
|
||||
HiLog.info(TAG, `EncryptedSharingAbility onSessionDestroy.`);
|
||||
}
|
||||
|
||||
onDestroy(): void {
|
||||
HiLog.info(TAG, `EncryptedSharingAbility onDestroy.`);
|
||||
}
|
||||
};
|
@ -26,7 +26,6 @@ import {
|
||||
getOsAccountInfo,
|
||||
judgeIsSandBox,
|
||||
getFileFd,
|
||||
isPC,
|
||||
getAppId,
|
||||
getDLPInfo,
|
||||
sendDlpManagerAccountLogin,
|
||||
@ -53,14 +52,12 @@ export default class MainAbility extends UIAbility {
|
||||
private authPerm: dlpPermission.DLPFileAccess = dlpPermission.DLPFileAccess.READ_ONLY;
|
||||
private callerToken:number = 0;
|
||||
private homeFeature!: HomeFeature;
|
||||
private domainAccount: boolean = !isPC() ? false : true;
|
||||
|
||||
async onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): Promise<void> {
|
||||
GlobalContext.store('abilityWant', want);
|
||||
if (!GlobalContext.load('fileOpenHistoryFromMain')) {
|
||||
GlobalContext.store('fileOpenHistoryFromMain', new Map<string, string>());
|
||||
}
|
||||
GlobalContext.store('context', this.context);
|
||||
GlobalContext.store('uri', want.uri ?? '');
|
||||
direction = this.context.config.direction ?? -1;
|
||||
if (!GlobalContext.load('linkSet')) {
|
||||
@ -99,8 +96,7 @@ export default class MainAbility extends UIAbility {
|
||||
|
||||
async gotoPage(windowStage: window.WindowStage): Promise<void> {
|
||||
let accountInfo: osAccount.OsAccountInfo = GlobalContext.load('accountInfo');
|
||||
let accountName: string = this.domainAccount ?
|
||||
accountInfo.domainInfo.accountName : accountInfo.distributedInfo.name;
|
||||
let accountName: string = accountInfo.domainInfo.accountName;
|
||||
this.authPerm = getAuthPerm(accountName, GlobalContext.load('dlpProperty'));
|
||||
|
||||
AppStorage.setOrCreate('authPerm', this.authPerm);
|
||||
@ -112,12 +108,10 @@ export default class MainAbility extends UIAbility {
|
||||
return;
|
||||
}
|
||||
if (this.authPerm === dlpPermission.DLPFileAccess.FULL_CONTROL) {
|
||||
if (this.domainAccount) {
|
||||
try {
|
||||
await this.checkValidEnterpriseAndAccount(windowStage);
|
||||
} catch {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
await this.checkValidEnterpriseAndAccount(windowStage);
|
||||
} catch {
|
||||
return;
|
||||
}
|
||||
|
||||
windowStage.loadContent('pages/changeEncryption', (err: BusinessError) =>{
|
||||
@ -193,7 +187,7 @@ export default class MainAbility extends UIAbility {
|
||||
async checkValidWantAndAccount(want: Want): Promise<void> {
|
||||
return new Promise(async (resolve, reject) => {
|
||||
if (!this.checkValidWant(want)) {
|
||||
await GetAlertMessage.startAlertAbility(GlobalContext.load('context') as common.UIAbilityContext,
|
||||
await GetAlertMessage.startAlertAbility(this.context,
|
||||
{ code: Constants.ERR_JS_APP_PARAM_ERROR } as BusinessError);
|
||||
reject();
|
||||
return;
|
||||
@ -206,14 +200,14 @@ export default class MainAbility extends UIAbility {
|
||||
resolve();
|
||||
} catch (err) {
|
||||
HiLog.error(TAG, `getOsAccountInfo failed: ${JSON.stringify(err)}`);
|
||||
await GetAlertMessage.startAlertAbility(GlobalContext.load('context') as common.UIAbilityContext,
|
||||
await GetAlertMessage.startAlertAbility(this.context,
|
||||
{ code: Constants.ERR_JS_GET_ACCOUNT_ERROR } as BusinessError);
|
||||
reject();
|
||||
return;
|
||||
}
|
||||
let codeMessage = checkDomainAccountInfo(accountInfo);
|
||||
if (codeMessage) {
|
||||
await GetAlertMessage.startAlertAbility(GlobalContext.load('context') as common.UIAbilityContext,
|
||||
await GetAlertMessage.startAlertAbility(this.context,
|
||||
{ code: codeMessage } as BusinessError);
|
||||
reject();
|
||||
return;
|
||||
|
@ -29,11 +29,11 @@ import {
|
||||
judgeIsSandBox,
|
||||
getFileFd,
|
||||
getAppId,
|
||||
isPC,
|
||||
DLPInfo,
|
||||
getDLPInfo,
|
||||
sendDlpManagerAccountLogin,
|
||||
isValidPath
|
||||
isValidPath,
|
||||
getAccountType
|
||||
} from '../common/utils';
|
||||
import GlobalContext from '../common/GlobalContext';
|
||||
import HomeFeature from '../feature/HomeFeature';
|
||||
@ -51,7 +51,6 @@ export default class MainAbility extends UIExtensionAbility {
|
||||
private authPerm: dlpPermission.DLPFileAccess = dlpPermission.DLPFileAccess.READ_ONLY;
|
||||
private callerToken: number = 0;
|
||||
private homeFeature!: HomeFeature;
|
||||
private domainAccount: boolean = !isPC() ? false : true;
|
||||
|
||||
async onSessionCreate(want: Want, session: UIExtensionContentSession): Promise<void> {
|
||||
HiLog.info(TAG, `want: ${JSON.stringify(want)}`);
|
||||
@ -67,7 +66,6 @@ export default class MainAbility extends UIExtensionAbility {
|
||||
AppStorage.setOrCreate('hiPNameId', dlpInfo.name);
|
||||
AppStorage.setOrCreate('hiPVersionId', dlpInfo.versionCode);
|
||||
GlobalContext.store('abilityWant', want);
|
||||
GlobalContext.store('context', this.context);
|
||||
GlobalContext.store('uri', want.uri ?? '');
|
||||
direction = this.context.config.direction ?? -1;
|
||||
|
||||
@ -111,8 +109,7 @@ export default class MainAbility extends UIExtensionAbility {
|
||||
|
||||
async gotoPage(session: UIExtensionContentSession): Promise<void> {
|
||||
let accountInfo: osAccount.OsAccountInfo = GlobalContext.load('accountInfo');
|
||||
let accountName: string = this.domainAccount ?
|
||||
accountInfo.domainInfo.accountName : accountInfo.distributedInfo.name;
|
||||
let accountName: string = accountInfo.domainInfo.accountName;
|
||||
this.authPerm = getAuthPerm(accountName, GlobalContext.load('dlpProperty'));
|
||||
|
||||
AppStorage.setOrCreate('authPerm', this.authPerm);
|
||||
@ -120,17 +117,15 @@ 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(GlobalContext.load('context') as common.UIExtensionContext,
|
||||
await GetAlertMessage.startAlertAbility(this.context,
|
||||
{ code: Constants.ERR_JS_APP_INSIDE_ERROR } as BusinessError, session);
|
||||
return;
|
||||
}
|
||||
if (this.authPerm === dlpPermission.DLPFileAccess.FULL_CONTROL) {
|
||||
if (this.domainAccount) {
|
||||
try {
|
||||
await this.checkValidEnterpriseAndAccount(session);
|
||||
} catch {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
await this.checkValidEnterpriseAndAccount(session);
|
||||
} catch {
|
||||
return;
|
||||
}
|
||||
|
||||
let storage: LocalStorage = new LocalStorage({
|
||||
@ -214,8 +209,7 @@ export default class MainAbility extends UIExtensionAbility {
|
||||
resolve();
|
||||
})
|
||||
.catch(async (error: BusinessError) => {
|
||||
await GetAlertMessage.startAlertAbility(GlobalContext.load('context') as common.UIExtensionContext,
|
||||
error, session);
|
||||
await GetAlertMessage.startAlertAbility(this.context, error, session);
|
||||
reject();
|
||||
return;
|
||||
})
|
||||
@ -225,7 +219,7 @@ export default class MainAbility extends UIExtensionAbility {
|
||||
async checkValidWantAndAccount(session: UIExtensionContentSession): Promise<void> {
|
||||
return new Promise(async (resolve, reject) => {
|
||||
if (!this.checkValidWant()) {
|
||||
await GetAlertMessage.startAlertAbility(GlobalContext.load('context') as common.UIExtensionContext,
|
||||
await GetAlertMessage.startAlertAbility(this.context,
|
||||
{ code: Constants.ERR_JS_APP_PARAM_ERROR } as BusinessError, session);
|
||||
reject();
|
||||
return;
|
||||
@ -238,7 +232,7 @@ export default class MainAbility extends UIExtensionAbility {
|
||||
resolve();
|
||||
} catch (err) {
|
||||
HiLog.error(TAG, `getOsAccountInfo failed: ${JSON.stringify(err)}`);
|
||||
await GetAlertMessage.startAlertAbility(GlobalContext.load('context') as common.UIExtensionContext,
|
||||
await GetAlertMessage.startAlertAbility(this.context,
|
||||
{ code: Constants.ERR_JS_GET_ACCOUNT_ERROR } as BusinessError, session);
|
||||
reject();
|
||||
return;
|
||||
@ -256,7 +250,7 @@ export default class MainAbility extends UIExtensionAbility {
|
||||
let codeMessage = checkDomainAccountInfo(GlobalContext.load('accountInfo'));
|
||||
sendDlpManagerAccountLogin(0);
|
||||
if (codeMessage) {
|
||||
await GetAlertMessage.startAlertAbility(GlobalContext.load('context') as common.UIExtensionContext,
|
||||
await GetAlertMessage.startAlertAbility(this.context,
|
||||
{ code: codeMessage } as BusinessError, session);
|
||||
return;
|
||||
}
|
||||
@ -298,7 +292,7 @@ export default class MainAbility extends UIExtensionAbility {
|
||||
try {
|
||||
isDlpSuffix = await FileUtils.isDLPFile(GlobalContext.load('uri'));
|
||||
} catch {
|
||||
await GetAlertMessage.startAlertAbility(GlobalContext.load('context') as common.UIExtensionContext,
|
||||
await GetAlertMessage.startAlertAbility(this.context,
|
||||
{ code: Constants.ERR_JS_APP_INSIDE_ERROR } as BusinessError, session);
|
||||
return;
|
||||
}
|
||||
@ -318,7 +312,18 @@ export default class MainAbility extends UIExtensionAbility {
|
||||
}
|
||||
return;
|
||||
} else {
|
||||
this.dlpFilesToEncrypt(session);
|
||||
try {
|
||||
let dlpFd = getFileFd(String((GlobalContext.load('abilityWant') as Want).uri));
|
||||
let accountType = await getAccountType(this.context, dlpFd);
|
||||
if (accountType === dlpPermission.AccountType.DOMAIN_ACCOUNT) {
|
||||
this.dlpFilesToEncrypt(session);
|
||||
} else {
|
||||
await GetAlertMessage.startAlertAbility(this.context, {
|
||||
code: Constants.ERR_JS_APP_INSIDE_ERROR } as BusinessError);
|
||||
}
|
||||
} catch {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -350,7 +355,7 @@ export default class MainAbility extends UIExtensionAbility {
|
||||
message: msg,
|
||||
}
|
||||
let accountFlag: boolean = true;
|
||||
if (this.domainAccount && err === Constants.ERR_JS_USER_NO_PERMISSION) {
|
||||
if (err === Constants.ERR_JS_USER_NO_PERMISSION) {
|
||||
let accountName: string = msg.split(', contact:')?.[1];
|
||||
accountFlag = await GetAlertMessage.checkAccountInfo(accountName);
|
||||
}
|
||||
@ -359,25 +364,33 @@ export default class MainAbility extends UIExtensionAbility {
|
||||
code: Constants.ERR_JS_APP_INSIDE_ERROR } as BusinessError);
|
||||
return;
|
||||
}
|
||||
await GetAlertMessage.startAlertAbility(GlobalContext.load('context') as common.UIExtensionContext,
|
||||
ansErr as BusinessError, session);
|
||||
await GetAlertMessage.startAlertAbility(this.context, ansErr as BusinessError, session);
|
||||
return;
|
||||
} else {
|
||||
GlobalContext.store('dlpProperty', data);
|
||||
AppStorage.setOrCreate('permanent', data.expireTime === 0);
|
||||
if (data.expireTime !== 0) {
|
||||
AppStorage.setOrCreate('validity', new Date(data.expireTime as number));
|
||||
}
|
||||
this.gotoPage(session);
|
||||
this.getOwnerAccountTypeInfo(data, session);
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
async getOwnerAccountTypeInfo(data: dlpPermission.DLPProperty, session: UIExtensionContentSession) {
|
||||
GlobalContext.store('dlpProperty', data);
|
||||
AppStorage.setOrCreate('permanent', data.expireTime === 0);
|
||||
if (data.expireTime !== 0) {
|
||||
AppStorage.setOrCreate('validity', new Date(data.expireTime as number));
|
||||
}
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
findFileOpenHistoryHome(uri: string, session: UIExtensionContentSession): Promise<void> {
|
||||
return new Promise<void>((resolve, reject) => {
|
||||
this.homeFeature.fileOpenHistoryHome(uri, async (err: number) => {
|
||||
if (err === 0) {
|
||||
await GetAlertMessage.startAlertAbility(GlobalContext.load('context') as common.UIExtensionContext,
|
||||
await GetAlertMessage.startAlertAbility(this.context,
|
||||
{ code: Constants.ERR_JS_APP_OPEN_REJECTED } as BusinessError, session);
|
||||
reject();
|
||||
}
|
||||
|
@ -24,7 +24,7 @@ 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, isPC } from '../common/utils';
|
||||
import { getFileUriByPath, getFileFd, getAppId, isValidPath, defaultDlpFile } from '../common/utils';
|
||||
import Constants from '../common/constant';
|
||||
import GlobalContext from '../common/GlobalContext';
|
||||
import zlib from '@ohos.zlib';
|
||||
@ -101,7 +101,6 @@ 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`);
|
||||
@ -179,10 +178,7 @@ export default class SaveAsAbility extends UIAbility {
|
||||
HiLog.error(TAG, `invalid authPerm: ${this.authPerm}`);
|
||||
this.isOK = false;
|
||||
AppStorage.setOrCreate('contactAccount', contactAccount);
|
||||
let accountFlag: boolean = true;
|
||||
if (this.domainAccount) {
|
||||
accountFlag = await GetAlertMessage.checkAccountInfo(contactAccount);
|
||||
}
|
||||
let accountFlag = await GetAlertMessage.checkAccountInfo(contactAccount);
|
||||
if (!accountFlag) {
|
||||
await GetAlertMessage.startAlertAbility(this.context, {
|
||||
code: Constants.ERR_JS_APP_INSIDE_ERROR } as BusinessError);
|
||||
|
@ -33,12 +33,12 @@ import {
|
||||
getFileFd,
|
||||
getFileUriByPath,
|
||||
getAppId,
|
||||
isPC,
|
||||
DLPInfo,
|
||||
getDLPInfo,
|
||||
sendDlpFileOpenProperties,
|
||||
isValidPath,
|
||||
defaultDlpFile
|
||||
defaultDlpFile,
|
||||
getAccountType
|
||||
} from '../common/utils';
|
||||
import Constants from '../common/constant';
|
||||
import GlobalContext from '../common/GlobalContext';
|
||||
@ -73,7 +73,7 @@ export default class ViewAbility extends ServiceExtensionAbility {
|
||||
private userId: number = -1;
|
||||
private linkFileWriteable: boolean = false;
|
||||
private callerBundleName: string = '';
|
||||
private domainAccount: boolean = !isPC() ? false : true;
|
||||
private accountType: number = dlpPermission.AccountType.DOMAIN_ACCOUNT;
|
||||
|
||||
async onCreate(want: Want): Promise<void> {
|
||||
if (!GlobalContext.load('sandbox2linkFile')) {
|
||||
@ -216,10 +216,10 @@ export default class ViewAbility extends ServiceExtensionAbility {
|
||||
'SANDBOX_PKGNAME': sandboxName,
|
||||
} as Record<string, number | string>
|
||||
};
|
||||
if (appIndex !== -1) {
|
||||
if (appIndex !== -1 && event.params) {
|
||||
event.params['SANDBOX_INDEX'] = appIndex;
|
||||
}
|
||||
if (reason !== undefined) {
|
||||
if (reason !== undefined && event.params) {
|
||||
event.params['REASON'] = reason;
|
||||
}
|
||||
try {
|
||||
@ -240,7 +240,7 @@ export default class ViewAbility extends ServiceExtensionAbility {
|
||||
'SANDBOX_PKGNAME': sandboxName,
|
||||
} as Record<string, number | string>
|
||||
};
|
||||
if (appIndex !== -1) {
|
||||
if (appIndex !== -1 && event.params) {
|
||||
event.params['SANDBOX_INDEX'] = appIndex;
|
||||
}
|
||||
try {
|
||||
@ -260,6 +260,18 @@ export default class ViewAbility extends ServiceExtensionAbility {
|
||||
}
|
||||
}
|
||||
|
||||
async startLoginAbility(): Promise<void> {
|
||||
let accountWant: Want = {
|
||||
bundleName: 'com.huawei.hmos.dlpcredmgr',
|
||||
abilityName: 'DlpCredLoginAbility'
|
||||
};
|
||||
try {
|
||||
await this.context.startAbility(accountWant);
|
||||
} catch {
|
||||
HiLog.info(TAG, `startLoginAbility failed`);
|
||||
}
|
||||
}
|
||||
|
||||
async getAccountAndOpenDLPFile(startId: number): Promise<void> {
|
||||
hiTraceMeter.startTrace('DlpGetOsAccountJs', startId);
|
||||
return new Promise(async (resolve, reject) => {
|
||||
@ -279,6 +291,17 @@ export default class ViewAbility extends ServiceExtensionAbility {
|
||||
return;
|
||||
}
|
||||
hiTraceMeter.finishTrace('DlpGetOsAccountJs', startId);
|
||||
if (this.accountType === dlpPermission.AccountType.CLOUD_ACCOUNT) {
|
||||
if (this.accountInfo.distributedInfo.name === 'ohosAnonymousName' &&
|
||||
this.accountInfo.distributedInfo.id === 'ohosAnonymousUid') {
|
||||
HiLog.info(TAG, 'account not login');
|
||||
await this.startLoginAbility();
|
||||
reject();
|
||||
return;
|
||||
}
|
||||
resolve();
|
||||
return;
|
||||
}
|
||||
let codeMessage = checkDomainAccountInfo(this.accountInfo);
|
||||
if (codeMessage) {
|
||||
hiTraceMeter.finishTrace('DlpOpenFileJs', startId);
|
||||
@ -306,6 +329,7 @@ export default class ViewAbility extends ServiceExtensionAbility {
|
||||
return;
|
||||
}
|
||||
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)}`);
|
||||
hiTraceMeter.finishTrace('DlpOpenDlpFileJs', startId);
|
||||
@ -315,7 +339,8 @@ 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 (this.domainAccount && err.code === Constants.ERR_JS_USER_NO_PERMISSION) {
|
||||
if (this.accountType === dlpPermission.AccountType.DOMAIN_ACCOUNT &&
|
||||
err.code === Constants.ERR_JS_USER_NO_PERMISSION) {
|
||||
let accountName: string = err.message.split(', contact:')?.[1];
|
||||
accountFlag = await GetAlertMessage.checkAccountInfo(accountName);
|
||||
}
|
||||
@ -342,10 +367,10 @@ export default class ViewAbility extends ServiceExtensionAbility {
|
||||
|
||||
async dlpGetAuthPerm(): Promise<void> {
|
||||
return new Promise(async (resolve, reject) => {
|
||||
if (this.domainAccount) {
|
||||
if (this.accountType === dlpPermission.AccountType.DOMAIN_ACCOUNT) {
|
||||
this.authPerm = getAuthPerm(this.accountInfo?.domainInfo.accountName ?? '', this.dlpFile.dlpProperty);
|
||||
} else {
|
||||
this.authPerm = getAuthPerm(this.accountInfo?.distributedInfo.name ?? '', this.dlpFile.dlpProperty);
|
||||
this.authPerm = dlpPermission.DLPFileAccess.READ_ONLY;
|
||||
}
|
||||
if (this.authPerm < dlpPermission.DLPFileAccess.READ_ONLY ||
|
||||
this.authPerm > dlpPermission.DLPFileAccess.FULL_CONTROL) {
|
||||
@ -617,6 +642,11 @@ export default class ViewAbility extends ServiceExtensionAbility {
|
||||
} catch {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
this.accountType = await getAccountType(this.context, this.dlpFd);
|
||||
} catch {
|
||||
return;
|
||||
}
|
||||
startId = Number(startId);
|
||||
hiTraceMeter.startTrace('DlpOpenFileJs', startId);
|
||||
this.sandboxBundleName = want.parameters?.['ohos.dlp.params.bundleName'] as string;
|
||||
@ -641,14 +671,12 @@ export default class ViewAbility extends ServiceExtensionAbility {
|
||||
return;
|
||||
}
|
||||
// uri permission just for domainAccount
|
||||
if (this.domainAccount) {
|
||||
let flag = wantConstant.Flags.FLAG_AUTH_WRITE_URI_PERMISSION |
|
||||
wantConstant.Flags.FLAG_AUTH_PERSISTABLE_URI_PERMISSION;
|
||||
let targetBundleName = this.sandboxBundleName;
|
||||
uriPermissionManager.grantUriPermission(this.uri, flag, targetBundleName, (result) => {
|
||||
HiLog.info(TAG, `grandUriPermission result: ${JSON.stringify(result)}`);
|
||||
});
|
||||
}
|
||||
let flag = wantConstant.Flags.FLAG_AUTH_WRITE_URI_PERMISSION |
|
||||
wantConstant.Flags.FLAG_AUTH_PERSISTABLE_URI_PERMISSION;
|
||||
let targetBundleName = this.sandboxBundleName;
|
||||
uriPermissionManager.grantUriPermission(this.uri, flag, targetBundleName, (result) => {
|
||||
HiLog.info(TAG, `grandUriPermission result: ${JSON.stringify(result)}`);
|
||||
});
|
||||
this.startSandboxApp(startId);
|
||||
AppStorage.setOrCreate('hiCode', Constants.DLP_START_SANDBOX_SUCCESS);
|
||||
sendDlpFileOpenProperties();
|
||||
|
@ -99,7 +99,7 @@ export class AccountTipsConfig {
|
||||
if (isExistFile) {
|
||||
configStr = fs.readTextSync(filePath);
|
||||
} else {
|
||||
let context: common.UIAbilityContext = GlobalContext.load('context') as common.UIAbilityContext;
|
||||
let context: common.UIAbilityContext = getContext() as common.UIAbilityContext;
|
||||
let resourceManager: resourceManager.ResourceManager = context?.resourceManager;
|
||||
if (resourceManager === null) {
|
||||
HiLog.error(TAG, `loadCcmConfigs failed. resourceManager is null.`);
|
||||
|
@ -22,6 +22,7 @@ import osAccount from '@ohos.account.osAccount';
|
||||
import account_osAccount from '@ohos.account.osAccount';
|
||||
import Constants from './constant';
|
||||
import GlobalContext from './GlobalContext';
|
||||
import dlpPermission from '@ohos.dlpPermission';
|
||||
import { measureTextSizeWidth } from './utils';
|
||||
import { HiLog } from '../common/HiLog';
|
||||
|
||||
@ -51,7 +52,8 @@ export class GetAlertMessage {
|
||||
abilityName: 'AlertAbility',
|
||||
parameters: {
|
||||
error: error,
|
||||
windowHeight
|
||||
windowHeight,
|
||||
accountType: GlobalContext.load('accountType')
|
||||
}
|
||||
}, options, async (err: BusinessError) => {
|
||||
if (err && err.code !== 0) {
|
||||
@ -64,8 +66,6 @@ export class GetAlertMessage {
|
||||
'bundleName': Constants.DLP_MANAGER_BUNDLE_NAME,
|
||||
},
|
||||
});
|
||||
} else if (GlobalContext.load('context')) {
|
||||
(GlobalContext.load('context') as common.UIAbilityContext).terminateSelf();
|
||||
} else {
|
||||
context.terminateSelf();
|
||||
}
|
||||
@ -98,7 +98,6 @@ export class GetAlertMessage {
|
||||
Constants.ERR_JS_APP_ENCRYPTION_REJECTED,
|
||||
Constants.ERR_JS_DLP_FILE_READ_ONLY,
|
||||
Constants.ERR_JS_FILE_EXPIRATION,
|
||||
Constants.ERR_JS_USER_NO_PERMISSION,
|
||||
Constants.ERR_JS_APP_PARAM_ERROR,
|
||||
Constants.ERR_JS_APP_OPEN_REJECTED,
|
||||
].includes(error.code)) {
|
||||
@ -111,6 +110,11 @@ export class GetAlertMessage {
|
||||
].includes(error.code)) {
|
||||
windowHeight = Constants.START_ABILITY_HEIGHT_FOUR_ROWS;
|
||||
};
|
||||
if ([Constants.ERR_JS_USER_NO_PERMISSION].includes(error.code)) {
|
||||
HiLog.info(TAG, `accountType: ${GlobalContext.load('accountType')}`);
|
||||
windowHeight = GlobalContext.load('accountType') === dlpPermission.AccountType.CLOUD_ACCOUNT ?
|
||||
Constants.START_ABILITY_HEIGHT_DEFAULT : Constants.START_ABILITY_HEIGHT_THREE_ROWS;
|
||||
}
|
||||
return windowHeight;
|
||||
}
|
||||
|
||||
@ -136,6 +140,8 @@ export class GetAlertMessage {
|
||||
return { 'msg': $r('app.string.MESSAGE_SERVICE_INSIDE_ERROR') } as Record<string, Resource>;
|
||||
case Constants.ERR_JS_NOT_DLP_FILE:
|
||||
return { 'msg': $r('app.string.MESSAGE_APP_FILE_PARAM_ERROR') } as Record<string, Resource>;
|
||||
case Constants.ERR_JS_USER_NO_PERMISSION:
|
||||
return { 'msg': $r('app.string.MESSAGE_APP_NOT_HAVE_PERM') } as Record<string, Resource>;
|
||||
default:
|
||||
if (defaultTitle !== undefined && defaultMessage != undefined) {
|
||||
return { 'title': defaultTitle, 'msg': defaultMessage } as Record<string, Resource>;
|
||||
|
@ -222,6 +222,8 @@ export default class Constants {
|
||||
public static FUSE_PATH = '/mnt/data/fuse/';
|
||||
public static RAND_START = 2;
|
||||
public static RAND_END = 18;
|
||||
public static TYPE_START = 2;
|
||||
public static TYPE_END = 3;
|
||||
public static BUNDLE_LEN = 20;
|
||||
|
||||
public static DLP_ZIP_MAGIC = 0x04034b50;
|
||||
@ -249,4 +251,32 @@ export default class Constants {
|
||||
public static SUB_HEADER_HEIGHT = 40;
|
||||
public static STAFF_FONT_SIZE = 10;
|
||||
public static STAFF_FONT_PADDING = 1;
|
||||
|
||||
// encryptionShare
|
||||
public static REQUEST_CODE = 1;
|
||||
public static INTERNATIONAL_DIALING_CODE = '0086';
|
||||
public static CONTACTS_PICKER_WIDTH = '100%';
|
||||
public static CONTACTS_PICKER_HEIGHT = '100%';
|
||||
public static SHARE_TITLE_HEAD_HEIGHT = 56;
|
||||
public static SHARE_TITLE_HEAD_MARGIN_TOP = 8;
|
||||
public static SHARE_TITLE_HEAD_MARGIN_RIGHT = 16;
|
||||
public static SHARE_TITLE_HEAD_MARGIN_BOTTOM = 24;
|
||||
public static SHARE_TITLE_HEAD_MARGIN_LEFT = 16;
|
||||
public static SHARE_CONTACTS_GROUP_WIDTH = 24;
|
||||
public static SHARE_CONTACTS_GROUP_HEIGHT = 24;
|
||||
public static SHARE_TEXT_INPUT_HEIGHT = 40;
|
||||
public static SHARE_TEXT_INPUT_MAX_LENGTH = 11;
|
||||
public static SHARE_CONTACTS_GROUP_OFFSET_X = -40;
|
||||
public static SHARE_CONTACTS_GROUP_OFFSET_Y = 0;
|
||||
public static SHARE_TITLE_HEAD_PADDING_LEFT = 16;
|
||||
public static SHARE_TEXT_INPUT_MARGIN_RIGHT = 24;
|
||||
public static SHARE_TEXT_INPUT_MARGIN_LEFT = 24;
|
||||
public static SHARE_BUTTON_WIDTH = '100%';
|
||||
public static SHARE_BUTTON_MARGIN_TOP = 64;
|
||||
public static SHARE_BUTTON_MARGIN_LEFT = 24;
|
||||
public static SHARE_BUTTON_MARGIN_RIGHT = 24;
|
||||
public static SHARE_BUTTON_PADDING_BOTTOM = 24;
|
||||
public static SHARE_PAGES_COLUMN_WIDTH = '100%';
|
||||
public static SHARE_PAGES_COLUMN_HEIGHT = '100%';
|
||||
public static SHARE_SET_TIMEOUT = 1500;
|
||||
}
|
||||
|
@ -18,7 +18,6 @@ import { staffItem } from './staff';
|
||||
import Constants from '../constant';
|
||||
import { AccountTipsConfig } from '../AccountTipsConfig';
|
||||
import { HiLog } from '../HiLog';
|
||||
import { isPC } from '../utils';
|
||||
|
||||
interface Staff {
|
||||
authAccount: string;
|
||||
@ -55,7 +54,7 @@ struct AddStaff {
|
||||
@State isInputInvalidFlag: boolean = false;
|
||||
private controller: RichEditorController = new RichEditorController();
|
||||
private options: RichEditorOptions = { controller: this.controller };
|
||||
@State domainAccount: boolean = !isPC() ? false : true;
|
||||
@State domainAccount: boolean = true;
|
||||
|
||||
@Builder
|
||||
StaffItemBuilder(authAccount: string, textContent: string, index: number) {
|
||||
@ -221,8 +220,7 @@ struct AddStaff {
|
||||
wrap: FlexWrap.Wrap,
|
||||
}) {
|
||||
RichEditor(this.options)
|
||||
.placeholder(!this.staffArray.length ? (this.domainAccount
|
||||
? $r('app.string.enter_a_complete_work_ID') : $r('app.string.enter_a_complete_account')) : '',
|
||||
.placeholder(!this.staffArray.length ? ($r('app.string.enter_a_complete_work_ID')) : '',
|
||||
{
|
||||
font: { size: $r('sys.float.ohos_id_text_size_body1') },
|
||||
fontColor: $r('sys.color.ohos_id_color_text_hint')
|
||||
@ -321,11 +319,11 @@ struct AddStaff {
|
||||
|
||||
Flex({ direction: FlexDirection.Row }) {
|
||||
if (this.isInputInvalid && !this.isNetworkInvalid) {
|
||||
Text(this.domainAccount ? $r('app.string.incorrect_work_ID') : $r('app.string.incorrect_account'))
|
||||
Text($r('app.string.incorrect_work_ID'))
|
||||
.inputMessageText()
|
||||
}
|
||||
if (this.isNetworkInvalid) {
|
||||
Text(this.domainAccount ? $r('app.string.network_invalid') : $r('app.string.incorrect_account'))
|
||||
Text($r('app.string.network_invalid'))
|
||||
.inputMessageText()
|
||||
}
|
||||
Blank()
|
||||
|
@ -14,7 +14,6 @@
|
||||
*/
|
||||
|
||||
import Constants from '../constant';
|
||||
import { isPC } from '../utils';
|
||||
|
||||
@Component
|
||||
struct EncryptingPanel {
|
||||
@ -64,12 +63,11 @@ struct EncryptingPanel {
|
||||
.alignItems(HorizontalAlign.Center)
|
||||
.justifyContent(FlexAlign.Center)
|
||||
}
|
||||
.width( isPC() ? Constants.ENCRYPTION_PC_FIXING_WIDTH : Constants.HEADER_COLUMN_WIDTH)
|
||||
.width(Constants.ENCRYPTION_PC_FIXING_WIDTH)
|
||||
.height(Constants.ENCRYPTION_LOADING_HEIGHT)
|
||||
.backgroundColor($r('sys.color.ohos_id_color_dialog_bg'))
|
||||
.borderRadius($r('sys.float.ohos_id_corner_radius_dialog'))
|
||||
.constraintSize({ minWidth: isPC() ?
|
||||
Constants.ENCRYPTION_PC_FIXING_WIDTH : Constants.ENCRYPTION_PC_FIXING_MINWIDTH })
|
||||
.constraintSize({ minWidth: Constants.ENCRYPTION_PC_FIXING_WIDTH })
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -21,7 +21,6 @@ import { AccountTips, AccountTipsConfig } from '../AccountTipsConfig';
|
||||
import { GetAlertMessage } from '../GetAlertMessage';
|
||||
import { DlpAlertDialog } from '../components/dlp_alert_dialog';
|
||||
import { HiLog } from '../HiLog';
|
||||
import { isPC } from '../utils';
|
||||
|
||||
const TAG = 'staff';
|
||||
|
||||
@ -60,7 +59,7 @@ struct staffItem {
|
||||
@Prop textContent: string = '';
|
||||
@State accountTipsArray: AccountTips[] = [];
|
||||
@State isHover: boolean = false;
|
||||
@State domainAccount: boolean = !isPC() ? false : true;
|
||||
@State domainAccount: boolean = true;
|
||||
dlpAlertDialog?: CustomDialogController;
|
||||
|
||||
@Builder popupBuilderTips() {
|
||||
|
94
entry/src/main/ets/common/share/ConnectService.ets
Normal file
94
entry/src/main/ets/common/share/ConnectService.ets
Normal file
@ -0,0 +1,94 @@
|
||||
/*
|
||||
* 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 common from '@ohos.app.ability.common';
|
||||
import Want from '@ohos.app.ability.Want';
|
||||
import { BusinessError } from '@ohos.base';
|
||||
import rpc from '@ohos.rpc';
|
||||
import CredCallbackStub from './CredCallback';
|
||||
import Constants from '../constant';
|
||||
import { HiLog } from '../HiLog';
|
||||
|
||||
const TAG = 'ConnectService';
|
||||
|
||||
export default class ConnectService {
|
||||
private context: ESObject;
|
||||
private connection = -1;
|
||||
private options: common.ConnectOptions;
|
||||
|
||||
constructor(context: ESObject) {
|
||||
let that = this;
|
||||
this.context = context;
|
||||
this.options = {
|
||||
onConnect: (elementName, remote) => {
|
||||
HiLog.info(TAG, `onConnect success${JSON.stringify(elementName)}`);
|
||||
that.sendDataRequest(remote);
|
||||
},
|
||||
onDisconnect: () => {
|
||||
HiLog.info(TAG, `onDisconnect`);
|
||||
},
|
||||
onFailed: () => {
|
||||
HiLog.info(TAG, `onFailed`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
connectServiceShareAbility() {
|
||||
HiLog.info(TAG, `connectServiceShareAbility start`);
|
||||
let want: Want = {
|
||||
bundleName: 'com.huawei.hmos.dlpcredmgr',
|
||||
abilityName: 'DlpCredDataExtAbility',
|
||||
};
|
||||
try {
|
||||
this.connection = this.context.connectServiceExtensionAbility(want, this.options);
|
||||
AppStorage.setOrCreate('connection', this.connection);
|
||||
} catch (err) {
|
||||
HiLog.error(TAG, `connectServiceExtAbility failed: ${JSON.stringify(err)}`);
|
||||
}
|
||||
HiLog.info(TAG, `connectServiceExtAbility result: ${this.connection}`);
|
||||
}
|
||||
|
||||
sendDataRequest(remote: rpc.IRemoteObject) {
|
||||
let cloudPhone: string | undefined = AppStorage.get('cloudPhone');
|
||||
HiLog.info(TAG, `sendDataRequest start`);
|
||||
let option = new rpc.MessageOption();
|
||||
let data = new rpc.MessageSequence();
|
||||
let reply = new rpc.MessageSequence();
|
||||
data.writeInterfaceToken('OHOS.HapDlpCredAbilityServiceStub');
|
||||
let callback: CredCallbackStub = new CredCallbackStub('CredCallbackStub');
|
||||
data.writeRemoteObject(callback.asObject());
|
||||
data.writeString(JSON.stringify({'phone': cloudPhone}));
|
||||
if (remote === null) {
|
||||
HiLog.info(TAG, `onConnect remote is null.`);
|
||||
return;
|
||||
}
|
||||
HiLog.info(TAG, `sendDataRequest success ${JSON.stringify(data)}`);
|
||||
remote.sendMessageRequest(Constants.REQUEST_CODE, data, reply, option).then((result) => {
|
||||
HiLog.info(TAG, `sendDataRequest. result: ${JSON.stringify(result)}`);
|
||||
}).catch((e: string) => {
|
||||
HiLog.info(TAG, `sendDataRequest error: ${e}`);
|
||||
});
|
||||
}
|
||||
|
||||
disconnectServiceShareAbility() {
|
||||
HiLog.info(TAG, `disconnectServiceShareAbility: ${AppStorage.get('connection')}`);
|
||||
let connectionNum: number | undefined = AppStorage.get('connection');
|
||||
this.context.disconnectAbility(connectionNum).then(() => {
|
||||
HiLog.info(TAG, `disconnectAbility success.`);
|
||||
}).catch((error: BusinessError) => {
|
||||
HiLog.error(TAG, `disconnectAbility failed. Error: ${JSON.stringify(error)}`);
|
||||
})
|
||||
};
|
||||
}
|
56
entry/src/main/ets/common/share/CredCallback.ets
Normal file
56
entry/src/main/ets/common/share/CredCallback.ets
Normal file
@ -0,0 +1,56 @@
|
||||
/*
|
||||
* 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 rpc from '@ohos.rpc';
|
||||
import ConnectService from './ConnectService';
|
||||
import { HiLog } from '../HiLog';
|
||||
|
||||
const TAG = 'CredCallbackStub';
|
||||
|
||||
export default class CredCallbackStub extends rpc.RemoteObject {
|
||||
private connectService: ConnectService = new ConnectService(getContext(this));
|
||||
private static readonly DESCRIPTOR: string = 'OHOS.HapDlpCredAbilityServiceStub';
|
||||
private static readonly COMMAND_ON_RESULT = 1;
|
||||
|
||||
constructor(des: string) {
|
||||
super(des);
|
||||
}
|
||||
|
||||
asObject(): rpc.IRemoteObject {
|
||||
return this;
|
||||
}
|
||||
|
||||
async onRemoteMessageRequest(code: number, data: rpc.MessageSequence): Promise<boolean> {
|
||||
HiLog.info(TAG, `onRemoteMessageRequest called, code = ${code}`);
|
||||
if (data.readInterfaceToken() !== CredCallbackStub.DESCRIPTOR) {
|
||||
HiLog.info(TAG, `DESCRIPTOR unmatched.`);
|
||||
return false;
|
||||
}
|
||||
switch (code) {
|
||||
case CredCallbackStub.COMMAND_ON_RESULT: {
|
||||
let resultVar = data.readString();
|
||||
HiLog.info(TAG, `onRemoteMessageRequest data: ${JSON.stringify(resultVar)}`);
|
||||
AppStorage.setOrCreate('isInputInvalid', resultVar);
|
||||
this.connectService.disconnectServiceShareAbility();
|
||||
return true;
|
||||
}
|
||||
default: {
|
||||
HiLog.info(TAG, `invalid request code: ${code}`);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
@ -21,9 +21,9 @@ import emitter from '@ohos.events.emitter';
|
||||
import dlpPermission from '@ohos.dlpPermission';
|
||||
import bundleManager from '@ohos.bundle.bundleManager'
|
||||
import fs from '@ohos.file.fs';
|
||||
import zlib from '@ohos.zlib';
|
||||
import fileUri from '@ohos.file.fileuri';
|
||||
import { BusinessError, Callback } from '@ohos.base'
|
||||
import deviceInfo from '@ohos.deviceInfo';
|
||||
import Want from '@ohos.app.ability.Want';
|
||||
import common from '@ohos.app.ability.common';
|
||||
import UIExtensionContentSession from '@ohos.app.ability.UIExtensionContentSession';
|
||||
@ -33,11 +33,14 @@ import hiSysEvent from '@ohos.hiSysEvent';
|
||||
import { HiLog } from '../common/HiLog';
|
||||
|
||||
const TAG = 'Utils';
|
||||
let domainAccount = !isPC() ? false : true;
|
||||
const HEAD_LENGTH_IN_BYTE = 20;
|
||||
class ChangeOption {
|
||||
public offset: number = 0
|
||||
public length: number = 0
|
||||
}
|
||||
let defaultDlpProperty: dlpPermission.DLPProperty = {
|
||||
ownerAccount: '',
|
||||
ownerAccountType: domainAccount ?
|
||||
dlpPermission.AccountType.DOMAIN_ACCOUNT : dlpPermission.AccountType.CLOUD_ACCOUNT,
|
||||
ownerAccountType: dlpPermission.AccountType.DOMAIN_ACCOUNT,
|
||||
authUserList: [],
|
||||
contactAccount: '',
|
||||
offlineAccess: true,
|
||||
@ -99,24 +102,15 @@ async function getOsAccountInfo(): Promise<account_osAccount.OsAccountInfo> {
|
||||
}
|
||||
|
||||
function checkDomainAccountInfo(accountInfo: account_osAccount.OsAccountInfo): number {
|
||||
if (domainAccount) {
|
||||
AppStorage.setOrCreate('hiAccountType', 'Domain_Account');
|
||||
if (accountInfo.domainInfo.accountName === '' &&
|
||||
accountInfo.domainInfo.accountId === '') {
|
||||
AppStorage.setOrCreate('hiAccountStatus', 0);
|
||||
return Constants.ERR_JS_APP_NO_ACCOUNT_ERROR;
|
||||
}
|
||||
if (!accountInfo.domainInfo.isAuthenticated) {
|
||||
AppStorage.setOrCreate('hiAccountStatus', 0);
|
||||
return Constants.ERR_JS_APP_SYSTEM_IS_AUTHENTICATED;
|
||||
}
|
||||
} else {
|
||||
AppStorage.setOrCreate('hiAccountType', 'Cloud_Account');
|
||||
if (accountInfo.distributedInfo.name === 'ohosAnonymousName' &&
|
||||
accountInfo.distributedInfo.id === 'ohosAnonymousUid') {
|
||||
AppStorage.setOrCreate('hiAccountStatus', 0);
|
||||
return Constants.ERR_JS_APP_NO_ACCOUNT_ERROR;
|
||||
}
|
||||
AppStorage.setOrCreate('hiAccountType', 'Domain_Account');
|
||||
if (accountInfo.domainInfo.accountName === '' &&
|
||||
accountInfo.domainInfo.accountId === '') {
|
||||
AppStorage.setOrCreate('hiAccountStatus', 0);
|
||||
return Constants.ERR_JS_APP_NO_ACCOUNT_ERROR;
|
||||
}
|
||||
if (!accountInfo.domainInfo.isAuthenticated) {
|
||||
AppStorage.setOrCreate('hiAccountStatus', 0);
|
||||
return Constants.ERR_JS_APP_SYSTEM_IS_AUTHENTICATED;
|
||||
}
|
||||
AppStorage.setOrCreate('hiAccountStatus', 1);
|
||||
return Constants.ERR_JS_APP_ACCOUNT_INFO;
|
||||
@ -184,7 +178,7 @@ let removeDuplicate = (arr: AuthAccount[], arg: string) => {
|
||||
let calculate = (newValue: Area, allNames: AuthAccount[]) => {
|
||||
let editLength = allNames.length;
|
||||
let screenWidth = Number(newValue['width']);
|
||||
let nameChange = domainAccount ? Constants.ENCRYPTION_STAFF_WIDTH_NAME : Constants.ENCRYPTION_STAFF_WIDTH;
|
||||
let nameChange = Constants.ENCRYPTION_STAFF_WIDTH_NAME;
|
||||
let rowNamesLen = Math.floor(screenWidth / (nameChange + Constants.ENCRYPTION_ADD_STAFF_MARGIN_RIGHT));
|
||||
let showNamesArr = editLength > Constants.ENCRYPTION_DOUBLED_NUMBER * rowNamesLen
|
||||
? allNames.slice(0, 2 * rowNamesLen - 1)
|
||||
@ -229,13 +223,6 @@ function directionStatus(func: Callback<number>) {
|
||||
});
|
||||
}
|
||||
|
||||
function isPC(): boolean {
|
||||
let deviceTypeName = deviceInfo.deviceType;
|
||||
let productModel = deviceInfo.productModel;
|
||||
|
||||
return (deviceTypeName === 'tablet' || deviceTypeName === '2in1') && productModel?.startsWith('HYM') === true
|
||||
}
|
||||
|
||||
async function showErrorDialogAndExit(windowStage: window.WindowStage, error: BusinessError): Promise<void> {
|
||||
let abilityWant = GlobalContext.load('abilityWant') as Want;
|
||||
if (abilityWant.parameters) {
|
||||
@ -398,10 +385,10 @@ function sendDlpManagerFileConfiguration() {
|
||||
}
|
||||
}
|
||||
|
||||
function sendDlpFileCreateProperties() {
|
||||
function sendDlpFileCreateProperties(name: string) {
|
||||
let event: hiSysEvent.SysEventInfo = {
|
||||
domain: 'DLP_UE',
|
||||
name: 'DLP_FILE_CREATE_EVENT',
|
||||
name: name,
|
||||
eventType: hiSysEvent?.EventType?.BEHAVIOR,
|
||||
params: {
|
||||
'PNAMEID': AppStorage.get('hiPNameId') ?? '',
|
||||
@ -445,6 +432,26 @@ function sendDlpFileOpenProperties() {
|
||||
}
|
||||
}
|
||||
|
||||
function sendDlpManager2CAccountLogin(errorCode: number) {
|
||||
let event: hiSysEvent.SysEventInfo = {
|
||||
domain: 'DLP_UE',
|
||||
name: 'DLP_2C_MANAGER_ACCOUNT_LOGIN',
|
||||
eventType: hiSysEvent?.EventType?.BEHAVIOR,
|
||||
params: {
|
||||
'PNAMEID': AppStorage.get('hiPNameId') ?? '',
|
||||
'PVERSIONID': AppStorage.get('hiPVersionId') ?? '',
|
||||
'ACCOUNT_TYPE': 1,
|
||||
'PKG_NAME': AppStorage.get('hiPkgName') ?? '',
|
||||
} as Record<string, number>
|
||||
};
|
||||
|
||||
try {
|
||||
hiSysEvent.write(event);
|
||||
} catch (err) {
|
||||
HiLog.error(TAG, `sendDlpManagerAccountLogin failed`);
|
||||
}
|
||||
}
|
||||
|
||||
function isValidPath(path: string): Boolean {
|
||||
if (path.indexOf('/./') !== -1 || path.indexOf('/../') !== -1) {
|
||||
return false;
|
||||
@ -458,7 +465,63 @@ function measureTextSizeWidth(str: Resource | string) {
|
||||
fontSize: '16fp'
|
||||
})
|
||||
return px2vp(Number(itemLenWithPX.width) + Constants.ENCRYPTION_PROTECTION_TIME_MENU_WIDTH);
|
||||
}
|
||||
}
|
||||
|
||||
function getAccountType(
|
||||
context: common.ServiceExtensionContext | common.UIExtensionContext, fd: number): Promise<number> {
|
||||
return new Promise(async (resolve, reject) => {
|
||||
let z = new ArrayBuffer(HEAD_LENGTH_IN_BYTE);
|
||||
let option: ChangeOption = {
|
||||
offset: 0,
|
||||
length: HEAD_LENGTH_IN_BYTE
|
||||
};
|
||||
let random = String(Math.random()).substring(Constants.RAND_START, Constants.RAND_END);
|
||||
let filePath = context.filesDir + '/saveAs' + random;
|
||||
let dirPath = context.filesDir + '/saveAsUnzip' + random;
|
||||
let fileName = dirPath + '/dlp_cert';
|
||||
try {
|
||||
fs.readSync(fd, z, option);
|
||||
let ff = await fs.open(filePath, fs.OpenMode.READ_WRITE | fs.OpenMode.CREATE);
|
||||
await fs.copyFile(fd, ff.fd);
|
||||
await fs.mkdir(dirPath);
|
||||
await zlib.decompressFile(filePath, dirPath);
|
||||
let dlpInfo = fs.readTextSync(fileName);
|
||||
let infoArray = dlpInfo.split('accountType');
|
||||
let type = infoArray[1].slice(Constants.TYPE_START, Constants.TYPE_END);
|
||||
HiLog.info(TAG, `accountType: ${type}`);
|
||||
GlobalContext.store('accountType', Number(type));
|
||||
resolve(Number(type));
|
||||
} catch (err) {
|
||||
HiLog.error(TAG, `decompressFile: ${JSON.stringify(err)}`)
|
||||
reject();
|
||||
} finally {
|
||||
deleteFile(filePath);
|
||||
removeDir(dirPath);
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
function deleteFile(file: string) {
|
||||
try {
|
||||
let res = fs.accessSync(file);
|
||||
if (res) {
|
||||
fs.unlinkSync(file);
|
||||
}
|
||||
} catch (err) {
|
||||
HiLog.error(TAG, `deleteFile: ${JSON.stringify(err)}`);
|
||||
}
|
||||
}
|
||||
|
||||
function removeDir(file: string) {
|
||||
try {
|
||||
let res = fs.accessSync(file);
|
||||
if (res) {
|
||||
fs.rmdirSync(file);
|
||||
}
|
||||
} catch (err) {
|
||||
HiLog.error(TAG, `rmdirSync: ${JSON.stringify(err)}`);
|
||||
}
|
||||
}
|
||||
|
||||
export {
|
||||
AuthAccount,
|
||||
@ -475,7 +538,6 @@ export {
|
||||
calculate,
|
||||
toggleShow,
|
||||
directionStatus,
|
||||
isPC,
|
||||
showErrorDialogAndExit,
|
||||
goToAlertMessagePage,
|
||||
getAppId,
|
||||
@ -486,8 +548,10 @@ export {
|
||||
sendDlpManagerFileConfiguration,
|
||||
sendDlpFileCreateProperties,
|
||||
sendDlpFileOpenProperties,
|
||||
sendDlpManager2CAccountLogin,
|
||||
DLPInfo,
|
||||
isValidPath,
|
||||
measureTextSizeWidth,
|
||||
defaultDlpFile
|
||||
defaultDlpFile,
|
||||
getAccountType
|
||||
};
|
||||
|
@ -22,8 +22,8 @@ import Constants from '../common/constant';
|
||||
import UIExtensionContentSession from '@ohos.app.ability.UIExtensionContentSession';
|
||||
import ability from '@ohos.ability.ability';
|
||||
import account_osAccount from '@ohos.account.osAccount';
|
||||
import dlpPermission from '@ohos.dlpPermission';
|
||||
import { sendDlpManagerAccountLogin } from '../common/utils';
|
||||
import { isPC } from '../common/utils';
|
||||
import { HiLog } from '../common/HiLog';
|
||||
|
||||
const TAG = 'Alert';
|
||||
@ -125,9 +125,9 @@ struct Index {
|
||||
try {
|
||||
let messageCode = ((GlobalContext.load('abilityWant') as Want).parameters?.error as BusinessError).code;
|
||||
let errorMsg = (GlobalContext.load('abilityWant') as Want).parameters?.error as BusinessError;
|
||||
let accountType = (GlobalContext.load('abilityWant') as Want).parameters?.accountType as number;
|
||||
let errInfo: Record<string, Resource> = {};
|
||||
if ([
|
||||
Constants.ERR_JS_USER_NO_PERMISSION,
|
||||
Constants.ERR_JS_APP_PARAM_ERROR,
|
||||
Constants.ERR_JS_APP_OPEN_REJECTED,
|
||||
Constants.ERR_JS_APP_ENCRYPTION_REJECTED,
|
||||
@ -139,6 +139,9 @@ struct Index {
|
||||
errInfo = GetAlertMessage.getAlertTitleMessage(errorMsg);
|
||||
} else if ([Constants.ERR_JS_APP_SYSTEM_IS_AUTHENTICATED, Constants.ERR_JS_OFFLINE].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);
|
||||
}
|
||||
@ -247,7 +250,7 @@ struct Index {
|
||||
.borderRadius($r('sys.float.ohos_id_corner_radius_dialog'))
|
||||
.alignItems(HorizontalAlign.Center)
|
||||
.backgroundColor($r('sys.color.ohos_id_color_dialog_bg'))
|
||||
.height( isPC() ? Constants.HEADER_COLUMN_WIDTH : this.windowHeight)
|
||||
.height(Constants.HEADER_COLUMN_WIDTH)
|
||||
.shadow(ShadowStyle.OUTER_DEFAULT_MD)
|
||||
.border({ width: Constants.DIALOG_MD_OFFSET, color: $r('app.color.encryption_divider_color') })
|
||||
.backgroundBlurStyle(BlurStyle.COMPONENT_ULTRA_THIN);
|
||||
|
@ -33,7 +33,6 @@ import {
|
||||
toggleShow,
|
||||
directionStatus,
|
||||
getTime,
|
||||
isPC,
|
||||
sendDlpManagerFileConfiguration
|
||||
} from '../common/utils';
|
||||
import { DlpAlertDialog } from '../common/components/dlp_alert_dialog';
|
||||
@ -93,7 +92,7 @@ struct changeEncryption {
|
||||
@State staffDataArrayReadOnly: AuthAccount[] = [];
|
||||
@State staffDataArrayEdit: AuthAccount[] = [];
|
||||
private routerData: Record<string, AuthAccount[]> = {};
|
||||
@State domainAccount: boolean = !isPC() ? false : true;
|
||||
@State domainAccount: boolean = true;
|
||||
@State permissionDict: PermissionValue[] = [
|
||||
{
|
||||
value: $r('app.string.PERMISSION_TYPE_SELECT_TARGET') as Resource, data: 'target', index: 0
|
||||
@ -384,10 +383,8 @@ struct changeEncryption {
|
||||
'staffDataArrayEdit': this.staffDataArrayEdit,
|
||||
} as Record<string, AuthAccount[]>;
|
||||
} else { // ability
|
||||
if (this.domainAccount) {
|
||||
await AccountTipsConfig.getConfigTips();
|
||||
await this.getTextContent();
|
||||
}
|
||||
await AccountTipsConfig.getConfigTips();
|
||||
await this.getTextContent();
|
||||
|
||||
this.routerData = {
|
||||
'staffDataArrayReadOnly': this.staffDataArrayReadOnly,
|
||||
@ -900,12 +897,11 @@ struct changeEncryption {
|
||||
})
|
||||
}
|
||||
.visibility(this.prepareData ? Visibility.Hidden : Visibility.Visible)
|
||||
.width( this.domainAccount ? Constants.ENCRYPTION_PC_FIXING_WIDTH : Constants.HEADER_COLUMN_WIDTH)
|
||||
.width(Constants.ENCRYPTION_PC_FIXING_WIDTH)
|
||||
.backgroundColor($r('sys.color.ohos_id_color_dialog_bg'))
|
||||
.borderRadius($r('sys.float.ohos_id_corner_radius_dialog'))
|
||||
.constraintSize({
|
||||
minWidth: this.domainAccount ?
|
||||
Constants.ENCRYPTION_PC_FIXING_WIDTH : Constants.ENCRYPTION_PC_FIXING_MINWIDTH
|
||||
minWidth: Constants.ENCRYPTION_PC_FIXING_WIDTH
|
||||
})
|
||||
.backgroundBlurStyle(BlurStyle.COMPONENT_ULTRA_THICK);
|
||||
}
|
||||
|
392
entry/src/main/ets/pages/encryptedSharing.ets
Normal file
392
entry/src/main/ets/pages/encryptedSharing.ets
Normal file
@ -0,0 +1,392 @@
|
||||
/*
|
||||
* 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 { EditableLeftIconType } from '@ohos.arkui.advanced.EditableTitleBar';
|
||||
import { EditableTitleBar } from '@ohos.arkui.advanced.EditableTitleBar';
|
||||
import ConnectService from '../common/share/ConnectService';
|
||||
import dlpPermission from '@ohos.dlpPermission';
|
||||
import promptAction from '@ohos.promptAction';
|
||||
import Want from '@ohos.app.ability.Want';
|
||||
import fs from '@ohos.file.fs';
|
||||
import { HiLog } from '../common/HiLog';
|
||||
import Constants from '../common/constant';
|
||||
import FileUtils, { FileMsg } from '../common/FileUtils';
|
||||
import { getFileUriByPath, getFileFd, sendDlpFileCreateProperties, getFileSizeByUri } from '../common/utils';
|
||||
|
||||
const TAG = 'Share';
|
||||
class Test {
|
||||
public '0': number = 0;
|
||||
public '1': number = 0;
|
||||
public '4': string = '';
|
||||
}
|
||||
|
||||
let defaultDlpProperty: dlpPermission.DLPProperty = {
|
||||
ownerAccount: '',
|
||||
ownerAccountType: dlpPermission.AccountType.CLOUD_ACCOUNT,
|
||||
authUserList: [],
|
||||
contactAccount: '',
|
||||
offlineAccess: true,
|
||||
ownerAccountID: '',
|
||||
everyoneAccessList: []
|
||||
};
|
||||
|
||||
@Extend(Text)
|
||||
function inputMessageText() {
|
||||
.fontSize($r('sys.float.ohos_fa_text_size_body'))
|
||||
.lineHeight(Constants.PP_TEXT_LINE_HEIGHT2)
|
||||
.fontColor($r('sys.color.ohos_id_color_text_secondary'))
|
||||
.fontWeight(FontWeight.Regular)
|
||||
.margin({ top: Constants.ENCRYPTION_ADD_STAFF_BORDER_MARGIN_TOP })
|
||||
}
|
||||
|
||||
let storage = LocalStorage.getShared();
|
||||
@Entry(storage)
|
||||
@Component
|
||||
struct encryptedSharing {
|
||||
private connectService: ConnectService = new ConnectService(getContext(this));
|
||||
@StorageLink('isInputInvalid') @Watch('beginToGenerateDLPFile') isInputInvalid: string = '';
|
||||
@State dlpProperty: dlpPermission.DLPProperty = defaultDlpProperty;
|
||||
@State enabledFocus: boolean = true;
|
||||
@State isShowSheet: boolean = false;
|
||||
@State showUIExtension: boolean = true;
|
||||
@State cloudAccountLogin: boolean = true;
|
||||
@State actionWant: Want | undefined = storage.get<Want>('actionWant');
|
||||
@State inputValue: string = '';
|
||||
@State showTipsMsg: boolean = true;
|
||||
@State phoneFormatTips: boolean = true;
|
||||
@State ownerAccount: string = '';
|
||||
@State ownerAccountID: string = '';
|
||||
@State credentialCallBackMsg: string = '';
|
||||
@State session: UIExtensionContentSession | undefined =
|
||||
storage === undefined ? undefined : storage.get<UIExtensionContentSession>('session');
|
||||
|
||||
@Builder
|
||||
contactsPicker() {
|
||||
Column() {
|
||||
UIExtensionComponent({
|
||||
bundleName: 'com.ohos.contacts',
|
||||
abilityName: 'ContactUiExtentionAbility',
|
||||
parameters: {
|
||||
'ability.want.params.uiExtensionType': 'sys/commonUI',
|
||||
'targetUrl': 'BatchSelectContactsPage',
|
||||
}
|
||||
})
|
||||
.onRelease((code) => {
|
||||
})
|
||||
.onResult((data) => {
|
||||
})
|
||||
.onReceive((data) => {
|
||||
let want = data.want as Record<string, Object>;
|
||||
let parameters = want.parameters as Record<string, string>;
|
||||
let contactObjects = parameters.contactObjects;
|
||||
let contactInfo: object[] = JSON.parse(contactObjects);
|
||||
this.inputValue = (contactInfo[0] as Record<string, string>).telephone;
|
||||
this.isShowSheet = false;
|
||||
})
|
||||
.width(Constants.CONTACTS_PICKER_WIDTH)
|
||||
.height(Constants.CONTACTS_PICKER_HEIGHT)
|
||||
}
|
||||
.width(Constants.CONTACTS_PICKER_WIDTH)
|
||||
.height(Constants.CONTACTS_PICKER_HEIGHT)
|
||||
}
|
||||
|
||||
private async beginShareEncrypt() {
|
||||
if (this.checkCloudPhone(this.inputValue)) {
|
||||
HiLog.info(TAG, `this.cloudAccountLogin: ${this.cloudAccountLogin}`);
|
||||
if (this.cloudAccountLogin) {
|
||||
this.connectService.connectServiceShareAbility();
|
||||
} else {
|
||||
this.showUIExtension = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
checkCloudPhone(phone: string): boolean {
|
||||
if (!phone) {
|
||||
return false;
|
||||
}
|
||||
if (!(/^[1][3,4,5,6,7,8,9][0-9]{9}$/.test(phone))) {
|
||||
HiLog.info(TAG, `Please enter the phone.`);
|
||||
this.phoneFormatTips = false;
|
||||
HiLog.info(TAG, `phoneFormatTips: ${this.phoneFormatTips}`);
|
||||
return false;
|
||||
};
|
||||
let cloudPhone = `${Constants.INTERNATIONAL_DIALING_CODE}${this.inputValue}`;
|
||||
AppStorage.setOrCreate('cloudPhone', cloudPhone);
|
||||
return true;
|
||||
}
|
||||
|
||||
async beginToGenerateDLPFile() {
|
||||
HiLog.info(TAG, `beginToGenerateDLPFile start: ${JSON.stringify(this.actionWant)}`);
|
||||
if (!this.getInputInvalid()) {
|
||||
return;
|
||||
}
|
||||
let parameters = this.actionWant?.parameters as Record<string, Array<string>>;
|
||||
let inputUri: string = parameters['ability.params.stream'][0];
|
||||
let srcFileMsg: FileMsg = FileUtils.getSuffixFileMsgByUri(inputUri);
|
||||
let inputFileName = srcFileMsg.fileName;
|
||||
let filePatch = inputFileName + srcFileMsg.fileType + '.dlp';
|
||||
let inFileFd = getFileFd(inputUri);
|
||||
let srcFileSize: number = await getFileSizeByUri(inputUri);
|
||||
AppStorage.setOrCreate('hiFileSize', srcFileSize);
|
||||
AppStorage.setOrCreate('hiFileType', srcFileMsg.fileType);
|
||||
let filePath = getContext(this).filesDir + '/' + filePatch;
|
||||
let file: fs.File;
|
||||
try {
|
||||
file = fs.openSync(filePath, fs.OpenMode.CREATE | fs.OpenMode.READ_WRITE);
|
||||
HiLog.info(TAG, `open temp file: ${file.fd}`);
|
||||
} catch (err) {
|
||||
HiLog.error(TAG, `open temp failed: ${JSON.stringify(err)}`);
|
||||
this.enabledFocus = true;
|
||||
return;
|
||||
}
|
||||
let filePathUri = getFileUriByPath(filePath);
|
||||
this.enabledFocus = false;
|
||||
HiLog.info(TAG, `this.dlpProperty: ${JSON.stringify(this.dlpProperty)}`);
|
||||
try {
|
||||
await dlpPermission.generateDLPFile(inFileFd, file.fd, this.dlpProperty);
|
||||
this.showToast($r('app.string.Share_File_Encrypted_Success'));
|
||||
let dstFileSize: number = await getFileSizeByUri(filePathUri);
|
||||
AppStorage.setOrCreate('hiPolicySizeEnc', dstFileSize);
|
||||
AppStorage.setOrCreate('hiCode', 201);
|
||||
sendDlpFileCreateProperties('DLP_2C_FILE_CREATE_EVENT'); // 201: DLP_2C_FILE_CREATE_EVENT
|
||||
this.backToPages(filePathUri, filePatch);
|
||||
try {
|
||||
await fs.close(file);
|
||||
} catch (err) {
|
||||
HiLog.info(TAG, `close failed: ${JSON.stringify(err)}`);
|
||||
}
|
||||
} catch (err) {
|
||||
this.showTipsMsg = false;
|
||||
this.enabledFocus = true;
|
||||
HiLog.info(TAG, `generateDLPFile file failed: ${JSON.stringify(err)}`);
|
||||
AppStorage.setOrCreate('isInputInvalid', '');
|
||||
this.showToast($r('app.string.Share_File_Encrypted_Failed'));
|
||||
}
|
||||
}
|
||||
|
||||
showToast(msg: Resource) {
|
||||
promptAction.showToast({
|
||||
message: msg,
|
||||
duration: Constants.SHARE_SET_TIMEOUT
|
||||
});
|
||||
}
|
||||
|
||||
backToPages(filePathUri: string, filePatch: string) {
|
||||
if (this.actionWant && this.actionWant.parameters) {
|
||||
this.actionWant.parameters['ability.params.stream'] = [filePathUri];
|
||||
let arr: Test[] = [
|
||||
{
|
||||
'0': 0,
|
||||
'1': 0,
|
||||
'4': filePatch
|
||||
}
|
||||
];
|
||||
let generalFile: Record<string, Test[]> = {
|
||||
'general.file': arr,
|
||||
}
|
||||
this.actionWant.parameters['ability.picker.records'] = generalFile;
|
||||
HiLog.info(TAG, `this.actionWant: ${JSON.stringify(this.actionWant)}`);
|
||||
setTimeout(() => {
|
||||
this.session!.terminateSelfWithResult({
|
||||
resultCode: 2,
|
||||
want: this.actionWant
|
||||
});
|
||||
}, Constants.SHARE_SET_TIMEOUT)
|
||||
}
|
||||
}
|
||||
|
||||
getInputInvalid(): boolean {
|
||||
if (!this.isInputInvalid) {
|
||||
return false;
|
||||
};
|
||||
let credentialCallBack = JSON.parse(this.isInputInvalid) as Record<string, string>;
|
||||
if (!credentialCallBack.status) {
|
||||
HiLog.info(TAG, `credentialCallBack: ${credentialCallBack.msg}`);
|
||||
this.credentialCallBackMsg = credentialCallBack.msg;
|
||||
this.showTipsMsg = false;
|
||||
AppStorage.setOrCreate('isInputInvalid', '');
|
||||
return false;
|
||||
}
|
||||
this.dlpProperty = {
|
||||
'ownerAccount': this.ownerAccount,
|
||||
'ownerAccountID': this.ownerAccountID,
|
||||
'ownerAccountType': 1,
|
||||
'authUserList': [
|
||||
{
|
||||
'authAccount': credentialCallBack.userIdCipher,
|
||||
'authAccountType': 1,
|
||||
'dlpFileAccess': 1,
|
||||
'permExpiryTime': Date.UTC(9999, 1, 1),
|
||||
}
|
||||
],
|
||||
'contactAccount': this.ownerAccount,
|
||||
'offlineAccess': true,
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
aboutToAppear() {
|
||||
HiLog.info(TAG, `aboutToAppear enter: ${this.showUIExtension}`);
|
||||
}
|
||||
|
||||
build() {
|
||||
Stack() {
|
||||
Column() {
|
||||
EditableTitleBar({
|
||||
leftIconStyle: EditableLeftIconType.Back,
|
||||
title: $r('app.string.Share_Add_Viewable_Users'),
|
||||
menuItems: [
|
||||
{
|
||||
value: $r('sys.media.ohos_ic_public_cancel'),
|
||||
isEnabled: true,
|
||||
action: () => {
|
||||
if (this.session !== undefined) {
|
||||
this.session.terminateSelfWithResult({
|
||||
'resultCode': 1,
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
isSaveIconRequired: false,
|
||||
onCancel: () => {
|
||||
if (this.session !== undefined) {
|
||||
this.session.terminateSelfWithResult({
|
||||
'resultCode': 0,
|
||||
});
|
||||
}
|
||||
},
|
||||
})
|
||||
.height(Constants.SHARE_TITLE_HEAD_HEIGHT)
|
||||
.margin({
|
||||
top: Constants.SHARE_TITLE_HEAD_MARGIN_TOP,
|
||||
right: Constants.SHARE_TITLE_HEAD_MARGIN_RIGHT,
|
||||
bottom: Constants.SHARE_TITLE_HEAD_MARGIN_BOTTOM,
|
||||
left: Constants.SHARE_TITLE_HEAD_MARGIN_LEFT
|
||||
})
|
||||
Column() {
|
||||
Row() {
|
||||
TextInput({ text: this.inputValue, placeholder: $r('app.string.Share_Enter_Mobile_Number') })
|
||||
.enabled(this.enabledFocus)
|
||||
.height(Constants.SHARE_TEXT_INPUT_HEIGHT)
|
||||
.defaultFocus(true)
|
||||
.type(InputType.PhoneNumber)
|
||||
.contentType(ContentType.PHONE_COUNTRY_CODE)
|
||||
.enterKeyType(EnterKeyType.NEW_LINE)
|
||||
.border(!this.showTipsMsg ?
|
||||
{ width: Constants.DIALOG_MD_OFFSET, color: $r('sys.color.ohos_id_color_warning') } : {})
|
||||
.maxLength(Constants.SHARE_TEXT_INPUT_MAX_LENGTH)
|
||||
.onChange((value: string) => {
|
||||
this.inputValue = value;
|
||||
this.showTipsMsg = true;
|
||||
this.phoneFormatTips = true;
|
||||
})
|
||||
Image($r('app.media.ic_public_contacts_group'))
|
||||
.fillColor($r('sys.color.ohos_id_color_secondary'))
|
||||
.width(Constants.SHARE_CONTACTS_GROUP_WIDTH)
|
||||
.height(Constants.SHARE_CONTACTS_GROUP_HEIGHT)
|
||||
.offset({x: Constants.SHARE_CONTACTS_GROUP_OFFSET_X, y: Constants.SHARE_CONTACTS_GROUP_OFFSET_Y})
|
||||
.onClick(() => {
|
||||
this.isShowSheet = !this.isShowSheet;
|
||||
})
|
||||
.bindSheet(this.isShowSheet, this.contactsPicker(), {
|
||||
height: SheetSize.LARGE,
|
||||
dragBar: false,
|
||||
showClose: false,
|
||||
onDisappear: () => {
|
||||
this.isShowSheet = false;
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
Text(){
|
||||
if (this.showTipsMsg) {
|
||||
if (this.phoneFormatTips) {
|
||||
Span($r('app.string.Share_Only_Supported_Mobile_Number'))
|
||||
} else {
|
||||
Span($r('app.string.Share_Tips_Phone_Format'))
|
||||
}
|
||||
} else {
|
||||
Span(this.credentialCallBackMsg)
|
||||
.fontColor($r('sys.color.ohos_id_color_warning'))
|
||||
}
|
||||
}
|
||||
.inputMessageText()
|
||||
.width(Constants.CONTACTS_PICKER_WIDTH)
|
||||
.padding({left: Constants.SHARE_TITLE_HEAD_PADDING_LEFT})
|
||||
}
|
||||
.margin({ left: Constants.SHARE_TEXT_INPUT_MARGIN_LEFT, right: Constants.SHARE_TEXT_INPUT_MARGIN_RIGHT })
|
||||
Column() {
|
||||
Button($r('app.string.Share_Confirms'), { type: ButtonType.Capsule, stateEffect: true })
|
||||
.enabled(this.enabledFocus)
|
||||
.backgroundColor($r('sys.color.ohos_id_color_text_primary_activated'))
|
||||
.fontWeight(FontWeight.Medium)
|
||||
.width(Constants.SHARE_BUTTON_WIDTH)
|
||||
.height(Constants.FOOTER_HEIGHT)
|
||||
.onClick(() => {
|
||||
this.beginShareEncrypt()
|
||||
})
|
||||
}
|
||||
.justifyContent(FlexAlign.Center)
|
||||
.margin({
|
||||
top: Constants.SHARE_BUTTON_MARGIN_TOP,
|
||||
left: Constants.SHARE_BUTTON_MARGIN_LEFT,
|
||||
right: Constants.SHARE_BUTTON_MARGIN_RIGHT
|
||||
})
|
||||
.padding({
|
||||
bottom: Constants.SHARE_BUTTON_PADDING_BOTTOM
|
||||
})
|
||||
}
|
||||
.width(Constants.SHARE_PAGES_COLUMN_WIDTH)
|
||||
.height(Constants.SHARE_PAGES_COLUMN_HEIGHT)
|
||||
if (this.showUIExtension) {
|
||||
UIExtensionComponent({
|
||||
bundleName: 'com.huawei.hmos.dlpcredmgr',
|
||||
abilityName: 'DlpCredAccountAbility',
|
||||
parameters: {
|
||||
'ability.want.params.uiExtensionType': 'sys/commonUI'
|
||||
}
|
||||
})
|
||||
.onReceive((data) => {
|
||||
let res = data.result as Record<string, string>;
|
||||
this.ownerAccount = res.uid;
|
||||
this.ownerAccountID = res.uid;
|
||||
if (data.status) {
|
||||
this.cloudAccountLogin = true;
|
||||
let checkCloudPhone = this.checkCloudPhone(this.inputValue);
|
||||
HiLog.info(TAG, `checkCloudPhone: ${checkCloudPhone}`);
|
||||
if (checkCloudPhone) {
|
||||
this.connectService.connectServiceShareAbility();
|
||||
}
|
||||
} else {
|
||||
this.cloudAccountLogin = false;
|
||||
if (['12300001', '1001502005'].includes(res.code.toString())) {
|
||||
promptAction.showToast({
|
||||
message: $r('app.string.network_invalid'),
|
||||
duration: Constants.SHARE_SET_TIMEOUT
|
||||
});
|
||||
}
|
||||
}
|
||||
this.showUIExtension = false;
|
||||
})
|
||||
.size({
|
||||
width: Constants.SHARE_PAGES_COLUMN_WIDTH, height: Constants.SHARE_PAGES_COLUMN_HEIGHT
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -35,7 +35,6 @@ import {
|
||||
directionStatus,
|
||||
AuthAccount,
|
||||
getFileUriByPath,
|
||||
isPC,
|
||||
sendDlpFileCreateProperties,
|
||||
sendDlpManagerFileConfiguration,
|
||||
getFileSizeByUri
|
||||
@ -70,11 +69,9 @@ interface dlpDataType {
|
||||
offlineAccess: boolean;
|
||||
everyoneAccessList: Array<dlpPermission.DLPFileAccess>;
|
||||
}
|
||||
let domainAccount = !isPC() ? false : true;
|
||||
let defaultDlpProperty: dlpPermission.DLPProperty = {
|
||||
ownerAccount: '',
|
||||
ownerAccountType: domainAccount ?
|
||||
dlpPermission.AccountType.DOMAIN_ACCOUNT : dlpPermission.AccountType.CLOUD_ACCOUNT,
|
||||
ownerAccountType: dlpPermission.AccountType.DOMAIN_ACCOUNT,
|
||||
authUserList: [],
|
||||
contactAccount: '',
|
||||
offlineAccess: true,
|
||||
@ -101,8 +98,7 @@ struct DlpDialog {
|
||||
@State prepareData: boolean = false;
|
||||
@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 domainOrCloudAccount: number = dlpPermission.AccountType.DOMAIN_ACCOUNT
|
||||
@State permissionDict: PermissionType[] = [
|
||||
{
|
||||
value: $r('app.string.PERMISSION_TYPE_SELECT_TARGET'), data: 'target', index: 0
|
||||
@ -200,8 +196,10 @@ struct DlpDialog {
|
||||
|
||||
try {
|
||||
let userId = await getUserId();
|
||||
event.params['USER_ID'] = userId;
|
||||
await hiSysEvent.write(event);
|
||||
if (event.params) {
|
||||
event.params['USER_ID'] = userId;
|
||||
await hiSysEvent.write(event);
|
||||
}
|
||||
} catch (err) {
|
||||
HiLog.error(TAG, `sendDlpFileCreateFault failed, err: ${JSON.stringify(err)}`);
|
||||
}
|
||||
@ -218,8 +216,10 @@ struct DlpDialog {
|
||||
};
|
||||
try {
|
||||
let userId = await getUserId();
|
||||
event.params['USER_ID'] = userId;
|
||||
await hiSysEvent.write(event);
|
||||
if (event.params) {
|
||||
event.params['USER_ID'] = userId;
|
||||
await hiSysEvent.write(event);
|
||||
}
|
||||
} catch (err) {
|
||||
HiLog.error(TAG, `sendDlpFileCreateEvent, err: ${JSON.stringify(err)}`);
|
||||
}
|
||||
@ -420,7 +420,7 @@ struct DlpDialog {
|
||||
let dstFileSize: number = await getFileSizeByUri(uri);
|
||||
AppStorage.setOrCreate('hiPolicySizeEnc', dstFileSize);
|
||||
AppStorage.setOrCreate('hiCode', 201);
|
||||
sendDlpFileCreateProperties(); // 201: DLP_FILE_CREATE_SUCCESS
|
||||
sendDlpFileCreateProperties('DLP_FILE_CREATE_EVENT'); // 201: DLP_FILE_CREATE_SUCCESS
|
||||
GlobalContext.store('dlpFileName', uriInfo.name);
|
||||
GlobalContext.store('dlpProperty', _dlp);
|
||||
GlobalContext.store('uri', uri);
|
||||
@ -448,13 +448,8 @@ struct DlpDialog {
|
||||
this.staffDataArrayReadOnly = this.staffDataArrayReadOnly.filter((item) =>
|
||||
!this.staffDataArrayEdit.some((ele) => ele.authAccount === item.authAccount)
|
||||
);
|
||||
if (domainAccount) {
|
||||
property.ownerAccount = accountInfo.domainInfo.accountName;
|
||||
property.ownerAccountID = accountInfo.domainInfo.accountId ?? '';
|
||||
} else {
|
||||
property.ownerAccount = accountInfo.distributedInfo.name;
|
||||
property.ownerAccountID = accountInfo.distributedInfo.id;
|
||||
}
|
||||
property.ownerAccount = accountInfo.domainInfo.accountName;
|
||||
property.ownerAccountID = accountInfo.domainInfo.accountId ?? '';
|
||||
property.authUserList = [];
|
||||
property.everyoneAccessList = [];
|
||||
property.offlineAccess = this.selectedIndex === 0 ? true : false;
|
||||
@ -520,17 +515,10 @@ struct DlpDialog {
|
||||
}
|
||||
|
||||
async prepareDlpProperty() {
|
||||
if (domainAccount) {
|
||||
let accountInfo: osAccount.OsAccountInfo = GlobalContext.load('accountInfo') as osAccount.OsAccountInfo;
|
||||
this.dlpProperty.ownerAccount = accountInfo.domainInfo.accountName;
|
||||
this.dlpProperty.contactAccount = accountInfo.domainInfo.accountName;
|
||||
this.dlpProperty.ownerAccountID = accountInfo.domainInfo.accountId ?? '';
|
||||
} else {
|
||||
let accountInfo: osAccount.OsAccountInfo = GlobalContext.load('accountInfo') as osAccount.OsAccountInfo;
|
||||
this.dlpProperty.ownerAccount = accountInfo.distributedInfo.name;
|
||||
this.dlpProperty.contactAccount = accountInfo.distributedInfo.name;
|
||||
this.dlpProperty.ownerAccountID = accountInfo.distributedInfo.id;
|
||||
}
|
||||
let accountInfo: osAccount.OsAccountInfo = GlobalContext.load('accountInfo') as osAccount.OsAccountInfo;
|
||||
this.dlpProperty.ownerAccount = accountInfo.domainInfo.accountName;
|
||||
this.dlpProperty.contactAccount = accountInfo.domainInfo.accountName;
|
||||
this.dlpProperty.ownerAccountID = accountInfo.domainInfo.accountId ?? '';
|
||||
let ownerAccount: dlpPermission.AuthUser = {
|
||||
authAccount: this.dlpProperty.ownerAccount,
|
||||
dlpFileAccess: dlpPermission.DLPFileAccess.FULL_CONTROL,
|
||||
@ -912,11 +900,10 @@ struct DlpDialog {
|
||||
})
|
||||
}
|
||||
.visibility(this.processing ? Visibility.Hidden : Visibility.Visible)
|
||||
.width( domainAccount ? Constants.ENCRYPTION_PC_FIXING_WIDTH : Constants.HEADER_COLUMN_WIDTH)
|
||||
.width(Constants.ENCRYPTION_PC_FIXING_WIDTH)
|
||||
.backgroundColor($r('sys.color.ohos_id_color_dialog_bg'))
|
||||
.borderRadius($r('sys.float.ohos_id_corner_radius_dialog'))
|
||||
.constraintSize({ minWidth: domainAccount ?
|
||||
Constants.ENCRYPTION_PC_FIXING_WIDTH : Constants.ENCRYPTION_PC_FIXING_MINWIDTH })
|
||||
.constraintSize({minWidth: Constants.ENCRYPTION_PC_FIXING_WIDTH})
|
||||
.backgroundBlurStyle(BlurStyle.COMPONENT_ULTRA_THICK);
|
||||
}
|
||||
}
|
||||
|
@ -26,7 +26,6 @@ import {
|
||||
toggleShow,
|
||||
directionStatus,
|
||||
getTime,
|
||||
isPC
|
||||
} from '../common/utils';
|
||||
import GlobalContext from '../common/GlobalContext';
|
||||
import HomeFeature from '../feature/HomeFeature';
|
||||
@ -631,12 +630,12 @@ struct encryptionSuccess {
|
||||
right: Constants.FOOTER_ROW_PAD_RIGHT
|
||||
})
|
||||
}
|
||||
.width( isPC() ? Constants.ENCRYPTION_PC_FIXING_WIDTH : Constants.HEADER_COLUMN_WIDTH)
|
||||
.width(Constants.ENCRYPTION_PC_FIXING_WIDTH)
|
||||
.backgroundColor($r('sys.color.ohos_id_color_dialog_bg'))
|
||||
.borderRadius($r('sys.float.ohos_id_corner_radius_dialog'))
|
||||
.constraintSize({
|
||||
minWidth: isPC() ? Constants.ENCRYPTION_PC_FIXING_WIDTH : Constants.ENCRYPTION_PC_FIXING_MINWIDTH,
|
||||
minHeight: isPC() ? Constants.ENCRYPTION_LOADING_HEIGHT : Constants.ENCRYPTION_PC_FIXING_MINWIDTH
|
||||
minWidth: Constants.ENCRYPTION_PC_FIXING_WIDTH,
|
||||
minHeight: Constants.ENCRYPTION_LOADING_HEIGHT
|
||||
})
|
||||
.backgroundBlurStyle(BlurStyle.COMPONENT_ULTRA_THICK);
|
||||
}
|
||||
|
@ -17,7 +17,7 @@ import UIExtensionContentSession from '@ohos.app.ability.UIExtensionContentSessi
|
||||
import ability from '@ohos.ability.ability';
|
||||
import Constants from '../common/constant';
|
||||
import GlobalContext from '../common/GlobalContext';
|
||||
import { directionStatus, isPC } from '../common/utils';
|
||||
import { directionStatus } from '../common/utils';
|
||||
import common from '@ohos.app.ability.common';
|
||||
import { HiLog } from '../common/HiLog';
|
||||
|
||||
@ -333,12 +333,11 @@ struct PermissionStatus {
|
||||
right: Constants.FOOTER_ROW_PAD_RIGHT
|
||||
})
|
||||
}
|
||||
.width( isPC() ? Constants.ENCRYPTION_PC_FIXING_STATUS_WIDTH : Constants.HEADER_COLUMN_WIDTH)
|
||||
.width(Constants.ENCRYPTION_PC_FIXING_STATUS_WIDTH)
|
||||
.backgroundColor($r('sys.color.ohos_id_color_dialog_bg'))
|
||||
.borderRadius($r('sys.float.ohos_id_corner_radius_dialog'))
|
||||
.shadow(ShadowStyle.OUTER_DEFAULT_MD)
|
||||
.constraintSize({ minWidth: isPC() ?
|
||||
Constants.ENCRYPTION_PC_FIXING_STATUS_WIDTH : Constants.ENCRYPTION_PC_FIXING_MINWIDTH })
|
||||
.constraintSize({ minWidth: Constants.ENCRYPTION_PC_FIXING_STATUS_WIDTH })
|
||||
.backgroundBlurStyle(BlurStyle.COMPONENT_ULTRA_THICK);
|
||||
}
|
||||
}
|
||||
|
@ -88,6 +88,44 @@
|
||||
"description": "service",
|
||||
"type": "service",
|
||||
"exported": false
|
||||
},
|
||||
{
|
||||
"name": "EncryptedSharingAbility",
|
||||
"srcEntry": "./ets/EncryptedSharingAbility/EncryptedSharingAbility.ets",
|
||||
"icon": "$media:ic_public_lock",
|
||||
"label": "$string:EncryptedSharing",
|
||||
"description": "service",
|
||||
"type": "action",
|
||||
"exported": true,
|
||||
"skills": [
|
||||
{
|
||||
"actions": [
|
||||
"ohos.want.action.sendData"
|
||||
],
|
||||
"uris": [
|
||||
{
|
||||
"scheme": "file",
|
||||
"utd": "general.file",
|
||||
"maxFileSupported": 1
|
||||
},
|
||||
{
|
||||
"scheme": "file",
|
||||
"utd": "general.plain-text",
|
||||
"maxFileSupported": 1
|
||||
},
|
||||
{
|
||||
"scheme": "file",
|
||||
"utd": "com.adobe.pdf",
|
||||
"maxFileSupported": 1
|
||||
},
|
||||
{
|
||||
"scheme": "file",
|
||||
"utd": "org.openxmlformats.openxml",
|
||||
"maxFileSupported": 1
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"requestPermissions": [
|
||||
|
@ -101,6 +101,44 @@
|
||||
"description": "service",
|
||||
"type": "service",
|
||||
"exported": false
|
||||
},
|
||||
{
|
||||
"name": "EncryptedSharingAbility",
|
||||
"srcEntry": "./ets/EncryptedSharingAbility/EncryptedSharingAbility.ets",
|
||||
"icon": "$media:ic_public_lock",
|
||||
"label": "$string:EncryptedSharing",
|
||||
"description": "service",
|
||||
"type": "action",
|
||||
"exported": true,
|
||||
"skills": [
|
||||
{
|
||||
"actions": [
|
||||
"ohos.want.action.sendData"
|
||||
],
|
||||
"uris": [
|
||||
{
|
||||
"scheme": "file",
|
||||
"utd": "general.file",
|
||||
"maxFileSupported": 1
|
||||
},
|
||||
{
|
||||
"scheme": "file",
|
||||
"utd": "general.plain-text",
|
||||
"maxFileSupported": 1
|
||||
},
|
||||
{
|
||||
"scheme": "file",
|
||||
"utd": "com.adobe.pdf",
|
||||
"maxFileSupported": 1
|
||||
},
|
||||
{
|
||||
"scheme": "file",
|
||||
"utd": "org.openxmlformats.openxml",
|
||||
"maxFileSupported": 1
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"requestPermissions": [
|
||||
|
@ -16,6 +16,10 @@
|
||||
"name": "ViewAbility_desc",
|
||||
"value": "DLPViewer"
|
||||
},
|
||||
{
|
||||
"name": "EncryptedSharing",
|
||||
"value": "EncryptedSharing"
|
||||
},
|
||||
{
|
||||
"name": "ban",
|
||||
"value": "Cancel"
|
||||
@ -200,6 +204,10 @@
|
||||
"name": "MESSAGE_APP_NOT_HAVE_PERM_VISIT",
|
||||
"value": "You don't have permission to view this file. To apply for permission, contact %s."
|
||||
},
|
||||
{
|
||||
"name": "MESSAGE_APP_NOT_HAVE_PERM",
|
||||
"value": "You don't have permission to view this file."
|
||||
},
|
||||
{
|
||||
"name": "MESSAGE_APP_FILE_PARAM_ERROR",
|
||||
"value": "Unable to open file. Check and try again."
|
||||
@ -299,6 +307,34 @@
|
||||
{
|
||||
"name": "TITLE_APP_VERSION_LOWER",
|
||||
"value": "System update required"
|
||||
},
|
||||
{
|
||||
"name": "Share_Add_Viewable_Users",
|
||||
"value": "Add Viewable Users"
|
||||
},
|
||||
{
|
||||
"name": "Share_Enter_Mobile_Number",
|
||||
"value": "Enter the bound mobile number"
|
||||
},
|
||||
{
|
||||
"name": "Share_Only_Supported_Mobile_Number",
|
||||
"value": "Currently, only mobile numbers are supported."
|
||||
},
|
||||
{
|
||||
"name": "Share_Tips_Phone_Format",
|
||||
"value": "Enter a mobile number in the correct format."
|
||||
},
|
||||
{
|
||||
"name": "Share_Confirms",
|
||||
"value": "Confirms"
|
||||
},
|
||||
{
|
||||
"name": "Share_File_Encrypted_Success",
|
||||
"value": "File encrypted successfully."
|
||||
},
|
||||
{
|
||||
"name": "Share_File_Encrypted_Failed",
|
||||
"value": "Failed to encrypt the file."
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg width="24px" height="24px" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<title>Public/ic_public_contacts_group</title>
|
||||
<defs>
|
||||
<path d="M11,2.5 C13.8994949,2.5 16.25,4.85050506 16.25,7.75 C16.25,9.51473805 15.3792831,11.0761093 14.0440228,12.0279401 C17.516287,13.2752612 20,16.5975795 20,20.5 C20,20.9142136 19.6642136,21.25 19.25,21.25 C18.8357864,21.25 18.5,20.9142136 18.5,20.5 C18.5,16.3578644 15.1421356,13 11,13 C6.85786438,13 3.5,16.3578644 3.5,20.5 C3.5,20.8796958 3.21784612,21.193491 2.85177056,21.2431534 L2.75,21.25 L2.75,21.25 C2.33578644,21.25 2,20.9142136 2,20.5 C2,16.5975795 4.48371302,13.2752612 7.95660209,12.0275821 C6.62071692,11.0761093 5.75,9.51473805 5.75,7.75 C5.75,4.85050506 8.10050506,2.5 11,2.5 Z M16.8455126,11.990365 L16.9001786,11.9998698 L16.9001786,11.9998698 C20.1151694,13.1058156 21.5244976,15.7436283 21.9852941,16.7777778 C22.1978509,17.2548115 22.3699793,17.8850275 22.5016794,18.6684258 C22.6803621,19.731297 21.9852991,20.7391431 20.939535,20.957517 C20.9790064,20.8115098 21,20.6582066 21,20.5 L20.9991975,20.3725581 C20.9583277,17.1285533 19.3592048,14.1922682 16.8371835,12.3780488 C16.8267847,12.3705684 16.8087299,12.357267 16.7830192,12.3381447 L16.7386575,12.3051674 C16.6613354,12.2473649 16.6455116,12.1378247 16.7033141,12.0605026 C16.7374229,12.0148754 16.790703,11.989685 16.8455126,11.990365 Z M11,4 C8.92893219,4 7.25,5.67893219 7.25,7.75 C7.25,9.82106781 8.92893219,11.5 11,11.5 C13.0710678,11.5 14.75,9.82106781 14.75,7.75 C14.75,5.67893219 13.0710678,4 11,4 Z M14.3933827,2.26605683 C16.8326968,2.46603293 18.75,4.50911139 18.75,7 C18.75,8.63466202 17.9242699,10.0764644 16.6671636,10.9310533 L16.6534314,10.9403132 L16.6534314,10.9403132 L16.6390036,10.9498595 C16.582224,10.9872983 16.505845,10.9716194 16.4684062,10.9148398 C16.4515547,10.8892829 16.445116,10.8588907 16.4493121,10.8295803 L16.4636103,10.7871659 L16.4636103,10.7871659 C16.9705014,9.8763586 17.25,8.83638014 17.25,7.75 C17.25,5.54150753 16.1045197,3.60055631 14.3752757,2.48882859 C14.3740147,2.48801791 14.3670156,2.48382955 14.3542783,2.4762635 L14.3308634,2.4623901 C14.2806258,2.43263244 14.2640236,2.36778346 14.2937812,2.31754587 C14.3143973,2.28274139 14.3530659,2.26275164 14.3933827,2.26605683 Z" id="path-1"></path>
|
||||
</defs>
|
||||
<g id="Public/ic_public_contacts_group" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
||||
<mask id="mask-2" fill="white">
|
||||
<use xlink:href="#path-1"></use>
|
||||
</mask>
|
||||
<use id="蒙版" fill="#000000" fill-rule="nonzero" xlink:href="#path-1"></use>
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 2.6 KiB |
13
entry/src/main/resources/base/media/ic_public_lock.svg
Normal file
13
entry/src/main/resources/base/media/ic_public_lock.svg
Normal file
@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<svg width="24px" height="24px" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<title>Public/ic_public_lock</title>
|
||||
<defs>
|
||||
<path d="M12,2 C14.3202308,2 16.206199,3.85929891 16.249248,6.16924008 L16.25,6.25 L16.25,9 L16.5,9 C18.1568542,9 19.5,10.3431458 19.5,12 L19.5,18.5 C19.5,20.1568542 18.1568542,21.5 16.5,21.5 L7.5,21.5 C5.84314575,21.5 4.5,20.1568542 4.5,18.5 L4.5,12 C4.5,10.3431458 5.84314575,9 7.5,9 L7.75,9 L7.75,6.25 C7.75,3.90278981 9.65278981,2 12,2 Z M16.5,10.5 L7.5,10.5 C6.69040076,10.5 6.03060706,11.1413937 6.00103462,11.9437654 L6,12 L6,18.5 C6,19.3095992 6.64139372,19.9693929 7.44376543,19.9989654 L7.5,20 L16.5,20 C17.3095992,20 17.9693929,19.3586063 17.9989654,18.5562346 L18,18.5 L18,12 C18,11.1904008 17.3586063,10.5306071 16.5562346,10.5010346 L16.5,10.5 Z M12,13.25 C13.1045695,13.25 14,14.1454305 14,15.25 C14,16.3545695 13.1045695,17.25 12,17.25 C10.8954305,17.25 10,16.3545695 10,15.25 C10,14.1454305 10.8954305,13.25 12,13.25 Z M12,3.5 C10.5053246,3.5 9.28915871,4.69244089 9.25092685,6.17789813 L9.25,9 L14.75,9 L14.75,6.25 C14.75,4.73121694 13.5187831,3.5 12,3.5 Z" id="path-1"></path>
|
||||
</defs>
|
||||
<g id="Public/ic_public_lock" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
||||
<mask id="mask-2" fill="white">
|
||||
<use xlink:href="#path-1"></use>
|
||||
</mask>
|
||||
<use id="形状结合" fill="#000000" fill-rule="nonzero" xlink:href="#path-1"></use>
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 1.5 KiB |
@ -4,6 +4,7 @@
|
||||
"pages/encryptionProtection",
|
||||
"pages/encryptionSuccess",
|
||||
"pages/changeEncryption",
|
||||
"pages/permissionStatus"
|
||||
"pages/permissionStatus",
|
||||
"pages/encryptedSharing"
|
||||
]
|
||||
}
|
||||
|
@ -16,6 +16,10 @@
|
||||
"name": "ViewAbility_desc",
|
||||
"value": "DLPViewer"
|
||||
},
|
||||
{
|
||||
"name": "EncryptedSharing",
|
||||
"value": "加密分享"
|
||||
},
|
||||
{
|
||||
"name": "ban",
|
||||
"value": "取消"
|
||||
@ -200,6 +204,10 @@
|
||||
"name": "MESSAGE_APP_NOT_HAVE_PERM_VISIT",
|
||||
"value": "您没有权限查看此文件。如需申请权限,请联系:%s"
|
||||
},
|
||||
{
|
||||
"name": "MESSAGE_APP_NOT_HAVE_PERM",
|
||||
"value": "您没有权限查看此文件。"
|
||||
},
|
||||
{
|
||||
"name": "MESSAGE_APP_FILE_PARAM_ERROR",
|
||||
"value": "无法打开此文件。请检查后重试。"
|
||||
@ -299,6 +307,34 @@
|
||||
{
|
||||
"name": "TITLE_APP_VERSION_LOWER",
|
||||
"value": "系统版本过低"
|
||||
},
|
||||
{
|
||||
"name": "Share_Add_Viewable_Users",
|
||||
"value": "添加可查看用户"
|
||||
},
|
||||
{
|
||||
"name": "Share_Enter_Mobile_Number",
|
||||
"value": "输入绑定的手机号码"
|
||||
},
|
||||
{
|
||||
"name": "Share_Only_Supported_Mobile_Number",
|
||||
"value": "当前仅支持输入手机号码"
|
||||
},
|
||||
{
|
||||
"name": "Share_Tips_Phone_Format",
|
||||
"value": "请输入正确格式的手机号"
|
||||
},
|
||||
{
|
||||
"name": "Share_Confirms",
|
||||
"value": "确认"
|
||||
},
|
||||
{
|
||||
"name": "Share_File_Encrypted_Success",
|
||||
"value": "文件加密成功"
|
||||
},
|
||||
{
|
||||
"name": "Share_File_Encrypted_Failed",
|
||||
"value": "文件加密失败"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user