summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJay Freeman (saurik) <saurik@saurik.com>2013-12-23 17:50:42 -0800
committerJay Freeman (saurik) <saurik@saurik.com>2013-12-23 17:50:42 -0800
commit8c5b623ff2633be8f4e7223a689c1f09d4c777f7 (patch)
tree1533e119129f32aadeab13857512e09ef21c5b7b
parentd32f96beabb726c84dfeaa3a51bb365eded7f8f9 (diff)
Add cydia.getApplicationInfoValue() for ProTube.
-rw-r--r--MobileCydia.mm12
-rw-r--r--iPhonePrivate.h1
2 files changed, 13 insertions, 0 deletions
diff --git a/MobileCydia.mm b/MobileCydia.mm
index 754deef..a78e6b0 100644
--- a/MobileCydia.mm
+++ b/MobileCydia.mm
@@ -4140,6 +4140,8 @@ static _H<NSMutableSet> 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<NSMutableSet> 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 5f5ba12..08e0a33 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);
// }}}