mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-04 01:20:12 +00:00
Added user display names and switched to using an avatar url directly in the homeScreen viewModel for the current user.
This commit is contained in:
@@ -21,22 +21,6 @@ struct MediaProvider: MediaProviderProtocol {
|
||||
self.processingQueue = DispatchQueue(label: "MediaProviderProcessingQueue")
|
||||
}
|
||||
|
||||
func loadCurrentUserAvatar(_ completion: @escaping (Result<UIImage?, MediaProviderError>) -> Void) {
|
||||
processingQueue.async {
|
||||
do {
|
||||
let imageData = try client.avatar()
|
||||
DispatchQueue.main.async {
|
||||
completion(.success(UIImage(data: Data(bytes: imageData, count: imageData.count))))
|
||||
}
|
||||
} catch {
|
||||
MXLog.error("Failed retrieving image with error: \(error)")
|
||||
DispatchQueue.main.async {
|
||||
completion(.failure(.failedRetrievingImage))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func imageForURL(_ url: String?) -> UIImage? {
|
||||
guard let url = url else {
|
||||
return nil
|
||||
|
||||
@@ -15,8 +15,6 @@ enum MediaProviderError: Error {
|
||||
}
|
||||
|
||||
protocol MediaProviderProtocol {
|
||||
func loadCurrentUserAvatar(_ completion: @escaping (Result<UIImage?, MediaProviderError>) -> Void)
|
||||
|
||||
func imageForURL(_ url: String?) -> UIImage?
|
||||
|
||||
func loadImageFromURL(_ url: String, _ completion: @escaping (Result<UIImage, MediaProviderError>) -> Void)
|
||||
|
||||
Reference in New Issue
Block a user