feat: notifications help string
This commit is contained in:
@@ -33,19 +33,19 @@
|
||||
// Notification settings (disabled, per article, per feed, total)
|
||||
NSPopUpButton *notify = self.view.popupNotificationType;
|
||||
[notify removeAllItems];
|
||||
[notify addItemWithTitle:NSLocalizedString(@"Disabled", @"Disable notifications")];
|
||||
notify.lastItem.representedObject = @"";
|
||||
[notify addItemsWithTitles:@[
|
||||
NSLocalizedString(@"Disabled", @"Disable notifications"),
|
||||
NSLocalizedString(@"Article title (per article)", @"Show article title in notification"),
|
||||
NSLocalizedString(@"Number of articles (per feed)", @"Show “feed X: N new articles”"),
|
||||
NSLocalizedString(@"Generic “new articles” (over all)", @"Show total “N new article”"),
|
||||
NSLocalizedString(@"Disabled", @"No notifications"),
|
||||
NSLocalizedString(@"Per Article", nil),
|
||||
NSLocalizedString(@"Per Feed", nil),
|
||||
NSLocalizedString(@"Global “X unread articles”", nil),
|
||||
]];
|
||||
notify.itemArray[0].representedObject = NotificationTypeToString(NotificationTypeDisabled);
|
||||
notify.itemArray[1].representedObject = NotificationTypeToString(NotificationTypePerArticle);
|
||||
notify.itemArray[2].representedObject = NotificationTypeToString(NotificationTypePerFeed);
|
||||
notify.itemArray[3].representedObject = NotificationTypeToString(NotificationTypeGlobal);
|
||||
[notify selectItemAtIndex:[notify indexOfItemWithRepresentedObject:NotificationTypeToString(UserPrefsNotificationType())]];
|
||||
NotificationType savedType = UserPrefsNotificationType();
|
||||
[notify selectItemAtIndex:[notify indexOfItemWithRepresentedObject:NotificationTypeToString(savedType)]];
|
||||
self.view.notificationHelp.stringValue = [self notificationHelpString:savedType];
|
||||
}
|
||||
|
||||
/// Get human readable application name such as 'Safari' or 'baRSS'
|
||||
@@ -85,7 +85,22 @@
|
||||
|
||||
- (void)changeNotificationType:(NSPopUpButton *)sender {
|
||||
UserPrefsSet(Pref_notificationType, sender.selectedItem.representedObject);
|
||||
self.view.notificationHelp.stringValue = [self notificationHelpString:UserPrefsNotificationType()];
|
||||
[NotifyEndpoint activate];
|
||||
}
|
||||
|
||||
/// Help string explaining the different notification settings (for the current configuration)
|
||||
- (NSString*)notificationHelpString:(NotificationType)typ {
|
||||
switch (typ) {
|
||||
case NotificationTypeDisabled:
|
||||
return NSLocalizedString(@"Notifications are disabled. You will not get any notifications even if you enable them in System Settings.", nil);
|
||||
case NotificationTypePerArticle:
|
||||
return NSLocalizedString(@"You will get a notification for each article (“Article Title: Article Content”). A click on the notification banner opens the article link and marks the item as read.", nil);
|
||||
case NotificationTypePerFeed:
|
||||
return NSLocalizedString(@"You will get a notification for each feed whenever one or more new articles are published (“Feed Title: X unread articles”). A click on the notification banner will open all unread articles of that feed.", nil);
|
||||
case NotificationTypeGlobal:
|
||||
return NSLocalizedString(@"You will get a single notification for all feeds combined (“baRSS: X unread articles”). A click on the notification banner will open all unread articles of all feeds.", nil);
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@@ -7,6 +7,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
@property (strong) IBOutlet NSTextField *defaultReader;
|
||||
@property (strong) IBOutlet NSPopUpButton* popupHttpApplication;
|
||||
@property (strong) IBOutlet NSPopUpButton* popupNotificationType;
|
||||
@property (strong) IBOutlet NSTextField* notificationHelp;
|
||||
|
||||
- (instancetype)initWithController:(SettingsGeneral*)controller NS_DESIGNATED_INITIALIZER;
|
||||
- (instancetype)initWithFrame:(NSRect)frameRect NS_UNAVAILABLE;
|
||||
|
||||
@@ -23,6 +23,12 @@
|
||||
NSTextField *l3 = [[NSView label:NSLocalizedString(@"Notifications:", nil)] placeIn:self x:PAD_WIN yTop:y + 1];
|
||||
self.popupNotificationType = [[[[NSView popupButton:0] placeIn:self x:NSMaxX(l3.frame) + PAD_S yTop:y] sizeToRight:PAD_WIN]
|
||||
action:@selector(changeNotificationType:) target:controller];
|
||||
|
||||
// Notification help text
|
||||
y = YFromTop(self.popupNotificationType) + PAD_M;
|
||||
self.notificationHelp = [[[[[NSView label:@""] gray]
|
||||
multiline:NSMakeSize(320 - 2*PAD_WIN, HEIGHT_LABEL * 5)]
|
||||
placeIn:self x:PAD_WIN yTop:y] sizeToRight:PAD_WIN];
|
||||
return self;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user