incubator-callback-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From shaz...@apache.org
Subject ios commit: [CB-994] CDVLocalStorage core plugin does not fully backup when app setting "Application does not run in background" is YES
Date Wed, 01 Aug 2012 02:58:54 GMT
Updated Branches:
  refs/heads/master 75bcbce99 -> 2e06754d6


[CB-994] CDVLocalStorage core plugin does not fully backup when app setting "Application does
not run in background" is YES


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

Branch: refs/heads/master
Commit: 2e06754d6240f37b38366e8fc3e852205cd8efdc
Parents: 75bcbce
Author: Shazron Abdullah <shazron@apache.org>
Authored: Tue Jul 31 19:58:42 2012 -0700
Committer: Shazron Abdullah <shazron@apache.org>
Committed: Tue Jul 31 19:58:42 2012 -0700

----------------------------------------------------------------------
 CordovaLib/Classes/CDVLocalStorage.m |   12 +++++++++++-
 1 files changed, 11 insertions(+), 1 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/blob/2e06754d/CordovaLib/Classes/CDVLocalStorage.m
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/CDVLocalStorage.m b/CordovaLib/Classes/CDVLocalStorage.m
index 5dc36da..58686ba 100644
--- a/CordovaLib/Classes/CDVLocalStorage.m
+++ b/CordovaLib/Classes/CDVLocalStorage.m
@@ -316,8 +316,18 @@
 - (void) onResignActive
 {
     UIDevice* device = [UIDevice currentDevice];
+    NSNumber* exitsOnSuspend = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"UIApplicationExitsOnSuspend"];
+
+    BOOL isMultitaskingSupported = [device respondsToSelector:@selector(isMultitaskingSupported)]
&& [device isMultitaskingSupported];
+    if (exitsOnSuspend == nil) { // if it's missing, it should be NO (i.e. multi-tasking
on by default)
+        exitsOnSuspend = [NSNumber numberWithBool:NO];
+    }
     
-    if ([device respondsToSelector:@selector(isMultitaskingSupported)] && [device
isMultitaskingSupported]) 
+    if (exitsOnSuspend)
+    {
+        [self backup:nil withDict:nil];
+    } 
+    else if (isMultitaskingSupported) 
     {
         __block UIBackgroundTaskIdentifier backgroundTaskID = UIBackgroundTaskInvalid;
         


Mime
View raw message