You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by ag...@apache.org on 2013/02/20 20:29:37 UTC

ios commit: Implement useSplashScreen without using a setting

Updated Branches:
  refs/heads/next 1bfff2d16 -> 0005897dd


Implement useSplashScreen without using a setting

This avoids adding yet another setting to config.xml.


Project: http://git-wip-us.apache.org/repos/asf/cordova-ios/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-ios/commit/0005897d
Tree: http://git-wip-us.apache.org/repos/asf/cordova-ios/tree/0005897d
Diff: http://git-wip-us.apache.org/repos/asf/cordova-ios/diff/0005897d

Branch: refs/heads/next
Commit: 0005897ddf804c6f061f8622811179817a9fd610
Parents: 1bfff2d
Author: Andrew Grieve <ag...@chromium.org>
Authored: Wed Feb 20 14:28:57 2013 -0500
Committer: Andrew Grieve <ag...@chromium.org>
Committed: Wed Feb 20 14:28:57 2013 -0500

----------------------------------------------------------------------
 CordovaLib/Classes/CDVSplashScreen.m   |   12 +-----------
 CordovaLib/Classes/CDVViewController.h |    3 +--
 CordovaLib/Classes/CDVViewController.m |   19 +++++--------------
 3 files changed, 7 insertions(+), 27 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/0005897d/CordovaLib/Classes/CDVSplashScreen.m
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVSplashScreen.m b/CordovaLib/Classes/CDVSplashScreen.m
index 7561609..cba1b53 100644
--- a/CordovaLib/Classes/CDVSplashScreen.m
+++ b/CordovaLib/Classes/CDVSplashScreen.m
@@ -31,9 +31,7 @@
     [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(pageDidLoad) name:CDVPageDidLoadNotification object:nil];
     [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onOrientationWillChange:) name:UIApplicationWillChangeStatusBarOrientationNotification object:nil];
 
-    if (self.useSplashScreen) {
-        [self show:nil];
-    }
+    [self show:nil];
 }
 
 - (void)show:(CDVInvokedUrlCommand*)command
@@ -46,14 +44,6 @@
     [self updateSplashScreenWithState:kSplashScreenStateHide];
 }
 
-- (BOOL)useSplashScreen
-{
-    id ret = self.commandDelegate.settings[@"ShowSplashScreen"];
-
-    // if value is missing, default to yes
-    return (ret == nil) || [ret boolValue];
-}
-
 - (void)pageDidLoad
 {
     id autoHideSplashScreenValue = [self.commandDelegate.settings objectForKey:@"AutoHideSplashScreen"];

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/0005897d/CordovaLib/Classes/CDVViewController.h
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVViewController.h b/CordovaLib/Classes/CDVViewController.h
index 553c628..82e22f6 100644
--- a/CordovaLib/Classes/CDVViewController.h
+++ b/CordovaLib/Classes/CDVViewController.h
@@ -44,8 +44,7 @@
 @property (nonatomic, readonly, strong) NSXMLParser* configParser;
 @property (nonatomic, readonly, strong) CDVWhitelist* whitelist; // readonly for public
 @property (nonatomic, readonly, assign) BOOL loadFromString;
-
-@property (nonatomic, readwrite, assign) BOOL useSplashScreen CDV_DEPRECATED(2.5, "Replaced with ShowSplashScreen setting (or remove the SplashScreen plugin).");
+@property (nonatomic, readwrite, assign) BOOL useSplashScreen CDV_DEPRECATED(2.5, "Add/Remove the SplashScreen plugin instead of setting this property.");
 
 @property (nonatomic, readwrite, copy) NSString* wwwFolderName;
 @property (nonatomic, readwrite, copy) NSString* startPage;

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/0005897d/CordovaLib/Classes/CDVViewController.m
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVViewController.m b/CordovaLib/Classes/CDVViewController.m
index d625424..bec716d 100644
--- a/CordovaLib/Classes/CDVViewController.m
+++ b/CordovaLib/Classes/CDVViewController.m
@@ -52,6 +52,7 @@
 @synthesize webView, supportedOrientations;
 @synthesize pluginObjects, pluginsMap, whitelist, startupPluginNames;
 @synthesize configParser, settings, loadFromString;
+@synthesize useSplashScreen;
 @synthesize wwwFolderName, startPage, initialized, openURL;
 @synthesize commandDelegate = _commandDelegate;
 @synthesize commandQueue = _commandQueue;
@@ -84,6 +85,7 @@
 
         // load config.xml settings
         [self loadSettings];
+        useSplashScreen = YES;
     }
 }
 
@@ -175,19 +177,6 @@
     self.pluginObjects = [[NSMutableDictionary alloc] initWithCapacity:20];
 }
 
-- (BOOL)useSplashScreen
-{
-    id ret = self.settings[@"ShowSplashScreen"];
-
-    // if value is missing, default to yes
-    return (ret == nil) || [ret boolValue];
-}
-
-- (void)setUseSplashScreen:(BOOL)value
-{
-    self.settings[@"ShowSplashScreen"] = [NSNumber numberWithBool:value];
-}
-
 // Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
 - (void)viewDidLoad
 {
@@ -323,7 +312,9 @@
     }
 
     // TODO: Remove this explicit instantiation once we move to cordova-CLI.
-    [self getCommandInstance:@"splashscreen"];
+    if (useSplashScreen) {
+        [self getCommandInstance:@"splashscreen"];
+    }
 
     // /////////////////
     [CDVUserAgentUtil acquireLock:^(NSInteger lockToken) {