Advertisement
Guest User

Untitled

a guest
May 5th, 2019
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2.  
  3. static float redAlpha;
  4. static float greenAlpha;
  5. static float blueAlpha;
  6. BOOL DateTimeLeftJustify;
  7. BOOL StatusBarColour;
  8. BOOL IconsDown;
  9. BOOL IconLabelColour;
  10.  
  11. //Respring function, needed to perform a proper respring.
  12. @interface FBSystemService : NSObject
  13.   +(id)sharedInstance;
  14.   -(void)exitAndRelaunch:(bool)arg1;
  15. @end
  16.  
  17. static void RespringDevice() {
  18.     [[%c(FBSystemService) sharedInstance] exitAndRelaunch:YES];
  19. }
  20. //End respring
  21.  
  22. %hook SBFLockScreenDateView
  23.   -(void)setAlignmentPercent:(double)arg1 {
  24.     if(DateTimeLeftJustify) {
  25.       arg1 = -1;
  26.     }
  27.   %orig(arg1);
  28.   }
  29. %end
  30.  
  31. %hook SBRootFolderView
  32.   -(void)setStatusBarHeight:(double)arg1 {
  33.     if(IconsDown) {
  34.       arg1 = 38;
  35.     }
  36.   %orig(arg1);
  37.   }
  38. %end
  39.  
  40. %hook SBMutableIconLabelImageParameters
  41.   -(void)setTextColor:(id)arg1 {
  42.     if(IconLabelColour) {
  43.       arg1 = [UIColor colorWithRed:(232/255.f) green:(213/255.f) blue:(17/255.f) alpha:1.0];
  44.     }
  45.   %orig(arg1);
  46.   }
  47. %end
  48.  
  49.  
  50. //%hook UIStatusBarForegroundStyleAttributes
  51.  
  52. //  -(UIColor *)tintColor {
  53. //      if(StatusBarColour) {
  54. //          return [UIColor colorWithRed:(232/255.f) green:(213/255.f) blue:(17/255.f) alpha:1.0];
  55. //      }
  56. //  return %orig;
  57. //  }
  58.  
  59. //%end
  60.  
  61. %hook UIStatusBarForegroundStyleAttributes
  62.   -(id) initWithHeight:(double)arg1 legibilityStyle:(long long)arg2 tintColor:(id)arg3 hasBusyBackground:(bool)arg4 idiom:(long long)arg5 {
  63.     if(StatusBarColour) { arg3 = [UIColor colorWithRed:(redAlpha) green:(greenAlpha) blue:(blueAlpha) alpha:1.0];
  64.     }
  65.   return %orig;
  66.   }
  67. %end
  68.  
  69.  
  70.  
  71. static void loadPrefs() {
  72. NSString *preferencesPath = @"/User/Library/Preferences/com.nicksb.lstextify.plist";
  73. NSMutableDictionary *preferences = [[NSMutableDictionary alloc] initWithContentsOfFile:preferencesPath];
  74.   if(!preferences) {
  75.     preferences = [[NSMutableDictionary alloc] init];
  76. DateTimeLeftJustify = YES;
  77. StatusBarColour = YES;
  78. IconsDown = YES;
  79. IconLabelColour = YES;
  80. redAlpha = 0.91;
  81. greenAlpha = 0.84;
  82. blueAlpha = 0.07;
  83.   } else {
  84.     DateTimeLeftJustify = [[preferences objectForKey:@"isEnabled"] boolValue];
  85. StatusBarColour = [[preferences objectForKey:@"isEnabled2"] boolValue];
  86. IconsDown = [[preferences objectForKey:@"isEnabled3"] boolValue];
  87. IconLabelColour = [[preferences objectForKey:@"isEnabled4"] boolValue];
  88. redAlpha = [[preferences objectForKey:@"redAlpha"] doubleValue];
  89. greenAlpha = [[preferences objectForKey:@"greenAlpha"] doubleValue];
  90. blueAlpha = [[preferences objectForKey:@"blueAlpha"] doubleValue];
  91.   }
  92.  
  93.   [preferences release];
  94. }
  95.  
  96.  
  97.  
  98. //Change this to your postNotification from your settings.
  99. static NSString *nsNotificationString = @"com.nicksb.lstextify/preferences.changed";
  100. static void notificationCallback(CFNotificationCenterRef center, void *observer, CFStringRef name, const void *object, CFDictionaryRef userInfo) {
  101.   loadPrefs();
  102. }
  103.  
  104. %ctor {
  105.   NSAutoreleasePool *pool = [NSAutoreleasePool new];
  106.   loadPrefs();
  107.   notificationCallback(NULL, NULL, NULL, NULL, NULL);
  108.   CFNotificationCenterAddObserver(CFNotificationCenterGetDarwinNotifyCenter(), NULL, notificationCallback, (CFStringRef)nsNotificationString, NULL, CFNotificationSuspensionBehaviorCoalesce);
  109.   [pool release];
  110.  
  111. //Respring
  112.   CFNotificationCenterAddObserver(CFNotificationCenterGetDarwinNotifyCenter(), NULL, (CFNotificationCallback)RespringDevice, CFSTR("com.nicksb.lstextify/respring"), NULL, CFNotificationSuspensionBehaviorDeliverImmediately);
  113. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement