mirror of
https://gitee.com/openharmony/applications_dlp_manager
synced 2024-11-23 09:59:57 +00:00
commit
4b7fed8932
@ -37,7 +37,7 @@ import {
|
|||||||
} from '../common/utils';
|
} from '../common/utils';
|
||||||
import GlobalContext from '../common/GlobalContext';
|
import GlobalContext from '../common/GlobalContext';
|
||||||
import HomeFeature from '../feature/HomeFeature';
|
import HomeFeature from '../feature/HomeFeature';
|
||||||
import { AccountTipsConfig } from '../common/AccountTipsConfig';
|
import { AccountTipsConfig } from '../component/AccountTipsConfig';
|
||||||
import common from '@ohos.app.ability.common';
|
import common from '@ohos.app.ability.common';
|
||||||
import { GetAlertMessage } from '../common/GetAlertMessage';
|
import { GetAlertMessage } from '../common/GetAlertMessage';
|
||||||
import { HiLog } from '../common/HiLog';
|
import { HiLog } from '../common/HiLog';
|
||||||
|
@ -1,83 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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';
|
|
||||||
import Constants from '../constant';
|
|
||||||
|
|
||||||
const TAG = 'CredCallbackStub';
|
|
||||||
|
|
||||||
export default class CredCallbackStub extends rpc.RemoteObject {
|
|
||||||
private connectService: ConnectService = new ConnectService(getContext(this));
|
|
||||||
private static readonly DESCRIPTOR: string = 'OHOS.HapDlpCredAbilityServiceStub';
|
|
||||||
|
|
||||||
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}`);
|
|
||||||
try {
|
|
||||||
if (data.readInterfaceToken() !== CredCallbackStub.DESCRIPTOR) {
|
|
||||||
HiLog.info(TAG, `DESCRIPTOR unmatched.`);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
} catch (error) {
|
|
||||||
HiLog.error(TAG, `read data exception, error is ${JSON.stringify(error)}`);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
switch (code) {
|
|
||||||
case Constants.COMMAND_SEARCH_USER_INFO: {
|
|
||||||
let storage = LocalStorage.getShared();
|
|
||||||
HiLog.info(TAG, `onRemoteMessageRequest command search user info`);
|
|
||||||
let resultVar = '';
|
|
||||||
try {
|
|
||||||
resultVar = data.readString();
|
|
||||||
} catch (error) {
|
|
||||||
HiLog.error(TAG, `read string exception, error is ${JSON.stringify(error)}`);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
storage.setOrCreate('commandSearchUserInfo', resultVar);
|
|
||||||
this.connectService.disconnectServiceShareAbility();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
case Constants.COMMAND_GET_ACCOUNT_INFO: {
|
|
||||||
let storage = LocalStorage.getShared();
|
|
||||||
HiLog.info(TAG, `onRemoteMessageRequest command get account info`);
|
|
||||||
let resultVar = '';
|
|
||||||
try {
|
|
||||||
resultVar = data.readString();
|
|
||||||
} catch (error) {
|
|
||||||
HiLog.error(TAG, `read string exception, error is ${JSON.stringify(error)}`);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
storage.setOrCreate('commandGetAccountInfo', resultVar);
|
|
||||||
this.connectService.disconnectServiceShareAbility();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
default: {
|
|
||||||
HiLog.error(TAG, `invalid request code: ${code}`);
|
|
||||||
this.connectService.disconnectServiceShareAbility();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
@ -19,7 +19,7 @@ import resourceManager from '@ohos.resourceManager';
|
|||||||
import util from '@ohos.util';
|
import util from '@ohos.util';
|
||||||
import osAccount from '@ohos.account.osAccount';
|
import osAccount from '@ohos.account.osAccount';
|
||||||
import { BusinessError } from '@ohos.base';
|
import { BusinessError } from '@ohos.base';
|
||||||
import GlobalContext from './GlobalContext';
|
import GlobalContext from '../common/GlobalContext';
|
||||||
import I18n from '@ohos.i18n';
|
import I18n from '@ohos.i18n';
|
||||||
import { HiLog } from '../common/HiLog';
|
import { HiLog } from '../common/HiLog';
|
||||||
|
|
@ -15,13 +15,13 @@
|
|||||||
|
|
||||||
import { BusinessError } from '@ohos.base';
|
import { BusinessError } from '@ohos.base';
|
||||||
import { staffItem } from './staff';
|
import { staffItem } from './staff';
|
||||||
import Constants from '../constant';
|
import Constants from '../../common/constant';
|
||||||
import { AccountTipsConfig } from '../AccountTipsConfig';
|
import { AccountTipsConfig } from '../AccountTipsConfig';
|
||||||
import { HiLog } from '../HiLog';
|
import { HiLog } from '../../common/HiLog';
|
||||||
import CommonUtil from '../CommonUtil';
|
import CommonUtil from '../../common/CommonUtil';
|
||||||
import AccountManager from '../../manager/AccountManager';
|
import AccountManager from '../../manager/AccountManager';
|
||||||
import DomainAccountResponse from '../../bean/response/DomainAccountResponse';
|
import DomainAccountResponse from '../../bean/response/DomainAccountResponse';
|
||||||
import AppStorageConstant from '../constant/AppStorageConstant';
|
import AppStorageConstant from '../../common/constant/AppStorageConstant';
|
||||||
import { common } from '@kit.AbilityKit';
|
import { common } from '@kit.AbilityKit';
|
||||||
import DomainAccountInfo from '../../bean/data/DomainAccountInfo';
|
import DomainAccountInfo from '../../bean/data/DomainAccountInfo';
|
||||||
|
|
@ -1,76 +1,76 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2023 Huawei Device Co., Ltd.
|
* Copyright (c) 2023 Huawei Device Co., Ltd.
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
* You may obtain a copy of the License at
|
* You may obtain a copy of the License at
|
||||||
*
|
*
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
*
|
*
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import Constants from '../constant';
|
import Constants from '../../common/constant';
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
struct EncryptingPanel {
|
struct EncryptingPanel {
|
||||||
@Link processing: boolean;
|
@Link processing: boolean;
|
||||||
@Prop loadingType: number = 0;
|
@Prop loadingType: number = 0;
|
||||||
|
|
||||||
loadingText() {
|
loadingText() {
|
||||||
if (this.loadingType === Constants.LOAD_TYPE_CE) {
|
if (this.loadingType === Constants.LOAD_TYPE_CE) {
|
||||||
return $r('app.string.loading_title');
|
return $r('app.string.loading_title');
|
||||||
} else {
|
} else {
|
||||||
return $r('app.string.encryption_loading_title');
|
return $r('app.string.encryption_loading_title');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
build() {
|
build() {
|
||||||
if (this.processing) {
|
if (this.processing) {
|
||||||
Flex({ justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center,
|
Flex({ justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center,
|
||||||
direction: FlexDirection.Column }) {
|
direction: FlexDirection.Column }) {
|
||||||
Flex({ alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
|
Flex({ alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
|
||||||
Column() {
|
Column() {
|
||||||
Row() {
|
Row() {
|
||||||
Text($r('app.string.header_title'))
|
Text($r('app.string.header_title'))
|
||||||
.fontWeight(FontWeight.Bold)
|
.fontWeight(FontWeight.Bold)
|
||||||
.fontFamily($r('app.string.typeface'))
|
.fontFamily($r('app.string.typeface'))
|
||||||
.fontColor($r('sys.color.ohos_id_color_text_primary'))
|
.fontColor($r('sys.color.ohos_id_color_text_primary'))
|
||||||
.fontSize($r('sys.float.ohos_id_text_size_dialog_tittle'))
|
.fontSize($r('sys.float.ohos_id_text_size_dialog_tittle'))
|
||||||
.width(Constants.HEADER_TEXT_WIDTH)
|
.width(Constants.HEADER_TEXT_WIDTH)
|
||||||
.align(Alignment.Start)
|
.align(Alignment.Start)
|
||||||
}
|
}
|
||||||
.width(Constants.HEADER_COLUMN_WIDTH)
|
.width(Constants.HEADER_COLUMN_WIDTH)
|
||||||
.height(Constants.HEADER_COLUMN_HEIGHT)
|
.height(Constants.HEADER_COLUMN_HEIGHT)
|
||||||
.padding({
|
.padding({
|
||||||
left: Constants.HEADER_COLUMN_PADDING_LEFT,
|
left: Constants.HEADER_COLUMN_PADDING_LEFT,
|
||||||
right: Constants.HEADER_COLUMN_PADDING_RIGHT
|
right: Constants.HEADER_COLUMN_PADDING_RIGHT
|
||||||
})
|
})
|
||||||
Column() {
|
Column() {
|
||||||
LoadingProgress()
|
LoadingProgress()
|
||||||
.color($r('sys.color.ohos_id_color_progress'))
|
.color($r('sys.color.ohos_id_color_progress'))
|
||||||
.height(Constants.ENCRYPTION_LOADING_ICON_HEIGHT)
|
.height(Constants.ENCRYPTION_LOADING_ICON_HEIGHT)
|
||||||
.width(Constants.ENCRYPTION_LOADING_ICON_HEIGHT)
|
.width(Constants.ENCRYPTION_LOADING_ICON_HEIGHT)
|
||||||
Text(this.loadingText())
|
Text(this.loadingText())
|
||||||
.fontSize($r('sys.float.ohos_id_text_size_body2'))
|
.fontSize($r('sys.float.ohos_id_text_size_body2'))
|
||||||
.fontColor($r('sys.color.ohos_id_color_text_secondary'))
|
.fontColor($r('sys.color.ohos_id_color_text_secondary'))
|
||||||
}
|
}
|
||||||
.height(Constants.ENCRYPTION_LOADING_CONTENT_HEIGHT)
|
.height(Constants.ENCRYPTION_LOADING_CONTENT_HEIGHT)
|
||||||
.alignItems(HorizontalAlign.Center)
|
.alignItems(HorizontalAlign.Center)
|
||||||
.justifyContent(FlexAlign.Center)
|
.justifyContent(FlexAlign.Center)
|
||||||
}
|
}
|
||||||
.width(Constants.ENCRYPTION_PC_FIXING_WIDTH)
|
.width(Constants.ENCRYPTION_PC_FIXING_WIDTH)
|
||||||
.height(Constants.ENCRYPTION_LOADING_HEIGHT)
|
.height(Constants.ENCRYPTION_LOADING_HEIGHT)
|
||||||
.backgroundColor($r('sys.color.ohos_id_color_dialog_bg'))
|
.backgroundColor($r('sys.color.ohos_id_color_dialog_bg'))
|
||||||
.borderRadius($r('sys.float.ohos_id_corner_radius_dialog'))
|
.borderRadius($r('sys.float.ohos_id_corner_radius_dialog'))
|
||||||
.constraintSize({ minWidth: Constants.ENCRYPTION_PC_FIXING_WIDTH })
|
.constraintSize({ minWidth: Constants.ENCRYPTION_PC_FIXING_WIDTH })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export { EncryptingPanel };
|
export { EncryptingPanel };
|
@ -1,174 +1,174 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2023 Huawei Device Co., Ltd.
|
* Copyright (c) 2023 Huawei Device Co., Ltd.
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
* You may obtain a copy of the License at
|
* You may obtain a copy of the License at
|
||||||
*
|
*
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
*
|
*
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import Constants from '../constant';
|
import Constants from '../../common/constant';
|
||||||
import { AuthAccount, PermissionType } from '../utils';
|
import { AuthAccount, PermissionType } from '../../common/utils';
|
||||||
|
|
||||||
const TAG = 'Select';
|
const TAG = 'Select';
|
||||||
|
|
||||||
@Extend(MenuItem)
|
@Extend(MenuItem)
|
||||||
function timeTextStyle() {
|
function timeTextStyle() {
|
||||||
.labelFont({ size: $r('sys.float.ohos_id_text_size_body1'), weight: FontWeight.Regular })
|
.labelFont({ size: $r('sys.float.ohos_id_text_size_body1'), weight: FontWeight.Regular })
|
||||||
.margin({
|
.margin({
|
||||||
left: Constants.ENCRYPTION_PROTECTION_TIME_MENU_MARGIN_LEFT,
|
left: Constants.ENCRYPTION_PROTECTION_TIME_MENU_MARGIN_LEFT,
|
||||||
right: Constants.ENCRYPTION_PROTECTION_TIME_MENU_MARGIN_RIGHT
|
right: Constants.ENCRYPTION_PROTECTION_TIME_MENU_MARGIN_RIGHT
|
||||||
})
|
})
|
||||||
.padding({
|
.padding({
|
||||||
left: Constants.ENCRYPTION_PROTECTION_TIME_MENU_PADDING_LEFT,
|
left: Constants.ENCRYPTION_PROTECTION_TIME_MENU_PADDING_LEFT,
|
||||||
right: Constants.ENCRYPTION_PROTECTION_TIME_MENU_PADDING_RIGHT,
|
right: Constants.ENCRYPTION_PROTECTION_TIME_MENU_PADDING_RIGHT,
|
||||||
})
|
})
|
||||||
.borderRadius($r('sys.float.ohos_id_corner_radius_default_m'))
|
.borderRadius($r('sys.float.ohos_id_corner_radius_default_m'))
|
||||||
}
|
}
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
struct permissionTypeSelect {
|
struct permissionTypeSelect {
|
||||||
@State index: number = 0;
|
@State index: number = 0;
|
||||||
@Prop isReadType: boolean = false;
|
@Prop isReadType: boolean = false;
|
||||||
@State permissionTypes: PermissionType[] = [
|
@State permissionTypes: PermissionType[] = [
|
||||||
{ value: $r('app.string.PERMISSION_TYPE_SELECT_TARGET'), data: 'target', index: 0 },
|
{ value: $r('app.string.PERMISSION_TYPE_SELECT_TARGET'), data: 'target', index: 0 },
|
||||||
{ value: $r('app.string.PERMISSION_TYPE_SELECT_ALL'), data: 'all', index: 1 },
|
{ value: $r('app.string.PERMISSION_TYPE_SELECT_ALL'), data: 'all', index: 1 },
|
||||||
{ value: $r('app.string.PERMISSION_TYPE_SELECT_SELF'), data: 'self', index: 2 }
|
{ value: $r('app.string.PERMISSION_TYPE_SELECT_SELF'), data: 'self', index: 2 }
|
||||||
];
|
];
|
||||||
@Link @Watch('selectedItemUpdated') selectedItem: PermissionType;
|
@Link @Watch('selectedItemUpdated') selectedItem: PermissionType;
|
||||||
@Link staffArray: AuthAccount[];
|
@Link staffArray: AuthAccount[];
|
||||||
@Prop @Watch('onCountUpdated') isDisable: boolean = false;
|
@Prop @Watch('onCountUpdated') isDisable: boolean = false;
|
||||||
|
|
||||||
onCountUpdated(isDisable: boolean): void {
|
onCountUpdated(isDisable: boolean): void {
|
||||||
if (this.isReadType) {
|
if (this.isReadType) {
|
||||||
if (this.isDisable) {
|
if (this.isDisable) {
|
||||||
this.selectedItem = this.permissionTypes[Constants.ENCRYPTION_TYPE_SELECT];
|
this.selectedItem = this.permissionTypes[Constants.ENCRYPTION_TYPE_SELECT];
|
||||||
this.index = Constants.ENCRYPTION_TYPE_SELECT;
|
this.index = Constants.ENCRYPTION_TYPE_SELECT;
|
||||||
} else {
|
} else {
|
||||||
this.selectedItem = this.permissionTypes[Constants.ENCRYPTION_TYPE_SELECT_INDEX];
|
this.selectedItem = this.permissionTypes[Constants.ENCRYPTION_TYPE_SELECT_INDEX];
|
||||||
this.index = Constants.ENCRYPTION_TYPE_SELECT_INDEX;
|
this.index = Constants.ENCRYPTION_TYPE_SELECT_INDEX;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
selectedItemUpdated(selectedItem: object): void {
|
selectedItemUpdated(selectedItem: object): void {
|
||||||
this.index = this.selectedItem.index;
|
this.index = this.selectedItem.index;
|
||||||
}
|
}
|
||||||
|
|
||||||
aboutToAppear() {
|
aboutToAppear() {
|
||||||
if (this.isReadType) {
|
if (this.isReadType) {
|
||||||
this.permissionTypes = this.permissionTypes.filter(item => {
|
this.permissionTypes = this.permissionTypes.filter(item => {
|
||||||
return item.data !== 'self';
|
return item.data !== 'self';
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
let selectIndex = this.selectedItem.index === -1 ? 0 : this.selectedItem.index;
|
let selectIndex = this.selectedItem.index === -1 ? 0 : this.selectedItem.index;
|
||||||
this.selectedItem = this.permissionTypes[selectIndex];
|
this.selectedItem = this.permissionTypes[selectIndex];
|
||||||
}, Constants.ENCRYPTION_SET_TIMEOUT_TIME)
|
}, Constants.ENCRYPTION_SET_TIMEOUT_TIME)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Builder
|
@Builder
|
||||||
PermissionTypeMenu() {
|
PermissionTypeMenu() {
|
||||||
Menu() {
|
Menu() {
|
||||||
ForEach(this.permissionTypes, (item: PermissionType) => {
|
ForEach(this.permissionTypes, (item: PermissionType) => {
|
||||||
MenuItem({ content: item.value })
|
MenuItem({ content: item.value })
|
||||||
.selected(this.index === item.index)
|
.selected(this.index === item.index)
|
||||||
.selectIcon(true)
|
.selectIcon(true)
|
||||||
.onChange(() => {
|
.onChange(() => {
|
||||||
this.index = item.index;
|
this.index = item.index;
|
||||||
this.selectedItem = this.permissionTypes[item.index];
|
this.selectedItem = this.permissionTypes[item.index];
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
build() {
|
build() {
|
||||||
Row() {
|
Row() {
|
||||||
Text() {
|
Text() {
|
||||||
Span(this.permissionTypes[this.index].value)
|
Span(this.permissionTypes[this.index].value)
|
||||||
Span(`${this.selectedItem?.data === 'target' && this.staffArray.length > 0 ?
|
Span(`${this.selectedItem?.data === 'target' && this.staffArray.length > 0 ?
|
||||||
` (${this.staffArray.length})` : ''}`)
|
` (${this.staffArray.length})` : ''}`)
|
||||||
}
|
}
|
||||||
.fontSize($r('sys.float.ohos_id_text_size_body2'))
|
.fontSize($r('sys.float.ohos_id_text_size_body2'))
|
||||||
.fontWeight(FontWeight.Medium)
|
.fontWeight(FontWeight.Medium)
|
||||||
.fontColor($r('sys.color.ohos_id_color_text_secondary'));
|
.fontColor($r('sys.color.ohos_id_color_text_secondary'));
|
||||||
|
|
||||||
SymbolGlyph($r('sys.symbol.arrowtriangle_down_fill'))
|
SymbolGlyph($r('sys.symbol.arrowtriangle_down_fill'))
|
||||||
.fontSize(`${Constants.VALIDITY_IMAGE_WIDTH}vp`)
|
.fontSize(`${Constants.VALIDITY_IMAGE_WIDTH}vp`)
|
||||||
.fontColor([$r('sys.color.ohos_id_color_tertiary')])
|
.fontColor([$r('sys.color.ohos_id_color_tertiary')])
|
||||||
.margin({
|
.margin({
|
||||||
left: Constants.VALIDITY_IMAGE_PADDING_LEFT,
|
left: Constants.VALIDITY_IMAGE_PADDING_LEFT,
|
||||||
right: Constants.VALIDITY_IMAGE_PADDING_RIGHT
|
right: Constants.VALIDITY_IMAGE_PADDING_RIGHT
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
.opacity(this.isDisable ? Constants.DU_LINE_WIDTH : Constants.FOOTER_OPACITY_ONE)
|
.opacity(this.isDisable ? Constants.DU_LINE_WIDTH : Constants.FOOTER_OPACITY_ONE)
|
||||||
.enabled(this.isDisable ? false : true)
|
.enabled(this.isDisable ? false : true)
|
||||||
.bindMenu(this.PermissionTypeMenu, { placement: Placement.BottomRight, showInSubWindow: false });
|
.bindMenu(this.PermissionTypeMenu, { placement: Placement.BottomRight, showInSubWindow: false });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
struct validDateTypeMenuItem {
|
struct validDateTypeMenuItem {
|
||||||
@Link selectedIndex: number;
|
@Link selectedIndex: number;
|
||||||
@State perMissionTypes: PermissionType[] = [
|
@State perMissionTypes: PermissionType[] = [
|
||||||
{ value: $r('app.string.permanently'), data: 'permanently', index: 0 },
|
{ value: $r('app.string.permanently'), data: 'permanently', index: 0 },
|
||||||
{ value: $r('app.string.Appointed_day'), data: 'Appointed_day', index: 1 }
|
{ value: $r('app.string.Appointed_day'), data: 'Appointed_day', index: 1 }
|
||||||
];
|
];
|
||||||
|
|
||||||
build() {
|
build() {
|
||||||
Menu() {
|
Menu() {
|
||||||
ForEach(this.perMissionTypes, (item: PermissionType) => {
|
ForEach(this.perMissionTypes, (item: PermissionType) => {
|
||||||
MenuItem({ content: item.value })
|
MenuItem({ content: item.value })
|
||||||
.selected(this.selectedIndex === item.index)
|
.selected(this.selectedIndex === item.index)
|
||||||
.selectIcon(true)
|
.selectIcon(true)
|
||||||
.timeTextStyle()
|
.timeTextStyle()
|
||||||
.onChange(() => {
|
.onChange(() => {
|
||||||
this.selectedIndex = item.index;
|
this.selectedIndex = item.index;
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
struct validDateTypeMenu {
|
struct validDateTypeMenu {
|
||||||
@Link selectedIndex: number;
|
@Link selectedIndex: number;
|
||||||
@Prop isDisable: boolean = false;
|
@Prop isDisable: boolean = false;
|
||||||
@State validDateTypes: PermissionType[] = [
|
@State validDateTypes: PermissionType[] = [
|
||||||
{ value: $r('app.string.permanently'), data: 'permanently', index: 0 },
|
{ value: $r('app.string.permanently'), data: 'permanently', index: 0 },
|
||||||
{ value: $r('app.string.Appointed_day'), data: 'Appointed_day', index: 1 }
|
{ value: $r('app.string.Appointed_day'), data: 'Appointed_day', index: 1 }
|
||||||
];
|
];
|
||||||
|
|
||||||
@Builder
|
@Builder
|
||||||
ValidDateMenuItem() {
|
ValidDateMenuItem() {
|
||||||
validDateTypeMenuItem({ selectedIndex: $selectedIndex });
|
validDateTypeMenuItem({ selectedIndex: $selectedIndex });
|
||||||
}
|
}
|
||||||
|
|
||||||
build() {
|
build() {
|
||||||
Row() {
|
Row() {
|
||||||
Text(this.validDateTypes[this.selectedIndex].value)
|
Text(this.validDateTypes[this.selectedIndex].value)
|
||||||
.fontSize($r('sys.float.ohos_id_text_size_body2'))
|
.fontSize($r('sys.float.ohos_id_text_size_body2'))
|
||||||
.fontWeight(FontWeight.Medium)
|
.fontWeight(FontWeight.Medium)
|
||||||
.fontColor($r('sys.color.ohos_id_color_text_secondary'));
|
.fontColor($r('sys.color.ohos_id_color_text_secondary'));
|
||||||
|
|
||||||
SymbolGlyph($r('sys.symbol.arrowtriangle_down_fill'))
|
SymbolGlyph($r('sys.symbol.arrowtriangle_down_fill'))
|
||||||
.fontSize(`${Constants.VALIDITY_IMAGE_WIDTH}vp`)
|
.fontSize(`${Constants.VALIDITY_IMAGE_WIDTH}vp`)
|
||||||
.fontColor([$r('sys.color.ohos_id_color_tertiary')])
|
.fontColor([$r('sys.color.ohos_id_color_tertiary')])
|
||||||
.margin({
|
.margin({
|
||||||
left: Constants.VALIDITY_IMAGE_PADDING_LEFT,
|
left: Constants.VALIDITY_IMAGE_PADDING_LEFT,
|
||||||
right: Constants.VALIDITY_IMAGE_PADDING_RIGHT
|
right: Constants.VALIDITY_IMAGE_PADDING_RIGHT
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
.opacity(this.isDisable ? Constants.DU_LINE_WIDTH : Constants.FOOTER_OPACITY_ONE)
|
.opacity(this.isDisable ? Constants.DU_LINE_WIDTH : Constants.FOOTER_OPACITY_ONE)
|
||||||
.enabled(this.isDisable ? false : true)
|
.enabled(this.isDisable ? false : true)
|
||||||
.bindMenu(this.ValidDateMenuItem(), { placement: Placement.BottomRight, showInSubWindow: false });
|
.bindMenu(this.ValidDateMenuItem(), { placement: Placement.BottomRight, showInSubWindow: false });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export { permissionTypeSelect, validDateTypeMenuItem, validDateTypeMenu };
|
export { permissionTypeSelect, validDateTypeMenuItem, validDateTypeMenu };
|
@ -1,211 +1,211 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2023 Huawei Device Co., Ltd.
|
* Copyright (c) 2023 Huawei Device Co., Ltd.
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
* You may obtain a copy of the License at
|
* You may obtain a copy of the License at
|
||||||
*
|
*
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
*
|
*
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import account_osAccount from '@ohos.account.osAccount';
|
import account_osAccount from '@ohos.account.osAccount';
|
||||||
import common from '@ohos.app.ability.common';
|
import common from '@ohos.app.ability.common';
|
||||||
import { BusinessError } from '@ohos.base';
|
import { BusinessError } from '@ohos.base';
|
||||||
import Constants from '../constant';
|
import Constants from '../../common/constant';
|
||||||
import { AccountTips, AccountTipsConfig } from '../AccountTipsConfig';
|
import { AccountTips, AccountTipsConfig } from '../AccountTipsConfig';
|
||||||
import { GetAlertMessage } from '../GetAlertMessage';
|
import { GetAlertMessage } from '../../common/GetAlertMessage';
|
||||||
import { DlpAlertDialog } from '../components/dlp_alert_dialog';
|
import { DlpAlertDialog } from '../../common/components/dlp_alert_dialog';
|
||||||
import { HiLog } from '../HiLog';
|
import { HiLog } from '../../common/HiLog';
|
||||||
import { SystemUtils } from '../systemUtils';
|
import { SystemUtils } from '../../common/systemUtils';
|
||||||
import AccountManager from '../../manager/AccountManager';
|
import AccountManager from '../../manager/AccountManager';
|
||||||
import accountManager from '@ohos.enterprise.accountManager';
|
import accountManager from '@ohos.enterprise.accountManager';
|
||||||
import DomainAccountInfo from '../../bean/data/DomainAccountInfo';
|
import DomainAccountInfo from '../../bean/data/DomainAccountInfo';
|
||||||
|
|
||||||
const TAG = 'staff';
|
const TAG = 'staff';
|
||||||
|
|
||||||
@Extend(Text)
|
@Extend(Text)
|
||||||
function tipsTextStyle() {
|
function tipsTextStyle() {
|
||||||
.fontSize($r('sys.float.ohos_id_text_size_body2'))
|
.fontSize($r('sys.float.ohos_id_text_size_body2'))
|
||||||
.fontColor($r('sys.color.ohos_id_color_text_primary'))
|
.fontColor($r('sys.color.ohos_id_color_text_primary'))
|
||||||
.textOverflow({
|
.textOverflow({
|
||||||
overflow: TextOverflow.Ellipsis
|
overflow: TextOverflow.Ellipsis
|
||||||
})
|
})
|
||||||
.maxLines(Constants.PP_TEXT_MAX_LINE)
|
.maxLines(Constants.PP_TEXT_MAX_LINE)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
struct staffItem {
|
struct staffItem {
|
||||||
@Prop authAccount: string = '';
|
@Prop authAccount: string = '';
|
||||||
@Prop isActive: boolean = false;
|
@Prop isActive: boolean = false;
|
||||||
@State color: Resource[] = [
|
@State color: Resource[] = [
|
||||||
$r('sys.color.multi_color_01'),
|
$r('sys.color.multi_color_01'),
|
||||||
$r('sys.color.multi_color_02'),
|
$r('sys.color.multi_color_02'),
|
||||||
$r('sys.color.multi_color_03'),
|
$r('sys.color.multi_color_03'),
|
||||||
$r('sys.color.multi_color_04'),
|
$r('sys.color.multi_color_04'),
|
||||||
$r('sys.color.multi_color_05'),
|
$r('sys.color.multi_color_05'),
|
||||||
$r('sys.color.multi_color_06'),
|
$r('sys.color.multi_color_06'),
|
||||||
$r('sys.color.multi_color_07'),
|
$r('sys.color.multi_color_07'),
|
||||||
$r('sys.color.multi_color_08'),
|
$r('sys.color.multi_color_08'),
|
||||||
$r('sys.color.multi_color_09'),
|
$r('sys.color.multi_color_09'),
|
||||||
$r('sys.color.multi_color_10'),
|
$r('sys.color.multi_color_10'),
|
||||||
$r('sys.color.multi_color_11'),
|
$r('sys.color.multi_color_11'),
|
||||||
];
|
];
|
||||||
@Prop changeIndex: number = 0;
|
@Prop changeIndex: number = 0;
|
||||||
@State domainTips: string = '';
|
@State domainTips: string = '';
|
||||||
@State accountNameTips: string = '';
|
@State accountNameTips: string = '';
|
||||||
@State handlePopupTips: boolean = false;
|
@State handlePopupTips: boolean = false;
|
||||||
|
|
||||||
@Prop textContent: string = '';
|
@Prop textContent: string = '';
|
||||||
@State accountTipsArray: AccountTips[] = [];
|
@State accountTipsArray: AccountTips[] = [];
|
||||||
@State isHover: boolean = false;
|
@State isHover: boolean = false;
|
||||||
dlpAlertDialog?: CustomDialogController;
|
dlpAlertDialog?: CustomDialogController;
|
||||||
|
|
||||||
@Builder popupBuilderTips() {
|
@Builder popupBuilderTips() {
|
||||||
Column() {
|
Column() {
|
||||||
ForEach(this.accountTipsArray, (item: AccountTips) => {
|
ForEach(this.accountTipsArray, (item: AccountTips) => {
|
||||||
if (item.isShow) {
|
if (item.isShow) {
|
||||||
Row() {
|
Row() {
|
||||||
if (AccountTipsConfig.isSysLanguage()) {
|
if (AccountTipsConfig.isSysLanguage()) {
|
||||||
Text(item.description?.replace('%s', item.value)).tipsTextStyle()
|
Text(item.description?.replace('%s', item.value)).tipsTextStyle()
|
||||||
} else {
|
} else {
|
||||||
Text(item.descriptionEn?.replace('%s', item.value)).tipsTextStyle()
|
Text(item.descriptionEn?.replace('%s', item.value)).tipsTextStyle()
|
||||||
}
|
}
|
||||||
}.height(Constants.TIPS_HEIGHT_ITEM)
|
}.height(Constants.TIPS_HEIGHT_ITEM)
|
||||||
}
|
}
|
||||||
}, (item: AccountTips) => item.key)
|
}, (item: AccountTips) => item.key)
|
||||||
}
|
}
|
||||||
.alignItems(HorizontalAlign.Start)
|
.alignItems(HorizontalAlign.Start)
|
||||||
.padding({
|
.padding({
|
||||||
left: Constants.ROW_FONT_SIZE,
|
left: Constants.ROW_FONT_SIZE,
|
||||||
right: Constants.ROW_FONT_SIZE,
|
right: Constants.ROW_FONT_SIZE,
|
||||||
top: Constants.DA_MARGIN_TOP,
|
top: Constants.DA_MARGIN_TOP,
|
||||||
bottom: Constants.DA_MARGIN_TOP
|
bottom: Constants.DA_MARGIN_TOP
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
private rollColor() {
|
private rollColor() {
|
||||||
while (this.changeIndex > this.color.length - 1) {
|
while (this.changeIndex > this.color.length - 1) {
|
||||||
this.changeIndex = this.changeIndex - this.color.length
|
this.changeIndex = this.changeIndex - this.color.length
|
||||||
}
|
}
|
||||||
return this.color[this.changeIndex]
|
return this.color[this.changeIndex]
|
||||||
}
|
}
|
||||||
|
|
||||||
private showErrorDialog(title: Resource, message: Resource) {
|
private showErrorDialog(title: Resource, message: Resource) {
|
||||||
this.dlpAlertDialog = new CustomDialogController({
|
this.dlpAlertDialog = new CustomDialogController({
|
||||||
builder: DlpAlertDialog({
|
builder: DlpAlertDialog({
|
||||||
title: title,
|
title: title,
|
||||||
message: message,
|
message: message,
|
||||||
action: () => {
|
action: () => {
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
autoCancel: false,
|
autoCancel: false,
|
||||||
customStyle: true,
|
customStyle: true,
|
||||||
});
|
});
|
||||||
this.dlpAlertDialog.open();
|
this.dlpAlertDialog.open();
|
||||||
}
|
}
|
||||||
|
|
||||||
private splitContent() {
|
private splitContent() {
|
||||||
if (this.textContent) {
|
if (this.textContent) {
|
||||||
if (this.textContent.length > Constants.TIPS_NAME_LENGTH) {
|
if (this.textContent.length > Constants.TIPS_NAME_LENGTH) {
|
||||||
return this.textContent.split('').join(Constants.TIPS_SPACE_ZERO)
|
return this.textContent.split('').join(Constants.TIPS_SPACE_ZERO)
|
||||||
} else if (this.textContent.length === Constants.TIPS_NAME_LENGTH) {
|
} else if (this.textContent.length === Constants.TIPS_NAME_LENGTH) {
|
||||||
return this.textContent.split('').join(Constants.TIPS_SPACE_EM)
|
return this.textContent.split('').join(Constants.TIPS_SPACE_EM)
|
||||||
} else {
|
} else {
|
||||||
return Constants.TIPS_SPACE_EN + this.textContent;
|
return Constants.TIPS_SPACE_EN + this.textContent;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return this.textContent;
|
return this.textContent;
|
||||||
}
|
}
|
||||||
|
|
||||||
private getFontWeight() {
|
private getFontWeight() {
|
||||||
try {
|
try {
|
||||||
return (getContext(this) as common.UIAbilityContext).resourceManager.getNumber(
|
return (getContext(this) as common.UIAbilityContext).resourceManager.getNumber(
|
||||||
$r('sys.float.font_weight_semibold'));
|
$r('sys.float.font_weight_semibold'));
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
HiLog.error(TAG, `getFontWeight callback getNumber failed: ${JSON.stringify(error)}.`);
|
HiLog.error(TAG, `getFontWeight callback getNumber failed: ${JSON.stringify(error)}.`);
|
||||||
return FontWeight.Regular;
|
return FontWeight.Regular;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async aboutToAppear() {
|
async aboutToAppear() {
|
||||||
AccountManager.connectAbility(getContext(this) as common.UIAbilityContext);
|
AccountManager.connectAbility(getContext(this) as common.UIAbilityContext);
|
||||||
}
|
}
|
||||||
|
|
||||||
build() {
|
build() {
|
||||||
Row() {
|
Row() {
|
||||||
Stack() {
|
Stack() {
|
||||||
Circle({ width: Constants.HEADER_ROW_FONT_SIZE, height: Constants.HEADER_ROW_FONT_SIZE })
|
Circle({ width: Constants.HEADER_ROW_FONT_SIZE, height: Constants.HEADER_ROW_FONT_SIZE })
|
||||||
.fill(this.rollColor())
|
.fill(this.rollColor())
|
||||||
.opacity(Constants.FOOTER_OPACITY_MID);
|
.opacity(Constants.FOOTER_OPACITY_MID);
|
||||||
Text(this.authAccount?.[0]?.toLocaleUpperCase())
|
Text(this.authAccount?.[0]?.toLocaleUpperCase())
|
||||||
.fontSize(Constants.STAFF_FONT_SIZE)
|
.fontSize(Constants.STAFF_FONT_SIZE)
|
||||||
.fontWeight(this.getFontWeight())
|
.fontWeight(this.getFontWeight())
|
||||||
.width(Constants.HEADER_ROW_FONT_SIZE)
|
.width(Constants.HEADER_ROW_FONT_SIZE)
|
||||||
.height(Constants.HEADER_ROW_FONT_SIZE)
|
.height(Constants.HEADER_ROW_FONT_SIZE)
|
||||||
.borderRadius(Constants.ENCRYPTION_STAFF_BORDER_RADIUS)
|
.borderRadius(Constants.ENCRYPTION_STAFF_BORDER_RADIUS)
|
||||||
.fontColor($r('sys.color.ohos_fa_text_contrary'))
|
.fontColor($r('sys.color.ohos_fa_text_contrary'))
|
||||||
.textAlign(TextAlign.Center)
|
.textAlign(TextAlign.Center)
|
||||||
.opacity(Constants.FOOTER_OPACITY_MID)
|
.opacity(Constants.FOOTER_OPACITY_MID)
|
||||||
.padding({ bottom: Constants.STAFF_FONT_PADDING });
|
.padding({ bottom: Constants.STAFF_FONT_PADDING });
|
||||||
}
|
}
|
||||||
.margin({
|
.margin({
|
||||||
left: SystemUtils.isRTL() ? Constants.ADD_STAFF_ITEM_MARGIN_RIGHT : Constants.ADD_STAFF_ITEM_MARGIN_LEFT,
|
left: SystemUtils.isRTL() ? Constants.ADD_STAFF_ITEM_MARGIN_RIGHT : Constants.ADD_STAFF_ITEM_MARGIN_LEFT,
|
||||||
right: SystemUtils.isRTL() ? Constants.ADD_STAFF_ITEM_MARGIN_LEFT : Constants.ADD_STAFF_ITEM_MARGIN_RIGHT,
|
right: SystemUtils.isRTL() ? Constants.ADD_STAFF_ITEM_MARGIN_LEFT : Constants.ADD_STAFF_ITEM_MARGIN_RIGHT,
|
||||||
});
|
});
|
||||||
Text(this.splitContent())
|
Text(this.splitContent())
|
||||||
.textOverflow({
|
.textOverflow({
|
||||||
overflow: TextOverflow.Ellipsis
|
overflow: TextOverflow.Ellipsis
|
||||||
})
|
})
|
||||||
.maxLines(Constants.PP_TEXT_MAX_LINE)
|
.maxLines(Constants.PP_TEXT_MAX_LINE)
|
||||||
.fontSize($r('sys.float.ohos_id_text_size_button3'))
|
.fontSize($r('sys.float.ohos_id_text_size_button3'))
|
||||||
.height(Constants.HEADER_ROW_FONT_SIZE);
|
.height(Constants.HEADER_ROW_FONT_SIZE);
|
||||||
}
|
}
|
||||||
.onClick(async () => {
|
.onClick(async () => {
|
||||||
try {
|
try {
|
||||||
let accountInfo: DomainAccountInfo = await AccountManager.getDomainAccountByAccountName(this.authAccount);
|
let accountInfo: DomainAccountInfo = await AccountManager.getDomainAccountByAccountName(this.authAccount);
|
||||||
this.accountTipsArray = await AccountTipsConfig.getConfigTips();
|
this.accountTipsArray = await AccountTipsConfig.getConfigTips();
|
||||||
this.handlePopupTips = !this.handlePopupTips;
|
this.handlePopupTips = !this.handlePopupTips;
|
||||||
this.accountTipsArray?.forEach((item: AccountTips) => {
|
this.accountTipsArray?.forEach((item: AccountTips) => {
|
||||||
item.value = accountInfo[item.key];
|
item.value = accountInfo[item.key];
|
||||||
})
|
})
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
HiLog.error(TAG, `getFontWeight callback getNumber failed: ${JSON.stringify(error)}.`);
|
HiLog.error(TAG, `getFontWeight callback getNumber failed: ${JSON.stringify(error)}.`);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.hitTestBehavior(HitTestMode.Block)
|
.hitTestBehavior(HitTestMode.Block)
|
||||||
.bindPopup(this.handlePopupTips, {
|
.bindPopup(this.handlePopupTips, {
|
||||||
builder: this.popupBuilderTips,
|
builder: this.popupBuilderTips,
|
||||||
placement: SystemUtils.isRTL() ? Placement.BottomRight : Placement.BottomLeft,
|
placement: SystemUtils.isRTL() ? Placement.BottomRight : Placement.BottomLeft,
|
||||||
enableArrow: true,
|
enableArrow: true,
|
||||||
showInSubWindow: false,
|
showInSubWindow: false,
|
||||||
onStateChange: (e) => {
|
onStateChange: (e) => {
|
||||||
if (!e.isVisible) {
|
if (!e.isVisible) {
|
||||||
this.handlePopupTips = false;
|
this.handlePopupTips = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.height(Constants.ENCRYPTION_ADD_STAFF_HEIGHT)
|
.height(Constants.ENCRYPTION_ADD_STAFF_HEIGHT)
|
||||||
.alignItems(VerticalAlign.Center)
|
.alignItems(VerticalAlign.Center)
|
||||||
.backgroundColor(this.isActive && this.handlePopupTips ? '#1A0A59F7' : $r('sys.color.ohos_id_color_button_normal'))
|
.backgroundColor(this.isActive && this.handlePopupTips ? '#1A0A59F7' : $r('sys.color.ohos_id_color_button_normal'))
|
||||||
.borderRadius(Constants.ENCRYPTION_SUCCESS_CHANGE_TOP)
|
.borderRadius(Constants.ENCRYPTION_SUCCESS_CHANGE_TOP)
|
||||||
.padding(
|
.padding(
|
||||||
{
|
{
|
||||||
top: Constants.ENCRYPTION_STAFF_PAD,
|
top: Constants.ENCRYPTION_STAFF_PAD,
|
||||||
bottom: Constants.ENCRYPTION_STAFF_PAD,
|
bottom: Constants.ENCRYPTION_STAFF_PAD,
|
||||||
left: Constants.ENCRYPTION_STAFF_ITEM_MARGIN,
|
left: Constants.ENCRYPTION_STAFF_ITEM_MARGIN,
|
||||||
right: Constants.ENCRYPTION_STAFF_ITEM_MARGIN
|
right: Constants.ENCRYPTION_STAFF_ITEM_MARGIN
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
.margin({
|
.margin({
|
||||||
right: Constants.ENCRYPTION_ADD_STAFF_MARGIN_RIGHT,
|
right: Constants.ENCRYPTION_ADD_STAFF_MARGIN_RIGHT,
|
||||||
top: Constants.ENCRYPTION_ADD_STAFF_MARGIN_BOTTOM
|
top: Constants.ENCRYPTION_ADD_STAFF_MARGIN_BOTTOM
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export { staffItem };
|
export { staffItem };
|
@ -14,7 +14,7 @@
|
|||||||
*/
|
*/
|
||||||
import DomainAccountInfo from '../bean/data/DomainAccountInfo';
|
import DomainAccountInfo from '../bean/data/DomainAccountInfo';
|
||||||
import DomainAccountResponse from '../bean/response/DomainAccountResponse';
|
import DomainAccountResponse from '../bean/response/DomainAccountResponse';
|
||||||
import CredConnection from '../common/connection/CredConnection';
|
import CredConnection from '../rpc/CredConnection';
|
||||||
import AppStorageConstant from '../common/constant/AppStorageConstant';
|
import AppStorageConstant from '../common/constant/AppStorageConstant';
|
||||||
import { HiLog } from '../common/HiLog';
|
import { HiLog } from '../common/HiLog';
|
||||||
import { getOsAccountInfo } from '../common/utils';
|
import { getOsAccountInfo } from '../common/utils';
|
||||||
|
@ -23,7 +23,7 @@ import fileUri from '@ohos.file.fileuri';
|
|||||||
import { BusinessError } from '@ohos.base';
|
import { BusinessError } from '@ohos.base';
|
||||||
import osAccount from '@ohos.account.osAccount';
|
import osAccount from '@ohos.account.osAccount';
|
||||||
import common from '@ohos.app.ability.common';
|
import common from '@ohos.app.ability.common';
|
||||||
import { staffItem } from '../common/encryptionComponents/staff';
|
import { staffItem } from '../component/encryptionComponents/staff';
|
||||||
import Constants from '../common/constant';
|
import Constants from '../common/constant';
|
||||||
import {
|
import {
|
||||||
AuthAccount,
|
AuthAccount,
|
||||||
@ -38,8 +38,8 @@ import {
|
|||||||
import { DlpAlertDialog } from '../common/components/dlp_alert_dialog';
|
import { DlpAlertDialog } from '../common/components/dlp_alert_dialog';
|
||||||
import GlobalContext from '../common/GlobalContext';
|
import GlobalContext from '../common/GlobalContext';
|
||||||
import HomeFeature from '../feature/HomeFeature';
|
import HomeFeature from '../feature/HomeFeature';
|
||||||
import { AccountTipsConfig } from '../common/AccountTipsConfig';
|
import { AccountTipsConfig } from '../component/AccountTipsConfig';
|
||||||
import { EncryptingPanel } from '../common/encryptionComponents/encrypting';
|
import { EncryptingPanel } from '../component/encryptionComponents/encrypting';
|
||||||
import { GetAlertMessage } from '../common/GetAlertMessage';
|
import { GetAlertMessage } from '../common/GetAlertMessage';
|
||||||
import { HiLog } from '../common/HiLog';
|
import { HiLog } from '../common/HiLog';
|
||||||
import { SystemUtils } from '../common/systemUtils';
|
import { SystemUtils } from '../common/systemUtils';
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
import UIExtensionContentSession from '@ohos.app.ability.UIExtensionContentSession';
|
import UIExtensionContentSession from '@ohos.app.ability.UIExtensionContentSession';
|
||||||
import { EditableLeftIconType } from '@ohos.arkui.advanced.EditableTitleBar';
|
import { EditableLeftIconType } from '@ohos.arkui.advanced.EditableTitleBar';
|
||||||
import { EditableTitleBar } from '@ohos.arkui.advanced.EditableTitleBar';
|
import { EditableTitleBar } from '@ohos.arkui.advanced.EditableTitleBar';
|
||||||
import ConnectService from '../common/share/ConnectService';
|
import ConnectService from '../rpc/ConnectService';
|
||||||
import { LengthMetrics } from '@ohos.arkui.node';
|
import { LengthMetrics } from '@ohos.arkui.node';
|
||||||
import dlpPermission from '@ohos.dlpPermission';
|
import dlpPermission from '@ohos.dlpPermission';
|
||||||
import promptAction from '@ohos.promptAction';
|
import promptAction from '@ohos.promptAction';
|
||||||
|
@ -24,7 +24,7 @@ import fs from '@ohos.file.fs';
|
|||||||
import osAccount from '@ohos.account.osAccount';
|
import osAccount from '@ohos.account.osAccount';
|
||||||
import { BusinessError } from '@ohos.base';
|
import { BusinessError } from '@ohos.base';
|
||||||
import common from '@ohos.app.ability.common';
|
import common from '@ohos.app.ability.common';
|
||||||
import { EncryptingPanel } from '../common/encryptionComponents/encrypting';
|
import { EncryptingPanel } from '../component/encryptionComponents/encrypting';
|
||||||
import { DlpAlertDialog } from '../common/components/dlp_alert_dialog';
|
import { DlpAlertDialog } from '../common/components/dlp_alert_dialog';
|
||||||
import {
|
import {
|
||||||
PermissionType,
|
PermissionType,
|
||||||
@ -44,8 +44,8 @@ import {
|
|||||||
permissionTypeSelect,
|
permissionTypeSelect,
|
||||||
validDateTypeMenu,
|
validDateTypeMenu,
|
||||||
validDateTypeMenuItem
|
validDateTypeMenuItem
|
||||||
} from '../common/encryptionComponents/permission_type_select';
|
} from '../component/encryptionComponents/permission_type_select';
|
||||||
import { AddStaff } from '../common/encryptionComponents/AddStaff';
|
import { AddStaff } from '../component/encryptionComponents/AddStaff';
|
||||||
import GlobalContext from '../common/GlobalContext';
|
import GlobalContext from '../common/GlobalContext';
|
||||||
import IDLDLPProperty from '../serviceExtensionAbility/sequenceable/dlpClass';
|
import IDLDLPProperty from '../serviceExtensionAbility/sequenceable/dlpClass';
|
||||||
import { IAuthUser } from '../serviceExtensionAbility/sequenceable/dlpClass';
|
import { IAuthUser } from '../serviceExtensionAbility/sequenceable/dlpClass';
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
import UIExtensionContentSession from '@ohos.app.ability.UIExtensionContentSession';
|
import UIExtensionContentSession from '@ohos.app.ability.UIExtensionContentSession';
|
||||||
import router from '@ohos.router';
|
import router from '@ohos.router';
|
||||||
import common from '@ohos.app.ability.common';
|
import common from '@ohos.app.ability.common';
|
||||||
import { staffItem } from '../common/encryptionComponents/staff';
|
import { staffItem } from '../component/encryptionComponents/staff';
|
||||||
import Constants from '../common/constant';
|
import Constants from '../common/constant';
|
||||||
import ability from '@ohos.ability.ability';
|
import ability from '@ohos.ability.ability';
|
||||||
import {
|
import {
|
||||||
|
86
entry/src/main/ets/rpc/ConnectService.ets
Normal file
86
entry/src/main/ets/rpc/ConnectService.ets
Normal file
@ -0,0 +1,86 @@
|
|||||||
|
/*
|
||||||
|
* 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 CredCallbackStub from './CredCallback';
|
||||||
|
import Constants from '../common/constant';
|
||||||
|
import { HiLog } from '../common/HiLog';
|
||||||
|
|
||||||
|
const TAG = 'ConnectService';
|
||||||
|
|
||||||
|
export default class ConnectService {
|
||||||
|
private service: CredCallbackStub = new CredCallbackStub('CredCallbackStub');
|
||||||
|
private context: ESObject;
|
||||||
|
private connection = -1;
|
||||||
|
private optionsSearchUser: common.ConnectOptions;
|
||||||
|
private optionsGetAccount: common.ConnectOptions;
|
||||||
|
|
||||||
|
constructor(context: ESObject) {
|
||||||
|
this.context = context;
|
||||||
|
this.optionsSearchUser = {
|
||||||
|
onConnect: (elementName, remote) => {
|
||||||
|
HiLog.info(TAG, `onConnect success search account ${JSON.stringify(elementName)}`);
|
||||||
|
this.service.searchUserInfo(remote);
|
||||||
|
},
|
||||||
|
onDisconnect: () => {
|
||||||
|
HiLog.info(TAG, `onDisconnect`);
|
||||||
|
},
|
||||||
|
onFailed: () => {
|
||||||
|
HiLog.info(TAG, `onFailed`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.optionsGetAccount = {
|
||||||
|
onConnect: (elementName, remote) => {
|
||||||
|
HiLog.info(TAG, `onConnect success get account ${JSON.stringify(elementName)}`);
|
||||||
|
this.service.getAccountInfo(remote);
|
||||||
|
},
|
||||||
|
onDisconnect: () => {
|
||||||
|
HiLog.info(TAG, `onDisconnect`);
|
||||||
|
},
|
||||||
|
onFailed: () => {
|
||||||
|
HiLog.info(TAG, `onFailed`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
connectServiceShareAbility(code: number) {
|
||||||
|
HiLog.info(TAG, `connectServiceShareAbility start`);
|
||||||
|
let want: Want = {
|
||||||
|
bundleName: 'com.huawei.hmos.dlpcredmgr',
|
||||||
|
abilityName: 'DlpCredDataExtAbility',
|
||||||
|
};
|
||||||
|
try {
|
||||||
|
switch (code) {
|
||||||
|
case Constants.COMMAND_SEARCH_USER_INFO: {
|
||||||
|
this.connection = this.context.connectServiceExtensionAbility(want, this.optionsSearchUser);
|
||||||
|
AppStorage.setOrCreate('connection', this.connection);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case Constants.COMMAND_GET_ACCOUNT_INFO: {
|
||||||
|
this.connection = this.context.connectServiceExtensionAbility(want, this.optionsGetAccount);
|
||||||
|
AppStorage.setOrCreate('connection', this.connection);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default: {
|
||||||
|
HiLog.error(TAG, `code is not exist ${code}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
HiLog.error(TAG, `connectServiceExtAbility failed: ${JSON.stringify(err)}`);
|
||||||
|
}
|
||||||
|
HiLog.info(TAG, `connectServiceExtAbility result: ${this.connection}`);
|
||||||
|
}
|
||||||
|
}
|
@ -13,77 +13,71 @@
|
|||||||
* limitations under the License.
|
* 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 rpc from '@ohos.rpc';
|
||||||
import CredCallbackStub from './CredCallback';
|
import { HiLog } from '../common/HiLog';
|
||||||
import Constants from '../constant';
|
import Constants from '../common/constant';
|
||||||
import { HiLog } from '../HiLog';
|
import { common } from '@kit.AbilityKit';
|
||||||
|
|
||||||
const TAG = 'ConnectService';
|
const TAG = 'CredCallbackStub';
|
||||||
|
|
||||||
export default class ConnectService {
|
export default class CredCallbackStub extends rpc.RemoteObject {
|
||||||
private context: ESObject;
|
private static readonly DESCRIPTOR: string = 'OHOS.HapDlpCredAbilityServiceStub';
|
||||||
private connection = -1;
|
|
||||||
private optionsSearchUser: common.ConnectOptions;
|
|
||||||
private optionsGetAccount: common.ConnectOptions;
|
|
||||||
|
|
||||||
constructor(context: ESObject) {
|
constructor(des: string) {
|
||||||
let that = this;
|
super(des);
|
||||||
this.context = context;
|
|
||||||
this.optionsSearchUser = {
|
|
||||||
onConnect: (elementName, remote) => {
|
|
||||||
HiLog.info(TAG, `onConnect success search account ${JSON.stringify(elementName)}`);
|
|
||||||
that.searchUserInfo(remote);
|
|
||||||
},
|
|
||||||
onDisconnect: () => {
|
|
||||||
HiLog.info(TAG, `onDisconnect`);
|
|
||||||
},
|
|
||||||
onFailed: () => {
|
|
||||||
HiLog.info(TAG, `onFailed`);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
this.optionsGetAccount = {
|
|
||||||
onConnect: (elementName, remote) => {
|
|
||||||
HiLog.info(TAG, `onConnect success get account ${JSON.stringify(elementName)}`);
|
|
||||||
that.getAccountInfo(remote);
|
|
||||||
},
|
|
||||||
onDisconnect: () => {
|
|
||||||
HiLog.info(TAG, `onDisconnect`);
|
|
||||||
},
|
|
||||||
onFailed: () => {
|
|
||||||
HiLog.info(TAG, `onFailed`);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
connectServiceShareAbility(code: number) {
|
asObject(): rpc.IRemoteObject {
|
||||||
HiLog.info(TAG, `connectServiceShareAbility start`);
|
return this;
|
||||||
let want: Want = {
|
}
|
||||||
bundleName: 'com.huawei.hmos.dlpcredmgr',
|
|
||||||
abilityName: 'DlpCredDataExtAbility',
|
async onRemoteMessageRequest(code: number, data: rpc.MessageSequence): Promise<boolean> {
|
||||||
};
|
HiLog.info(TAG, `onRemoteMessageRequest called, code = ${code}`);
|
||||||
try {
|
try {
|
||||||
switch (code) {
|
if (data.readInterfaceToken() !== CredCallbackStub.DESCRIPTOR) {
|
||||||
case Constants.COMMAND_SEARCH_USER_INFO: {
|
HiLog.info(TAG, `DESCRIPTOR unmatched.`);
|
||||||
this.connection = this.context.connectServiceExtensionAbility(want, this.optionsSearchUser);
|
return false;
|
||||||
AppStorage.setOrCreate('connection', this.connection);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case Constants.COMMAND_GET_ACCOUNT_INFO: {
|
|
||||||
this.connection = this.context.connectServiceExtensionAbility(want, this.optionsGetAccount);
|
|
||||||
AppStorage.setOrCreate('connection', this.connection);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
default: {
|
|
||||||
HiLog.error(TAG, `code is not exist ${code}`);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (error) {
|
||||||
HiLog.error(TAG, `connectServiceExtAbility failed: ${JSON.stringify(err)}`);
|
HiLog.error(TAG, `read data exception, error is ${JSON.stringify(error)}`);
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
HiLog.info(TAG, `connectServiceExtAbility result: ${this.connection}`);
|
switch (code) {
|
||||||
|
case Constants.COMMAND_SEARCH_USER_INFO: {
|
||||||
|
let storage = LocalStorage.getShared();
|
||||||
|
HiLog.info(TAG, `onRemoteMessageRequest command search user info`);
|
||||||
|
let resultVar = '';
|
||||||
|
try {
|
||||||
|
resultVar = data.readString();
|
||||||
|
} catch (error) {
|
||||||
|
HiLog.error(TAG, `read string exception, error is ${JSON.stringify(error)}`);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
storage.setOrCreate('commandSearchUserInfo', resultVar);
|
||||||
|
this.disconnectServiceShareAbility();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
case Constants.COMMAND_GET_ACCOUNT_INFO: {
|
||||||
|
let storage = LocalStorage.getShared();
|
||||||
|
HiLog.info(TAG, `onRemoteMessageRequest command get account info`);
|
||||||
|
let resultVar = '';
|
||||||
|
try {
|
||||||
|
resultVar = data.readString();
|
||||||
|
} catch (error) {
|
||||||
|
HiLog.error(TAG, `read string exception, error is ${JSON.stringify(error)}`);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
storage.setOrCreate('commandGetAccountInfo', resultVar);
|
||||||
|
this.disconnectServiceShareAbility();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
default: {
|
||||||
|
HiLog.error(TAG, `invalid request code: ${code}`);
|
||||||
|
this.disconnectServiceShareAbility();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
searchUserInfo(remote: rpc.IRemoteObject) {
|
searchUserInfo(remote: rpc.IRemoteObject) {
|
||||||
@ -139,10 +133,12 @@ export default class ConnectService {
|
|||||||
disconnectServiceShareAbility() {
|
disconnectServiceShareAbility() {
|
||||||
HiLog.info(TAG, `disconnectServiceShareAbility: ${AppStorage.get('connection')}`);
|
HiLog.info(TAG, `disconnectServiceShareAbility: ${AppStorage.get('connection')}`);
|
||||||
let connectionNum: number | undefined = AppStorage.get('connection');
|
let connectionNum: number | undefined = AppStorage.get('connection');
|
||||||
this.context.disconnectAbility(connectionNum).then(() => {
|
let context: common.UIAbilityContext = getContext(this) as common.UIAbilityContext;
|
||||||
HiLog.info(TAG, `disconnectAbility success.`);
|
try {
|
||||||
}).catch((error: BusinessError) => {
|
context.disconnectServiceExtensionAbility(connectionNum);
|
||||||
HiLog.error(TAG, `disconnectAbility failed. Error: ${JSON.stringify(error)}`);
|
HiLog.info(TAG, `disconnectServiceExtensionAbility success.`);
|
||||||
})
|
} catch (error) {
|
||||||
|
HiLog.error(TAG, `disconnectServiceExtensionAbility failed. Error: ${JSON.stringify(error)}`);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
@ -17,13 +17,13 @@ import common from '@ohos.app.ability.common';
|
|||||||
import Want from '@ohos.app.ability.Want';
|
import Want from '@ohos.app.ability.Want';
|
||||||
import { BusinessError } from '@ohos.base';
|
import { BusinessError } from '@ohos.base';
|
||||||
import rpc from '@ohos.rpc';
|
import rpc from '@ohos.rpc';
|
||||||
import DomainAccountRequest from '../../bean/request/DomainAccountRequest';
|
import DomainAccountRequest from '../bean/request/DomainAccountRequest';
|
||||||
import DomainAccountResponse from '../../bean/response/DomainAccountResponse';
|
import DomainAccountResponse from '../bean/response/DomainAccountResponse';
|
||||||
import DomainAccountConvertor from '../../convertor/DomainAccountConvertor';
|
import DomainAccountConvertor from '../convertor/DomainAccountConvertor';
|
||||||
import Constants from '../constant';
|
import Constants from '../common/constant';
|
||||||
import AppStorageConstant from '../constant/AppStorageConstant';
|
import AppStorageConstant from '../common/constant/AppStorageConstant';
|
||||||
import { HiLog } from '../HiLog';
|
import { HiLog } from '../common/HiLog';
|
||||||
import CredCallbackStub from '../share/CredCallback';
|
import CredCallbackStub from './CredCallback';
|
||||||
|
|
||||||
const TAG = 'CredConnection';
|
const TAG = 'CredConnection';
|
||||||
|
|
Loading…
Reference in New Issue
Block a user