add toggle wifi status on PocketBook

pull/1407/head
chrox 9 years ago
parent c6dbf43cf4
commit db064fc009

@ -38,11 +38,17 @@ local function koboEnableWifi(toggle)
end end
end end
local function pocketbookEnableWifi(toggle)
os.execute("/ebrmain/bin/netagent " .. (toggle == 1 and "connect" or "disconnect"))
end
function NetworkMgr:turnOnWifi() function NetworkMgr:turnOnWifi()
if Device:isKindle() then if Device:isKindle() then
kindleEnableWifi(1) kindleEnableWifi(1)
elseif Device:isKobo() then elseif Device:isKobo() then
koboEnableWifi(1) koboEnableWifi(1)
elseif Device:isPocketBook() then
pocketbookEnableWifi(1)
end end
end end
@ -51,6 +57,8 @@ function NetworkMgr:turnOffWifi()
kindleEnableWifi(0) kindleEnableWifi(0)
elseif Device:isKobo() then elseif Device:isKobo() then
koboEnableWifi(0) koboEnableWifi(0)
elseif Device:isPocketBook() then
pocketbookEnableWifi(0)
end end
end end

@ -126,6 +126,9 @@ function EvernoteExporter:addToMainMenu(tab_item_table)
end end
function EvernoteExporter:login() function EvernoteExporter:login()
if NetworkMgr:getWifiStatus() == false then
NetworkMgr:promptWifiOn()
end
self.login_dialog = LoginDialog:new{ self.login_dialog = LoginDialog:new{
title = self.login_title, title = self.login_title,
username = self.evernote_username or "", username = self.evernote_username or "",
@ -185,10 +188,7 @@ function EvernoteExporter:doLogin(username, password)
self.evernote_username = username self.evernote_username = username
local ok, token = pcall(oauth.getToken, oauth) local ok, token = pcall(oauth.getToken, oauth)
-- prompt users to turn on Wifi if network is unreachable -- prompt users to turn on Wifi if network is unreachable
if not ok and token and token:find("Network is unreachable") then if not ok and token then
NetworkMgr:promptWifiOn()
return
elseif not ok and token then
UIManager:show(InfoMessage:new{ UIManager:show(InfoMessage:new{
text = _("An error occurred while logging in:") .. "\n" .. token, text = _("An error occurred while logging in:") .. "\n" .. token,
}) })

Loading…
Cancel
Save