2021-02-07 07:42:50 +01:00
|
|
|
//
|
|
|
|
// StatusProvider.swift
|
|
|
|
// Mastodon
|
|
|
|
//
|
|
|
|
// Created by sxiaojian on 2021/2/5.
|
|
|
|
//
|
|
|
|
|
|
|
|
import UIKit
|
|
|
|
import Combine
|
2021-03-03 09:12:48 +01:00
|
|
|
import CoreData
|
2021-02-07 07:42:50 +01:00
|
|
|
import CoreDataStack
|
2021-06-22 07:41:40 +02:00
|
|
|
|
|
|
|
#if ASDK
|
2021-06-20 18:14:47 +02:00
|
|
|
import AsyncDisplayKit
|
2021-06-22 07:41:40 +02:00
|
|
|
#endif
|
2021-02-07 07:42:50 +01:00
|
|
|
|
|
|
|
protocol StatusProvider: NeedsDependency & DisposeBagCollectable & UIViewController {
|
2021-03-03 09:12:48 +01:00
|
|
|
// async
|
2021-04-01 08:39:15 +02:00
|
|
|
func status() -> Future<Status?, Never>
|
2021-04-13 13:46:42 +02:00
|
|
|
func status(for cell: UITableViewCell?, indexPath: IndexPath?) -> Future<Status?, Never>
|
2021-04-01 08:39:15 +02:00
|
|
|
func status(for cell: UICollectionViewCell) -> Future<Status?, Never>
|
2021-02-24 09:11:48 +01:00
|
|
|
|
2021-03-03 09:12:48 +01:00
|
|
|
// sync
|
|
|
|
var managedObjectContext: NSManagedObjectContext { get }
|
2021-07-15 03:56:26 +02:00
|
|
|
|
|
|
|
@available(*, deprecated)
|
2021-02-24 09:11:48 +01:00
|
|
|
var tableViewDiffableDataSource: UITableViewDiffableDataSource<StatusSection, Item>? { get }
|
2021-07-15 03:56:26 +02:00
|
|
|
@available(*, deprecated)
|
2021-03-03 09:12:48 +01:00
|
|
|
func item(for cell: UITableViewCell?, indexPath: IndexPath?) -> Item?
|
2021-07-15 03:56:26 +02:00
|
|
|
@available(*, deprecated)
|
2021-03-10 12:12:53 +01:00
|
|
|
func items(indexPaths: [IndexPath]) -> [Item]
|
2021-06-20 18:14:47 +02:00
|
|
|
|
2021-07-15 03:56:26 +02:00
|
|
|
func statusObjectItems(indexPaths: [IndexPath]) -> [StatusObjectItem]
|
|
|
|
|
2021-06-22 07:41:40 +02:00
|
|
|
#if ASDK
|
2021-06-20 18:14:47 +02:00
|
|
|
func status(node: ASCellNode?, indexPath: IndexPath?) -> Status?
|
2021-06-22 07:41:40 +02:00
|
|
|
#endif
|
2021-06-20 18:14:47 +02:00
|
|
|
}
|
|
|
|
|
2021-06-22 07:41:40 +02:00
|
|
|
#if ASDK
|
2021-06-20 18:14:47 +02:00
|
|
|
extension StatusProvider {
|
|
|
|
func status(node: ASCellNode?, indexPath: IndexPath?) -> Status? {
|
|
|
|
fatalError("Needs implement this")
|
|
|
|
}
|
2021-02-07 07:42:50 +01:00
|
|
|
}
|
2021-06-22 07:41:40 +02:00
|
|
|
#endif
|
2021-07-15 03:56:26 +02:00
|
|
|
|
|
|
|
enum StatusObjectItem {
|
|
|
|
case status(objectID: NSManagedObjectID)
|
|
|
|
case homeTimelineIndex(objectID: NSManagedObjectID)
|
|
|
|
case mastodonNotification(objectID: NSManagedObjectID) // may not contains status
|
|
|
|
}
|