]> git.saurik.com Git - cydia.git/commitdiff
Add cydia.getApplicationInfoValue() for ProTube.
authorJay Freeman (saurik) <saurik@saurik.com>
Tue, 24 Dec 2013 01:50:42 +0000 (17:50 -0800)
committerJay Freeman (saurik) <saurik@saurik.com>
Tue, 24 Dec 2013 01:50:42 +0000 (17:50 -0800)
MobileCydia.mm
iPhonePrivate.h

index 754deefa0b74add95f8ba6226fd80165b869ee78..a78e6b026fd4c591c706861d32ae71f1ce949e78 100644 (file)
@@ -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]);
 
index 5f5ba129843b83c55b20ec9c6be3a1c5a5bd7443..08e0a334ef8178376c9e1b2bca1cc9a89dcb3333 100644 (file)
@@ -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);
 // }}}