From 34004d29550914bcdec87cbd7986fac71076e8aa Mon Sep 17 00:00:00 2001 From: dengxiaoyu Date: Thu, 15 Aug 2024 11:50:01 +0800 Subject: [PATCH 1/8] add learnmore&update prompt Signed-off-by: dengxiaoyu --- .../src/main/ets/pages/ContinueSwitch.ets | 63 +++++++--- .../src/main/ets/utils/TipsJumpUtils.ets | 116 ++++++++++++++++++ .../main/resources/base/element/color.json | 4 + .../main/resources/base/element/string.json | 10 +- .../main/resources/zh_CN/element/string.json | 10 +- 5 files changed, 187 insertions(+), 16 deletions(-) create mode 100644 application/entry/src/main/ets/utils/TipsJumpUtils.ets diff --git a/application/entry/src/main/ets/pages/ContinueSwitch.ets b/application/entry/src/main/ets/pages/ContinueSwitch.ets index 31b510ae..e6756874 100644 --- a/application/entry/src/main/ets/pages/ContinueSwitch.ets +++ b/application/entry/src/main/ets/pages/ContinueSwitch.ets @@ -23,10 +23,12 @@ import mediaQuery from '@ohos.mediaquery'; import ConfigurationConstant from '@ohos.app.ability.ConfigurationConstant'; import CommonConstants from '../common/constants/CommonConstants'; import { logger } from '../utils/Logger'; +import { TipsJumpUtils } from '../utils/TipsJumpUtils'; const TAG = '[ContinueSwitch_Page] : '; let context = getContext(this) as common.UIAbilityContext; let localStorage = LocalStorage.getShared(); +const FUN_NUM = 'SF-20005815_f101'; interface switchStatus { open: string; @@ -64,6 +66,8 @@ struct ContinueSwitch { private listener: mediaQuery.MediaQueryListener = mediaQuery.matchMediaSync('(dark-mode:true)'); private extContext?: common.UIExtensionContext; private scroller: Scroller = new Scroller(); + private learnMore: ResourceStr = $r('app.string.learn_more'); + private continueDesc: ResourceStr = $r('app.string.continue_desc', ''); onPortrait(mediaQueryResult: mediaQuery.MediaQueryResult) { logger.info(TAG + 'onPortrait in'); @@ -231,18 +235,25 @@ struct ContinueSwitch { console.info(TAG + 'ImageAnimator Finish'); }) - Text($r('app.string.continue_desc')) - .fontSize($r('sys.float.ohos_id_text_size_body2')) - .fontWeight(FontWeight.Regular) - .margin({ bottom: CommonConstants.CONTINUE_DESC_TEXT_MARGIN_BOTTOM }) - .fontColor($r('sys.color.ohos_id_color_text_secondary')) - .textAlign(TextAlign.Center) - .width('100%') - .maxLines(10) - .onAreaChange((oldArea: Area, newArea: Area) => { - logger.info(TAG + 'Text:continue desc, oldArea.height = ' + oldArea.height + - ', newArea.height = ' + newArea.height); - }) + Text() { + Span(this.continueDesc) + .fontFamily('HarmonyHeiTi') + .fontSize($r('sys.float.ohos_id_text_size_body2')) + .fontColor($r('sys.color.ohos_id_color_text_secondary')) + .fontWeight(FontWeight.Regular) + Span(this.learnMore) + .fontFamily('HarmonyHeiTi') + .fontSize($r('sys.float.ohos_id_text_size_body2')) + .fontColor($r('app.color.color_0A59F7_blue')) + .fontWeight(FontWeight.Regular) + .onClick(() => { + TipsJumpUtils.jumpTips(getContext(this) as common.UIAbilityContext, FUN_NUM, '105'); + }) + } + .margin({ bottom: CommonConstants.CONTINUE_DESC_TEXT_MARGIN_BOTTOM }) + .textAlign(TextAlign.Center) + .width('100%') + Column() { Flex({ @@ -284,12 +295,36 @@ struct ContinueSwitch { .accessibilityText(this.title) }.width('100%') + Column() { + Flex({ + direction: FlexDirection.Row, + justifyContent: FlexAlign.SpaceBetween, + alignItems: ItemAlign.Center + }) { + SymbolGlyph($r('sys.symbol.info_circle_fill')) + .fontWeight(FontWeight.Lighter) + .fontSize(13) + .fontColor([$r('app.color.color_0A59F7_blue')]) + .margin({right:4}) + + Text($r('app.string.update_version_prompt')) + .fontSize($r('sys.float.ohos_id_text_size_body3')) + .fontWeight(FontWeight.Medium) + .fontColor($r('sys.color.ohos_id_color_text_primary')) + } + .margin({top:9}) + } + .padding({ + left: CommonConstants.TEXT_LIST_ALIGN_DISTANCE, + right: CommonConstants.TEXT_LIST_ALIGN_DISTANCE + }) + Column() { Row() { Text($r('app.string.continue_privacy_text')) .fontSize($r('sys.float.ohos_id_text_size_body3')) .fontWeight(FontWeight.Regular) - .margin({ top: CommonConstants.CONTINUE_PRIVACY_TEXT_MARGIN_TOP}) + .margin({ top: CommonConstants.CONTINUE_PRIVACY_TEXT_MARGIN_TOP }) .fontColor($r('sys.color.ohos_id_color_text_secondary')) .textAlign(TextAlign.Start) .width('100%') @@ -317,7 +352,7 @@ struct ContinueSwitch { .align(Alignment.TopStart) .friction(0.6) .edgeEffect(EdgeEffect.Spring) - .onScroll((xOffset: number, yOffset: number) => { + .onWillScroll((xOffset: number, yOffset: number) => { console.info(TAG + 'onScroll : xOffset:' + xOffset + ' ; yOffset' + yOffset); }) .onScrollEdge(() => { diff --git a/application/entry/src/main/ets/utils/TipsJumpUtils.ets b/application/entry/src/main/ets/utils/TipsJumpUtils.ets new file mode 100644 index 00000000..4026e5cf --- /dev/null +++ b/application/entry/src/main/ets/utils/TipsJumpUtils.ets @@ -0,0 +1,116 @@ +/* + * 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 bundleManager from '@ohos.bundle.bundleManager'; +import hilog from '@ohos.hilog'; +import Want from '@ohos.app.ability.Want'; +import { BusinessError } from '@ohos.base'; +import util from '@ohos.util'; + +const DOMAIN_ID = 0x3F3F; +const TAG = 'TipsJump'; +const APP_BUNDLE_NAME = 'com.huawei.hmos.tips'; +const TIPS_APP_ID = 'com.huawei.hmos.tips_BB4oLXt8JL0w5djd42S0oL0Gz06kOnT8hZfFRAAel2gbcQBG5jIsO4genni5cn2SQpkpkvkwOA7Ajsc7qf+MZgM='; +const MODULE_NAME_PHONE = 'phone_widget'; +const MODULE_NAME_PC = 'pc_widget'; +const URI_FORMATTER = 'hwtips://com.huawei.hmos.tips.app?funNum=%s&type=%s'; +const MODULE_NAME_APPGALLERY = 'com.huawei.hmsapp.appgallery'; +const URI_APPGALLERY = 'store://appgallery.huawei.com/app/detail?id=com.huawei.hmos.tips'; +const CODE_BUNDLE_NAME_NOT_FOUND = 17700001; +const CODE_SUCCESS_ERROR = 0; +const FUN_NUM_HOME = 'SF-20005815_f101'; +type startAbleContext = common.UIAbilityContext | common.ServiceExtensionContext; + +export class TipsJumpUtils { + /* + * Jump to Tips Home + * + * @param startAbleContext:common.UIAbilityContext | common.ServiceExtensionContext + * */ + public static jumpHome(context: startAbleContext, type: string, moduleName: string = MODULE_NAME_PHONE) { + TipsJumpUtils.jumpTips(context, FUN_NUM_HOME, type, moduleName ?? MODULE_NAME_PHONE) + } + + public static jumpTips(context: startAbleContext, funNum: string, type: string, moduleName: string = MODULE_NAME_PHONE) { + let uri = util.format(URI_FORMATTER, funNum, type); + TipsJumpUtils.jumpTipsByUri(context, uri, moduleName ?? MODULE_NAME_PHONE); + } + + public static jumpTipsByUri(context: startAbleContext, uri: string, moduleName: string = MODULE_NAME_PHONE) { + if (moduleName != MODULE_NAME_PHONE && moduleName !== MODULE_NAME_PC) { + hilog.error(DOMAIN_ID, TAG, `unknown moduleName, supported value:"${MODULE_NAME_PHONE}" or "${MODULE_NAME_PC}"`); + return; + } + TipsJumpUtils.isAppInstalled().then((isAppInstalled: boolean) => { + if (isAppInstalled) { + TipsJumpUtils.jumpAppByUri(context, uri); + } else { + TipsJumpUtils.jumpAppGallery(context); + } + }) + } + + public static jumpAppByUri(context: startAbleContext, uri: string) { + hilog.info(DOMAIN_ID, TAG, 'try to jump to app'); + const want: Want = { + bundleName: APP_BUNDLE_NAME, + action: 'ohos.want.action.viewData', + entities: ['entity.system.browsable'], + uri + }; + context.startAbility(want, (err: BusinessError) => { + if (err.code !== CODE_SUCCESS_ERROR) { + hilog.warn(DOMAIN_ID, TAG, 'jump to [tips app] failed, error: %{private}s', JSON.stringify(err)); + } else { + hilog.info(DOMAIN_ID, TAG, 'jump to [tips app] success'); + } + }) + } + + public static jumpAppGallery(context: startAbleContext) { + hilog.info(DOMAIN_ID, TAG, 'try to jump to AppGallery'); + const want: Want = { + bundleName: MODULE_NAME_APPGALLERY, + uri: URI_APPGALLERY + }; + context.startAbility(want).then(() => { + hilog.info(DOMAIN_ID, TAG, 'jump to AppGallery success'); + }).catch(() => { + hilog.warn(DOMAIN_ID, TAG, 'jump to AppGallery error'); + }) + } + + public static isAppInstalled(): Promise { + return bundleManager.getBundleInfo(APP_BUNDLE_NAME, bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_SIGNATURE_INFO) + .then((info) => { + if (TIPS_APP_ID === info.signatureInfo.appId) { + hilog.info(DOMAIN_ID, TAG, 'tips app is installed'); + return true; + } else { + hilog.warn(DOMAIN_ID, TAG, 'tips app is forged'); + return false; + } + }) + .catch((err: BusinessError) => { + if (err.code === CODE_BUNDLE_NAME_NOT_FOUND) { + hilog.info(DOMAIN_ID, TAG, 'tips app is not installed') + } else { + hilog.info(DOMAIN_ID, TAG, 'failed to check if tips app is installed, err: %{private}s', JSON.stringify(err)); + } + return false; + }) + + } +} \ No newline at end of file diff --git a/application/entry/src/main/resources/base/element/color.json b/application/entry/src/main/resources/base/element/color.json index 3c712962..a502679e 100644 --- a/application/entry/src/main/resources/base/element/color.json +++ b/application/entry/src/main/resources/base/element/color.json @@ -3,6 +3,10 @@ { "name": "start_window_background", "value": "#FFFFFF" + }, + { + "name": "color_0A59F7_blue", + "value": "#0A59F7" } ] } \ No newline at end of file diff --git a/application/entry/src/main/resources/base/element/string.json b/application/entry/src/main/resources/base/element/string.json index f8fb4373..d1d8e321 100644 --- a/application/entry/src/main/resources/base/element/string.json +++ b/application/entry/src/main/resources/base/element/string.json @@ -54,7 +54,7 @@ }, { "name": "continue_desc", - "value":"Continuation lets you start something on one device, then instantly pick it up on other devices nearby using the same HUAWEI ID. When continuation is available, an icon will appear in the app dock." + "value":"Continuation lets you start something on one device, then instantly pick it up on other devices nearby using the same HUAWEI ID. When continuation is available, an icon will appear in the app dock. %s" }, { "name": "multi_device_collaboration", @@ -63,6 +63,14 @@ { "name": "continue_privacy_text", "value":"This service uses Bluetooth and WLAN. During use, it will read this device's name and send it to devices you hop to. By turning this on, you agree to these terms." + }, + { + "name": "update_version_prompt", + "value":"The peer party must upgrade to HarmonyOS NEXT or later." + }, + { + "name": "learn_more", + "value":"Learn more" } ] } \ No newline at end of file diff --git a/application/entry/src/main/resources/zh_CN/element/string.json b/application/entry/src/main/resources/zh_CN/element/string.json index 3ae7bf4d..63ba7ffe 100644 --- a/application/entry/src/main/resources/zh_CN/element/string.json +++ b/application/entry/src/main/resources/zh_CN/element/string.json @@ -54,7 +54,7 @@ }, { "name":"continue_desc", - "value":"在一台设备上浏览或编辑内容后,只需在附近的另一台已登录相同华为账号设备的桌面任务栏上找到接续图标并点击,即可继续操作。" + "value":"在一台设备上浏览或编辑内容后,然后在附近另一台登录相同华为账号的设备的桌面任务栏上点击接续图标,即可继续使用。%s" }, { "name":"multi_device_collaboration", @@ -63,6 +63,14 @@ { "name":"continue_privacy_text", "value":"本服务使用过程中需要使用蓝牙和 WLAN 功能,读取并传送本设备名称到要接续的设备。打开开关,即表示您同意上述内容。" + }, + { + "name": "update_version_prompt", + "value":"对方需升级至 HarmonyOS NEXT 及以上版本。" + }, + { + "name": "learn_more", + "value":"了解详情" } ] } \ No newline at end of file -- Gitee From bd840605aeda84de23bbde56884e0f0efe2bb47d Mon Sep 17 00:00:00 2001 From: dengxiaoyu Date: Thu, 15 Aug 2024 12:15:37 +0800 Subject: [PATCH 2/8] add learnmore&update prompt Signed-off-by: dengxiaoyu --- .../src/main/ets/pages/ContinueSwitch.ets | 4 ++-- .../src/main/ets/utils/TipsJumpUtils.ets | 21 ++++++++++++------- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/application/entry/src/main/ets/pages/ContinueSwitch.ets b/application/entry/src/main/ets/pages/ContinueSwitch.ets index e6756874..32fb8eca 100644 --- a/application/entry/src/main/ets/pages/ContinueSwitch.ets +++ b/application/entry/src/main/ets/pages/ContinueSwitch.ets @@ -298,12 +298,12 @@ struct ContinueSwitch { Column() { Flex({ direction: FlexDirection.Row, - justifyContent: FlexAlign.SpaceBetween, + justifyContent: FlexAlign.Start, alignItems: ItemAlign.Center }) { SymbolGlyph($r('sys.symbol.info_circle_fill')) .fontWeight(FontWeight.Lighter) - .fontSize(13) + .fontSize(14) .fontColor([$r('app.color.color_0A59F7_blue')]) .margin({right:4}) diff --git a/application/entry/src/main/ets/utils/TipsJumpUtils.ets b/application/entry/src/main/ets/utils/TipsJumpUtils.ets index 4026e5cf..35bf880f 100644 --- a/application/entry/src/main/ets/utils/TipsJumpUtils.ets +++ b/application/entry/src/main/ets/utils/TipsJumpUtils.ets @@ -22,7 +22,7 @@ import util from '@ohos.util'; const DOMAIN_ID = 0x3F3F; const TAG = 'TipsJump'; const APP_BUNDLE_NAME = 'com.huawei.hmos.tips'; -const TIPS_APP_ID = 'com.huawei.hmos.tips_BB4oLXt8JL0w5djd42S0oL0Gz06kOnT8hZfFRAAel2gbcQBG5jIsO4genni5cn2SQpkpkvkwOA7Ajsc7qf+MZgM='; +const TIPS_APP_ID = 'com.huawei.hmos.tips_BB4oLXt8JLOw5djd42S0oLOGzO6kOnT8hZfFRAAel2gbcQBG5jIsO4genni5cn2SQpKpKvkwOA7Ajsc7qf+MZgM='; const MODULE_NAME_PHONE = 'phone_widget'; const MODULE_NAME_PC = 'pc_widget'; const URI_FORMATTER = 'hwtips://com.huawei.hmos.tips.app?funNum=%s&type=%s'; @@ -33,12 +33,17 @@ const CODE_SUCCESS_ERROR = 0; const FUN_NUM_HOME = 'SF-20005815_f101'; type startAbleContext = common.UIAbilityContext | common.ServiceExtensionContext; +/** + * cut in com.huawei.hmos.tips + * + */ export class TipsJumpUtils { - /* + /** * Jump to Tips Home * * @param startAbleContext:common.UIAbilityContext | common.ServiceExtensionContext - * */ + * @param type + */ public static jumpHome(context: startAbleContext, type: string, moduleName: string = MODULE_NAME_PHONE) { TipsJumpUtils.jumpTips(context, FUN_NUM_HOME, type, moduleName ?? MODULE_NAME_PHONE) } @@ -49,7 +54,7 @@ export class TipsJumpUtils { } public static jumpTipsByUri(context: startAbleContext, uri: string, moduleName: string = MODULE_NAME_PHONE) { - if (moduleName != MODULE_NAME_PHONE && moduleName !== MODULE_NAME_PC) { + if (moduleName !== MODULE_NAME_PHONE && moduleName !== MODULE_NAME_PC) { hilog.error(DOMAIN_ID, TAG, `unknown moduleName, supported value:"${MODULE_NAME_PHONE}" or "${MODULE_NAME_PC}"`); return; } @@ -62,9 +67,9 @@ export class TipsJumpUtils { }) } - public static jumpAppByUri(context: startAbleContext, uri: string) { + private static jumpAppByUri(context: startAbleContext, uri: string) { hilog.info(DOMAIN_ID, TAG, 'try to jump to app'); - const want: Want = { + let want: Want = { bundleName: APP_BUNDLE_NAME, action: 'ohos.want.action.viewData', entities: ['entity.system.browsable'], @@ -79,7 +84,7 @@ export class TipsJumpUtils { }) } - public static jumpAppGallery(context: startAbleContext) { + private static jumpAppGallery(context: startAbleContext) { hilog.info(DOMAIN_ID, TAG, 'try to jump to AppGallery'); const want: Want = { bundleName: MODULE_NAME_APPGALLERY, @@ -92,7 +97,7 @@ export class TipsJumpUtils { }) } - public static isAppInstalled(): Promise { + private static isAppInstalled(): Promise { return bundleManager.getBundleInfo(APP_BUNDLE_NAME, bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_SIGNATURE_INFO) .then((info) => { if (TIPS_APP_ID === info.signatureInfo.appId) { -- Gitee From 682532cdfdc8e9f8d770c697b28de1b8456f8c2f Mon Sep 17 00:00:00 2001 From: dengxiaoyu Date: Thu, 15 Aug 2024 15:03:14 +0800 Subject: [PATCH 3/8] add learnmore&update prompt Signed-off-by: dengxiaoyu --- application/AppScope/app.json | 6 +- application/AppScope/app.json5 | 6 +- application/build-profile.json5 | 8 +-- application/entry/build-profile.json5 | 2 +- .../ets/common/constants/CommonConstants.ets | 4 +- .../src/main/ets/pages/ContinueSwitch.ets | 11 ++-- .../src/main/ets/utils/TipsJumpUtils.ets | 53 ++++++++++++------ application/entry/src/main/module.json | 3 + application/entry/src/main/module.json5 | 3 + .../media/{continue_85.png => continue_0.png} | Bin 10 files changed, 62 insertions(+), 34 deletions(-) rename application/entry/src/main/resources/base/media/{continue_85.png => continue_0.png} (100%) diff --git a/application/AppScope/app.json b/application/AppScope/app.json index 4666e6fe..4ac61518 100644 --- a/application/AppScope/app.json +++ b/application/AppScope/app.json @@ -2,11 +2,11 @@ "app": { "bundleName": "com.ohos.dhardwareui", "vendor": "example", - "versionCode": 10000019, - "versionName": "1.0.19", + "versionCode": 10000020, + "versionName": "1.0.20", "icon": "$media:app_icon", "label": "$string:app_name", - "minAPIVersion": 11, + "minAPIVersion": 12, "targetAPIVersion": 12, "apiReleaseType": "Beta1", "debug": false diff --git a/application/AppScope/app.json5 b/application/AppScope/app.json5 index 50d0d7e3..e026e7be 100644 --- a/application/AppScope/app.json5 +++ b/application/AppScope/app.json5 @@ -16,11 +16,11 @@ "app": { "bundleName": "com.ohos.dhardwareui", "vendor": "example", - "versionCode": 10000019, - "versionName": "1.0.19", + "versionCode": 10000020, + "versionName": "1.0.20", "icon": "$media:app_icon", "label": "$string:app_name", - "minAPIVersion": 11, + "minAPIVersion": 12, "targetAPIVersion": 12, "apiReleaseType": "Beta1", "debug": false diff --git a/application/build-profile.json5 b/application/build-profile.json5 index 2de87c5f..0e049182 100644 --- a/application/build-profile.json5 +++ b/application/build-profile.json5 @@ -19,10 +19,10 @@ { "name": "default", "signingConfig": "default", - "compileSdkVersion": 11, - "compatibleSdkVersion": 11, - "targetSdkVersion": 11, - "runtimeOS": "OpenHarmony" + "compileSdkVersion": "5.0.0(12)", + "compatibleSdkVersion": "5.0.0(12)", + "targetSdkVersion": "5.0.0(12)", + "runtimeOS": "HarmonyOS" } ], "buildModeSet": [ diff --git a/application/entry/build-profile.json5 b/application/entry/build-profile.json5 index caf14acb..31522064 100644 --- a/application/entry/build-profile.json5 +++ b/application/entry/build-profile.json5 @@ -20,7 +20,7 @@ "targets": [ { "name": "default", - "runtimeOS": "OpenHarmony" + "runtimeOS": "HarmonyOS" }, { "name": "ohosTest", diff --git a/application/entry/src/main/ets/common/constants/CommonConstants.ets b/application/entry/src/main/ets/common/constants/CommonConstants.ets index a2654763..b4fedb62 100644 --- a/application/entry/src/main/ets/common/constants/CommonConstants.ets +++ b/application/entry/src/main/ets/common/constants/CommonConstants.ets @@ -15,7 +15,7 @@ export default class CommonConstants { //ContinueSwitch page : - static readonly IMAGE_COUNT:number = 85; + static readonly IMAGE_COUNT:number = 84; static readonly IMG_ANIMATOR_OVER_DURATION:number = 1000; static readonly IMG_ANIMATOR_NORMAL_DURATION:number = 30; static readonly SWITCH_STATUS_OPEN:string = '1'; @@ -31,4 +31,6 @@ export default class CommonConstants { static readonly CONTINUE_PRIVACY_TEXT_MARGIN_TOP:number = 8; static readonly CONTINUE_SWITCH_WIDTH:number = 36; static readonly CONTINUE_SWITCH_HEIGHT:number = 20; + static readonly TIPS_TYPE:string = '105'; + static readonly FUN_NUM = 'SF-20005815_f101'; } \ No newline at end of file diff --git a/application/entry/src/main/ets/pages/ContinueSwitch.ets b/application/entry/src/main/ets/pages/ContinueSwitch.ets index 32fb8eca..3fc2cab0 100644 --- a/application/entry/src/main/ets/pages/ContinueSwitch.ets +++ b/application/entry/src/main/ets/pages/ContinueSwitch.ets @@ -28,7 +28,6 @@ import { TipsJumpUtils } from '../utils/TipsJumpUtils'; const TAG = '[ContinueSwitch_Page] : '; let context = getContext(this) as common.UIAbilityContext; let localStorage = LocalStorage.getShared(); -const FUN_NUM = 'SF-20005815_f101'; interface switchStatus { open: string; @@ -244,10 +243,10 @@ struct ContinueSwitch { Span(this.learnMore) .fontFamily('HarmonyHeiTi') .fontSize($r('sys.float.ohos_id_text_size_body2')) - .fontColor($r('app.color.color_0A59F7_blue')) + .fontColor($r('sys.color.ohos_id_color_text_primary_activated')) .fontWeight(FontWeight.Regular) .onClick(() => { - TipsJumpUtils.jumpTips(getContext(this) as common.UIAbilityContext, FUN_NUM, '105'); + TipsJumpUtils.jumpTips(getContext(this) as common.UIAbilityContext, CommonConstants.FUN_NUM, CommonConstants.TIPS_TYPE); }) } .margin({ bottom: CommonConstants.CONTINUE_DESC_TEXT_MARGIN_BOTTOM }) @@ -304,15 +303,15 @@ struct ContinueSwitch { SymbolGlyph($r('sys.symbol.info_circle_fill')) .fontWeight(FontWeight.Lighter) .fontSize(14) - .fontColor([$r('app.color.color_0A59F7_blue')]) - .margin({right:4}) + .fontColor([$r('sys.color.ohos_id_color_activated')]) + .margin({ right: 4 }) Text($r('app.string.update_version_prompt')) .fontSize($r('sys.float.ohos_id_text_size_body3')) .fontWeight(FontWeight.Medium) .fontColor($r('sys.color.ohos_id_color_text_primary')) } - .margin({top:9}) + .margin({ top: 9 }) } .padding({ left: CommonConstants.TEXT_LIST_ALIGN_DISTANCE, diff --git a/application/entry/src/main/ets/utils/TipsJumpUtils.ets b/application/entry/src/main/ets/utils/TipsJumpUtils.ets index 35bf880f..61766296 100644 --- a/application/entry/src/main/ets/utils/TipsJumpUtils.ets +++ b/application/entry/src/main/ets/utils/TipsJumpUtils.ets @@ -22,7 +22,8 @@ import util from '@ohos.util'; const DOMAIN_ID = 0x3F3F; const TAG = 'TipsJump'; const APP_BUNDLE_NAME = 'com.huawei.hmos.tips'; -const TIPS_APP_ID = 'com.huawei.hmos.tips_BB4oLXt8JLOw5djd42S0oLOGzO6kOnT8hZfFRAAel2gbcQBG5jIsO4genni5cn2SQpKpKvkwOA7Ajsc7qf+MZgM='; +const TIPS_APP_ID = + 'com.huawei.hmos.tips_BB4oLXt8JLOw5djd42S0oLOGzO6kOnT8hZfFRAAel2gbcQBG5jIsO4genni5cn2SQpKpKvkwOA7Ajsc7qf+MZgM='; const MODULE_NAME_PHONE = 'phone_widget'; const MODULE_NAME_PC = 'pc_widget'; const URI_FORMATTER = 'hwtips://com.huawei.hmos.tips.app?funNum=%s&type=%s'; @@ -33,26 +34,39 @@ const CODE_SUCCESS_ERROR = 0; const FUN_NUM_HOME = 'SF-20005815_f101'; type startAbleContext = common.UIAbilityContext | common.ServiceExtensionContext; -/** - * cut in com.huawei.hmos.tips - * - */ export class TipsJumpUtils { /** * Jump to Tips Home * * @param startAbleContext:common.UIAbilityContext | common.ServiceExtensionContext - * @param type + * @param type: entry type ID, used for dotting + * @param moduleName: phone_widget: jump phone, pc_widget: jump pc */ public static jumpHome(context: startAbleContext, type: string, moduleName: string = MODULE_NAME_PHONE) { - TipsJumpUtils.jumpTips(context, FUN_NUM_HOME, type, moduleName ?? MODULE_NAME_PHONE) + TipsJumpUtils.jumpTips(context, FUN_NUM_HOME, type, moduleName ?? MODULE_NAME_PHONE); } - public static jumpTips(context: startAbleContext, funNum: string, type: string, moduleName: string = MODULE_NAME_PHONE) { + /** + * Jump to the specified page of Tips by FUN_NUM + * + * @param startAbleContext:common.UIAbilityContext | common.ServiceExtensionContext + * @param funNum: page FUN_NUM + * @param type: entry type ID, used for dotting + * @param moduleName: phone_widget: jump phone, pc_widget: jump pc + */ + public static jumpTips(context: startAbleContext, funNum: string, type: string, + moduleName: string = MODULE_NAME_PHONE) { let uri = util.format(URI_FORMATTER, funNum, type); TipsJumpUtils.jumpTipsByUri(context, uri, moduleName ?? MODULE_NAME_PHONE); } + /** + * Jump to the specified page of Tips by uri + * + * @param startAbleContext:common.UIAbilityContext | common.ServiceExtensionContext + * @param uri: uri format:hwtips://com.huawei.hmos.tips.app?funNum=xxx&type=xxx + * @param moduleName: phone_widget: jump phone, pc_widget: jump pc + */ public static jumpTipsByUri(context: startAbleContext, uri: string, moduleName: string = MODULE_NAME_PHONE) { if (moduleName !== MODULE_NAME_PHONE && moduleName !== MODULE_NAME_PC) { hilog.error(DOMAIN_ID, TAG, `unknown moduleName, supported value:"${MODULE_NAME_PHONE}" or "${MODULE_NAME_PC}"`); @@ -67,8 +81,14 @@ export class TipsJumpUtils { }) } + /** + * Jump to Tips APP by uri + * + * @param startAbleContext:common.UIAbilityContext | common.ServiceExtensionContext + * @param uri: uri format:hwtips://com.huawei.hmos.tips.app?funNum=xxx&type=xxx + */ private static jumpAppByUri(context: startAbleContext, uri: string) { - hilog.info(DOMAIN_ID, TAG, 'try to jump to app'); + hilog.info(DOMAIN_ID, TAG, 'try jump to tips app'); let want: Want = { bundleName: APP_BUNDLE_NAME, action: 'ohos.want.action.viewData', @@ -81,20 +101,22 @@ export class TipsJumpUtils { } else { hilog.info(DOMAIN_ID, TAG, 'jump to [tips app] success'); } - }) + }); } + /** + * Jump to AppGallery by uri + * + * @param startAbleContext:common.UIAbilityContext | common.ServiceExtensionContext + */ private static jumpAppGallery(context: startAbleContext) { hilog.info(DOMAIN_ID, TAG, 'try to jump to AppGallery'); - const want: Want = { - bundleName: MODULE_NAME_APPGALLERY, - uri: URI_APPGALLERY - }; + const want: Want = { bundleName: MODULE_NAME_APPGALLERY, uri: URI_APPGALLERY }; context.startAbility(want).then(() => { hilog.info(DOMAIN_ID, TAG, 'jump to AppGallery success'); }).catch(() => { hilog.warn(DOMAIN_ID, TAG, 'jump to AppGallery error'); - }) + }); } private static isAppInstalled(): Promise { @@ -116,6 +138,5 @@ export class TipsJumpUtils { } return false; }) - } } \ No newline at end of file diff --git a/application/entry/src/main/module.json b/application/entry/src/main/module.json index 474e7e29..003ff296 100644 --- a/application/entry/src/main/module.json +++ b/application/entry/src/main/module.json @@ -46,6 +46,9 @@ }, { "name": "ohos.permission.MANAGE_SETTINGS" + }, + { + "name": "ohos.permission.GET_BUNDLE_INFO" } ], "extensionAbilities": [ diff --git a/application/entry/src/main/module.json5 b/application/entry/src/main/module.json5 index c1ba8beb..375f6d77 100644 --- a/application/entry/src/main/module.json5 +++ b/application/entry/src/main/module.json5 @@ -60,6 +60,9 @@ }, { "name": "ohos.permission.MANAGE_SETTINGS" + }, + { + "name": "ohos.permission.GET_BUNDLE_INFO" } ], "extensionAbilities": [ diff --git a/application/entry/src/main/resources/base/media/continue_85.png b/application/entry/src/main/resources/base/media/continue_0.png similarity index 100% rename from application/entry/src/main/resources/base/media/continue_85.png rename to application/entry/src/main/resources/base/media/continue_0.png -- Gitee From 88ac3a1f51251dd3d92e8a635499306efa01d225 Mon Sep 17 00:00:00 2001 From: dengxiaoyu Date: Thu, 15 Aug 2024 15:12:04 +0800 Subject: [PATCH 4/8] add learnmore&update prompt Signed-off-by: dengxiaoyu --- application/entry/src/main/ets/pages/ContinueSwitch.ets | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/application/entry/src/main/ets/pages/ContinueSwitch.ets b/application/entry/src/main/ets/pages/ContinueSwitch.ets index 3fc2cab0..d488fc94 100644 --- a/application/entry/src/main/ets/pages/ContinueSwitch.ets +++ b/application/entry/src/main/ets/pages/ContinueSwitch.ets @@ -246,7 +246,8 @@ struct ContinueSwitch { .fontColor($r('sys.color.ohos_id_color_text_primary_activated')) .fontWeight(FontWeight.Regular) .onClick(() => { - TipsJumpUtils.jumpTips(getContext(this) as common.UIAbilityContext, CommonConstants.FUN_NUM, CommonConstants.TIPS_TYPE); + TipsJumpUtils.jumpTips(getContext(this) as common.UIAbilityContext, CommonConstants.FUN_NUM, + CommonConstants.TIPS_TYPE); }) } .margin({ bottom: CommonConstants.CONTINUE_DESC_TEXT_MARGIN_BOTTOM }) -- Gitee From 3286effb48d5a9a459ce2b47dacd92653130a61b Mon Sep 17 00:00:00 2001 From: dengxiaoyu Date: Thu, 15 Aug 2024 15:34:21 +0800 Subject: [PATCH 5/8] add learnmore&update prompt Signed-off-by: dengxiaoyu --- application/entry/src/main/ets/pages/ContinueSwitch.ets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/application/entry/src/main/ets/pages/ContinueSwitch.ets b/application/entry/src/main/ets/pages/ContinueSwitch.ets index d488fc94..55de3c90 100644 --- a/application/entry/src/main/ets/pages/ContinueSwitch.ets +++ b/application/entry/src/main/ets/pages/ContinueSwitch.ets @@ -244,7 +244,7 @@ struct ContinueSwitch { .fontFamily('HarmonyHeiTi') .fontSize($r('sys.float.ohos_id_text_size_body2')) .fontColor($r('sys.color.ohos_id_color_text_primary_activated')) - .fontWeight(FontWeight.Regular) + .fontWeight(FontWeight.Medium) .onClick(() => { TipsJumpUtils.jumpTips(getContext(this) as common.UIAbilityContext, CommonConstants.FUN_NUM, CommonConstants.TIPS_TYPE); -- Gitee From 12267c8a3334a380e4c646c9cbb4ff5797dd9da9 Mon Sep 17 00:00:00 2001 From: dengxiaoyu Date: Thu, 15 Aug 2024 15:57:49 +0800 Subject: [PATCH 6/8] add learnmore&update prompt Signed-off-by: dengxiaoyu --- .../src/main/ets/common/constants/CommonConstants.ets | 1 + application/entry/src/main/ets/pages/ContinueSwitch.ets | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/application/entry/src/main/ets/common/constants/CommonConstants.ets b/application/entry/src/main/ets/common/constants/CommonConstants.ets index b4fedb62..f412baaf 100644 --- a/application/entry/src/main/ets/common/constants/CommonConstants.ets +++ b/application/entry/src/main/ets/common/constants/CommonConstants.ets @@ -28,6 +28,7 @@ export default class CommonConstants { static readonly PC_BORDER_RADIUS:number = 16; static readonly NON_PC_BORDER_RADIUS:number = 20; static readonly CONTINUE_DESC_TEXT_MARGIN_BOTTOM:number = 32; + static readonly CONTINUE_DESC_TEXT_MARGIN_TOP:number = 24; static readonly CONTINUE_PRIVACY_TEXT_MARGIN_TOP:number = 8; static readonly CONTINUE_SWITCH_WIDTH:number = 36; static readonly CONTINUE_SWITCH_HEIGHT:number = 20; diff --git a/application/entry/src/main/ets/pages/ContinueSwitch.ets b/application/entry/src/main/ets/pages/ContinueSwitch.ets index 55de3c90..c466d279 100644 --- a/application/entry/src/main/ets/pages/ContinueSwitch.ets +++ b/application/entry/src/main/ets/pages/ContinueSwitch.ets @@ -250,11 +250,13 @@ struct ContinueSwitch { CommonConstants.TIPS_TYPE); }) } - .margin({ bottom: CommonConstants.CONTINUE_DESC_TEXT_MARGIN_BOTTOM }) + .margin({ + bottom: CommonConstants.CONTINUE_DESC_TEXT_MARGIN_BOTTOM, + top: CommonConstants.CONTINUE_DESC_TEXT_MARGIN_TOP + }) .textAlign(TextAlign.Center) .width('100%') - Column() { Flex({ direction: FlexDirection.Row, @@ -311,6 +313,7 @@ struct ContinueSwitch { .fontSize($r('sys.float.ohos_id_text_size_body3')) .fontWeight(FontWeight.Medium) .fontColor($r('sys.color.ohos_id_color_text_primary')) + .textAlign(TextAlign.Center) } .margin({ top: 9 }) } -- Gitee From cd3d2a5076a0136185bdbdad3b06f1c6b8a496b9 Mon Sep 17 00:00:00 2001 From: dengxiaoyu Date: Thu, 15 Aug 2024 16:37:59 +0800 Subject: [PATCH 7/8] add learnmore&update prompt Signed-off-by: dengxiaoyu --- .../src/main/ets/common/constants/CommonConstants.ets | 7 +++++++ application/entry/src/main/ets/pages/ContinueSwitch.ets | 9 +++++---- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/application/entry/src/main/ets/common/constants/CommonConstants.ets b/application/entry/src/main/ets/common/constants/CommonConstants.ets index f412baaf..bd1f007b 100644 --- a/application/entry/src/main/ets/common/constants/CommonConstants.ets +++ b/application/entry/src/main/ets/common/constants/CommonConstants.ets @@ -32,6 +32,13 @@ export default class CommonConstants { static readonly CONTINUE_PRIVACY_TEXT_MARGIN_TOP:number = 8; static readonly CONTINUE_SWITCH_WIDTH:number = 36; static readonly CONTINUE_SWITCH_HEIGHT:number = 20; + // Tips static readonly TIPS_TYPE:string = '105'; static readonly FUN_NUM = 'SF-20005815_f101'; + // Symbol + static readonly SYMBOL_INFO_CIRCLE:number = 14; + static readonly SYMBOL_MARGIN_RIGHT:number = 4; + // Update prompt text + static readonly UPDATE_PROMPT_LINE_HEIGHT:number = 16; + static readonly UPDATE_PROMPT_MARGIN_TOP:number = 9; } \ No newline at end of file diff --git a/application/entry/src/main/ets/pages/ContinueSwitch.ets b/application/entry/src/main/ets/pages/ContinueSwitch.ets index c466d279..3671b721 100644 --- a/application/entry/src/main/ets/pages/ContinueSwitch.ets +++ b/application/entry/src/main/ets/pages/ContinueSwitch.ets @@ -304,18 +304,19 @@ struct ContinueSwitch { alignItems: ItemAlign.Center }) { SymbolGlyph($r('sys.symbol.info_circle_fill')) - .fontWeight(FontWeight.Lighter) - .fontSize(14) + .fontWeight(FontWeight.Medium) + .fontSize(CommonConstants.SYMBOL_INFO_CIRCLE) .fontColor([$r('sys.color.ohos_id_color_activated')]) - .margin({ right: 4 }) + .margin({ right: CommonConstants.SYMBOL_MARGIN_RIGHT }) Text($r('app.string.update_version_prompt')) .fontSize($r('sys.float.ohos_id_text_size_body3')) .fontWeight(FontWeight.Medium) .fontColor($r('sys.color.ohos_id_color_text_primary')) .textAlign(TextAlign.Center) + .lineHeight(CommonConstants.UPDATE_PROMPT_LINE_HEIGHT) } - .margin({ top: 9 }) + .margin({ top: CommonConstants.UPDATE_PROMPT_MARGIN_TOP }) } .padding({ left: CommonConstants.TEXT_LIST_ALIGN_DISTANCE, -- Gitee From ce58c8e5cb6baa4298e4b517723ea7c8d24f6eb2 Mon Sep 17 00:00:00 2001 From: dengxiaoyu Date: Thu, 15 Aug 2024 17:32:45 +0800 Subject: [PATCH 8/8] add learnmore&update prompt Signed-off-by: dengxiaoyu --- .../entry/src/main/ets/common/constants/CommonConstants.ets | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/application/entry/src/main/ets/common/constants/CommonConstants.ets b/application/entry/src/main/ets/common/constants/CommonConstants.ets index bd1f007b..88b7b17c 100644 --- a/application/entry/src/main/ets/common/constants/CommonConstants.ets +++ b/application/entry/src/main/ets/common/constants/CommonConstants.ets @@ -29,7 +29,7 @@ export default class CommonConstants { static readonly NON_PC_BORDER_RADIUS:number = 20; static readonly CONTINUE_DESC_TEXT_MARGIN_BOTTOM:number = 32; static readonly CONTINUE_DESC_TEXT_MARGIN_TOP:number = 24; - static readonly CONTINUE_PRIVACY_TEXT_MARGIN_TOP:number = 8; + static readonly CONTINUE_PRIVACY_TEXT_MARGIN_TOP:number = 4; static readonly CONTINUE_SWITCH_WIDTH:number = 36; static readonly CONTINUE_SWITCH_HEIGHT:number = 20; // Tips -- Gitee