From: Jay Freeman (saurik) Date: Sun, 28 Mar 2010 07:52:16 +0000 (+0000) Subject: Add a setting to hide the WinterBoard icon. X-Git-Tag: v0.9.3900~35 X-Git-Url: https://git.saurik.com/winterboard.git/commitdiff_plain/7c88a3f1e2c7b332f39a544e26f022416b794098 Add a setting to hide the WinterBoard icon. --- diff --git a/Settings.mm b/Settings.mm index 38aa3c3..3c8ed65 100644 --- a/Settings.mm +++ b/Settings.mm @@ -42,6 +42,14 @@ #import #import +#include + +static BOOL (*IsIconHiddenDisplayId)(NSString *); +static BOOL (*HideIconViaDisplayId)(NSString *); +static BOOL (*UnHideIconViaDisplayId)(NSString *); + +static const NSString *WinterBoardDisplayID = @"com.saurik.WinterBoard"; + extern NSString *PSTableCellKey; extern "C" UIImage *_UIImageWithName(NSString *); @@ -76,6 +84,7 @@ static NSString *_plist; - (UITableViewCellEditingStyle) tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath; - (BOOL) tableView:(UITableView *)tableView shouldIndentWhileEditingRowAtIndexPath:(NSIndexPath *)indexPath; - (BOOL) tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath; + @end @implementation WBSThemesController @@ -262,10 +271,24 @@ static NSString *_plist; @implementation WBSettingsController ++ (void) load { + NSLog(@"LH"); + void *libhide(dlopen("/usr/lib/hide.dylib", RTLD_LAZY)); + NSLog(@"LH:%x", libhide); + IsIconHiddenDisplayId = reinterpret_cast(dlsym(libhide, "IsIconHiddenDisplayId")); + NSLog(@"LH:%x", IsIconHiddenDisplayId); + HideIconViaDisplayId = reinterpret_cast(dlsym(libhide, "HideIconViaDisplayId")); + NSLog(@"LH:%x", HideIconViaDisplayId); + UnHideIconViaDisplayId = reinterpret_cast(dlsym(libhide, "UnHideIconViaDisplayId")); + NSLog(@"LH:%x", UnHideIconViaDisplayId); +} + - (id) initForContentSize:(CGSize)size { if ((self = [super initForContentSize:size]) != nil) { _plist = [[NSString stringWithFormat:@"%@/Library/Preferences/com.saurik.WinterBoard.plist", NSHomeDirectory()] retain]; _settings = [([NSMutableDictionary dictionaryWithContentsOfFile:_plist] ?: [NSMutableDictionary dictionary]) retain]; + + [_settings setObject:[NSNumber numberWithBool:IsIconHiddenDisplayId(WinterBoardDisplayID)] forKey:@"IconHidden"]; } return self; } @@ -285,10 +308,16 @@ static NSString *_plist; if (![data writeToFile:_plist options:NSAtomicWrite error:NULL]) return; + ([[_settings objectForKey:@"IconHidden"] boolValue] ? HideIconViaDisplayId : UnHideIconViaDisplayId)(WinterBoardDisplayID); + unlink("/User/Library/Caches/com.apple.springboard-imagecache-icons"); unlink("/User/Library/Caches/com.apple.springboard-imagecache-icons.plist"); unlink("/User/Library/Caches/com.apple.springboard-imagecache-smallicons"); unlink("/User/Library/Caches/com.apple.springboard-imagecache-smallicons.plist"); + + system("rm -rf /User/Library/Caches/SpringBoardIconCache"); + system("rm -rf /User/Library/Caches/SpringBoardIconCache-small"); + system("killall SpringBoard"); } @@ -332,9 +361,10 @@ static NSString *_plist; } - (void) setPreferenceValue:(id)value specifier:(PSSpecifier *)spec { + NSString *key([spec propertyForKey:@"key"]); if ([[spec propertyForKey:@"negate"] boolValue]) value = [NSNumber numberWithBool:(![value boolValue])]; - [_settings setValue:value forKey:[spec propertyForKey:@"key"]]; + [_settings setValue:value forKey:key]; [self settingsChanged]; } diff --git a/WinterBoardSettings.bundle/WinterBoard.plist b/WinterBoardSettings.bundle/WinterBoard.plist index d6b4f96..e8124bb 100644 --- a/WinterBoardSettings.bundle/WinterBoard.plist +++ b/WinterBoardSettings.bundle/WinterBoard.plist @@ -1,37 +1,22 @@ { - items = ( - { - cell = PSSwitchCell; - key = ArbitrarySetting; - label = "Arbitrary Switch 1"; - }, - { - cell = PSSwitchCell; - key = ArbitrarySettingTwo; - label = "Arbitrary Switch 2"; - negate = 1; - }, - { - cell = PSSwitchCell; - default = 1; - key = ArbitrarySettingThree; - label = "Arbitrary Switch 3"; - }, - { - cell = PSSwitchCell; - default = 0; - key = ArbitrarySettingFour; - label = "Arbitrary Switch 4"; - }, - { - cell = PSGroupCell; - }, - { - cell = PSLinkCell; - detail = WBSThemesController; - icon = Themes.png; - label = Themes; - } - ); + items = ({ + cell = PSSwitchCell; + key = IconHidden; + label = "Hide Application"; + }, { + cell = PSGroupCell; + isStaticText = true; + }, { + cell = PSTitleValueCell; + label = "WinterBoard can also be found under the normal iPhone OS Settings application."; + }, { + cell = PSGroupCell; + }, { + cell = PSLinkCell; + detail = WBSThemesController; + icon = Themes.png; + label = Themes; + }); + title = WinterBoard; } diff --git a/control b/control index 9a72f53..b10c1fd 100644 --- a/control +++ b/control @@ -3,10 +3,10 @@ Priority: optional Section: System Maintainer: Jay Freeman (saurik) Architecture: iphoneos-arm -Version: 0.9.3017-1 +Version: 0.9.3147-1 Description: more powerful, open-source SummerBoard Name: WinterBoard -Depends: mobilesubstrate (>= 0.9.2958-1), killall, preferenceloader +Depends: mobilesubstrate (>= 0.9.2958-1), killall, preferenceloader, libhide Provides: theme-manager Conflicts: com.modmyifone.winterboardicon, winterboardsettings, themesettings Replaces: com.modmyifone.winterboardicon, winterboardsettings, themesettings