xbmc / Official-Kodi-Remote-iOS

Full-featured remote control for XBMC Media Center. It features library browsing, now playing informations and a direct remote control.
Other
215 stars 104 forks source link

Rework RemoteController key handling #1092

Open wutschel opened 1 week ago

wutschel commented 1 week ago

Description

Closes https://github.com/xbmc/Official-Kodi-Remote-iOS/issues/427.

This PR does some internal rework of how RemoteController handles key presses and touch pad events.

Refactoring of key processing

Refactoring the processing of keys into two main methods processButtonPress and processButtonLongPress. Only in these methods key presses and interpreted and commands are sent to Kodi. This allowed to reduce some distributed preparation and calling of JSON API commands.

Up/Down/Left/Right to match physical keyboard

Introducing "Input.ButtonEvent" (supported since Kodi 19) for the up/down/left/right buttons to match the behaviour of pressing the same on a physical keyboard. This resolves an issue where seek was behaving different while playing videos with and without the progress slider being visible.

Remark: This now results in different behaviour between Kodi versions "older than 19" and "19 or later". Also the remote buttons behave different now for music playback compared to older App versions: Up/Down = Next/Previous (instead of rating up/down) and Left/Right = Seek backward/forward. This matches behaviour of keyboard presses.

Rewriting auto-repeated key presses

The auto-repeating key presses are rewritten (similar to how this is done for volume button presses). This allows to reduce complexity and a global variable.

Summary for release notes

Maintenance: Internal refactoring of remote control button processing Improvement: Consistent up/down/left/right behaviour of remote and physical keyboard