Advertisement
Guest User

Untitled

a guest
May 3rd, 2019
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. static float BlurValue;
  2. static float IdleValue;
  3. BOOL PlayButtonHide;
  4. BOOL PreviousButtonHide;
  5. BOOL NextButtonHide;
  6. BOOL HeartButtonBarHide;
  7. BOOL HeartButtonViewHide;
  8. BOOL AttributionHide;
  9. BOOL ChangeBlur;
  10. BOOL RightAccessoryIndicator;
  11. BOOL LeftAccessoryIndicator;
  12. BOOL RadialGrad;
  13. BOOL CoverArt;
  14. BOOL IdleTime;
  15. BOOL CloseButtonHide;
  16. BOOL GeniusHide;
  17.  
  18. //Respring function, needed to perform a proper respring.
  19. @interface FBSystemService : NSObject
  20. +(id)sharedInstance;
  21. -(void)exitAndRelaunch:(bool)arg1;
  22. @end
  23.  
  24. static void RespringDevice() {
  25.     [[%c(FBSystemService) sharedInstance] exitAndRelaunch:YES];
  26. }
  27. //End respring
  28.  
  29. %hook SPTNowPlayingPreviousTrackButton
  30.   -(long long) icon {
  31.     if(PreviousButtonHide) {
  32.       return nil;
  33.     } else {
  34.       return %orig;
  35.     }
  36.   }
  37. %end
  38.  
  39. %hook SPTNowPlayingNextTrackButton
  40.   -(long long) icon {
  41.     if(NextButtonHide) {
  42.         return nil;
  43.       } else {
  44.         return %orig;
  45.       }
  46.     }
  47. %end
  48.  
  49. %hook SPTNowPlayingPlayButtonV2
  50.   -(void) applyIcon {
  51.     if(PlayButtonHide) {
  52.       return;
  53.     } else {
  54.       %orig;
  55.     }
  56.   }
  57. %end
  58.  
  59. %hook SPTNowPlayingBarHeartViewController
  60.   -(void) viewDidLoad {
  61.     if(HeartButtonBarHide) {
  62.       return;
  63.     }  
  64.     %orig;
  65.   }
  66. %end
  67.  
  68. %hook SPTNowPlayingFreeTierFeedbackButton
  69.   -(void) applyIcon {
  70.     if(HeartButtonViewHide) {
  71.       return;
  72.     }  
  73.     %orig;
  74.   }
  75. %end
  76.  
  77. %hook SPTCanvasViewController
  78.   -(void) setShouldShowAttribution:(bool)arg1 {
  79.     if(AttributionHide) {
  80.       nil;
  81.     } else {
  82.     %orig;
  83.     }
  84.   }
  85. %end
  86.  
  87. %hook SPTImageBlurView
  88.   -(void) setBlurIntensity:(double)arg1 {
  89.     if(ChangeBlur) {
  90.       arg1 = BlurValue;
  91.     }
  92.     %orig(arg1);
  93.   }
  94. %end
  95.  
  96. %hook SPTNowPlayingHeadUnitViewV2
  97.   -(void) setRightAccessoryIndicator:(id)arg1 {
  98.     if(RightAccessoryIndicator) {
  99.       return;
  100.     }  
  101.     %orig;
  102.   }
  103. %end
  104.  
  105. %hook SPTNowPlayingHeadUnitViewV2
  106.   -(void) setLeftAccessoryIndicator:(id)arg1 {
  107.     if(RightAccessoryIndicator) {
  108.       return;
  109.     }
  110.     %orig;
  111.   }
  112. %end
  113.  
  114. %hook SPTNowPlayingShowsFormatBackgroundRadialGradientLayer
  115.   -(void) drawInContext:(CGContext*)arg1 {
  116.     if(RadialGrad) {
  117.       return;
  118.     }
  119.     %orig;
  120.   }
  121. %end
  122.  
  123. %hook SPTNowPlayingContentCell
  124.   -(void) setView:(id)arg1 visible:(BOOL)arg2 animated:(BOOL)arg3 {
  125.     if(CoverArt) {
  126.       nil;
  127.     } else {
  128.       %orig;
  129.     }
  130.   }
  131. %end
  132.  
  133. %hook SPTNowPlayingContainerIdleMonitor
  134.   -(id) initWithIdleWaitInterval:(double)arg1 view:(id)arg2 {
  135.     if(IdleTime) {
  136.       arg1 = IdleValue;
  137.     }
  138.     return %orig;
  139.   }
  140. %end
  141.  
  142. %hook SPTNowPlayingNavigationBarViewV2
  143.   -(void) setLeftButton:(id)arg1 {
  144.     if(CloseButtonHide) {
  145.       return;
  146.     }
  147.     %orig;
  148.   }
  149. %end
  150.  
  151. %hook SPTGeniusScrollProvider
  152.   -(BOOL) isEnabledForTrack:(id)bool {
  153.     if(GeniusHide) {
  154.       return FALSE;
  155.     } else {
  156.       return %orig;
  157.     }
  158.   }
  159. %end
  160.  
  161.  
  162. static void loadPrefs() {
  163.   NSString *preferencesPath = @"/User/Library/Preferences/com.nicksb.lstextify.plist";
  164.   NSMutableDictionary *preferences = [[NSMutableDictionary alloc] initWithContentsOfFile:preferencesPath];
  165.   if(!preferences) {
  166.     preferences = [[NSMutableDictionary alloc] init];
  167.     PlayButtonHide = YES;
  168.     PreviousButtonHide = YES;
  169.     NextButtonHide = YES;
  170.     HeartButtonBarHide = YES;
  171.     HeartButtonViewHide = YES;
  172.     AttributionHide = YES;
  173.     ChangeBlur = YES;
  174.     RightAccessoryIndicator = YES;
  175.     LeftAccessoryIndicator = YES;
  176.     RadialGrad = YES;
  177.     CoverArt = YES;
  178.     IdleTime = YES;
  179.     CloseButtonHide = YES;
  180.     GeniusHide = YES;
  181.     BlurValue = 0.50;
  182.     IdleValue = 30;
  183.   } else {
  184.     PlayButtonHide = [[preferences objectForKey:@"isEnabled"] boolValue];
  185.     PreviousButtonHide = [[preferences objectForKey:@"isEnabled2"] boolValue];
  186.     NextButtonHide = [[preferences objectForKey:@"isEnabled3"] boolValue];
  187.     HeartButtonBarHide = [[preferences objectForKey:@"isEnabled4"] boolValue];
  188.     HeartButtonViewHide = [[preferences objectForKey:@"isEnabled5"] boolValue];
  189.     AttributionHide = [[preferences objectForKey:@"isEnabled6"] boolValue];
  190.     ChangeBlur = [[preferences objectForKey:@"isEnabled7"] boolValue];
  191.     RightAccessoryIndicator = [[preferences objectForKey:@"isEnabled8"] boolValue];
  192.     LeftAccessoryIndicator = [[preferences objectForKey:@"isEnabled9"] boolValue];
  193.     RadialGrad = [[preferences objectForKey:@"isEnabled10"] boolValue];
  194.     CoverArt = [[preferences objectForKey:@"isEnabled11"] boolValue];
  195.     IdleTime = [[preferences objectForKey:@"isEnabled12"] boolValue];
  196. CloseButtonHide = [[preferences objectForKey:@"isEnabled13"] boolValue];
  197. GeniusHide = [[preferences objectForKey:@"isEnabled13"] boolValue];
  198. BlurValue = [[preferences objectForKey:@"BlurValue"] doubleValue];
  199. IdleValue = [[preferences objectForKey:@"IdleValue"] doubleValue];
  200.    
  201.  
  202.   }
  203.   [preferences release];
  204. }
  205.  
  206. //Change this to your postNotification from your settings.
  207. static NSString *nsNotificationString = @"com.nicksb.lstextify/preferences.changed";
  208. static void notificationCallback(CFNotificationCenterRef center, void *observer, CFStringRef name, const void *object, CFDictionaryRef userInfo) {
  209.   loadPrefs();
  210. }
  211.  
  212. %ctor {
  213.   NSAutoreleasePool *pool = [NSAutoreleasePool new];
  214.   loadPrefs();
  215.   notificationCallback(NULL, NULL, NULL, NULL, NULL);
  216.   CFNotificationCenterAddObserver(CFNotificationCenterGetDarwinNotifyCenter(), NULL, notificationCallback, (CFStringRef)nsNotificationString, NULL, CFNotificationSuspensionBehaviorCoalesce);
  217.   [pool release];
  218.  
  219. //Respring
  220.   CFNotificationCenterAddObserver(CFNotificationCenterGetDarwinNotifyCenter(), NULL, (CFNotificationCallback)RespringDevice, CFSTR("com.nicksb.lstextify/respring"), NULL, CFNotificationSuspensionBehaviorDeliverImmediately);
  221. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement