Cached Avatar cancellation quick fix (#691)
* loading a cached avatar at first, and then actually doing the request so that the avatar can still be displayed without connection * improved the code * fix + changelog * policy on how to fetch the avatar url added * code improvements * addressed al PR comments * improved the error handling * improved the async task code * fixed a typo * fixed another typo * fix * removed useless codepull/692/head
parent
fb27efee10
commit
4144893e86
|
@ -158,7 +158,6 @@ class ClientProxy: ClientProxyProtocol {
|
|||
func loadUserDisplayName() async -> Result<String, ClientProxyError> {
|
||||
await Task.dispatch(on: clientQueue) {
|
||||
do {
|
||||
self.loadCachedAvatarURLTask?.cancel()
|
||||
let displayName = try self.client.displayName()
|
||||
return .success(displayName)
|
||||
} catch {
|
||||
|
@ -171,6 +170,7 @@ class ClientProxy: ClientProxyProtocol {
|
|||
await Task.dispatch(on: clientQueue) {
|
||||
do {
|
||||
let urlString = try self.client.avatarUrl()
|
||||
self.loadCachedAvatarURLTask?.cancel()
|
||||
self.avatarURLSubject.value = urlString.flatMap(URL.init)
|
||||
} catch {
|
||||
MXLog.error("Failed fetching the user avatar url: \(error)")
|
||||
|
|
Loading…
Reference in New Issue