From 6a2fee12b5196f3af0b4f36050ce118ba4a52f81 Mon Sep 17 00:00:00 2001 From: CMK Date: Fri, 9 Jul 2021 19:13:09 +0800 Subject: [PATCH] fix: notification list always reload issue --- .../Scene/Notification/NotificationViewController.swift | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Mastodon/Scene/Notification/NotificationViewController.swift b/Mastodon/Scene/Notification/NotificationViewController.swift index f383781e9..c3ad661b7 100644 --- a/Mastodon/Scene/Notification/NotificationViewController.swift +++ b/Mastodon/Scene/Notification/NotificationViewController.swift @@ -148,8 +148,10 @@ extension NotificationViewController { tableView.deselectRow(with: transitionCoordinator, animated: animated) - // fetch latest notification when will appear - viewModel.loadLatestStateMachine.enter(NotificationViewModel.LoadLatestState.Loading.self) + // fetch latest notification when scroll position is within half screen height to prevent list reload + if tableView.contentOffset.y < view.frame.height * 0.5 { + viewModel.loadLatestStateMachine.enter(NotificationViewModel.LoadLatestState.Loading.self) + } // needs trigger manually after onboarding dismiss