xugenyuan

ref |> 早晚报桌面组件跳转App页面处理

Signed-off-by: xugenyuan <xugenyuan@wondertek.com.cn>
@@ -4,7 +4,7 @@ import { ContentType } from 'wdRouter/Index'; @@ -4,7 +4,7 @@ import { ContentType } from 'wdRouter/Index';
4 4
5 export class DeepLinkUtil { 5 export class DeepLinkUtil {
6 6
7 - private static DEEP_LINK_PREFIX = "rmrbapp:rmrb.app/openwith" 7 + private static DEEP_LINK_PREFIX = "rmrbapp://rmrb.app/openwith"
8 8
9 static generateDeepLinkWithConent(content: ContentDetailDTO): string { 9 static generateDeepLinkWithConent(content: ContentDetailDTO): string {
10 10
@@ -23,7 +23,7 @@ export class DeepLinkUtil { @@ -23,7 +23,7 @@ export class DeepLinkUtil {
23 private static generate(contentType: number, contentId?: string, relId?: string, link?: string): string { 23 private static generate(contentType: number, contentId?: string, relId?: string, link?: string): string {
24 let deeplink = DeepLinkUtil.DEEP_LINK_PREFIX 24 let deeplink = DeepLinkUtil.DEEP_LINK_PREFIX
25 25
26 - let pubParam = `&contentId=${contentId}}&relId=${relId}&skipType=1` 26 + let pubParam = `&contentId=${contentId}&relId=${relId}&skipType=1`
27 27
28 let type: ContentType = Number(contentType) 28 let type: ContentType = Number(contentType)
29 switch (type) { 29 switch (type) {
@@ -38,7 +38,7 @@ export class DeepLinkUtil { @@ -38,7 +38,7 @@ export class DeepLinkUtil {
38 deeplink += "?type=article&subType=h5" 38 deeplink += "?type=article&subType=h5"
39 deeplink += "&url=" + encodeURIComponent(link) 39 deeplink += "&url=" + encodeURIComponent(link)
40 } else { 40 } else {
41 - deeplink += "type=article&subType=h5_template_article" 41 + deeplink += "?type=article&subType=h5_template_article"
42 } 42 }
43 break 43 break
44 case ContentType.DynamicImageText: 44 case ContentType.DynamicImageText:
@@ -151,14 +151,12 @@ function jumpWithDeepLink(deepLink: string, component: Object) { @@ -151,14 +151,12 @@ function jumpWithDeepLink(deepLink: string, component: Object) {
151 if (deepLink.length == 0) { 151 if (deepLink.length == 0) {
152 return 152 return
153 } 153 }
154 - const deepLinkKey: string = NewspaperWidgetCommon.JumpParam.DeepLinkKey  
155 - const fromDailyNewspaperKey: string = NewspaperWidgetCommon.JumpParam.FromNewspaperWidgetKey  
156 postCardAction(component, { 154 postCardAction(component, {
157 action: NewspaperWidgetCommon.PosterCardAction.ActionRouter, 155 action: NewspaperWidgetCommon.PosterCardAction.ActionRouter,
158 abilityName: NewspaperWidgetCommon.PosterCardAction.MainAbilityName, 156 abilityName: NewspaperWidgetCommon.PosterCardAction.MainAbilityName,
159 params: { 157 params: {
160 - deepLinkKey: deepLink,  
161 - fromDailyNewspaperKey: true 158 + "newspaper.widget.jump.deeplink": deepLink,
  159 + "newspaper.widget.jump.fromNewspaperWidget": 1
162 } 160 }
163 }); 161 });
164 } 162 }
@@ -12,13 +12,14 @@ import { DeviceUtil, @@ -12,13 +12,14 @@ import { DeviceUtil,
12 UmengStats } from 'wdKit/Index' 12 UmengStats } from 'wdKit/Index'
13 import { LoginModule } from 'wdLogin/Index' 13 import { LoginModule } from 'wdLogin/Index'
14 import { HostEnum, HostManager, WDHttp } from 'wdNetwork/Index' 14 import { HostEnum, HostManager, WDHttp } from 'wdNetwork/Index'
15 -import { registerRouter } from 'wdRouter/Index' 15 +import { AppInnerLink, registerRouter } from 'wdRouter/Index'
16 import { TrackingModule } from 'wdTracking/Index' 16 import { TrackingModule } from 'wdTracking/Index'
17 import { JSON } from '@kit.ArkTS' 17 import { JSON } from '@kit.ArkTS'
18 import app from '@system.app' 18 import app from '@system.app'
19 import { GetuiPush, HWLocationUtils } from 'wdHwAbility/Index' 19 import { GetuiPush, HWLocationUtils } from 'wdHwAbility/Index'
20 import { ImageKnife, ImageKnifeGlobal } from '@ohos/imageknife' 20 import { ImageKnife, ImageKnifeGlobal } from '@ohos/imageknife'
21 import { webview } from '@kit.ArkWeb' 21 import { webview } from '@kit.ArkWeb'
  22 +import { NewspaperWidgetCommon } from '../dailynewspaperwidget/common/NewspaperWidgetCommon'
22 23
23 const TAG = "[StartupManager]" 24 const TAG = "[StartupManager]"
24 25
@@ -26,6 +27,7 @@ const TAG = "[StartupManager]" @@ -26,6 +27,7 @@ const TAG = "[StartupManager]"
26 export class StartupManager { 27 export class StartupManager {
27 28
28 private context?: common.UIAbilityContext 29 private context?: common.UIAbilityContext
  30 + private lastStartupWant?: Want
29 31
30 private constructor() { 32 private constructor() {
31 } 33 }
@@ -74,10 +76,14 @@ export class StartupManager { @@ -74,10 +76,14 @@ export class StartupManager {
74 // 通知栏点击后启动 76 // 通知栏点击后启动
75 GetuiPush.sharedInstance().onWant(want) 77 GetuiPush.sharedInstance().onWant(want)
76 Logger.debug(TAG, "App onCreate: finised") 78 Logger.debug(TAG, "App onCreate: finised")
  79 +
  80 + this.lastStartupWant = want
77 } 81 }
78 82
79 appOnNewWant(want: Want, launchParam: AbilityConstant.LaunchParam) { 83 appOnNewWant(want: Want, launchParam: AbilityConstant.LaunchParam) {
80 GetuiPush.sharedInstance().onNewWant(want) 84 GetuiPush.sharedInstance().onNewWant(want)
  85 +
  86 + this.dealWithDeepLink(want)
81 } 87 }
82 88
83 appOnDestory() { 89 appOnDestory() {
@@ -124,6 +130,10 @@ export class StartupManager { @@ -124,6 +130,10 @@ export class StartupManager {
124 //TODO: 130 //TODO:
125 // 提前初始化webview 131 // 提前初始化webview
126 webview.WebviewController.initializeWebEngine() 132 webview.WebviewController.initializeWebEngine()
  133 +
  134 + if (this.lastStartupWant && this.dealWithDeepLink(this.lastStartupWant)) {
  135 + this.lastStartupWant = undefined
  136 + }
127 resolve() 137 resolve()
128 }) 138 })
129 } 139 }
@@ -195,4 +205,20 @@ export class StartupManager { @@ -195,4 +205,20 @@ export class StartupManager {
195 private initOthers() { 205 private initOthers() {
196 206
197 } 207 }
  208 +
  209 + private dealWithDeepLink(want: Want): boolean {
  210 +
  211 + if (!want.parameters) {
  212 + return false
  213 + }
  214 +
  215 + let deepLink = want.parameters[NewspaperWidgetCommon.JumpParam.DeepLinkKey] as string
  216 +
  217 + if (deepLink && deepLink.length) {
  218 +
  219 + AppInnerLink.jumpWithLink(deepLink)
  220 + return true
  221 + }
  222 + return false
  223 + }
198 } 224 }