浏览推送通知

时间:2018-12-26 22:00:10

标签: firebase ionic-framework push-notification ionic3 ngrx

我将Ionic v3与Firebase推送通知(@ ionic-native / firebase)和redux(@ ngrx / store)结合使用。

在我的用例中,流程如下:

  1. 已收到推送通知。
  2. redux存储已修改。
  3. 进行页面导航。

问题在于页面导航后,-new-页面损坏(即按钮不起作用或发生奇怪的事情)。

我的代码如下:

const self = this;

this.firebase.onNotificationOpen()
         .subscribe( (data) => {
           self.handle_notification(data);
         });

handle_notification(data){
         this.store.dispatch(new theReduxAction());
}

this.store.select('state').select('the_redux_action')
        .subscribe( (data) => {
          self.handle_redux(data);
        });

handle_redux(data){
         this.navCtrl.push('new_page');
}

为了进行测试,我尝试从firebase self.handle_notification(data)函数外部调用.subscribe()(例如,单击按钮时或从间隔回调中调用),并且效果很好。

有人暗示为什么会中断吗?

0 个答案:

没有答案
相关问题