Configured and applied SwiftFormat

This commit is contained in:
Stefan Ceriu
2022-09-27 10:17:22 +03:00
committed by Stefan Ceriu
parent ff2e6ddfa7
commit 43c28d23b7
663 changed files with 2329 additions and 2840 deletions
@@ -14,10 +14,10 @@
// limitations under the License.
//
import Foundation
import MatrixSDK
import Combine
import DesignKit
import Foundation
import MatrixSDK
enum AvatarServiceError: Error {
case pathNotfound
@@ -25,7 +25,6 @@ enum AvatarServiceError: Error {
}
class AvatarService: AvatarServiceProtocol {
private enum Constants {
static let mimeType = "image/jpeg"
static let thumbnailMethod = MXThumbnailingMethodCrop
@@ -34,7 +33,7 @@ class AvatarService: AvatarServiceProtocol {
private let mediaManager: MXMediaManager
static func instantiate(mediaManager: MXMediaManager) -> AvatarServiceProtocol {
return AvatarService(mediaManager: mediaManager)
AvatarService(mediaManager: mediaManager)
}
init(mediaManager: MXMediaManager) {
@@ -49,13 +48,13 @@ class AvatarService: AvatarServiceProtocol {
/// - avatarSize: The size of avatar to retrieve as defined in the DesignKit spec.
/// - Returns: A Future of UIImage that returns an error if it fails to fetch the image.
func avatarImage(mxContentUri: String, avatarSize: AvatarSize) -> Future<UIImage, Error> {
let cachePath = MXMediaManager.thumbnailCachePath(
forMatrixContentURI: mxContentUri,
andType: Constants.mimeType,
inFolder: nil,
inFolder: nil,
toFitViewSize: avatarSize.size,
with: Constants.thumbnailMethod)
with: Constants.thumbnailMethod
)
return Future<UIImage, Error> { promise in
if let image = MXMediaManager.loadThroughCache(withFilePath: cachePath),
@@ -69,7 +68,8 @@ class AvatarService: AvatarServiceProtocol {
withType: Constants.mimeType,
inFolder: nil,
toFitViewSize: avatarSize.size,
with: Constants.thumbnailMethod) { path in
with: Constants.thumbnailMethod
) { path in
guard let path = path else {
promise(.failure(AvatarServiceError.pathNotfound))
return