Gestures/profiles: allow disabling popup messages (#14543)

This commit is contained in:
hius07
2025-11-05 07:48:08 +02:00
committed by GitHub
parent 7bd546f587
commit 7d3d51add4
4 changed files with 30 additions and 10 deletions

View File

@@ -1207,6 +1207,7 @@ function Dispatcher:execute(settings, exec_props)
local has_many = Dispatcher:_itemsCount(settings) > 1
if has_many then
UIManager:broadcastEvent(Event:new("BatchedUpdate"))
UIManager:setSilentMode(true)
end
Notification:setNotifySource(Notification.SOURCE_DISPATCHER)
if settings.settings and settings.settings.notify then
@@ -1253,6 +1254,7 @@ function Dispatcher:execute(settings, exec_props)
end
Notification:resetNotifySource()
if has_many then
UIManager:setSilentMode(false)
UIManager:broadcastEvent(Event:new("BatchedUpdateDone"))
end
end

View File

@@ -124,6 +124,14 @@ function UIManager:setIgnoreTouchInput(state)
InputContainer:setIgnoreTouchInput(state)
end
function UIManager:setSilentMode(toggle)
self.silent_mode = toggle or nil
end
function UIManager:isInSilentMode()
return self.silent_mode or false
end
--[[--
Registers and shows a widget.
@@ -150,6 +158,10 @@ function UIManager:show(widget, refreshtype, refreshregion, x, y, refreshdither)
logger.dbg("attempted to show a nil widget")
return
end
if self.silent_mode and widget.honor_silent_mode then
logger.dbg("widget show disabled:", widget.id or widget.name or tostring(widget))
return
end
logger.dbg("show widget:", widget.id or widget.name or tostring(widget))
local window = {x = x or 0, y = y or 0, widget = widget}

View File

@@ -46,6 +46,7 @@ local Screen = Device.screen
local InfoMessage = InputContainer:extend{
modal = true,
honor_silent_mode = true,
face = nil,
monospace_font = false,
text = "",

View File

@@ -107,16 +107,21 @@ function MoveToArchive:onMoveToArchive(do_copy)
require("readcollection"):updateItem(document_full_path, dest_file)
end
DocSettings.updateLocation(document_full_path, dest_file, do_copy)
UIManager:show(ConfirmBox:new{
text = text,
ok_callback = function()
local ReaderUI = require("apps/reader/readerui")
ReaderUI:showReader(dest_file)
end,
cancel_callback = function()
self:openFileBrowser(self.last_copied_from_dir)
end,
})
if UIManager:isInSilentMode() then
-- no dialog to allow multi-action executing
self:openFileBrowser(self.last_copied_from_dir)
else
UIManager:show(ConfirmBox:new{
text = text,
ok_callback = function()
local ReaderUI = require("apps/reader/readerui")
ReaderUI:showReader(dest_file)
end,
cancel_callback = function()
self:openFileBrowser(self.last_copied_from_dir)
end,
})
end
end
function MoveToArchive:setArchiveDirectory()