Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Reset Buttons for every Settings Screen #992

Merged
merged 10 commits into from
Jan 4, 2025
2 changes: 1 addition & 1 deletion lib/components/AlbumScreen/download_button.dart
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ class DownloadButton extends ConsumerWidget {
confirmButtonText:
AppLocalizations.of(context)!.deleteDownloadsConfirmButtonText,
abortButtonText:
AppLocalizations.of(context)!.deleteDownloadsAbortButtonText,
AppLocalizations.of(context)!.genericCancel,
onConfirmed: () async {
try {
await downloadsService.deleteDownload(stub: item);
Expand Down
2 changes: 1 addition & 1 deletion lib/components/AlbumScreen/track_list_tile.dart
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ class TrackListTile extends StatelessWidget {
viewFilter: finampUserHelper.currentUser?.currentView?.id,
nullableViewFilters: settings.showDownloadsWithUnknownLibrary,
onlyFavorites:
settings.onlyShowFavourite && settings.trackOfflineFavorites,
settings.onlyShowFavourites && settings.trackOfflineFavorites,
);

var items =
Expand Down
2 changes: 1 addition & 1 deletion lib/components/DownloadsScreen/downloaded_items_list.dart
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class _DownloadedItemsListState extends State<DownloadedItemsList> {
confirmButtonText: AppLocalizations.of(context)!
.deleteDownloadsConfirmButtonText,
abortButtonText: AppLocalizations.of(context)!
.deleteDownloadsAbortButtonText,
.genericCancel,
onConfirmed: () async {
await downloadsService.deleteDownload(stub: album);
if (mounted) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class KeepScreenOnWhilePluggedInSelector extends StatelessWidget {
AppLocalizations.of(context)!.keepScreenOnWhilePluggedInSubtitle),
value: FinampSettingsHelper.finampSettings.keepScreenOnWhilePluggedIn,
onChanged: (value) {
FinampSettingsHelper.setKeepScreenOnWhileCharging(value);
FinampSettingsHelper.setKeepScreenOnWhilePluggedIn(value);
},
);
},
Expand Down
14 changes: 8 additions & 6 deletions lib/components/MusicScreen/music_screen_tab_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ class _MusicScreenTabViewState extends State<MusicScreenTabView>
: "SortName"),
sortOrder: sortOrder,
searchTerm: widget.searchTerm?.trim(),
filters: settings.onlyShowFavourite ? "IsFavorite" : null,
filters: settings.onlyShowFavourites ? "IsFavorite" : null,
startIndex: pageKey,
limit: _pageSize,
);
Expand Down Expand Up @@ -144,7 +144,7 @@ class _MusicScreenTabViewState extends State<MusicScreenTabView>
viewFilter: widget.view?.id,
nullableViewFilters: settings.showDownloadsWithUnknownLibrary,
onlyFavorites:
settings.onlyShowFavourite && settings.trackOfflineFavorites);
settings.onlyShowFavourites && settings.trackOfflineFavorites);
} else {
offlineItems = await _isarDownloader.getAllCollections(
nameFilter: widget.searchTerm,
Expand All @@ -160,7 +160,7 @@ class _MusicScreenTabViewState extends State<MusicScreenTabView>
nullableViewFilters: widget.tabContentType == TabContentType.albums &&
settings.showDownloadsWithUnknownLibrary,
onlyFavorites:
settings.onlyShowFavourite && settings.trackOfflineFavorites);
settings.onlyShowFavourites && settings.trackOfflineFavorites);
}

var items = offlineItems.map((e) => e.baseItem).whereNotNull().toList();
Expand Down Expand Up @@ -302,7 +302,7 @@ class _MusicScreenTabViewState extends State<MusicScreenTabView>
var settings = box.get("FinampSettings")!;
var newRefreshHash = Object.hash(
widget.searchTerm,
settings.onlyShowFavourite,
settings.onlyShowFavourites,
settings.tabSortBy[widget.tabContentType],
settings.tabSortOrder[widget.tabContentType],
settings.onlyShowFullyDownloaded,
Expand Down Expand Up @@ -343,8 +343,10 @@ class _MusicScreenTabViewState extends State<MusicScreenTabView>
icon: TablerIcons.filter_x,
text: AppLocalizations.of(context)!.resetFiltersButton,
onPressed: () {
FinampSettingsHelper.setOnlyShowFavourite(false);
FinampSettingsHelper.setOnlyShowFullyDownloaded(false);
FinampSettingsHelper.setonlyShowFavourites(
DefaultSettings.onlyShowFavourites);
FinampSettingsHelper.setOnlyShowFullyDownloaded(
DefaultSettings.onlyShowFullyDownloaded);
},
)
],
Expand Down
2 changes: 1 addition & 1 deletion lib/components/PlayerScreen/queue_source_helper.dart
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ Future<bool> removeFromPlaylist(BuildContext context, BaseItemDto item,
item.name ?? "item", parent.name ?? "playlist"),
confirmButtonText:
AppLocalizations.of(context)!.removeFromPlaylistConfirm,
abortButtonText: AppLocalizations.of(context)!.removeFromPlaylistCancel,
abortButtonText: AppLocalizations.of(context)!.genericCancel,
onConfirmed: () {
isConfirmed = true;
},
Expand Down
2 changes: 1 addition & 1 deletion lib/components/favourite_button.dart
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class _FavoriteButtonState extends ConsumerState<FavoriteButton> {

bool isFav = ref.watch(isFavoriteProvider(FavoriteRequest(widget.item)));
if (widget.onlyIfFav) {
if (isFav && !FinampSettingsHelper.finampSettings.onlyShowFavourite) {
if (isFav && !FinampSettingsHelper.finampSettings.onlyShowFavourites) {
return Icon(
Icons.favorite,
color: Colors.red,
Expand Down
18 changes: 16 additions & 2 deletions lib/l10n/app_en.arb
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,6 @@
"@deleteDownloadsConfirmButtonText": {
"description": "Shown in the confirmation dialog for deleting downloaded media from the local device."
},
"deleteDownloadsAbortButtonText": "Cancel",
"error": "Error",
"@error": {},
"discNumber": "Disc {number}",
Expand Down Expand Up @@ -1582,7 +1581,6 @@
}
},
"removeFromPlaylistConfirm": "Remove",
"removeFromPlaylistCancel": "Cancel",
"removeFromPlaylistPrompt": "Remove '{itemName}' from playlist '{playlistName}'?",
"@removeFromPlaylistPrompt": {
"placeholders": {
Expand Down Expand Up @@ -1813,5 +1811,21 @@
"resetFiltersButton": "Reset filters",
"@resetFiltersButton": {
"description": "Button to reset filters on a list of items"
},
"resetSettingsPromptGlobal": "Are you sure you want to reset ALL settings to their defaults?",
"@resetSettingsPromptGlobal": {
"description": "Prompt which gets shown when the user is about to reset all settings to their default values"
},
"resetSettingsPromptGlobalConfirm": "Reset ALL settings",
"@resetSettingsPromptGlobalConfirm": {
"description": "A differently worded Confirm button to prevent the user from instandly clicking confirm because they are about to reset all settings to their default value"
},
"resetSettingsPromptLocal": "Do you want to reset these settings back to their defaults?",
"@resetSettingsPromptLocal": {
"description": "Prompt which gets shown when the user is about to reset all settings in the current settings window to their default values"
},
"genericCancel": "Cancel",
"@genericCancel": {
"description": "Used when the user stops an action from taking place inside a popup dialog window"
}
}
2 changes: 1 addition & 1 deletion lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ Future<void> setupHive() async {

// If no ThemeMode is set, we set it to the default (system)
Box<ThemeMode> themeModeBox = Hive.box("ThemeMode");
if (themeModeBox.isEmpty) ThemeModeHelper.setThemeMode(ThemeMode.system);
if (themeModeBox.isEmpty) ThemeModeHelper.setThemeMode(DefaultSettings.theme);

final isar = await Isar.open(
[
Expand Down
Loading