Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- BOOL PlayButtonHide;
- BOOL PreviousButtonHide;
- BOOL NextButtonHide;
- BOOL HeartButtonBarHide;
- BOOL HeartButtonViewHide;
- BOOL AttributionHide;
- BOOL ChangeBlur;
- BOOL RightAccessoryIndicator;
- BOOL LeftAccessoryIndicator;
- BOOL RadialGrad;
- BOOL CoverArt;
- BOOL IdleTime;
- //Respring function, needed to perform a proper respring.
- @interface FBSystemService : NSObject
- +(id)sharedInstance;
- -(void)exitAndRelaunch:(bool)arg1;
- @end
- static void RespringDevice() {
- [[%c(FBSystemService) sharedInstance] exitAndRelaunch:YES];
- }
- //End respring
- %hook SPTNowPlayingPreviousTrackButton
- -(long long) icon {
- if(PreviousButtonHide) {
- return nil;
- } else {
- return %orig;
- }
- }
- %end
- %hook SPTNowPlayingNextTrackButton
- -(long long) icon {
- if(NextButtonHide) {
- return nil;
- } else {
- return %orig;
- }
- }
- %end
- %hook SPTNowPlayingPlayButtonV2
- -(void) applyIcon {
- if(PlayButtonHide) {
- return;
- } else {
- %orig;
- }
- }
- %end
- %hook SPTNowPlayingBarHeartViewController
- -(void) viewDidLoad {
- if(HeartButtonBarHide) {
- return;
- }
- %orig;
- }
- %end
- %hook SPTNowPlayingFreeTierFeedbackButton
- -(void) applyIcon {
- if(HeartButtonViewHide) {
- return;
- }
- %orig;
- }
- %end
- %hook SPTCanvasViewController
- -(void) setShouldShowAttribution:(bool)arg1 {
- if(AttributionHide) {
- arg1 = FALSE;
- }
- %orig(arg1);
- }
- %end
- %hook SPTImageBlurView
- -(void) setBlurIntensity:(double)arg1 {
- if(ChangeBlur) {
- arg1 = 0.5;
- }
- %orig(arg1);
- }
- %end
- %hook SPTNowPlayingHeadUnitViewV2
- -(void) setRightAccessoryIndicator:(id)arg1 {
- if(RightAccessoryIndicator) {
- return;
- }
- %orig(arg1);
- }
- %end
- %hook SPTNowPlayingHeadUnitViewV2
- -(void) setLeftAccessoryIndicator:(id)arg1 {
- if(RightAccessoryIndicator) {
- return;
- }
- %orig(arg1);
- }
- %end
- %hook SPTNowPlayingShowsFormatBackgroundRadialGradientLayer
- -(void) drawInContext:(CGContext*)arg1 {
- if(RadialGrad) {
- return;
- }
- %orig(arg1);
- }
- %end
- %hook SPTNowPlayingContentCell
- -(void) setView:(id)arg1 visible:(BOOL)arg2 animated:(BOOL)arg3 {
- if (CoverArt) {
- nil;
- } else {
- %orig;
- }
- }
- %end
- %hook SPTNowPlayingContainerIdleMonitor
- -(id) initWithIdleWaitInterval:(double)arg1 view:(id)arg2 {
- if(IdleTime) {
- arg1 = 10;
- }
- return %orig;
- }
- %end
- static void loadPrefs() {
- NSString *preferencesPath = @"/User/Library/Preferences/com.nicksb.lstextify.plist";
- NSMutableDictionary *preferences = [[NSMutableDictionary alloc] initWithContentsOfFile:preferencesPath];
- if(!preferences) {
- preferences = [[NSMutableDictionary alloc] init];
- PlayButtonHide = YES;
- PreviousButtonHide = YES;
- NextButtonHide = YES;
- HeartButtonBarHide = YES;
- HeartButtonViewHide = YES;
- AttributionHide = YES;
- ChangeBlur = YES;
- RightAccessoryIndicator = YES;
- LeftAccessoryIndicator = YES;
- RadialGrad = YES;
- CoverArt = YES;
- IdleTime = YES;
- } else {
- PlayButtonHide = [[preferences objectForKey:@"isEnabled"] boolValue];
- PreviousButtonHide = [[preferences objectForKey:@"isEnabled2"] boolValue];
- NextButtonHide = [[preferences objectForKey:@"isEnabled3"] boolValue];
- HeartButtonBarHide = [[preferences objectForKey:@"isEnabled4"] boolValue];
- HeartButtonViewHide = [[preferences objectForKey:@"isEnabled5"] boolValue];
- AttributionHide = [[preferences objectForKey:@"isEnabled6"] boolValue];
- ChangeBlur = [[preferences objectForKey:@"isEnabled7"] boolValue];
- RightAccessoryIndicator = [[preferences objectForKey:@"isEnabled8"] boolValue];
- LeftAccessoryIndicator = [[preferences objectForKey:@"isEnabled9"] boolValue];
- RadialGrad = [[preferences objectForKey:@"isEnabled10"] boolValue];
- CoverArt = [[preferences objectForKey:@"isEnabled11"] boolValue];
- IdleTime = [[preferences objectForKey:@"isEnabled12"] boolValue];
- }
- [preferences release];
- }
- //Change this to your postNotification from your settings.
- static NSString *nsNotificationString = @"com.nicksb.lstextify/preferences.changed";
- static void notificationCallback(CFNotificationCenterRef center, void *observer, CFStringRef name, const void *object, CFDictionaryRef userInfo) {
- loadPrefs();
- }
- %ctor {
- NSAutoreleasePool *pool = [NSAutoreleasePool new];
- loadPrefs();
- notificationCallback(NULL, NULL, NULL, NULL, NULL);
- CFNotificationCenterAddObserver(CFNotificationCenterGetDarwinNotifyCenter(), NULL, notificationCallback, (CFStringRef)nsNotificationString, NULL, CFNotificationSuspensionBehaviorCoalesce);
- [pool release];
- //Respring
- CFNotificationCenterAddObserver(CFNotificationCenterGetDarwinNotifyCenter(), NULL, (CFNotificationCallback)RespringDevice, CFSTR("com.nicksb.lstextify/respring"), NULL, CFNotificationSuspensionBehaviorDeliverImmediately);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement