Browse Source

update usage instructions and make it possible to use a right tap to open accessory views as well now

Kevin Bradley 3 years ago
parent
commit
ad85ffba76

+ 5 - 2
Classes/ExplorerInterface/FLEXExplorerViewController.m

@@ -102,6 +102,7 @@ typedef NS_ENUM(NSUInteger, FLEXExplorerMode) {
 
 -(void)pressesEnded:(NSSet<UIPress *> *)presses withEvent:(UIPressesEvent *)event {
     
+    FXLog(@"presses.anyObject.type: %lu", presses.anyObject.type);
     if (self.currentMode != FLEXExplorerModeSelect && self.currentMode != FLEXExplorerModeMove){
         [super pressesEnded:presses withEvent:event];
         return;
@@ -237,13 +238,16 @@ typedef NS_ENUM(NSUInteger, FLEXExplorerMode) {
     doubleTap.numberOfTapsRequired = 2;
     [self.view addGestureRecognizer:doubleTap];
     
+    UITapGestureRecognizer *rightTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(doubleTap:)];
+    rightTap.allowedPressTypes = @[[NSNumber numberWithInteger:UIPressTypePlayPause],[NSNumber numberWithInteger:UIPressTypeRightArrow]];
+    [self.view addGestureRecognizer:rightTap];
+    
 #endif
 }
 
 - (void)doubleTap:(UITapGestureRecognizer *)gesture {
     if (gesture.state == UIGestureRecognizerStateEnded) {
         if (self.currentMode == FLEXExplorerModeSelect || self.currentMode == FLEXExplorerModeMove){
-            FXLog(@"doubleTap: toggle views tool!");
             [self showTVOSOptionsAlert];
             
         }
@@ -253,7 +257,6 @@ typedef NS_ENUM(NSUInteger, FLEXExplorerMode) {
 
 - (void)showObjectControllerForSelectedView {
     FLEXObjectExplorerViewController *viewExplorer = [FLEXObjectExplorerFactory explorerViewControllerForObject:self.selectedView];
-    FXLog(@"showObjectControllerForSelectedView: %@", viewExplorer);
     if (!viewExplorer) return;
     if ([self presentedViewController]){
         FLEXHierarchyViewController *vc = (FLEXHierarchyViewController*)[self presentedViewController];

+ 3 - 0
Classes/GlobalStateExplorers/FileBrowser/FLEXFileBrowserController.m

@@ -240,6 +240,9 @@ typedef NS_ENUM(NSUInteger, FLEXFileBrowserSortAttribute) {
     UILongPressGestureRecognizer *longPress = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(longPress:)];
     longPress.allowedPressTypes = @[[NSNumber numberWithInteger:UIPressTypePlayPause],[NSNumber numberWithInteger:UIPressTypeSelect]];
     [self.tableView addGestureRecognizer:longPress];
+    UITapGestureRecognizer *rightTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(longPress:)];
+    rightTap.allowedPressTypes = @[[NSNumber numberWithInteger:UIPressTypePlayPause],[NSNumber numberWithInteger:UIPressTypeRightArrow]];
+    [self.tableView addGestureRecognizer:rightTap];
 }
 
 - (void)longPress:(UILongPressGestureRecognizer*)gesture {

File diff suppressed because it is too large
+ 1 - 1
Classes/Manager/FLEXManager.m


+ 37 - 0
Classes/Network/FLEXNetworkMITMViewController.m

@@ -66,6 +66,8 @@
     ];
 #if !TARGET_OS_TV
     self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
+#else
+    [self addlongPressGestureRecognizer];
 #endif
     self.tableView.rowHeight = FLEXNetworkTransactionCell.preferredCellHeight;
     [self registerForNotifications];
@@ -393,6 +395,41 @@
     }
 }
 
+- (void)addlongPressGestureRecognizer {
+    UILongPressGestureRecognizer *longPress = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(longPress:)];
+    longPress.allowedPressTypes = @[[NSNumber numberWithInteger:UIPressTypePlayPause],[NSNumber numberWithInteger:UIPressTypeSelect]];
+    [self.tableView addGestureRecognizer:longPress];
+    UITapGestureRecognizer *rightTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(longPress:)];
+    rightTap.allowedPressTypes = @[[NSNumber numberWithInteger:UIPressTypePlayPause],[NSNumber numberWithInteger:UIPressTypeRightArrow]];
+    [self.tableView addGestureRecognizer:rightTap];
+}
+
+- (void)longPress:(UILongPressGestureRecognizer*)gesture {
+    if ( gesture.state == UIGestureRecognizerStateEnded) {
+        
+        UITableViewCell *cell = [gesture.view valueForKey:@"_focusedCell"];
+        [self showActionForCell:cell];
+    }
+}
+
+
+- (void)showActionForCell:(UITableViewCell *)cell {
+    NSIndexPath *indexPath = [self.tableView indexPathForCell:cell];
+    NSURLRequest *request = [self transactionAtIndexPath:indexPath].request;
+    [FLEXAlert makeAlert:^(FLEXAlert *make) {
+        make.title(@"");
+        make.button([NSString stringWithFormat:@"Blacklist '%@'", request.URL.host]).destructiveStyle().handler(^(NSArray<NSString *> *strings) {
+            NSMutableArray *blacklist =  FLEXNetworkRecorder.defaultRecorder.hostBlacklist;
+            [blacklist addObject:request.URL.host];
+            [FLEXNetworkRecorder.defaultRecorder clearBlacklistedTransactions];
+            [FLEXNetworkRecorder.defaultRecorder synchronizeBlacklist];
+            [self tryUpdateTransactions];
+        });
+        make.button(@"Cancel").cancelStyle();
+    } showFrom:self];
+}
+
+
 #if FLEX_AT_LEAST_IOS13_SDK
 #if !TARGET_OS_TV
 - (UIContextMenuConfiguration *)tableView:(UITableView *)tableView contextMenuConfigurationForRowAtIndexPath:(NSIndexPath *)indexPath point:(CGPoint)point __IOS_AVAILABLE(13.0) {

+ 3 - 0
Classes/ObjectExplorers/FLEXObjectExplorerViewController.m

@@ -143,6 +143,9 @@
     UILongPressGestureRecognizer *longPress = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(longPress:)];
     longPress.allowedPressTypes = @[[NSNumber numberWithInteger:UIPressTypePlayPause],[NSNumber numberWithInteger:UIPressTypeSelect]];
     [self.tableView addGestureRecognizer:longPress];
+    UITapGestureRecognizer *rightTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(longPress:)];
+    rightTap.allowedPressTypes = @[[NSNumber numberWithInteger:UIPressTypePlayPause],[NSNumber numberWithInteger:UIPressTypeRightArrow]];
+    [self.tableView addGestureRecognizer:rightTap];
 }
 
 - (void)longPress:(UILongPressGestureRecognizer*)gesture {

+ 3 - 0
Classes/ViewHierarchy/TreeExplorer/FLEXHierarchyTableViewController.m

@@ -77,6 +77,9 @@ typedef NS_ENUM(NSUInteger, FLEXHierarchyScope) {
     UILongPressGestureRecognizer *longPress = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(longPress:)];
     longPress.allowedPressTypes = @[[NSNumber numberWithInteger:UIPressTypePlayPause],[NSNumber numberWithInteger:UIPressTypeSelect]];
     [self.tableView addGestureRecognizer:longPress];
+    UITapGestureRecognizer *rightTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(longPress:)];
+    rightTap.allowedPressTypes = @[[NSNumber numberWithInteger:UIPressTypePlayPause],[NSNumber numberWithInteger:UIPressTypeRightArrow]];
+    [self.tableView addGestureRecognizer:rightTap];
     
 }