mnill / cordova-app-updater

Simple plugin for hot update cordova app
MIT License
16 stars 5 forks source link

Handling missed updates #10

Open khamaileon opened 8 years ago

khamaileon commented 8 years ago

What happens if a user misses an update? How the updater will know which files to download?

mnill commented 8 years ago

User can miss update only if you set 'tryupdate' or 'cached' mode.

Nothing happens, user just use a old version.

About files to update - my goal in this plugin is keep it very simple. On every app startup plugin download config.json from server. All times whenever a config.json version in 'cached' folder is not equal to version download from server plugin will make those steps:

Are my explain is clear for understand?

khamaileon commented 8 years ago

Even if you set 'mustupdate' mode, the user can miss an update. For example if a user doesn't start the app for one week and during this time there are 2 updates. Different files in the second update is not necessarily the same as in the first.

mnill commented 8 years ago

As I explained, all updates has its own life and don't associated with any other.

At any update user delete all previous updates and copy files from original 'www' folder (without any updates) to cache, and then download all files specified in latest config.json

All is simple - all you updates must be compatible with original build which uploaded to appstore\goolge play.

mnill commented 8 years ago

I meant your latest update just must be compatible with version uploaded to store.

khamaileon commented 8 years ago

Ok so I have to keep in mind that the reference is the latest version on the store.

Shouldn't it be more robust and efficient to keep hash of every file and update only the modified one?

mnill commented 8 years ago

Efficient may be, but why is more robust with hash? I just want to keep it very simplified and free of bugs.

With my model there is very simple state machine in updater mechanism. We test it in production in really big apps and all works fine.

khamaileon commented 8 years ago

How can you be sure your user has the latest version on the store before updating?

mnill commented 8 years ago

I have different $SERVER_URL for every build.

After every new version I stop to update previous version and ask users to update the app if necessary.

Anyway if you updated the app it is means they have broken changes in plugins, right? What also may be a reason to update the app in the store if we have this beautiful updater :-)

khamaileon commented 8 years ago

Different $SERVER_URL is a good tip thank you. How do you keep the list of modified files up to date?

mnill commented 8 years ago

I just have a grunt script to build app.min.js and hardcoded list of changed imges\other files. Also this script create new config.json and upload files to server.