xugenyuan

ref |> 统一uri配置。解决推送、H5换端等问题

1 import { url } from '@kit.ArkTS' 1 import { url } from '@kit.ArkTS'
  2 +import { RetryHolderManager } from '@ohos/imageknife/src/main/ets/components/imageknife/holder/RetryHolderManager'
2 import App from '@system.app' 3 import App from '@system.app'
3 import { Action, Params } from 'wdBean/Index' 4 import { Action, Params } from 'wdBean/Index'
4 import { ExtraDTO } from 'wdBean/src/main/ets/bean/component/extra/ExtraDTO' 5 import { ExtraDTO } from 'wdBean/src/main/ets/bean/component/extra/ExtraDTO'
@@ -17,12 +18,12 @@ export class AppInnerLink { @@ -17,12 +18,12 @@ export class AppInnerLink {
17 18
18 // 内链跳转 19 // 内链跳转
19 // 内链地址例如:rmrbapp://rmrb.app/openwith?type=article&subType=h5_template_article&contentId=30000762651&relId=500000038702&skipType=1&relType=1 20 // 内链地址例如:rmrbapp://rmrb.app/openwith?type=article&subType=h5_template_article&contentId=30000762651&relId=500000038702&skipType=1&relType=1
20 - static jumpWithLink(innerLink: string) { 21 + static jumpWithLink(innerLink: string) : boolean {
21 22
22 let params = AppInnerLink.parseParams(innerLink) 23 let params = AppInnerLink.parseParams(innerLink)
23 if (!params) { 24 if (!params) {
24 Logger.info(TAG, "跳转无效的链接地址 " + innerLink) 25 Logger.info(TAG, "跳转无效的链接地址 " + innerLink)
25 - return 26 + return false
26 } 27 }
27 28
28 switch (params.skipType) { 29 switch (params.skipType) {
@@ -48,8 +49,10 @@ export class AppInnerLink { @@ -48,8 +49,10 @@ export class AppInnerLink {
48 } 49 }
49 default: { 50 default: {
50 Logger.info(TAG, "跳转无效的链接地址 " + innerLink) 51 Logger.info(TAG, "跳转无效的链接地址 " + innerLink)
  52 + return false
51 } 53 }
52 } 54 }
  55 + return true
53 } 56 }
54 57
55 private static jumpParams(params: InnerLinkParam) { 58 private static jumpParams(params: InnerLinkParam) {
@@ -252,16 +252,18 @@ export class StartupManager { @@ -252,16 +252,18 @@ export class StartupManager {
252 252
253 private dealWithDeepLink(want: Want): boolean { 253 private dealWithDeepLink(want: Want): boolean {
254 254
255 - if (!want.parameters) {  
256 - return false 255 + // H5换端地址
  256 + let innerLink = want["uri"] as string
  257 + if (innerLink && innerLink.length) {
  258 + return AppInnerLink.jumpWithLink(innerLink)
257 } 259 }
258 260
259 - let deepLink = want.parameters[NewspaperWidgetCommon.JumpParam.DeepLinkKey] as string  
260 -  
261 - if (deepLink && deepLink.length) {  
262 -  
263 - AppInnerLink.jumpWithLink(deepLink)  
264 - return true 261 + if (want.parameters) {
  262 + // 桌面组件换端
  263 + let deepLink = want.parameters[NewspaperWidgetCommon.JumpParam.DeepLinkKey] as string
  264 + if (deepLink && deepLink.length) {
  265 + return AppInnerLink.jumpWithLink(deepLink)
  266 + }
265 } 267 }
266 return false 268 return false
267 } 269 }
@@ -29,7 +29,7 @@ @@ -29,7 +29,7 @@
29 "audioPlayback" 29 "audioPlayback"
30 ], 30 ],
31 "skills": [ 31 "skills": [
32 - { 32 + { // App Linking 跳转
33 "entities": [ 33 "entities": [
34 "entity.system.browsable" 34 "entity.system.browsable"
35 ], 35 ],
@@ -37,11 +37,6 @@ @@ -37,11 +37,6 @@
37 "ohos.want.action.viewData" 37 "ohos.want.action.viewData"
38 ], 38 ],
39 "uris": [ 39 "uris": [
40 - // { // 之前的 推送配置  
41 - // "scheme": 'rmrbapp',  
42 - // "host": 'rmrb.app',  
43 - // 'port': '8080',  
44 - // "path": 'openwith'}  
45 { 40 {
46 "scheme": "https", 41 "scheme": "https",
47 "host": "pd-people-uat.pdnews.cn", 42 "host": "pd-people-uat.pdnews.cn",
@@ -145,39 +140,39 @@ @@ -145,39 +140,39 @@
145 ], 140 ],
146 "domainVerify": true 141 "domainVerify": true
147 }, 142 },
148 - { 143 + { // 默认的
149 "entities": [ 144 "entities": [
150 "entity.system.home", 145 "entity.system.home",
151 ], 146 ],
152 "actions": [ 147 "actions": [
153 - "com.test.pushaction",  
154 "action.system.home", 148 "action.system.home",
155 ], 149 ],
156 150
157 }, 151 },
158 - {"uris": [  
159 - { // 推送配置 - (播控中心共用)  
160 - "scheme": 'rmrbapp',  
161 - "host": 'rmrb.app',  
162 - 'port': '8080',  
163 - "path": 'openwith'  
164 - },  
165 - { // 普通配置 - 暂时无法跳转 - ?? 152 + { // H5换端
  153 + "actions": [
  154 + "ohos.want.action.viewData"
  155 + ],
  156 + "uris": [
  157 + {
166 "scheme": "rmrbapp", 158 "scheme": "rmrbapp",
167 "host": "rmrb.app", 159 "host": "rmrb.app",
168 "path": "openwith" 160 "path": "openwith"
169 }, 161 },
170 - // { // 分享用 - 正式环境地址  
171 - // "scheme": "https",  
172 - // "host": "www.peopleapp.com",  
173 - // "pathStartWith": "column"  
174 - // },  
175 - // { // 分享用 - 测试环境地址  
176 - // "scheme": "https",  
177 - // "host": "pd-people-uat.pdnews.cn",  
178 - //// "pathStartWith": "column"  
179 - // }  
180 - ]} 162 + ]},
  163 + { // 推送
  164 + "actions": [
  165 + "com.test.pushaction"
  166 + ],
  167 + "uris": [
  168 + {
  169 + "scheme": 'rmrbapp',
  170 + "host": 'rmrb.app',
  171 + 'port': '8080',
  172 + "path": 'openwith'
  173 + }
  174 + ]
  175 + },
181 ] 176 ]
182 } 177 }
183 ], 178 ],