Refresh interval string localizations

This commit is contained in:
relikd
2019-07-08 22:40:16 +02:00
parent 31e0821080
commit dda219b570
10 changed files with 75 additions and 91 deletions

View File

@@ -48,5 +48,4 @@ typedef NS_ENUM(int16_t, FeedGroupType) {
- (BOOL)iterateSorted:(BOOL)ordered overDescendantFeeds:(void(^)(Feed *feed, BOOL* cancel))block;
// Printing
- (NSString*)readableDescription;
- (nonnull NSString*)refreshString;
@end

View File

@@ -141,22 +141,10 @@
/// @return Simplified description of the feed object.
- (NSString*)readableDescription {
switch (self.type) {
case GROUP: return [NSString stringWithFormat:@"%@:", self.name];
case FEED: return [NSString stringWithFormat:@"%@ (%@)", self.name, self.feed.meta.url];
case SEPARATOR: return @"-------------";
case GROUP: return [NSString stringWithFormat:@"%@", self.name];
case FEED:
return [NSString stringWithFormat:@"%@ (%@) - %@", self.name, self.feed.meta.url, [self refreshString]];
}
}
/// @return Formatted string for update interval ( e.g., @c 30m or @c 12h )
- (nonnull NSString*)refreshString {
if (self.type == FEED) {
int32_t refresh = self.feed.meta.refresh;
if (refresh <= 0)
return @"∞"; // ƒ Ø
return [NSDate stringForInterval:refresh rounded:NO];
}
return @"";
}
@end

View File

@@ -33,7 +33,6 @@
if (self.errorCount < 0)
self.errorCount = 0;
int16_t n = self.errorCount + 1; // always increment errorCount (can be used to indicate bad feeds)
// TODO: remove logging
#ifdef DEBUG
NSLog(@"ERROR: Feed download failed: %@ (errorCount: %d)", self.url, n);
#endif