diff --git a/Tusker/Screens/Main/MainTabBarViewController.swift b/Tusker/Screens/Main/MainTabBarViewController.swift index 010c40e0..f4026d21 100644 --- a/Tusker/Screens/Main/MainTabBarViewController.swift +++ b/Tusker/Screens/Main/MainTabBarViewController.swift @@ -51,12 +51,8 @@ class MainTabBarViewController: UITabBarController, UITabBarControllerDelegate { composePlaceholder.title = "Compose" composePlaceholder.tabBarItem.image = UIImage(systemName: "pencil") - #if !DEBUG - #error("remove me") - #endif viewControllers = [ -// embedInNavigationController(Tab.timelines.createViewController(mastodonController)), - embedInNavigationController(TimelineViewController(for: .home, mastodonController: mastodonController)), + embedInNavigationController(Tab.timelines.createViewController(mastodonController)), embedInNavigationController(Tab.notifications.createViewController(mastodonController)), composePlaceholder, embedInNavigationController(Tab.explore.createViewController(mastodonController)), diff --git a/Tusker/Screens/Timeline/TimelineViewController.swift b/Tusker/Screens/Timeline/TimelineViewController.swift index 8d4a7eec..c92e989e 100644 --- a/Tusker/Screens/Timeline/TimelineViewController.swift +++ b/Tusker/Screens/Timeline/TimelineViewController.swift @@ -87,38 +87,6 @@ class TimelineViewController: UIViewController, TimelineLikeCollectionViewContro collectionView.refreshControl!.addTarget(self, action: #selector(refresh), for: .valueChanged) #endif - #if DEBUG - let split = UIBarButtonItem(image: UIImage(systemName: "square.split.1x2.fill"), primaryAction: UIAction(handler: { [unowned self] _ in - var snapshot = self.dataSource.snapshot() - let statuses = snapshot.itemIdentifiers(inSection: .statuses) - if statuses.count > 20 { - let toRemove = Array(Array(statuses.dropFirst(10)).dropLast(10)) - if !toRemove.isEmpty { - print("REMOVING MIDDLE \(toRemove.count) STATUSES") - snapshot.insertItems([.gap], beforeItem: toRemove.first!) - snapshot.deleteItems(toRemove) - self.dataSource.apply(snapshot) - } - } - })) - let rewind = UIBarButtonItem(image: UIImage(systemName: "clock.arrow.circlepath"), primaryAction: UIAction(handler: { [unowned self] _ in - var snapshot = self.dataSource.snapshot() - let statuses = snapshot.itemIdentifiers(inSection: .statuses) - if statuses.count > 20 { - let toRemove = Array(statuses.dropLast(20)) - snapshot.deleteItems(toRemove) - self.dataSource.apply(snapshot) - } - })) - if #available(iOS 16.0, *) { - navigationItem.trailingItemGroups = [ - UIBarButtonItemGroup(barButtonItems: [split, rewind], representativeItem: nil) - ] - } - #else - #error("remove me") - #endif - contentOffsetObservation = collectionView.observe(\.contentOffset) { [weak self] _, _ in if let indexPath = self?.dataSource.indexPath(for: .gap), let cell = self?.collectionView.cellForItem(at: indexPath) as? TimelineGapCollectionViewCell { @@ -208,12 +176,6 @@ class TimelineViewController: UIViewController, TimelineLikeCollectionViewContro } } - override func viewDidDisappear(_ animated: Bool) { - super.viewDidDisappear(animated) - -// pruneOffscreenRows() - } - private func removeTimelineDescriptionCell() { var snapshot = dataSource.snapshot() snapshot.deleteSections([.header]) @@ -221,29 +183,6 @@ class TimelineViewController: UIViewController, TimelineLikeCollectionViewContro isShowingTimelineDescription = false } -// private func pruneOffscreenRows() { -// guard let lastVisibleIndexPath = collectionView.indexPathsForVisibleItems.last else { -// return -// } -// var snapshot = dataSource.snapshot() -// guard snapshot.indexOfSection(.statuses) != nil else { -// return -// } -// let items = snapshot.itemIdentifiers(inSection: .statuses) -// let pageSize = 20 -// let numberOfPagesToPrune = (items.count - lastVisibleIndexPath.row - 1) / pageSize -// if numberOfPagesToPrune > 0 { -// let itemsToRemove = Array(items.suffix(numberOfPagesToPrune * pageSize)) -// snapshot.deleteItems(itemsToRemove) -// -// dataSource.apply(snapshot, animatingDifferences: false) -// -// if case .status(id: let id, state: _) = snapshot.itemIdentifiers(inSection: .statuses).last { -// older = .before(id: id, count: nil) -// } -// } -// } - @objc private func sceneWillEnterForeground(_ notification: Foundation.Notification) { guard let scene = notification.object as? UIScene, // view.window is nil when the VC is not on screen