Explorar o código

Allow the FLEXWindow to become key when it wants to accept input and affect the status bar.

The previous logic was preventing FLEXWindow from ever becoming key.
Ryan Olson %!s(int64=11) %!d(string=hai) anos
pai
achega
3d977450ca

+ 1 - 0
Classes/ExplorerToolbar/FLEXExplorerViewController.h

@@ -15,6 +15,7 @@
 @property (nonatomic, weak) id <FLEXExplorerViewControllerDelegate> delegate;
 
 - (BOOL)shouldReceiveTouchAtWindowPoint:(CGPoint)pointInWindowCoordinates;
+- (BOOL)wantsWindowToBecomeKey;
 
 @end
 

+ 8 - 2
Classes/ExplorerToolbar/FLEXExplorerViewController.m

@@ -810,9 +810,10 @@ typedef NS_ENUM(NSUInteger, FLEXExplorerMode) {
 
 - (void)resignKeyAndDismissViewControllerAnimated:(BOOL)animated completion:(void (^)(void))completion
 {
-    [self.previousKeyWindow makeKeyWindow];
-    [[self.previousKeyWindow rootViewController] setNeedsStatusBarAppearanceUpdate];
+    UIWindow *previousKeyWindow = self.previousKeyWindow;
     self.previousKeyWindow = nil;
+    [previousKeyWindow makeKeyWindow];
+    [[previousKeyWindow rootViewController] setNeedsStatusBarAppearanceUpdate];
     
     // Restore the status bar window's normal window level.
     // We want it above FLEX while a modal is presented for scroll to top, but below FLEX otherwise for exploration.
@@ -824,4 +825,9 @@ typedef NS_ENUM(NSUInteger, FLEXExplorerMode) {
     [self dismissViewControllerAnimated:animated completion:completion];
 }
 
+- (BOOL)wantsWindowToBecomeKey
+{
+    return self.previousKeyWindow != nil;
+}
+
 @end

+ 2 - 2
Classes/ExplorerToolbar/FLEXManager.m

@@ -113,8 +113,8 @@
 
 - (BOOL)canBecomeKeyWindow
 {
-    // Only when the explorer is showing a modal, because we want to affect the status bar and receive key input there.
-    return self.explorerViewController.presentedViewController != nil;
+    // Only when the explorer view controller wants it because it needs to accept key input & affect the status bar.
+    return [self.explorerViewController wantsWindowToBecomeKey];
 }