feat: restore macOS 10.13 compatibility

This commit is contained in:
relikd
2026-01-11 22:00:48 +01:00
parent 25be1033aa
commit c310933623
11 changed files with 47 additions and 29 deletions

View File

@@ -5,7 +5,7 @@ CODE_SIGN_STYLE = Manual
CODE_SIGN_IDENTITY = Apple Development CODE_SIGN_IDENTITY = Apple Development
ENABLE_HARDENED_RUNTIME = YES ENABLE_HARDENED_RUNTIME = YES
MACOSX_DEPLOYMENT_TARGET = 10.14 MACOSX_DEPLOYMENT_TARGET = 10.13
MARKETING_VERSION = 1.6.1 MARKETING_VERSION = 1.6.1
PRODUCT_NAME = baRSS PRODUCT_NAME = baRSS
PRODUCT_BUNDLE_IDENTIFIER = de.relikd.baRSS PRODUCT_BUNDLE_IDENTIFIER = de.relikd.baRSS

View File

@@ -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) [![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) [![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) [![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 Download & Install
------------------ ------------------
Requires macOS Mojave (10.14) or higher. Requires macOS High Sierra (10.13) or higher.
### Easy way ### Easy way
Go to [releases](https://github.com/relikd/baRSS/releases) and downloaded the latest version. Go to [releases](https://github.com/relikd/baRSS/releases) and downloaded the latest version.

View File

@@ -47,9 +47,11 @@
if (initial) [UpdateScheduler updateAllFavicons]; if (initial) [UpdateScheduler updateAllFavicons];
} }
// Notifications are disabled by default so this wont trigger for first app launch. if (@available(macOS 10.14, *)) {
// Also, this will register the notification delegate and respond to click & open feed. // Notifications are disabled by default so this wont trigger for first app launch.
[NotifyEndpoint activate]; // Also, this will register the notification delegate and respond to click & open feed.
[NotifyEndpoint activate];
}
} }
- (void)applicationWillTerminate:(NSNotification *)aNotification { - (void)applicationWillTerminate:(NSNotification *)aNotification {

View File

@@ -129,7 +129,9 @@
if (deletingSet.count > 0) { if (deletingSet.count > 0) {
[localSet minusSet:deletingSet]; [localSet minusSet:deletingSet];
[self removeArticles:deletingSet]; [self removeArticles:deletingSet];
[NotifyEndpoint dismiss:dismissed]; if (@available(macOS 10.14, *)) {
[NotifyEndpoint dismiss:dismissed];
}
} }
return c; return c;
} }

View File

@@ -91,7 +91,9 @@
NSNumber *num = (fa.unread ? @+1 : @-1); NSNumber *num = (fa.unread ? @+1 : @-1);
PostNotification(kNotificationTotalUnreadCountChanged, num); 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]; [moc reset];
} }

View File

@@ -211,26 +211,28 @@ static inline void AlertDownloadError(NSError *err, NSString *url) {
// after save, update notifications // after save, update notifications
// dismiss previously delivered notifications // dismiss previously delivered notifications
if (deleted) { if (@available(macOS 10.14, *)) {
NSMutableArray *ids = [NSMutableArray array]; if (deleted) {
for (FeedArticle *article in deleted) { // will contain non-articles too NSMutableArray *ids = [NSMutableArray array];
if ([article isKindOfClass:[FeedArticle class]] || [article isKindOfClass:[Feed class]]) { for (FeedArticle *article in deleted) { // will contain non-articles too
[ids addObject:article.notificationID]; 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) {
// post new notification (if needed) BOOL didAddAny = NO;
if (notify && inserted) { for (FeedArticle *article in inserted) { // will contain non-articles too
BOOL didAddAny = NO; if ([article isKindOfClass:[FeedArticle class]]) {
for (FeedArticle *article in inserted) { // will contain non-articles too [NotifyEndpoint postArticle:article];
if ([article isKindOfClass:[FeedArticle class]]) { didAddAny = YES;
[NotifyEndpoint postArticle:article]; }
didAddAny = YES;
} }
if (didAddAny)
[NotifyEndpoint postFeed:f];
} }
if (didAddAny)
[NotifyEndpoint postFeed:f];
} }
if (needsNotification) if (needsNotification)

View File

@@ -5,6 +5,7 @@
NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_BEGIN
API_AVAILABLE(macos(10.14))
@interface NotifyEndpoint : NSObject <UNUserNotificationCenterDelegate> @interface NotifyEndpoint : NSObject <UNUserNotificationCenterDelegate>
+ (void)activate; + (void)activate;

View File

@@ -18,6 +18,7 @@ static NSString* const kActionOpenOnly = @"OPEN_ONLY_DONT_MARK_READ";
@implementation NotifyEndpoint @implementation NotifyEndpoint
API_AVAILABLE(macos(10.14))
static NotifyEndpoint *singleton = nil; static NotifyEndpoint *singleton = nil;
static NotificationType notifyType; static NotificationType notifyType;

View File

@@ -86,7 +86,9 @@
- (void)changeNotificationType:(NSPopUpButton *)sender { - (void)changeNotificationType:(NSPopUpButton *)sender {
UserPrefsSet(Pref_notificationType, sender.selectedItem.representedObject); UserPrefsSet(Pref_notificationType, sender.selectedItem.representedObject);
self.view.notificationHelp.stringValue = [self notificationHelpString:UserPrefsNotificationType()]; 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) /// Help string explaining the different notification settings (for the current configuration)

View File

@@ -77,7 +77,9 @@
NSInteger oldCount = _unreadCountTotal; NSInteger oldCount = _unreadCountTotal;
_unreadCountTotal = count > 0 ? (NSInteger)count : 0; _unreadCountTotal = count > 0 ? (NSInteger)count : 0;
[self updateBarIcon]; [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). /// Assign new value by adding @c count to total unread count (may be negative).
@@ -88,7 +90,9 @@
_unreadCountTotal = 0; _unreadCountTotal = 0;
} }
[self updateBarIcon]; [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). /// Fetch new total unread count from core data and assign it as new value (dispatch async on main thread).

View File

@@ -206,8 +206,10 @@ typedef NS_ENUM(NSInteger, MenuItemTag) {
} }
NSManagedObjectContext *moc = [StoreCoordinator createChildContext]; NSManagedObjectContext *moc = [StoreCoordinator createChildContext];
NSArray<FeedArticle*> *list = [StoreCoordinator articlesAtPath:path isFeed:isFeedMenu sorted:openLinks unread:markRead inContext:moc limit:limit]; NSArray<FeedArticle*> *list = [StoreCoordinator articlesAtPath:path isFeed:isFeedMenu sorted:openLinks unread:markRead inContext:moc limit:limit];
[NotifyEndpoint dismiss: NSArray<NSString *> *notificationIds = [StoreCoordinator updateArticles:list markRead:markRead andOpen:openLinks inContext:moc];
[StoreCoordinator updateArticles:list markRead:markRead andOpen:openLinks inContext:moc]]; if (@available(macOS 10.14, *)) {
[NotifyEndpoint dismiss:notificationIds];
}
} }
@end @end