summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJay Freeman (saurik) <saurik@saurik.com>2015-07-11 22:20:17 -0700
committerJay Freeman (saurik) <saurik@saurik.com>2015-07-11 22:23:00 -0700
commitd0a5ea5685a2c5e2f98b76fd771095ecf048a66f (patch)
tree53e286e368951be79d0276e202797f4f10709832
parent375a4481b21835983ea4f32bd1847a46c1038c68 (diff)
Provide a way to get the icons for installed apps.
-rw-r--r--MobileCydia.mm14
-rw-r--r--iPhonePrivate.h1
2 files changed, 14 insertions, 1 deletions
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);
// }}}