Last active
December 20, 2022 06:25
-
-
Save zwim/c2f98eb72e2a05004f4041edf0de867d to your computer and use it in GitHub Desktop.
Show a message, when KOReader was updated on next start.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- a patch for showing a message after an update of KOReader | |
local lfs = require("libs/libkoreader-lfs") | |
local DataStorage = require("datastorage") | |
local ffiutil = require("ffi/util") | |
local patch_dir = DataStorage:getDataDir() .. "/patches" | |
if lfs.attributes(patch_dir .. "/09-UpgradeMessage.lua", "mode") == "file" then | |
os.remove(patch_dir .. "/29-UpgradeMessage.lua") -- to be safe, as there coulde be a patch with that name ;) | |
os.rename(patch_dir .. "/09-UpgradeMessage.lua", patch_dir .. "/29-UpgradeMessage.lua") | |
return | |
end | |
-- this part is executed delayed (=UserPatch.late), when it was renamed to 29-UpgradeMessage.lua | |
os.remove(patch_dir .. "/09-UpgradeMessage.lua") -- just to be safe (should not be necessary) | |
os.rename(patch_dir .. "/29-UpgradeMessage.lua", patch_dir .. "/09-UpgradeMessage.lua") | |
local UIManager = require("ui/uimanager") | |
local InfoMessage = require("ui/widget/infomessage") | |
UIManager:show(InfoMessage:new{ | |
text = " KOReader was updated.", | |
show_icon = false, | |
}) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment