~aleteoryx/muditaos

885d70d868dfcdaa462eb3187462aeddc44a7e8f — Paweł Joński 4 years ago 8bad97c
[BH-989] Unify alarm will ring message

Unify alarm will ring message
M products/BellHybrid/apps/application-bell-alarm/windows/BellAlarmSetWindow.cpp => products/BellHybrid/apps/application-bell-alarm/windows/BellAlarmSetWindow.cpp +1 -1
@@ 51,7 51,7 @@ namespace gui
        if (presenter->isAlarmActive()) {
            icon->image->set("big_alarm_W_G");
            icon->text->setRichText(utils::time::getBottomDescription(
                utils::time::calculateTimeDifference(presenter->getAlarmTime(), utils::time::getCurrentTime())));
                utils::time::calculateMinutesDifference(presenter->getAlarmTime(), utils::time::getCurrentTime())));
        }
        else {
            icon->image->set("big_no-alarm_W_G");

M products/BellHybrid/apps/application-bell-main/presenters/StateController.cpp => products/BellHybrid/apps/application-bell-main/presenters/StateController.cpp +1 -1
@@ 177,7 177,7 @@ namespace app::home_screen
                alarmModel.activate(true);
                presenter.spawnTimer();
                view.setBottomDescription(utils::time::getBottomDescription(
                    utils::time::calculateTimeDifference(view.getAlarmTime(), timeModel.getCurrentTime())));
                    utils::time::calculateMinutesDifference(view.getAlarmTime(), timeModel.getCurrentTime())));
                view.setAlarmActive(true);
                view.setAlarmVisible(true);
            };

M products/BellHybrid/apps/common/include/common/TimeUtils.hpp => products/BellHybrid/apps/common/include/common/TimeUtils.hpp +1 -0
@@ 11,5 11,6 @@ namespace utils::time
{
    std::time_t getCurrentTime();
    std::time_t calculateTimeDifference(std::time_t alarmTime, std::time_t currentTime);
    std::time_t calculateMinutesDifference(std::time_t alarmTime, std::time_t currentTime);
    UTF8 getBottomDescription(std::time_t timestamp);
} // namespace utils::time

M products/BellHybrid/apps/common/src/TimeUtils.cpp => products/BellHybrid/apps/common/src/TimeUtils.cpp +7 -0
@@ 4,6 4,7 @@
#include <common/TimeUtils.hpp>

#include <time/time_conversion.hpp>
#include <time/dateCommon.hpp>

namespace utils::time
{


@@ 16,6 17,12 @@ namespace utils::time
    {
        return Duration{alarmTime, currentTime}.get();
    }
    std::time_t calculateMinutesDifference(std::time_t alarmTime, std::time_t currentTime)
    {
        const auto floorMinutesAlarmTime   = alarmTime - alarmTime % 60;
        const auto floorMinutesCurrentTime = currentTime - currentTime % 60;
        return calculateTimeDifference(floorMinutesAlarmTime, floorMinutesCurrentTime);
    }

    UTF8 getBottomDescription(std::time_t timestamp)
    {

M products/BellHybrid/apps/common/src/popups/AlarmActivatedWindow.cpp => products/BellHybrid/apps/common/src/popups/AlarmActivatedWindow.cpp +1 -1
@@ 81,6 81,6 @@ namespace gui
    void AlarmActivatedWindow::setAlarmTime(time_t alarmTime)
    {
        icon->text->setRichText(utils::time::getBottomDescription(
            utils::time::calculateTimeDifference(alarmTime, utils::time::getCurrentTime())));
            utils::time::calculateMinutesDifference(alarmTime, utils::time::getCurrentTime())));
    }
} /* namespace gui */