Fix timeline customiser

This commit is contained in:
Stuart Breckenridge committed 2026-01-23 22:24:20 +08:00
1 parent 12f13d2378
commit 37591d0eac
3 files changed
+204 -157

No files matched your search

@@ -15,9 +15,9 @@ import Articles
final class TimelineCustomizerTableViewController: UITableViewController {
private var previewArticle: Article {
var components = DateComponents()
components.year = 1925
components.month = 4
components.day = 10
components.year = 1954
components.month = 7
components.day = 29
let calendar = Calendar.current
let date = calendar.date(from: components)!
@@ -26,9 +26,9 @@ final class TimelineCustomizerTableViewController: UITableViewController {
articleID: "_testArticleID",
feedID: "_testFeedID",
uniqueID: UUID().uuidString,
title: "Chapter 1",
title: "At The Sign Of The Prancing Pony",
contentHTML: nil,
contentText: "In my younger and more vulnerable years my father gave me some advice that I’ve been turning over in my mind ever since. “Whenever you feel like criticizing any one,” he told me, “just remember that all the people in this world haven’t had the advantages that you’ve had.”",
contentText: "Bree was the chief village of Bree-land, a small country a few miles broad whose chief claim to fame was its aluminum siding industry. The Men of Bree were cheerful and independant: they belonged to nobody but themselves. In the lands beyond Bree there were mysterious wanderers.",
markdown: nil,
url: nil,
externalURL: nil,
@@ -36,7 +36,7 @@ final class TimelineCustomizerTableViewController: UITableViewController {
imageURL: nil,
datePublished: date,
dateModified: nil,
authors: Set([Author(authorID: "_testAuthorID", name: "F. Scott Fitzgerald", url: nil, avatarURL: nil, emailAddress: nil)!]),
authors: Set([Author(authorID: "_testAuthorID", name: "J. R. R. Tolkien", url: nil, avatarURL: nil, emailAddress: nil)!]),
status: ArticleStatus(articleID: "_testArticleID", read: false, starred: false, dateArrived: .now))
}
@@ -75,45 +75,45 @@ final class TimelineCustomizerTableViewController: UITableViewController {
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
// if indexPath.section == 0 {
// let cell = tableView.dequeueReusableCell(withIdentifier: "IconSizeCell") as! ModernTimelineSliderCell
// cell.sliderConfiguration = .iconSize
// return cell
// }
//
// if indexPath.section == 1 {
// let cell = tableView.dequeueReusableCell(withIdentifier: "NumberOfLinesCell") as! ModernTimelineSliderCell
// cell.sliderConfiguration = .numberOfLines
// return cell
// }
//
// if indexPath.section == 2 {
// let cell = tableView.dequeueReusableCell(withIdentifier: "MainTimelineIconFeedCell") as? MainTimelineIconFeedCell ?? MainTimelineIconFeedCell()
// cell.cellData = MainTimelineCellData(article: previewArticle,
// showFeedName: .byline,
// feedName: "The Great Gatsby",
// byline: "F. Scott Fitzgerald",
// iconImage: IconImage(Assets.Images.nnwFeedIcon),
// showIcon: true,
// numberOfLines: AppDefaults.shared.timelineNumberOfLines,
// iconSize: AppDefaults.shared.timelineIconSize)
// cell.isPreview = true
// return cell
// }
//
// if indexPath.section == 3 {
// let cell = tableView.dequeueReusableCell(withIdentifier: "MainTimelineFeedCell") as? MainTimelineFeedCell ?? MainTimelineFeedCell()
// cell.cellData = MainTimelineCellData(article: previewArticle,
// showFeedName: .byline,
// feedName: "The Great Gatsby",
// byline: "F. Scott Fitzgerald",
// iconImage: nil,
// showIcon: false,
// numberOfLines: AppDefaults.shared.timelineNumberOfLines,
// iconSize: AppDefaults.shared.timelineIconSize)
// cell.isPreview = true
// return cell
// }
if indexPath.section == 0 {
let cell = tableView.dequeueReusableCell(withIdentifier: "IconSizeCell") as! ModernTimelineSliderCell
cell.sliderConfiguration = .iconSize
return cell
}
if indexPath.section == 1 {
let cell = tableView.dequeueReusableCell(withIdentifier: "NumberOfLinesCell") as! ModernTimelineSliderCell
cell.sliderConfiguration = .numberOfLines
return cell
}
if indexPath.section == 2 {
let cell = tableView.dequeueReusableCell(withIdentifier: standardCellIdentifierIcon) as! MainTimelineCell
cell.cellData = MainTimelineCellData(article: previewArticle,
showFeedName: .byline,
feedName: "The Fellowship of the Ring",
byline: "J. R. R. Tolkien",
iconImage: IconImage(Assets.Images.nnwFeedIcon),
showIcon: true,
numberOfLines: AppDefaults.shared.timelineNumberOfLines,
iconSize: AppDefaults.shared.timelineIconSize)
cell.isPreview = true
return cell
}
if indexPath.section == 3 {
let cell = tableView.dequeueReusableCell(withIdentifier: standardCellIdentifier) as! MainTimelineCell
cell.cellData = MainTimelineCellData(article: previewArticle,
showFeedName: .byline,
feedName: "The Fellowship of the Ring",
byline: "J. R. R. Tolkien",
iconImage: nil,
showIcon: false,
numberOfLines: AppDefaults.shared.timelineNumberOfLines,
iconSize: AppDefaults.shared.timelineIconSize)
cell.isPreview = true
return cell
}
return UITableViewCell()