diff --git a/Mastodon/Scene/HomeTimeline/HomeTimelineViewController.swift b/Mastodon/Scene/HomeTimeline/HomeTimelineViewController.swift index fcd35cec1..728c92c21 100644 --- a/Mastodon/Scene/HomeTimeline/HomeTimelineViewController.swift +++ b/Mastodon/Scene/HomeTimeline/HomeTimelineViewController.swift @@ -205,10 +205,6 @@ 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) { @@ -216,11 +212,10 @@ extension HomeTimelineViewController { viewModel.viewDidAppear.send() - DispatchQueue.main.async { [weak self] in + DispatchQueue.main.asyncAfter(deadline: .now() + 2) { [weak self] in guard let self = self else { return } - if (self.viewModel.fetchedResultsController.fetchedObjects ?? []).count == 0 { - self.viewModel.loadLatestStateMachine.enter(HomeTimelineViewModel.LoadLatestState.Loading.self) - } + // always try to refresh timeline after appear + self.viewModel.homeTimelineNeedRefresh.send() } } diff --git a/Mastodon/Scene/HomeTimeline/HomeTimelineViewModel.swift b/Mastodon/Scene/HomeTimeline/HomeTimelineViewModel.swift index d22c52be3..9d8f6f709 100644 --- a/Mastodon/Scene/HomeTimeline/HomeTimelineViewModel.swift +++ b/Mastodon/Scene/HomeTimeline/HomeTimelineViewModel.swift @@ -135,8 +135,10 @@ final class HomeTimelineViewModel: NSObject { self?.loadLatestStateMachine.enter(LoadLatestState.Loading.self) } .store(in: &disposeBag) - + + // refresh after publish post homeTimelineNavigationBarTitleViewModel.isPublished + .delay(for: 2, scheduler: DispatchQueue.main) .sink { [weak self] isPublished in guard let self = self else { return } self.homeTimelineNeedRefresh.send()