ref |> 解决离线推送点击后,打开App且跳转对应页面问题
Signed-off-by: xugenyuan <xugenyuan@wondertek.com.cn>
Showing
1 changed file
with
9 additions
and
1 deletions
| @@ -34,6 +34,7 @@ export class GetuiPush { | @@ -34,6 +34,7 @@ export class GetuiPush { | ||
| 34 | private lastPushContent?: PushContentBean | 34 | private lastPushContent?: PushContentBean |
| 35 | 35 | ||
| 36 | private initialed = false | 36 | private initialed = false |
| 37 | + private hasEnterMain = false | ||
| 37 | 38 | ||
| 38 | private constructor() { | 39 | private constructor() { |
| 39 | } | 40 | } |
| @@ -59,6 +60,10 @@ export class GetuiPush { | @@ -59,6 +60,10 @@ export class GetuiPush { | ||
| 59 | this.cid = cid | 60 | this.cid = cid |
| 60 | this.registerEvents() | 61 | this.registerEvents() |
| 61 | this.checkSetup() | 62 | this.checkSetup() |
| 63 | + | ||
| 64 | + if (this.hasEnterMain) { | ||
| 65 | + this.comsumeLastPushContent() | ||
| 66 | + } | ||
| 62 | }, | 67 | }, |
| 63 | onFailed: (error:string) => { | 68 | onFailed: (error:string) => { |
| 64 | Logger.error(TAG, "个推SDK初始化失败,error = " + error) | 69 | Logger.error(TAG, "个推SDK初始化失败,error = " + error) |
| @@ -204,11 +209,14 @@ export class GetuiPush { | @@ -204,11 +209,14 @@ export class GetuiPush { | ||
| 204 | if (this.initialed) { | 209 | if (this.initialed) { |
| 205 | this.comsumeLastPushContent() | 210 | this.comsumeLastPushContent() |
| 206 | } else { | 211 | } else { |
| 207 | - this.lastPushContent = undefined | 212 | + // 这里可能还没来得及初始化完成。所以不能清空 |
| 213 | + // this.lastPushContent = undefined | ||
| 208 | } | 214 | } |
| 215 | + this.hasEnterMain = true | ||
| 209 | } | 216 | } |
| 210 | 217 | ||
| 211 | comsumeLastPushContent() { | 218 | comsumeLastPushContent() { |
| 219 | + Logger.debug(TAG, "尝试消费推送: " + this.lastPushContent) | ||
| 212 | if (!this.lastPushContent) { | 220 | if (!this.lastPushContent) { |
| 213 | return | 221 | return |
| 214 | } | 222 | } |
-
Please register or login to post a comment