fix: homeTimeline refresh after follow people
This commit is contained in:
parent
9402dab97f
commit
106a5cc71a
|
@ -200,6 +200,10 @@ extension HomeTimelineViewController {
|
|||
|
||||
// needs trigger manually after onboarding dismiss
|
||||
setNeedsStatusBarAppearanceUpdate()
|
||||
|
||||
if (viewModel.fetchedResultsController.fetchedObjects ?? []).isEmpty {
|
||||
viewModel.loadLatestStateMachine.enter(HomeTimelineViewModel.LoadLatestState.Loading.self)
|
||||
}
|
||||
}
|
||||
|
||||
override func viewDidAppear(_ animated: Bool) {
|
||||
|
@ -280,6 +284,7 @@ extension HomeTimelineViewController {
|
|||
|
||||
@objc private func findPeopleButtonPressed(_ sender: PrimaryActionButton) {
|
||||
let viewModel = SuggestionAccountViewModel(context: context)
|
||||
viewModel.delegate = self.viewModel
|
||||
coordinator.present(scene: .suggestionAccount(viewModel: viewModel), from: self, transition: .modal(animated: true, completion: nil))
|
||||
}
|
||||
|
||||
|
|
|
@ -129,3 +129,9 @@ final class HomeTimelineViewModel: NSObject {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
extension HomeTimelineViewModel: SuggestionAccountViewModelDelegate {
|
||||
func homeTimelineNeedRefresh() {
|
||||
loadLatestStateMachine.enter(LoadLatestState.Loading.self)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,12 +13,16 @@ import MastodonSDK
|
|||
import os.log
|
||||
import UIKit
|
||||
|
||||
protocol SuggestionAccountViewModelDelegate: AnyObject {
|
||||
func homeTimelineNeedRefresh()
|
||||
}
|
||||
final class SuggestionAccountViewModel: NSObject {
|
||||
var disposeBag = Set<AnyCancellable>()
|
||||
|
||||
// input
|
||||
let context: AppContext
|
||||
|
||||
weak var delegate: SuggestionAccountViewModelDelegate?
|
||||
// output
|
||||
let accounts = CurrentValueSubject<[NSManagedObjectID], Never>([])
|
||||
var selectedAccounts = [NSManagedObjectID]()
|
||||
|
@ -137,7 +141,7 @@ final class SuggestionAccountViewModel: NSObject {
|
|||
case .failure(let error):
|
||||
os_log("%{public}s[%{public}ld], %{public}s: follow failed. %s", (#file as NSString).lastPathComponent, #line, #function, error.localizedDescription)
|
||||
case .finished:
|
||||
// handle isFetchingLatestTimeline in fetch controller delegate
|
||||
self.delegate?.homeTimelineNeedRefresh()
|
||||
break
|
||||
}
|
||||
} receiveValue: { _ in
|
||||
|
|
Loading…
Reference in New Issue