MpaasUpgradeCheck.ets
1.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import { MPUpgradeService } from '@mpaas/upgrade'
import { MpaasUtils } from './MpaasUtils'
export class MpaasUpgradeCheck {
/// 默认提示框
checkNewVersionAndShow() {
try {
MPUpgradeService.checkNewVersionAndShow()
} catch (error) {
console.log("mpaas upgrade fail", JSON.stringify(error))
}
}
async checkNewVersion() {
const utdid = await MpaasUtils.mpaasUtdid()
console.log("mpaas utdid: ", utdid)
MPUpgradeService.checkNewVersion().then((response)=>{
let str = JSON.stringify(response)
console.log("mpaas upgrade check", str)
AlertDialog.show(
{
title: '升级检测结果',
message: str,
autoCancel: true,
offset: { dx: 0, dy: -20 },
gridCount: 3,
confirm: {
value: '确认',
action: () => {
console.info('upgrade result',response)
}
},
cancel: () => {
console.info('Closed callbacks')
}
}
)
}).catch((error: Error) => {
console.log("mpaas upgrade fail", `name: ${error.name}, message: ${error.message}, \nstack: ${error.stack}`)
})
}
}