[screensaver menu] remove gesture based option from NT devices - #12747
Conversation
…rKeyPressText function
@Commodore64user |
|
according to this comment here koreader/frontend/ui/screensaver.lua Lines 414 to 426 in fd37272 it appears the koreader/frontend/ui/elements/screensaver_menu.lua Lines 167 to 175 in fd37272 |
No, that comment is misleading/outdated, it's actually available anywhere we can control poweroff/reboot. |
i.e., |
| } | ||
|
|
||
| if Device:isTouchDevice() then | ||
| table.insert(menu_items[1].sub_item_table[8].sub_item_table, |
There was a problem hiding this comment.
Possibly #menu_items[1].sub_item_table instead of 8? (Assuming it's indeed the final element).
Or anything else you might come up with to avoid the magic number, basically ;).
There was a problem hiding this comment.
iterating through all the elements and matching the name of the sub_item_table ("Postpone screen update after wake-up")? ignore that
(Assuming it's indeed the final element).
it isn't. it the 8th/9
"Show book cover on sleep screen"
"Show custom image or cover on sleep screen"
"Show random image from folder on sleep screen"
"Show reading progress on sleep screen"
"Show book status on sleep screen"
"Leave screen as-is"
"Border fill, rotation, and fit"
8. "Postpone screen update after wake-up" -- this is the one
"Custom images"
There was a problem hiding this comment.
Can't you just on line 97:
- -- "Until 'exit sleep screen' gesture" is added later to touch devices
+ Device:isTouchDevice() and genMenuItem(_("Until 'exit sleep screen' gesture"), "screensaver_delay", "gesture") or nilThere was a problem hiding this comment.
that works, yes.
AND or OR? |
U+0026 ;p. |
| genMenuItem(_("5 seconds"), "screensaver_delay", "5"), | ||
| genMenuItem(_("Until a tap"), "screensaver_delay", "tap"), | ||
| genMenuItem(_("Until 'exit sleep screen' gesture"), "screensaver_delay", "gesture"), | ||
| genMenuItem(getUntilTapOrKeyPressText(), "screensaver_delay", "tap"), |
There was a problem hiding this comment.
Not worth a function 80 lines away, you can inline that:
genMenuItem(Device:isTouchDevice() and _("Until a tap") or _("Until a key press"), "screensaver_delay", "tap"),
There was a problem hiding this comment.
this was done prior to realising that trick worked inside that function
There was a problem hiding this comment.
I just learned it today myself :D
_meta.lua:
https://github.com/koreader/koreader/pull/12766/files
| }, | ||
| { | ||
| text = _("Hide reboot/poweroff message"), |
There was a problem hiding this comment.
If this is the last item in the array, you can use:
Device:canReboot() and Device:canPowerOff() and {
text...
} or nil
instead of the table.insert() below.
| return { | ||
|
|
||
| local menu_items = { |
There was a problem hiding this comment.
You can now keep the original return {.
|
Looks like a wrong line. |
|
|
||
| -- Date at which the last migration snippet was added | ||
| local CURRENT_MIGRATION_DATE = 20240928 | ||
| local CURRENT_MIGRATION_DATE = 20241117 |
There was a problem hiding this comment.
(Update the date to the day this gets a chance to be merged :))
There was a problem hiding this comment.
mmm what does that mean? today? I thought the specific date was irrelevant so long as it was a number larger than the previously used one.
There was a problem hiding this comment.
it indeed just needs to be larger than the previous one - but best to have it precise so we know when things happened and are not misleaded.
Today is fine if the PR is ready (dunno about @hius07 last comment), even if merged tomorrow.
|
Happy 50th commit-versary to me. 😬🥂 |
|
And your Commodore 64! |
what's new:
getUntilTapOrKeyPressTextto return appropriate text based on whether the device is a touch device or not.menu_itemstable.Until 'exit sleep screen' gesturemenu item only to touch devices.issue was first documented here #12744
This change is