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:
parent
38e2e6baab
commit
1421795eab
@ -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 {
|
||||
|
@ -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 {
|
||||
|
Loading…
x
Reference in New Issue
Block a user