@ -1,6 +1,8 @@
local BD = require ( " ui/bidi " )
local BD = require ( " ui/bidi " )
local ConfirmBox = require ( " ui/widget/confirmbox " )
local Device = require ( " device " )
local Device = require ( " device " )
local InfoMessage = require ( " ui/widget/infomessage " )
local InfoMessage = require ( " ui/widget/infomessage " )
local Notification = require ( " ui/widget/notification " )
local UIManager = require ( " ui/uimanager " )
local UIManager = require ( " ui/uimanager " )
local Version = require ( " version " )
local Version = require ( " version " )
local dbg = require ( " dbg " )
local dbg = require ( " dbg " )
@ -51,38 +53,21 @@ common_info.about = {
} )
} )
end
end
}
}
common_info.debug_logging = {
common_info.report_bug = {
text = _ ( " Enable verbose debug logging " ) ,
text_func = function ( )
checked_func = function ( )
local label = _ ( " Report a bug " )
return G_reader_settings : isTrue ( " debug_verbose " )
end ,
callback = function ( )
-- Unlike in the dev options, we flip everything at once.
if G_reader_settings : isTrue ( " debug_verbose " ) then
if G_reader_settings : isTrue ( " debug_verbose " ) then
dbg : setVerbose ( false )
label = label .. " " .. _ ( " (verbose logging is enabled) " )
dbg : turnOff ( )
G_reader_settings : makeFalse ( " debug_verbose " )
G_reader_settings : makeFalse ( " debug " )
else
dbg : turnOn ( )
dbg : setVerbose ( true )
G_reader_settings : makeTrue ( " debug " )
G_reader_settings : makeTrue ( " debug_verbose " )
end
end
-- Also unlike the dev options, explicitly ask for a restart,
return label
-- to make sure framebuffer pulls in a logger.dbg ref that doesn't point to noop on init ;).
UIManager : askForRestart ( )
end ,
end ,
}
common_info.report_bug = {
text = _ ( " Report a bug " ) ,
keep_menu_open = true ,
keep_menu_open = true ,
callback _func = function ( )
callback = function ( touchmenu_instance )
local DataStorage = require ( " datastorage " )
local DataStorage = require ( " datastorage " )
local log_path = string.format ( " %s/%s " , DataStorage : getDataDir ( ) , " crash.log " )
local log_path = string.format ( " %s/%s " , DataStorage : getDataDir ( ) , " crash.log " )
local common_msg = T ( _ ( " Please report bugs to \n https://github.com/koreader/koreader/issues \n \n Version: \n %1 \n \n Detected device: \n %2 " ) ,
local common_msg = T ( _ ( " Please report bugs to \n https://github.com/koreader/koreader/issues \n \n Version: \n %1 \n \n Detected device: \n %2 " ) ,
Version : getCurrentRevision ( ) , Device : info ( ) )
Version : getCurrentRevision ( ) , Device : info ( ) )
local log_msg = T ( _ ( " Reproduce the issue with verbose debug logging enabled, and attach %1 to your bug report." ) , log_path )
local log_msg = T ( _ ( " Verbose logs will make our investigations easier. If possible, try to reproduce the issue while it's enabled, and attach %1 to your bug report." ) , log_path )
if Device : isAndroid ( ) then
if Device : isAndroid ( ) then
local android = require ( " android " )
local android = require ( " android " )
@ -95,8 +80,37 @@ common_info.report_bug = {
else
else
msg = common_msg
msg = common_msg
end
end
UIManager : show ( InfoMessage : new {
UIManager : show ( ConfirmBox : new {
text = msg ,
text = msg ,
icon = " notice-info " ,
no_ok_button = true ,
other_buttons_first = true ,
other_buttons = { {
{
text = G_reader_settings : isTrue ( " debug_verbose " ) and _ ( " Disable verbose logging " ) or _ ( " Enable verbose logging " ) ,
callback = function ( )
-- Flip verbose logging on dismissal
-- Unlike in the dev options, we flip everything at once.
if G_reader_settings : isTrue ( " debug_verbose " ) then
dbg : setVerbose ( false )
dbg : turnOff ( )
G_reader_settings : makeFalse ( " debug_verbose " )
G_reader_settings : makeFalse ( " debug " )
Notification : notify ( _ ( " Verbose logging disabled " ) , Notification.SOURCE_ALWAYS_SHOW )
else
dbg : turnOn ( )
dbg : setVerbose ( true )
G_reader_settings : makeTrue ( " debug " )
G_reader_settings : makeTrue ( " debug_verbose " )
Notification : notify ( _ ( " Verbose logging enabled " ) , Notification.SOURCE_ALWAYS_SHOW )
end
touchmenu_instance : updateItems ( )
-- Also unlike the dev options, explicitly ask for a restart,
-- to make sure framebuffer pulls in a logger.dbg ref that doesn't point to noop on init ;).
UIManager : askForRestart ( )
end ,
}
} } ,
} )
} )
end
end
}
}