Minor cleanups after #6424 (#6438)

* Minor cosmetic code cleanup
* String tweak
reviewable/pr6445/r1
NiLuJe 4 years ago committed by GitHub
parent 87b1f0c1f2
commit 744e933036
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -420,7 +420,7 @@ end
function NetworkMgr:getPowersaveMenuTable()
return {
text = _("Kill Wi-Fi connection when inactive"),
text = _("Disable Wi-Fi connection when inactive"),
help_text = _([[This will automatically turn Wi-Fi off after a generous period of network inactivity, without disrupting workflows that require a network connection, so you can just keep reading without worrying about battery drain.]]),
checked_func = function() return G_reader_settings:isTrue("auto_disable_wifi") end,
enabled_func = function() return Device:hasWifiManager() and not Device:isEmulator() end,

@ -155,26 +155,28 @@ function NetworkListener:_scheduleActivityCheck()
end
end
-- If we've just killed Wi-Fi, onNetworkDisconnected will take care of unscheduling us
if keep_checking then
-- Update tracker for next iter
self._last_tx_packets = tx_packets
-- If we've just killed Wi-Fi, onNetworkDisconnected will take care of unscheduling us, so we're done
if not keep_checking then
return
end
-- If it's already been scheduled, increase the delay until we hit the ceiling
if self._activity_check_delay then
self._activity_check_delay = self._activity_check_delay + default_network_timeout_seconds
-- Update tracker for next iter
self._last_tx_packets = tx_packets
if self._activity_check_delay > max_network_timeout_seconds then
self._activity_check_delay = max_network_timeout_seconds
end
else
self._activity_check_delay = default_network_timeout_seconds
end
-- If it's already been scheduled, increase the delay until we hit the ceiling
if self._activity_check_delay then
self._activity_check_delay = self._activity_check_delay + default_network_timeout_seconds
UIManager:scheduleIn(self._activity_check_delay, self._scheduleActivityCheck, self)
self._activity_check_scheduled = true
logger.dbg("NetworkListener: network activity check scheduled in", self._activity_check_delay, "seconds")
if self._activity_check_delay > max_network_timeout_seconds then
self._activity_check_delay = max_network_timeout_seconds
end
else
self._activity_check_delay = default_network_timeout_seconds
end
UIManager:scheduleIn(self._activity_check_delay, self._scheduleActivityCheck, self)
self._activity_check_scheduled = true
logger.dbg("NetworkListener: network activity check scheduled in", self._activity_check_delay, "seconds")
end
function NetworkListener:onNetworkConnected()

Loading…
Cancel
Save