Remove old TimelineTableViewController
This commit is contained in:
parent
b1d83f2746
commit
5de0c034f4
|
@ -125,7 +125,6 @@
|
||||||
D64D0AAD2128D88B005A6F37 /* LocalData.swift in Sources */ = {isa = PBXBuildFile; fileRef = D64D0AAC2128D88B005A6F37 /* LocalData.swift */; };
|
D64D0AAD2128D88B005A6F37 /* LocalData.swift in Sources */ = {isa = PBXBuildFile; fileRef = D64D0AAC2128D88B005A6F37 /* LocalData.swift */; };
|
||||||
D64D0AB12128D9AE005A6F37 /* OnboardingViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D64D0AB02128D9AE005A6F37 /* OnboardingViewController.swift */; };
|
D64D0AB12128D9AE005A6F37 /* OnboardingViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D64D0AB02128D9AE005A6F37 /* OnboardingViewController.swift */; };
|
||||||
D64D8CA92463B494006B0BAA /* MultiThreadDictionary.swift in Sources */ = {isa = PBXBuildFile; fileRef = D64D8CA82463B494006B0BAA /* MultiThreadDictionary.swift */; };
|
D64D8CA92463B494006B0BAA /* MultiThreadDictionary.swift in Sources */ = {isa = PBXBuildFile; fileRef = D64D8CA82463B494006B0BAA /* MultiThreadDictionary.swift */; };
|
||||||
D65234D325618EFA001AF9CF /* TimelineTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D65234D225618EFA001AF9CF /* TimelineTableViewController.swift */; };
|
|
||||||
D65234E12561AA68001AF9CF /* NotificationsTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D65234E02561AA68001AF9CF /* NotificationsTableViewController.swift */; };
|
D65234E12561AA68001AF9CF /* NotificationsTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D65234E02561AA68001AF9CF /* NotificationsTableViewController.swift */; };
|
||||||
D6531DEE246B81C9000F9538 /* GifvAttachmentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6531DED246B81C9000F9538 /* GifvAttachmentView.swift */; };
|
D6531DEE246B81C9000F9538 /* GifvAttachmentView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6531DED246B81C9000F9538 /* GifvAttachmentView.swift */; };
|
||||||
D6531DF0246B867E000F9538 /* GifvAttachmentViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6531DEF246B867E000F9538 /* GifvAttachmentViewController.swift */; };
|
D6531DF0246B867E000F9538 /* GifvAttachmentViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6531DEF246B867E000F9538 /* GifvAttachmentViewController.swift */; };
|
||||||
|
@ -480,7 +479,6 @@
|
||||||
D64D0AAC2128D88B005A6F37 /* LocalData.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LocalData.swift; sourceTree = "<group>"; };
|
D64D0AAC2128D88B005A6F37 /* LocalData.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LocalData.swift; sourceTree = "<group>"; };
|
||||||
D64D0AB02128D9AE005A6F37 /* OnboardingViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OnboardingViewController.swift; sourceTree = "<group>"; };
|
D64D0AB02128D9AE005A6F37 /* OnboardingViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OnboardingViewController.swift; sourceTree = "<group>"; };
|
||||||
D64D8CA82463B494006B0BAA /* MultiThreadDictionary.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MultiThreadDictionary.swift; sourceTree = "<group>"; };
|
D64D8CA82463B494006B0BAA /* MultiThreadDictionary.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MultiThreadDictionary.swift; sourceTree = "<group>"; };
|
||||||
D65234D225618EFA001AF9CF /* TimelineTableViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TimelineTableViewController.swift; sourceTree = "<group>"; };
|
|
||||||
D65234E02561AA68001AF9CF /* NotificationsTableViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NotificationsTableViewController.swift; sourceTree = "<group>"; };
|
D65234E02561AA68001AF9CF /* NotificationsTableViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NotificationsTableViewController.swift; sourceTree = "<group>"; };
|
||||||
D6531DED246B81C9000F9538 /* GifvAttachmentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GifvAttachmentView.swift; sourceTree = "<group>"; };
|
D6531DED246B81C9000F9538 /* GifvAttachmentView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GifvAttachmentView.swift; sourceTree = "<group>"; };
|
||||||
D6531DEF246B867E000F9538 /* GifvAttachmentViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GifvAttachmentViewController.swift; sourceTree = "<group>"; };
|
D6531DEF246B867E000F9538 /* GifvAttachmentViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GifvAttachmentViewController.swift; sourceTree = "<group>"; };
|
||||||
|
@ -927,7 +925,6 @@
|
||||||
D6945C3123AC4D36005C403C /* HashtagTimelineViewController.swift */,
|
D6945C3123AC4D36005C403C /* HashtagTimelineViewController.swift */,
|
||||||
D6945C3723AC739F005C403C /* InstanceTimelineViewController.swift */,
|
D6945C3723AC739F005C403C /* InstanceTimelineViewController.swift */,
|
||||||
D6BC9DD6232D7811002CA326 /* TimelinesPageViewController.swift */,
|
D6BC9DD6232D7811002CA326 /* TimelinesPageViewController.swift */,
|
||||||
D65234D225618EFA001AF9CF /* TimelineTableViewController.swift */,
|
|
||||||
D66C900A28DAB7FD00217BF2 /* TimelineViewController.swift */,
|
D66C900A28DAB7FD00217BF2 /* TimelineViewController.swift */,
|
||||||
D6ADB6E728E8C878009924AB /* PublicTimelineDescriptionCollectionViewCell.swift */,
|
D6ADB6E728E8C878009924AB /* PublicTimelineDescriptionCollectionViewCell.swift */,
|
||||||
);
|
);
|
||||||
|
@ -1997,7 +1994,6 @@
|
||||||
D6C1B2082545D1EC00DAAA66 /* StatusCardView.swift in Sources */,
|
D6C1B2082545D1EC00DAAA66 /* StatusCardView.swift in Sources */,
|
||||||
D64BC18A23C16487000D0238 /* UnpinStatusActivity.swift in Sources */,
|
D64BC18A23C16487000D0238 /* UnpinStatusActivity.swift in Sources */,
|
||||||
D64D8CA92463B494006B0BAA /* MultiThreadDictionary.swift in Sources */,
|
D64D8CA92463B494006B0BAA /* MultiThreadDictionary.swift in Sources */,
|
||||||
D65234D325618EFA001AF9CF /* TimelineTableViewController.swift in Sources */,
|
|
||||||
D68E6F5F253C9B2D001A1B4C /* BaseEmojiLabel.swift in Sources */,
|
D68E6F5F253C9B2D001A1B4C /* BaseEmojiLabel.swift in Sources */,
|
||||||
D6F0B12B24A3071C001E48C3 /* MainSplitViewController.swift in Sources */,
|
D6F0B12B24A3071C001E48C3 /* MainSplitViewController.swift in Sources */,
|
||||||
D6AEBB3E2321638100E5038B /* UIActivity+Types.swift in Sources */,
|
D6AEBB3E2321638100E5038B /* UIActivity+Types.swift in Sources */,
|
||||||
|
|
|
@ -105,7 +105,7 @@ class AuxiliarySceneDelegate: UIResponder, UIWindowSceneDelegate {
|
||||||
switch timeline {
|
switch timeline {
|
||||||
// todo: list/hashtag controllers need whole objects which must be fetched asynchronously
|
// todo: list/hashtag controllers need whole objects which must be fetched asynchronously
|
||||||
default:
|
default:
|
||||||
return TimelineTableViewController(for: timeline, mastodonController: mastodonController)
|
return TimelineViewController(for: timeline, mastodonController: mastodonController)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,334 +0,0 @@
|
||||||
//
|
|
||||||
// TimelineTableViewController.swift
|
|
||||||
// Tusker
|
|
||||||
//
|
|
||||||
// Created by Shadowfacts on 8/15/18.
|
|
||||||
// Copyright © 2018 Shadowfacts. All rights reserved.
|
|
||||||
//
|
|
||||||
|
|
||||||
import UIKit
|
|
||||||
import Pachyderm
|
|
||||||
|
|
||||||
typealias TimelineEntry = (id: String, state: StatusState)
|
|
||||||
|
|
||||||
class TimelineTableViewController: DiffableTimelineLikeTableViewController<TimelineTableViewController.Section, TimelineTableViewController.Item> {
|
|
||||||
|
|
||||||
let timeline: Timeline
|
|
||||||
weak var mastodonController: MastodonController!
|
|
||||||
|
|
||||||
private var newer: RequestRange?
|
|
||||||
private var older: RequestRange?
|
|
||||||
|
|
||||||
private var didConfirmLoadMore = false
|
|
||||||
private var isShowingTimelineDescription = false
|
|
||||||
|
|
||||||
init(for timeline: Timeline, mastodonController: MastodonController) {
|
|
||||||
self.timeline = timeline
|
|
||||||
self.mastodonController = mastodonController
|
|
||||||
|
|
||||||
super.init()
|
|
||||||
|
|
||||||
dragEnabled = true
|
|
||||||
|
|
||||||
title = timeline.title
|
|
||||||
tabBarItem.image = timeline.tabBarImage
|
|
||||||
|
|
||||||
if let id = mastodonController.accountInfo?.id {
|
|
||||||
userActivity = UserActivityManager.showTimelineActivity(timeline: timeline, accountID: id)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
required init?(coder: NSCoder) {
|
|
||||||
fatalError("init(coder:) has not been implemented")
|
|
||||||
}
|
|
||||||
|
|
||||||
override func viewDidLoad() {
|
|
||||||
super.viewDidLoad()
|
|
||||||
|
|
||||||
tableView.register(UINib(nibName: "TimelineStatusTableViewCell", bundle: .main), forCellReuseIdentifier: "statusCell")
|
|
||||||
tableView.register(UINib(nibName: "ConfirmLoadMoreTableViewCell", bundle: .main), forCellReuseIdentifier: "confirmLoadMoreCell")
|
|
||||||
tableView.register(UINib(nibName: "PublicTimelineDescriptionTableViewCell", bundle: .main), forCellReuseIdentifier: "publicTimelineDescriptionCell")
|
|
||||||
|
|
||||||
if case let .public(local: local) = timeline,
|
|
||||||
(local && !Preferences.shared.hasShownLocalTimelineDescription) || (!local && !Preferences.shared.hasShownFederatedTimelineDescription) {
|
|
||||||
isShowingTimelineDescription = true
|
|
||||||
|
|
||||||
var snapshot = self.dataSource.snapshot()
|
|
||||||
snapshot.appendSections([.header])
|
|
||||||
snapshot.appendItems([.publicTimelineDescription(local: local)], toSection: .header)
|
|
||||||
self.dataSource.apply(snapshot, animatingDifferences: false)
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
override func viewDidAppear(_ animated: Bool) {
|
|
||||||
super.viewDidAppear(animated)
|
|
||||||
|
|
||||||
if case let .public(local: local) = timeline {
|
|
||||||
if local {
|
|
||||||
Preferences.shared.hasShownLocalTimelineDescription = true
|
|
||||||
} else {
|
|
||||||
Preferences.shared.hasShownFederatedTimelineDescription = true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override func viewDidDisappear(_ animated: Bool) {
|
|
||||||
super.viewDidDisappear(animated)
|
|
||||||
|
|
||||||
if isShowingTimelineDescription {
|
|
||||||
isShowingTimelineDescription = false
|
|
||||||
|
|
||||||
var snapshot = self.dataSource.snapshot()
|
|
||||||
snapshot.deleteSections([.header])
|
|
||||||
self.dataSource.apply(snapshot, animatingDifferences: false)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// MARK: - DiffableTimelineLikeTableViewController
|
|
||||||
|
|
||||||
override class func refreshCommandTitle() -> String {
|
|
||||||
return NSLocalizedString("Refresh Statuses", comment: "refresh status command discoverability title")
|
|
||||||
}
|
|
||||||
|
|
||||||
override func timelineContentSections() -> [Section] {
|
|
||||||
return [.statuses]
|
|
||||||
}
|
|
||||||
|
|
||||||
override func cellProvider(_ tableView: UITableView, _ indexPath: IndexPath, _ item: Item) -> UITableViewCell? {
|
|
||||||
switch item {
|
|
||||||
case .loadingIndicator:
|
|
||||||
return self.loadingIndicatorCell(indexPath: indexPath)
|
|
||||||
|
|
||||||
case let .status(id: id, state: state):
|
|
||||||
let cell = tableView.dequeueReusableCell(withIdentifier: "statusCell", for: indexPath) as! TimelineStatusTableViewCell
|
|
||||||
|
|
||||||
cell.delegate = self
|
|
||||||
cell.updateUI(statusID: id, state: state)
|
|
||||||
return cell
|
|
||||||
|
|
||||||
case .confirmLoadMore:
|
|
||||||
let cell = tableView.dequeueReusableCell(withIdentifier: "confirmLoadMoreCell", for: indexPath) as! ConfirmLoadMoreTableViewCell
|
|
||||||
cell.confirmLoadMore = {
|
|
||||||
self.didConfirmLoadMore = true
|
|
||||||
self.loadOlder()
|
|
||||||
self.didConfirmLoadMore = false
|
|
||||||
}
|
|
||||||
return cell
|
|
||||||
|
|
||||||
case .publicTimelineDescription(local: let local):
|
|
||||||
let cell = tableView.dequeueReusableCell(withIdentifier: "publicTimelineDescriptionCell", for: indexPath) as! PublicTimelineDescriptionTableViewCell
|
|
||||||
cell.mastodonController = mastodonController
|
|
||||||
cell.local = local
|
|
||||||
cell.didDismiss = { [unowned self] in
|
|
||||||
var snapshot = self.dataSource.snapshot()
|
|
||||||
snapshot.deleteSections([.header])
|
|
||||||
self.dataSource.apply(snapshot)
|
|
||||||
}
|
|
||||||
return cell
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override func loadInitialItems(completion: @escaping (LoadResult) -> Void) {
|
|
||||||
guard let mastodonController = mastodonController else {
|
|
||||||
completion(.failure(.noClient))
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
let request = Client.getStatuses(timeline: timeline)
|
|
||||||
|
|
||||||
mastodonController.run(request) { response in
|
|
||||||
switch response {
|
|
||||||
case let .failure(error):
|
|
||||||
completion(.failure(.client(error)))
|
|
||||||
|
|
||||||
case let .success(statuses, _):
|
|
||||||
if !statuses.isEmpty {
|
|
||||||
self.newer = .after(id: statuses.first!.id, count: nil)
|
|
||||||
self.older = .before(id: statuses.last!.id, count: nil)
|
|
||||||
}
|
|
||||||
|
|
||||||
self.mastodonController.persistentContainer.addAll(statuses: statuses) {
|
|
||||||
DispatchQueue.main.async {
|
|
||||||
var snapshot = self.dataSource.snapshot()
|
|
||||||
if snapshot.sectionIdentifiers.contains(.loadingIndicator) {
|
|
||||||
snapshot.deleteSections([.loadingIndicator])
|
|
||||||
}
|
|
||||||
snapshot.deleteSections([.statuses, .footer])
|
|
||||||
snapshot.appendSections([.statuses, .footer])
|
|
||||||
snapshot.appendItems(statuses.map { .status(id: $0.id, state: .unknown) }, toSection: .statuses)
|
|
||||||
completion(.success(snapshot))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override func loadOlderItems(currentSnapshot: @escaping () -> Snapshot, completion: @escaping (LoadResult) -> Void) {
|
|
||||||
guard let older = older else {
|
|
||||||
completion(.failure(.noOlder))
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if Preferences.shared.disableInfiniteScrolling && !didConfirmLoadMore {
|
|
||||||
var snapshot = currentSnapshot()
|
|
||||||
guard !snapshot.itemIdentifiers(inSection: .footer).contains(.confirmLoadMore) else {
|
|
||||||
// todo: need something more accurate than "success"/"failure"
|
|
||||||
completion(.success(snapshot))
|
|
||||||
return
|
|
||||||
}
|
|
||||||
snapshot.appendItems([.confirmLoadMore], toSection: .footer)
|
|
||||||
completion(.success(snapshot))
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
let request = Client.getStatuses(timeline: timeline, range: older)
|
|
||||||
|
|
||||||
mastodonController.run(request) { response in
|
|
||||||
switch response {
|
|
||||||
case let .failure(error):
|
|
||||||
completion(.failure(.client(error)))
|
|
||||||
|
|
||||||
case let .success(statuses, _):
|
|
||||||
if !statuses.isEmpty {
|
|
||||||
self.older = .before(id: statuses.last!.id, count: nil)
|
|
||||||
}
|
|
||||||
|
|
||||||
self.mastodonController.persistentContainer.addAll(statuses: statuses) {
|
|
||||||
var snapshot = currentSnapshot()
|
|
||||||
snapshot.appendItems(statuses.map { .status(id: $0.id, state: .unknown) }, toSection: .statuses)
|
|
||||||
snapshot.deleteItems([.confirmLoadMore])
|
|
||||||
completion(.success(snapshot))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override func loadNewerItems(currentSnapshot: @escaping () -> Snapshot, completion: @escaping (LoadResult) -> Void) {
|
|
||||||
guard let newer = newer else {
|
|
||||||
completion(.failure(.noNewer))
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
let request = Client.getStatuses(timeline: timeline, range: newer)
|
|
||||||
mastodonController.run(request) { response in
|
|
||||||
switch response {
|
|
||||||
case let .failure(error):
|
|
||||||
completion(.failure(.client(error)))
|
|
||||||
|
|
||||||
case let .success(statuses, _):
|
|
||||||
guard !statuses.isEmpty else {
|
|
||||||
completion(.failure(.allCaughtUp))
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
self.newer = .after(id: statuses.first!.id, count: nil)
|
|
||||||
|
|
||||||
self.mastodonController.persistentContainer.addAll(statuses: statuses) {
|
|
||||||
var snapshot = currentSnapshot()
|
|
||||||
let newIdentifiers = statuses.map { Item.status(id: $0.id, state: .unknown) }
|
|
||||||
if let first = snapshot.itemIdentifiers(inSection: .statuses).first {
|
|
||||||
snapshot.insertItems(newIdentifiers, beforeItem: first)
|
|
||||||
} else {
|
|
||||||
snapshot.appendItems(newIdentifiers, toSection: .statuses)
|
|
||||||
}
|
|
||||||
completion(.success(snapshot))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override func scrollViewWillBeginDragging(_ scrollView: UIScrollView) {
|
|
||||||
super.scrollViewWillBeginDragging(scrollView)
|
|
||||||
|
|
||||||
if isShowingTimelineDescription {
|
|
||||||
var snapshot = self.dataSource.snapshot()
|
|
||||||
snapshot.deleteSections([.header])
|
|
||||||
self.dataSource.apply(snapshot, animatingDifferences: true)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
extension TimelineTableViewController {
|
|
||||||
enum Section: DiffableTimelineLikeSection {
|
|
||||||
case loadingIndicator
|
|
||||||
case header
|
|
||||||
case statuses
|
|
||||||
case footer
|
|
||||||
}
|
|
||||||
enum Item: DiffableTimelineLikeItem {
|
|
||||||
case loadingIndicator
|
|
||||||
case status(id: String, state: StatusState)
|
|
||||||
case confirmLoadMore
|
|
||||||
case publicTimelineDescription(local: Bool)
|
|
||||||
|
|
||||||
static func ==(lhs: Item, rhs: Item) -> Bool {
|
|
||||||
switch (lhs, rhs) {
|
|
||||||
case let (.status(id: a, state: _), .status(id: b, state: _)):
|
|
||||||
return a == b
|
|
||||||
case (.confirmLoadMore, .confirmLoadMore):
|
|
||||||
return true
|
|
||||||
case let (.publicTimelineDescription(local: a), .publicTimelineDescription(local: b)):
|
|
||||||
return a == b
|
|
||||||
default:
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func hash(into hasher: inout Hasher) {
|
|
||||||
switch self {
|
|
||||||
case .loadingIndicator:
|
|
||||||
hasher.combine(0)
|
|
||||||
case let .status(id: id, state: _):
|
|
||||||
hasher.combine(1)
|
|
||||||
hasher.combine(id)
|
|
||||||
case .confirmLoadMore:
|
|
||||||
hasher.combine(2)
|
|
||||||
case let .publicTimelineDescription(local: local):
|
|
||||||
hasher.combine(3)
|
|
||||||
hasher.combine(local)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
extension TimelineTableViewController: TuskerNavigationDelegate {
|
|
||||||
var apiController: MastodonController! { mastodonController }
|
|
||||||
}
|
|
||||||
|
|
||||||
extension TimelineTableViewController: StatusTableViewCellDelegate {
|
|
||||||
func statusCellCollapsedStateChanged(_ cell: BaseStatusTableViewCell) {
|
|
||||||
if #available(iOS 16.0, *) {
|
|
||||||
} else {
|
|
||||||
cellHeightChanged()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
extension TimelineTableViewController: MenuActionProvider {
|
|
||||||
}
|
|
||||||
|
|
||||||
extension TimelineTableViewController: UITableViewDataSourcePrefetching, StatusTablePrefetching {
|
|
||||||
func tableView(_ tableView: UITableView, prefetchRowsAt indexPaths: [IndexPath]) {
|
|
||||||
let ids: [String] = indexPaths.compactMap {
|
|
||||||
if case let .status(id: id, state: _) = dataSource.itemIdentifier(for: $0) {
|
|
||||||
return id
|
|
||||||
} else {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
}
|
|
||||||
prefetchStatuses(with: ids)
|
|
||||||
}
|
|
||||||
|
|
||||||
func tableView(_ tableView: UITableView, cancelPrefetchingForRowsAt indexPaths: [IndexPath]) {
|
|
||||||
let ids: [String] = indexPaths.compactMap {
|
|
||||||
if case let .status(id: id, state: _) = dataSource.itemIdentifier(for: $0) {
|
|
||||||
return id
|
|
||||||
} else {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
}
|
|
||||||
cancelPrefetchingStatuses(with: ids)
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -205,7 +205,7 @@ class UserActivityManager {
|
||||||
rootController.segmentedControl.selectedSegmentIndex = index
|
rootController.segmentedControl.selectedSegmentIndex = index
|
||||||
rootController.selectPage(at: index, animated: false)
|
rootController.selectPage(at: index, animated: false)
|
||||||
default:
|
default:
|
||||||
let timeline = TimelineTableViewController(for: timeline, mastodonController: mastodonController)
|
let timeline = TimelineViewController(for: timeline, mastodonController: mastodonController)
|
||||||
navigationController.pushViewController(timeline, animated: false)
|
navigationController.pushViewController(timeline, animated: false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue