From 9dd3045d98e3d2905f4b656c44b933a06fbe7736 Mon Sep 17 00:00:00 2001 From: "Jay Freeman (saurik)" Date: Wed, 9 Mar 2011 22:22:03 -0800 Subject: [PATCH 1/1] Save the state during abnormal terminations. --- MobileCydia.mm | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/MobileCydia.mm b/MobileCydia.mm index 096c4ab5..fd5c1c42 100644 --- a/MobileCydia.mm +++ b/MobileCydia.mm @@ -871,6 +871,7 @@ static NSString *CYHex(NSData *data, bool reverse = false) { @class CYPackageController; @protocol CydiaDelegate +- (void) saveState; - (void) retainNetworkActivityIndicator; - (void) releaseNetworkActivityIndicator; - (void) clearPackage:(Package *)package; @@ -5072,6 +5073,9 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) { - (void) close { UpdateExternalStatus(0); + if (Finish_ > 1) + [delegate_ saveState]; + switch (Finish_) { case 0: break; @@ -9478,15 +9482,19 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) { [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"]; + Changed_ = true; [self _saveConfig]; } +- (void) applicationWillTerminate:(UIApplication *)application { + [self saveState]; +} + - (void) setConfigurationData:(NSString *)data { static Pcre conffile_r("^'(.*)' '(.*)' ([01]) ([01])$"); -- 2.47.2