From bc841fdd5464480b4a657802974d365e80c27cd7 Mon Sep 17 00:00:00 2001 From: wutschel Date: Sat, 14 Sep 2024 16:32:29 +0200 Subject: [PATCH] fixup: separating library notifications from general messages --- XBMC Remote/MasterViewController.m | 21 +++++++++++++-------- XBMC Remote/ViewControllerIPad.m | 19 ++++++++++++------- 2 files changed, 25 insertions(+), 15 deletions(-) diff --git a/XBMC Remote/MasterViewController.m b/XBMC Remote/MasterViewController.m index 9676e3579..59c3d78cb 100644 --- a/XBMC Remote/MasterViewController.m +++ b/XBMC Remote/MasterViewController.m @@ -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]; @@ -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 { diff --git a/XBMC Remote/ViewControllerIPad.m b/XBMC Remote/ViewControllerIPad.m index b1645acb9..d859d029f 100644 --- a/XBMC Remote/ViewControllerIPad.m +++ b/XBMC Remote/ViewControllerIPad.m @@ -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]; @@ -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 {