Return-Path: X-Original-To: apmail-cordova-commits-archive@www.apache.org Delivered-To: apmail-cordova-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 6763117E8D for ; Sat, 25 Oct 2014 01:26:21 +0000 (UTC) Received: (qmail 9039 invoked by uid 500); 25 Oct 2014 01:26:21 -0000 Delivered-To: apmail-cordova-commits-archive@cordova.apache.org Received: (qmail 8909 invoked by uid 500); 25 Oct 2014 01:26:21 -0000 Mailing-List: contact commits-help@cordova.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Delivered-To: mailing list commits@cordova.apache.org Received: (qmail 8774 invoked by uid 99); 25 Oct 2014 01:26:21 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 25 Oct 2014 01:26:21 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id EBAA5812E7C; Sat, 25 Oct 2014 01:26:20 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: agrieve@apache.org To: commits@cordova.apache.org Date: Sat, 25 Oct 2014 01:26:26 -0000 Message-Id: In-Reply-To: <302bc196a8ec4dd8aaf38fe44eb72662@git.apache.org> References: <302bc196a8ec4dd8aaf38fe44eb72662@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [08/17] git commit: Stopped destroying the webview on every launch. Stopped destroying the webview on every launch. If we're relaunching the same app, we reload the webview. This handles the most annoying `cca push --watch` case. If a new app is being launched, though, the webview is still destroyed and recreated (for now). 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/7c884d15 Tree: http://git-wip-us.apache.org/repos/asf/cordova-app-harness/tree/7c884d15 Diff: http://git-wip-us.apache.org/repos/asf/cordova-app-harness/diff/7c884d15 Branch: refs/heads/master Commit: 7c884d15369dd33897db72ef94f80c75ffd55a63 Parents: da46492 Author: Max Woghiren Authored: Mon Oct 6 15:34:11 2014 -0400 Committer: Andrew Grieve Committed: Fri Oct 24 21:26:07 2014 -0400 ---------------------------------------------------------------------- www/cdvah/js/AppsService.js | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cordova-app-harness/blob/7c884d15/www/cdvah/js/AppsService.js ---------------------------------------------------------------------- diff --git a/www/cdvah/js/AppsService.js b/www/cdvah/js/AppsService.js index 14b8c5c..9c25391 100644 --- a/www/cdvah/js/AppsService.js +++ b/www/cdvah/js/AppsService.js @@ -139,8 +139,21 @@ }, launchApp : function(installer) { - return AppsService.quitApp() + // Determine whether we're relaunching the same app as is already active. + var relaunch = activeInstaller && activeInstaller.appId; + relaunch = installer && installer.appId; + relaunch = relaunch && (activeInstaller.appId === installer.appId); + + return $q.when() .then(function() { + // If we're relaunching the active app, move on. + // Otherwise, quit the active app. + if (relaunch) { + return $q.when(); + } else { + return AppsService.quitApp(); + } + }).then(function() { activeInstaller = installer; return installer.launch(); }).then(function(launchUrl) { @@ -152,7 +165,14 @@ return installer.getPluginMetadata(); }).then(function(pluginMetadata) { $location.path('/inappmenu'); - return AppHarnessUI.create(launchUrl, pluginMetadata); + // If we're relaunching the active app, just reload the existing webview. + // Otherwise, create a new one. + // TODO(maxw): Use the existing webview all the time. + if (relaunch) { + return AppHarnessUI.reload(); + } else { + return AppHarnessUI.create(launchUrl, pluginMetadata); + } }).then(function() { if (AppsService.onAppListChange) { AppsService.onAppListChange(); --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org For additional commands, e-mail: commits-help@cordova.apache.org