cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From agri...@apache.org
Subject [05/17] git commit: Prevented launching an app that hasn't changed.
Date Sat, 25 Oct 2014 01:26:23 GMT
Prevented launching an app that hasn't changed.

Also added an option to force a launch.  Sometimes, such as when an app is pushed for the
first time, we want to launch the app even if it hasn't changed since the last time it was
launched (in a previous session).


Project: http://git-wip-us.apache.org/repos/asf/cordova-app-harness/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-app-harness/commit/6ce27408
Tree: http://git-wip-us.apache.org/repos/asf/cordova-app-harness/tree/6ce27408
Diff: http://git-wip-us.apache.org/repos/asf/cordova-app-harness/diff/6ce27408

Branch: refs/heads/master
Commit: 6ce27408c50bea9eb123fb883ebcb593f8aa0444
Parents: 4c0ac66
Author: Max Woghiren <max.woghiren@gmail.com>
Authored: Tue Sep 30 15:01:06 2014 -0400
Committer: Andrew Grieve <agrieve@chromium.org>
Committed: Fri Oct 24 20:44:03 2014 -0400

----------------------------------------------------------------------
 .../node_modules/cordova-harness-client/pushsession.js  | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-app-harness/blob/6ce27408/harness-push/node_modules/cordova-harness-client/pushsession.js
----------------------------------------------------------------------
diff --git a/harness-push/node_modules/cordova-harness-client/pushsession.js b/harness-push/node_modules/cordova-harness-client/pushsession.js
index d878198..05681b2 100644
--- a/harness-push/node_modules/cordova-harness-client/pushsession.js
+++ b/harness-push/node_modules/cordova-harness-client/pushsession.js
@@ -217,7 +217,7 @@ PushSession.prototype.initialize = function(opts) {
     });
 };
 
-PushSession.prototype.push = function() {
+PushSession.prototype.push = function(forceLaunch) {
     var self = this;
     return Q.when(this.platformId_ || this.initialize())
     .then(function() {
@@ -234,7 +234,7 @@ PushSession.prototype.push = function() {
         var pushList = buildPushList(self.assetManifest_ || {}, assetMap);
         if (deleteList.length === 0 && pushList.length === 0) {
             console.log('Application already up-to-date.');
-            return;
+            return false; // appChanged
         }
         var p;
         // TODO: It might be faster to use Zip even when some files exist.
@@ -245,9 +245,13 @@ PushSession.prototype.push = function() {
         }
         return p.then(function() {
             return self.deleteFiles_(deleteList);
+        }).then(function() {
+            return true; // appChanged
         });
-    }).then(function() {
-        if (self.launchAfterPush) {
+    }).then(function(appChanged) {
+        // Determine whether we should launch the app.
+        shouldLaunch = forceLaunch || (self.launchAfterPush && appChanged);
+        if (shouldLaunch) {
             return self.harnessClient_.launch(self.appId_);
         }
     });


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org


Mime
View raw message