nordnet/cordova-hot-code-push

manifest doesn't compare release dates

Closed this issue ยท 8 comments

We've setup a staging and production server for hot push to ensure that fixes are tested before going into production. However, we're using a version of the plugin (#55 - currently in PR) to allow header authorization, so this may be resolved...

The problem:
If the hotfix code which lives on the server is older than what is in the app BUT not equal to the release date, it still prompts or downloads an update (depending on how you set it up). I noticed this behaviour when switching between staging and production and having an older version on production than what I had on the phone, yet still the plugin was downloading older code.

So, it appears the plugin doesn't actually check if the release date in the http://[your-server]/chcp.json is newer than what is on the phone, only if the dates are not equal, then assumes a new update is ready.

Am I correct in this assumption? How would I get around this? Thanks!

๐Ÿ‘

Yes, you are correct about this. From documentation:

Important: plugin will compare release values as strings for equality, and if they are not equal - it will decide that new release is available.

Release version can be any string. By default it's date and time of the build. But you can change this to anything, that's why there is no limit for that.

I can implement that kind of checking. For example, add preference in chcp.json file, that will indicate if we are allowed to compare release versions and how to do it. And then do this on the native side. Should not be that hard.

Any proposals on how to name that preference in chcp.json? :)

Thanks for the prompt reply! What about something along the lines of newer_only?

{
  "name": "MyApp",
  "ios_identifier": "123456",
  "android_identifier": "",
  "update": "start",
  "content_url": "http://[server]/",
  "release": "2016.02.18-16.47.12",
  "newer_only": "true"
}

Although that name doesn't describe "how to do it"... maybe it could be comparison with the possible values of >, and !=

Since this relates to release - maybe it should be like that:

{
  "name": "MyApp",
  "ios_identifier": "123456",
  "android_identifier": "",
  "update": "start",
  "content_url": "http://[server]/",
  "release": {
    "version": "2016.02.18-16.47.12",
    "compare": ">"
  }
}

So, by default it will use "!=" and you specify release as you do right now: "release": "2016.02.18-16.47.12". But if you want to enable some custom comparison logic: release becomes an object with options, which can be extended later on.

Sounds like a sensible approach ๐Ÿ‘

That would help us very much. Upvote ๐Ÿ‘

And many thanks for that plugin!
Helps us getting changes (and fixes) out fast as lightning...

@g-mack Thanks, glad to hear that :)

๐Ÿ‘‹ Hi! Thank you for your interest in this repo.

๐Ÿ˜ข We are not using nordnet/cordova-hot-code-push anymore, and we lack the manpower and the experience needed to maintain it. We are aware of the inconveniece that this may cause you. Feel free to use it as is, or create your own fork.

๐Ÿ”’ This will now be closed & locked.

โ„น๏ธ Please see #371 for more information.