Cached avatar support (from Rust) (#633)

* 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
This commit is contained in:
Mauro
2023-03-08 18:50:06 +01:00
committed by GitHub
parent c67c4e362e
commit fb27efee10
10 changed files with 62 additions and 31 deletions
@@ -43,11 +43,13 @@ class SettingsScreenViewModel: SettingsScreenViewModelType, SettingsScreenViewMo
ServiceLocator.shared.settings.$timelineStyle
.weakAssign(to: \.state.bindings.timelineStyle, on: self)
.store(in: &cancellables)
userSession.clientProxy.avatarURLPublisher
.weakAssign(to: \.state.userAvatarURL, on: self)
.store(in: &cancellables)
Task {
if case let .success(userAvatarURL) = await userSession.clientProxy.loadUserAvatarURL() {
state.userAvatarURL = userAvatarURL
}
await userSession.clientProxy.loadUserAvatarURL()
}
Task {