QR Code Login Flow (#2767)

Co-authored-by: Hugh Nimmo-Smith <hughns@users.noreply.github.com>
Co-authored-by: Hugh Nimmo-Smith <hughns@element.io>
This commit is contained in:
Mauro
2024-05-29 17:07:17 +02:00
committed by GitHub
parent 9c15d52a3b
commit e09e34aa61
72 changed files with 1241 additions and 226 deletions

View File

@@ -14,6 +14,7 @@
// limitations under the License.
//
import AVFoundation
import UIKit
class AppMediator: AppMediatorProtocol {
@@ -64,4 +65,22 @@ class AppMediator: AppMediatorProtocol {
func setIdleTimerDisabled(_ disabled: Bool) {
application.isIdleTimerDisabled = disabled
}
func requestAuthorizationIfNeeded() async -> Bool {
let status = AVCaptureDevice.authorizationStatus(for: .video)
// Determine if the user previously authorized camera access.
if status == .authorized {
return true
}
var isAuthorized = false
// If the system hasn't determined the user's authorization status,
// explicitly prompt them for approval.
if status == .notDetermined {
isAuthorized = await AVCaptureDevice.requestAccess(for: .video)
}
return isAuthorized
}
}