xugenyuan

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

import { url } from '@kit.ArkTS'
import { RetryHolderManager } from '@ohos/imageknife/src/main/ets/components/imageknife/holder/RetryHolderManager'
import App from '@system.app'
import { Action, Params } from 'wdBean/Index'
import { ExtraDTO } from 'wdBean/src/main/ets/bean/component/extra/ExtraDTO'
... ... @@ -17,12 +18,12 @@ export class AppInnerLink {
// 内链跳转
// 内链地址例如:rmrbapp://rmrb.app/openwith?type=article&subType=h5_template_article&contentId=30000762651&relId=500000038702&skipType=1&relType=1
static jumpWithLink(innerLink: string) {
static jumpWithLink(innerLink: string) : boolean {
let params = AppInnerLink.parseParams(innerLink)
if (!params) {
Logger.info(TAG, "跳转无效的链接地址 " + innerLink)
return
return false
}
switch (params.skipType) {
... ... @@ -48,8 +49,10 @@ export class AppInnerLink {
}
default: {
Logger.info(TAG, "跳转无效的链接地址 " + innerLink)
return false
}
}
return true
}
private static jumpParams(params: InnerLinkParam) {
... ...
... ... @@ -252,16 +252,18 @@ export class StartupManager {
private dealWithDeepLink(want: Want): boolean {
if (!want.parameters) {
return false
// H5换端地址
let innerLink = want["uri"] as string
if (innerLink && innerLink.length) {
return AppInnerLink.jumpWithLink(innerLink)
}
let deepLink = want.parameters[NewspaperWidgetCommon.JumpParam.DeepLinkKey] as string
if (deepLink && deepLink.length) {
AppInnerLink.jumpWithLink(deepLink)
return true
if (want.parameters) {
// 桌面组件换端
let deepLink = want.parameters[NewspaperWidgetCommon.JumpParam.DeepLinkKey] as string
if (deepLink && deepLink.length) {
return AppInnerLink.jumpWithLink(deepLink)
}
}
return false
}
... ...
... ... @@ -29,7 +29,7 @@
"audioPlayback"
],
"skills": [
{
{ // App Linking 跳转
"entities": [
"entity.system.browsable"
],
... ... @@ -37,11 +37,6 @@
"ohos.want.action.viewData"
],
"uris": [
// { // 之前的 推送配置
// "scheme": 'rmrbapp',
// "host": 'rmrb.app',
// 'port': '8080',
// "path": 'openwith'}
{
"scheme": "https",
"host": "pd-people-uat.pdnews.cn",
... ... @@ -145,39 +140,39 @@
],
"domainVerify": true
},
{
{ // 默认的
"entities": [
"entity.system.home",
],
"actions": [
"com.test.pushaction",
"action.system.home",
],
},
{"uris": [
{ // 推送配置 - (播控中心共用)
"scheme": 'rmrbapp',
"host": 'rmrb.app',
'port': '8080',
"path": 'openwith'
},
{ // 普通配置 - 暂时无法跳转 - ??
{ // H5换端
"actions": [
"ohos.want.action.viewData"
],
"uris": [
{
"scheme": "rmrbapp",
"host": "rmrb.app",
"path": "openwith"
},
// { // 分享用 - 正式环境地址
// "scheme": "https",
// "host": "www.peopleapp.com",
// "pathStartWith": "column"
// },
// { // 分享用 - 测试环境地址
// "scheme": "https",
// "host": "pd-people-uat.pdnews.cn",
//// "pathStartWith": "column"
// }
]}
]},
{ // 推送
"actions": [
"com.test.pushaction"
],
"uris": [
{
"scheme": 'rmrbapp',
"host": 'rmrb.app',
'port': '8080',
"path": 'openwith'
}
]
},
]
}
],
... ...