From 8c5b623ff2633be8f4e7223a689c1f09d4c777f7 Mon Sep 17 00:00:00 2001 From: "Jay Freeman (saurik)" Date: Mon, 23 Dec 2013 17:50:42 -0800 Subject: [PATCH] Add cydia.getApplicationInfoValue() for ProTube. --- MobileCydia.mm | 12 ++++++++++++ iPhonePrivate.h | 1 + 2 files changed, 13 insertions(+) diff --git a/MobileCydia.mm b/MobileCydia.mm index 754deefa..a78e6b02 100644 --- a/MobileCydia.mm +++ b/MobileCydia.mm @@ -4140,6 +4140,8 @@ static _H Diversions_; return @"format"; else if (selector == @selector(getAllSources)) return @"getAllSources"; + else if (selector == @selector(getApplicationInfo:value:)) + return @"getApplicationInfoValue"; else if (selector == @selector(getKernelNumber:)) return @"getKernelNumber"; else if (selector == @selector(getKernelString:)) @@ -4248,6 +4250,16 @@ static _H Diversions_; [CydiaWebViewController performSelectorOnMainThread:@selector(addDiversion:) withObject:[[[Diversion alloc] initWithFrom:from to:to] autorelease] waitUntilDone:NO]; } +- (NSDictionary *) getApplicationInfo:(NSString *)display value:(NSString *)key { + char path[1024]; + if (SBBundlePathForDisplayIdentifier(SBSSpringBoardServerPort(), [display UTF8String], path) != 0) + return (id) [NSNull null]; + NSDictionary *info([NSDictionary dictionaryWithContentsOfFile:[[NSString stringWithUTF8String:path] stringByAppendingString:@"/Info.plist"]]); + if (info == nil) + return (id) [NSNull null]; + return [info objectForKey:key]; +} + - (NSNumber *) getKernelNumber:(NSString *)name { const char *string([name UTF8String]); diff --git a/iPhonePrivate.h b/iPhonePrivate.h index 5f5ba129..08e0a334 100644 --- a/iPhonePrivate.h +++ b/iPhonePrivate.h @@ -430,6 +430,7 @@ extern float const UIWebViewScalesToFitScale; // extern "C" *(); {{{ extern "C" void *reboot2(uint64_t flags); extern "C" mach_port_t SBSSpringBoardServerPort(); +extern "C" int SBBundlePathForDisplayIdentifier(mach_port_t port, const char *identifier, char *path); extern "C" UIImage *_UIImageWithName(NSString *name); extern "C" void UISetColor(CGColorRef color); // }}} -- 2.45.2