Ver código fonte

Add API to enable network debugging from FLEXManager.

This way clients don’t need to know anything about FLEXNetworkObserver or FLEXNetworkRecorder
Ryan Olson 11 anos atrás
pai
commit
1d7d41a350

+ 5 - 0
Classes/Explorer Toolbar/FLEXManager.h

@@ -17,6 +17,11 @@
 - (void)showExplorer;
 - (void)showExplorer;
 - (void)hideExplorer;
 - (void)hideExplorer;
 
 
+/// If this property is set to YES, FLEX will swizzle NSURLConnection*Delegate and NSURLSession*Delegate methods
+/// on classes that conform to the protocols. This allows you to view network activity history from the main FLEX menu.
+/// Full responses are kept temporarily in a size limited cache and may be pruged under memory pressure.
+@property (nonatomic, assign, getter=isNetworkDebuggingEnabled) BOOL networkDebuggingEnabled;
+
 #pragma mark - Extensions
 #pragma mark - Extensions
 
 
 /// Adds an entry at the bottom of the list of Global State items. Call this method before this view controller is displayed.
 /// Adds an entry at the bottom of the list of Global State items. Call this method before this view controller is displayed.

+ 11 - 0
Classes/Explorer Toolbar/FLEXManager.m

@@ -12,6 +12,7 @@
 #import "FLEXGlobalsTableViewControllerEntry.h"
 #import "FLEXGlobalsTableViewControllerEntry.h"
 #import "FLEXObjectExplorerFactory.h"
 #import "FLEXObjectExplorerFactory.h"
 #import "FLEXObjectExplorerViewController.h"
 #import "FLEXObjectExplorerViewController.h"
+#import "FLEXNetworkObserver.h"
 
 
 @interface FLEXManager () <FLEXWindowEventDelegate, FLEXExplorerViewControllerDelegate>
 @interface FLEXManager () <FLEXWindowEventDelegate, FLEXExplorerViewControllerDelegate>
 
 
@@ -81,6 +82,16 @@
     return self.explorerWindow.isHidden;
     return self.explorerWindow.isHidden;
 }
 }
 
 
+- (BOOL)isNetworkDebuggingEnabled
+{
+    return [FLEXNetworkObserver isEnabled];
+}
+
+- (void)setNetworkDebuggingEnabled:(BOOL)networkDebuggingEnabled
+{
+    [FLEXNetworkObserver setEnabled:networkDebuggingEnabled];
+}
+
 
 
 #pragma mark - FLEXWindowEventDelegate
 #pragma mark - FLEXWindowEventDelegate