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

Move responsibility for instance configuration updates to the AuthenticationServiceProvider

Fixes IOS-401
This commit is contained in:
shannon 2025-04-07 14:36:29 -04:00
parent 38e2e6baab
commit 1421795eab
2 changed files with 9 additions and 16 deletions

View File

@ -39,6 +39,15 @@ public class AuthenticationServiceProvider: ObservableObject {
.store(in: &disposeBag)
// TODO: verify credentials for active authentication
currentActiveUser
.throttle(for: 3, scheduler: DispatchQueue.main, latest: true)
.sink { authBox in
guard let domain = authBox?.domain else { return }
Task {
await InstanceService.shared.updateInstance(domain: domain)
}
}
.store(in: &disposeBag)
Task {
if authenticationMigrationRequired {

View File

@ -16,22 +16,6 @@ public final class InstanceService {
static let shared = InstanceService()
var disposeBag = Set<AnyCancellable>()
// output
init() {
AuthenticationServiceProvider.shared.currentActiveUser
.receive(on: DispatchQueue.main)
.asyncMap { [weak self] in
if let domain = $0?.domain {
await self?.updateInstance(domain: domain)
}
}
.sink {}
.store(in: &disposeBag)
}
}
extension InstanceService {