fix: analyzer warnings on non-null value
This commit is contained in:
@@ -16,7 +16,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
- (void)calculateAndSetIndexPathString;
|
||||
- (void)setNewIcon:(NSURL*)location;
|
||||
// Article properties
|
||||
- (NSArray<FeedArticle*>*)sortedArticles;
|
||||
- (nullable NSArray<FeedArticle*>*)sortedArticles;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
||||
@@ -124,7 +124,7 @@
|
||||
/**
|
||||
@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)
|
||||
return nil;
|
||||
return [self.articles sortedArrayUsingDescriptors:@[[NSSortDescriptor sortDescriptorWithKey:@"sortIndex" ascending:NO]]];
|
||||
|
||||
@@ -24,7 +24,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
- (NSMenuItem*)newMenuItem;
|
||||
// Handle children and parents
|
||||
- (NSString*)indexPathString;
|
||||
- (NSArray<FeedGroup*>*)sortedChildren;
|
||||
- (nullable NSArray<FeedGroup*>*)sortedChildren;
|
||||
- (NSMutableArray<FeedGroup*>*)allParents;
|
||||
// Printing
|
||||
- (NSString*)readableDescription;
|
||||
|
||||
@@ -106,7 +106,7 @@
|
||||
}
|
||||
|
||||
/// @return Children sorted by attribute @c sortIndex (same order as in preferences).
|
||||
- (NSArray<FeedGroup*>*)sortedChildren {
|
||||
- (nullable NSArray<FeedGroup*>*)sortedChildren {
|
||||
if (self.children.count == 0)
|
||||
return nil;
|
||||
return [self.children sortedArrayUsingDescriptors:@[[NSSortDescriptor sortDescriptorWithKey:@"sortIndex" ascending:YES]]];
|
||||
|
||||
@@ -6,7 +6,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
// TODO: Make plugins extensible? community extensions.
|
||||
@interface YouTubePlugin : NSObject
|
||||
+ (NSString*)feedURL:(NSURL*)url data:(NSData*)html;
|
||||
+ (nullable NSString*)feedURL:(NSURL*)url data:(NSData*)html;
|
||||
+ (NSString*)videoImage:(NSString*)videoid;
|
||||
+ (NSString*)videoImageHQ:(NSString*)videoid;
|
||||
@end
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
@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
|
||||
return nil;
|
||||
// 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;
|
||||
- (void)cancel;
|
||||
// Extract from HTML metadata
|
||||
+ (nullable NSString*)urlForMetadata:(RSHTMLMetadata*)meta;
|
||||
+ (nullable NSString*)urlForMetadata:(nullable RSHTMLMetadata*)meta;
|
||||
@end
|
||||
|
||||
|
||||
|
||||
@@ -168,7 +168,7 @@
|
||||
// ---------------------------------------------------------------
|
||||
|
||||
/// Extract favicon URL from parsed HTML metadata.
|
||||
+ (nullable NSString*)urlForMetadata:(RSHTMLMetadata*)meta {
|
||||
+ (nullable NSString*)urlForMetadata:(nullable RSHTMLMetadata*)meta {
|
||||
if (!meta) return nil;
|
||||
|
||||
double bestScore = DBL_MAX;
|
||||
|
||||
@@ -35,7 +35,7 @@ typedef void (^FeedDownloadBlock)(FeedDownload *sender);
|
||||
@protocol FeedDownloadDelegate <NSObject>
|
||||
@optional
|
||||
/// 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.
|
||||
- (void)feedDownload:(FeedDownload*)sender urlRedirected:(NSString*)newURL;
|
||||
/// 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];
|
||||
}
|
||||
// finalize HTML parsing
|
||||
if (self.error) {
|
||||
if (self.error || !feedURL) {
|
||||
[self finishAndNotify];
|
||||
} else {
|
||||
self.assertIsFeedURL = YES;
|
||||
|
||||
@@ -70,7 +70,7 @@
|
||||
</dict>
|
||||
</array>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>14690</string>
|
||||
<string>14695</string>
|
||||
<key>LSApplicationCategoryType</key>
|
||||
<string>public.app-category.news</string>
|
||||
<key>LSMinimumSystemVersion</key>
|
||||
|
||||
@@ -35,7 +35,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
|
||||
@interface NSDate (Statistics)
|
||||
+ (NSDictionary*)refreshIntervalStatistics:(NSArray<NSDate*> *)list;
|
||||
+ (nullable NSDictionary*)refreshIntervalStatistics:(NSArray<NSDate*> *)list;
|
||||
@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}
|
||||
*/
|
||||
+ (NSDictionary*)refreshIntervalStatistics:(NSArray<NSDate*> *)list {
|
||||
+ (nullable NSDictionary*)refreshIntervalStatistics:(NSArray<NSDate*> *)list {
|
||||
if (!list || list.count == 0)
|
||||
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;
|
||||
+ (NSButton*)checkbox:(BOOL)flag;
|
||||
+ (NSProgressIndicator*)activitySpinner;
|
||||
+ (NSView*)radioGroup:(NSArray<NSString*>*)entries target:(id)target action:(nonnull SEL)action;
|
||||
+ (NSView*)radioGroup:(NSArray<NSString*>*)entries;
|
||||
+ (nullable NSView*)radioGroup:(NSArray<NSString*>*)entries target:(id)target action:(nonnull SEL)action;
|
||||
+ (nullable NSView*)radioGroup:(NSArray<NSString*>*)entries;
|
||||
// UI: Enclosing Container
|
||||
+ (NSPopover*)popover:(NSSize)size;
|
||||
- (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).
|
||||
+ (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)
|
||||
return nil;
|
||||
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.
|
||||
+ (NSView*)radioGroup:(NSArray<NSString*>*)entries {
|
||||
+ (nullable NSView*)radioGroup:(NSArray<NSString*>*)entries {
|
||||
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.
|
||||
*/
|
||||
- (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)];
|
||||
menu.autoenablesItems = NO;
|
||||
for (RSHTMLMetadataFeedLink *fl in list) {
|
||||
|
||||
@@ -14,7 +14,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
- (void)insertDefaultHeader;
|
||||
// Update menu
|
||||
- (void)setHeaderHasUnread:(BOOL)hasUnread hasRead:(BOOL)hasRead;
|
||||
- (NSMenuItem*)deepestItemWithPath:(nonnull NSString*)path;
|
||||
- (nullable NSMenuItem*)deepestItemWithPath:(nonnull NSString*)path;
|
||||
@end
|
||||
|
||||
|
||||
|
||||
@@ -116,7 +116,7 @@ typedef NS_ENUM(NSInteger, MenuItemTag) {
|
||||
@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.
|
||||
*/
|
||||
- (NSMenuItem*)deepestItemWithPath:(nonnull NSString*)path {
|
||||
- (nullable NSMenuItem*)deepestItemWithPath:(nonnull NSString*)path {
|
||||
NSUInteger loc = [path rangeOfString:@"."].location;
|
||||
BOOL isLast = (loc == NSNotFound);
|
||||
NSString *indexStr = (isLast ? path : [path substringToIndex:loc]);
|
||||
|
||||
Reference in New Issue
Block a user