From 52d010b427a3f7446c0dd773ab27c67fde39ade7 Mon Sep 17 00:00:00 2001 From: fanchenxuan Date: Mon, 8 Apr 2024 17:02:11 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=89=E5=85=A8=E6=8E=A7=E4=BB=B6UI=E8=B0=83?= =?UTF-8?q?=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: fanchenxuan --- .../src/main/ets/Application/AbilityStage.ts | 7 ++- .../src/main/ets/common/utils/constant.ets | 17 ++---- .../src/main/ets/common/utils/typedef.ets | 4 +- .../src/main/ets/pages/dialogPlus.ets | 2 +- .../ets/pages/permission-access-record.ets | 9 +-- .../src/main/ets/pages/securityDialog.ets | 58 +++++++++++-------- .../main/resources/base/element/string.json | 32 +++------- .../src/main/resources/base/media/file.svg | 1 + .../main/resources/base/media/ic_location.svg | 43 ++++++++++++++ .../base/media/ic_public_privacy.svg | 13 +++++ .../main/resources/zh_CN/element/string.json | 32 +++------- 11 files changed, 124 insertions(+), 94 deletions(-) create mode 100644 permissionmanager/src/main/resources/base/media/file.svg create mode 100644 permissionmanager/src/main/resources/base/media/ic_location.svg create mode 100644 permissionmanager/src/main/resources/base/media/ic_public_privacy.svg diff --git a/permissionmanager/src/main/ets/Application/AbilityStage.ts b/permissionmanager/src/main/ets/Application/AbilityStage.ts index c56833f..bc86676 100644 --- a/permissionmanager/src/main/ets/Application/AbilityStage.ts +++ b/permissionmanager/src/main/ets/Application/AbilityStage.ts @@ -16,5 +16,10 @@ import AbilityStage from '@ohos.app.ability.AbilityStage'; export default class MyAbilityStage extends AbilityStage { - onCreate(): void {} + + // PermissionManager AbilityStage + onCreate(): void { + + } + } \ No newline at end of file diff --git a/permissionmanager/src/main/ets/common/utils/constant.ets b/permissionmanager/src/main/ets/common/utils/constant.ets index 23ad3c5..cbac171 100644 --- a/permissionmanager/src/main/ets/common/utils/constant.ets +++ b/permissionmanager/src/main/ets/common/utils/constant.ets @@ -24,15 +24,6 @@ export default class Constants { public static BACKBAR_IMAGE_WIDTH = 24; public static BACKBAR_MARGIN_RIGHT = 4; - // dialog - public static DIALOG_BORDER_RADIUS = 24; - public static DIALOG_HEIGHT = 70; - public static DIALOG_WIDTH = 336; - - // text of dialog - public static DIALOG_TEXT_FONT_SIZE = 20; - public static DIALOG_TEXT_MARGIN_TOP = 25; - // search textInput public static TEXTINPUT_PADDING_LEFT = 36; public static TEXTINPUT_BORDER_RADIUS = 20; @@ -81,6 +72,7 @@ export default class Constants { public static TEXT_SMALL_FONT_SIZE = 14; public static TEXT_SMALLER_FONT_SIZE = 12; public static TEXT_LINE_HEIGHT = 22; + public static TEXT_LINE_HEIGHT_27 = 27; public static TEXT_BIG_LINE_HEIGHT = 28; public static TEXT_SMALL_LINE_HEIGHT = 19; public static CONSTRAINTSIZE_MINHEIGHT = 48; @@ -100,6 +92,8 @@ export default class Constants { public static IMAGE_WIDTH_RECORD = 24; public static IMAGE_HEIGHT_RECORD_APPLICATION = 16; public static IMAGE_WIDTH_RECORD_APPLICATION = 16; + public static IMAGE_POSITION_28 = 28; + public static BORDER_WIDTH_1 = 1; public static TITLE_MARGIN_BOTTOM = 16; public static SUBTITLE_MIN_HEIGHT = 48; public static SUBTITLE_LINE_HEIGHT = 24; @@ -110,6 +104,7 @@ export default class Constants { public static TAB_INNER_PADDING = 8; public static TAB_DECORATION_HEIGHT = 2; public static TAB_DECORATION_POSITION_Y = 6; + public static PADDING_10 = 10; public static DEFAULT_PADDING_START = 12; public static DEFAULT_PADDING_END = 12; public static DEFAULT_PADDING_TOP = 12; @@ -270,8 +265,8 @@ export default class Constants { // icon public static SECURITY_ICON_MARGIN_TOP = 24; public static SECURITY_ICON_MARGIN_BOTTOM = 16; - public static SECURITY_ICON_WIDTH = 24; - public static SECURITY_ICON_HEIGHT = 24; + public static SECURITY_ICON_WIDTH = 48; + public static SECURITY_ICON_HEIGHT = 48; // content-descriptor public static SECURITY_DESCRIPTOR_DEVIDER_MARGIN_TOP = 8; diff --git a/permissionmanager/src/main/ets/common/utils/typedef.ets b/permissionmanager/src/main/ets/common/utils/typedef.ets index 3a0b269..d4dbbe5 100644 --- a/permissionmanager/src/main/ets/common/utils/typedef.ets +++ b/permissionmanager/src/main/ets/common/utils/typedef.ets @@ -205,10 +205,12 @@ export class AppInfoSimple { export class Param { public icon: Resource public label: Resource + public description: string - constructor(icon: Resource, label: Resource) { + constructor(icon: Resource, label: Resource, description: string) { this.icon = icon this.label = label + this.description = description } }; diff --git a/permissionmanager/src/main/ets/pages/dialogPlus.ets b/permissionmanager/src/main/ets/pages/dialogPlus.ets index fe0f647..9c103fd 100644 --- a/permissionmanager/src/main/ets/pages/dialogPlus.ets +++ b/permissionmanager/src/main/ets/pages/dialogPlus.ets @@ -276,7 +276,7 @@ struct PermissionDialog { } }.margin({ left: this.isBottomPopover ? Constants.DIALOG_MARGIN_VERTICAL : Constants.DIALOG_MARGIN, right: this.isBottomPopover ? Constants.DIALOG_MARGIN_VERTICAL : Constants.DIALOG_MARGIN, - bottom: this.isBottomPopover ? this.naviHeight + "px" : 0}) + bottom: this.isBottomPopover ? this.naviHeight + 'px' : 0}) } showTitle(): ResourceStr { diff --git a/permissionmanager/src/main/ets/pages/permission-access-record.ets b/permissionmanager/src/main/ets/pages/permission-access-record.ets index 7d8d5ac..b171aa1 100644 --- a/permissionmanager/src/main/ets/pages/permission-access-record.ets +++ b/permissionmanager/src/main/ets/pages/permission-access-record.ets @@ -569,11 +569,8 @@ struct permissionRecordPage { } getInfo(record: privacyManager.BundleUsedRecord, sortFlag: boolean) { - bundleManager.getBundleInfo( - record.bundleName, - bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_APPLICATION | - bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_REQUESTED_PERMISSION - ).then(async (info): Promise => { + bundleManager.getBundleInfo(record.bundleName, bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_APPLICATION | + bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_REQUESTED_PERMISSION).then(async (info): Promise => { let appInfo: AppRecordInfo = new AppRecordInfo('', '', '', 0, 0, [], [], [], [], 0); let reqPermissions: Permissions[] = []; let groupIds: number[] = []; @@ -597,14 +594,12 @@ struct permissionRecordPage { groupIds.push(groupId); } } - this.allBundleInfo.forEach(bundleInfo => { if (bundleInfo.bundleName === info.name) { appInfo.groupName = bundleInfo.label; appInfo.icon = bundleInfo.icon; } }) - appInfo.name = info.name; appInfo.api = info.targetVersion; appInfo.accessTokenId = info.appInfo.accessTokenId; diff --git a/permissionmanager/src/main/ets/pages/securityDialog.ets b/permissionmanager/src/main/ets/pages/securityDialog.ets index 66f52b6..ce825d8 100644 --- a/permissionmanager/src/main/ets/pages/securityDialog.ets +++ b/permissionmanager/src/main/ets/pages/securityDialog.ets @@ -70,8 +70,12 @@ struct CustomSecurityDialog { @State naviHeight: number = 0 securityParams : Array = [ - new Param($r('app.media.ic_public_gps'), $r('app.string.location_desc')), - new Param($r('app.media.ic_public_folder'), $r('app.string.media_files_desc')) + new Param( + $r('app.media.ic_location'), $r('app.string.SecurityTitle_location'), 'app.string.SecurityDescription_location' + ), + new Param( + $r('app.media.file'), $r('app.string.SecurityTitle_mediaFiles'), 'app.string.SecurityDescription_mediaFiles' + ) ] GetAppName() { @@ -141,36 +145,40 @@ struct CustomSecurityDialog { }) { Row() { Column() { - Image(this.securityParams[this.index].icon) // icon - .width(Constants.SECURITY_ICON_WIDTH) - .height(Constants.SECURITY_ICON_HEIGHT) - .fillColor($r('sys.color.ohos_id_color_text_primary')) - .margin({ - top: Constants.SECURITY_ICON_MARGIN_TOP, - bottom: Constants.SECURITY_ICON_MARGIN_BOTTOM - }) + Column() { + Image($r('app.media.ic_public_privacy')) // icon + .width(Constants.SECURITY_ICON_WIDTH) + .height(Constants.SECURITY_ICON_HEIGHT) + .fillColor($r('sys.color.ohos_id_color_component_activated')) + .border({ + width: Constants.BORDER_WIDTH_1, + color: $r('sys.color.ohos_id_color_button_normal'), + radius: $r('sys.float.ohos_id_corner_radius_default_m') + }) + .padding(Constants.PADDING_10) + Image(this.securityParams[this.index].icon) + .width(Constants.IMAGE_LENGTH_20) + .height(Constants.IMAGE_LENGTH_20) + .position({ x: Constants.IMAGE_POSITION_28, y: Constants.IMAGE_POSITION_28 }) + } + .backgroundColor($r('sys.color.ohos_id_color_background')) + .margin({ + top: Constants.SECURITY_ICON_MARGIN_TOP, + bottom: Constants.SECURITY_ICON_MARGIN_BOTTOM + }) Column() { // content - Text() { - Span($r('app.string.Temporarily_authorize')) - Span(this.appName) - Span($r('app.string.To_access')) - Span(this.securityParams[this.index].label) - } + Text(this.securityParams[this.index].label) .textAlign(TextAlign.Center) .fontColor($r('sys.color.ohos_id_color_text_primary')) - .fontSize($r('sys.float.ohos_id_text_size_body1')) + .fontSize($r('sys.float.ohos_id_text_size_headline8')) .fontWeight(FontWeight.Medium) + .lineHeight(Constants.TEXT_LINE_HEIGHT_27) - Text() { - Span($r('app.string.location_button_desc')) - Span($r('app.string.only_can_desc')) - Span(this.securityParams[this.index].label) - Span($r('app.string.only_after_desc')) - Span($r('app.string.prevent_desc')) - } + Text($r(this.securityParams[this.index].description, this.appName)) .textAlign(TextAlign.Center) .fontColor($r('sys.color.ohos_id_color_text_secondary')) .fontSize($r('sys.float.ohos_id_text_size_body2')) + .lineHeight(Constants.TEXT_SMALL_LINE_HEIGHT) .margin({ top: Constants.SECURITY_DESCRIPTOR_DEVIDER_MARGIN_TOP, }) @@ -202,7 +210,7 @@ struct CustomSecurityDialog { } }.margin({ left: this.isBottomPopover ? Constants.DIALOG_MARGIN_VERTICAL : Constants.DIALOG_MARGIN, right: this.isBottomPopover ? Constants.DIALOG_MARGIN_VERTICAL : Constants.DIALOG_MARGIN, - bottom: this.isBottomPopover ? this.naviHeight : 0}) + bottom: this.isBottomPopover ? this.naviHeight + 'px' : 0}) } aboutToAppear() { diff --git a/permissionmanager/src/main/resources/base/element/string.json b/permissionmanager/src/main/resources/base/element/string.json index 727b745..8d65072 100644 --- a/permissionmanager/src/main/resources/base/element/string.json +++ b/permissionmanager/src/main/resources/base/element/string.json @@ -605,36 +605,20 @@ "value": "Permission manager" }, { - "name": "Temporarily_authorize", - "value": "Temporarily authorize \"" + "name": "SecurityTitle_location", + "value": "Secure access to location information" }, { - "name": "To_access", - "value": "\" to access " + "name": "SecurityTitle_mediaFiles", + "value": "Secure access to media and files" }, { - "name": "location_desc", - "value": "location information" + "name": "SecurityDescription_location", + "value": "This button is certified by the system security and only allows \"%s\" temporary access to location information when you click this button, in order to reduce the continuous access of your private data by applications." }, { - "name": "media_files_desc", - "value": "media and files" - }, - { - "name": "location_button_desc", - "value": "This button has passed the system security authentication. " - }, - { - "name": "only_can_desc", - "value": "The app is allowed to temporarily access your " - }, - { - "name": "only_after_desc", - "value": " only after you touch this button. " - }, - { - "name": "prevent_desc", - "value": "This prevents your private data from being continuously obtained by the app." + "name": "SecurityDescription_mediaFiles", + "value": "This button is certified by the system security and only allows \"%s\" temporary access to media and files when you click this button, in order to reduce the continuous access of your private data by applications." }, { "name": "Got_it", diff --git a/permissionmanager/src/main/resources/base/media/file.svg b/permissionmanager/src/main/resources/base/media/file.svg new file mode 100644 index 0000000..1676527 --- /dev/null +++ b/permissionmanager/src/main/resources/base/media/file.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/permissionmanager/src/main/resources/base/media/ic_location.svg b/permissionmanager/src/main/resources/base/media/ic_location.svg new file mode 100644 index 0000000..62dea3f --- /dev/null +++ b/permissionmanager/src/main/resources/base/media/ic_location.svg @@ -0,0 +1,43 @@ + + + ic_location + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/permissionmanager/src/main/resources/base/media/ic_public_privacy.svg b/permissionmanager/src/main/resources/base/media/ic_public_privacy.svg new file mode 100644 index 0000000..b45136d --- /dev/null +++ b/permissionmanager/src/main/resources/base/media/ic_public_privacy.svg @@ -0,0 +1,13 @@ + + + Public/ic_public_Privacy + + + + + + + + + + \ No newline at end of file diff --git a/permissionmanager/src/main/resources/zh_CN/element/string.json b/permissionmanager/src/main/resources/zh_CN/element/string.json index 24dffe4..3a5e6de 100644 --- a/permissionmanager/src/main/resources/zh_CN/element/string.json +++ b/permissionmanager/src/main/resources/zh_CN/element/string.json @@ -605,36 +605,20 @@ "value": "权限管理" }, { - "name": "Temporarily_authorize", - "value": "临时授权“" + "name": "SecurityTitle_location", + "value": "安全访问位置信息" }, { - "name": "To_access", - "value": "”访问" + "name": "SecurityTitle_mediaFiles", + "value": "安全访问媒体和文件" }, { - "name": "location_desc", - "value": "位置信息" + "name": "SecurityDescription_location", + "value": "此按钮通过系统安全认证,仅允许“%s”在您点击此按钮时,临时访问位置信息,以减少您的隐私数据被应用持续获取。" }, { - "name": "media_files_desc", - "value": "媒体和文件" - }, - { - "name": "location_button_desc", - "value": "此按钮通过系统安全认证," - }, - { - "name": "only_can_desc", - "value": "仅允许应用在您点击此按钮时,临时访问" - }, - { - "name": "only_after_desc", - "value": "," - }, - { - "name": "prevent_desc", - "value": "以减少您的隐私数据被应用持续获取。" + "name": "SecurityDescription_mediaFiles", + "value": "此按钮通过系统安全认证,仅允许“%s”在您点击此按钮时,临时访问媒体和文件,以减少您的隐私数据被应用持续获取。" }, { "name": "Got_it",