Manos Chorianopoulos

minor fix

......@@ -10,7 +10,7 @@ import UIKit
import WebKit
import SwiftEventBus
var timer: DispatchSourceTimer?
var timer2: DispatchSourceTimer?
@objc public class CampaignViewController: UIViewController, WKNavigationDelegate, WKScriptMessageHandler {
@IBOutlet weak var webview: WKWebView!
......@@ -63,9 +63,9 @@ var timer: DispatchSourceTimer?
print("========= Webview Timer Started! =========")
let queue = DispatchQueue(label: Bundle.main.bundleIdentifier! + ".webview.timer")
timer = DispatchSource.makeTimerSource(queue: queue)
timer!.schedule(deadline: .now(), repeating: .seconds(1))
timer!.setEventHandler { [weak self] in
timer2 = DispatchSource.makeTimerSource(queue: queue)
timer2!.schedule(deadline: .now(), repeating: .seconds(1))
timer2!.setEventHandler { [weak self] in
// do whatever stuff you want on the background queue here here
print("========= Webview interval! =========")
......@@ -82,13 +82,13 @@ var timer: DispatchSourceTimer?
})
}
}
timer!.resume()
timer2!.resume()
}
func stopTimer() {
print("========= Webview Timer Stopped! =========")
timer?.cancel()
timer = nil
timer2?.cancel()
timer2 = nil
}
// MARK: - API Calls
......