From: Jay Freeman (saurik) Date: Wed, 1 Feb 2017 05:33:32 +0000 (-0800) Subject: For progress JS on iOS 10 to solve race and flash. X-Git-Tag: v1.1.28%b10~1 X-Git-Url: https://git.saurik.com/cydia.git/commitdiff_plain/f9c8848fc9d0b954980f2dbad9d338ded4ad2a1b?hp=a07675e1d9fe1344f04b9d436c8de174d086c480 For progress JS on iOS 10 to solve race and flash. --- diff --git a/MobileCydia.mm b/MobileCydia.mm index dbe4f804..addc9418 100644 --- a/MobileCydia.mm +++ b/MobileCydia.mm @@ -1135,6 +1135,7 @@ typedef std::map< unsigned long, _H > SourceMap; + (Database *) sharedInstance; - (unsigned) era; +- (bool) hasPackages; - (void) _readCydia:(NSNumber *)fd; - (void) _readStatus:(NSNumber *)fd; @@ -3523,6 +3524,10 @@ class CydiaLogCleaner : CFArrayRemoveAllValues(packages_); } +- (bool) hasPackages { + return CFArrayGetCount(packages_) != 0; +} + - (void) dealloc { // XXX: actually implement this thing _assert(false); @@ -4857,10 +4862,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]]; }