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/ui
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
..
data copt/kopt options: deduplicate some defaults (#10893) 8 months ago
elements Check for Noto Emoji font in UI fallback fonts (#10908) 8 months ago
message Calibre: Log errors on wireless connection failures (#9914) 1 year ago
network NetworkMgr: Handle non-blocking turnOnWifi implementations better (#10863) 8 months ago
plugin Clarify our OOP semantics across the codebase (#9586) 2 years ago
widget TextViewer: font size (#10911) 8 months ago
bidi.lua [chore] replace utf8 bytes with Unicode escape sequence 10 months ago
downloadmgr.lua CloudStorage: remove cloudmgr (#9532) 2 years ago
event.lua Cleanup various varargs shenanigans (#9624) 2 years ago
font.lua Decrease fonts memory use (#10618) 11 months ago
geometry.lua ImageViewer: Followup to #9529 (#9544) 2 years ago
gesturerange.lua [feat] Replace TimeVal (RIP) with time, fixed point time seconds (#8999) 2 years ago
hook_container.lua Clarify our OOP semantics across the codebase (#9586) 2 years ago
language.lua [i18n] Enable Farsi (#10017) 1 year ago
menusorter.lua [fix] MenuSorter: use orderedPairs for orphans (#6403) 4 years ago
otamanager.lua [ota]: deprecation check & notice (#10639) 11 months ago
quickstart.lua Quick start guide: fix links to images (#8072) 3 years ago
renderimage.lua Misc: Get rid of the legacy defaults.lua globals (#9546) 2 years ago
rendertext.lua Decrease fonts memory use (#10618) 11 months ago
screensaver.lua Custom metadata (#10861) 9 months ago
size.lua [RFC] Pagination UI shenanigans (#7335) 3 years ago
time.lua time: Fix another subtle FP issue in split_s_us 2 years ago
translator.lua TextViewer: font size (#10911) 8 months ago
trapper.lua Deal with table.pack corner-cases properly (#10350) 1 year ago
uimanager.lua PocketBook: Run Generic:exit *last* 9 months ago
viewhtml.lua TextViewer: font size (#10911) 8 months ago
wikipedia.lua [chore] replace utf8 bytes with Unicode escape sequence 10 months ago