From d0a5ea5685a2c5e2f98b76fd771095ecf048a66f Mon Sep 17 00:00:00 2001 From: "Jay Freeman (saurik)" Date: Sat, 11 Jul 2015 22:20:17 -0700 Subject: Provide a way to get the icons for installed apps. --- MobileCydia.mm | 14 +++++++++++++- iPhonePrivate.h | 1 + 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/MobileCydia.mm b/MobileCydia.mm index fc3598b..b039213 100644 --- a/MobileCydia.mm +++ b/MobileCydia.mm @@ -7177,7 +7177,19 @@ static void HomeControllerReachabilityCallback(SCNetworkReachabilityRef reachabi Database *database([Database sharedInstance]); - if ([command isEqualToString:@"package-icon"]) { + if (false); + else if ([command isEqualToString:@"application-icon"]) { + if (path == nil) + goto fail; + path = [path stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding]; + NSData *data([SBSCopyIconImagePNGDataForDisplayIdentifier(path) autorelease]); + UIImage *icon; + if (data == nil) + icon = [UIImage imageNamed:@"unknown.png"]; + else + icon = [UIImage imageWithData:data]; + [self _returnPNGWithImage:icon forRequest:request]; + } else if ([command isEqualToString:@"package-icon"]) { if (path == nil) goto fail; path = [path stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding]; diff --git a/iPhonePrivate.h b/iPhonePrivate.h index 2c9239c..70eef38 100644 --- a/iPhonePrivate.h +++ b/iPhonePrivate.h @@ -440,6 +440,7 @@ extern "C" mach_port_t SBSSpringBoardServerPort(); extern "C" int SBBundlePathForDisplayIdentifier(mach_port_t port, const char *identifier, char *path); extern "C" NSSet *SBSCopyDisplayIdentifiers(); extern "C" NSString *SBSCopyLocalizedApplicationNameForDisplayIdentifier(NSString *); +extern "C" NSData *SBSCopyIconImagePNGDataForDisplayIdentifier(NSString *); extern "C" UIImage *_UIImageWithName(NSString *name); extern "C" void UISetColor(CGColorRef color); // }}} -- cgit v1.2.3