Commit Graph

1059 Commits

Author SHA1 Message Date
Tim Ekl f12e8b4a4a Fix errors in starred articles operations tests
Pull the same do/catch/Result.get() trick as previously for completion
blocks which now take Results. `try` a few throwing calls.
2019-12-31 19:11:37 -06:00
Tim Ekl 6a4f3fb11e Fix build errors in sync stream operations tests
Prefix two throwing calls with `try`. Label the enclosing test functions
with `throws` so the XCTest machinery helps us with error reporting.
2019-12-31 19:08:29 -06:00
Tim Ekl 6583688e38 Fix errors in Feedly unread operations tests
Most fetch completion blocks took a parameter that was expected to be
some result data type, but is now a Result. Rename these parameters;
wrap their existing bodies in do/catch blocks; and recreate the original
underlying variable using the result of `Result.get()`.

Prepend a few synchronous calls that started throwing with `try` along
the way.
2019-12-31 19:06:10 -06:00
Tim Ekl ae1651fad1 Fix errors in Feedly update-feeds operation tests
Mark some throwing calls with `try`; mark the enclosing test functions
with `throws`, letting the XCTest framework handle error reporting for
us.
2019-12-31 15:55:59 -06:00
Tim Ekl f82be27666 Resolve errors in Feedly statuses operation tests
Add `error` parameters to completion blocks which now pass them. Assert
these errors are always nil in the existing tests.

Flip calls to `selectPendingCount()` so they are async, with a
completion block that asserts about the results instead of asserting
about the return value. Since the closure takes a Result, unwrap it in a
do/catch block at each site; `XCTAssertNoThrow` doesn't help us bubble a
value out from `Result.get()`, and I'd rather not use `try!` here. There
might be a stylistic discussion to be had about this unwrapping, though.
2019-12-31 15:52:54 -06:00
Kiel Gillard 3b47edfba7 Models the feed identifier of feedly articles as an optional since it seems the Feedly API will not always provide one (despite the API documentation).
Additional, more elegantly handle the failure to parse an article when Feedly does not provide a matching feed.
2019-12-31 08:47:27 +11:00
Brent Simmons 388886a355 Base our active articles window on dateArrived instead of datePublished. This reverses a recent change that led to some bugs. 2019-12-28 22:20:13 -08:00
Brent Simmons ac519c5c90 Add new and updated articles to the in-memory cache when saving articles. 2019-12-28 21:19:02 -08:00
Brent Simmons 26bb2b8eaf Remove references to Article.bannerImageURL. We can bring it back if/when we start using it. 2019-12-28 20:53:36 -08:00
Brent Simmons aeaeac61fc Get rid of DatabaseArticle entirely. Cache Article objects. This will make fetches faster *and* save memory. 2019-12-27 22:47:02 -08:00
Brent Simmons 3a33c38d5c Use an inner function in FeedbinAccountDelegate.refreshMissingArticles. I like this pattern because 1) it keeps the switch statement and its cases near each other, and 2) it puts all the actual processing in a single function, which makes it easier to see where processing happens. 2019-12-17 21:24:17 -08:00
Brent Simmons db564d9cf9 Remove all references to fetchArticleIDsForStatusesWithoutArticles. Use fetchArticleIDsForStatusesWithoutArticlesNewerThanCutoffDate instead. 2019-12-17 21:15:20 -08:00
Maurice Parker 236f581d95 Update Feedbin to use fetchArticleIDsForStatusesWithoutArticlesNewerThanCutoffDate for missing articles. 2019-12-17 17:43:08 -07:00
Kiel Gillard 40dacd6522 Update set starred articles operation to honour database errors. 2019-12-18 09:45:30 +11:00
Kiel Gillard 5a9b138a9d Update set unraed articles operation to honour database errors. 2019-12-18 09:42:08 +11:00
Kiel Gillard 7ddcb2fc8e Add optional completions to avoid race conditions involving these marked statuses. 2019-12-18 09:41:45 +11:00
Kiel Gillard 6fb0e2e0d0 Honour the error case when ingesting read and star statuses 2019-12-18 09:32:58 +11:00
Kiel Gillard bd307cbb6c Give the FeedlySyncStarredArticlesOperation a delegate so that if the database becomes suspended, the remainder of the sync operation cancels. 2019-12-18 09:26:57 +11:00
Kiel Gillard 311f5b2e81 Check the account update error when update a Feedly account and finish with an error, indicating to its delegate that remaining operations should cancel. 2019-12-18 09:19:00 +11:00
Maurice Parker 73d6d5f5d5 Merge branch 'master' of https://github.com/brentsimmons/NetNewsWire 2019-12-17 14:29:53 -07:00
Brent Simmons 948d366a4e Created fetchArticleIDsForStatusesWithoutArticlesNewerThanCutoffDate — this gets articleIDs of articles we care about. They’re not deleted. They’re either (starred) or (unread and newer than cutoffDate). Also: it’s async. Use this instead of fetchArticleIDsForStatusesWithoutArticles, which is deprecated. 2019-12-17 13:28:48 -08:00
Maurice Parker b637a6f01b Process the article downloads in smaller transaction groups to make possible to interrupt. Issue #1437. 2019-12-17 14:28:04 -07:00
Maurice Parker 7192a6893e Change Feedbin to always check the error from Account.update. 2019-12-17 13:25:01 -07:00
Brent Simmons 567a971a1c Remove no-longer-used fetchStatuses functions. 2019-12-16 23:09:46 -08:00
Brent Simmons 704ccb2927 Remove no-longer-used ensureStatuses functions. 2019-12-16 23:06:21 -08:00
Brent Simmons e2db7b4a5d Fix bug where completion wasn’t getting called on the main thread. 2019-12-16 22:56:38 -08:00
Brent Simmons e8045b0e8b Merge branch 'master' of https://github.com/brentsimmons/NetNewsWire 2019-12-16 22:46:24 -08:00
Brent Simmons 15184aa3f1 Finish changes mandated by DatabaseQueue changes. 2019-12-16 22:45:59 -08:00
Brent Simmons 3c8097404f Make progress on update ArticleFetcher to handle DatabaseQueue changes. 2019-12-16 17:04:00 -08:00
Brent Simmons 51393967e2 Finish making Account and AccountManager compatible with DatabaseQueue changes. 2019-12-16 17:03:41 -08:00
Brent Simmons 9516392c61 Make two more Feedly operations compatible with DatabaseQueue changes. 2019-12-16 17:03:05 -08:00
Brent Simmons 3883d24ebe Simplify FeedlySetUnreadArticlesOperation. 2019-12-16 16:26:35 -08:00
Brent Simmons 67f65545b3 Continue changes mandated by DatabaseQueue changes. 2019-12-16 15:55:37 -08:00
Brent Simmons e700da9410 Mark appropriate functions as throws. 2019-12-16 15:32:08 -08:00
Brent Simmons f2052f110f Make updateUnreadCounts compatible with database changes. 2019-12-16 14:59:15 -08:00
Brent Simmons 9a36051d8a Remove a reference to database.isSuspended. 2019-12-16 14:43:25 -08:00
Brent Simmons 908652df51 Make just one database call in fetchUnreadCounts — use fetchAllUnreadCounts and process the UnreadCountDictionary. 2019-12-16 14:43:11 -08:00
Maurice Parker 9dad3f0540 Pass the account metadata to delegate on initialization 2019-12-16 14:19:55 -07:00
Brent Simmons aa5859ff27 Use makeDatabaseCalls/switch pattern in ArticlesTable. 2019-12-16 12:49:46 -08:00
Brent Simmons 3981312d6f Update sync code to handle async selectForProcessing. 2019-12-16 12:49:07 -08:00
Brent Simmons 7b7346d010 Make selectForProcessing async. 2019-12-16 11:08:47 -08:00
Brent Simmons 7a134740ec Make SyncDatabase selectPendingCount async. 2019-12-16 10:50:13 -08:00
Brent Simmons 894d3909a3 Make SyncDatabase work with DatabaseQueue changes. 2019-12-15 23:07:28 -08:00
Brent Simmons e0f61c362b Switch to using the new DatabaseError. 2019-12-15 22:37:45 -08:00
Brent Simmons 1f65b3fc87 Remove isSuspended property; add a try! when creating tables. 2019-12-15 22:28:48 -08:00
Brent Simmons df45484205 Update Articles.framework to use revised DatabaseQueue — use Result types and throwing functions. 2019-12-15 22:09:27 -08:00
Brent Simmons 9cb0bcbc94 Make ArticlesDatabase.swift compatible with the DatabaseQueue revisions. 2019-12-15 17:26:45 -08:00
Maurice Parker 58b24f3349 Rename callback: to completion: 2019-12-14 18:01:34 -07:00
Maurice Parker 43bf65b7a6 Rename occurrences of completionHandler to completion. 2019-12-14 17:14:55 -07:00
Brent Simmons 45cdb7bea3 Create a fetchStatuses method that will optionally create statuses if needed. Callback gets Set<ArticleStatus> — or nil if the app is suspended. 2019-12-11 22:28:01 -08:00