mirror of
https://github.com/gabehf/Fladder.git
synced 2026-03-09 07:28:14 -07:00
feat: Videoplayer remember subtitle and audio selection(#339)
This commit is contained in:
parent
93a38a0b6b
commit
b1491b0ada
10 changed files with 247 additions and 39 deletions
|
|
@ -902,4 +902,38 @@ class JellyService {
|
|||
Future<Response<bool>> quickConnectEnabled() async => api.quickConnectEnabledGet();
|
||||
|
||||
Future<Response<dynamic>> deleteItem(String itemId) => api.itemsItemIdDelete(itemId: itemId);
|
||||
|
||||
Future<UserConfiguration?> _updateUserConfiguration(UserConfiguration newUserConfiguration) async {
|
||||
if (account?.id == null) return null;
|
||||
|
||||
final response = await api.usersConfigurationPost(
|
||||
userId: account!.id,
|
||||
body: newUserConfiguration,
|
||||
);
|
||||
|
||||
if (response.isSuccessful) {
|
||||
return newUserConfiguration;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
Future<UserConfiguration?> updateRememberAudioSelections() {
|
||||
final currentUserConfiguration = account?.userConfiguration;
|
||||
if (currentUserConfiguration == null) return Future.value(null);
|
||||
|
||||
final updated = currentUserConfiguration.copyWith(
|
||||
rememberAudioSelections: !(currentUserConfiguration.rememberAudioSelections ?? false),
|
||||
);
|
||||
return _updateUserConfiguration(updated);
|
||||
}
|
||||
|
||||
Future<UserConfiguration?> updateRememberSubtitleSelections() {
|
||||
final current = account?.userConfiguration;
|
||||
if (current == null) return Future.value(null);
|
||||
|
||||
final updated = current.copyWith(
|
||||
rememberSubtitleSelections: !(current.rememberSubtitleSelections ?? false),
|
||||
);
|
||||
return _updateUserConfiguration(updated);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -45,6 +45,7 @@ class User extends _$User {
|
|||
name: response.body?.name ?? state?.name ?? "",
|
||||
policy: response.body?.policy,
|
||||
serverConfiguration: systemConfiguration.body,
|
||||
userConfiguration: response.body?.configuration,
|
||||
quickConnectState: quickConnectStatus.body ?? false,
|
||||
latestItemsExcludes: response.body?.configuration?.latestItemsExcludes ?? [],
|
||||
);
|
||||
|
|
@ -53,6 +54,20 @@ class User extends _$User {
|
|||
return null;
|
||||
}
|
||||
|
||||
void setRememberAudioSelections() async {
|
||||
final newUserConfiguration = await api.updateRememberAudioSelections();
|
||||
if (newUserConfiguration != null) {
|
||||
userState = state?.copyWith(userConfiguration: newUserConfiguration);
|
||||
}
|
||||
}
|
||||
|
||||
void setRememberSubtitleSelections() async {
|
||||
final newUserConfiguration = await api.updateRememberSubtitleSelections();
|
||||
if (newUserConfiguration != null) {
|
||||
userState = state?.copyWith(userConfiguration: newUserConfiguration);
|
||||
}
|
||||
}
|
||||
|
||||
Future<Response> refreshMetaData(
|
||||
String itemId, {
|
||||
MetadataRefresh? metadataRefreshMode,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue