2
2
mirror of https://github.com/mastodon/mastodon-ios synced 2025-04-11 22:58:02 +02:00

Only publish new active user if it has changed, and only fetch info for current user.

contributes to iOS-319
This commit is contained in:
shannon 2024-11-19 10:31:18 -05:00
parent 96e3bec016
commit d96be97cf6

View File

@ -28,12 +28,12 @@ public class AuthenticationServiceProvider: ObservableObject {
$mastodonAuthenticationBoxes
.throttle(for: 3, scheduler: DispatchQueue.main, latest: true)
.sink { [weak self] boxes in
self?.currentActiveUser.send(boxes.first)
let nowActive = boxes.first
guard nowActive?.authentication != self?.currentActiveUser.value?.authentication else { return }
self?.currentActiveUser.send(nowActive)
guard let nowActive = nowActive else { return }
Task { [weak self] in
for authBox in boxes {
do { try await self?.fetchFollowedBlockedUserIds(authBox) }
catch {}
}
try await self?.fetchFollowedBlockedUserIds(nowActive)
}
}
.store(in: &disposeBag)