diff --git a/lib/controller/indexer_controller.dart b/lib/controller/indexer_controller.dart index 0e964c35..e7296d60 100644 --- a/lib/controller/indexer_controller.dart +++ b/lib/controller/indexer_controller.dart @@ -39,7 +39,7 @@ class Indexer { Indexer._internal(); bool get _defaultUseMediaStore => settings.useMediaStore.value; - bool get _includeVideosAsTracks => true; // TODO: settings.includeVideosAsTracks.value + bool get _includeVideosAsTracks => settings.includeVideos.value; void _clearTracksDBAndReOpen() { _tracksDBManager diff --git a/lib/controller/settings_controller.dart b/lib/controller/settings_controller.dart index 64b5eb27..e27d1ca4 100644 --- a/lib/controller/settings_controller.dart +++ b/lib/controller/settings_controller.dart @@ -59,6 +59,7 @@ class _SettingsController with SettingsFileWriter { final albumListTileHeight = 90.0.obs; final useMediaStore = false.obs; + final includeVideos = true.obs; final displayTrackNumberinAlbumPage = true.obs; final albumCardTopRightDate = true.obs; final forceSquaredTrackThumbnail = false.obs; @@ -402,6 +403,7 @@ class _SettingsController with SettingsFileWriter { albumListTileHeight.value = json['albumListTileHeight'] ?? albumListTileHeight.value; useMediaStore.value = json['useMediaStore'] ?? useMediaStore.value; + includeVideos.value = json['includeVideos'] ?? includeVideos.value; displayTrackNumberinAlbumPage.value = json['displayTrackNumberinAlbumPage'] ?? displayTrackNumberinAlbumPage.value; albumCardTopRightDate.value = json['albumCardTopRightDate'] ?? albumCardTopRightDate.value; forceSquaredTrackThumbnail.value = json['forceSquaredTrackThumbnail'] ?? forceSquaredTrackThumbnail.value; @@ -596,6 +598,7 @@ class _SettingsController with SettingsFileWriter { 'albumListTileHeight': albumListTileHeight.value, 'useMediaStore': useMediaStore.value, + 'includeVideos': includeVideos.value, 'displayTrackNumberinAlbumPage': displayTrackNumberinAlbumPage.value, 'albumCardTopRightDate': albumCardTopRightDate.value, 'forceSquaredTrackThumbnail': forceSquaredTrackThumbnail.value, @@ -752,6 +755,7 @@ class _SettingsController with SettingsFileWriter { double? albumThumbnailSizeinList, double? albumListTileHeight, bool? useMediaStore, + bool? includeVideos, bool? displayTrackNumberinAlbumPage, bool? albumCardTopRightDate, bool? forceSquaredTrackThumbnail, @@ -921,6 +925,7 @@ class _SettingsController with SettingsFileWriter { if (albumListTileHeight != null) this.albumListTileHeight.value = albumListTileHeight; if (useMediaStore != null) this.useMediaStore.value = useMediaStore; + if (includeVideos != null) this.includeVideos.value = includeVideos; if (displayTrackNumberinAlbumPage != null) this.displayTrackNumberinAlbumPage.value = displayTrackNumberinAlbumPage; if (albumCardTopRightDate != null) this.albumCardTopRightDate.value = albumCardTopRightDate; diff --git a/lib/core/translations/keys.dart b/lib/core/translations/keys.dart index 39dcddd7..a4f11623 100644 --- a/lib/core/translations/keys.dart +++ b/lib/core/translations/keys.dart @@ -309,6 +309,7 @@ abstract class LanguageKeys { String get IMPORT_TIME_RANGE => _getKey('IMPORT_TIME_RANGE'); String get IMPORT_YOUTUBE_HISTORY_GUIDE => _getKey('IMPORT_YOUTUBE_HISTORY_GUIDE'); String get IMPORT_YOUTUBE_HISTORY => _getKey('IMPORT_YOUTUBE_HISTORY'); + String get INCLUDE_VIDEOS => _getKey('INCLUDE_VIDEOS'); String get INDEX_REFRESH_REQUIRED => _getKey('INDEX_REFRESH_REQUIRED'); String get INDEXER_NOTE => _getKey('INDEXER_NOTE'); String get INDEXER_SUBTITLE => _getKey('INDEXER_SUBTITLE'); diff --git a/lib/ui/pages/onboarding.dart b/lib/ui/pages/onboarding.dart index 83170aba..b07b8066 100644 --- a/lib/ui/pages/onboarding.dart +++ b/lib/ui/pages/onboarding.dart @@ -116,6 +116,7 @@ class _FirstRunConfigureScreenState extends State { Widget build(BuildContext context) { const indexer = IndexerSettings(); final useMediaStore = indexer.getMediaStoreWidget(); + final includeVideosWidget = indexer.getIncludeVideosWidget(); final foldersToScan = indexer.getFoldersToScanWidget(context: context, initiallyExpanded: true); final foldersToExclude = indexer.getFoldersToExcludeWidget(context: context, initiallyExpanded: true); final groupArtworksByAlbum = indexer.getGroupArtworksByAlbumWidget(); @@ -173,6 +174,7 @@ class _FirstRunConfigureScreenState extends State { performanceTile, libraryTabsTile, if (useMediaStore != null) useMediaStore, + includeVideosWidget, groupArtworksByAlbum, foldersToScan, foldersToExclude, diff --git a/lib/ui/widgets/settings/indexer_settings.dart b/lib/ui/widgets/settings/indexer_settings.dart index d87b6532..b642778a 100644 --- a/lib/ui/widgets/settings/indexer_settings.dart +++ b/lib/ui/widgets/settings/indexer_settings.dart @@ -38,6 +38,7 @@ enum _IndexerSettingsKeys { minimumFileSize, minimumTrackDur, useMediaStore, + includeVideos, refreshOnStartup, missingTracks, reindex, @@ -64,6 +65,7 @@ class IndexerSettings extends SettingSubpageProvider { _IndexerSettingsKeys.minimumFileSize: [lang.MIN_FILE_SIZE], _IndexerSettingsKeys.minimumTrackDur: [lang.MIN_FILE_DURATION], _IndexerSettingsKeys.useMediaStore: [lang.USE_MEDIA_STORE, lang.USE_MEDIA_STORE_SUBTITLE], + _IndexerSettingsKeys.includeVideos: [lang.INCLUDE_VIDEOS], _IndexerSettingsKeys.refreshOnStartup: [lang.REFRESH_ON_STARTUP], _IndexerSettingsKeys.missingTracks: [lang.MISSING_TRACKS], _IndexerSettingsKeys.reindex: [lang.RE_INDEX, lang.RE_INDEX_SUBTITLE], @@ -110,6 +112,29 @@ class IndexerSettings extends SettingSubpageProvider { ); } + Widget getIncludeVideosWidget() { + return getItemWrapper( + key: _IndexerSettingsKeys.includeVideos, + child: ObxO( + rx: settings.includeVideos, + builder: (context, includeVideos) => CustomSwitchListTile( + bgColor: getBgColor(_IndexerSettingsKeys.includeVideos), + leading: StackedIcon( + baseIcon: Broken.video_play, + secondaryIcon: Broken.tick_circle, + secondaryIconSize: 12.0, + ), + title: lang.INCLUDE_VIDEOS, + value: includeVideos, + onChanged: (isTrue) { + settings.save(includeVideos: !isTrue); + showRefreshPromptDialog(false); + }, + ), + ), + ); + } + Widget getGroupArtworksByAlbumWidget() { return getItemWrapper( key: _IndexerSettingsKeys.groupArtworksByAlbum, @@ -302,7 +327,8 @@ class IndexerSettings extends SettingSubpageProvider { const refreshIconKey1 = 'kurukuru'; const refreshIconKey2 = 'kururin'; - final useMediaStore = getMediaStoreWidget(); + final useMediaStoreWidget = getMediaStoreWidget(); + final includeVideosWidget = getIncludeVideosWidget(); return SettingsCard( title: lang.INDEXER, subtitle: lang.INDEXER_SUBTITLE, @@ -563,7 +589,8 @@ class IndexerSettings extends SettingSubpageProvider { ), ), ), - if (useMediaStore != null) useMediaStore, + if (useMediaStoreWidget != null) useMediaStoreWidget, + includeVideosWidget, getItemWrapper( key: _IndexerSettingsKeys.refreshOnStartup, child: Obx( diff --git a/pubspec.yaml b/pubspec.yaml index a62900c3..16c376c0 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,7 +1,7 @@ name: namida description: A Beautiful and Feature-rich Music Player, With YouTube & Video Support Built in Flutter publish_to: "none" -version: 4.6.96-beta+241118167 +version: 4.7.0-beta+241118187 environment: sdk: ">=3.4.0 <4.0.0"