~aleteoryx/muditaos

ffd01ae81ac4b77672845e54d04972e2d6339899 — Bartosz Szostak 3 years ago d28fdb6
[MOS-651] Update the unread message counter after a thread deletion

In order to delete notification of unread messages
from the thread, which was deleted.
After successful deletion of the thread
the unread messages counter is updated
as when the thread is opened.
2 files changed, 10 insertions(+), 2 deletions(-)

M module-apps/application-messages/ApplicationMessages.cpp
M pure_changelog.md
M module-apps/application-messages/ApplicationMessages.cpp => module-apps/application-messages/ApplicationMessages.cpp +8 -1
@@ 25,6 25,7 @@
#include <module-db/queries/messages/threads/QueryThreadGetByID.hpp>
#include <module-db/queries/messages/threads/QueryThreadRemove.hpp>
#include <module-db/queries/phonebook/QueryContactGetByNumberID.hpp>
#include <module-db/queries/notifications/QueryNotificationsDecrement.hpp>
#include <OptionsWindow.hpp>
#include <OptionWindow.hpp>
#include <service-cellular/CellularMessage.hpp>


@@ 221,9 222,15 @@ namespace app

        auto query = std::make_unique<ThreadRemove>(record.ID);
        auto task  = app::AsyncQuery::createFromQuery(std::move(query), db::Interface::Name::SMSThread);
        task->setCallback([this, threadId = record.ID](auto response) {
        task->setCallback([this, threadId = record.ID, unreadMsgCount = record.unreadMsgCount](auto response) {
            const auto result = dynamic_cast<ThreadRemoveResult *>(response);
            if ((result != nullptr) && result->success()) {
                if (unreadMsgCount) {
                    DBServiceAPI::GetQuery(this,
                                           db::Interface::Name::Notifications,
                                           std::make_unique<db::query::notifications::Decrement>(
                                               NotificationsRecord::Key::Sms, unreadMsgCount));
                }
                switchWindow(gui::name::window::main_window);
                return true;
            }

M pure_changelog.md => pure_changelog.md +2 -1
@@ 28,12 28,13 @@
* Fixed inability to unblock SIM card when previously ejected during slot switching
* Fixed French translations for Ulock Screen
* Fixed crash when syncing with Mudita Center
* Fixed inactive alarms after timezone change and reboot.
* Fixed inactive alarms after timezone change and reboot
* Fixed no sound when Bluetooth audio device connected/disconnected during call
* Fixed full filesystem path displayed in music player for invalid files instead of just filename
* Fixed problem with track info not being displayed correctly
* Fixed alarm rings on the low battery screen
* Fixed crash when trying to play 96kHz FLAC with USB cable connected
* Fixed the notification of unread messages are not deleted with the thread

### Added