From f9c8848fc9d0b954980f2dbad9d338ded4ad2a1b Mon Sep 17 00:00:00 2001 From: "Jay Freeman (saurik)" Date: Tue, 31 Jan 2017 21:33:32 -0800 Subject: For progress JS on iOS 10 to solve race and flash. --- MobileCydia.mm | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/MobileCydia.mm b/MobileCydia.mm index dbe4f80..addc941 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]]; } -- cgit v1.2.3