From f224db47412c975eb83d7be38866b390ba30dbb8 Mon Sep 17 00:00:00 2001 From: James Matoe Date: Mon, 11 Jun 2012 16:53:03 -0300 Subject: [PATCH 1/6] fixes --- Makefile | 15 ++ .../classes/layout/DEBIAN/control => control | 4 +- dylib/classes/Makefile | 8 - dylib/classes/get-theos.sh | 7 - library/hide-sample.c => hide-sample.c | 0 library/main.h => hide.h | 1 - library/main.m => hide.m | 12 +- dylib/classes/iconhide.xm => iconhide.xm | 217 +++++++++--------- .../libhide.plist => libhide.plist | 0 library/Makefile | 22 -- 10 files changed, 134 insertions(+), 152 deletions(-) create mode 100644 Makefile rename dylib/classes/layout/DEBIAN/control => control (86%) delete mode 100644 dylib/classes/Makefile delete mode 100755 dylib/classes/get-theos.sh rename library/hide-sample.c => hide-sample.c (100%) rename library/main.h => hide.h (99%) rename library/main.m => hide.m (98%) rename dylib/classes/iconhide.xm => iconhide.xm (70%) rename dylib/classes/layout/Library/MobileSubstrate/DynamicLibraries/libhide.plist => libhide.plist (100%) delete mode 100644 library/Makefile diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..64409bb --- /dev/null +++ b/Makefile @@ -0,0 +1,15 @@ +TWEAK_NAME = libhide +LIBRARY_NAME = hide + +libhide_FILES = iconhide.xm +libhide_FRAMEWORKS = UIKit + +hide_FILES = hide.m +hide_INSTALL_PATH = /usr/lib + +include framework/makefiles/common.mk +include framework/makefiles/tweak.mk +include framework/makefiles/library.mk + +internal-stage:: + $(ECHO_NOTHING)cp hide-sample.c $(THEOS_STAGING_DIR)/usr/lib/hide-sample.c$(ECHO_END) \ No newline at end of file diff --git a/dylib/classes/layout/DEBIAN/control b/control similarity index 86% rename from dylib/classes/layout/DEBIAN/control rename to control index a040399..397ce3f 100644 --- a/dylib/classes/layout/DEBIAN/control +++ b/control @@ -1,12 +1,12 @@ Package: libhide Name: libhide -Version: 2.0.7 +Version: 2.2 Architecture: iphoneos-arm Description: Library to hide icons. If you are a developer wanting to use this library, code samples included in /usr/lib. Maintainer: BigBoss Author: BigBoss Section: Development -Depends: mobilesubstrate +Depends: mobilesubstrate, com.chpwn.iconsupport dev: bigboss Sponsor: thebigboss.org Tag: role::developer, purpose::library diff --git a/dylib/classes/Makefile b/dylib/classes/Makefile deleted file mode 100644 index d4718d1..0000000 --- a/dylib/classes/Makefile +++ /dev/null @@ -1,8 +0,0 @@ -TWEAK_NAME = libhide -SDKVERSION = 4.0 - -libhide_OBJCC_FILES = iconhide.mm -libhide_FRAMEWORKS = UIKit - -include framework/makefiles/common.mk -include framework/makefiles/tweak.mk diff --git a/dylib/classes/get-theos.sh b/dylib/classes/get-theos.sh deleted file mode 100755 index 0c4edcf..0000000 --- a/dylib/classes/get-theos.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash - -if [ ! -d framework ]; then - svn co http://svn.howett.net/svn/theos/trunk framework -else - echo "The Theos \"framework\" directory already exists." -fi diff --git a/library/hide-sample.c b/hide-sample.c similarity index 100% rename from library/hide-sample.c rename to hide-sample.c diff --git a/library/main.h b/hide.h similarity index 99% rename from library/main.h rename to hide.h index d96552a..c66d7f1 100644 --- a/library/main.h +++ b/hide.h @@ -1,4 +1,3 @@ - #define Cache_ "/var/mobile/Library/Caches/com.apple.mobile.installation.plist" #define HIDLIBPATH "/var/mobile/Library/LibHide/hidden.plist" diff --git a/library/main.m b/hide.m similarity index 98% rename from library/main.m rename to hide.m index 3a1a12e..67006df 100644 --- a/library/main.m +++ b/hide.m @@ -1,7 +1,7 @@ #import #import #import -#import "main.h" +#import "hide.h" #import /* for uname structure */ #include #include @@ -356,7 +356,7 @@ BOOL UnHideSpecialIcon(NSString* Path, BOOL UpdateMaster) // Check AppStore apps for it if(Path == nil) { - NSArray* AppDirs = [[NSArray alloc] initWithArray:[FileManager directoryContentsAtPath:@"/var/mobile/Applications"]]; + NSArray* AppDirs = [[NSArray alloc] initWithArray:[FileManager contentsOfDirectoryAtPath:@"/var/mobile/Applications" error:NULL]]; int i = 0; for(i = 0; i < [AppDirs count]; i++) @@ -412,7 +412,7 @@ BOOL UnHideSpecialIcon(NSString* Path, BOOL UpdateMaster) int j = 0; // First scan /Applications - AppDirs = [[NSArray alloc] initWithArray:[FileManager directoryContentsAtPath:@"/Applications"]]; + AppDirs = [[NSArray alloc] initWithArray:[FileManager contentsOfDirectoryAtPath:@"/Applications" error:NULL]]; for(i = 0; i < [AppDirs count]; i++) { AppDirTitle = [NSString stringWithString:[AppDirs objectAtIndex:i]]; @@ -452,16 +452,16 @@ BOOL UnHideSpecialIcon(NSString* Path, BOOL UpdateMaster) NSString* FullAppPath = nil; BOOL AppExists = NO; - AppDirs = [[NSArray alloc] initWithArray:[FileManager directoryContentsAtPath:@"/var/mobile/Applications"]]; + AppDirs = [[NSArray alloc] initWithArray:[FileManager contentsOfDirectoryAtPath:@"/var/mobile/Applications" error:NULL]]; for(i = 0; i < [AppDirs count]; i++) { PrefixDir = [NSString stringWithFormat:@"/var/mobile/Applications/%@", [AppDirs objectAtIndex: i]]; NSLog(@"PrefixDir = %@\n", PrefixDir); - AppStoreApps = [[NSArray alloc] initWithArray:[FileManager directoryContentsAtPath: PrefixDir]]; + AppStoreApps = [[NSArray alloc] initWithArray:[FileManager contentsOfDirectoryAtPath:PrefixDir error:NULL]]; AppExists = NO; for(j = 0; j < [AppStoreApps count]; j++) { - AppDirTitle = [NSString stringWithFormat: [AppStoreApps objectAtIndex: j]]; + AppDirTitle = [AppStoreApps objectAtIndex: j]; NSLog(@"AppDirTitle = %@\n", AppDirTitle); // Filter garbage diff --git a/dylib/classes/iconhide.xm b/iconhide.xm similarity index 70% rename from dylib/classes/iconhide.xm rename to iconhide.xm index 85a8197..1406c96 100644 --- a/dylib/classes/iconhide.xm +++ b/iconhide.xm @@ -9,21 +9,20 @@ // created and copyrighted by Jay Freeman a.k.a saurik and // are protected by various means of open source licensing. // -// -#include -#include #include +#include -//******************************************************************************************************* -// #defines -//******************************************************************************************************* -#define IH_VERSION "2.0.6-1" +/******************************************************************************************************** +// defines +********************************************************************************************************/ +#define IH_VERSION "2.2" #define HIDLIBPATH "/var/mobile/Library/LibHide/hidden.plist" #define SYS_VER_2(_x) (_x >= 2.0 && _x < 3.0) ? YES : NO #define SYS_VER_3(_x) (_x >= 3.0 && _x < 4.0) ? YES : NO #define SYS_VER_4(_x) (_x >= 4.0 && _x < 5.0) ? YES : NO +#define SYS_VER_5(_x) (_x >= 5.0) ? YES : NO #define _release(object) \ do if (object != nil) { \ @@ -39,9 +38,14 @@ __asm__("mov %0, lr": "=r"(bt)); \ NSLog(@"[%@ %s] bt=%x", [[self class] description], sel_getName(sel), bt); \ } -//******************************************************************************************************* +/******************************************************************************************************* // Declarations (for private classes/methods) -//******************************************************************************************************* +********************************************************************************************************/ +@interface ISIconSupport : NSObject ++ (ISIconSupport *)sharedInstance; +- (void)addExtension:(NSString *)name; +@end + @interface SBIcon : UIView - (void)setShowsImages:(BOOL)images; @end @@ -100,9 +104,9 @@ NSLog(@"[%@ %s] bt=%x", [[self class] description], sel_getName(sel), bt); \ - (void)relaunchSpringBoard; @end -//******************************************************************************************************* +/******************************************************************************************************** // Globals -//******************************************************************************************************* +********************************************************************************************************/ static NSMutableArray* global_HiddenIconIds = nil; static NSMutableArray* global_HiddenSpotlightIconIds = nil; static bool global_Rehide = YES; @@ -114,14 +118,14 @@ static bool global_switcherShowing = NO; #pragma mark - #pragma mark hidden icon hooks -//******************************************************************************************************* +/******************************************************************************************************** // SBIconModel hooks -//******************************************************************************************************* +********************************************************************************************************/ %hook SBIconModel -//******************************************************************************************************* +/******************************************************************************************************** // 2.x renamed function -//******************************************************************************************************* +********************************************************************************************************/ %group GSBIconModel_Firmware2x - (BOOL)iconIsVisible:(id)iconId @@ -141,9 +145,9 @@ static bool global_switcherShowing = NO; %end // GSBIconModel_Firmware2x -//******************************************************************************************************* +/******************************************************************************************************** // 3.x renamed function -//******************************************************************************************************* +********************************************************************************************************/ %group GSBIconModel_Firmware3x - (BOOL)isIconVisible:(id)iconId @@ -194,9 +198,9 @@ static bool global_switcherShowing = NO; %end // GSBIconModel_Firmware3x -//******************************************************************************************************* +/******************************************************************************************************** // 4.x renamed function -//******************************************************************************************************* +********************************************************************************************************/ %group GSBIconModel_Firmware4x - (BOOL)isIconVisible:(id)iconId @@ -280,13 +284,13 @@ static bool global_switcherShowing = NO; %end // SBIconModel -//******************************************************************************************************* +/******************************************************************************************************** // SBSearchController hooks -//******************************************************************************************************* +********************************************************************************************************/ %hook SBSearchController -//******************************************************************************************************* -//******************************************************************************************************* +/******************************************************************************************************** +********************************************************************************************************/ - (id)init { id newSearchController = %orig; @@ -298,79 +302,78 @@ static bool global_switcherShowing = NO; %end // SBSearchController -%group GHiddenIcons - -//******************************************************************************************************* +/******************************************************************************************************** // SBUIController hooks -//******************************************************************************************************* -%hook SBUIController +********************************************************************************************************/ + + +%hook SBPlatformController +%group GHiddenIcons3x +- (void)setInfo:(NSMutableArray *)arrayOfApps forCapability:(NSString *)Capability { + if (Capability != nil && [Capability isEqualToString:@"application-display-identifiers"]) { + NSMutableArray *mutableArray = [NSMutableArray arrayWithArray:arrayOfApps]; + [mutableArray addObjectsFromArray:global_HiddenIconIds]; + + %orig(mutableArray, Capability); + return; + } + + %orig; +} +%end + +%group GHiddenIcons4x +- (void)setValue:(NSMutableArray *)arrayOfApps forCapability:(NSString *)Capability { + if (Capability != nil && [Capability isEqualToString:@"application-display-identifiers"]) { + NSMutableArray *mutableArray = [NSMutableArray arrayWithArray:arrayOfApps]; + [mutableArray addObjectsFromArray:global_HiddenIconIds]; + + %orig(mutableArray, Capability); + return; + } + + %orig; +} +%end +%end -//******************************************************************************************************* -//******************************************************************************************************* +/******************************************************************************************************** +********************************************************************************************************/ +%hook SBUIController +%group GSwitcherHooks4x5x - (void)_toggleSwitcher { global_switcherShowing = YES; %orig; } +%end -//******************************************************************************************************* -//******************************************************************************************************* +%group GSwitcherHooks4x - (void)_dismissSwitcher:(double)switcher { %orig; global_switcherShowing = NO; } +%end -%end // SBUIController - - -#pragma mark - -#pragma mark always-used hooks - -//******************************************************************************************************* -// SBPlatformController hooks -//******************************************************************************************************* -%hook SBPlatformController - -//******************************************************************************************************* -// setInfo - Called for capabilities of app -//******************************************************************************************************* -- (void)setInfo:(NSMutableArray *)arrayOfApps forCapability:(NSString *)Capability -{ - if(Capability != nil && [Capability isEqualToString:@"application-display-identifiers"]) - { - //This assumes arrayOfApps is mutable and not just an NSArray. - if(![arrayOfApps respondsToSelector:@selector(addObjectsFromArray:)]) - { - [arrayOfApps addObjectsFromArray:global_HiddenIconIds]; - } - - // In case the array is not mutable. - else - { - NSMutableArray* mutableArray = [NSMutableArray arrayWithArray:arrayOfApps]; - [mutableArray addObjectsFromArray:global_HiddenIconIds]; - arrayOfApps = mutableArray; - } - } - +%group GSwitcherHooks5x +- (void)dismissSwitcherAnimated:(BOOL)animated { + %log; %orig; } - -%end // SBPlatformController - -%end // GHiddenIcons +%end +%end #pragma mark - #pragma mark non-hooks -//******************************************************************************************************* +/******************************************************************************************************** // Non-hooks -//******************************************************************************************************* +********************************************************************************************************/ -//******************************************************************************************************* +/******************************************************************************************************** // LoadHiddenIconList -//******************************************************************************************************* +********************************************************************************************************/ int LoadHiddenIconList() { int HiddenIcons = 0; @@ -405,8 +408,8 @@ int LoadHiddenIconList() return HiddenIcons; } -//******************************************************************************************************* -//******************************************************************************************************* +/******************************************************************************************************** +********************************************************************************************************/ void* MSHookIvar(id self, const char *unitName) { Ivar ivar = class_getInstanceVariable(object_getClass(self), unitName); @@ -414,9 +417,9 @@ void* MSHookIvar(id self, const char *unitName) return pointer; } -//******************************************************************************************************* +/******************************************************************************************************** // IconHide_HiddenIconsChanged - Runs when the nofify_post(com.libhide.hiddeniconschanged) is called. -//******************************************************************************************************* +********************************************************************************************************/ static void IconHide_HiddenIconsChanged(CFNotificationCenterRef center, void *observer, CFStringRef name, @@ -471,8 +474,8 @@ static void IconHide_HiddenIconsChanged(CFNotificationCenterRef center, } -//******************************************************************************************************* -//******************************************************************************************************* +/******************************************************************************************************** +********************************************************************************************************/ float getSystemVersion() { float Version = 4.0; @@ -493,56 +496,58 @@ float getSystemVersion() #pragma mark - #pragma mark dylib initializer -//******************************************************************************************************* +/******************************************************************************************************** // dylib initializer or entry point. -//******************************************************************************************************* -__attribute__((constructor)) static void init() -{ - NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; +********************************************************************************************************/ +%ctor { + dlopen("/Library/MobileSubstrate/DynamicLibraries/IconSupport.dylib", RTLD_NOW); + [[objc_getClass("ISIconSupport") sharedInstance] addExtension:@"libhide"]; + NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; NSLog(@"LibHide: v" IH_VERSION " initializer"); global_SystemVersion = getSystemVersion(); - //Check open application and create hooks here: - NSString* identifier = [[NSBundle mainBundle] bundleIdentifier]; - if([identifier isEqualToString:@"com.apple.springboard"]) + if(LoadHiddenIconList() != 0) { - if(LoadHiddenIconList() != 0) - { - %init(GHiddenIcons); - + if (SYS_VER_2(global_SystemVersion) || SYS_VER_3(global_SystemVersion)) { + %init(GHiddenIcons3x); + if(SYS_VER_2(global_SystemVersion)) - { %init(GSBIconModel_Firmware2x); - } + else if(SYS_VER_3(global_SystemVersion)) - { %init(GSBIconModel_Firmware3x); - } - else - { - %init(GSBIconModel_Firmware4x); - } } - - // Initialize remaining (non-grouped) hooks - %init; - // Set the rehide flag for setVisibilityOfIcons* function. - global_Rehide = YES; + else { + %init(GSBIconModel_Firmware4x); + %init(GHiddenIcons4x); + + %init(GSwitcherHooks4x5x); + if (SYS_VER_4(global_SystemVersion)) + %init(GSwitcherHooks4x); + else + %init(GSwitcherHooks5x); + } } + // Initialize remaining (non-grouped) hooks + %init; + + // Set the rehide flag for setVisibilityOfIcons* function. + global_Rehide = YES; + CFNotificationCenterAddObserver(CFNotificationCenterGetDarwinNotifyCenter(), NULL, &IconHide_HiddenIconsChanged, - (CFStringRef) @"com.libhide.hiddeniconschanged", + CFSTR("com.libhide.hiddeniconschanged"), NULL, CFNotificationSuspensionBehaviorDeliverImmediately); NSLog(@"LibHide: initializer completed and you're not in safe mode!"); - [pool release]; + [pool drain]; } /* vim: set filetype=objcpp sw=4 ts=4 sts=4 noexpandtab textwidth=80 ff=unix: */ diff --git a/dylib/classes/layout/Library/MobileSubstrate/DynamicLibraries/libhide.plist b/libhide.plist similarity index 100% rename from dylib/classes/layout/Library/MobileSubstrate/DynamicLibraries/libhide.plist rename to libhide.plist diff --git a/library/Makefile b/library/Makefile deleted file mode 100644 index 33395d6..0000000 --- a/library/Makefile +++ /dev/null @@ -1,22 +0,0 @@ -CC=arm-apple-darwin-gcc -LD=$(CC) -LDFLAGS=-lobjc -dynamiclib -bind_at_load -isysroot /var/sdk -F/System/Library/PrivateFrameworks -framework CoreFoundation -framework Foundation -CFLAGS=-fconstant-cfstrings -std=gnu99 -Wall -O2 -I/var/include -I.. --sysroot=/var/sdk -VERSION=1.0 - - -all: hide.dylib - -hide.dylib: main.o - $(LD) $(LDFLAGS) -o $@ $^ - /usr/bin/ldid -S hide.dylib - rm -f *.o - -%.o: %.m - $(CC) -c $(CFLAGS) $(CPPFLAGS) $< -o $@ - -%.o: %.c - $(CC) -c $(CFLAGS) $(CPPFLAGS) $< -o $@ - -clean: - rm -f *.o edge From fbfe66b906c4156edbc0e30a6763f0c935ba2066 Mon Sep 17 00:00:00 2001 From: James Matoe Date: Mon, 11 Jun 2012 16:54:44 -0300 Subject: [PATCH 2/6] sorry, keep the script. --- get-theos.sh | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 get-theos.sh diff --git a/get-theos.sh b/get-theos.sh new file mode 100644 index 0000000..0e44112 --- /dev/null +++ b/get-theos.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +if [ ! -d framework ]; then + svn co http://svn.howett.net/svn/theos/trunk framework +else + echo "The Theos \"framework\" directory already exists." +fi \ No newline at end of file From 47cce940a82357e0a0e956df43a5dd90bcac9985 Mon Sep 17 00:00:00 2001 From: James Matoe Date: Mon, 11 Jun 2012 16:57:56 -0300 Subject: [PATCH 3/6] apparently libhide deb has vaster hide-sample. --- hide-sample.c | 228 +++++++++++++++++++++++++++++++++----------------- 1 file changed, 151 insertions(+), 77 deletions(-) mode change 100644 => 100755 hide-sample.c diff --git a/hide-sample.c b/hide-sample.c old mode 100644 new mode 100755 index 3eecf39..9c995ab --- a/hide-sample.c +++ b/hide-sample.c @@ -1,77 +1,151 @@ -// PlistPath is the full path to the app's Info.plist file for example: -// /Applications/MobileSafari.app/Info.plist -// -// There are exceptions allowed for camera and photos. You should use these: -// /Applications/Camera.app/Info.plist -// /Applications/Photos.app/Info.plist -// -//************************************************************************************************* -// IsIconHidden - Determines if the icon passed in is already hidden or not. -//************************************************************************************************* -BOOL IsIconHidden(NSString* PlistPath) -{ - BOOL Hidden = NO; - - void* libHandle = dlopen("/usr/lib/hide.dylib", RTLD_LAZY); - - if(libHandle != NULL) - { - BOOL (*IsIconHidden)(NSString* Plist) = dlsym(libHandle, "IsIconHidden"); - if(IsIconHidden != NULL) - { - Hidden = IsIconHidden(PlistPath); - } - } - - if(libHandle != NULL) dlclose(libHandle); - - return Hidden; -} - -//************************************************************************************************* -// HideIcon - Hides the icon at the path passed in. -//************************************************************************************************* -BOOL HideIcon(NSString* PlistPath) -{ - - NSLog(@"Hiding %@\n", PlistPath); - void* libHandle = dlopen("/usr/lib/hide.dylib", RTLD_LAZY); - - BOOL DeletedSomething = NO; - - if(libHandle != NULL) - { - BOOL (*LibHideIcon)(NSString* Plist) = dlsym(libHandle, "HideIcon"); - if(LibHideIcon != NULL) - { - // PlistPath is the full path to the plist like "/Applications/BossPrefs.app/Info.plist" - DeletedSomething = LibHideIcon(PlistPath); - } - } - - if(libHandle != NULL) dlclose(libHandle); - - return DeletedSomething; -} - -//************************************************************************************************* -// UnHideIcon - Removes a hidden icon from the plist. Returns TRUE if something was done, FALSE ir not. -//************************************************************************************************* -BOOL UnHideIcon(NSString* Path) -{ - BOOL SomethingDone = NO; - void* libHandle = dlopen("/usr/lib/hide.dylib", RTLD_LAZY); - - if(libHandle != NULL) - { - BOOL (* LibUnHideIcon)(NSString* Plist) = dlsym(libHandle, "UnHideIcon"); - if(LibUnHideIcon != NULL) - { - SomethingDone = LibUnHideIcon(Path); - } - } - if(libHandle != NULL) dlclose(libHandle); - - return SomethingDone; -} - +// PlistPath is the full path to the app's Info.plist file for example: +// /Applications/MobileSafari.app/Info.plist +// +// There are exceptions allowed for camera and photos. You should use these: +// /Applications/Camera.app/Info.plist +// /Applications/Photos.app/Info.plist +// +//************************************************************************************************* +// IsIconHidden - Determines if the icon passed in is already hidden or not. +// PlistPath is the full path to the Info.plist for the app. +//************************************************************************************************* +BOOL IsIconHidden(NSString* PlistPath) +{ + BOOL Hidden = NO; + + void* libHandle = dlopen("/usr/lib/hide.dylib", RTLD_LAZY); + + if(libHandle != NULL) + { + BOOL (*IsIconHidden)(NSString* Plist) = dlsym(libHandle, "IsIconHidden"); + if(IsIconHidden != NULL) + { + Hidden = IsIconHidden(PlistPath); + } + dlclose(libHandle); + } + + return Hidden; +} + +//************************************************************************************************* +// IsIconHidden - Determines if the icon passed in is already hidden or not via the display identifier +// BundleId is the bundle identifier out of the Info.plist for the app. +//************************************************************************************************* +BOOL IsIconHiddenDisplay(NSString* BundleId) +{ + BOOL Hidden = NO; + + void* libHandle = dlopen("/usr/lib/hide.dylib", RTLD_LAZY); + + if(libHandle != NULL) + { + BOOL (*IsIconHiddenDisplayId)(NSString* Plist) = dlsym(libHandle, "IsIconHiddenDisplayId"); + if(IsIconHiddenDisplayId != NULL) + { + Hidden = IsIconHiddenDisplayId(BundleId); + } + dlclose(libHandle); + } + + return Hidden; +} + +//************************************************************************************************* +// HideIcon - Hides the icon at the path passed in. +// PlistPath is the full path to the Info.plist for the app. +//************************************************************************************************* +BOOL HideIcon(NSString* PlistPath) +{ + NSLog(@"Hiding %@\n", PlistPath); + void* libHandle = dlopen("/usr/lib/hide.dylib", RTLD_LAZY); + + BOOL DeletedSomething = NO; + + if(libHandle != NULL) + { + BOOL (*LibHideIcon)(NSString* Plist) = dlsym(libHandle, "HideIcon"); + if(LibHideIcon != NULL) + { + // PlistPath is the full path to the plist like "/Applications/BossPrefs.app/Info.plist" + DeletedSomething = LibHideIcon(PlistPath); + } + dlclose(libHandle); + } + + return DeletedSomething; +} + +//************************************************************************************************* +// HideIconViaDisplayId - Hides the icon using the bundle ID passed in. +// BundleId is the bundle identifier out of the Info.plist for the app. +//************************************************************************************************* +BOOL HideIconViaDisplayId(NSString* BundleId) +{ + void* libHandle = dlopen("/usr/lib/hide.dylib", RTLD_LAZY); + + BOOL DeletedSomething = NO; + + if(libHandle != NULL) + { + BOOL (*LibHideIcon)(NSString* Plist) = dlsym(libHandle, "HideIconViaDisplayId"); + if(LibHideIcon != NULL) + { + DeletedSomething = LibHideIcon(BundleId); + } + dlclose(libHandle); + } + + return DeletedSomething; +} + +//************************************************************************************************* +// UnHideIcon - Removes a hidden icon from the plist. Returns TRUE if something was done, FALSE ir not. +// PlistPath is the full path to the Info.plist for the app. +//************************************************************************************************* +BOOL UnHideIcon(NSString* Path) +{ + BOOL SomethingDone = NO; + void* libHandle = dlopen("/usr/lib/hide.dylib", RTLD_LAZY); + + if(libHandle != NULL) + { + BOOL (* LibUnHideIcon)(NSString* Plist) = dlsym(libHandle, "UnHideIcon"); + if(LibUnHideIcon != NULL) + { + SomethingDone = LibUnHideIcon(Path); + } + dlclose(libHandle); + } + + return SomethingDone; +} + +//************************************************************************************************* +// UnHideIconViaDisplayId - Removes a hidden icon from the plist. Returns TRUE if something was done, FALSE ir not. +// BundleId is the bundle identifier out of the Info.plist for the app. +//************************************************************************************************* +BOOL UnHideIconViaDisplayId(NSString* BundleId) +{ + BOOL SomethingDone = NO; + void* libHandle = dlopen("/usr/lib/hide.dylib", RTLD_LAZY); + + if(libHandle != NULL) + { + BOOL (* LibUnHideIcon)(NSString* BundleId) = dlsym(libHandle, "UnHideIconViaDisplayId"); + if(LibUnHideIcon != NULL) + { + SomethingDone = LibUnHideIcon(BundleId); + } + dlclose(libHandle); + } + + return SomethingDone; +} + +//************************************************************************************************* +// Cause changes to take effect without respring (v2.0.6 or newer only) +// just issue notify_post (may need to #include +// notify_post("com.libhide.hiddeniconschanged); +//************************************************************************************************* + From 2d16c19d72681ff81456d3008e4234b77a393521 Mon Sep 17 00:00:00 2001 From: James Matoe Date: Mon, 11 Jun 2012 19:08:57 -0300 Subject: [PATCH 4/6] add theos submodule --- .gitmodules | 3 +++ theos | 1 + 2 files changed, 4 insertions(+) create mode 100644 .gitmodules create mode 160000 theos diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..4a061ca --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "theos"] + path = theos + url = git://github.com/DHowett/theos diff --git a/theos b/theos new file mode 160000 index 0000000..f1b398e --- /dev/null +++ b/theos @@ -0,0 +1 @@ +Subproject commit f1b398e9376f611a5855dba19848ad10b4a5596d From 823b4db3766d3856ac002e835fb17b567622c46e Mon Sep 17 00:00:00 2001 From: James Matoe Date: Mon, 11 Jun 2012 19:50:11 -0300 Subject: [PATCH 5/6] god forgive me --- iconhide.xm | 10 ++++------ theos | 2 +- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/iconhide.xm b/iconhide.xm index 1406c96..d0ac631 100644 --- a/iconhide.xm +++ b/iconhide.xm @@ -88,10 +88,8 @@ NSLog(@"[%@ %s] bt=%x", [[self class] description], sel_getName(sel), bt); \ @end @interface SBSearchController : NSObject -@property(retain, nonatomic) SBSearchView *searchView; -@end -@interface SBSearchController (Firmware2x3x) + (id)sharedInstance; +@property(retain, nonatomic) SBSearchView *searchView; @end @interface SBSearchModel : NSObject // Firmware4x @@ -159,7 +157,7 @@ static bool global_switcherShowing = NO; if(global_switcherShowing == NO) { Class SBSearchController = objc_getClass("SBSearchController"); - SBSearchController* searchController = [SBSearchController sharedInstance]; + id searchController = [SBSearchController sharedInstance]; if(searchController != nil) { SBSearchView* SearchView = [searchController searchView]; @@ -229,7 +227,7 @@ static bool global_switcherShowing = NO; { // FIXME: This code is never called (?). What is its purpose? Class SBSearchModel = objc_getClass("SBSearchModel"); - SBSearchModel* searchModel = [SBSearchModel sharedInstance]; + id searchModel = [SBSearchModel sharedInstance]; if(searchModel != nil) { isShowingSearch = [searchModel hasQueryString]; @@ -358,8 +356,8 @@ static bool global_switcherShowing = NO; %group GSwitcherHooks5x - (void)dismissSwitcherAnimated:(BOOL)animated { - %log; %orig; + global_switcherShowing = NO; } %end %end diff --git a/theos b/theos index f1b398e..88e6a30 160000 --- a/theos +++ b/theos @@ -1 +1 @@ -Subproject commit f1b398e9376f611a5855dba19848ad10b4a5596d +Subproject commit 88e6a302c42840440f9faac73f27efc6a3e0c1a6 From 3b2662d9ca342374796a473834cba220bf526884 Mon Sep 17 00:00:00 2001 From: James Matoe Date: Mon, 11 Jun 2012 20:59:54 -0300 Subject: [PATCH 6/6] as suggested by @DHowett, not use IconSupport --- control | 2 +- iconhide.xm | 8 -------- 2 files changed, 1 insertion(+), 9 deletions(-) diff --git a/control b/control index 397ce3f..ffb588b 100644 --- a/control +++ b/control @@ -6,7 +6,7 @@ Description: Library to hide icons. If you are a developer wanting to use this l Maintainer: BigBoss Author: BigBoss Section: Development -Depends: mobilesubstrate, com.chpwn.iconsupport +Depends: mobilesubstrate dev: bigboss Sponsor: thebigboss.org Tag: role::developer, purpose::library diff --git a/iconhide.xm b/iconhide.xm index d0ac631..60cd6b5 100644 --- a/iconhide.xm +++ b/iconhide.xm @@ -41,11 +41,6 @@ NSLog(@"[%@ %s] bt=%x", [[self class] description], sel_getName(sel), bt); \ /******************************************************************************************************* // Declarations (for private classes/methods) ********************************************************************************************************/ -@interface ISIconSupport : NSObject -+ (ISIconSupport *)sharedInstance; -- (void)addExtension:(NSString *)name; -@end - @interface SBIcon : UIView - (void)setShowsImages:(BOOL)images; @end @@ -498,9 +493,6 @@ float getSystemVersion() // dylib initializer or entry point. ********************************************************************************************************/ %ctor { - dlopen("/Library/MobileSubstrate/DynamicLibraries/IconSupport.dylib", RTLD_NOW); - [[objc_getClass("ISIconSupport") sharedInstance] addExtension:@"libhide"]; - NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; NSLog(@"LibHide: v" IH_VERSION " initializer");