Merge branch 'main' of http://192.168.1.42/developOne/harmonyPool into main
* 'main' of http://192.168.1.42/developOne/harmonyPool: ref |> 处理退出登录或注销 取消推送别名设置 ref |> 调整推送消息跳转处理
Showing
3 changed files
with
18 additions
and
7 deletions
| @@ -13,7 +13,7 @@ export class EmitterUtils { | @@ -13,7 +13,7 @@ export class EmitterUtils { | ||
| 13 | static sendEmptyEvent(eventId: number) { | 13 | static sendEmptyEvent(eventId: number) { |
| 14 | let event: emitter.InnerEvent = { | 14 | let event: emitter.InnerEvent = { |
| 15 | eventId: eventId, | 15 | eventId: eventId, |
| 16 | - priority: emitter.EventPriority.LOW | 16 | + priority: emitter.EventPriority.IMMEDIATE |
| 17 | }; | 17 | }; |
| 18 | emitter.emit(event); | 18 | emitter.emit(event); |
| 19 | } | 19 | } |
| @@ -26,7 +26,7 @@ export class EmitterUtils { | @@ -26,7 +26,7 @@ export class EmitterUtils { | ||
| 26 | static sendEvent(eventId: number, str?: string | number) { | 26 | static sendEvent(eventId: number, str?: string | number) { |
| 27 | let event: emitter.InnerEvent = { | 27 | let event: emitter.InnerEvent = { |
| 28 | eventId: eventId, | 28 | eventId: eventId, |
| 29 | - priority: emitter.EventPriority.LOW | 29 | + priority: emitter.EventPriority.IMMEDIATE |
| 30 | }; | 30 | }; |
| 31 | let eventData: emitter.EventData = { | 31 | let eventData: emitter.EventData = { |
| 32 | data: { | 32 | data: { |
| @@ -486,6 +486,7 @@ export struct AccountAndSecurityLayout { | @@ -486,6 +486,7 @@ export struct AccountAndSecurityLayout { | ||
| 486 | let login = new LoginViewModel; | 486 | let login = new LoginViewModel; |
| 487 | login.logOut().then(()=>{ | 487 | login.logOut().then(()=>{ |
| 488 | this.showToastTip('退出登录') | 488 | this.showToastTip('退出登录') |
| 489 | + EmitterUtils.sendEvent(EmitterEventId.FORCE_USER_LOGIN_OUT) | ||
| 489 | EmitterUtils.sendEvent(EmitterEventId.PEOPLE_SHIP_ATTENTION) | 490 | EmitterUtils.sendEvent(EmitterEventId.PEOPLE_SHIP_ATTENTION) |
| 490 | router.back(); | 491 | router.back(); |
| 491 | }).catch((error:string)=>{ | 492 | }).catch((error:string)=>{ |
| @@ -498,6 +499,8 @@ export struct AccountAndSecurityLayout { | @@ -498,6 +499,8 @@ export struct AccountAndSecurityLayout { | ||
| 498 | TrackingButton.click("cancelAccountPageCancelAccountSuccess",TrackConstants.PageName.Cancel_Account,TrackConstants.PageName.Cancel_Account) | 499 | TrackingButton.click("cancelAccountPageCancelAccountSuccess",TrackConstants.PageName.Cancel_Account,TrackConstants.PageName.Cancel_Account) |
| 499 | this.logoutViewModel.requestLogout().then(()=>{ | 500 | this.logoutViewModel.requestLogout().then(()=>{ |
| 500 | ToastUtils.shortToast("注销成功") | 501 | ToastUtils.shortToast("注销成功") |
| 502 | + EmitterUtils.sendEmptyEvent(EmitterEventId.FORCE_USER_LOGIN_OUT) | ||
| 503 | + EmitterUtils.sendEmptyEvent(EmitterEventId.PEOPLE_SHIP_ATTENTION) | ||
| 501 | router.back() | 504 | router.back() |
| 502 | }) | 505 | }) |
| 503 | } | 506 | } |
| @@ -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) => { |
| @@ -93,7 +95,7 @@ export class GetuiPush { | @@ -93,7 +95,7 @@ export class GetuiPush { | ||
| 93 | if (!this.initialed) { return } | 95 | if (!this.initialed) { return } |
| 94 | if (HttpUtils.isLogin()) { | 96 | if (HttpUtils.isLogin()) { |
| 95 | const userId = SPHelper.default.getSync(SpConstants.USER_ID, "") as string | 97 | const userId = SPHelper.default.getSync(SpConstants.USER_ID, "") as string |
| 96 | - this.currentUserId = userId | 98 | + this.currentUserId = userId + "" |
| 97 | this.setAlias(true, userId) | 99 | this.setAlias(true, userId) |
| 98 | } | 100 | } |
| 99 | let tags = [this.TAG_PD_ZH, AppUtils.getAppVersionCode()] | 101 | let tags = [this.TAG_PD_ZH, AppUtils.getAppVersionCode()] |
| @@ -110,7 +112,7 @@ export class GetuiPush { | @@ -110,7 +112,7 @@ export class GetuiPush { | ||
| 110 | // 登录和退出 | 112 | // 登录和退出 |
| 111 | EmitterUtils.receiveEvent(EmitterEventId.LOGIN_SUCCESS, () => { | 113 | EmitterUtils.receiveEvent(EmitterEventId.LOGIN_SUCCESS, () => { |
| 112 | const userId = SPHelper.default.getSync(SpConstants.USER_ID, "") as string | 114 | const userId = SPHelper.default.getSync(SpConstants.USER_ID, "") as string |
| 113 | - this.currentUserId = userId | 115 | + this.currentUserId = userId + "" |
| 114 | this.setAlias(true, userId) | 116 | this.setAlias(true, userId) |
| 115 | }) | 117 | }) |
| 116 | EmitterUtils.receiveEvent(EmitterEventId.FORCE_USER_LOGIN_OUT, () => { | 118 | EmitterUtils.receiveEvent(EmitterEventId.FORCE_USER_LOGIN_OUT, () => { |
| @@ -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) |
-
Please register or login to post a comment