diff --git a/baRSS.xcodeproj/project.pbxproj b/baRSS.xcodeproj/project.pbxproj index 0a61aa3..a48a7aa 100644 --- a/baRSS.xcodeproj/project.pbxproj +++ b/baRSS.xcodeproj/project.pbxproj @@ -805,7 +805,7 @@ CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 16668; + CURRENT_PROJECT_VERSION = 16683; DEAD_CODE_STRIPPING = YES; DEBUG_INFORMATION_FORMAT = dwarf; DEVELOPMENT_TEAM = UY657LKNHJ; @@ -866,7 +866,7 @@ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; CODE_SIGN_INJECT_BASE_ENTITLEMENTS = NO; COPY_PHASE_STRIP = NO; - CURRENT_PROJECT_VERSION = 16668; + CURRENT_PROJECT_VERSION = 16683; DEAD_CODE_STRIPPING = YES; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DEVELOPMENT_TEAM = UY657LKNHJ; diff --git a/baRSS/Core Data/Feed+Ext.m b/baRSS/Core Data/Feed+Ext.m index e8a2274..a5b2114 100644 --- a/baRSS/Core Data/Feed+Ext.m +++ b/baRSS/Core Data/Feed+Ext.m @@ -189,7 +189,8 @@ - (NSUInteger)countUnread { NSUInteger count = 0; for (FeedArticle *article in self.articles) { - count += article.unread; + if (article.unread) + count += 1; } return count; } diff --git a/baRSS/Core Data/StoreCoordinator.h b/baRSS/Core Data/StoreCoordinator.h index afd7b8c..0a7a8ce 100644 --- a/baRSS/Core Data/StoreCoordinator.h +++ b/baRSS/Core Data/StoreCoordinator.h @@ -30,7 +30,7 @@ NS_ASSUME_NONNULL_BEGIN // Unread articles list & mark articled read + (NSArray*)articlesAtPath:(nullable NSString*)path isFeed:(BOOL)feedFlag sorted:(BOOL)sortFlag unread:(BOOL)readFlag inContext:(NSManagedObjectContext*)moc limit:(NSUInteger)limit; -+ (NSArray*)updateArticles:(NSArray*)list markRead:(BOOL)markRead andOpen:(BOOL)openLinks inContext:(NSManagedObjectContext*)moc; ++ (nullable NSArray*)updateArticles:(NSArray*)list markRead:(BOOL)markRead andOpen:(BOOL)openLinks inContext:(NSManagedObjectContext*)moc; // Restore sound state + (void)cleanupAndShowAlert:(BOOL)flag; diff --git a/baRSS/Core Data/StoreCoordinator.m b/baRSS/Core Data/StoreCoordinator.m index 034b8df..fa50b14 100644 --- a/baRSS/Core Data/StoreCoordinator.m +++ b/baRSS/Core Data/StoreCoordinator.m @@ -214,7 +214,7 @@ @return @c notificationID for all articles that were opened (empty if @c openLinks=NO or open failed). */ -+ (NSArray*)updateArticles:(NSArray*)list markRead:(BOOL)markRead andOpen:(BOOL)openLinks inContext:(NSManagedObjectContext*)moc { ++ (nullable NSArray*)updateArticles:(NSArray*)list markRead:(BOOL)markRead andOpen:(BOOL)openLinks inContext:(NSManagedObjectContext*)moc { if (openLinks) { NSMutableArray *urls = [NSMutableArray arrayWithCapacity:list.count]; for (FeedArticle *fa in list) { diff --git a/baRSS/Helper/TinySVG.h b/baRSS/Helper/TinySVG.h index ddc5caa..eeaedd1 100644 --- a/baRSS/Helper/TinySVG.h +++ b/baRSS/Helper/TinySVG.h @@ -1,6 +1,5 @@ @import Cocoa; -CGMutablePathRef tinySVG_path(CGFloat scale, const char * code); void svgAddPath(CGContextRef context, CGFloat scale, const char * path); void svgAddCircle(CGContextRef context, CGFloat scale, CGFloat x, CGFloat y, CGFloat radius, bool clockwise); void svgAddRect(CGContextRef context, CGFloat scale, CGRect rect, CGFloat cornerRadius); diff --git a/baRSS/Helper/TinySVG.m b/baRSS/Helper/TinySVG.m index 908c044..bc9d4bc 100644 --- a/baRSS/Helper/TinySVG.m +++ b/baRSS/Helper/TinySVG.m @@ -83,10 +83,7 @@ inline static void continueNum(char chr, struct SVGState *state) { # pragma mark - Parser /// very basic svg path parser. -/// @returns @c CGMutablePathRef which must be released with @c CGPathRelease() -CGMutablePathRef tinySVG_path(CGFloat scale, const char * code) { - CGMutablePathRef path = CGPathCreateMutable(); - +static void tinySVG_parse(const char * code, CGFloat scale, CGMutablePathRef path) { struct SVGState state = { .scale = scale, .op = '_', @@ -139,17 +136,17 @@ CGMutablePathRef tinySVG_path(CGFloat scale, const char * code) { } } } - return path; } # pragma mark - External API /// calls @c tinySVG_path and handles @c CGPath creation and release. -void svgAddPath(CGContextRef context, CGFloat scale, const char * path) { - CGMutablePathRef tmp = tinySVG_path(scale, path); - CGContextAddPath(context, tmp); - CGPathRelease(tmp); +void svgAddPath(CGContextRef context, CGFloat scale, const char * code) { + CGMutablePathRef path = CGPathCreateMutable(); + tinySVG_parse(code, scale, path); + CGContextAddPath(context, path); + CGPathRelease(path); } /// calls @c CGPathAddArc with full circle diff --git a/baRSS/Notifications/NotifyEndpoint.m b/baRSS/Notifications/NotifyEndpoint.m index 918cce2..4a1be4d 100644 --- a/baRSS/Notifications/NotifyEndpoint.m +++ b/baRSS/Notifications/NotifyEndpoint.m @@ -102,8 +102,8 @@ static NotificationType notifyType; /// @param identifier Used to identify a specific instance (and dismiss a previously shown notification). + (void)send:(NSString *)identifier title:(nullable NSString *)title body:(nullable NSString *)body { UNMutableNotificationContent *msg = [UNMutableNotificationContent new]; - msg.title = title; - msg.body = body; + if (title) msg.title = title; + if (body) msg.body = body; // common settings: // TODO: make sound configurable? msg.sound = [UNNotificationSound defaultSound];