Browse Source

consolidation, fixed injection in PineBoard and HeadBoard

Kevin Bradley 5 years ago
parent
commit
1b3397b11f

+ 19 - 19
Classes/tvOS/KBDatePickerView.h

@@ -2,6 +2,24 @@
 #import "Macros.h"
 #define NUMBER_OF_CELLS 100000
 
+ // Enums are all defined like this to make it easier to convert them to / from string versions of themselves.
+#define TABLE_TAG(XX) \
+XX(KBTableViewTagMonths, = 501) \
+XX(KBTableViewTagDays, )\
+XX(KBTableViewTagYears, )\
+XX(KBTableViewTagHours, )\
+XX(KBTableViewTagMinutes, )\
+XX(KBTableViewTagAMPM, )\
+XX(KBTaleViewWeekday, )
+DECLARE_ENUM(KBTableViewTag, TABLE_TAG)
+
+#define PICKER_MODE(XX) \
+XX(KBDatePickerModeTime, ) \
+XX(KBDatePickerModeDate, ) \
+XX(KBDatePickerModeDateAndTime, ) \
+XX(KBDatePickerModeCountDownTimer, )
+DECLARE_ENUM(KBDatePickerMode, PICKER_MODE)
+
 @interface NSString (format)
 + (id _Nonnull )kb_stringWithFormat:(const char*) fmt,...;
 @end
@@ -18,29 +36,11 @@
 @interface KBTableView: UITableView
 @property NSIndexPath * _Nullable selectedIndexPath;
 @property id _Nullable selectedValue;
+- (instancetype _Nonnull )initWithTag:(KBTableViewTag)tag delegate:(id _Nonnull )delegate;
 - (id _Nullable )valueForIndexPath:(NSIndexPath *_Nonnull)indexPath;
 - (NSArray *_Nonnull)visibleValues;
 @end
 
- // Enums are all defined like this to make it easier to convert them to / from string versions of themselves.
- 
-#define TABLE_TAG(XX) \
-XX(KBTableViewTagMonths, = 501) \
-XX(KBTableViewTagDays, )\
-XX(KBTableViewTagYears, )\
-XX(KBTableViewTagHours, )\
-XX(KBTableViewTagMinutes, )\
-XX(KBTableViewTagAMPM, )\
-XX(KBTaleViewWeekday, )
-DECLARE_ENUM(KBTableViewTag, TABLE_TAG)
-
-#define PICKER_MODE(XX) \
-XX(KBDatePickerModeTime, ) \
-XX(KBDatePickerModeDate, ) \
-XX(KBDatePickerModeDateAndTime, ) \
-XX(KBDatePickerModeCountDownTimer, )
-DECLARE_ENUM(KBDatePickerMode, PICKER_MODE)
-
 @interface KBDatePickerView: UIControl <UITableViewDelegate, UITableViewDataSource>
 @property (nonnull, nonatomic, strong) NSDate *date;
 @property (nullable, nonatomic, strong) NSDate *minimumDate;

+ 16 - 24
Classes/tvOS/KBDatePickerView.m

@@ -58,6 +58,16 @@ DEFINE_ENUM(KBDatePickerMode, PICKER_MODE)
 @end
 @implementation KBTableView
 
+- (instancetype)initWithTag:(KBTableViewTag)tag delegate:(id)delegate {
+    self = [super initWithFrame:CGRectZero style:UITableViewStylePlain];
+    if (self){
+        self.tag = tag;
+        self.dataSource = delegate;
+        self.delegate = delegate;
+    }
+    return self;
+}
+
 - (NSArray *)visibleValues {
     __block NSMutableArray *visibleValues = [NSMutableArray new];
     [self.visibleCells enumerateObjectsUsingBlock:^(__kindof UITableViewCell * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
@@ -245,19 +255,10 @@ DEFINE_ENUM(KBDatePickerMode, PICKER_MODE)
     }
     
     [self setupTimeData];
-    self.hourTable = [[KBTableView alloc] initWithFrame:CGRectZero style:UITableViewStylePlain];
-    self.hourTable.tag = KBTableViewTagHours;
-    self.minuteTable = [[KBTableView alloc] initWithFrame:CGRectZero style:UITableViewStylePlain];
-    self.minuteTable.tag = KBTableViewTagMinutes;
-    self.amPMTable = [[KBTableView alloc] initWithFrame:CGRectZero style:UITableViewStylePlain];
+    self.hourTable = [[KBTableView alloc] initWithTag:KBTableViewTagHours delegate:self];
+    self.minuteTable = [[KBTableView alloc] initWithTag:KBTableViewTagMinutes delegate:self];
+    self.amPMTable = [[KBTableView alloc] initWithTag:KBTableViewTagAMPM delegate:self];
     self.amPMTable.contentInset = UIEdgeInsetsMake(0, 0, 40, 0);
-    self.amPMTable.tag = KBTableViewTagAMPM;
-    self.hourTable.delegate = self;
-    self.hourTable.dataSource = self;
-    self.minuteTable.delegate = self;
-    self.minuteTable.dataSource = self;
-    self.amPMTable.delegate = self;
-    self.amPMTable.dataSource = self;
     _tableViews = @[_hourTable, _minuteTable, _amPMTable];
 }
 
@@ -288,18 +289,9 @@ DEFINE_ENUM(KBDatePickerMode, PICKER_MODE)
     self.dayLabel.translatesAutoresizingMaskIntoConstraints = false;
     self.dayLabel.text = @"Day";
     
-    self.monthTable = [[KBTableView alloc] initWithFrame:CGRectZero style:UITableViewStylePlain];
-    self.monthTable.tag = KBTableViewTagMonths;
-    self.yearTable = [[KBTableView alloc] initWithFrame:CGRectZero style:UITableViewStylePlain];
-    self.yearTable.tag = KBTableViewTagYears;
-    self.dayTable = [[KBTableView alloc] initWithFrame:CGRectZero style:UITableViewStylePlain];
-    self.dayTable.tag = KBTableViewTagDays;
-    self.monthTable.delegate = self;
-    self.monthTable.dataSource = self;
-    self.yearTable.delegate = self;
-    self.yearTable.dataSource = self;
-    self.dayTable.delegate = self;
-    self.dayTable.dataSource = self;
+    self.monthTable = [[KBTableView alloc] initWithTag:KBTableViewTagMonths delegate:self];
+    self.yearTable = [[KBTableView alloc] initWithTag:KBTableViewTagYears delegate:self];
+    self.dayTable = [[KBTableView alloc] initWithTag:KBTableViewTagDays delegate:self];
     _tableViews = @[_monthTable, _dayTable, _yearTable];
     [self addSubview:self.monthLabel];
     [self addSubview:self.yearLabel];

+ 5 - 2
flexinjected/Tweak.x

@@ -77,6 +77,7 @@ __attribute__ ((constructor)) static void FLEXInjected_main() {
     NSBundle *bundle = [NSBundle mainBundle];
     NSString *bundleID = [bundle bundleIdentifier];
     NSDictionary *ourDict = [[NSDictionary alloc] initWithContentsOfFile:@"/var/mobile/Library/Preferences/com.nito.flexinjected.plist"];
+    NSArray *iconBlacklist = @[@"com.apple.PineBoard", @"com.apple.HeadBoard"];
     NSNumber *value = [ourDict objectForKey:bundleID];
     if ([value boolValue] == YES) {
         BOOL sendAlert = true;
@@ -87,7 +88,7 @@ __attribute__ ((constructor)) static void FLEXInjected_main() {
             if ([prox isContainerized]){
                 icon = nil;
             } else {
-                if ([prox respondsToSelector:@selector(tv_applicationFlatIcon)]){
+                if ([prox respondsToSelector:@selector(tv_applicationFlatIcon)] && ![iconBlacklist containsObject:bundleID]){
                     icon = [prox tv_applicationFlatIcon];
                 }
             }
@@ -98,16 +99,18 @@ __attribute__ ((constructor)) static void FLEXInjected_main() {
             if ([prox isContainerized]){
                 icon = nil;
             } else {
-                if ([prox respondsToSelector:@selector(tv_applicationFlatIcon)]){
+                if ([prox respondsToSelector:@selector(tv_applicationFlatIcon)] && ![iconBlacklist containsObject:bundleID]){
                     icon = [prox tv_applicationFlatIcon];
                 }
             }
         }
+        NSLog(@"[FLEXInjected] found icon: %@", icon);
         if (sendAlert){
             NSString *message = [NSString stringWithFormat:@"Injected into bundle: %@", bundleID];
             sendNotification(@"FLEXInjected", message, icon);
             NSLog(@"[FLEXInjected) bundle ID %@", bundleID);
         }
+        NSLog(@"[FLEXInjected] post send alert");
         dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(10 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
             NSLog(@"[FLEXInjected] weouchea...");
             NSString *p = @"/Library/Frameworks/FLEX.framework";

File diff suppressed because it is too large
+ 1 - 1
flexinjected/Tweak.x.jsont


File diff suppressed because it is too large
+ 1 - 1
flexinjected/compile_commands.json


+ 1 - 1
flexinjected/layout/DEBIAN/control

@@ -1,7 +1,7 @@
 Package: com.nito.flexinjected
 Name: FLEXInjected
 Depends: mobilesubstrate, preferenceloader (>=1.5-15), applist (>=1.3-11), libflex (>=4.1.1b-6)
-Version: 1.2
+Version: 1.3
 Architecture: appletvos-arm64
 Description: Inject FLEX into your favorite Applications utilizing applist
 Maintainer: Kevin Bradley

+ 13 - 0
flexinjected/layout/Library/PreferenceLoader/Preferences/FLEXInjected.plist

@@ -20,6 +20,19 @@
 			<string>FLEX</string>
 		</dict>
 		<dict>
+			<key>ALSectionDescriptors</key>
+			<array>
+				<dict>
+					<key>cell-class-name</key>
+					<string>ALSwitchCell</string>
+					<key>icon-size</key>
+					<integer>29</integer>
+					<key>suppress-hidden-apps</key>
+					<false/>
+					<key>title</key>
+					<string>Applications</string>
+				</dict>
+			</array>
 			<key>ALAllowsSelection</key>
 			<string>1</string>
 			<key>ALChangeNotification</key>