feat: Customizable shortcuts/hotkeys (#439)

This implements the logic for allowing hotkeys with modifiers.
Implemented globalhotkeys and videocontrol hotkeys
Also implements saving the forward backwards seconds to the user.

Co-authored-by: PartyDonut <PartyDonut@users.noreply.github.com>
This commit is contained in:
PartyDonut 2025-08-08 16:36:50 +02:00 committed by GitHub
parent 23385d8e62
commit fa30e634b4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
29 changed files with 1360 additions and 162 deletions

View file

@ -40,6 +40,9 @@ class User extends _$User {
var response = await api.usersMeGet();
var quickConnectStatus = await api.quickConnectEnabled();
var systemConfiguration = await api.systemConfigurationGet();
final customConfig = await api.getCustomConfig();
if (response.isSuccessful && response.body != null) {
userState = state?.copyWith(
name: response.body?.name ?? state?.name ?? "",
@ -48,6 +51,7 @@ class User extends _$User {
userConfiguration: response.body?.configuration,
quickConnectState: quickConnectStatus.body ?? false,
latestItemsExcludes: response.body?.configuration?.latestItemsExcludes ?? [],
userSettings: customConfig.body,
);
return response.copyWith(body: state);
}
@ -68,6 +72,25 @@ class User extends _$User {
}
}
void setBackwardSpeed(int value) {
final userSettings = state?.userSettings?.copyWith(skipBackDuration: Duration(seconds: value));
if (userSettings != null) {
updateCustomConfig(userSettings);
}
}
void setForwardSpeed(int value) {
final userSettings = state?.userSettings?.copyWith(skipForwardDuration: Duration(seconds: value));
if (userSettings != null) {
updateCustomConfig(userSettings);
}
}
Future<Response<dynamic>> updateCustomConfig(UserSettings settings) async {
state = state?.copyWith(userSettings: settings);
return api.setCustomConfig(settings);
}
Future<Response> refreshMetaData(
String itemId, {
MetadataRefresh? metadataRefreshMode,