2020-01-04 00:18:51 +00:00
local BD = require ( " ui/bidi " )
2014-11-21 14:41:14 +00:00
local Device = require ( " device " )
local InfoMessage = require ( " ui/widget/infomessage " )
local UIManager = require ( " ui/uimanager " )
2020-08-29 03:20:28 +00:00
local Version = require ( " version " )
2022-09-27 23:10:50 +00:00
local lfs = require ( " libs/libkoreader-lfs " )
2014-11-21 14:41:14 +00:00
local _ = require ( " gettext " )
2017-04-03 21:52:47 +00:00
local T = require ( " ffi/util " ) . template
2014-11-21 14:41:14 +00:00
local common_info = { }
2018-10-06 05:55:35 +00:00
if Device : hasOTAUpdates ( ) then
2014-11-21 14:41:14 +00:00
local OTAManager = require ( " ui/otamanager " )
2017-03-03 06:41:10 +00:00
common_info.ota_update = OTAManager : getOTAMenuTable ( )
2014-11-21 14:41:14 +00:00
end
2017-03-03 06:41:10 +00:00
common_info.version = {
2020-08-29 03:20:28 +00:00
text = T ( _ ( " Version: %1 " ) , Version : getShortVersion ( ) ) ,
2018-09-04 21:55:58 +00:00
keep_menu_open = true ,
2014-11-21 14:41:14 +00:00
callback = function ( )
UIManager : show ( InfoMessage : new {
2020-08-29 03:20:28 +00:00
text = Version : getCurrentRevision ( ) ,
2014-11-21 14:41:14 +00:00
} )
end
2017-02-28 21:46:32 +00:00
}
2017-03-03 06:41:10 +00:00
common_info.help = {
2014-11-21 14:41:14 +00:00
text = _ ( " Help " ) ,
2017-04-03 21:52:47 +00:00
}
2020-06-19 18:40:40 +00:00
common_info.more_tools = {
2020-06-18 10:21:09 +00:00
text = _ ( " More tools " ) ,
2017-06-24 07:55:31 +00:00
}
2018-08-11 20:47:33 +00:00
common_info.device = {
text = _ ( " Device " ) ,
}
2017-04-15 12:45:56 +00:00
common_info.quickstart_guide = {
text = _ ( " Quickstart guide " ) ,
callback = function ( )
2017-04-24 06:27:29 +00:00
local QuickStart = require ( " ui/quickstart " )
2017-04-15 12:45:56 +00:00
local ReaderUI = require ( " apps/reader/readerui " )
ReaderUI : showReader ( QuickStart : getQuickStart ( ) )
end
}
2017-04-03 21:52:47 +00:00
common_info.about = {
text = _ ( " About " ) ,
2018-09-04 21:55:58 +00:00
keep_menu_open = true ,
2017-04-03 21:52:47 +00:00
callback = function ( )
UIManager : show ( InfoMessage : new {
2021-02-20 17:10:39 +00:00
text = T ( _ ( " KOReader %1 \n \n A document viewer for E Ink devices. \n \n Licensed under Affero GPL v3. All dependencies are free software. \n \n http://koreader.rocks " ) , BD.ltr ( Version : getCurrentRevision ( ) ) ) ,
2020-12-19 11:18:30 +00:00
icon = " koreader " ,
2017-04-03 21:52:47 +00:00
} )
end
}
common_info.report_bug = {
text = _ ( " Report a bug " ) ,
2018-09-04 21:55:58 +00:00
keep_menu_open = true ,
2021-05-22 23:20:13 +00:00
callback_func = function ( )
local DataStorage = require ( " datastorage " )
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 " ) ,
Version : getCurrentRevision ( ) , Device : info ( ) )
local log_msg = T ( _ ( " Attach %1 to your bug report. " ) , log_path )
if Device : isAndroid ( ) then
local android = require ( " android " )
2021-06-07 15:13:34 +00:00
android.dumpLogs ( )
2021-05-22 23:20:13 +00:00
end
local msg
if lfs.attributes ( log_path , " mode " ) == " file " then
msg = string.format ( " %s \n \n %s " , common_msg , log_msg )
else
msg = common_msg
end
2014-11-21 14:41:14 +00:00
UIManager : show ( InfoMessage : new {
2021-05-22 23:20:13 +00:00
text = msg ,
2014-11-21 14:41:14 +00:00
} )
end
2017-02-28 21:46:32 +00:00
}
2017-09-03 13:40:50 +00:00
2014-11-21 14:41:14 +00:00
return common_info