- Work in progress.
This commit is contained in:
David Sinclair 2022-09-03 19:55:21 -06:00
parent 2cdaa654ea
commit 45044060af
8 changed files with 24 additions and 34 deletions

View file

@ -199,9 +199,6 @@ class DetailViewController: BaseViewController {
/// The feed detail view controller, if using `top`, `bottom`, or `grid` layout. `nil` if using `left` layout.
var feedDetailViewController: FeedDetailViewController?
/// The grid detail view controller, if using `grid` layout. `nil` for other layouts.
var gridDetailViewController: GridDetailViewController?
/// The horizontal page view controller. [Not currently used; might be used for #1351 (gestures in vertical scrolling).]
// var horizontalPageViewController: HorizontalPageViewController?
@ -250,13 +247,6 @@ class DetailViewController: BaseViewController {
tidyNavigationController()
}
/// Reloads the grid view, if it is displayed.
@objc func reloadGrid() {
if layout == .grid {
gridDetailViewController?.reload()
}
}
/// Adjusts the container when autoscrolling. Only applies to iPhone.
@objc func adjustForAutoscroll() {
adjustTopConstraint()
@ -338,11 +328,6 @@ private extension DetailViewController {
func checkViewControllers() {
let isTop = layout == .top
if layout != .grid, gridDetailViewController != nil {
remove(viewController: gridDetailViewController)
gridDetailViewController = nil
}
if layout == .left {
if feedDetailViewController != nil {
remove(viewController: feedDetailViewController)
@ -357,12 +342,10 @@ private extension DetailViewController {
dividerViewBottomConstraint.constant = -13
} else if layout == .grid {
if gridDetailViewController == nil {
gridDetailViewController = Storyboards.shared.controller(withIdentifier: .gridDetail) as? GridDetailViewController
if feedDetailViewController == nil {
feedDetailViewController = Storyboards.shared.controller(withIdentifier: .feedDetail) as? FeedDetailViewController
add(viewController: gridDetailViewController, top: true)
add(viewController: feedDetailViewController, top: false)
add(viewController: feedDetailViewController, top: true)
supplementaryFeedDetailNavigationController = appDelegate.feedDetailNavigationController
supplementaryFeedDetailViewController = appDelegate.feedDetailViewController

View file

@ -148,6 +148,10 @@ static UIFont *indicatorFont = nil;
@end
@implementation FeedDetailSwipableCell
@end
@implementation FeedDetailContentView
- (void)drawRect:(CGRect)r {

View file

@ -663,7 +663,6 @@ typedef NS_ENUM(NSUInteger, MarkReadShowMenu)
[self beginOfflineTimer];
[appDelegate.cacheImagesOperationQueue cancelAllOperations];
[self reload];
[appDelegate.detailViewController reloadGrid];
}
- (void)reloadStories {
@ -1345,8 +1344,6 @@ typedef NS_ENUM(NSUInteger, MarkReadShowMenu)
[self testForTryFeed];
}
[appDelegate.detailViewController reloadGrid];
dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_LOW, 0ul);
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 0.1 * NSEC_PER_SEC),
queue, ^(void) {

View file

@ -91,7 +91,7 @@ extension FeedDetailViewController {
self.prepareFeedCell(cell, indexPath: indexPath)
}
let storyCellRegistration = UICollectionView.CellRegistration<GridStoryCell, Int> { (cell, indexPath, identifier) in
let storyCellRegistration = UICollectionView.CellRegistration<StoryPagesCollectionCell, Int> { (cell, indexPath, identifier) in
//TODO: 🚧
cell.contentView.backgroundColor = UIColor.blue
@ -116,9 +116,15 @@ extension FeedDetailViewController {
if storyCount > 1 {
let selectedIndex = max(appDelegate.storiesCollection.indexOfActiveStory(), 0)
snapshot.appendItems(Array(0..<selectedIndex - 1), toSection: .feedBeforeStory)
if selectedIndex > 0 {
snapshot.appendItems(Array(0..<selectedIndex - 1), toSection: .feedBeforeStory)
}
snapshot.appendItems([selectedIndex], toSection: .selectedStory)
snapshot.appendItems(Array(selectedIndex + 1..<storyCount), toSection: .feedAfterStory)
if selectedIndex < storyCount - 1 {
snapshot.appendItems(Array(selectedIndex + 1..<storyCount), toSection: .feedAfterStory)
}
}
snapshot.appendItems([0], toSection: .loading)

View file

@ -94,7 +94,7 @@ extension GridDetailViewController {
//TODO: 🚧
}
let storyCellRegistration = UICollectionView.CellRegistration<GridStoryCell, Int> { (cell, indexPath, identifier) in
let storyCellRegistration = UICollectionView.CellRegistration<StoryPagesCollectionCell, Int> { (cell, indexPath, identifier) in
//TODO: 🚧
cell.contentView.backgroundColor = UIColor.blue
}

View file

@ -1,5 +1,5 @@
//
// GridStoryCell.swift
// StoryPagesCollectionCell.swift
// NewsBlur
//
// Created by David Sinclair on 2022-08-19.
@ -9,7 +9,7 @@
import UIKit
/// Collection view cell for a story.
class GridStoryCell: UICollectionViewCell {
static let reuseIdentifier = "GridStoryCell"
class StoryPagesCollectionCell: UICollectionViewCell {
static let reuseIdentifier = "StoryPagesCollectionCell"
}

View file

@ -82,7 +82,7 @@
177551DF238E228A00E27818 /* Old NewsBlur Latest.appex in Embed App Extensions */ = {isa = PBXBuildFile; fileRef = 177551D3238E228A00E27818 /* Old NewsBlur Latest.appex */; platformFilter = ios; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
177D017828B056C600F2F2DB /* GridDetailViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 177D017728B056C600F2F2DB /* GridDetailViewController.swift */; };
177D017B28B05D2500F2F2DB /* GridFeedCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 177D017A28B05D2500F2F2DB /* GridFeedCell.swift */; };
177D017D28B05D9500F2F2DB /* GridStoryCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 177D017C28B05D9500F2F2DB /* GridStoryCell.swift */; };
177D017D28B05D9500F2F2DB /* StoryPagesCollectionCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 177D017C28B05D9500F2F2DB /* StoryPagesCollectionCell.swift */; };
17813FB723AC6E450057FB16 /* WidgetErrorTableViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 17CE3F0523AC529B003152EF /* WidgetErrorTableViewCell.xib */; };
1787083024F8B3A50000C82B /* StoryDetailViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1787082F24F8B3A50000C82B /* StoryDetailViewController.swift */; };
17876B9E1C9911D40055DD15 /* g_icn_folder_rss_sm.png in Resources */ = {isa = PBXBuildFile; fileRef = 17876B9A1C9911D40055DD15 /* g_icn_folder_rss_sm.png */; };
@ -828,7 +828,7 @@
177551E3238E26BF00E27818 /* Widget Extension.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = "Widget Extension.entitlements"; sourceTree = "<group>"; };
177D017728B056C600F2F2DB /* GridDetailViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GridDetailViewController.swift; sourceTree = "<group>"; };
177D017A28B05D2500F2F2DB /* GridFeedCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GridFeedCell.swift; sourceTree = "<group>"; };
177D017C28B05D9500F2F2DB /* GridStoryCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GridStoryCell.swift; sourceTree = "<group>"; };
177D017C28B05D9500F2F2DB /* StoryPagesCollectionCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StoryPagesCollectionCell.swift; sourceTree = "<group>"; };
1787082F24F8B3A50000C82B /* StoryDetailViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StoryDetailViewController.swift; sourceTree = "<group>"; };
17876B9A1C9911D40055DD15 /* g_icn_folder_rss_sm.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = g_icn_folder_rss_sm.png; sourceTree = "<group>"; };
17876B9B1C9911D40055DD15 /* g_icn_folder_rss_sm@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "g_icn_folder_rss_sm@2x.png"; sourceTree = "<group>"; };
@ -1814,7 +1814,6 @@
children = (
177D017728B056C600F2F2DB /* GridDetailViewController.swift */,
177D017A28B05D2500F2F2DB /* GridFeedCell.swift */,
177D017C28B05D9500F2F2DB /* GridStoryCell.swift */,
);
name = Grid;
sourceTree = "<group>";
@ -2066,6 +2065,7 @@
171B6FFC25C4C7C8008638A9 /* StoryPagesViewController.swift */,
FF6A233016448E0700E15989 /* StoryPagesObjCViewController.h */,
FF6A233116448E0700E15989 /* StoryPagesObjCViewController.m */,
177D017C28B05D9500F2F2DB /* StoryPagesCollectionCell.swift */,
170E3CD224F8A89B009CE819 /* HorizontalPageViewController.swift */,
172AD263251D901D000BB264 /* HorizontalPageDelegate.swift */,
1787082F24F8B3A50000C82B /* StoryDetailViewController.swift */,
@ -3721,7 +3721,7 @@
FF2924E61E932D2900FCFA63 /* PINDiskCache.m in Sources */,
7843F50511EEB1A000675F64 /* FeedDetailCollectionCell.m in Sources */,
784B50ED127E3F68008F90EA /* LoginViewController.m in Sources */,
177D017D28B05D9500F2F2DB /* GridStoryCell.swift in Sources */,
177D017D28B05D9500F2F2DB /* StoryPagesCollectionCell.swift in Sources */,
FF5ACC241DE5F0C000FBD044 /* NotificationsViewController.m in Sources */,
FFCDD8FE17F6368F000C6483 /* MCSwipeTableViewCell.m in Sources */,
78095EC9128F30B500230C8E /* OriginalStoryViewController.m in Sources */,

View file

@ -14,7 +14,7 @@
<objects>
<viewController storyboardIdentifier="DetailViewController" useStoryboardIdentifierAsRestorationIdentifier="YES" id="djW-7k-haK" customClass="DetailViewController" customModule="NewsBlur" customModuleProvider="target" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="jTZ-4O-xyT">
<rect key="frame" x="0.0" y="0.0" width="818.5" height="834"/>
<rect key="frame" x="0.0" y="0.0" width="1194" height="834"/>
<subviews>
<containerView opaque="NO" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="bPa-u1-Aml">
<rect key="frame" x="0.0" y="74" width="1194" height="580"/>