From a674bc8510ca7bca6e7e0bb1a90c15078ccc0702 Mon Sep 17 00:00:00 2001 From: ly-pa <40139299+ly-pa@users.noreply.github.com> Date: Wed, 30 Jul 2025 13:30:50 +0100 Subject: [PATCH] AutoWarmth: add option to hide the "night mode changed" warning (#13253) Closes #13163. --- plugins/autowarmth.koplugin/main.lua | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/plugins/autowarmth.koplugin/main.lua b/plugins/autowarmth.koplugin/main.lua index 702144fd8..e9f479499 100644 --- a/plugins/autowarmth.koplugin/main.lua +++ b/plugins/autowarmth.koplugin/main.lua @@ -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