Fix some warnings. (#3416)

This commit is contained in:
Doug
2024-10-16 08:54:34 +01:00
committed by GitHub
parent 236d142583
commit 718774dc36
10 changed files with 48 additions and 43 deletions
@@ -117,14 +117,14 @@ class BugReportService: NSObject, BugReportServiceProtocol {
let (data, response) = try await session.dataWithRetry(for: request, delegate: self)
guard let httpResponse = response as? HTTPURLResponse else {
let errorDescription = String(decoding: data, as: UTF8.self).trimmingCharacters(in: .whitespacesAndNewlines)
let errorDescription = String(data: data, encoding: .utf8)?.trimmingCharacters(in: .whitespacesAndNewlines) ?? "Unknown error"
MXLog.error("Failed to submit bug report: \(errorDescription)")
MXLog.error("Response: \(response)")
return .failure(.serverError(response, errorDescription))
}
guard httpResponse.statusCode == 200 else {
let errorDescription = String(decoding: data, as: UTF8.self).trimmingCharacters(in: .whitespacesAndNewlines)
let errorDescription = String(data: data, encoding: .utf8)?.trimmingCharacters(in: .whitespacesAndNewlines) ?? "Unknown error"
MXLog.error("Failed to submit bug report: \(errorDescription) (\(httpResponse.statusCode))")
MXLog.error("Response: \(httpResponse)")
return .failure(.httpError(httpResponse, errorDescription))
@@ -365,6 +365,7 @@ class ClientProxy: ClientProxyProtocol {
}
}
// swiftlint:disable:next function_parameter_count
func createRoom(name: String, topic: String?, isRoomPrivate: Bool, isKnockingOnly: Bool, userIDs: [String], avatarURL: URL?) async -> Result<String, ClientProxyError> {
do {
// TODO: Revisit once the SDK supports the knocking API
@@ -138,6 +138,7 @@ protocol ClientProxyProtocol: AnyObject, MediaLoaderProtocol {
func createDirectRoom(with userID: String, expectedRoomName: String?) async -> Result<String, ClientProxyError>
// swiftlint:disable:next function_parameter_count
func createRoom(name: String, topic: String?, isRoomPrivate: Bool, isKnockingOnly: Bool, userIDs: [String], avatarURL: URL?) async -> Result<String, ClientProxyError>
func joinRoom(_ roomID: String, via: [String]) async -> Result<Void, ClientProxyError>
@@ -299,8 +299,6 @@ class ElementCallService: NSObject, ElementCallServiceProtocol, PKPushRegistryDe
switch action {
case .roomInfoUpdate:
return (roomProxy.hasOngoingCall, roomProxy.activeRoomCallParticipants)
default:
return nil
}
}
.removeDuplicates { $0 == $1 }
@@ -208,7 +208,7 @@ struct TimelineItemDebugInfo: Identifiable, CustomStringConvertible {
return nil
}
return String(decoding: jsonData, as: UTF8.self)
return String(data: jsonData, encoding: .utf8)
}
}