diff --git a/permissionmanager/src/main/ets/SecurityExtAbility/SecurityExtAbility.ts b/permissionmanager/src/main/ets/SecurityExtAbility/SecurityExtAbility.ts index 6cd22580321569ff98e8ff84ff654f3b27fbcc84..e96ea015ca22574147341b8b8210a2deee9e436e 100644 --- a/permissionmanager/src/main/ets/SecurityExtAbility/SecurityExtAbility.ts +++ b/permissionmanager/src/main/ets/SecurityExtAbility/SecurityExtAbility.ts @@ -17,13 +17,10 @@ import extension from '@ohos.app.ability.ServiceExtensionAbility'; import window from '@ohos.window'; import display from '@ohos.display'; import { GlobalContext } from '../common/utils/globalContext'; -import { preferences } from '@kit.ArkData'; import { Configuration } from '@ohos.app.ability.Configuration'; -const DELAY = 1000; const TAG = 'PermissionManager_Log:'; const BG_COLOR = '#00000000'; -let dataPreferences: preferences.Preferences | null = null; export default class SecurityExtensionAbility extends extension { /** @@ -51,8 +48,6 @@ export default class SecurityExtensionAbility extends extension { width: dis.width, height: dis.height }; - let options: preferences.Options = { name: 'myStore' }; - dataPreferences = preferences.getPreferencesSync(this.context, options); this.createWindow('SecurityDialog' + startId, window.WindowType.TYPE_DIALOG, navigationBarRect, want); } catch (exception) { console.error(TAG + 'Failed to obtain the default display object. Code: ' + JSON.stringify(exception)); @@ -68,12 +63,6 @@ export default class SecurityExtensionAbility extends extension { onConfigurationUpdate(newConfig: Configuration): void { console.info(TAG + 'onConfigurationUpdate: ' + JSON.stringify(newConfig)); - dataPreferences?.putSync('language', newConfig.language); - setTimeout(() => { - dataPreferences?.flush(() => { - console.info(TAG + 'dataPreferences update.'); - }); - }, DELAY); } private async createWindow(name: string, windowType, rect, want): Promise { @@ -91,7 +80,7 @@ export default class SecurityExtensionAbility extends extension { } try { const win = await window.createWindow({ ctx: this.context, name, windowType }); - let storage: LocalStorage = new LocalStorage({ 'want': want, 'win': win, 'dataPreferences': dataPreferences }); + let storage: LocalStorage = new LocalStorage({ 'want': want, 'win': win }); await win.bindDialogTarget(want.parameters['ohos.ability.params.token'].value, () => { win.destroyWindow(); let dialogSet: Set = GlobalContext.load('dialogSet'); diff --git a/permissionmanager/src/main/ets/pages/securityDialog.ets b/permissionmanager/src/main/ets/pages/securityDialog.ets index 9d8ca196358ac25d285f46daa994545298ab090d..94d735b1a0185743e9d517262d60f1aefb98ed14 100644 --- a/permissionmanager/src/main/ets/pages/securityDialog.ets +++ b/permissionmanager/src/main/ets/pages/securityDialog.ets @@ -22,7 +22,6 @@ import { CustomContentDialog } from '@ohos.arkui.advanced.Dialog'; import { Log, getFontSizeScale } from '../common/utils/utils'; import { Param, WantInfo } from '../common/model/typedef'; import { GlobalContext } from '../common/utils/globalContext'; -import { preferences } from '@kit.ArkData'; import bundleResourceManager from '@ohos.bundle.bundleResourceManager'; let storage = LocalStorage.getShared(); @@ -42,7 +41,6 @@ struct SecurityDialog { private context = getContext(this) as common.ServiceExtensionContext; @LocalStorageLink('want') want: WantInfo = new WantInfo([]); @LocalStorageLink('win') win: window.Window = {} as window.Window; - @LocalStorageLink('dataPreferences') dataPreferences: preferences.Preferences | null = null; @State appName: ResourceStr = 'Application'; @State appIndex: number = 0; @State index: number = 0; @@ -50,10 +48,10 @@ struct SecurityDialog { securityParams : Array = [ new Param( - $r('app.media.ic_location'), $r('app.string.SecurityTitle_location'), 'app.string.SecurityDescription_location' + $r('app.media.ic_location'), $r('app.string.SecurityTitle_location'), 'app.string.SecurityText_location' ), new Param( - $r('app.media.rawfile'), $r('app.string.SecurityTitle_mediaFiles'), 'app.string.SecurityDescription_mediaFiles' + $r('app.media.rawfile'), $r('app.string.SecurityTitle_mediaFiles'), 'app.string.SecurityText_mediaFiles' ) ] @@ -176,7 +174,11 @@ struct SecurityDialog { Column() { // content this.DialogTitle(); - Text($r(this.securityParams[this.index].description, this.appName)) + Text($r( + this.securityParams[this.index].description, + this.appName, + this.appIndex === 0 ? '' : String(this.appIndex) + )) .textAlign(TextAlign.Start) .fontColor($r('sys.color.font_primary')) .fontSize($r('sys.float.Body_L')) @@ -206,10 +208,6 @@ struct SecurityDialog { this.GetAppName(); this.index = this.want.parameters['ohos.user.security.type']; this.dialogController?.open(); - this.dataPreferences?.on('change', (key: string) => { - Log.info('dataPreferences change.'); - this.appIndex === 0 ? null : this.GetAppName(); - }) } aboutToDisappear() { @@ -222,7 +220,7 @@ struct SecurityDialog { bundleManager.getAppCloneIdentity(uid).then(cloneInfo => { Log.info(`getAppCloneIdentity: ${JSON.stringify(cloneInfo)}`); this.appIndex = cloneInfo.appIndex; - cloneInfo.appIndex === 0 ? this.getSelfName(cloneInfo) : this.getCloneName(cloneInfo); + this.getSelfName(cloneInfo); }).catch((err: BusinessError) => { Log.error(`getAppCloneIdentity failed: ${JSON.stringify(err)}`); }) diff --git a/permissionmanager/src/main/resources/base/element/string.json b/permissionmanager/src/main/resources/base/element/string.json index e7091dc752be9c06abf42f5d938effd17c02b4ce..d180cdebf8842b6d314c6aae531fe37571555e55 100644 --- a/permissionmanager/src/main/resources/base/element/string.json +++ b/permissionmanager/src/main/resources/base/element/string.json @@ -690,6 +690,20 @@ "priority":"LT" } }, + { + "name":"SecurityText_location", + "value":"To protect your privacy, %1$s%2$s can only briefly access your location when you tap Allow.", + "attr":{ + "priority":"translate" + } + }, + { + "name":"SecurityText_mediaFiles", + "value":"To protect your privacy, %1$s%2$s can only briefly access your Gallery to save items when you tap Allow.", + "attr":{ + "priority":"translate" + } + }, { "name":"Download", "value":"Download" diff --git a/permissionmanager/src/main/resources/bo_CN/element/string.json b/permissionmanager/src/main/resources/bo_CN/element/string.json index 6912432531016bf964b62bfdaf31c32eb5bba9aa..8a8a1db781996974780e4c75cd59400e320a8d89 100644 --- a/permissionmanager/src/main/resources/bo_CN/element/string.json +++ b/permissionmanager/src/main/resources/bo_CN/element/string.json @@ -28,6 +28,20 @@ "priority":"translate" } }, + { + "name":"SecurityText_location", + "value":"༼%1$s%2$s༽ཡིས་ཁྱེད་ཀྱིས་གནོན་མཐེབ་འདིར་རྡེབ་སྐབས་ཁོ་ནར་གནས་ཡུལ་ལ་ལྟ་སྤྱོད་བྱ་ཆོག", + "attr":{ + "priority":"translate" + } + }, + { + "name":"SecurityText_mediaFiles", + "value":"༼%1$s%2$s༽ཡིས་ཁྱེད་ཀྱིས་གནོན་མཐེབ་འདིར་རྡེབ་སྐབས་ཁོ་ནར་པར་མཛོད་དུ་འདྲ་པར་དང་བརྙན་ཟློས་ཉར་ཚགས་ཁོ་ན་བྱ་ཆོག", + "attr":{ + "priority":"translate" + } + }, { "name":"SecurityTitle_location", "value":"གནས་ཡུལ་ལ་བདེ་འཇགས་ངང་ལྟ་སྤྱོད་བྱེད་པ།", diff --git a/permissionmanager/src/main/resources/ug/element/string.json b/permissionmanager/src/main/resources/ug/element/string.json index c861241df374b88351c0728f683d074895c8fa3e..6273a9f29af8e45b2344caadb3c4e952e526c106 100644 --- a/permissionmanager/src/main/resources/ug/element/string.json +++ b/permissionmanager/src/main/resources/ug/element/string.json @@ -28,6 +28,20 @@ "priority":"translate" } }, + { + "name":"SecurityText_location", + "value":"\u200f«%1$s %2$s» پەقەت سىز رۇخسەت كۇنۇپكىسىنى چەككەن ۋاقىتتا ئورۇن ئۇچۇرىنى ئوقۇيالايدۇ.", + "attr":{ + "priority":"translate" + } + }, + { + "name":"SecurityText_mediaFiles", + "value":"\u200f«%1$s %2$s» پەقەت سىز رۇخسەت كۇنۇپكىسىنى چەككەن ۋاقىتتا ئامبارغا رەسىم ۋە سىن ساقلىيالايدۇ.", + "attr":{ + "priority":"translate" + } + }, { "name":"SecurityTitle_location", "value":"بىخەتەر ئورۇن ئىجازىتى", diff --git a/permissionmanager/src/main/resources/zh_CN/element/string.json b/permissionmanager/src/main/resources/zh_CN/element/string.json index 60f8b9b8becfd9650a4021c636e0b544a0993c7d..734589b24bffff04bdb87711e0091ca0a37d11de 100644 --- a/permissionmanager/src/main/resources/zh_CN/element/string.json +++ b/permissionmanager/src/main/resources/zh_CN/element/string.json @@ -690,6 +690,20 @@ "priority":"translate" } }, + { + "name":"SecurityText_location", + "value":"仅允许“%1$s%2$s”在您点击此按钮时访问位置。", + "attr":{ + "priority":"translate" + } + }, + { + "name":"SecurityText_mediaFiles", + "value":"仅允许“%1$s%2$s”在您点击此按钮时保存图片和视频至图库。", + "attr":{ + "priority":"translate" + } + }, { "name":"Download", "value":"下载" diff --git a/permissionmanager/src/main/resources/zh_HK/element/string.json b/permissionmanager/src/main/resources/zh_HK/element/string.json index aabb2801387373df3c8d737753fe36a8a78cbf28..1fbb15cedaaba55ed0d81eaa41569f213d614330 100644 --- a/permissionmanager/src/main/resources/zh_HK/element/string.json +++ b/permissionmanager/src/main/resources/zh_HK/element/string.json @@ -28,6 +28,20 @@ "priority":"translate" } }, + { + "name":"SecurityText_location", + "value":"僅允許「%1$s%2$s」在您輕觸此按鈕時存取位置。", + "attr":{ + "priority":"translate" + } + }, + { + "name":"SecurityText_mediaFiles", + "value":"僅允許「%1$s%2$s」在您輕觸此按鈕時儲存圖片和影片至圖片庫。", + "attr":{ + "priority":"translate" + } + }, { "name":"SecurityTitle_location", "value":"安全存取位置", diff --git a/permissionmanager/src/main/resources/zh_TW/element/string.json b/permissionmanager/src/main/resources/zh_TW/element/string.json index ada6cd1d740370527880d27712e742339006cef6..4d84ff138e92b6f37cced3bbc3d4989680c047ae 100644 --- a/permissionmanager/src/main/resources/zh_TW/element/string.json +++ b/permissionmanager/src/main/resources/zh_TW/element/string.json @@ -28,6 +28,20 @@ "priority":"translate" } }, + { + "name":"SecurityText_location", + "value":"在您輕觸此按鈕時,僅允許「%1$s%2$s」存取位置。", + "attr":{ + "priority":"translate" + } + }, + { + "name":"SecurityText_mediaFiles", + "value":"在您輕觸此按鈕時,僅允許「%1$s%2$s」將圖片和影片儲存至圖片庫。", + "attr":{ + "priority":"translate" + } + }, { "name":"SecurityTitle_location", "value":"安全存取位置", diff --git a/permissionmanager/src/main/resources/zz_ZX/element/string.json b/permissionmanager/src/main/resources/zz_ZX/element/string.json index af35288b8bf2d64a074dabe19916458ab10fef4f..4696cff9ff56ece96e42cfebff4bd6422db70739 100644 --- a/permissionmanager/src/main/resources/zz_ZX/element/string.json +++ b/permissionmanager/src/main/resources/zz_ZX/element/string.json @@ -16,6 +16,14 @@ "name":"SecurityDescription_mediaFiles", "value":"[TS_950753]_To protect your privacy, %s can only briefly access your Gallery to save items when you tap Allow." }, + { + "name":"SecurityText_location", + "value":"[TS_1015861]_To protect your privacy, %1$s%2$s can only briefly access your location when you tap Allow." + }, + { + "name":"SecurityText_mediaFiles", + "value":"[TS_1015860]_To protect your privacy, %1$s%2$s can only briefly access your Gallery to save items when you tap Allow." + }, { "name":"SecurityTitle_location", "value":"[TS_950716]_Private access to location"