If database empty, add releases feed
This commit is contained in:
@@ -17,7 +17,7 @@ and this project does adhere to [Semantic Versioning](https://semver.org/spec/v2
|
|||||||
- *Settings, Feeds:* OPML export with selected items only
|
- *Settings, Feeds:* OPML export with selected items only
|
||||||
- *UI:* Accessibility hints for most UI elements
|
- *UI:* Accessibility hints for most UI elements
|
||||||
- *UI*: Show welcome message upon first usage (empty db)
|
- *UI*: Show welcome message upon first usage (empty db)
|
||||||
- *DB*: Table for options. E.g., with what version was the db last used
|
- Welcome message also adds Github releases feed
|
||||||
- Associate OPML files (double click and right click actions in Finder)
|
- Associate OPML files (double click and right click actions in Finder)
|
||||||
- Quick Look preview for OPML files
|
- Quick Look preview for OPML files
|
||||||
|
|
||||||
@@ -37,6 +37,7 @@ and this project does adhere to [Semantic Versioning](https://semver.org/spec/v2
|
|||||||
- *Settings, Feeds:* Always append new items at the end
|
- *Settings, Feeds:* Always append new items at the end
|
||||||
- *Adding feed:* Display error reason if user cancels the creation of a new feed item
|
- *Adding feed:* Display error reason if user cancels the creation of a new feed item
|
||||||
- *Adding feed:* Refresh interval hotkeys set to: `⌘1` … `⌘6`
|
- *Adding feed:* Refresh interval hotkeys set to: `⌘1` … `⌘6`
|
||||||
|
- *DB*: New table for options. E.g., what app version modified the database
|
||||||
|
|
||||||
|
|
||||||
## [0.9.4] - 2019-04-02
|
## [0.9.4] - 2019-04-02
|
||||||
|
|||||||
@@ -51,11 +51,12 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
|
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
|
||||||
|
[_statusItem asyncReloadUnreadCount];
|
||||||
|
[FeedDownload registerNetworkChangeNotification]; // will call update scheduler
|
||||||
if ([StoreCoordinator isEmpty]) {
|
if ([StoreCoordinator isEmpty]) {
|
||||||
[_statusItem showWelcomeMessage];
|
[_statusItem showWelcomeMessage];
|
||||||
|
[FeedDownload autoDownloadAndParseUpdateURL];
|
||||||
}
|
}
|
||||||
[FeedDownload registerNetworkChangeNotification]; // will call update scheduler
|
|
||||||
[_statusItem asyncReloadUnreadCount];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)applicationWillTerminate:(NSNotification *)aNotification {
|
- (void)applicationWillTerminate:(NSNotification *)aNotification {
|
||||||
@@ -71,7 +72,7 @@
|
|||||||
url = [url substringFromIndex:2];
|
url = [url substringFromIndex:2];
|
||||||
}
|
}
|
||||||
if ([scheme isEqualToString:@"feed"]) {
|
if ([scheme isEqualToString:@"feed"]) {
|
||||||
[FeedDownload autoDownloadAndParseURL:url successBlock:nil];
|
[FeedDownload autoDownloadAndParseURL:url addAnyway:NO modify:nil];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -30,6 +30,8 @@
|
|||||||
|
|
||||||
/// UTI type used for opml files
|
/// UTI type used for opml files
|
||||||
static NSPasteboardType const UTI_OPML = @"org.opml";
|
static NSPasteboardType const UTI_OPML = @"org.opml";
|
||||||
|
/// URL with newest baRSS releases. Automatically added when user starts baRSS for the first time.
|
||||||
|
static NSString* const versionUpdateURL = @"https://github.com/relikd/baRSS/releases.atom";
|
||||||
|
|
||||||
|
|
||||||
#pragma mark - NSImageName constants
|
#pragma mark - NSImageName constants
|
||||||
|
|||||||
@@ -39,7 +39,8 @@
|
|||||||
+ (void)forceUpdateAllFeeds;
|
+ (void)forceUpdateAllFeeds;
|
||||||
// Downloading
|
// Downloading
|
||||||
+ (void)newFeed:(NSString *)urlStr askUser:(nonnull NSString*(^)(RSHTMLMetadata *meta))askUser block:(nonnull void(^)(RSParsedFeed *parsed, NSError *error, NSHTTPURLResponse *response))block;
|
+ (void)newFeed:(NSString *)urlStr askUser:(nonnull NSString*(^)(RSHTMLMetadata *meta))askUser block:(nonnull void(^)(RSParsedFeed *parsed, NSError *error, NSHTTPURLResponse *response))block;
|
||||||
+ (void)autoDownloadAndParseURL:(NSString*)urlStr successBlock:(nullable os_block_t)block;
|
+ (void)autoDownloadAndParseURL:(NSString*)urlStr addAnyway:(BOOL)flag modify:(nullable void(^)(Feed *feed))block;
|
||||||
|
+ (void)autoDownloadAndParseUpdateURL;
|
||||||
+ (void)batchDownloadFeeds:(NSArray<Feed*> *)list favicons:(BOOL)fav showErrorAlert:(BOOL)alert finally:(nullable os_block_t)block;
|
+ (void)batchDownloadFeeds:(NSArray<Feed*> *)list favicons:(BOOL)fav showErrorAlert:(BOOL)alert finally:(nullable os_block_t)block;
|
||||||
// Favicon image download
|
// Favicon image download
|
||||||
+ (void)downloadFavicon:(NSString*)urlStr finished:(void(^)(NSImage * _Nullable img))block;
|
+ (void)downloadFavicon:(NSString*)urlStr finished:(void(^)(NSImage * _Nullable img))block;
|
||||||
|
|||||||
@@ -26,6 +26,7 @@
|
|||||||
#import "Feed+Ext.h"
|
#import "Feed+Ext.h"
|
||||||
#import "FeedMeta+Ext.h"
|
#import "FeedMeta+Ext.h"
|
||||||
#import "FeedGroup+Ext.h"
|
#import "FeedGroup+Ext.h"
|
||||||
|
#import "NSDate+Ext.h"
|
||||||
|
|
||||||
#import <SystemConfiguration/SystemConfiguration.h>
|
#import <SystemConfiguration/SystemConfiguration.h>
|
||||||
|
|
||||||
@@ -342,24 +343,33 @@ static BOOL _nextUpdateIsForced = NO;
|
|||||||
Creates new @c FeedGroup, @c Feed, @c FeedMeta and @c FeedArticle instances and saves them to the persistent store.
|
Creates new @c FeedGroup, @c Feed, @c FeedMeta and @c FeedArticle instances and saves them to the persistent store.
|
||||||
Update duration is set to the default of 30 minutes.
|
Update duration is set to the default of 30 minutes.
|
||||||
*/
|
*/
|
||||||
+ (void)autoDownloadAndParseURL:(NSString*)url successBlock:(nullable os_block_t)block {
|
+ (void)autoDownloadAndParseURL:(NSString*)url addAnyway:(BOOL)flag modify:(nullable void(^)(Feed *feed))block {
|
||||||
NSManagedObjectContext *moc = [StoreCoordinator createChildContext];
|
NSManagedObjectContext *moc = [StoreCoordinator createChildContext];
|
||||||
Feed *f = [Feed appendToRootWithDefaultIntervalInContext:moc];
|
Feed *f = [Feed appendToRootWithDefaultIntervalInContext:moc];
|
||||||
f.meta.url = url;
|
f.meta.url = url;
|
||||||
[self backgroundUpdateBoth:f favicon:YES alert:YES finally:^(BOOL successful){
|
[self backgroundUpdateBoth:f favicon:YES alert:!flag finally:^(BOOL successful){
|
||||||
if (!successful) {
|
if (!flag && !successful) {
|
||||||
[moc deleteObject:f.group];
|
[moc deleteObject:f.group];
|
||||||
|
} else if (block) {
|
||||||
|
block(f); // only on success
|
||||||
}
|
}
|
||||||
[StoreCoordinator saveContext:moc andParent:YES];
|
[StoreCoordinator saveContext:moc andParent:YES];
|
||||||
[moc reset];
|
[moc reset];
|
||||||
if (successful) {
|
if (successful) {
|
||||||
PostNotification(kNotificationGroupInserted, f.group.objectID);
|
PostNotification(kNotificationGroupInserted, f.group.objectID);
|
||||||
[self scheduleUpdateForUpcomingFeeds];
|
[self scheduleUpdateForUpcomingFeeds];
|
||||||
if (block) block();
|
|
||||||
}
|
}
|
||||||
}];
|
}];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Insert Github URL for version releases with update interval 2 days and rename @c FeedGroup item.
|
||||||
|
+ (void)autoDownloadAndParseUpdateURL {
|
||||||
|
[self autoDownloadAndParseURL:versionUpdateURL addAnyway:YES modify:^(Feed *feed) {
|
||||||
|
feed.group.name = NSLocalizedString(@"baRSS releases", nil);
|
||||||
|
[feed.meta setRefreshAndSchedule:2 * TimeUnitDays];
|
||||||
|
}];
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Start download of feed xml, then continue with favicon download (optional).
|
Start download of feed xml, then continue with favicon download (optional).
|
||||||
|
|
||||||
|
|||||||
@@ -60,7 +60,7 @@
|
|||||||
</dict>
|
</dict>
|
||||||
</array>
|
</array>
|
||||||
<key>CFBundleVersion</key>
|
<key>CFBundleVersion</key>
|
||||||
<string>10158</string>
|
<string>10180</string>
|
||||||
<key>LSApplicationCategoryType</key>
|
<key>LSApplicationCategoryType</key>
|
||||||
<string>public.app-category.news</string>
|
<string>public.app-category.news</string>
|
||||||
<key>LSMinimumSystemVersion</key>
|
<key>LSMinimumSystemVersion</key>
|
||||||
|
|||||||
Reference in New Issue
Block a user