You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

91 lines
5.3 KiB

  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. typedef UIViewController *(^FLEXCustomContentViewerFuture)(NSData *data);
  11. @interface FLEXManager : NSObject
  12. + (instancetype)sharedManager;
  13. @property (nonatomic, readonly) BOOL isHidden;
  14. - (void)showExplorer;
  15. - (void)hideExplorer;
  16. - (void)toggleExplorer;
  17. #pragma mark - Network Debugging
  18. /// If this property is set to YES, FLEX will swizzle NSURLConnection*Delegate and NSURLSession*Delegate methods
  19. /// on classes that conform to the protocols. This allows you to view network activity history from the main FLEX menu.
  20. /// Full responses are kept temporarily in a size-limited cache and may be pruned under memory pressure.
  21. @property (nonatomic, assign, getter=isNetworkDebuggingEnabled) BOOL networkDebuggingEnabled;
  22. /// Defaults to 25 MB if never set. Values set here are presisted across launches of the app.
  23. /// The response cache uses an NSCache, so it may purge prior to hitting the limit when the app is under memory pressure.
  24. @property (nonatomic, assign) NSUInteger networkResponseCacheByteLimit;
  25. /// Requests whose host ends with one of the blacklisted entries in this array will be not be recorded (eg. google.com).
  26. /// Wildcard or subdomain entries are not required (eg. google.com will match any subdomain under google.com).
  27. /// Useful to remove requests that are typically noisy, such as analytics requests that you aren't interested in tracking.
  28. @property (nonatomic, copy) NSArray<NSString *> *networkRequestHostBlacklist;
  29. #pragma mark - Keyboard Shortcuts
  30. /// Simulator keyboard shortcuts are enabled by default.
  31. /// The shortcuts will not fire when there is an active text field, text view, or other responder accepting key input.
  32. /// You can disable keyboard shortcuts if you have existing keyboard shortcuts that conflict with FLEX, or if you like doing things the hard way ;)
  33. /// Keyboard shortcuts are always disabled (and support is compiled out) in non-simulator builds
  34. @property (nonatomic, assign) BOOL simulatorShortcutsEnabled;
  35. /// Adds an action to run when the specified key & modifier combination is pressed
  36. /// @param key A single character string matching a key on the keyboard
  37. /// @param modifiers Modifier keys such as shift, command, or alt/option
  38. /// @param action The block to run on the main thread when the key & modifier combination is recognized.
  39. /// @param description Shown the the keyboard shortcut help menu, which is accessed via the '?' key.
  40. /// @note The action block will be retained for the duration of the application. You may want to use weak references.
  41. /// @note FLEX registers several default keyboard shortcuts. Use the '?' key to see a list of shortcuts.
  42. - (void)registerSimulatorShortcutWithKey:(NSString *)key modifiers:(UIKeyModifierFlags)modifiers action:(dispatch_block_t)action description:(NSString *)description;
  43. #pragma mark - Extensions
  44. /// Default database password is @c nil by default.
  45. /// Set this to the password you want the databases to open with.
  46. @property (copy, nonatomic) NSString *defaultSqliteDatabasePassword;
  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 objectFutureBlock When you tap on the row, information about the object returned by this block will be displayed.
  50. /// 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)
  51. /// @note This method must be called from the main thread.
  52. /// The objectFutureBlock will be invoked from the main thread and may return nil.
  53. /// @note The passed block will be copied and retain for the duration of the application, you may want to use __weak references.
  54. - (void)registerGlobalEntryWithName:(NSString *)entryName objectFutureBlock:(id (^)(void))objectFutureBlock;
  55. /// Adds an entry at the bottom of the list of Global State items. Call this method before this view controller is displayed.
  56. /// @param entryName The string to be displayed in the cell.
  57. /// @param viewControllerFutureBlock When you tap on the row, view controller returned by this block will be pushed on the navigation controller stack.
  58. /// @note This method must be called from the main thread.
  59. /// The viewControllerFutureBlock will be invoked from the main thread and may not return nil.
  60. /// @note The passed block will be copied and retain for the duration of the application, you may want to use __weak references.
  61. - (void)registerGlobalEntryWithName:(NSString *)entryName
  62. viewControllerFutureBlock:(UIViewController * (^)(void))viewControllerFutureBlock;
  63. /// Sets custom viewer for specific content type.
  64. /// @param contentType Mime type like application/json
  65. /// @param viewControllerFutureBlock Viewer (view controller) creation block
  66. /// @note This method must be called from the main thread.
  67. /// The viewControllerFutureBlock will be invoked from the main thread and may not return nil.
  68. /// @note The passed block will be copied and retain for the duration of the application, you may want to use __weak references.
  69. - (void)setCustomViewerForContentType:(NSString *)contentType
  70. viewControllerFutureBlock:(FLEXCustomContentViewerFuture)viewControllerFutureBlock;
  71. @end