Merge pull request #586 from mastodon/chore-move-updateActiveUserAccountPublisher

Move updateActiveUserAccountPublisher to AuthenticationService
This commit is contained in:
Marcus Kida 2022-11-14 14:27:55 +01:00 committed by GitHub
commit 38afbbfbc8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 4 additions and 4 deletions

View File

@ -553,7 +553,7 @@ extension ProfileViewController {
} }
// trigger authenticated user account update // trigger authenticated user account update
viewModel.context.instanceService.updateActiveUserAccountPublisher.send() viewModel.context.authenticationService.updateActiveUserAccountPublisher.send()
DispatchQueue.main.asyncAfter(deadline: .now() + 0.3) { DispatchQueue.main.asyncAfter(deadline: .now() + 0.3) {
sender.endRefreshing() sender.endRefreshing()

View File

@ -313,7 +313,7 @@ extension MainTabBarController {
let currentUserDisplayName = user.displayNameWithFallback ?? "no user" let currentUserDisplayName = user.displayNameWithFallback ?? "no user"
profileTabItem.accessibilityHint = L10n.Scene.AccountList.tabBarHint(currentUserDisplayName) profileTabItem.accessibilityHint = L10n.Scene.AccountList.tabBarHint(currentUserDisplayName)
context.instanceService.updateActiveUserAccountPublisher context.authenticationService.updateActiveUserAccountPublisher
.sink { [weak self] in .sink { [weak self] in
self?.updateUserAccount() self?.updateUserAccount()
} }

View File

@ -111,7 +111,7 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate {
AppContext.shared.statusFilterService.filterUpdatePublisher.send() AppContext.shared.statusFilterService.filterUpdatePublisher.send()
// trigger authenticated user account update // trigger authenticated user account update
AppContext.shared.instanceService.updateActiveUserAccountPublisher.send() AppContext.shared.authenticationService.updateActiveUserAccountPublisher.send()
if let shortcutItem = savedShortCutItem { if let shortcutItem = savedShortCutItem {
Task { Task {

View File

@ -25,6 +25,7 @@ public final class AuthenticationService: NSObject {
// output // output
@Published public var mastodonAuthentications: [ManagedObjectRecord<MastodonAuthentication>] = [] @Published public var mastodonAuthentications: [ManagedObjectRecord<MastodonAuthentication>] = []
@Published public var mastodonAuthenticationBoxes: [MastodonAuthenticationBox] = [] @Published public var mastodonAuthenticationBoxes: [MastodonAuthenticationBox] = []
public let updateActiveUserAccountPublisher = PassthroughSubject<Void, Never>()
init( init(
managedObjectContext: NSManagedObjectContext, managedObjectContext: NSManagedObjectContext,

View File

@ -24,7 +24,6 @@ public final class InstanceService {
weak var authenticationService: AuthenticationService? weak var authenticationService: AuthenticationService?
// output // output
public let updateActiveUserAccountPublisher = PassthroughSubject<Void, Never>()
init( init(
apiService: APIService, apiService: APIService,