Skip to content

Commit 8521a38

Browse files
JF002JustScott
authored andcommitted
Emit the message BleRadioEnableToggle to DisplayApp only if the enable state of the radio has actually changed. (InfiniTimeOrg#2037)
This fixes an issue where the BLE connected logo would disappear when opening and closing the BLE setting (without changing it) while InfiniTime was already connected to a companion app. Co-authored-by: JustScott <development@justscott.me>
1 parent 0c7a867 commit 8521a38

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

src/displayapp/screens/settings/SettingBluetooth.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -36,24 +36,24 @@ namespace {
3636

3737
SettingBluetooth::SettingBluetooth(Pinetime::Applications::DisplayApp* app, Pinetime::Controllers::Settings& settingsController)
3838
: app {app},
39+
settings {settingsController},
3940
checkboxList(
4041
0,
4142
1,
4243
"Bluetooth",
4344
Symbols::bluetooth,
4445
settingsController.GetBleRadioEnabled() ? 0 : 1,
45-
[&settings = settingsController](uint32_t index) {
46+
[this](uint32_t index) {
4647
const bool priorMode = settings.GetBleRadioEnabled();
4748
const bool newMode = options[index].radioEnabled;
4849
if (newMode != priorMode) {
4950
settings.SetBleRadioEnabled(newMode);
51+
this->app->PushMessage(Pinetime::Applications::Display::Messages::BleRadioEnableToggle);
5052
}
5153
},
5254
CreateOptionArray()) {
5355
}
5456

5557
SettingBluetooth::~SettingBluetooth() {
5658
lv_obj_clean(lv_scr_act());
57-
// Pushing the message in the OnValueChanged function causes a freeze?
58-
app->PushMessage(Pinetime::Applications::Display::Messages::BleRadioEnableToggle);
5959
}

src/displayapp/screens/settings/SettingBluetooth.h

+1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ namespace Pinetime {
2020

2121
private:
2222
DisplayApp* app;
23+
Pinetime::Controllers::Settings& settings;
2324
CheckboxList checkboxList;
2425
};
2526
}

0 commit comments

Comments
 (0)