You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
koreader/frontend
NiLuJe 34ba2fab30
NetworkMgr: Handle non-blocking turnOnWifi implementations better (#10863)
* Device: Add a `hasSeamlessWifiToggle` devcap to complement `hasWifiToggle`, to denote platforms where we can toggle WiFi without losing focus, as this has obvious UX impacts, and less obvious technical impacts on some of the NetworkMgr innards...
* Android: Mark as `!hasSeamlessWifiToggle`, as it requires losing focus to the system settings. Moreover, `turnOnWifi` returns *immediately* and we *still* run in the background during that time, for extra spiciness...
* NetworkMgr: Ensure only *one* call to `turnOnWifi` will actually go on when stuff gets re-scheduled by the `beforeWifiAction` framework.
* NetworkMgr: Ensure the `beforeWifiAction` framework will not re-schedule the same thing *ad vitam aeternam* if a previous connection attempt is still ongoing. (i.e., previously, on Android, if you backed out of the system settings, you entered the Benny Hill dimension, as NetworkMgr would keep throwing you back into the system settings ;p). This has a few implications on callbacks requested by subsequent connection attempts, though. Generally, we'll try to honor *explicitly interactive* callbacks, but `beforeWifiAction` stuff will be dropped (only the original cb is preserved). That's what prevents the aforementioned infinite loop, as the `beforeWifiAction` framework was based on the assumption that `turnOnWifi` somewhat guaranteed `isConnected` to be true on return, something which is only actually true on `hasWifiManager` platforms.
* NetworkMgr: In `prompt` mode, the above implies that the prompt will not even be shown for concurrent attempts, as it's otherwise extremely confusing (KOSync on Android being a prime example, as it has a pair of Suspend/Resume handlers, so the initial attempt trips those two because of the focus switch >_<").
* NetworkMgr: Don't attempt to kill wifi when aborting a connection attempt on `!hasSeamlessWifiToggle` (because, again, it'll break UX, and also because it might run at very awkward times (e.g., I managed to go back to KOReader *between* a FM/Reader switch at one point, which promptly caused `UIManager` to exit because there was nothing to show ;p).
* NetworkMgr: Don't drop the connectivity callback when `beforeWifiAction` is set to prompt and the target happens to use a connectivity check in its `turnOnWifi` implementation (e.g., on Kindle).
* Android: Add an `"ignore"` `beforeWifiAction` mode, that'll do nothing but schedule the connectivity check with its callback (with the intent being the system will eventually enable wifi on its own Soon(TM)). If you're already online, the callback will run immediately, obviously. If you followed the early discussions on this PR, this closely matches what happens on `!hasWifiToggle` platforms (as flagging Android that way was one of the possible approaches here).
* NetworkMgr: Bail out early in `goOnlineToRun` if `beforeWifiAction` isn't `"turn_on"`. Prompt cannot work there, and while ignore technically could, it would serve very little purpose given its intended use case.
* KOSync: Neuter the Resume/Suspend handlers early on `CloseDocument`, as this is how focus switches are handled on Android, and if `beforeWifiAction` is `turn_on` and you were offline at the time, we'd trip them because of the swap to system settings to enable wifi.
* KOSync: Allow `auto_sync` to be enabled regardless of the `beforeWifiAction` mode on `!hasSeamlessWifiToggle` platforms. Prompt is still a terrible idea, but given that `goOnlineToRun` now aborts early if the mode is not supported, it's less of a problem.
8 months ago
..
apps TextViewer: font size (#10911) 8 months ago
device NetworkMgr: Handle non-blocking turnOnWifi implementations better (#10863) 8 months ago
document copt deduplicate: line_spacing (#10768) 9 months ago
ui NetworkMgr: Handle non-blocking turnOnWifi implementations better (#10863) 8 months ago
cache.lua Clarify our OOP semantics across the codebase (#9586) 2 years ago
cacheitem.lua Clarify our OOP semantics across the codebase (#9586) 2 years ago
configurable.lua copt/kopt options: deduplicate some defaults (#10893) 8 months ago
datetime.lua [i18n] Revert Unicode escape sequence to utf-8 bytes for translation (#10845) 9 months ago
dbg.lua Deal with table.pack corner-cases properly (#10350) 1 year ago
depgraph.lua Tame a few tests that relied on `pairs` being somewhat deterministic (#6371) 4 years ago
device.lua Truly silence the attempt at loading SDL2 3 years ago
dispatcher.lua Actions for Go to first/last bookmark (#10899) 8 months ago
docsettings.lua DocSettings: Minor cleanup following #10861 9 months ago
dump.lua Logger: Use serpent instead of dump (#9588) 2 years ago
fontlist.lua Decrease fonts memory use (#10618) 11 months ago
gettext.lua Make luacheck >= 0.26 happy (#9174) 2 years ago
httpclient.lua build: enforce luacheck in travis build 8 years ago
languagesupport.lua getProps: centralize 2 (#10837) 9 months ago
logger.lua Cleanup various varargs shenanigans (#9624) 2 years ago
luadata.lua DocSettings: Fix candidates sorting (#9607) 2 years ago
luadefaults.lua DocSettings: Fix candidates sorting (#9607) 2 years ago
luasettings.lua DocSettings: Fix candidates sorting (#9607) 2 years ago
luxl.lua [fix] Don't break OPDS parsing on HR tags (#5949) 4 years ago
optmath.lua [autosuspend, plugin] Switch to datetimewidget and provide default values (#8480) 3 years ago
persist.lua persist: fix possible leak on error (#10568) 12 months ago
pluginloader.lua Restart KOReader: add a ConfirmBox instead of a plain InfoMessage (#9853) 1 year ago
pluginshare.lua Clarify our OOP semantics across the codebase (#9586) 2 years ago
random.lua Faster blitting @ BB8/BBRGB32 when no processing is needed (#4847) 5 years ago
readcollection.lua readcollection: fix mandatory for deleted files (#10488) 1 year ago
readhistory.lua History: update short date/time correctly (#10601) 11 months ago
socketutil.lua KOSync: Set sane socket timeouts properly (#10835) 9 months ago
sort.lua Misc: Natural sorting refactor (#10023) 1 year ago
userpatch.lua patch management 1 year ago
util.lua View HTML & CSS: fix minor spacing issues 10 months ago
version.lua Version log and (limited) notifications log (#10178) 1 year ago