From 03e79eb2895e1c8a0cea89c65e19536de08fce65 Mon Sep 17 00:00:00 2001 From: Alaric Senat <dev.asenat@posteo.net> Date: Mon, 11 Dec 2023 16:04:21 +0100 Subject: [PATCH] Media: Notify external media creation Users actually expect the "New Media" notification to trigger at each media addition instead of just the internal ones. This was reported by the Android team as they are building a remote access service. Notifying external media creation this way allow them to update their UI without having to worry if the media is internal or external. It's simpler that way. --- src/Media.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Media.cpp b/src/Media.cpp index 4d75a5d6..43cfec33 100644 --- a/src/Media.cpp +++ b/src/Media.cpp @@ -224,6 +224,10 @@ std::shared_ptr<Media> Media::createExternalMedia( MediaLibraryPtr ml, return nullptr; t->commit(); + + auto notifier = ml->getNotifier(); + if ( notifier != nullptr) + notifier->notifyMediaCreation( self ); return self; } @@ -1062,9 +1066,6 @@ bool Media::markAsInternal( Type type, int64_t duration, int64_t deviceId, int64 deviceId, folderId, ImportType::Internal, m_id ) == false ) return false; - auto notifier = m_ml->getNotifier(); - if ( notifier != nullptr ) - notifier->notifyMediaCreation( shared_from_this() ); m_type = type; m_duration = duration; m_deviceId = deviceId; -- GitLab