X-Git-Url: https://git.saurik.com/cydia.git/blobdiff_plain/5652087ef8eac68233426e3675bf26b0c1585d55..caa861bdca0452534fccc101228458f5cc6f41f2:/MobileCydia.mm diff --git a/MobileCydia.mm b/MobileCydia.mm index dbe4f804..0485f54f 100644 --- a/MobileCydia.mm +++ b/MobileCydia.mm @@ -53,7 +53,6 @@ #include #include -#include #include #include @@ -1135,6 +1134,7 @@ typedef std::map< unsigned long, _H > SourceMap; + (Database *) sharedInstance; - (unsigned) era; +- (bool) hasPackages; - (void) _readCydia:(NSNumber *)fd; - (void) _readStatus:(NSNumber *)fd; @@ -3523,6 +3523,10 @@ class CydiaLogCleaner : CFArrayRemoveAllValues(packages_); } +- (bool) hasPackages { + return CFArrayGetCount(packages_) != 0; +} + - (void) dealloc { // XXX: actually implement this thing _assert(false); @@ -4857,10 +4861,16 @@ static _H Diversions_; } - (NSString *) substitutePackageNames:(NSString *)message { + auto database([Database sharedInstance]); + + // XXX: this check is less racy than you'd expect, but this entire concept is a little awkward + if (![database hasPackages]) + return message; + NSMutableArray *words([[[message componentsSeparatedByString:@" "] mutableCopy] autorelease]); for (size_t i(0), e([words count]); i != e; ++i) { NSString *word([words objectAtIndex:i]); - if (Package *package = [[Database sharedInstance] packageWithName:word]) + if (Package *package = [database packageWithName:word]) [words replaceObjectAtIndex:i withObject:[package name]]; } @@ -5613,7 +5623,7 @@ bool DepSubstrate(const pkgCache::VerIterator &iterator) { [self setURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@/#!/progress/", UI_]]]; - [scroller_ setBackgroundColor:[UIColor blackColor]]; + [self setPageColor:[UIColor blackColor]]; [[self navigationItem] setHidesBackButton:YES]; @@ -8844,7 +8854,7 @@ static void HomeControllerReachabilityCallback(SCNetworkReachabilityRef reachabi [alert setNumberOfRows:1]; [alert addTextFieldWithValue:@"http://" label:@""]; - UITextInputTraits *traits = [[alert textField] textInputTraits]; + NSObject *traits = [[alert textField] textInputTraits]; [traits setAutocapitalizationType:UITextAutocapitalizationTypeNone]; [traits setAutocorrectionType:UITextAutocorrectionTypeNo]; [traits setKeyboardType:UIKeyboardTypeURL]; @@ -9594,7 +9604,7 @@ _end [super applicationSuspend]; } -- (void) applicationSuspend:(__GSEvent *)event { +- (void) applicationSuspend:(GSEventRef)event { if ([self isSafeToSuspend]) [super applicationSuspend:event]; }