Make account switching work again
This commit is contained in:
parent
1bb8e64574
commit
aa9a6ee701
|
@ -217,7 +217,7 @@ extension SceneCoordinator {
|
|||
let rootViewController: UIViewController
|
||||
|
||||
do {
|
||||
let _authentication = AuthenticationServiceProvider.shared.authentications.first
|
||||
let _authentication = AuthenticationServiceProvider.shared.authenticationSortedByActivation().first
|
||||
let _authContext = _authentication.flatMap { AuthContext(authentication: $0) }
|
||||
self.authContext = _authContext
|
||||
|
||||
|
|
|
@ -50,8 +50,8 @@ public extension AuthenticationServiceProvider {
|
|||
authentications.first(where: { $0.userAccessToken == userAccessToken })
|
||||
}
|
||||
|
||||
func sortByActivation() { // fixme: why do we need this?
|
||||
authentications = authentications.sorted(by: { $0.activedAt > $1.activedAt })
|
||||
func authenticationSortedByActivation() -> [MastodonAuthentication] { // fixme: why do we need this?
|
||||
return authentications.sorted(by: { $0.activedAt > $1.activedAt })
|
||||
}
|
||||
|
||||
func restore() {
|
||||
|
|
|
@ -119,7 +119,7 @@ public final class AuthenticationService: NSObject {
|
|||
}
|
||||
.assign(to: &$mastodonAuthenticationBoxes)
|
||||
|
||||
AuthenticationServiceProvider.shared.sortByActivation()
|
||||
AuthenticationServiceProvider.shared.authentications = AuthenticationServiceProvider.shared.authenticationSortedByActivation()
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -179,8 +179,7 @@ extension ShareViewController {
|
|||
|
||||
extension ShareViewController {
|
||||
private func setupAuthContext() throws -> AuthContext? {
|
||||
AuthenticationServiceProvider.shared.sortByActivation()
|
||||
let _authentication = AuthenticationServiceProvider.shared.authentications.first
|
||||
let _authentication = AuthenticationServiceProvider.shared.authenticationSortedByActivation().first
|
||||
let _authContext = _authentication.flatMap { AuthContext(authentication: $0) }
|
||||
return _authContext
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue