From d5840ae7d604bd0ba3ce6c7e2863a40f069c0bcc Mon Sep 17 00:00:00 2001 From: Damon Date: Sat, 17 Jul 2021 14:39:09 +0800 Subject: [PATCH] fix show --- netfox-zxkit.podspec | 2 +- pod/zxkit/NetFox+zxkit.swift | 18 +++++++++++++++--- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/netfox-zxkit.podspec b/netfox-zxkit.podspec index d1402e0..e4635c1 100644 --- a/netfox-zxkit.podspec +++ b/netfox-zxkit.podspec @@ -1,7 +1,7 @@ Pod::Spec.new do |s| s.name = 'netfox-zxkit' s.swift_version = '5.0' -s.version = '0.0.3' +s.version = '0.0.4' s.license= { :type => "Apache-2.0", :file => "LICENSE" } s.summary = 'a quick look on all executed network requests performed by netfox' s.homepage = 'https://github.com/ZXKitCode/netfox-zxkit' diff --git a/pod/zxkit/NetFox+zxkit.swift b/pod/zxkit/NetFox+zxkit.swift index 9156075..6713517 100644 --- a/pod/zxkit/NetFox+zxkit.swift +++ b/pod/zxkit/NetFox+zxkit.swift @@ -32,7 +32,13 @@ open class NetFoxZXKit: ZXKitPluginProtocol { } public func start() { - NFX.sharedInstance().show() + ZXKit.hide() + DispatchQueue.main.asyncAfter(deadline: .now() + 0.1) { + if !self.isRunning { + NFX.sharedInstance().start() + } + NFX.sharedInstance().show() + } } public var pluginIdentifier: String { @@ -52,11 +58,17 @@ open class NetFoxZXKit: ZXKitPluginProtocol { } public var isRunning: Bool { - return true + return NFX.sharedInstance().isStarted() } public func stop() { - NFX.sharedInstance().hide() + ZXKit.hide() + DispatchQueue.main.asyncAfter(deadline: .now() + 0.1) { + if !self.isRunning { + NFX.sharedInstance().start() + } + NFX.sharedInstance().show() + } }