xugenyuan

ref |> 补充推送内链跳转与设置别名问题解决

Signed-off-by: xugenyuan <xugenyuan@wondertek.com.cn>
import { url } from '@kit.ArkTS'
import App from '@system.app'
import { Action, Params } from 'wdBean/Index'
import { ExtraDTO } from 'wdBean/src/main/ets/bean/component/extra/ExtraDTO'
import { Logger } from 'wdKit/Index'
import { WDRouterRule } from '../router/WDRouterRule'
import { ProcessUtils } from './ProcessUtils'
const TAG = "AppInnerLink"
... ... @@ -8,7 +12,7 @@ export class AppInnerLink {
static readonly INNER_LINK_PROTCOL = "rmrbapp:"
static readonly INNER_LINK_HOSTNAME = "rmrb.app"
static readonly INNER_LINK_PATHNAME = "openwith"
static readonly INNER_LINK_PATHNAME = "/openwith"
// 内链跳转
// 内链地址例如:rmrbapp://rmrb.app/openwith?type=article&subType=h5_template_article&contentId=30000762651&relId=500000038702&skipType=1&relType=1
... ... @@ -48,19 +52,110 @@ export class AppInnerLink {
}
private static jumpParams(params: InnerLinkParam) {
if (!AppInnerLink.validTypes(params.type)) {
return
}
const contentType = AppInnerLink.contentTypeWithType(params.type)
if (params.type == "article") {
let taskAction: Action = {
type: 'JUMP_INNER_NEW_PAGE',
params: {
contentID: params.contentId,
pageID: 'IMAGE_TEXT_DETAIL',
extra: {
relType: params.relType,
relId: params.relId,
sourcePage: '5', // ???
} as ExtraDTO
} as Params,
};
WDRouterRule.jumpWithAction(taskAction)
return
}
if (params.type == "video"
|| params.type == "dynamic"
|| params.type == "live"
|| params.type == "audio"
|| params.type == "picture") {
let taskAction: Action = {
type: 'JUMP_DETAIL_PAGE',
params: {
detailPageType: contentType,
contentID: params.contentId,
extra: {
relType: params.relType,
relId: params.relId,
} as ExtraDTO
} as Params,
};
WDRouterRule.jumpWithAction(taskAction)
return
}
if (params.type == "owner_page" && params.creatorId) {
ProcessUtils.gotoPeopleShipHomePage(params.creatorId)
return
}
if (params.type == "topic") {
}
if (params.type == "channel") {
}
}
private static contentTypeWithType(type?: string) : number | undefined {
switch (type) {
case "video": return 1
case "dynamic": return 14
case "live": return 2
case "audio": return 13
case "picture": return 9
case "article": return 8
case "ask": return 16
}
return
}
private static validTypes(type?: string) : boolean {
if (!type) {
return false
}
let typeArray = ["article", "dynamic", "live", "video", "topic", "audio", "ask", "picture", "owner_page", "topic", "channel"]
return typeArray.indexOf(type) != -1
}
private static jumpNoParams(params: InnerLinkParam) {
if (!params.type || params.type != "app" || !params.subType) {
return
}
if (params.subType == "login") {
ProcessUtils.gotoLoginPage();
} else if (params.subType == "search") {
} else if (params.subType == "home") {
} else if (params.subType == "mine") {
}
}
private static jumpAppH5(params: InnerLinkParam) {
private static jumpAppH5(params: InnerLinkParam) {
if (params.type && params.type == "h5" && params.url) {
ProcessUtils.gotoDefaultWebPage(params.url);
}
}
private static jumpOutH5(params: InnerLinkParam) {
if (params.type && params.type == "h5" && params.url) {
ProcessUtils.jumpExternalWebPage(params.url);
}
}
private static jumpThirdApp(params: InnerLinkParam) {
//TODO:
}
static parseParams(link: string) : InnerLinkParam | undefined {
... ...
... ... @@ -149,6 +149,9 @@ export class GetuiPush {
}
setAlias(bind: boolean, alias: string, sn: string = this.ALIAS_SN_USERID) {
if (typeof alias == "number") {
alias = `${alias}`
}
if (!this.initialed) { return }
if (bind) {
Logger.debug(TAG, "推送 绑定别名 " + alias)
... ...
... ... @@ -56,9 +56,15 @@ export class PushContentParser {
},*/
let gtData = want.parameters[PushContentParser.LAUNCH_PARAM_GETUI_DATA] as Record<string, string | number | object>
if (gtData[PushContentParser.LAUNCH_PARAM_GETUI_TASKID] != undefined) {
let json = JSON.parse(gtData["wantUri"] as string) as Record<string, string | number>
if (json && json[PushContentParser.PUSH_PARAM_PUSH_LINK] != null) {
const pushLink = json[PushContentParser.PUSH_PARAM_PUSH_LINK] as string
// let json = JSON.parse(gtData["wantUri"] as string) as Record<string, string | number>
// if (json && json[PushContentParser.PUSH_PARAM_PUSH_LINK] != null) {
// const pushLink = json[PushContentParser.PUSH_PARAM_PUSH_LINK] as string
// return {
// isPush: true, online: true, pushLink: pushLink, want: want
// }
// }
if (want.parameters[PushContentParser.PUSH_PARAM_PUSH_LINK]) {
let pushLink = want.parameters[PushContentParser.PUSH_PARAM_PUSH_LINK] as string
return {
isPush: true, online: true, pushLink: pushLink, want: want
}
... ...