Просмотр исходного кода

Add API to enable network debugging from FLEXManager.

This way clients don’t need to know anything about FLEXNetworkObserver or FLEXNetworkRecorder
Ryan Olson лет назад: 11
Родитель
Сommit
1d7d41a350
2 измененных файлов с 16 добавлено и 0 удалено
  1. 5 0
      Classes/Explorer Toolbar/FLEXManager.h
  2. 11 0
      Classes/Explorer Toolbar/FLEXManager.m

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

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