Add TodayFeedDelegate. Start work on fetching unread count for Today pseudo-feed.

This commit is contained in:
Brent Simmons 2017-11-19 12:12:43 -08:00
parent 1cc532faa1
commit e681007bbe
3 changed files with 31 additions and 1 deletions

View File

@ -14,6 +14,7 @@
842E45E71ED8C747000A8B52 /* DB5.plist in Resources */ = {isa = PBXBuildFile; fileRef = 842E45E61ED8C747000A8B52 /* DB5.plist */; };
84513F901FAA63950023A1A9 /* FeedListControlsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84513F8F1FAA63950023A1A9 /* FeedListControlsView.swift */; };
845B14921FC2028A0013CF92 /* PseudoFeed.swift in Sources */ = {isa = PBXBuildFile; fileRef = 845B14911FC2028A0013CF92 /* PseudoFeed.swift */; };
845B14A21FC21A080013CF92 /* TodayFeedDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 845B14A11FC21A080013CF92 /* TodayFeedDelegate.swift */; };
845F52ED1FB2B9FC00C10BF0 /* FeedPasteboardWriter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 845F52EC1FB2B9FC00C10BF0 /* FeedPasteboardWriter.swift */; };
846E773D1F6EF67A00A165E2 /* Account.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 846E773A1F6EF5D700A165E2 /* Account.framework */; };
846E773E1F6EF67A00A165E2 /* Account.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 846E773A1F6EF5D700A165E2 /* Account.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
@ -398,6 +399,7 @@
842E45E61ED8C747000A8B52 /* DB5.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = DB5.plist; path = Evergreen/Resources/DB5.plist; sourceTree = "<group>"; };
84513F8F1FAA63950023A1A9 /* FeedListControlsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FeedListControlsView.swift; sourceTree = "<group>"; };
845B14911FC2028A0013CF92 /* PseudoFeed.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PseudoFeed.swift; sourceTree = "<group>"; };
845B14A11FC21A080013CF92 /* TodayFeedDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TodayFeedDelegate.swift; sourceTree = "<group>"; };
845F52EC1FB2B9FC00C10BF0 /* FeedPasteboardWriter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FeedPasteboardWriter.swift; sourceTree = "<group>"; };
846E77161F6EF5D000A165E2 /* Database.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = Database.xcodeproj; path = Frameworks/Database/Database.xcodeproj; sourceTree = "<group>"; };
846E77301F6EF5D600A165E2 /* Account.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = Account.xcodeproj; path = Frameworks/Account/Account.xcodeproj; sourceTree = "<group>"; };
@ -590,6 +592,7 @@
isa = PBXGroup;
children = (
845B14911FC2028A0013CF92 /* PseudoFeed.swift */,
845B14A11FC21A080013CF92 /* TodayFeedDelegate.swift */,
849A97581ED9EB0D007D329B /* ArticleUtilities.swift */,
);
name = Data;
@ -1255,6 +1258,7 @@
files = (
84F204E01FAACBB30076E152 /* ArticleArray.swift in Sources */,
849C64641ED37A5D003D8FC0 /* AppDelegate.swift in Sources */,
845B14A21FC21A080013CF92 /* TodayFeedDelegate.swift in Sources */,
84513F901FAA63950023A1A9 /* FeedListControlsView.swift in Sources */,
84E46C7D1F75EF7B005ECFB3 /* AppDefaults.swift in Sources */,
842E45CE1ED8C308000A8B52 /* AppNotifications.swift in Sources */,

View File

@ -0,0 +1,20 @@
//
// TodayFeedDelegate.swift
// Evergreen
//
// Created by Brent Simmons on 11/19/17.
// Copyright © 2017 Ranchero Software. All rights reserved.
//
import Foundation
import Account
struct TodayFeedDelegate: PseudoFeedDelegate {
let nameForDisplay = NSLocalizedString("Today", comment: "Today pseudo-feed title")
func fetchUnreadCount(for account: Account, callback: (Int) -> Void) {
account.fetchUnreadCountForToday(callback)
}
}

View File

@ -323,7 +323,13 @@ public final class Account: DisplayNameProvider, UnreadCountProvider, Container,
return database.fetchUnreadArticles(for: folder.flattenedFeeds())
}
public func fetchUnreadCountForToday(_ callback: (Int) -> Void) {
let startOfToday = NSCalendar.startOfToday()
}
// MARK: - Notifications
@objc func downloadProgressDidChange(_ note: Notification) {