FLEXManager.h 4.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. //
  2. // FLEXManager.h
  3. // Flipboard
  4. //
  5. // Created by Ryan Olson on 4/4/14.
  6. // Copyright (c) 2014 Flipboard. All rights reserved.
  7. //
  8. #import <Foundation/Foundation.h>
  9. #import <UIKit/UIKit.h>
  10. @interface FLEXManager : NSObject
  11. + (instancetype)sharedManager;
  12. @property (nonatomic, readonly) BOOL isHidden;
  13. - (void)showExplorer;
  14. - (void)hideExplorer;
  15. #pragma mark - Network Debugging
  16. /// If this property is set to YES, FLEX will swizzle NSURLConnection*Delegate and NSURLSession*Delegate methods
  17. /// on classes that conform to the protocols. This allows you to view network activity history from the main FLEX menu.
  18. /// Full responses are kept temporarily in a size limited cache and may be pruged under memory pressure.
  19. @property (nonatomic, assign, getter=isNetworkDebuggingEnabled) BOOL networkDebuggingEnabled;
  20. /// Defaults to 25 MB if never set. Values set here are presisted across launches of the app.
  21. /// The response cache uses an NSCache, so it may purge prior to hitting the limit when the app is under memory pressure.
  22. @property (nonatomic, assign) NSUInteger networkResponseCacheByteLimit;
  23. #pragma mark - Keyboard Shortcuts
  24. /// Simulator keyboard shortcuts are enabled by default.
  25. /// The shortcuts will not fire when there is an active text field, text view, or other responder accepting key input.
  26. /// You can disable keyboard shortcuts if you have existing keyboard shortcuts that conflict with FLEX, or if you like doing things the hard way ;)
  27. /// Keyboard shortcuts are always disabled (and support is compiled out) in non-simulator builds
  28. @property (nonatomic, assign) BOOL simulatorShortcutsEnabled;
  29. /// Adds an action to run when the specified key & modifier combination is pressed
  30. /// @param key A single character string matching a key on the keyboard
  31. /// @param modifiers Modifier keys such as shift, command, or alt/option
  32. /// @param action The block to run on the main thread when the key & modifier combination is recognized.
  33. /// @param description Shown the the keyboard shortcut help menu, which is accessed via the '?' key.
  34. /// @note The action block will be retained for the duration of the application. You may want to use weak references.
  35. /// @note FLEX registers several default keyboard shortcuts. Use the '?' key to see a list of shortcuts.
  36. - (void)registerSimulatorShortcutWithKey:(NSString *)key modifiers:(UIKeyModifierFlags)modifiers action:(dispatch_block_t)action description:(NSString *)description;
  37. #pragma mark - Extensions
  38. /// Adds an entry at the bottom of the list of Global State items. Call this method before this view controller is displayed.
  39. /// @param entryName The string to be displayed in the cell.
  40. /// @param objectFutureBlock When you tap on the row, information about the object returned by this block will be displayed.
  41. /// Passing a block that returns an object allows you to display information about an object whose actual pointer may change at runtime (e.g. +currentUser)
  42. /// @note This method must be called from the main thread.
  43. /// The objectFutureBlock will be invoked from the main thread and may return nil.
  44. /// @note The passed block will be copied and retain for the duration of the application, you may want to use __weak references.
  45. - (void)registerGlobalEntryWithName:(NSString *)entryName objectFutureBlock:(id (^)(void))objectFutureBlock;
  46. /// Adds an entry at the bottom of the list of Global State items. Call this method before this view controller is displayed.
  47. /// @param entryName The string to be displayed in the cell.
  48. /// @param viewControllerFutureBlock When you tap on the row, view controller returned by this block will be pushed on the navigation controller stack.
  49. /// @note This method must be called from the main thread.
  50. /// The viewControllerFutureBlock will be invoked from the main thread and may not return nil.
  51. /// @note The passed block will be copied and retain for the duration of the application, you may want to use __weak references.
  52. - (void)registerGlobalEntryWithName:(NSString *)entryName
  53. viewControllerFutureBlock:(UIViewController * (^)(void))viewControllerFutureBlock;
  54. @end