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.

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