2021-04-07 08:24:28 +02:00
|
|
|
//
|
|
|
|
// FavoriteViewModel+Diffable.swift
|
|
|
|
// Mastodon
|
|
|
|
//
|
|
|
|
// Created by MainasuK Cirno on 2021-4-7.
|
|
|
|
//
|
|
|
|
|
|
|
|
import UIKit
|
|
|
|
|
|
|
|
extension FavoriteViewModel {
|
|
|
|
|
|
|
|
func setupDiffableDataSource(
|
|
|
|
for tableView: UITableView,
|
|
|
|
dependency: NeedsDependency,
|
|
|
|
statusTableViewCellDelegate: StatusTableViewCellDelegate
|
2021-09-30 08:19:15 +02:00
|
|
|
) {
|
2021-04-07 08:24:28 +02:00
|
|
|
diffableDataSource = StatusSection.tableViewDiffableDataSource(
|
|
|
|
for: tableView,
|
2021-07-09 13:07:12 +02:00
|
|
|
timelineContext: .favorite,
|
2021-04-07 08:24:28 +02:00
|
|
|
dependency: dependency,
|
|
|
|
managedObjectContext: statusFetchedResultsController.fetchedResultsController.managedObjectContext,
|
|
|
|
statusTableViewCellDelegate: statusTableViewCellDelegate,
|
2021-04-13 13:46:42 +02:00
|
|
|
timelineMiddleLoaderTableViewCellDelegate: nil,
|
|
|
|
threadReplyLoaderTableViewCellDelegate: nil
|
2021-04-07 08:24:28 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
// set empty section to make update animation top-to-bottom style
|
|
|
|
var snapshot = NSDiffableDataSourceSnapshot<StatusSection, Item>()
|
|
|
|
snapshot.appendSections([.main])
|
|
|
|
diffableDataSource?.apply(snapshot)
|
|
|
|
|
|
|
|
stateMachine.enter(State.Reloading.self)
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|