AutoWarmth: add option to hide the "night mode changed" warning (#13253)

Closes #13163.
This commit is contained in:
ly-pa
2025-07-30 13:30:50 +01:00
committed by GitHub
parent 5009d36d79
commit a674bc8510

View File

@@ -79,6 +79,7 @@ function AutoWarmth:init()
self.control_warmth = G_reader_settings:nilOrTrue("autowarmth_control_warmth")
self.control_nightmode = G_reader_settings:nilOrTrue("autowarmth_control_nightmode")
self.hide_nightmode_warning = G_reader_settings:isTrue("autowarmth_hide_nightmode_warning")
if not Device:hasNaturalLight() then
self.control_nightmode = true
elseif not self.control_warmth and not self.control_nightmode then
@@ -221,6 +222,13 @@ function AutoWarmth:_onToggleNightMode()
self.hide_nightmode_warning = true
end,
}},
{{
text = _("Hide this warning permanently"),
provider = function()
self.hide_nightmode_warning = true
G_reader_settings:makeTrue("autowarmth_hide_nightmode_warning")
end,
}},
{{
text = _("Disable AutoWarmth's nightmode control"),
provider = function()
@@ -645,6 +653,17 @@ function AutoWarmth:getSubMenuItems()
sub_item_table_func = function() return self:getWarmthMenu() end,
},
self:getFlOffDuringDayMenu(),
{
text = _("Enable night mode warning"),
checked_func = function()
return not self.hide_nightmode_warning
end,
callback = function()
self.hide_nightmode_warning = not self.hide_nightmode_warning
G_reader_settings:saveSetting("autowarmth_hide_nightmode_warning", self.hide_nightmode_warning)
end,
separator = true,
},
self:getTimesMenu(_("Currently active parameters")),
self:getTimesMenu(_("Sun position information for"), true, activate_sun),
self:getTimesMenu(_("Fixed schedule information"), false, activate_schedule),
@@ -722,7 +741,6 @@ For cloudy autumn days, the switch-on/off time can be shifted by an offset.]]),
})
end,
keep_menu_open = true,
separator = true,
}
end