fix: analyzer warnings on non-null value
This commit is contained in:
@@ -16,7 +16,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
- (void)calculateAndSetIndexPathString;
|
- (void)calculateAndSetIndexPathString;
|
||||||
- (void)setNewIcon:(NSURL*)location;
|
- (void)setNewIcon:(NSURL*)location;
|
||||||
// Article properties
|
// Article properties
|
||||||
- (NSArray<FeedArticle*>*)sortedArticles;
|
- (nullable NSArray<FeedArticle*>*)sortedArticles;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_END
|
NS_ASSUME_NONNULL_END
|
||||||
|
|||||||
@@ -124,7 +124,7 @@
|
|||||||
/**
|
/**
|
||||||
@return Articles sorted by attribute @c sortIndex with descending order (newest items first).
|
@return Articles sorted by attribute @c sortIndex with descending order (newest items first).
|
||||||
*/
|
*/
|
||||||
- (NSArray<FeedArticle*>*)sortedArticles {
|
- (nullable NSArray<FeedArticle*>*)sortedArticles {
|
||||||
if (self.articles.count == 0)
|
if (self.articles.count == 0)
|
||||||
return nil;
|
return nil;
|
||||||
return [self.articles sortedArrayUsingDescriptors:@[[NSSortDescriptor sortDescriptorWithKey:@"sortIndex" ascending:NO]]];
|
return [self.articles sortedArrayUsingDescriptors:@[[NSSortDescriptor sortDescriptorWithKey:@"sortIndex" ascending:NO]]];
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
- (NSMenuItem*)newMenuItem;
|
- (NSMenuItem*)newMenuItem;
|
||||||
// Handle children and parents
|
// Handle children and parents
|
||||||
- (NSString*)indexPathString;
|
- (NSString*)indexPathString;
|
||||||
- (NSArray<FeedGroup*>*)sortedChildren;
|
- (nullable NSArray<FeedGroup*>*)sortedChildren;
|
||||||
- (NSMutableArray<FeedGroup*>*)allParents;
|
- (NSMutableArray<FeedGroup*>*)allParents;
|
||||||
// Printing
|
// Printing
|
||||||
- (NSString*)readableDescription;
|
- (NSString*)readableDescription;
|
||||||
|
|||||||
@@ -106,7 +106,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// @return Children sorted by attribute @c sortIndex (same order as in preferences).
|
/// @return Children sorted by attribute @c sortIndex (same order as in preferences).
|
||||||
- (NSArray<FeedGroup*>*)sortedChildren {
|
- (nullable NSArray<FeedGroup*>*)sortedChildren {
|
||||||
if (self.children.count == 0)
|
if (self.children.count == 0)
|
||||||
return nil;
|
return nil;
|
||||||
return [self.children sortedArrayUsingDescriptors:@[[NSSortDescriptor sortDescriptorWithKey:@"sortIndex" ascending:YES]]];
|
return [self.children sortedArrayUsingDescriptors:@[[NSSortDescriptor sortDescriptorWithKey:@"sortIndex" ascending:YES]]];
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
|
|
||||||
// TODO: Make plugins extensible? community extensions.
|
// TODO: Make plugins extensible? community extensions.
|
||||||
@interface YouTubePlugin : NSObject
|
@interface YouTubePlugin : NSObject
|
||||||
+ (NSString*)feedURL:(NSURL*)url data:(NSData*)html;
|
+ (nullable NSString*)feedURL:(NSURL*)url data:(NSData*)html;
|
||||||
+ (NSString*)videoImage:(NSString*)videoid;
|
+ (NSString*)videoImage:(NSString*)videoid;
|
||||||
+ (NSString*)videoImageHQ:(NSString*)videoid;
|
+ (NSString*)videoImageHQ:(NSString*)videoid;
|
||||||
@end
|
@end
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
@return @c nil if @c url is not properly formatted, YouTube feed URL otherwise.
|
@return @c nil if @c url is not properly formatted, YouTube feed URL otherwise.
|
||||||
*/
|
*/
|
||||||
+ (NSString*)feedURL:(NSURL*)url data:(NSData*)html {
|
+ (nullable NSString*)feedURL:(NSURL*)url data:(NSData*)html {
|
||||||
if (![url.host hasSuffix:@"youtube.com"]) // 'youtu.be' & 'youtube-nocookie.com' will redirect
|
if (![url.host hasSuffix:@"youtube.com"]) // 'youtu.be' & 'youtube-nocookie.com' will redirect
|
||||||
return nil;
|
return nil;
|
||||||
// https://www.youtube.com/channel/[channel-id]
|
// https://www.youtube.com/channel/[channel-id]
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ typedef void(^FaviconDownloadBlock)(NSImage * _Nullable img, NSURL * _Nullable p
|
|||||||
- (instancetype)startWithBlock:(nonnull FaviconDownloadBlock)block;
|
- (instancetype)startWithBlock:(nonnull FaviconDownloadBlock)block;
|
||||||
- (void)cancel;
|
- (void)cancel;
|
||||||
// Extract from HTML metadata
|
// Extract from HTML metadata
|
||||||
+ (nullable NSString*)urlForMetadata:(RSHTMLMetadata*)meta;
|
+ (nullable NSString*)urlForMetadata:(nullable RSHTMLMetadata*)meta;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -168,7 +168,7 @@
|
|||||||
// ---------------------------------------------------------------
|
// ---------------------------------------------------------------
|
||||||
|
|
||||||
/// Extract favicon URL from parsed HTML metadata.
|
/// Extract favicon URL from parsed HTML metadata.
|
||||||
+ (nullable NSString*)urlForMetadata:(RSHTMLMetadata*)meta {
|
+ (nullable NSString*)urlForMetadata:(nullable RSHTMLMetadata*)meta {
|
||||||
if (!meta) return nil;
|
if (!meta) return nil;
|
||||||
|
|
||||||
double bestScore = DBL_MAX;
|
double bestScore = DBL_MAX;
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ typedef void (^FeedDownloadBlock)(FeedDownload *sender);
|
|||||||
@protocol FeedDownloadDelegate <NSObject>
|
@protocol FeedDownloadDelegate <NSObject>
|
||||||
@optional
|
@optional
|
||||||
/// Delegate must return chosen URL. If not implemented, the first URL will be used.
|
/// Delegate must return chosen URL. If not implemented, the first URL will be used.
|
||||||
- (NSString*)feedDownload:(FeedDownload*)sender selectFeedFromList:(NSArray<RSHTMLMetadataFeedLink*>*)list;
|
- (nullable NSString*)feedDownload:(FeedDownload*)sender selectFeedFromList:(NSArray<RSHTMLMetadataFeedLink*>*)list;
|
||||||
/// Only called if an URL redirect occured.
|
/// Only called if an URL redirect occured.
|
||||||
- (void)feedDownload:(FeedDownload*)sender urlRedirected:(NSString*)newURL;
|
- (void)feedDownload:(FeedDownload*)sender urlRedirected:(NSString*)newURL;
|
||||||
/// Called after xml data is loaded and parsed. Called on error, but not if download is cancled.
|
/// Called after xml data is loaded and parsed. Called on error, but not if download is cancled.
|
||||||
|
|||||||
@@ -168,7 +168,7 @@
|
|||||||
self.error = [NSError canceledByUser];
|
self.error = [NSError canceledByUser];
|
||||||
}
|
}
|
||||||
// finalize HTML parsing
|
// finalize HTML parsing
|
||||||
if (self.error) {
|
if (self.error || !feedURL) {
|
||||||
[self finishAndNotify];
|
[self finishAndNotify];
|
||||||
} else {
|
} else {
|
||||||
self.assertIsFeedURL = YES;
|
self.assertIsFeedURL = YES;
|
||||||
|
|||||||
@@ -70,7 +70,7 @@
|
|||||||
</dict>
|
</dict>
|
||||||
</array>
|
</array>
|
||||||
<key>CFBundleVersion</key>
|
<key>CFBundleVersion</key>
|
||||||
<string>14690</string>
|
<string>14695</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>
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
|
|
||||||
|
|
||||||
@interface NSDate (Statistics)
|
@interface NSDate (Statistics)
|
||||||
+ (NSDictionary*)refreshIntervalStatistics:(NSArray<NSDate*> *)list;
|
+ (nullable NSDictionary*)refreshIntervalStatistics:(NSArray<NSDate*> *)list;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
NS_ASSUME_NONNULL_END
|
NS_ASSUME_NONNULL_END
|
||||||
|
|||||||
@@ -140,7 +140,7 @@ static TimeUnitType const _values[] = {
|
|||||||
/**
|
/**
|
||||||
@return @c nil if list contains less than 2 entries. Otherwise: @{min, max, avg, median, earliest, latest}
|
@return @c nil if list contains less than 2 entries. Otherwise: @{min, max, avg, median, earliest, latest}
|
||||||
*/
|
*/
|
||||||
+ (NSDictionary*)refreshIntervalStatistics:(NSArray<NSDate*> *)list {
|
+ (nullable NSDictionary*)refreshIntervalStatistics:(NSArray<NSDate*> *)list {
|
||||||
if (!list || list.count == 0)
|
if (!list || list.count == 0)
|
||||||
return nil;
|
return nil;
|
||||||
|
|
||||||
|
|||||||
@@ -48,8 +48,8 @@ static inline CGFloat NSMaxWidth(NSView *a, NSView *b) { return Max(NSWidth(a.fr
|
|||||||
+ (NSImageView*)imageView:(nullable NSImageName)name size:(CGFloat)size;
|
+ (NSImageView*)imageView:(nullable NSImageName)name size:(CGFloat)size;
|
||||||
+ (NSButton*)checkbox:(BOOL)flag;
|
+ (NSButton*)checkbox:(BOOL)flag;
|
||||||
+ (NSProgressIndicator*)activitySpinner;
|
+ (NSProgressIndicator*)activitySpinner;
|
||||||
+ (NSView*)radioGroup:(NSArray<NSString*>*)entries target:(id)target action:(nonnull SEL)action;
|
+ (nullable NSView*)radioGroup:(NSArray<NSString*>*)entries target:(id)target action:(nonnull SEL)action;
|
||||||
+ (NSView*)radioGroup:(NSArray<NSString*>*)entries;
|
+ (nullable NSView*)radioGroup:(NSArray<NSString*>*)entries;
|
||||||
// UI: Enclosing Container
|
// UI: Enclosing Container
|
||||||
+ (NSPopover*)popover:(NSSize)size;
|
+ (NSPopover*)popover:(NSSize)size;
|
||||||
- (NSScrollView*)wrapContent:(NSView*)content inScrollView:(NSRect)rect;
|
- (NSScrollView*)wrapContent:(NSView*)content inScrollView:(NSRect)rect;
|
||||||
|
|||||||
@@ -126,7 +126,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Create grouping view with vertically, left-aligned radio buttons. Action is identical for all buttons (grouping).
|
/// Create grouping view with vertically, left-aligned radio buttons. Action is identical for all buttons (grouping).
|
||||||
+ (NSView*)radioGroup:(NSArray<NSString*>*)entries target:(id)target action:(nonnull SEL)action {
|
+ (nullable NSView*)radioGroup:(NSArray<NSString*>*)entries target:(id)target action:(nonnull SEL)action {
|
||||||
if (entries.count == 0)
|
if (entries.count == 0)
|
||||||
return nil;
|
return nil;
|
||||||
CGFloat w = 0, h = 0;
|
CGFloat w = 0, h = 0;
|
||||||
@@ -145,7 +145,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Same as @c radioGroup:target:action: but using dummy action to ignore radio button click events.
|
/// Same as @c radioGroup:target:action: but using dummy action to ignore radio button click events.
|
||||||
+ (NSView*)radioGroup:(NSArray<NSString*>*)entries {
|
+ (nullable NSView*)radioGroup:(NSArray<NSString*>*)entries {
|
||||||
return [self radioGroup:entries target:self action:@selector(donothing)];
|
return [self radioGroup:entries target:self action:@selector(donothing)];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -140,7 +140,7 @@
|
|||||||
|
|
||||||
@return Either URL string or @c nil if user canceled the selection.
|
@return Either URL string or @c nil if user canceled the selection.
|
||||||
*/
|
*/
|
||||||
- (NSString*)feedDownload:(FeedDownload*)sender selectFeedFromList:(NSArray<RSHTMLMetadataFeedLink*>*)list {
|
- (nullable NSString*)feedDownload:(FeedDownload*)sender selectFeedFromList:(NSArray<RSHTMLMetadataFeedLink*>*)list {
|
||||||
NSMenu *menu = [[NSMenu alloc] initWithTitle:NSLocalizedString(@"Choose feed menu", nil)];
|
NSMenu *menu = [[NSMenu alloc] initWithTitle:NSLocalizedString(@"Choose feed menu", nil)];
|
||||||
menu.autoenablesItems = NO;
|
menu.autoenablesItems = NO;
|
||||||
for (RSHTMLMetadataFeedLink *fl in list) {
|
for (RSHTMLMetadataFeedLink *fl in list) {
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
- (void)insertDefaultHeader;
|
- (void)insertDefaultHeader;
|
||||||
// Update menu
|
// Update menu
|
||||||
- (void)setHeaderHasUnread:(BOOL)hasUnread hasRead:(BOOL)hasRead;
|
- (void)setHeaderHasUnread:(BOOL)hasUnread hasRead:(BOOL)hasRead;
|
||||||
- (NSMenuItem*)deepestItemWithPath:(nonnull NSString*)path;
|
- (nullable NSMenuItem*)deepestItemWithPath:(nonnull NSString*)path;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -116,7 +116,7 @@ typedef NS_ENUM(NSInteger, MenuItemTag) {
|
|||||||
@param path Dot separated list of @c sortIndex. E.g., @c Feed.indexPath.
|
@param path Dot separated list of @c sortIndex. E.g., @c Feed.indexPath.
|
||||||
@return Either @c NSMenuItem that exactly matches @c path or one of the parent @c NSMenuItem if a submenu isn't open.
|
@return Either @c NSMenuItem that exactly matches @c path or one of the parent @c NSMenuItem if a submenu isn't open.
|
||||||
*/
|
*/
|
||||||
- (NSMenuItem*)deepestItemWithPath:(nonnull NSString*)path {
|
- (nullable NSMenuItem*)deepestItemWithPath:(nonnull NSString*)path {
|
||||||
NSUInteger loc = [path rangeOfString:@"."].location;
|
NSUInteger loc = [path rangeOfString:@"."].location;
|
||||||
BOOL isLast = (loc == NSNotFound);
|
BOOL isLast = (loc == NSNotFound);
|
||||||
NSString *indexStr = (isLast ? path : [path substringToIndex:loc]);
|
NSString *indexStr = (isLast ? path : [path substringToIndex:loc]);
|
||||||
|
|||||||
Reference in New Issue
Block a user