Advertisement
Guest User

Untitled

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