Skip to content

Commit 604b37a

Browse files
committed
fixed a crashing bug where it was allowing long/right clicks on accessories that didnt suport them, improved navigation selection index choices between view navigation. bumped to latest release 4.3.0-6
1 parent 73a6201 commit 604b37a

File tree

6 files changed

+48
-7
lines changed

6 files changed

+48
-7
lines changed

Classes/Core/Controllers/FLEXTableViewController.m

+30
Original file line numberDiff line numberDiff line change
@@ -627,4 +627,34 @@ - (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInte
627627
return nil; // For plain/gropued style
628628
}
629629

630+
#if TARGET_OS_TV
631+
#pragma mark tvOS
632+
633+
/*
634+
This tracks our most recently focused cell so when we leave / return to this view we can refocus to the proper index path.
635+
*/
636+
637+
- (void)tableView:(UITableView *)tableView didUpdateFocusInContext:(UITableViewFocusUpdateContext *)context withAnimationCoordinator:(UIFocusAnimationCoordinator *)coordinator {
638+
[coordinator addCoordinatedAnimations:^{
639+
640+
NSIndexPath *nextIndexPath = context.nextFocusedIndexPath;
641+
KBTableView *table = (KBTableView *)tableView;
642+
if ([table respondsToSelector:@selector(setSelectedIndexPath:)]){
643+
if (nextIndexPath != nil){
644+
[table setSelectedIndexPath:nextIndexPath];
645+
}
646+
}
647+
} completion:nil];
648+
}
649+
650+
- (NSArray *)preferredFocusEnvironments {
651+
if (self.tableView.selectedIndexPath){
652+
return @[[self.tableView cellForRowAtIndexPath:self.tableView.selectedIndexPath]];
653+
}
654+
return @[self];
655+
}
656+
657+
658+
#endif
659+
630660
@end

Classes/Core/Views/FLEXTableView.h

+5
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,11 @@ extern FLEXTableViewCellReuseIdentifier const kFLEXCodeFontCell;
3535
+ (instancetype)plainTableView;
3636
+ (instancetype)style:(UITableViewStyle)style;
3737

38+
#if TARGET_OS_TV
39+
/// tvOS tries to keep your selected index remembered when pushing and popping between views in a navigation controller, it doesn't do a very good job, this is to keep track of it ourselves.
40+
@property (nonatomic, strong) NSIndexPath *selectedIndexPath;
41+
#endif
42+
3843
/// You do not need to register classes for any of the default reuse identifiers above
3944
/// (annotated as \c FLEXTableViewCellReuseIdentifier types) unless you wish to provide
4045
/// a custom cell for any of those reuse identifiers. By default, \c FLEXTableViewCell,

Classes/ObjectExplorers/FLEXObjectExplorerViewController.m

+9-3
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@
2727
#import "NSUserDefaults+FLEX.h"
2828
#import <objc/runtime.h>
2929
#import <TargetConditionals.h>
30+
#if TARGET_OS_TV
31+
#import "fakes.h"
32+
#endif
3033

3134
#pragma mark - Private properties
3235
@interface FLEXObjectExplorerViewController () <UIGestureRecognizerDelegate>{
@@ -150,12 +153,15 @@ - (void)addlongPressGestureRecognizer {
150153

151154
- (void)longPress:(UILongPressGestureRecognizer*)gesture {
152155
if ( gesture.state == UIGestureRecognizerStateEnded) {
153-
NSLog(@"do something different for long press!");
156+
FXLog(@"do something different for long press!");
154157
UITableView *tv = [self tableView];
155158
//naughty naughty
156159
NSIndexPath *focus = [tv valueForKey:@"_focusedCellIndexPath"];
157-
NSLog(@"[FLEX] focusedIndexPath: %@", focus);
158-
[self tableView:self.tableView accessoryButtonTappedForRowWithIndexPath:focus];
160+
UITableViewCell *cell = [tv valueForKey:@"_focusedCell"];
161+
FXLog(@"focusedIndexPath: %@ accessoryType: %lu", focus, cell.accessoryType);
162+
if (cell.accessoryType != TVTableViewCellAccessoryDisclosureIndicator){
163+
[self tableView:self.tableView accessoryButtonTappedForRowWithIndexPath:focus];
164+
}
159165
}
160166
}
161167

flexinjected/Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
target = appletv:12.1
1+
target = appletv:12.1.1
22

33
INSTALL_TARGET_PROCESSES = PineBoard
44

flexinjected/layout/DEBIAN/control

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Package: com.nito.flexinjected
22
Name: FLEXInjected
3-
Depends: mobilesubstrate, preferenceloader (>=1.5-15), applist (>=1.3-11), libflex (>=4.3.0-1)
4-
Version: 1.4
3+
Depends: mobilesubstrate, preferenceloader (>=1.5-15), applist (>=1.3-11), libflex (>=4.3.0-6)
4+
Version: 1.5
55
Architecture: appletvos-arm64
66
Description: Inject FLEX into your favorite Applications utilizing applist
77
Maintainer: Kevin Bradley

layout/DEBIAN/control

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ Package: libflex
22
Section: Development
33
Maintainer: Kevin Bradley
44
Architecture: appletvos-arm64
5-
Version: 4.3.0-5
5+
Version: 4.3.0-6
66
Depends: firmware (>= 9.0), mobilesubstrate
77
Description: A library for Flipboard Explorer on tvOS
88
Name: libFLEX

0 commit comments

Comments
 (0)