mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
@@ -11,6 +11,7 @@ local Device = {
|
||||
screen_saver_mode = false,
|
||||
charging_mode = false,
|
||||
survive_screen_saver = false,
|
||||
is_special_offers = nil,
|
||||
touch_dev = nil,
|
||||
model = nil,
|
||||
firmware_rev = nil,
|
||||
@@ -265,4 +266,26 @@ function Device:getPowerDevice()
|
||||
return self.powerd
|
||||
end
|
||||
|
||||
function Device:isSpecialOffers()
|
||||
if self.is_special_offers ~= nil then return self.is_special_offers end
|
||||
-- K5 only
|
||||
if self:isTouchDevice() and self:isKindle() then
|
||||
-- Look at the current blanket modules to see if the SO screensavers are enabled...
|
||||
local lipc = require("liblipclua")
|
||||
local lipc_handle = nil
|
||||
if lipc then
|
||||
lipc_handle = lipc.init("com.github.koreader.device")
|
||||
end
|
||||
if lipc_handle then
|
||||
local loaded_blanket_modules = lipc_handle:get_string_property("com.lab126.blanket", "load")
|
||||
if string.find(loaded_blanket_modules, "ad_screensaver") then
|
||||
self.is_special_offers = true
|
||||
end
|
||||
lipc_handle:close()
|
||||
else
|
||||
end
|
||||
end
|
||||
return self.is_special_offers
|
||||
end
|
||||
|
||||
return Device
|
||||
|
||||
18
reader.lua
18
reader.lua
@@ -48,14 +48,16 @@ function exitReader()
|
||||
os.execute("echo 'send 139' > /proc/keypad;echo 'send 139' > /proc/keypad")
|
||||
end
|
||||
if Device:isTouchDevice() and Device.survive_screen_saver then
|
||||
-- hack the swipe to unlock screen
|
||||
local dev = Device:getTouchInputDev()
|
||||
if dev then
|
||||
local width, height = Screen:getWidth(), Screen:getHeight()
|
||||
input.fakeTapInput(dev,
|
||||
math.min(width, height)/2,
|
||||
math.max(width, height)-30
|
||||
)
|
||||
-- If needed, hack the swipe to unlock screen
|
||||
if Device:isSpecialOffers() then
|
||||
local dev = Device:getTouchInputDev()
|
||||
if dev then
|
||||
local width, height = Screen:getWidth(), Screen:getHeight()
|
||||
input.fakeTapInput(dev,
|
||||
math.min(width, height)/2,
|
||||
math.max(width, height)-30
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user