From 27385f04a30c3a7883fa6dd6c1c3dcaa24414eb8 Mon Sep 17 00:00:00 2001 From: Mateusz Piesta Date: Wed, 16 Feb 2022 09:43:39 +0100 Subject: [PATCH] [BH-1259] Changing language resets snooze timer Due to improper ownership model, all data models used by the main application were recreated each time the language changed. --- .../application-bell-main/ApplicationBellMain.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/products/BellHybrid/apps/application-bell-main/ApplicationBellMain.cpp b/products/BellHybrid/apps/application-bell-main/ApplicationBellMain.cpp index 33a66edda339e8da4a0621c09ee5ae47d6664b5e..45f9f0cdbc28ea10d14169cfb67cdce25315a06b 100644 --- a/products/BellHybrid/apps/application-bell-main/ApplicationBellMain.cpp +++ b/products/BellHybrid/apps/application-bell-main/ApplicationBellMain.cpp @@ -76,6 +76,13 @@ namespace app return ret; } + auto timeModel = std::make_unique(); + auto batteryModel = std::make_unique(this); + auto temperatureModel = std::make_unique(this); + auto alarmModel = std::make_unique(this); + homeScreenPresenter = std::make_shared( + this, std::move(alarmModel), std::move(batteryModel), std::move(temperatureModel), std::move(timeModel)); + createUserInterface(); return sys::ReturnCodes::Success; @@ -84,12 +91,6 @@ namespace app void ApplicationBellMain::createUserInterface() { windowsFactory.attach(gui::name::window::main_window, [this](ApplicationCommon *app, const std::string &name) { - auto timeModel = std::make_unique(); - auto batteryModel = std::make_unique(app); - auto temperatureModel = std::make_unique(app); - auto alarmModel = std::make_unique(app); - homeScreenPresenter = std::make_shared( - app, std::move(alarmModel), std::move(batteryModel), std::move(temperatureModel), std::move(timeModel)); auto window = std::make_unique(app, homeScreenPresenter); // TODO: To be replaced with settings db read setHomeScreenLayout("ClassicWithTemp");