activitree / meteor-push

Meteor Push Notifications for Cordova and Web/PWA with Firebase (FCM).
MIT License
27 stars 19 forks source link

this.once('ready') function is undefined in Cordova.js - activitree:push v2.0.8 #35

Open mikamarkus opened 3 years ago

mikamarkus commented 3 years ago

I'm trying to trigger routing action via following function:

CordovaPush.push.on('notification', data => { // Route somewhere according to parameter })

When I'm clicking the notification, my listener function does not get triggered, because Cordova.js dies after trying to set badge on line 29. I think it's because 'once' function does not exists anymore after removing deprecated raix -packages in last version.

Console error:


Error in Success callbackId: PushNotification270011709 : TypeError: undefined is not a function (near '...this.once...')
cordova.js:1540

setBadge@http://localhost:12688/__cordova/packages/activitree_push.js?hash=7a9a9ac94bc9741966430eda9a0a4236da660e6d:111:16
http://localhost:12688/__cordova/packages/activitree_push.js?hash=7a9a9ac94bc9741966430eda9a0a4236da660e6d:221:32
emit@http://localhost:12688/plugins/phonegap-plugin-push/www/push.js:295:25
success@http://localhost:12688/plugins/phonegap-plugin-push/www/push.js:56:19
callbackFromNative@http://localhost:12688/cordova.js:295:63
http://localhost:12688/plugins/cordova-plugin-wkwebview-engine/src/www/ios/ios-wkwebview-exec.js:129:35
http://localhost:12688/__cordova/packages/meteor.js?hash=65c4a13f0259405d858d17417f5e24851f0421c0:1266:27
promiseReactionJob@[native code]
raise — promise.js:763

Any suggestions?

activitree:push version. 2.0.8

paulincai commented 3 years ago

Hi, I am not sure what the problem might be here, I don't have any issues in this area. Would you please try to route vie the action with the method. E.g

Meteor.call('userPushNotification', {
        title: 'Notification title',
        body: 'Notification Body',
        badge: 1,
        userIds: ['xxxxx', 'xxxxxxxxxx'],
        action: '/your_url'
      })