[CP-1210] Contacts imported from SIM dont show up in Mudita Center

Fix for imported contacts from SIM don't show up in Mudita Center.
Added functionality to send notification after all imported contacts are
added to the database.
This commit is contained in:
Lukasz Mastalerz
2023-01-25 13:18:36 +01:00
committed by Łukasz Mastalerz
parent 942b837f92
commit d7c8a8a6bf
10 changed files with 51 additions and 23 deletions

View File

@@ -1,4 +1,4 @@
// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved.
// Copyright (c) 2017-2023, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md
#include "SimContactsRepository.hpp"
@@ -93,11 +93,15 @@ void SimContactsRepository::save(const std::vector<bool> &selectedContacts,
if (result == nullptr) {
return false;
}
for (const auto &r : result->getResult()) {
sendNotification(r);
}
if (callback) {
callback();
}
return true;
});
task->execute(application, this);
}
@@ -141,6 +145,13 @@ void SimContactsRepository::updateImportedRecords(const std::vector<cellular::Si
#endif
}
void SimContactsRepository::sendNotification(const NotificationData &notificationData)
{
auto notificationMessage = std::make_shared<db::NotificationMessage>(
db::Interface::Name::Contact, notificationData.first, notificationData.second);
application->bus.sendMulticast(notificationMessage, sys::BusChannel::ServiceDBNotifications);
}
#if DEBUG_SIM_IMPORT_DATA == 1
void SimContactsRepository::printRecordsData(const std::string &name, const std::vector<ContactRecord> &data)
{