ionicDeploy always wants to update on first launch


#1

Hi,

I have pasted the code at http://docs.ionic.io/v1.0/docs/deploy-updating-apps into my app. I regularly do ionic upload from the CLI whenever I have made some decent additions to my app.

However, every time I install and launch my app, $ionicDeploy.check() returns true and starts downloading whichever code is latest on the ionic deploy servers. Even if the code I’m launching is more recent. This started to happen even before I clicked Deploy on any of my uploads at apps.ionic.io.

I would love to use ionicDeploy but I don’t want my users to get an update download running when they first launch the app. Should I be comparing versions somehow? Or should I not upload code at all unless I want to deploy it to users immediately?

I can see the following in my console during app launch:

In Finally
JSON Error: (null)
Returing?
Response: (null)
UUID: e1fcd5c6e00ec6a11e5af0cdcde7652e8a66a0 OUR_UUID: (null)
Updates Available: true
Is first?: 0
DEBUG DEPLOY: true
Upstream UUID: e1fcd5c6e00ec6a11e5af0cdcde7652e8a66a0
Versions: ()
In Finally
JSON Error: (null)
Returing?
Queueing Download...
Download Progress: 0%

Looking into what the ionicDeploy plug-in does, it seems to compare its own stored UUID for the app version to what the update services gives back as latest. However on first launch there is no stored UUID.

Should I be storing the baseline version UUID in my app project before building so that the current version isn’t being ‘updated’ to on first launch?


#2

I have the same problem. On the first launch, it will always update:

I have the following in my angular.module(‘starter.controllers’, [])
.controller(‘AppCtrl’, function($scope,$ionicDeploy,$ionicPopup) {

    $ionicDeploy.watch().then(function() {}, function() {},
    function(hasUpdate) {
      if (hasUpdate) {
      }
      $ionicDeploy.update().then(function(res) {
        console.log('Ionic Deploy: Update Success! ', res);
      }, function(err) {
        console.log('Ionic Deploy: Update error! ', err);
      }, function(prog) {
        console.log('Ionic Deploy: Progress... ', prog);
    });
  });

#3

Hi herve76,

your if(hasUpdate) statement is closed directly, you need to put the $ionicDeploy.update() call inside this if statement, that should fix your problem of continous updating.

$ionicDeploy.watch().then(function() {}, function() {},
function(hasUpdate) {
  if (hasUpdate) {
	  $ionicDeploy.update().then(function(res) {
	    console.log('Ionic Deploy: Update Success! ', res);
	  }, function(err) {
	    console.log('Ionic Deploy: Update error! ', err);
	  }, function(prog) {
	    console.log('Ionic Deploy: Progress... ', prog);
	  });
 }
});

#4

Ionic Deploy now supports setting the initial ‘binary version’ in apps.ionic.io so your app can see when the offered update is the same build. Problem solved.