You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by sh...@apache.org on 2014/11/12 16:08:49 UTC

cordova-plugins git commit: Added CordovaLocalWebServerStartOnSimulator setting, which defaults to true.

Repository: cordova-plugins
Updated Branches:
  refs/heads/master 6ac14219c -> 71a72594f


Added CordovaLocalWebServerStartOnSimulator setting, which defaults to true.

If set to false, when the user is running on the Simulator, we don't start the local web server. This is primarily to facilitate testing the wkwebview-engine plugin, which has a bug where file urls don't load on device (which is by design, there is a new loadFileURL API function, unreleased at this time) --  but file urls do load on Simulator.


Project: http://git-wip-us.apache.org/repos/asf/cordova-plugins/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugins/commit/71a72594
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugins/tree/71a72594
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugins/diff/71a72594

Branch: refs/heads/master
Commit: 71a72594f7ba0521c02f23445d0ccf65b27297fc
Parents: 6ac1421
Author: Shazron Abdullah <sh...@apache.org>
Authored: Wed Nov 12 07:08:47 2014 -0800
Committer: Shazron Abdullah <sh...@apache.org>
Committed: Wed Nov 12 07:08:47 2014 -0800

----------------------------------------------------------------------
 local-webserver/plugin.xml                        |  1 +
 local-webserver/src/ios/SACordovaLocalWebServer.m | 14 ++++++++++++--
 2 files changed, 13 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugins/blob/71a72594/local-webserver/plugin.xml
----------------------------------------------------------------------
diff --git a/local-webserver/plugin.xml b/local-webserver/plugin.xml
index 212a201..979b1b3 100644
--- a/local-webserver/plugin.xml
+++ b/local-webserver/plugin.xml
@@ -38,6 +38,7 @@
 			    <param name="ios-package" value="SACordovaLocalWebServer"/>
 			    <param name="onload" value="true"/>
 		    </feature>
+            <preference name="CordovaLocalWebServerStartOnSimulator" value="true" />
         </config-file>
 
 	    <header-file src="src/ios/SACordovaLocalWebServer.h" />

http://git-wip-us.apache.org/repos/asf/cordova-plugins/blob/71a72594/local-webserver/src/ios/SACordovaLocalWebServer.m
----------------------------------------------------------------------
diff --git a/local-webserver/src/ios/SACordovaLocalWebServer.m b/local-webserver/src/ios/SACordovaLocalWebServer.m
index 9c6cda0..be7070d 100644
--- a/local-webserver/src/ios/SACordovaLocalWebServer.m
+++ b/local-webserver/src/ios/SACordovaLocalWebServer.m
@@ -25,11 +25,11 @@
 @implementation SACordovaLocalWebServer
 
 - (void) pluginInitialize {
-	
+
     BOOL useLocalWebServer = NO;
     NSString* indexPage = @"index.html";
     NSUInteger port = 80;
-	
+
     // check the content tag src
     CDVViewController* vc = (CDVViewController*)self.viewController;
     NSURL* startPageUrl = [NSURL URLWithString:vc.startPage];
@@ -40,6 +40,16 @@
         }
     }
     
+    // check setting
+#if TARGET_IPHONE_SIMULATOR
+    if (useLocalWebServer) {
+        NSNumber* startOnSimulatorSetting = [[self.commandDelegate settings] objectForKey:[@"CordovaLocalWebServerStartOnSimulator" lowercaseString]];
+        if (startOnSimulatorSetting) {
+            useLocalWebServer = [startOnSimulatorSetting boolValue];
+        }
+    }
+#endif
+    
     if (useLocalWebServer) {
 		// Create server
         self.server = [[GCDWebServer alloc] init];


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