Skip to content

Commit

Permalink
fixup: separating library notifications from general messages
Browse files Browse the repository at this point in the history
  • Loading branch information
wutschel committed Sep 14, 2024
1 parent 1a498cd commit bc841fd
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 15 deletions.
21 changes: 13 additions & 8 deletions XBMC Remote/MasterViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -383,22 +383,22 @@ - (void)viewDidLoad {
object: nil];

[[NSNotificationCenter defaultCenter] addObserver: self
selector: @selector(showNotificationMessage:)
selector: @selector(handleLibraryNotification:)
name: @"AudioLibrary.OnScanFinished"
object: nil];

[[NSNotificationCenter defaultCenter] addObserver: self
selector: @selector(showNotificationMessage:)
selector: @selector(handleLibraryNotification:)
name: @"AudioLibrary.OnCleanFinished"
object: nil];

[[NSNotificationCenter defaultCenter] addObserver: self
selector: @selector(showNotificationMessage:)
selector: @selector(handleLibraryNotification:)
name: @"VideoLibrary.OnScanFinished"
object: nil];

[[NSNotificationCenter defaultCenter] addObserver: self
selector: @selector(showNotificationMessage:)
selector: @selector(handleLibraryNotification:)
name: @"VideoLibrary.OnCleanFinished"
object: nil];

Expand All @@ -411,12 +411,17 @@ - (void)viewDidLoad {
[menuList selectRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:0] animated:YES scrollPosition:UITableViewScrollPositionNone];
}

- (void)handleLibraryNotification:(NSNotification*)note {
[Utilities showMessage:note.name color:[Utilities getSystemGreen:0.95]];
}

- (void)showNotificationMessage:(NSNotification*)note {
[self addMessagesToRootView];
NSDictionary *params = note.userInfo;
UIColor *messageColor = params[@"color"] ?: [Utilities getSystemGreen:0.95];
NSString *messageText = params[@"message"] ?: note.name;
[messagesView showMessage:messageText timeout:2.0 color:messageColor];
if (!params) {
return;
}
[self addMessagesToRootView];
[messagesView showMessage:params[@"message"] timeout:2.0 color:params[@"color"]];
}

- (void)connectionStatus:(NSNotification*)note {
Expand Down
19 changes: 12 additions & 7 deletions XBMC Remote/ViewControllerIPad.m
Original file line number Diff line number Diff line change
Expand Up @@ -602,22 +602,22 @@ - (void)viewDidLoad {
object: nil];

[[NSNotificationCenter defaultCenter] addObserver: self
selector: @selector(showNotificationMessage:)
selector: @selector(handleLibraryNotification:)
name: @"AudioLibrary.OnScanFinished"
object: nil];

[[NSNotificationCenter defaultCenter] addObserver: self
selector: @selector(showNotificationMessage:)
selector: @selector(handleLibraryNotification:)
name: @"AudioLibrary.OnCleanFinished"
object: nil];

[[NSNotificationCenter defaultCenter] addObserver: self
selector: @selector(showNotificationMessage:)
selector: @selector(handleLibraryNotification:)
name: @"VideoLibrary.OnScanFinished"
object: nil];

[[NSNotificationCenter defaultCenter] addObserver: self
selector: @selector(showNotificationMessage:)
selector: @selector(handleLibraryNotification:)
name: @"VideoLibrary.OnCleanFinished"
object: nil];

Expand All @@ -627,11 +627,16 @@ - (void)viewDidLoad {
object: nil];
}

- (void)handleLibraryNotification:(NSNotification*)note {
[Utilities showMessage:note.name color:[Utilities getSystemGreen:0.95]];
}

- (void)showNotificationMessage:(NSNotification*)note {
NSDictionary *params = note.userInfo;
UIColor *messageColor = params[@"color"] ?: [Utilities getSystemGreen:0.95];
NSString *messageText = params[@"message"] ?: note.name;
[messagesView showMessage:messageText timeout:2.0 color:messageColor];
if (!params) {
return;
}
[messagesView showMessage:params[@"message"] timeout:2.0 color:params[@"color"]];
}

- (void)handlePlaylistHeaderUpdate:(NSNotification*)sender {
Expand Down

0 comments on commit bc841fd

Please sign in to comment.