FLEXManager.h 4.0 KB

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