mirror of
https://github.com/metabolist/metatext.git
synced 2024-11-22 08:10:59 +00:00
Adjust loading footer display interval behavior
This commit is contained in:
parent
699fff540e
commit
c6d644feaf
1 changed files with 7 additions and 5 deletions
|
@ -251,7 +251,7 @@ extension TableViewController: ZoomAnimatorDelegate {
|
|||
|
||||
private extension TableViewController {
|
||||
static let bottomInset: CGFloat = .newStatusButtonDimension + .defaultSpacing * 4
|
||||
static let loadingFooterDebounceInterval: TimeInterval = 0.5
|
||||
static let loadingFooterDebounceInterval: TimeInterval = 0.75
|
||||
|
||||
var bottomInset: CGFloat { insetBottom ? Self.bottomInset : 0 }
|
||||
|
||||
|
@ -279,19 +279,21 @@ private extension TableViewController {
|
|||
|
||||
viewModel.loading.receive(on: DispatchQueue.main).assign(to: &$loading)
|
||||
|
||||
$loading.combineLatest(
|
||||
$loading.debounce(
|
||||
for: .seconds(Self.loadingFooterDebounceInterval),
|
||||
scheduler: DispatchQueue.main)
|
||||
.sink { [weak self] in
|
||||
scheduler: DispatchQueue.main))
|
||||
.sink { [weak self] loading, debouncedLoading in
|
||||
guard let self = self else { return }
|
||||
|
||||
let refreshControlVisibile = self.refreshControl?.isRefreshing ?? false
|
||||
|
||||
if !$0, refreshControlVisibile {
|
||||
if !loading, refreshControlVisibile {
|
||||
self.refreshControl?.endRefreshing()
|
||||
}
|
||||
|
||||
self.tableView.tableFooterView = $0 && !refreshControlVisibile ? self.loadingTableFooterView : UIView()
|
||||
self.tableView.tableFooterView =
|
||||
loading && debouncedLoading && !refreshControlVisibile ? self.loadingTableFooterView : UIView()
|
||||
self.sizeTableHeaderFooterViews()
|
||||
}
|
||||
.store(in: &cancellables)
|
||||
|
|
Loading…
Reference in a new issue