Fix const + PostNotification() + RegisterNotification()
This commit is contained in:
@@ -205,7 +205,7 @@ NS_INLINE void DrawGradient(CGContextRef c, CGFloat size, NSColor *color) {
|
||||
[rgbColor getHue:&h saturation:&s brightness:&b alpha:&a];
|
||||
} @catch (NSException *e) {}
|
||||
|
||||
static const CGFloat impact = 0.3;
|
||||
static CGFloat const impact = 0.3;
|
||||
NSColor *darker = [NSColor colorWithHue:h saturation:(s + impact > 1 ? 1 : s + impact) brightness:b alpha:a];
|
||||
NSColor *lighter = [NSColor colorWithHue:h saturation:(s - impact < 0 ? 0 : s - impact) brightness:b alpha:a];
|
||||
const void* cgColors[] = {
|
||||
|
||||
@@ -330,7 +330,7 @@ static BOOL _nextUpdateIsForced = NO;
|
||||
}
|
||||
[StoreCoordinator saveContext:moc andParent:YES];
|
||||
if (needsNotification)
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:kNotificationFeedUpdated object:oid];
|
||||
PostNotification(kNotificationFeedUpdated, oid);
|
||||
if (block) block(success);
|
||||
}];
|
||||
}
|
||||
@@ -353,6 +353,7 @@ static BOOL _nextUpdateIsForced = NO;
|
||||
[StoreCoordinator saveContext:moc andParent:YES];
|
||||
[moc reset];
|
||||
if (successful) {
|
||||
PostNotification(kNotificationGroupInserted, f.group.objectID);
|
||||
[self scheduleUpdateForUpcomingFeeds];
|
||||
if (block) block();
|
||||
}
|
||||
@@ -388,7 +389,7 @@ static BOOL _nextUpdateIsForced = NO;
|
||||
*/
|
||||
+ (void)batchDownloadFeeds:(NSArray<Feed*> *)list favicons:(BOOL)fav showErrorAlert:(BOOL)alert finally:(nullable os_block_t)block {
|
||||
_isUpdating = YES;
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:kNotificationBackgroundUpdateInProgress object:@(list.count)];
|
||||
PostNotification(kNotificationBackgroundUpdateInProgress, @(list.count));
|
||||
dispatch_group_t group = dispatch_group_create();
|
||||
for (Feed *f in list) {
|
||||
dispatch_group_enter(group);
|
||||
@@ -399,7 +400,7 @@ static BOOL _nextUpdateIsForced = NO;
|
||||
dispatch_group_notify(group, dispatch_get_main_queue(), ^{
|
||||
if (block) block();
|
||||
_isUpdating = NO;
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:kNotificationBackgroundUpdateInProgress object:@(0)];
|
||||
PostNotification(kNotificationBackgroundUpdateInProgress, @(0));
|
||||
});
|
||||
}
|
||||
|
||||
@@ -426,7 +427,7 @@ static BOOL _nextUpdateIsForced = NO;
|
||||
Feed *f = [moc objectWithID:oid];
|
||||
if (f && [f setIconImage:img]) {
|
||||
[StoreCoordinator saveContext:moc andParent:YES];
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:kNotificationFeedIconUpdated object:oid];
|
||||
PostNotification(kNotificationFeedIconUpdated, oid);
|
||||
}
|
||||
if (block) block();
|
||||
}];
|
||||
@@ -549,7 +550,7 @@ static BOOL _nextUpdateIsForced = NO;
|
||||
static void networkReachabilityCallback(SCNetworkReachabilityRef target, SCNetworkConnectionFlags flags, void *object) {
|
||||
if (_reachability == NULL) return;
|
||||
_isReachable = [FeedDownload hasConnectivity:flags];
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:kNotificationNetworkStatusChanged object:@(_isReachable)];
|
||||
PostNotification(kNotificationNetworkStatusChanged, @(_isReachable));
|
||||
if (_isReachable) {
|
||||
[FeedDownload resumeUpdates];
|
||||
} else {
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
|
||||
#import <QuartzCore/QuartzCore.h>
|
||||
|
||||
static const TimeUnitType _values[] = {
|
||||
static TimeUnitType const _values[] = {
|
||||
TimeUnitYears,
|
||||
TimeUnitWeeks,
|
||||
TimeUnitDays,
|
||||
|
||||
@@ -22,23 +22,23 @@
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
|
||||
/***/ static const CGFloat PAD_WIN = 20; // window padding
|
||||
/***/ static const CGFloat PAD_L = 16;
|
||||
/***/ static const CGFloat PAD_M = 8;
|
||||
/***/ static const CGFloat PAD_S = 4;
|
||||
/***/ static const CGFloat PAD_XS = 2;
|
||||
/***/ static CGFloat const PAD_WIN = 20; // window padding
|
||||
/***/ static CGFloat const PAD_L = 16;
|
||||
/***/ static CGFloat const PAD_M = 8;
|
||||
/***/ static CGFloat const PAD_S = 4;
|
||||
/***/ static CGFloat const PAD_XS = 2;
|
||||
|
||||
/***/ static const CGFloat HEIGHT_LABEL = 17;
|
||||
/***/ static const CGFloat HEIGHT_LABEL_SMALL = 14;
|
||||
/***/ static const CGFloat HEIGHT_INPUTFIELD = 21;
|
||||
/***/ static const CGFloat HEIGHT_BUTTON = 21;
|
||||
/***/ static const CGFloat HEIGHT_INLINEBUTTON = 16;
|
||||
/***/ static const CGFloat HEIGHT_POPUP = 21;
|
||||
/***/ static const CGFloat HEIGHT_SPINNER = 16;
|
||||
/***/ static const CGFloat HEIGHT_CHECKBOX = 14;
|
||||
/***/ static CGFloat const HEIGHT_LABEL = 17;
|
||||
/***/ static CGFloat const HEIGHT_LABEL_SMALL = 14;
|
||||
/***/ static CGFloat const HEIGHT_INPUTFIELD = 21;
|
||||
/***/ static CGFloat const HEIGHT_BUTTON = 21;
|
||||
/***/ static CGFloat const HEIGHT_INLINEBUTTON = 16;
|
||||
/***/ static CGFloat const HEIGHT_POPUP = 21;
|
||||
/***/ static CGFloat const HEIGHT_SPINNER = 16;
|
||||
/***/ static CGFloat const HEIGHT_CHECKBOX = 14;
|
||||
|
||||
/// Static variable to calculate origin center coordinate in its @c superview. The value of this var isn't used.
|
||||
static const CGFloat CENTER = -0.015625;
|
||||
static CGFloat const CENTER = -0.015625;
|
||||
|
||||
/// Calculate @c origin.y going down from the top border of its @c superview
|
||||
NS_INLINE CGFloat YFromTop(NSView *view) { return NSHeight(view.superview.frame) - NSMinY(view.frame) - view.alignmentRectInsets.bottom; }
|
||||
|
||||
Reference in New Issue
Block a user