From c310933623dba1e2612572595a35dc7d77695087 Mon Sep 17 00:00:00 2001 From: relikd Date: Sun, 11 Jan 2026 22:00:48 +0100 Subject: [PATCH] feat: restore macOS 10.13 compatibility --- Config.xcconfig | 2 +- README.md | 4 +-- baRSS/AppHook.m | 8 +++-- baRSS/Core Data/Feed+Ext.m | 4 ++- baRSS/Core Data/FeedArticle+Ext.m | 4 ++- baRSS/Feed Import/UpdateScheduler.m | 34 ++++++++++--------- baRSS/Notifications/NotifyEndpoint.h | 1 + baRSS/Notifications/NotifyEndpoint.m | 1 + .../Preferences/General Tab/SettingsGeneral.m | 4 ++- baRSS/Status Bar Menu/BarStatusItem.m | 8 +++-- baRSS/Status Bar Menu/NSMenu+Ext.m | 6 ++-- 11 files changed, 47 insertions(+), 29 deletions(-) diff --git a/Config.xcconfig b/Config.xcconfig index 755d184..b3492af 100644 --- a/Config.xcconfig +++ b/Config.xcconfig @@ -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 diff --git a/README.md b/README.md index 958a9dd..af24b7b 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![macOS 10.14+](https://img.shields.io/badge/macOS-10.14+-888)](#download--install) +[![macOS 10.13+](https://img.shields.io/badge/macOS-10.13+-888)](#download--install) [![Current release](https://img.shields.io/github/release/relikd/baRSS)](https://github.com/relikd/baRSS/releases) [![All downloads](https://img.shields.io/github/downloads/relikd/baRSS/total)](https://github.com/relikd/baRSS/releases) [![GitHub license](https://img.shields.io/github/license/relikd/baRSS)](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. diff --git a/baRSS/AppHook.m b/baRSS/AppHook.m index 3b0dcb3..bcc43f2 100644 --- a/baRSS/AppHook.m +++ b/baRSS/AppHook.m @@ -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 { diff --git a/baRSS/Core Data/Feed+Ext.m b/baRSS/Core Data/Feed+Ext.m index a5b2114..f357ea3 100644 --- a/baRSS/Core Data/Feed+Ext.m +++ b/baRSS/Core Data/Feed+Ext.m @@ -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; } diff --git a/baRSS/Core Data/FeedArticle+Ext.m b/baRSS/Core Data/FeedArticle+Ext.m index db22669..58540cb 100644 --- a/baRSS/Core Data/FeedArticle+Ext.m +++ b/baRSS/Core Data/FeedArticle+Ext.m @@ -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]; } diff --git a/baRSS/Feed Import/UpdateScheduler.m b/baRSS/Feed Import/UpdateScheduler.m index 28af29f..0d79723 100644 --- a/baRSS/Feed Import/UpdateScheduler.m +++ b/baRSS/Feed Import/UpdateScheduler.m @@ -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) diff --git a/baRSS/Notifications/NotifyEndpoint.h b/baRSS/Notifications/NotifyEndpoint.h index c64413e..1137c31 100644 --- a/baRSS/Notifications/NotifyEndpoint.h +++ b/baRSS/Notifications/NotifyEndpoint.h @@ -5,6 +5,7 @@ NS_ASSUME_NONNULL_BEGIN +API_AVAILABLE(macos(10.14)) @interface NotifyEndpoint : NSObject + (void)activate; diff --git a/baRSS/Notifications/NotifyEndpoint.m b/baRSS/Notifications/NotifyEndpoint.m index d7afe92..2a4f28f 100644 --- a/baRSS/Notifications/NotifyEndpoint.m +++ b/baRSS/Notifications/NotifyEndpoint.m @@ -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; diff --git a/baRSS/Preferences/General Tab/SettingsGeneral.m b/baRSS/Preferences/General Tab/SettingsGeneral.m index 6657492..a29c500 100644 --- a/baRSS/Preferences/General Tab/SettingsGeneral.m +++ b/baRSS/Preferences/General Tab/SettingsGeneral.m @@ -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) diff --git a/baRSS/Status Bar Menu/BarStatusItem.m b/baRSS/Status Bar Menu/BarStatusItem.m index d0e318d..d7cf3d0 100644 --- a/baRSS/Status Bar Menu/BarStatusItem.m +++ b/baRSS/Status Bar Menu/BarStatusItem.m @@ -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). diff --git a/baRSS/Status Bar Menu/NSMenu+Ext.m b/baRSS/Status Bar Menu/NSMenu+Ext.m index 3af7bbf..f7ae37c 100644 --- a/baRSS/Status Bar Menu/NSMenu+Ext.m +++ b/baRSS/Status Bar Menu/NSMenu+Ext.m @@ -206,8 +206,10 @@ typedef NS_ENUM(NSInteger, MenuItemTag) { } NSManagedObjectContext *moc = [StoreCoordinator createChildContext]; NSArray *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 *notificationIds = [StoreCoordinator updateArticles:list markRead:markRead andOpen:openLinks inContext:moc]; + if (@available(macOS 10.14, *)) { + [NotifyEndpoint dismiss:notificationIds]; + } } @end