mirror of
https://github.com/gabehf/Fladder.git
synced 2026-03-14 09:46:01 -07:00
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:
parent
23385d8e62
commit
fa30e634b4
29 changed files with 1360 additions and 162 deletions
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue