From 36549aac43ff7a58c039482f483707aed55ee033 Mon Sep 17 00:00:00 2001 From: Nodeful Date: Mon, 5 Apr 2021 00:07:01 +0300 Subject: [PATCH] skipping update check if cannot access internet --- native/app/Source/AppDelegate.swift | 5 +++++ native/app/Source/Audio/Sources/Input/InputSource.swift | 4 +++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/native/app/Source/AppDelegate.swift b/native/app/Source/AppDelegate.swift index 3577a6a..0abf866 100644 --- a/native/app/Source/AppDelegate.swift +++ b/native/app/Source/AppDelegate.swift @@ -17,14 +17,19 @@ class AppDelegate: NSObject, NSApplicationDelegate, SUUpdaterDelegate { var updater = SUUpdater(for: Bundle.main)! var updateProcessed = EmitterKit.Event() var willBeDownloadingUpdate = false + var applicationStarted = false func applicationDidFinishLaunching(_ aNotification: Notification) { NSApplication.shared.windows.first?.close() updater.delegate = self updateProcessed.once { _ in + self.applicationStarted = true Application.start() } updater.checkForUpdatesInBackground() + Utilities.delay(2000) { + self.updateProcessed.emit() + } } func applicationWillTerminate(_ aNotification: Notification) { diff --git a/native/app/Source/Audio/Sources/Input/InputSource.swift b/native/app/Source/Audio/Sources/Input/InputSource.swift index 4ee69f6..a075e1e 100644 --- a/native/app/Source/Audio/Sources/Input/InputSource.swift +++ b/native/app/Source/Audio/Sources/Input/InputSource.swift @@ -34,7 +34,9 @@ class InputSource { static func requestPermission (_ callback: @escaping (Bool) -> Void) { if #available(OSX 10.14, *) { - AVCaptureDevice.requestAccess(for: AVMediaType.audio, completionHandler: callback) + AVCaptureDevice.requestAccess(for: AVMediaType.audio) { granted in + callback(granted) + } } else { callback(true) }