How to override a cordova package with a local one?

Hi,

We could not find documentation about it.

We’re trying to debug a cordova package and would like to know how to make a local copy so that meteor uses it instead ?

That local copy would be imported/used by a meteor plugin (activetree-push-notif)

Regards,

Burni

Hi @burni13
You need to create a directory called packages and then run meteor add PACKAGE_NAME
This way, you have your own package so that you can debug or change something in the source code.

Hi @burni13,

do you mean a Meteor package or a Cordova plugin?!
Meteor packages - as above by @hschmaiske.
Cordova plugins: Cordova | Meteor Guide search for " Installing a plugin from the local file system".

“That local copy would be imported/used by a meteor plugin (activetree-push-notif)” - again, not sure Cordova plugin or meteor package. Anyway, a new version of activitree:push is coming out soon with updated logic and Cordova Push Plugin. If you issue is related to activitree:push, you can let me know what is the issue you are facing.

Hi @paulishca ,

Thanks for the answer. That’s very helpful.

Yes, it’s a cordova plugin we wanted to modify

Yes, we had trouble receiving the on “notification” event in Android and we wanted to troubleshoot by adding logging in the cordova plugin phonegap-push. We finally managed to make it work without it.

But for another reason, we had to locally comment one “if” in activetree-push-notif because we do not use Meteor’s userId system but we use our own IDs but still wanted to send notifications by using your userID logic. So in the end, we commented out this section in InternalMethods.js since our userId does not match this.userId.

Do you think it’s something that could have an official bypass ? For instance, a setting that would prevent this “if” from failing ?

If you want us to provide a patch, we could also do that.

This would allow us to use your standard versions without keeping on modifying them :slight_smile:

What else is coming in the next release of activetree-plugin-push ? I’m being curious!

Best regards,

Burni

Hi @burni13,

Do you think it’s something that could have an official bypass ? For instance, a setting that would prevent this “if” from failing ?

How would you like to pass the userId from your user system?
I can definitely make it available at the ‘push-update’ method level and I hope this.userId in your case is undefined:

check(options, {
      id: Match.Optional(String),
      token: matchToken,
      appName: String,
      userId: Match.OneOf(String, null),
      metadata: Match.Optional(Object),
      somethingElseHere: ...anything you want.
    })

What else is coming in the next release of activetree-plugin-push ? I’m being curious!

(I am trying to figure out where you get the names from :slight_smile: The Meteor Package is activitree:push. Cordova Plugins are named (in general) cordova-plugin-push.

  • Some fixes/updates of the Notification objects
  • Updates of the Firebase server side platform/libraries
  • Updates of the Cordova Push plugin and Web worker FCM library
  • When a user has multiple logged devices/tokens, only keep on user in the Tokens collection and add multiple tokens to the user instead of adding multiple token documents for a single user. The old logic will still work anyway.
  • MONGO_PUSH_URL: your Mongo URL for your separate DB or Cluster. This opens the possibility for endless scalability as many servers can write and many servers can send while the ones that send can differ from the ones that write. We are preparing this for millions of notifications sent per day.
  • be able to set a Meteor server as isPushSender and isPushSaver . Masters can send Notifications. Savers can save tokens and notifications. A Meteor server can be Sender and/or Saver.

In a future version:

  • we will open the possibility to only send to certain tokens of a user. The developer will have to build her own logic (e.g. first (or only) send to the last logged device).
  • add more logic for sending volumes, maybe some analytics as well. Failures/success and volumes can be see in the Firebase Console anyway
  • Open to more platforms and make this a more Node and less Meteor service.
  • Integrate Email sending and add the user notification email to the user’s token object.
  • Add more options such as Push - Yes, Email - No for notifying a user. In general, we want to move the load with notifications from the Meteor User servers and make it scalable on its own.
2 Likes

Hi @paulishca

It can still be passed through the userId as when we do Push.Send, we do provide our “userId” to it so it finds the right users from the DB.

The 3 options we see as possibles:
1-if this.userId is null on the server, always allow push-setup to run.
or
2-a settings in the server side Push.Configure({}) to allow push-setup to skip validation of the userId with this.userId (similar to #1 but activated from Push.Configure)
3-Or a way to pass a validation function to push-setup

Those are great add-ons that will help us greatly!

Will the new cordova plugin be based on cordova-plugin-push instead of phonegap-plugin-push ?

hahaha That’s actually an existential question. I sound like I’m dyslexic at the word level :wink:

Thanks for your help!