Disable hot code push on mobile

Hi, someone know how I can disable hot-code-push only mobile ? Because I need enable only on web version.

Hmm, I don’t know if there’s a setting you can toggle. One idea you could try is before you build your mobile app, remove meteor-base, and then add back all base packages except hot-code-push.
They are: meteor, webapp, underscore, ddp

I will try too. This moment I will try add a new plugin that I dont use in server, and wait hot-code-push block update.

A doubt, if I remove hot-code-push, my client web dont updated automaticly too ?

Yeah, so you have to add it back after you build your mobile app.
You could make a build script that is like

meteor remove hot-code-push
meteor build mobile...
meteor add hot-code-push

Idon’t know if this is the best solution but it should work :stuck_out_tongue:

1 Like

It works fine. Thanks.

There’s a better solution for programmatically controlling HCP:

One usecase for this is to prevent HCP completely, e.g. on mobiles.

It also allows you to show a dialog before HCP takes place. But beware not to do this on iOS, since Apple‘s reviewer team doesn’t like these kind of dialogs.

I am using Reload._onMigrate() to defer HCP on mobile devices until the app is restarted by the user. In the web browser, I am showing a dialog instead which allows the user to reload the app or cancel HCP if important work would be lost.

3 Likes

Would you like to publish this functionality as a package maybe? Sounds really tasty)

It’s quite tightly coupled to bootstrap modals to make it work. Not sure if that is really what other people would want, as many are moving to React now.

You could substitute custom modal for simple window.confirm() :wink: as scaffolding; then other developers could plug in their preferred view component, but your logic would remain intact.

1 Like

I gave this idea a try recently, and it appears Reload._onMigrate() isn’t ensured to block hot-code push. Its intended use is more for not breaking a user session. The migration leaks through to the cordova app during app start/stop, unfortunately.

Removing the hot-code-push package entirely is probably needed to disable updates entirely. The good news for us, is that it looks like Reload._onMigrate() might be the right place to patch CSS stylesheets after a code update, which is what we were looking for in the first place.