@ -372,24 +372,18 @@ function NetworkMgr:getWifiToggleMenuTable()
if NetworkMgr : isWifiOn ( ) and NetworkMgr : isConnected ( ) then
UIManager : broadcastEvent ( Event : new ( " NetworkConnected " ) )
elseif NetworkMgr : isWifiOn ( ) and not NetworkMgr : isConnected ( ) then
-- Don't leave Wi-Fi in an inconsistent state if the connection failed.
-- If we can't ping the gateway, despite a successful authentication w/ the AP, display a warning,
-- because this means that Wi-Fi is technically still enabled (e.g., modules are loaded).
-- We can't really enforce a turnOffWifi right now, because the user might want to try another AP or something.
-- (c.f., #5912, #4616).
-- NOTE: Keep in mind that NetworkSetting only runs this callback on *successful* connections!
-- (It's called connect_callback there).
-- This makes this branch somewhat hard to reach, which is why it gets a dedicated prompt below...
self.wifi_was_on = false
G_reader_settings : makeFalse ( " wifi_was_on " )
-- NOTE: We're limiting this to only a few platforms, as it might be actually harmful on some devices.
-- The intent being to unload kernel modules, and make a subsequent turnOnWifi behave sanely.
-- PB: Relies on netagent, no idea what it does, but it's not using this codepath anyway (!hasWifiToggle)
-- Android: Definitely shouldn't do it.
-- Sony: Doesn't play with modules, don't do it.
-- Kobo: Yes, please.
-- Cervantes: Loads/unloads module, probably could use it like Kobo.
-- Kindle: Probably could use it, if only because leaving Wireless on is generally a terrible idea on Kindle,
-- except that we defer to lipc, which makes Wi-Fi handling asynchronous, and the callback is simply delayed by 1s,
-- so we can't be sure the system will actually have finished bringing Wi-Fi up by then...
NetworkMgr : turnOffWifi ( )
touchmenu_instance : updateItems ( )
UIManager : show ( InfoMessage : new {
icon = " notice-warning " ,
text = _ ( " Gateway is unreachable, but Wi-Fi is still on! " ) ,
timeout = 3 ,
} )
end
else
-- Assume success on other platforms