xugenyuan

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

Signed-off-by: xugenyuan <xugenyuan@wondertek.com.cn>
@@ -52,7 +52,7 @@ export class GetuiPush { @@ -52,7 +52,7 @@ export class GetuiPush {
52 const isOnlineEnv = HostManager.getHost() === HostEnum.HOST_PRODUCT 52 const isOnlineEnv = HostManager.getHost() === HostEnum.HOST_PRODUCT
53 53
54 PushManager.initialize({ 54 PushManager.initialize({
55 - appId:isOnlineEnv ? GetuiPush.GETUI_APPID_TEST : GetuiPush.GETUI_APPID_TEST, 55 + appId:isOnlineEnv ? GetuiPush.GETUI_APPID_ONLINE : GetuiPush.GETUI_APPID_TEST,
56 context: context, 56 context: context,
57 onSuccess: (cid:string) => { 57 onSuccess: (cid:string) => {
58 Logger.debug(TAG, "个推SDK初始化成功,cid = " + cid) 58 Logger.debug(TAG, "个推SDK初始化成功,cid = " + cid)
@@ -63,6 +63,8 @@ export class GetuiPush { @@ -63,6 +63,8 @@ export class GetuiPush {
63 63
64 if (this.hasEnterMain) { 64 if (this.hasEnterMain) {
65 this.comsumeLastPushContent() 65 this.comsumeLastPushContent()
  66 + } else {
  67 + Logger.debug(TAG, "等待进入主页")
66 } 68 }
67 }, 69 },
68 onFailed: (error:string) => { 70 onFailed: (error:string) => {
@@ -198,21 +200,24 @@ export class GetuiPush { @@ -198,21 +200,24 @@ export class GetuiPush {
198 if (pushContent && pushContent.isPush) { 200 if (pushContent && pushContent.isPush) {
199 Logger.debug(TAG, "接收到推送: " + JSON.stringify(want.parameters)) 201 Logger.debug(TAG, "接收到推送: " + JSON.stringify(want.parameters))
200 this.lastPushContent = pushContent 202 this.lastPushContent = pushContent
201 - if (this.initialed) { 203 + if (this.initialed && this.hasEnterMain) {
202 this.comsumeLastPushContent() 204 this.comsumeLastPushContent()
  205 + } else {
  206 + Logger.debug(TAG, "等待初始化完成 或 进入主页")
203 } 207 }
204 } 208 }
205 } 209 }
206 210
207 // 首次进入主页,即可解析跳转推送 211 // 首次进入主页,即可解析跳转推送
208 onReachMainPage() { 212 onReachMainPage() {
  213 + this.hasEnterMain = true
209 if (this.initialed) { 214 if (this.initialed) {
210 this.comsumeLastPushContent() 215 this.comsumeLastPushContent()
211 } else { 216 } else {
212 // 这里可能还没来得及初始化完成。所以不能清空 217 // 这里可能还没来得及初始化完成。所以不能清空
213 // this.lastPushContent = undefined 218 // this.lastPushContent = undefined
  219 + Logger.debug(TAG, "等待初始化完成")
214 } 220 }
215 - this.hasEnterMain = true  
216 } 221 }
217 222
218 comsumeLastPushContent() { 223 comsumeLastPushContent() {
@@ -229,6 +234,9 @@ export class GetuiPush { @@ -229,6 +234,9 @@ export class GetuiPush {
229 Logger.debug(TAG, "推送 回执: " + this.lastPushContent.want) 234 Logger.debug(TAG, "推送 回执: " + this.lastPushContent.want)
230 PushManager.setClickWant(this.lastPushContent.want) 235 PushManager.setClickWant(this.lastPushContent.want)
231 } 236 }
  237 + } else if (this.lastPushContent.want) {
  238 + Logger.debug(TAG, "推送 回执: " + this.lastPushContent.want)
  239 + PushManager.setClickWant(this.lastPushContent.want)
232 } 240 }
233 if (this.lastPushContent.pushLink) { 241 if (this.lastPushContent.pushLink) {
234 Logger.debug(TAG, "跳转对应页面: " + this.lastPushContent.pushLink) 242 Logger.debug(TAG, "跳转对应页面: " + this.lastPushContent.pushLink)