Device battery indicators on your Lock Screen
Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.

4 lat temu
4 lat temu
4 lat temu
4 lat temu
4 lat temu
4 lat temu
4 lat temu
4 lat temu
4 lat temu
4 lat temu
4 lat temu
4 lat temu
4 lat temu
4 lat temu
4 lat temu
4 lat temu
4 lat temu
4 lat temu
4 lat temu
4 lat temu
4 lat temu
4 lat temu
4 lat temu
4 lat temu
4 lat temu
4 lat temu
4 lat temu
4 lat temu
4 lat temu
4 lat temu
4 lat temu
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. #include <CoreFoundation/CoreFoundation.h>
  2. #import <Foundation/Foundation.h>
  3. #include <stdio.h>
  4. #import <objc/runtime.h>
  5. #import <UIKit/UIKit.h>
  6. #import "MobileGestalt.h"
  7. #import "NSTask.h"
  8. #define KAISelf ((CSAdjunctListView *)self) //for use when calling self in KAITarget
  9. //#define KAIBatteryStack UHDUEIHGCEBCHYDEICVKEVSAGJKBCXAHJGKVXHAS //lmao
  10. //#define KAIBatteryCell HDEIUOGEUBGUYOEXHNOPUSZIOJIGECEXIUSHXJXBE //very good
  11. @interface CSAdjunctListView : UIView
  12. @property (nonatomic, assign) BOOL hasKai;
  13. -(UIStackView *)stackView;
  14. -(void)setStackView:(UIStackView *)arg1;
  15. @end
  16. @interface CALayer (kai)
  17. @property (nonatomic, assign) BOOL continuousCorners;
  18. @end
  19. @interface SBIconController : UIViewController
  20. @end
  21. @interface SBCoverSheetPrimarySlidingViewController : UIViewController
  22. @end
  23. @interface UIDevice (kai)
  24. -(id)sf_udidString;
  25. -(id)_currentProduct;
  26. @end
  27. @interface NCNotificationListView : UIView
  28. -(void)fixComplicationsViewFrame;
  29. @end
  30. BOOL isUpdating = NO;
  31. //prefs
  32. BOOL enabled;
  33. BOOL disableGlyphs;
  34. BOOL hidePercent;
  35. BOOL showAll;
  36. BOOL belowMusic;
  37. BOOL hideDeviceLabel;
  38. BOOL hideChargingAnimation;
  39. BOOL showAllMinusInternal;
  40. NSInteger bannerStyle;
  41. NSInteger bannerAlign;
  42. NSInteger textColor;
  43. double spacing;
  44. double glyphSize;
  45. double bannerHeight;
  46. double cornerRadius;
  47. double bannerWidthFactor;
  48. double horizontalOffset;
  49. double bannerAlpha;
  50. //by importing here, I can use vars in the .mm files
  51. #import "KAIBatteryCell.mm"
  52. #import "KAIBatteryStack.mm"
  53. #define PLIST_PATH @"/User/Library/Preferences/com.burritoz.kaiprefs.plist"
  54. #define kIdentifier @"com.burritoz.kaiprefs"
  55. #define kSettingsChangedNotification (CFStringRef)@"com.burritoz.kaiprefs/reload"
  56. #define kSettingsPath @"/var/mobile/Library/Preferences/com.burritoz.kaiprefs.plist"
  57. NSDictionary *prefs = nil;
  58. static void *observer = NULL;
  59. static void reloadPrefs()
  60. {
  61. if ([NSHomeDirectory() isEqualToString:@"/var/mobile"])
  62. {
  63. CFArrayRef keyList = CFPreferencesCopyKeyList((CFStringRef)kIdentifier, kCFPreferencesCurrentUser, kCFPreferencesAnyHost);
  64. if (keyList)
  65. {
  66. prefs = (NSDictionary *)CFBridgingRelease(CFPreferencesCopyMultiple(keyList, (CFStringRef)kIdentifier, kCFPreferencesCurrentUser, kCFPreferencesAnyHost));
  67. if (!prefs)
  68. {
  69. prefs = [NSDictionary new];
  70. }
  71. CFRelease(keyList);
  72. }
  73. }
  74. else
  75. {
  76. prefs = [NSDictionary dictionaryWithContentsOfFile:kSettingsPath];
  77. }
  78. }
  79. static BOOL boolValueForKey(NSString *key, BOOL defaultValue) {
  80. return (prefs && [prefs objectForKey:key] ? [[prefs objectForKey:key] boolValue] : defaultValue);
  81. }
  82. static double numberForValue(NSString *key, double defaultValue) {
  83. return (prefs && [prefs objectForKey:key] ? [[prefs objectForKey:key] doubleValue] : defaultValue);
  84. }
  85. static void preferencesChanged()
  86. {
  87. CFPreferencesAppSynchronize((CFStringRef)kIdentifier);
  88. reloadPrefs();
  89. enabled = boolValueForKey(@"enabled", YES);
  90. spacing = numberForValue(@"spacing", 5);
  91. glyphSize = numberForValue(@"glyphSize", 30);
  92. bannerHeight = numberForValue(@"bannerHeight", 80);
  93. cornerRadius = numberForValue(@"cornerRadius", 13);
  94. disableGlyphs = boolValueForKey(@"disableGlyphs", NO);
  95. hidePercent = boolValueForKey(@"hidePercent", NO);
  96. bannerStyle = numberForValue(@"bannerStyle", 1);
  97. showAll = boolValueForKey(@"showAll", NO);
  98. bannerWidthFactor = numberForValue(@"bannerWidthFactor", 0);
  99. hideDeviceLabel = boolValueForKey(@"hideDeviceLabel", NO);
  100. bannerAlign = numberForValue(@"bannerAlign", 2);
  101. horizontalOffset = numberForValue(@"horizontalOffset", 0);
  102. belowMusic = boolValueForKey(@"belowMusic", NO);
  103. hideChargingAnimation = boolValueForKey(@"hideChargingAnimation", YES);
  104. textColor = numberForValue(@"textColor", 0);
  105. bannerAlpha = numberForValue(@"bannerAlpha", 1);
  106. showAllMinusInternal = boolValueForKey(@"showAllMinusInternal", NO);
  107. if(disableGlyphs) {
  108. glyphSize = 0;
  109. }
  110. }
  111. static void applyPrefs()
  112. {
  113. preferencesChanged();
  114. isUpdating = YES;
  115. [[KAIBatteryStack sharedInstance] refreshForPrefs]; //so hard (not)
  116. isUpdating = NO;
  117. }