Toggle navigation
Toggle navigation
This project
Loading...
Sign in
developOne
/
harmonyPool
Go to a project
Toggle navigation
Projects
Groups
Snippets
Help
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
xugenyuan
2024-05-09 16:38:36 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
3ad68543793ed8c66d6cefeca4a1e42d169bb4c0
3ad68543
1 parent
9f5232d7
ref |> 新增普通升级和强制升级对话框
Signed-off-by: xugenyuan <xugenyuan@wondertek.com.cn>
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
104 additions
and
14 deletions
sight_harmony/products/phone/src/main/ets/pages/MainPage.ets
sight_harmony/products/phone/src/main/ets/pages/upgradePage/UpgradeTipDialog.ets
sight_harmony/products/phone/src/main/resources/base/media/wd_upgrade_close.png
sight_harmony/products/phone/src/main/resources/base/media/wd_upgrade_rocket.png
sight_harmony/products/phone/src/main/ets/pages/MainPage.ets
View file @
3ad6854
...
...
@@ -7,6 +7,7 @@ import { BreakpointSystem, EmitterEventId, EmitterUtils, Logger, MpaasUpgradeChe
import router from '@ohos.router';
import { promptAction } from '@kit.ArkUI';
import { UpgradeTipDialog } from "./upgradePage/UpgradeTipDialog"
import { ProcessUtils } from 'wdRouter/Index';
const TAG = 'MainPage';
...
...
@@ -66,8 +67,8 @@ struct MainPage {
Logger.info(TAG, 'onPageShow');
this.pageShow = Math.random()
// TODO: 升级检查,暂时不开放
// this.upgradeCheck()
// 升级检查
this.upgradeCheck()
}
upgradeCheck() {
...
...
@@ -77,8 +78,19 @@ struct MainPage {
this.upgradeDialogController = new CustomDialogController({
builder: UpgradeTipDialog({
tipContent:data
})
tipContent:data,
confirm: () => {
ProcessUtils.jumpExternalWebPage(data.downloadUrl);
}
}),
autoCancel: false,
alignment: DialogAlignment.Center,
customStyle: true,
offset: {
dx: 0,
dy: 20
},
backgroundColor: "#50000000",
})
this.upgradeDialogController?.open()
}
...
...
sight_harmony/products/phone/src/main/ets/pages/upgradePage/UpgradeTipDialog.ets
View file @
3ad6854
import { UpgradeTipContent } from 'wdKit/Index'
import {
DeviceUtil, DisplayUtils,
UpgradeTipContent } from 'wdKit/Index'
@Preview
@CustomDialog
...
...
@@ -8,27 +8,105 @@ export struct UpgradeTipDialog {
confirm?: () => void
controller: CustomDialogController
maxHeight: number = 0
maxWidth: number = 0
scroller: Scroller = new Scroller();
aboutToAppear(): void {
this.maxHeight = DisplayUtils.getDeviceHeight() * 0.6
this.maxWidth = DisplayUtils.getDeviceWidth() * 0.76
// this.tipContent.content = "1、啊啊啊啊啊啊\n2、啊啊啊啊啊\n4、阿斯兰减肥的垃圾发电1、啊啊啊啊啊啊\n2、啊啊啊啊啊\n4、阿斯兰减肥的垃圾发电1、啊啊啊啊啊啊\n2、啊啊啊啊啊\n4、阿斯兰减肥的垃圾发电1、啊啊啊啊啊啊\n2、啊啊啊啊啊\n4、阿斯兰减肥的垃圾发电1、啊啊啊啊啊啊\n2、啊啊啊啊啊\n4、阿斯兰减肥的垃圾发电1、啊啊啊啊啊啊\n2、啊啊啊啊啊\n4、阿斯兰减肥的垃圾发电1、啊啊啊啊啊啊\n2、啊啊啊啊啊\n4、阿斯兰减肥的垃圾发电1、啊啊啊啊啊啊\n2、啊啊啊啊啊\n4、阿斯兰减肥的垃圾发电1、啊啊啊啊啊啊\n2、啊啊啊啊啊\n4、阿斯兰减肥的垃圾发电1、啊啊啊啊啊啊\n2、啊啊啊啊啊\n4、阿斯兰减肥的垃圾发电1、啊啊啊啊啊啊\n2、啊啊啊啊啊\n4、阿斯兰减肥的垃圾发电1、啊啊啊啊啊啊\n2、啊啊啊啊啊\n4、阿斯兰减肥的垃圾发电1、啊啊啊啊啊啊\n2、啊啊啊啊啊\n4、阿斯兰减肥的垃圾发电1、啊啊啊啊啊啊\n2、啊啊啊啊啊\n4、阿斯兰减肥的垃圾发电1、啊啊啊啊啊啊\n2、啊啊啊啊啊\n4、阿斯兰减肥的垃圾发电1、啊啊啊啊啊啊\n2、啊啊啊啊啊\n4、阿斯兰减肥的垃圾发电1、啊啊啊啊啊啊\n2、啊啊啊啊啊\n4、阿斯兰减肥的垃圾发电"
// this.tipContent.forceUpgrade = false
}
build() {
Column() {
Text(this.tipContent.content).fontSize(20).margin({ top: 10, bottom: 10 })
Flex({ justifyContent: FlexAlign.SpaceAround }) {
Button('cancel')
Image($r("app.media.wd_upgrade_rocket"))
.objectFit(ImageFit.Fill)
.width(this.maxWidth).height(147)
this.CenterContainer()
// 关闭按钮
Row() {
Image($r("app.media.wd_upgrade_close"))
.width(32).height(32)
.margin({top: 24})
.onClick(() => {
this.controller.close()
if (this.cancel) {
this.cancel()
}
}).backgroundColor(0xffffff).fontColor(Color.Black)
Button('立即升级')
})
}.justifyContent(FlexAlign.SpaceBetween)
.visibility(this.tipContent.forceUpgrade ? Visibility.Hidden: Visibility.Visible)
}
.height(this.maxHeight)
}
@Builder CenterContainer() {
Column() {
Text(`V${this.tipContent.newVersion}版本更新说明`)
.fontColor("#222222")
.fontSize(18)
.textAlign(TextAlign.Center)
Scroll(this.scroller) {
Column() {
Row() {
Text(this.tipContent.content)
.fontColor("#000000")
.fontSize(14)
.textAlign(TextAlign.Start)
}
.alignItems(VerticalAlign.Top)
.width("100%")
// .height("100%") // 设置后,无法滚动。TODO:内容较短,高度问题待解决
}
.padding({left: 24, right: 24})
}
.width("100%")
.margin({top: 16, bottom: 2})
// .backgroundColor(Color.Brown)
.layoutWeight(1)
/// 灰色线
Row().width("100%").height(1).backgroundColor("#50E6E6E6")
Button() {
Text("立即升级").fontColor(Color.White)
}.borderRadius(4)
.buttonStyle(ButtonStyleMode.NORMAL)
.type(ButtonType.Normal)
.backgroundColor("#ED2800")
.width("90%")
.height(40)
.margin({
top: 12, bottom: 12
})
.onClick(() => {
this.controller.close()
if (this.confirm) {
this.confirm()
}
}).backgroundColor(0xffffff).fontColor(Color.Red)
}.margin({ bottom: 10 })
})
if (this.tipContent.forceUpgrade) {
Text("温馨提示:本次更新为必要更新,若您选择拒绝,将无法再使用app")
.fontColor("999999")
.fontSize(12)
.fontWeight(400)
.lineHeight(17)
.margin({
left: 16, right: 16, bottom: 12
})
}
}
.justifyContent(FlexAlign.SpaceBetween)
.backgroundColor(Color.White)
.width(this.maxWidth)
.layoutWeight(1)
}
}
\ No newline at end of file
...
...
sight_harmony/products/phone/src/main/resources/base/media/wd_upgrade_close.png
0 → 100644
View file @
3ad6854
4.24 KB
sight_harmony/products/phone/src/main/resources/base/media/wd_upgrade_rocket.png
0 → 100644
View file @
3ad6854
26.7 KB
Please
register
or
login
to post a comment