]> git.saurik.com Git - cydia.git/commitdiff
Save the state during abnormal terminations.
authorJay Freeman (saurik) <saurik@saurik.com>
Thu, 10 Mar 2011 06:22:03 +0000 (22:22 -0800)
committerJay Freeman (saurik) <saurik@saurik.com>
Thu, 10 Mar 2011 06:22:34 +0000 (22:22 -0800)
MobileCydia.mm

index 096c4ab5ce19f46da0ae7641107e185ff6b557d1..fd5c1c427c7e9cd5fc2d8690922329a2fd84da8a 100644 (file)
@@ -871,6 +871,7 @@ static NSString *CYHex(NSData *data, bool reverse = false) {
 @class CYPackageController;
 
 @protocol CydiaDelegate
 @class CYPackageController;
 
 @protocol CydiaDelegate
+- (void) saveState;
 - (void) retainNetworkActivityIndicator;
 - (void) releaseNetworkActivityIndicator;
 - (void) clearPackage:(Package *)package;
 - (void) retainNetworkActivityIndicator;
 - (void) releaseNetworkActivityIndicator;
 - (void) clearPackage:(Package *)package;
@@ -5072,6 +5073,9 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
 - (void) close {
     UpdateExternalStatus(0);
 
 - (void) close {
     UpdateExternalStatus(0);
 
+    if (Finish_ > 1)
+        [delegate_ saveState];
+
     switch (Finish_) {
         case 0:
         break;
     switch (Finish_) {
         case 0:
         break;
@@ -9478,15 +9482,19 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) {
         [super applicationWillResignActive:application];
 }
 
         [super applicationWillResignActive:application];
 }
 
-- (void) applicationWillTerminate:(UIApplication *)application {
-    Changed_ = true;
+- (void) saveState {
     [Metadata_ setObject:[tabbar_ navigationURLCollection] forKey:@"InterfaceState"];
     [Metadata_ setObject:[NSDate date] forKey:@"LastClosed"];
     [Metadata_ setObject:[NSNumber numberWithInt:[tabbar_ selectedIndex]] forKey:@"InterfaceIndex"];
     [Metadata_ setObject:[tabbar_ navigationURLCollection] forKey:@"InterfaceState"];
     [Metadata_ setObject:[NSDate date] forKey:@"LastClosed"];
     [Metadata_ setObject:[NSNumber numberWithInt:[tabbar_ selectedIndex]] forKey:@"InterfaceIndex"];
+    Changed_ = true;
 
     [self _saveConfig];
 }
 
 
     [self _saveConfig];
 }
 
+- (void) applicationWillTerminate:(UIApplication *)application {
+    [self saveState];
+}
+
 - (void) setConfigurationData:(NSString *)data {
     static Pcre conffile_r("^'(.*)' '(.*)' ([01]) ([01])$");
 
 - (void) setConfigurationData:(NSString *)data {
     static Pcre conffile_r("^'(.*)' '(.*)' ([01]) ([01])$");