mirror of
https://github.com/mastodon/mastodon-ios.git
synced 2025-01-05 21:41:35 +01:00
677670055e
* Begin fixing of "Load More" on Home Timeline (IOS-266) * Don't show "Load More" if last status is first existing (IOS-266) * Insert missing items upon "Load More" (IOS-266) * Implement sinceID usage when loading latest posts (IOS-266) * Change updating of items on Load More(IOS-266) * Do not try to modify datasource directly (IOS-266) * Improve load more (IOS-266) * Fix load more using maxID and limit to 20 items (IOS-266) * Implement loading missing status in public timeline (IOS-266) * Implement subsequent "Load More" (IOS-266) * Make loadMore(item:at:) API more Swifty (IOS-266) * Address PR comments (IOS-266)
48 lines
1.0 KiB
Swift
48 lines
1.0 KiB
Swift
//
|
|
// TimelineMiddleLoaderTableViewCell+ViewModel.swift
|
|
// Mastodon
|
|
//
|
|
// Created by MainasuK on 2022-1-17.
|
|
//
|
|
|
|
import UIKit
|
|
import Combine
|
|
import MastodonSDK
|
|
|
|
extension TimelineMiddleLoaderTableViewCell {
|
|
public class ViewModel {
|
|
var disposeBag = Set<AnyCancellable>()
|
|
|
|
@Published var isFetching = false
|
|
}
|
|
}
|
|
|
|
extension TimelineMiddleLoaderTableViewCell.ViewModel {
|
|
public func bind(cell: TimelineMiddleLoaderTableViewCell) {
|
|
$isFetching
|
|
.sink { isFetching in
|
|
if isFetching {
|
|
cell.startAnimating()
|
|
} else {
|
|
cell.stopAnimating()
|
|
}
|
|
}
|
|
.store(in: &disposeBag)
|
|
}
|
|
}
|
|
|
|
|
|
extension TimelineMiddleLoaderTableViewCell {
|
|
public func configure(
|
|
feed: MastodonFeed,
|
|
delegate: TimelineMiddleLoaderTableViewCellDelegate?
|
|
) {
|
|
feed.$isLoadingMore
|
|
.assign(to: \.isFetching, on: self.viewModel)
|
|
.store(in: &disposeBag)
|
|
|
|
self.delegate = delegate
|
|
}
|
|
|
|
}
|