mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
[reMarkable] Don't need to keep attempting WiFi connection after success (#7121)
If we're in range of multiple known WiFi Access Points (including multiple instances of the same SSID), we don't need to keep trying to connect after the first successful connection. Minimal change would have been replacing the return inside the foreach function with return [a non-nil value]. But foreach is deprecated, and since I was touching the code anyhow, I figured I'd do that tiny update as well.
This commit is contained in:
@@ -594,23 +594,22 @@ function NetworkMgr:reconnectOrShowNetworkMenu(complete_callback)
|
||||
table.sort(network_list,
|
||||
function(l, r) return l.signal_quality > r.signal_quality end)
|
||||
local success = false
|
||||
table.foreach(network_list,
|
||||
function(idx, network)
|
||||
if network.password then
|
||||
success = NetworkMgr:authenticateNetwork(network)
|
||||
if success then
|
||||
NetworkMgr:obtainIP()
|
||||
if complete_callback then
|
||||
complete_callback()
|
||||
end
|
||||
UIManager:show(InfoMessage:new{
|
||||
text = T(_("Connected to network %1"), BD.wrap(network.ssid)),
|
||||
timeout = 3,
|
||||
})
|
||||
return
|
||||
end
|
||||
end
|
||||
end)
|
||||
for dummy, network in ipairs(network_list) do
|
||||
if network.password then
|
||||
success = NetworkMgr:authenticateNetwork(network)
|
||||
if success then
|
||||
NetworkMgr:obtainIP()
|
||||
if complete_callback then
|
||||
complete_callback()
|
||||
end
|
||||
UIManager:show(InfoMessage:new{
|
||||
text = T(_("Connected to network %1"), BD.wrap(network.ssid)),
|
||||
timeout = 3,
|
||||
})
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
if not success then
|
||||
UIManager:show(require("ui/widget/networksetting"):new{
|
||||
network_list = network_list,
|
||||
|
||||
Reference in New Issue
Block a user