Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[fix] Let UIManager handle suspend logic #5304

Merged
merged 1 commit into from Sep 1, 2019

Conversation

@Frenzie
Copy link
Member

commented Sep 1, 2019

See #2431 (comment).

Supersedes #5302.

@Frenzie Frenzie added the bug label Sep 1, 2019

@Frenzie Frenzie added this to the 2019.09 milestone Sep 1, 2019

@Frenzie Frenzie requested a review from pazos Sep 1, 2019

@pazos

This comment has been minimized.

Copy link
Contributor

commented Sep 1, 2019

Just reading UIManager.lua. What a if elseif end mess 🤦‍♂

Shouldn't Pocketbook react to PowerPress/PowerRelease like the others?. They only react to suspend/resume in

if Device:isPocketBook() then
self.event_handlers["Suspend"] = function()
self:_beforeSuspend()
Device:onPowerEvent("Power")
end
self.event_handlers["Resume"] = function()
Device:onPowerEvent("Power")
self:_afterResume()
end
end

@Frenzie

This comment has been minimized.

Copy link
Member Author

commented Sep 1, 2019

No, PB uses a handleMiscEv plugin to emit Suspend/Resume events.

handleMiscEv = function(this, ev)
if ev.code == EVT_BACKGROUND then
self.isInBackGround = true
return "Suspend"
elseif ev.code == EVT_FOREGROUND then
if self.isInBackGround then
self.isInBackGround = false
return "Resume"
end
end
end,

Something like that is probably how that Kobo thing should've been done.

And yes, it's clear that ideally a bunch of that UIManager stuff would be refactored into the device abstractions.

@pazos
pazos approved these changes Sep 1, 2019
@poire-z
Copy link
Contributor

left a comment

(Don't really want to re-read all that code to be able to give an honnest Approve :) but if it works for you, fine :)

@Frenzie Frenzie merged commit 4958990 into koreader:master Sep 1, 2019

1 check passed

ci/circleci: build Your tests passed on CircleCI!
Details

@Frenzie Frenzie deleted the Frenzie:fix-resume branch Sep 1, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.