feat: restore macOS 10.13 compatibility
This commit is contained in:
@@ -5,7 +5,7 @@ CODE_SIGN_STYLE = Manual
|
||||
CODE_SIGN_IDENTITY = Apple Development
|
||||
ENABLE_HARDENED_RUNTIME = YES
|
||||
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.14
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.13
|
||||
MARKETING_VERSION = 1.6.1
|
||||
PRODUCT_NAME = baRSS
|
||||
PRODUCT_BUNDLE_IDENTIFIER = de.relikd.baRSS
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
[](#download--install)
|
||||
[](#download--install)
|
||||
[](https://github.com/relikd/baRSS/releases)
|
||||
[](https://github.com/relikd/baRSS/releases)
|
||||
[](LICENSE)
|
||||
@@ -35,7 +35,7 @@ Further, tuning the update frequently will decrease the traffic even more.
|
||||
Download & Install
|
||||
------------------
|
||||
|
||||
Requires macOS Mojave (10.14) or higher.
|
||||
Requires macOS High Sierra (10.13) or higher.
|
||||
|
||||
### Easy way
|
||||
Go to [releases](https://github.com/relikd/baRSS/releases) and downloaded the latest version.
|
||||
|
||||
@@ -47,9 +47,11 @@
|
||||
if (initial) [UpdateScheduler updateAllFavicons];
|
||||
}
|
||||
|
||||
// Notifications are disabled by default so this wont trigger for first app launch.
|
||||
// Also, this will register the notification delegate and respond to click & open feed.
|
||||
[NotifyEndpoint activate];
|
||||
if (@available(macOS 10.14, *)) {
|
||||
// Notifications are disabled by default so this wont trigger for first app launch.
|
||||
// Also, this will register the notification delegate and respond to click & open feed.
|
||||
[NotifyEndpoint activate];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)applicationWillTerminate:(NSNotification *)aNotification {
|
||||
|
||||
@@ -129,7 +129,9 @@
|
||||
if (deletingSet.count > 0) {
|
||||
[localSet minusSet:deletingSet];
|
||||
[self removeArticles:deletingSet];
|
||||
[NotifyEndpoint dismiss:dismissed];
|
||||
if (@available(macOS 10.14, *)) {
|
||||
[NotifyEndpoint dismiss:dismissed];
|
||||
}
|
||||
}
|
||||
return c;
|
||||
}
|
||||
|
||||
@@ -91,7 +91,9 @@
|
||||
NSNumber *num = (fa.unread ? @+1 : @-1);
|
||||
PostNotification(kNotificationTotalUnreadCountChanged, num);
|
||||
|
||||
[NotifyEndpoint dismiss:fa.feed.countUnread > 0 ? @[fa.notificationID] : @[fa.notificationID, fa.feed.notificationID]];
|
||||
if (@available(macOS 10.14, *)) {
|
||||
[NotifyEndpoint dismiss:fa.feed.countUnread > 0 ? @[fa.notificationID] : @[fa.notificationID, fa.feed.notificationID]];
|
||||
}
|
||||
}
|
||||
[moc reset];
|
||||
}
|
||||
|
||||
@@ -211,26 +211,28 @@ static inline void AlertDownloadError(NSError *err, NSString *url) {
|
||||
|
||||
// after save, update notifications
|
||||
// dismiss previously delivered notifications
|
||||
if (deleted) {
|
||||
NSMutableArray *ids = [NSMutableArray array];
|
||||
for (FeedArticle *article in deleted) { // will contain non-articles too
|
||||
if ([article isKindOfClass:[FeedArticle class]] || [article isKindOfClass:[Feed class]]) {
|
||||
[ids addObject:article.notificationID];
|
||||
if (@available(macOS 10.14, *)) {
|
||||
if (deleted) {
|
||||
NSMutableArray *ids = [NSMutableArray array];
|
||||
for (FeedArticle *article in deleted) { // will contain non-articles too
|
||||
if ([article isKindOfClass:[FeedArticle class]] || [article isKindOfClass:[Feed class]]) {
|
||||
[ids addObject:article.notificationID];
|
||||
}
|
||||
}
|
||||
[NotifyEndpoint dismiss:ids]; // no-op if empty
|
||||
}
|
||||
[NotifyEndpoint dismiss:ids]; // no-op if empty
|
||||
}
|
||||
// post new notification (if needed)
|
||||
if (notify && inserted) {
|
||||
BOOL didAddAny = NO;
|
||||
for (FeedArticle *article in inserted) { // will contain non-articles too
|
||||
if ([article isKindOfClass:[FeedArticle class]]) {
|
||||
[NotifyEndpoint postArticle:article];
|
||||
didAddAny = YES;
|
||||
// post new notification (if needed)
|
||||
if (notify && inserted) {
|
||||
BOOL didAddAny = NO;
|
||||
for (FeedArticle *article in inserted) { // will contain non-articles too
|
||||
if ([article isKindOfClass:[FeedArticle class]]) {
|
||||
[NotifyEndpoint postArticle:article];
|
||||
didAddAny = YES;
|
||||
}
|
||||
}
|
||||
if (didAddAny)
|
||||
[NotifyEndpoint postFeed:f];
|
||||
}
|
||||
if (didAddAny)
|
||||
[NotifyEndpoint postFeed:f];
|
||||
}
|
||||
|
||||
if (needsNotification)
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
API_AVAILABLE(macos(10.14))
|
||||
@interface NotifyEndpoint : NSObject <UNUserNotificationCenterDelegate>
|
||||
+ (void)activate;
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@ static NSString* const kActionOpenOnly = @"OPEN_ONLY_DONT_MARK_READ";
|
||||
|
||||
@implementation NotifyEndpoint
|
||||
|
||||
API_AVAILABLE(macos(10.14))
|
||||
static NotifyEndpoint *singleton = nil;
|
||||
static NotificationType notifyType;
|
||||
|
||||
|
||||
@@ -86,7 +86,9 @@
|
||||
- (void)changeNotificationType:(NSPopUpButton *)sender {
|
||||
UserPrefsSet(Pref_notificationType, sender.selectedItem.representedObject);
|
||||
self.view.notificationHelp.stringValue = [self notificationHelpString:UserPrefsNotificationType()];
|
||||
[NotifyEndpoint activate];
|
||||
if (@available(macOS 10.14, *)) {
|
||||
[NotifyEndpoint activate];
|
||||
}
|
||||
}
|
||||
|
||||
/// Help string explaining the different notification settings (for the current configuration)
|
||||
|
||||
@@ -77,7 +77,9 @@
|
||||
NSInteger oldCount = _unreadCountTotal;
|
||||
_unreadCountTotal = count > 0 ? (NSInteger)count : 0;
|
||||
[self updateBarIcon];
|
||||
[NotifyEndpoint setGlobalCount:_unreadCountTotal previousCount:oldCount];
|
||||
if (@available(macOS 10.14, *)) {
|
||||
[NotifyEndpoint setGlobalCount:_unreadCountTotal previousCount:oldCount];
|
||||
}
|
||||
}
|
||||
|
||||
/// Assign new value by adding @c count to total unread count (may be negative).
|
||||
@@ -88,7 +90,9 @@
|
||||
_unreadCountTotal = 0;
|
||||
}
|
||||
[self updateBarIcon];
|
||||
[NotifyEndpoint setGlobalCount:_unreadCountTotal previousCount:oldCount];
|
||||
if (@available(macOS 10.14, *)) {
|
||||
[NotifyEndpoint setGlobalCount:_unreadCountTotal previousCount:oldCount];
|
||||
}
|
||||
}
|
||||
|
||||
/// Fetch new total unread count from core data and assign it as new value (dispatch async on main thread).
|
||||
|
||||
@@ -206,8 +206,10 @@ typedef NS_ENUM(NSInteger, MenuItemTag) {
|
||||
}
|
||||
NSManagedObjectContext *moc = [StoreCoordinator createChildContext];
|
||||
NSArray<FeedArticle*> *list = [StoreCoordinator articlesAtPath:path isFeed:isFeedMenu sorted:openLinks unread:markRead inContext:moc limit:limit];
|
||||
[NotifyEndpoint dismiss:
|
||||
[StoreCoordinator updateArticles:list markRead:markRead andOpen:openLinks inContext:moc]];
|
||||
NSArray<NSString *> *notificationIds = [StoreCoordinator updateArticles:list markRead:markRead andOpen:openLinks inContext:moc];
|
||||
if (@available(macOS 10.14, *)) {
|
||||
[NotifyEndpoint dismiss:notificationIds];
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
Reference in New Issue
Block a user