xugenyuan

ref |> 调整推送消息跳转处理

Signed-off-by: xugenyuan <xugenyuan@wondertek.com.cn>
... ... @@ -52,7 +52,7 @@ export class GetuiPush {
const isOnlineEnv = HostManager.getHost() === HostEnum.HOST_PRODUCT
PushManager.initialize({
appId:isOnlineEnv ? GetuiPush.GETUI_APPID_TEST : GetuiPush.GETUI_APPID_TEST,
appId:isOnlineEnv ? GetuiPush.GETUI_APPID_ONLINE : GetuiPush.GETUI_APPID_TEST,
context: context,
onSuccess: (cid:string) => {
Logger.debug(TAG, "个推SDK初始化成功,cid = " + cid)
... ... @@ -63,6 +63,8 @@ export class GetuiPush {
if (this.hasEnterMain) {
this.comsumeLastPushContent()
} else {
Logger.debug(TAG, "等待进入主页")
}
},
onFailed: (error:string) => {
... ... @@ -198,21 +200,24 @@ export class GetuiPush {
if (pushContent && pushContent.isPush) {
Logger.debug(TAG, "接收到推送: " + JSON.stringify(want.parameters))
this.lastPushContent = pushContent
if (this.initialed) {
if (this.initialed && this.hasEnterMain) {
this.comsumeLastPushContent()
} else {
Logger.debug(TAG, "等待初始化完成 或 进入主页")
}
}
}
// 首次进入主页,即可解析跳转推送
onReachMainPage() {
this.hasEnterMain = true
if (this.initialed) {
this.comsumeLastPushContent()
} else {
// 这里可能还没来得及初始化完成。所以不能清空
// this.lastPushContent = undefined
Logger.debug(TAG, "等待初始化完成")
}
this.hasEnterMain = true
}
comsumeLastPushContent() {
... ... @@ -229,6 +234,9 @@ export class GetuiPush {
Logger.debug(TAG, "推送 回执: " + this.lastPushContent.want)
PushManager.setClickWant(this.lastPushContent.want)
}
} else if (this.lastPushContent.want) {
Logger.debug(TAG, "推送 回执: " + this.lastPushContent.want)
PushManager.setClickWant(this.lastPushContent.want)
}
if (this.lastPushContent.pushLink) {
Logger.debug(TAG, "跳转对应页面: " + this.lastPushContent.pushLink)
... ...