Skip to content
This repository has been archived by the owner on Oct 1, 2018. It is now read-only.

manifest doesn't compare release dates #108

Closed
jonathancochran opened this issue Feb 24, 2016 · 8 comments
Closed

manifest doesn't compare release dates #108

jonathancochran opened this issue Feb 24, 2016 · 8 comments

Comments

@jonathancochran
Copy link

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!

@hussfelt
Copy link

👍

@nikDemyankov
Copy link
Member

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? :)

@jonathancochran
Copy link
Author

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 !=

@nikDemyankov
Copy link
Member

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.

@jonathancochran
Copy link
Author

Sounds like a sensible approach 👍

@g-mack
Copy link

g-mack commented Mar 2, 2016

That would help us very much. Upvote 👍

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

@nikDemyankov
Copy link
Member

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

@nordnet-deprecation-bot
Copy link
Contributor

👋 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.

@nordnet nordnet locked and limited conversation to collaborators Sep 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants