Silence some warnings. (#4969)

This commit is contained in:
Doug
2026-01-19 15:16:16 +00:00
committed by GitHub
parent a30ae24d16
commit 1faf9125c1
12 changed files with 50 additions and 55 deletions
@@ -113,7 +113,7 @@ class AudioRecorder: AudioRecorderProtocol {
MXLog.info("setup audio session")
try audioSession.setAllowHapticsAndSystemSoundsDuringRecording(true)
try audioSession.setCategory(.playAndRecord, mode: .default, options: [.allowBluetooth])
try audioSession.setCategory(.playAndRecord, mode: .default, options: [.allowBluetoothHFP])
try audioSession.setActive(true)
addObservers()
}
@@ -160,6 +160,9 @@ class AuthenticationService: AuthenticationServiceProtocol {
return progressSubject.asCurrentValuePublisher()
}
// At some stage the SDK will have a `qrCodeData.intent` which we should check before continuing here.
// Note the equivalent check will also happen for linking a device by QR in the LinkNewDeviceService.
guard let scannedServerName = qrData.serverName() else {
MXLog.error("The QR code is from a device that is not yet signed in.")
progressSubject.send(completion: .failure(.qrCodeError(.deviceNotSignedIn)))
@@ -63,7 +63,7 @@ class LinkNewDeviceService: LinkNewDeviceServiceProtocol {
Task {
do {
// TODO: we need a way to cancel the in progress grant if the user hit the cancel button
// Note: The SDK doesn't provide us with a way to cancel the grant if the user hit the cancel button 🤷‍♂️
try await grantLoginHandler.generate(progressListener: listener) // The success state is handled by the listener.
} catch let error as HumanQrGrantLoginError {
MXLog.error("QR code reciprocate error: \(error)")
@@ -98,12 +98,12 @@ class LinkNewDeviceService: LinkNewDeviceServiceProtocol {
return progressSubject.asCurrentValuePublisher()
}
#warning("Check intent/server name??")
#warning("Check Element Pro here??")
// At some stage the SDK will have a `qrCodeData.intent` which we should check before continuing here.
// Note the equivalent check will also happen for sign in with QR code in the AuthenticationService.
Task {
do {
// TODO: it would be nice to be able to cancel the grant at the SDK level if the user hits the cancel button
// Note: The SDK doesn't provide us with a way to cancel the grant if the user hit the cancel button 🤷‍♂️
try await grantLoginHandler.scan(qrCodeData: qrCodeData, progressListener: listener) // The success state is handled by the listener.
} catch let error as HumanQrGrantLoginError {
MXLog.error("QR code reciprocate error: \(error)")
@@ -216,7 +216,9 @@ class CheckCodeSenderProxy: Equatable {
try await underlyingSender.send(code: code)
}
#warning("Waiting for an SDK update to use the underlying sender.")
// Bypassed for now whilst we wait for an SDK update (however its worth noting that
// things should still fail if the wrong code is provided, just not necessarily with
// the right error being shown). https://github.com/matrix-org/matrix-rust-sdk/pull/5957
func validate(checkCode: UInt8) -> Bool { true }
}
@@ -451,9 +451,6 @@ struct MediaUploadingPreprocessor {
try? FileManager.default.removeItem(at: outputURL)
exportSession.outputURL = outputURL
exportSession.outputFileType = AVFileType.mp4
guard exportSession.supportedFileTypes.contains(AVFileType.mp4) else {
throw .failedConvertingVideo
}
@@ -463,9 +460,10 @@ struct MediaUploadingPreprocessor {
exportSession.fileLengthLimit = Int64(Double(targetFileSize) * 0.9)
}
await exportSession.export()
guard exportSession.status == .completed else {
do {
try await exportSession.export(to: outputURL, as: .mp4)
} catch {
MXLog.error("Video conversion failed: \(error)")
throw .failedConvertingVideo
}