Skip to content

Kosync network callback#6489

Merged
Frenzie merged 2 commits into
koreader:masterfrom
Galunid:kosync-network-callback
Aug 17, 2020
Merged

Kosync network callback#6489
Frenzie merged 2 commits into
koreader:masterfrom
Galunid:kosync-network-callback

Conversation

@Galunid

@Galunid Galunid commented Aug 9, 2020

Copy link
Copy Markdown
Member

I found that KOSync doesn't work with #6424 and since it was pretty simple I fixed it.


This change is Reviewable

@Galunid Galunid force-pushed the kosync-network-callback branch from 4f5b91f to f16aa61 Compare August 9, 2020 03:08
@Frenzie Frenzie added this to the 2020.08 milestone Aug 9, 2020

@Frenzie Frenzie left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems okay.

@@ -1,4 +1,5 @@
local UIManager = require("ui/uimanager")
local NetworkMgr = require("ui/network/manager")

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit

@Galunid Galunid requested a review from Frenzie August 9, 2020 13:29
@NiLuJe

NiLuJe commented Aug 9, 2020

Copy link
Copy Markdown
Member

That plug-in should already have an onNetworkConnected handler, so I'm not quite sure what this is attempting to fix?

Android? (Because the events are unreliable there).

I'd much rather fix the events and/or the handler than adding a hack in this specific plug-in ;).

(On mobile, so context is a bit gnarly to grok).

@Galunid

Galunid commented Aug 9, 2020

Copy link
Copy Markdown
Member Author

@NiLuJe It was supposed to fix it on my Kobos, tested it before(latest nightly) on both and none worked ;/
I took a look at

function KOSync:login()
if NetworkMgr:willRerunWhenOnline(function() self:login() end) then
return
end

I assumed you missed those two functions. As for onNetworkConnected, the only thing it does is
function KOSync:_onResume()
UIManager:scheduleIn(1, function() self:getProgress() end)
end

onNetworkManager calls _onNetworkManager, which in turn calls _onResume. Pushing/pulling progress with Wi-Fi off basically results in a massage like Something went wrong, check network.

@NiLuJe

NiLuJe commented Aug 10, 2020

Copy link
Copy Markdown
Member

I'm not in a position to actually review this for another week, but then again, I don't actually use the plugin, so if it works for you, that's fine enough by me ;).

@Frenzie Frenzie left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I still find it a bit confusing but I don't want to look into this one more deeply. :-)

@Frenzie Frenzie merged commit d90e221 into koreader:master Aug 17, 2020
Galunid added a commit that referenced this pull request Aug 20, 2020
Frenzie pushed a commit that referenced this pull request Aug 20, 2020
This reverts commit d90e221. Reverts #6489 since it introduced problems for people having [*]Auto sync now and in the furture & Action when wifi off: prompt.
@Galunid Galunid deleted the kosync-network-callback branch September 16, 2020 15:26
@Galunid Galunid mentioned this pull request Sep 30, 2020
NiLuJe added a commit that referenced this pull request Jul 2, 2023
…ore reliable (#10605)

Fix: #10539, and for context #6489, #6733, #6534

Reorganize and reword most of the settings to make it clear what actually ties into auto sync, and what doesn't. (Specifically, what happens when a pull attempts to sync forward or backward has nothing to do with auto sync, it applies in all cases; while the periodic sync *does* require auto sync).

The main point of contention, though, is that auto sync will now *always* attempt to setup network connectivity (i.e., on resume/suspend/close). Periodic sync will *not* though (the intent being that, if you use periodic sync, you're relying on the activity check to actually keep wifi on at all times)).

Since this may lead to a large amount of nagging about wifi toggles on devices w/ NetworkManager support, it is now *disabled* by default on those devices. (And given that it wouldn't have worked because of the lack of connectivity, that doesn't really make any practical difference ;p).

Additionally, given the fact that there's no way to make this behavior viable if the "before wifi" action is left at its default of "prompt", this feature now *requires* that to be set to "turn_on" (on devices where it can, of course); attempting to toggle it on will warn about that if necessary.
This change is retroactive (OTM).

Includes an assortment of fixes and cleanups, including migrating to the new LuaSettings API, which is why there's no longer a smattering of superfluous flushes.
0xstillb pushed a commit to 0xstillb/koreader-thai that referenced this pull request May 9, 2026
0xstillb pushed a commit to 0xstillb/koreader-thai that referenced this pull request May 9, 2026
This reverts commit 8d0c369. Reverts koreader#6489 since it introduced problems for people having [*]Auto sync now and in the furture & Action when wifi off: prompt.
0xstillb pushed a commit to 0xstillb/koreader-thai that referenced this pull request May 9, 2026
…ore reliable (koreader#10605)

Fix: koreader#10539, and for context koreader#6489, koreader#6733, koreader#6534

Reorganize and reword most of the settings to make it clear what actually ties into auto sync, and what doesn't. (Specifically, what happens when a pull attempts to sync forward or backward has nothing to do with auto sync, it applies in all cases; while the periodic sync *does* require auto sync).

The main point of contention, though, is that auto sync will now *always* attempt to setup network connectivity (i.e., on resume/suspend/close). Periodic sync will *not* though (the intent being that, if you use periodic sync, you're relying on the activity check to actually keep wifi on at all times)).

Since this may lead to a large amount of nagging about wifi toggles on devices w/ NetworkManager support, it is now *disabled* by default on those devices. (And given that it wouldn't have worked because of the lack of connectivity, that doesn't really make any practical difference ;p).

Additionally, given the fact that there's no way to make this behavior viable if the "before wifi" action is left at its default of "prompt", this feature now *requires* that to be set to "turn_on" (on devices where it can, of course); attempting to toggle it on will warn about that if necessary.
This change is retroactive (OTM).

Includes an assortment of fixes and cleanups, including migrating to the new LuaSettings API, which is why there's no longer a smattering of superfluous flushes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants