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

Refactor "song" to "track" in the entire app. #1059

Open
wants to merge 1 commit into
base: redesign
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 29 additions & 27 deletions ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ PODS:
- Flutter
- audio_service (0.0.1):
- Flutter
- FlutterMacOS
- audio_session (0.0.1):
- Flutter
- background_downloader (0.0.1):
Expand Down Expand Up @@ -74,6 +75,7 @@ PODS:
- Flutter
- just_audio (0.0.1):
- Flutter
- FlutterMacOS
- Mux-Stats-AVPlayer (3.5.1):
- Mux-Stats-Core (= 4.6.0)
- Mux-Stats-Core (4.6.0)
Expand All @@ -89,7 +91,7 @@ PODS:
- SDWebImage/Core (5.18.2)
- share_plus (0.0.1):
- Flutter
- sqflite (0.0.3):
- sqflite_darwin (0.0.4):
- Flutter
- FlutterMacOS
- SwiftyGif (5.4.4)
Expand All @@ -100,7 +102,7 @@ PODS:

DEPENDENCIES:
- app_set_id (from `.symlinks/plugins/app_set_id/ios`)
- audio_service (from `.symlinks/plugins/audio_service/ios`)
- audio_service (from `.symlinks/plugins/audio_service/darwin`)
- audio_session (from `.symlinks/plugins/audio_session/ios`)
- background_downloader (from `.symlinks/plugins/background_downloader/ios`)
- battery_plus (from `.symlinks/plugins/battery_plus/ios`)
Expand All @@ -111,12 +113,12 @@ DEPENDENCIES:
- flutter_to_airplay (from `.symlinks/plugins/flutter_to_airplay/ios`)
- flutter_vibrate (from `.symlinks/plugins/flutter_vibrate/ios`)
- isar_flutter_libs (from `.symlinks/plugins/isar_flutter_libs/ios`)
- just_audio (from `.symlinks/plugins/just_audio/ios`)
- just_audio (from `.symlinks/plugins/just_audio/darwin`)
- package_info_plus (from `.symlinks/plugins/package_info_plus/ios`)
- path_provider_foundation (from `.symlinks/plugins/path_provider_foundation/darwin`)
- permission_handler_apple (from `.symlinks/plugins/permission_handler_apple/ios`)
- share_plus (from `.symlinks/plugins/share_plus/ios`)
- sqflite (from `.symlinks/plugins/sqflite/darwin`)
- sqflite_darwin (from `.symlinks/plugins/sqflite_darwin/darwin`)
- url_launcher_ios (from `.symlinks/plugins/url_launcher_ios/ios`)
- wakelock_plus (from `.symlinks/plugins/wakelock_plus/ios`)

Expand All @@ -135,7 +137,7 @@ EXTERNAL SOURCES:
app_set_id:
:path: ".symlinks/plugins/app_set_id/ios"
audio_service:
:path: ".symlinks/plugins/audio_service/ios"
:path: ".symlinks/plugins/audio_service/darwin"
audio_session:
:path: ".symlinks/plugins/audio_session/ios"
background_downloader:
Expand All @@ -155,7 +157,7 @@ EXTERNAL SOURCES:
isar_flutter_libs:
:path: ".symlinks/plugins/isar_flutter_libs/ios"
just_audio:
:path: ".symlinks/plugins/just_audio/ios"
:path: ".symlinks/plugins/just_audio/darwin"
package_info_plus:
:path: ".symlinks/plugins/package_info_plus/ios"
path_provider_foundation:
Expand All @@ -164,42 +166,42 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/permission_handler_apple/ios"
share_plus:
:path: ".symlinks/plugins/share_plus/ios"
sqflite:
:path: ".symlinks/plugins/sqflite/darwin"
sqflite_darwin:
:path: ".symlinks/plugins/sqflite_darwin/darwin"
url_launcher_ios:
:path: ".symlinks/plugins/url_launcher_ios/ios"
wakelock_plus:
:path: ".symlinks/plugins/wakelock_plus/ios"

SPEC CHECKSUMS:
app_set_id: e0349a05a0ecc6d5c937d42869aa941f90801c9c
audio_service: f509d65da41b9521a61f1c404dd58651f265a567
audio_session: 088d2483ebd1dc43f51d253d4a1c517d9a2e7207
background_downloader: 9f788ffc5de45acf87d6380e91ca0841066c18cf
battery_plus: 34f72fa2afeeea83bbae306c72a25828d3ec727a
app_set_id: 7f0af7ac377647e0517efd55896a2c152a0569f4
audio_service: aa99a6ba2ae7565996015322b0bb024e1d25c6fd
audio_session: 9bb7f6c970f21241b19f5a3658097ae459681ba0
background_downloader: b42a56120f5348bff70e74222f0e9e6f7f1a1537
battery_plus: b42253f6d2dde71712f8c36fef456d99121c5977
CropViewController: 58fb440f30dac788b129d2a1f24cffdcb102669c
device_info_plus: bf2e3232933866d73fe290f2942f2156cdd10342
device_info_plus: 21fcca2080fbcd348be798aa36c3e5ed849eefbe
DKCamera: a902b66921fca14b7a75266feb8c7568aa7caa71
DKImagePickerController: b512c28220a2b8ac7419f21c491fc8534b7601ac
DKPhotoGallery: fdfad5125a9fdda9cc57df834d49df790dbb4179
file_picker: 09aa5ec1ab24135ccd7a1621c46c84134bfd6655
file_picker: a0560bc09d61de87f12d246fc47d2119e6ef37be
Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7
flutter_to_airplay: 3194fe6e4ca6ba1d9529c3c4194c32b9610d990f
flutter_vibrate: 9f4c2ab57008965f78969472367c329dd77eb801
isar_flutter_libs: b69f437aeab9c521821c3f376198c4371fa21073
just_audio: baa7252489dbcf47a4c7cc9ca663e9661c99aafa
flutter_to_airplay: 06ecea4c4458e28e1bfeff6741de84b79aa28821
flutter_vibrate: 207bbbeb62dd5638b479846c8e46168d7229f14a
isar_flutter_libs: 9fc2cfb928c539e1b76c481ba5d143d556d94920
just_audio: 4e391f57b79cad2b0674030a00453ca5ce817eed
Mux-Stats-AVPlayer: 1b1a877e5d8b57ca22e0717fa0a4eefef7529c40
Mux-Stats-Core: 53902e414f077b2239ea10d909a4cf072c0d4d5c
package_info_plus: 58f0028419748fad15bf008b270aaa8e54380b1c
path_provider_foundation: 2b6b4c569c0fb62ec74538f866245ac84301af46
permission_handler_apple: 9878588469a2b0d0fc1e048d9f43605f92e6cec2
package_info_plus: af8e2ca6888548050f16fa2f1938db7b5a5df499
path_provider_foundation: 080d55be775b7414fd5a5ef3ac137b97b097e564
permission_handler_apple: 4ed2196e43d0651e8ff7ca3483a069d469701f2d
SDWebImage: c0de394d7cf7f9838aed1fd6bb6037654a4572e4
share_plus: 8b6f8b3447e494cca5317c8c3073de39b3600d1f
sqflite: 673a0e54cc04b7d6dba8d24fb8095b31c3a99eec
share_plus: 50da8cb520a8f0f65671c6c6a99b3617ed10a58a
sqflite_darwin: 20b2a3a3b70e43edae938624ce550a3cbf66a3d0
SwiftyGif: 93a1cc87bf3a51916001cf8f3d63835fb64c819f
url_launcher_ios: 5334b05cef931de560670eeae103fd3e431ac3fe
wakelock_plus: 78ec7c5b202cab7761af8e2b2b3d0671be6c4ae1
url_launcher_ios: 694010445543906933d732453a59da0a173ae33d
wakelock_plus: 04623e3f525556020ebd4034310f20fe7fda8b49

PODFILE CHECKSUM: 047c0919aa274fcdf0ce568f883473a4587eda02

COCOAPODS: 1.15.2
COCOAPODS: 1.16.2
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
enableGPUValidationMode = "1"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
Expand Down
22 changes: 11 additions & 11 deletions lib/components/AddToPlaylistScreen/add_to_playlist_list.dart
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class _AddToPlaylistListState extends State<AddToPlaylistList> {
snapshot.data![index];
return AddToPlaylistTile(
playlist: playlist,
song: widget.itemToAdd,
track: widget.itemToAdd,
playlistItemId: playListItemId,
isLoading: isLoading);
},
Expand Down Expand Up @@ -125,10 +125,10 @@ class _AddToPlaylistListState extends State<AddToPlaylistList> {
var playlist = await jellyfinApiHelper.getItemById(newId);
var playlistItems = await jellyfinApiHelper.getItems(
parentItem: playlist, fields: "");
var song = playlistItems?.firstWhere(
var track = playlistItems?.firstWhere(
(element) => element.id == widget.itemToAdd.id);
setState(() {
var newItem = [(playlist, false, song?.playlistItemId)];
var newItem = [(playlist, false, track?.playlistItemId)];
playlistsFuture =
oldFuture.then((value) => value + newItem);
});
Expand All @@ -149,11 +149,11 @@ class AddToPlaylistTile extends StatefulWidget {
{super.key,
required this.playlist,
this.playlistItemId,
required this.song,
required this.track,
this.isLoading = false});

final BaseItemDto playlist;
final BaseItemDto song;
final BaseItemDto track;
final String? playlistItemId;
final bool isLoading;

Expand Down Expand Up @@ -187,7 +187,7 @@ class _AddToPlaylistTileState extends State<AddToPlaylistTile> {
} else {
final downloadsService = GetIt.instance<DownloadsService>();
itemIsIncluded =
downloadsService.checkIfInCollection(widget.playlist, widget.song);
downloadsService.checkIfInCollection(widget.playlist, widget.track);
}
}
}
Expand All @@ -198,7 +198,7 @@ class _AddToPlaylistTileState extends State<AddToPlaylistTile> {
return ToggleableListTile(
forceLoading: widget.isLoading,
title: widget.playlist.name ?? AppLocalizations.of(context)!.unknownName,
subtitle: AppLocalizations.of(context)!.songCount(childCount ?? 0),
subtitle: AppLocalizations.of(context)!.trackCount(childCount ?? 0),
leading: AlbumImage(item: widget.playlist),
positiveIcon: TablerIcons.circle_check_filled,
negativeIcon: itemIsIncluded == null
Expand All @@ -215,7 +215,7 @@ class _AddToPlaylistTileState extends State<AddToPlaylistTile> {
parentItem: widget.playlist, fields: "");

playlistItemId = newItems
?.firstWhereOrNull((x) => x.id == widget.song.id)
?.firstWhereOrNull((x) => x.id == widget.track.id)
?.playlistItemId;
if (playlistItemId == null) {
// We were already not part of the playlist,. so removal is complete
Expand All @@ -231,7 +231,7 @@ class _AddToPlaylistTileState extends State<AddToPlaylistTile> {
}
// part of playlist, remove
bool removed = await removeFromPlaylist(
context, widget.song, widget.playlist, playlistItemId!,
context, widget.track, widget.playlist, playlistItemId!,
confirm: false);
if (removed) {
setState(() {
Expand All @@ -243,15 +243,15 @@ class _AddToPlaylistTileState extends State<AddToPlaylistTile> {
} else {
// add to playlist
bool added =
await addItemToPlaylist(context, widget.song, widget.playlist);
await addItemToPlaylist(context, widget.track, widget.playlist);
if (added) {
final jellyfinApiHelper = GetIt.instance<JellyfinApiHelper>();
var newItems = await jellyfinApiHelper.getItems(
parentItem: widget.playlist, fields: "");
setState(() {
childCount = newItems?.length ?? 0;
playlistItemId = newItems
?.firstWhereOrNull((x) => x.id == widget.song.id)
?.firstWhereOrNull((x) => x.id == widget.track.id)
?.playlistItemId;
itemIsIncluded = true;
});
Expand Down
6 changes: 3 additions & 3 deletions lib/components/AddToPlaylistScreen/playlist_actions_menu.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import '../../services/feedback_helper.dart';
import '../../services/finamp_settings_helper.dart';
import '../../services/jellyfin_api_helper.dart';
import '../../services/theme_provider.dart';
import '../AlbumScreen/song_menu.dart';
import '../AlbumScreen/track_menu.dart';
import '../global_snackbar.dart';
import '../themed_bottom_sheet.dart';
import 'add_to_playlist_list.dart';
Expand Down Expand Up @@ -45,7 +45,7 @@ Future<void> showPlaylistActionsMenu({
);

final menuEntries = [
SongInfo.condensed(
TrackInfo.condensed(
item: item,
useThemeImage: usePlayerTheme,
),
Expand Down Expand Up @@ -92,7 +92,7 @@ Future<void> showPlaylistActionsMenu({
if (snapshot.data != null) {
return AddToPlaylistTile(
playlist: snapshot.data!,
song: item,
track: item,
playlistItemId: item.playlistItemId,
);
} else {
Expand Down
20 changes: 10 additions & 10 deletions lib/components/AlbumScreen/album_screen_content.dart
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class _AlbumScreenContentState extends State<AlbumScreenContent> {
Widget build(BuildContext context) {
void onDelete(BaseItemDto item) {
// This is pretty inefficient (has to search through whole list) but
// SongsSliverList gets passed some weird split version of children to
// TracksSliverList gets passed some weird split version of children to
// handle multi-disc albums and it's 00:35 so I can't be bothered to get
// it to return an index
setState(() {
Expand Down Expand Up @@ -106,15 +106,15 @@ class _AlbumScreenContentState extends State<AlbumScreenContent> {
style: const TextStyle(fontSize: 20.0),
),
),
sliver: SongsSliverList(
sliver: TracksSliverList(
childrenForList: childrenOfThisDisc,
childrenForQueue: Future.value(widget.queueChildren),
parent: widget.parent,
onRemoveFromList: onDelete,
),
)
else if (widget.displayChildren.isNotEmpty)
SongsSliverList(
TracksSliverList(
childrenForList: widget.displayChildren,
childrenForQueue: Future.value(widget.queueChildren),
parent: widget.parent,
Expand All @@ -125,8 +125,8 @@ class _AlbumScreenContentState extends State<AlbumScreenContent> {
}
}

class SongsSliverList extends StatefulWidget {
const SongsSliverList({
class TracksSliverList extends StatefulWidget {
const TracksSliverList({
super.key,
required this.childrenForList,
required this.childrenForQueue,
Expand All @@ -144,10 +144,10 @@ class SongsSliverList extends StatefulWidget {
final bool isOnArtistScreen;

@override
State<SongsSliverList> createState() => _SongsSliverListState();
State<TracksSliverList> createState() => _TracksSliverListState();
}

class _SongsSliverListState extends State<SongsSliverList> {
class _TracksSliverListState extends State<TracksSliverList> {
final GlobalKey<SliverAnimatedListState> sliverListKey =
GlobalKey<SliverAnimatedListState>();

Expand Down Expand Up @@ -176,9 +176,9 @@ class _SongsSliverListState extends State<SongsSliverList> {
// return SliverList(
delegate: SliverChildBuilderDelegate(
(BuildContext context, int index) {
// When user selects song from disc other than first, index number is
// incorrect and song with the same index on first disc is played instead.
// Adding this offset ensures playback starts for nth song on correct disc.
// When user selects track from disc other than first, index number is
// incorrect and track with the same index on first disc is played instead.
// Adding this offset ensures playback starts for nth track on correct disc.
final indexOffset = widget.childrenForQueue.then((childrenForQueue) =>
childrenForQueue.indexWhere(
(element) => element.id == widget.childrenForList[index].id));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ class AlbumScreenContentFlexibleSpaceBar extends StatelessWidget {
flex: 2,
child: ItemInfo(
item: parentItem,
itemSongs: items.length,
itemTracks: items.length,
),
)
],
Expand Down
8 changes: 4 additions & 4 deletions lib/components/AlbumScreen/download_button.dart
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ class DownloadButton extends ConsumerWidget {
onAborted: () {},
));
} else {
int? songCount = switch (item.baseItemType) {
int? trackCount = switch (item.baseItemType) {
BaseItemDtoType.album ||
BaseItemDtoType.playlist =>
children?.length,
Expand All @@ -83,7 +83,7 @@ class DownloadButton extends ConsumerWidget {
_ => null
};
await DownloadDialog.show(context, item, viewId,
songCount: songCount);
trackCount: trackCount);
}
},
tooltip: parentTooltip,
Expand Down Expand Up @@ -135,12 +135,12 @@ class DownloadButton extends ConsumerWidget {
}
}
var coreButton = status.isRequired ? deleteButton : downloadButton;
// Only show sync on album/song if there we know we are outdated due to failed downloads or the like.
// Only show sync on album/track if there we know we are outdated due to failed downloads or the like.
// On playlists/artists/genres, always show if downloaded.
List<Widget> buttons;
if (status == DownloadItemStatus.notNeeded ||
((item.baseItemType == BaseItemDtoType.album ||
item.baseItemType == BaseItemDtoType.song) &&
item.baseItemType == BaseItemDtoType.track) &&
!status.outdated) ||
isLibrary) {
buttons = [coreButton];
Expand Down
Loading