~aleteoryx/muditaos

1b08c01c0c66fca3ba0a1b6356f7373e3f113401 — Dawid Wojtas 2 years ago 31315ef
[BH-1748] Fix problem with sounds in applications

The deep press can disable alarms which cause
disable sounds. That behavior interrupts sounds in
applications.
M harmony_changelog.md => harmony_changelog.md +1 -0
@@ 17,6 17,7 @@
* Fixed problem with disabling the frontlight in pre-wake up
* Fixed occasional crash when a deep press occurs during popups
* Fixed diacritics in translations
* Fixed problem with sounds in relaxation and power nap applications

### Added


M products/BellHybrid/services/time/AlarmOperations.cpp => products/BellHybrid/services/time/AlarmOperations.cpp +11 -3
@@ 190,6 190,7 @@ namespace alarms
        if (!decision.timeForChime && !decision.timeForFrontlight) {
            return false;
        }
        preWakeUp.setActive(true);
        handlePreWakeUp(nextEvent, decision);
        return true;
    }


@@ 249,8 250,11 @@ namespace alarms

    auto AlarmOperations::disablePreWakeUp(const std::shared_ptr<AlarmEventRecord> &event) -> void
    {
        AlarmOperationsCommon::handleAlarmEvent(event, alarms::AlarmType::PreWakeUpChime, false);
        AlarmOperationsCommon::handleAlarmEvent(event, alarms::AlarmType::PreWakeUpFrontlight, false);
        if (preWakeUp.isActive()) {
            AlarmOperationsCommon::handleAlarmEvent(event, alarms::AlarmType::PreWakeUpChime, false);
            AlarmOperationsCommon::handleAlarmEvent(event, alarms::AlarmType::PreWakeUpFrontlight, false);
            preWakeUp.setActive(false);
        }
    }

    bool AlarmOperations::processSnoozeChime(TimePoint now)


@@ 323,7 327,6 @@ namespace alarms
        const auto frontlightSettings  = settingsProvider->getFrontlightSettings();
        const auto isTimeForChime      = isTimeForPreWakeUp(now, event, chimeSettings);
        const auto isTimeForFrontlight = isTimeForPreWakeUp(now, event, frontlightSettings);
        active                         = isTimeForChime || isTimeForFrontlight;
        return {isTimeForChime, isTimeForFrontlight};
    }



@@ 339,6 342,11 @@ namespace alarms
        return active;
    }

    auto PreWakeUp::setActive(bool state) -> void
    {
        active = state;
    }

    Bedtime::Bedtime(std::unique_ptr<AbstractBedtimeSettingsProvider> &&settingsProvider)
        : settingsProvider{std::move(settingsProvider)}
    {}

M products/BellHybrid/services/time/include/time/AlarmOperations.hpp => products/BellHybrid/services/time/include/time/AlarmOperations.hpp +1 -0
@@ 65,6 65,7 @@ namespace alarms
        explicit PreWakeUp(std::unique_ptr<PreWakeUpSettingsProvider> &&settingsProvider);
        auto decide(TimePoint now, const SingleEventRecord &event) -> Decision;
        auto isActive() const -> bool;
        auto setActive(bool state) -> void;

      private:
        auto isTimeForPreWakeUp(TimePoint now,