Explorar o código

start qr-code-reader in background as adviced by logged system warning

the warning reads sth as
"[AVCaptureSession startRunning] should be called from background thread.
Calling it on the main thread can lead to UI unresponsiveness"

closes #1836
B. Petersen %!s(int64=2) %!d(string=hai) anos
pai
achega
2ba04bfad8
Modificáronse 1 ficheiros con 4 adicións e 2 borrados
  1. 4 2
      deltachat-ios/Controller/QrCodeReaderController.swift

+ 4 - 2
deltachat-ios/Controller/QrCodeReaderController.swift

@@ -174,9 +174,11 @@ class QrCodeReaderController: UIViewController {
     // MARK: - actions
     func startSession() {
         #if targetEnvironment(simulator)
-        // ignore if run from simulator
+            // ignore if run from simulator
         #else
-        captureSession.startRunning()
+            DispatchQueue.global(qos: .userInteractive).async {
+                self.captureSession.startRunning()
+            }
         #endif
     }