From 5d644e8bece23c7a104f5232ae274ecc512f2c60 Mon Sep 17 00:00:00 2001 From: "Jay Freeman (saurik)" Date: Wed, 26 Nov 2014 13:25:01 -0800 Subject: [PATCH] Provide higher-level button to Restart SpringBoard. --- Settings.mm | 74 +++++++++++++---------- WinterBoardSettings.bundle/Advanced.plist | 44 ++++++++++++++ 2 files changed, 85 insertions(+), 33 deletions(-) diff --git a/Settings.mm b/Settings.mm index 052b7c3..1f011fa 100644 --- a/Settings.mm +++ b/Settings.mm @@ -67,6 +67,42 @@ void AddThemes(NSMutableArray *themesOnDisk, NSString *folder) { } } +static void RestartSpringBoard() { + 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"); + + unlink("/User/Library/Caches/com.apple.SpringBoard.folderSwitcherLinen"); + unlink("/User/Library/Caches/com.apple.SpringBoard.notificationCenterLinen"); + + unlink("/User/Library/Caches/com.apple.SpringBoard.folderSwitcherLinen.0"); + unlink("/User/Library/Caches/com.apple.SpringBoard.folderSwitcherLinen.1"); + unlink("/User/Library/Caches/com.apple.SpringBoard.folderSwitcherLinen.2"); + unlink("/User/Library/Caches/com.apple.SpringBoard.folderSwitcherLinen.3"); + + system("rm -rf /User/Library/Caches/SpringBoardIconCache"); + system("rm -rf /User/Library/Caches/SpringBoardIconCache-small"); + system("rm -rf /User/Library/Caches/com.apple.IconsCache"); + system("rm -rf /User/Library/Caches/com.apple.newsstand"); + system("rm -rf /User/Library/Caches/com.apple.springboard.sharedimagecache"); + system("rm -rf /User/Library/Caches/com.apple.UIStatusBar"); + + system("rm -rf /User/Library/Caches/BarDialer"); + system("rm -rf /User/Library/Caches/BarDialer_selected"); + system("rm -rf /User/Library/Caches/BarRecents"); + system("rm -rf /User/Library/Caches/BarRecents_selected"); + system("rm -rf /User/Library/Caches/BarVM"); + system("rm -rf /User/Library/Caches/BarVM_selected"); + + system("killall -9 lsd"); + + if (kCFCoreFoundationVersionNumber > 700) // XXX: iOS 6.x + system("killall backboardd"); + else + system("killall SpringBoard"); +} + /* [NSObject yieldToSelector:(withObject:)] {{{*/ @interface NSObject (wb$yieldToSelector) - (id) wb$yieldToSelector:(SEL)selector withObject:(id)object; @@ -411,6 +447,10 @@ void AddThemes(NSMutableArray *themesOnDisk, NSString *folder) { return plistValue; } +- (void) restartSpringBoard { + RestartSpringBoard(); +} + - (void) __optimizeThemes { system("/usr/libexec/winterboard/Optimize"); } @@ -523,39 +563,7 @@ void AddThemes(NSMutableArray *themesOnDisk, NSString *folder) { if (![data writeToFile:_plist options:NSAtomicWrite error:NULL]) return; - 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"); - - unlink("/User/Library/Caches/com.apple.SpringBoard.folderSwitcherLinen"); - unlink("/User/Library/Caches/com.apple.SpringBoard.notificationCenterLinen"); - - unlink("/User/Library/Caches/com.apple.SpringBoard.folderSwitcherLinen.0"); - unlink("/User/Library/Caches/com.apple.SpringBoard.folderSwitcherLinen.1"); - unlink("/User/Library/Caches/com.apple.SpringBoard.folderSwitcherLinen.2"); - unlink("/User/Library/Caches/com.apple.SpringBoard.folderSwitcherLinen.3"); - - system("rm -rf /User/Library/Caches/SpringBoardIconCache"); - system("rm -rf /User/Library/Caches/SpringBoardIconCache-small"); - system("rm -rf /User/Library/Caches/com.apple.IconsCache"); - system("rm -rf /User/Library/Caches/com.apple.newsstand"); - system("rm -rf /User/Library/Caches/com.apple.springboard.sharedimagecache"); - system("rm -rf /User/Library/Caches/com.apple.UIStatusBar"); - - system("rm -rf /User/Library/Caches/BarDialer"); - system("rm -rf /User/Library/Caches/BarDialer_selected"); - system("rm -rf /User/Library/Caches/BarRecents"); - system("rm -rf /User/Library/Caches/BarRecents_selected"); - system("rm -rf /User/Library/Caches/BarVM"); - system("rm -rf /User/Library/Caches/BarVM_selected"); - - system("killall -9 lsd"); - - if (kCFCoreFoundationVersionNumber > 700) // XXX: iOS 6.x - system("killall backboardd"); - else - system("killall SpringBoard"); + RestartSpringBoard(); } - (void) cancelChanges { diff --git a/WinterBoardSettings.bundle/Advanced.plist b/WinterBoardSettings.bundle/Advanced.plist index 4d16efa..f0fbf5c 100644 --- a/WinterBoardSettings.bundle/Advanced.plist +++ b/WinterBoardSettings.bundle/Advanced.plist @@ -140,6 +140,50 @@ + + cell + PSGroupCell + footerText + When WinterBoard restarts SpringBoard it also clears many icon and image caches. + + + action + restartSpringBoard + cell + PSButtonCell + label + Restart SpringBoard + + + cell + PSGroupCell + isStaticText + true + requiredCapabilities + + + wildcat + + voip + + + + + + cell + PSTitleValueCell + label + When WinterBoard restarts SpringBoard it also clears many icon and image caches. + requiredCapabilities + + + wildcat + + voip + + + + title Advanced -- 2.45.2