@@ -6,15 +6,15 @@ import { common, Want, bundleManager } from '@kit.AbilityKit'
66import { getAppVersion, getResourceStr } from '../utils/utils'
77import { rcp } from '@kit.RemoteCommunicationKit'
88import fs from '@ohos.file.fs'
9- import { updateManager } from '@kit.AppGalleryKit'
9+ import { commentManager, updateManager } from '@kit.AppGalleryKit'
1010import RouterUtil from '../utils/routerUtil'
1111
1212interface ComponentPart {
1313 title: Resource
1414 list: ComponentItem[]
1515}
1616interface ComponentItem {
17- name: ResourceStr,
17+ name: ResourceStr
1818 path: string
1919}
2020interface Tab {
@@ -294,6 +294,10 @@ struct Index {
294294 name: $r("app.string.component_textEllipsis"),
295295 path: "TextEllipsis"
296296 },
297+ {
298+ name: $r("app.string.component_tree"),
299+ path: "Tree"
300+ },
297301 {
298302 name: $r("app.string.component_watermark"),
299303 path: "Watermark"
@@ -437,6 +441,7 @@ struct Index {
437441 private context = this.getUIContext().getHostContext() as common.UIAbilityContext
438442 private router = this.getUIContext().getRouter()
439443 private navPathStack: NavPathStack = new NavPathStack()
444+ private timer: number = 0
440445
441446 @Builder tabBuilder(index: number){
442447 Column({space: 5}) {
@@ -610,7 +615,7 @@ struct Index {
610615 isLink: true,
611616 hasBorder: false,
612617 onCellClick: () => {
613- this.showCommentDialog ()
618+ this.viewAppStoreDetail ()
614619 }
615620 })
616621 }
@@ -663,10 +668,15 @@ struct Index {
663668 RouterUtil.navPathStackList.push(this.navPathStack)
664669 this.checkUpdate()
665670 this.getUiVersion()
671+ this.showCommentDialog()
666672 // setTimeout(() => {
667- // RouterUtil.push("Switch ")
673+ // RouterUtil.push("Tree ")
668674 // }, 100)
669675 }
676+ aboutToDisappear(): void {
677+ clearInterval(this.timer)
678+ this.timer = 0
679+ }
670680 getTitleOpacity(){
671681 // let scrollY = this.scrollTop < 50 ? this.scrollTop : 50
672682 return this.scrollTop < 50 ? 0 : 1
@@ -730,10 +740,21 @@ struct Index {
730740 }
731741 // 提示评论
732742 showCommentDialog(){
733- // 评论弹框 6.0.0 支持
734- // commentManager.showCommentDialog(this.context).then(()=>{
735- // console.log("succeeded in showing commentDialog.");
736- // })
743+ let count = 0
744+ this.timer = setInterval(() => {
745+ count++
746+ if(count > 120){
747+ clearInterval(this.timer)
748+ commentManager.showCommentDialog(this.context).then(()=>{
749+ console.log("succeeded in showing commentDialog.");
750+ }).catch((error: BusinessError<Object>) => {
751+ console.log(`showCommentDialog failed, Code: ${error.code}, message: ${error.message}`);
752+ })
753+ }
754+ }, 1000)
755+ }
756+ // 跳转应用市场详情
757+ viewAppStoreDetail(){
737758 let bundleName = bundleManager.getBundleInfoForSelfSync(bundleManager.BundleFlag.GET_BUNDLE_INFO_DEFAULT).name
738759 let link = 'https://appgallery.huawei.com/app/detail?id=' + bundleName + '&action=write-review'
739760 this.context.openLink(link, { appLinkingOnly: false })
0 commit comments