Browse Source

added usage hints view to make learning the tvOS version a little easier

Kevin Bradley 3 years ago
parent
commit
212afb019b

+ 12 - 4
Classes/ExplorerInterface/FLEXExplorerViewController.m

@@ -273,7 +273,7 @@ typedef NS_ENUM(NSUInteger, FLEXExplorerMode) {
 
 - (void)showTVOSOptionsAlert {
     UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"What would you like to do?" message:nil preferredStyle:UIAlertControllerStyleAlert];
-   
+    
     UIAlertAction *details = [UIAlertAction actionWithTitle:@"Show Details" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
         [self showObjectControllerForSelectedView];
         [[FLEXManager sharedManager] showExplorer];
@@ -296,10 +296,18 @@ typedef NS_ENUM(NSUInteger, FLEXExplorerMode) {
         [alertController addAction:movement];
     }
     UIAlertAction *showViews = [UIAlertAction actionWithTitle:@"Show Views" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
-           [self toggleViewsTool];
-           [[FLEXManager sharedManager] showExplorer];
+        [self toggleViewsTool];
+        [[FLEXManager sharedManager] showExplorer];
+    }];
+    [alertController addAction:showViews];
+    
+    UIAlertAction *showUsageHints = [UIAlertAction actionWithTitle:@"Show Usage Hints" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
+        [[FLEXManager sharedManager] showHintsAlert];
+        //[[FLEXManager sharedManager] showExplorer];
        }];
-       [alertController addAction:showViews];
+       [alertController addAction:showUsageHints];
+    
+    
     [alertController addAction:[UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) {
         [[FLEXManager sharedManager] showExplorer];
     }]];

+ 4 - 0
Classes/Manager/FLEXManager.h

@@ -25,6 +25,10 @@ NS_ASSUME_NONNULL_BEGIN
 - (void)hideExplorer;
 - (void)toggleExplorer;
 
+///tvOS specific
+
+- (void)showHintsAlert;
+
 /// Use this to present the explorer in a specific scene when the one
 /// it chooses by default is not the one you wish to display it in.
 - (void)showExplorerFromScene:(UIWindowScene *)scene API_AVAILABLE(ios(13.0));

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


+ 1 - 1
Example/Podfile

@@ -1,4 +1,4 @@
-platform :ios, '13.0'
+platform :tvos, '13.0'
 
 target 'FLEXample' do
   pod 'FLEX', :path => '../'

+ 5 - 1
flexinjected/Tweak.x

@@ -7,7 +7,8 @@
 @interface FLEXManager: NSObject
 +(id)sharedManager;
 -(void)showExplorer;
-- (void)_addTVOSGestureRecognizer:(UIViewController *)explorer;
+-(void)showHintsIfNecessary;
+-(void)_addTVOSGestureRecognizer:(UIViewController *)explorer;
 @end
 
 @interface NSDistributedNotificationCenter : NSNotificationCenter
@@ -125,6 +126,9 @@ __attribute__ ((constructor)) static void FLEXInjected_main() {
             NSLog(@"[FLEXInjected] top view controller: %@ violated...", tvc);
             [flexManager _addTVOSGestureRecognizer:tvc];
             [flexManager showExplorer];
+            if ([flexManager respondsToSelector:@selector(showHintsIfNecessary)]){
+                [flexManager showHintsIfNecessary];
+            }
         });
         
     }

+ 1 - 1
postScript.sh

@@ -39,7 +39,7 @@ pushd "$SRCROOT"
 find . -name ".DS_Store" | xargs rm -f
 
 EXE_PATH=$FINAL_FW_PATH/$EXECUTABLE_NAME
-exit 0
+#exit 0
 ldid -S $EXE_PATH
 rm -rf $FINAL_FW_PATH/_CodeSignature
 /usr/local/bin/fakeroot dpkg-deb -b layout