Skip to content

Commit

Permalink
Merge pull request #847 from Maxr1998/fix-stray-null
Browse files Browse the repository at this point in the history
Fix stray "null" in download transcode dialog
  • Loading branch information
jmshrv authored Aug 22, 2024
2 parents 8e7a8a9 + da460bc commit bc2f006
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 13 deletions.
27 changes: 15 additions & 12 deletions lib/components/AlbumScreen/download_dialog.dart
Original file line number Diff line number Diff line change
Expand Up @@ -121,31 +121,34 @@ class _DownloadDialogState extends State<DownloadDialog> {
DownloadProfile(transcodeCodec: FinampTranscodingCodec.original);

if (widget.children != null) {
final originalFileSize = widget.children!
.map((e) => e.mediaSources?.first.size ?? 0)
.fold(0, (a, b) => a + b);

final transcodedFileSize = widget.children!
.map((e) => e.mediaSources?.first.transcodedSize(FinampSettingsHelper
.finampSettings.downloadTranscodingProfile.bitrateChannels))
.fold(0, (a, b) => a + (b ?? 0));

transcodeDescription = FileSize.getSize(
transcodedFileSize,
precision: PrecisionValue.None,
);

final originalFileSize = widget.children!
.map((e) => e.mediaSources?.first.size ?? 0)
.fold(0, (a, b) => a + b);

final originalFileSizeFormatted = FileSize.getSize(
originalFileSize,
precision: PrecisionValue.None,
);

originalDescription = originalFileSizeFormatted;

final formats = widget.children!
.map((e) => e.mediaSources?.first.mediaStreams.first.codec)
.toSet();

transcodeDescription = FileSize.getSize(
transcodedFileSize,
precision: PrecisionValue.None,
);

originalDescription =
"$originalFileSizeFormatted ${formats.length == 1 ? formats.first!.toUpperCase() : "null"}";
if (formats.length == 1) {
originalDescription += " ${formats.first!.toUpperCase()}";
}
}

return AlertDialog(
Expand Down Expand Up @@ -233,4 +236,4 @@ class _DownloadDialogState extends State<DownloadDialog> {
],
);
}
}
}
2 changes: 1 addition & 1 deletion lib/l10n/app_en.arb
Original file line number Diff line number Diff line change
Expand Up @@ -1420,7 +1420,7 @@
},
"description": "Collection info line in downloads screen lists"
},
"dontTranscode": "Download original{description, select, null{} other { - {description}}}",
"dontTranscode": "Download original{description, select, null{} other{ - {description}}}",
"@dontTranscode": {
"placeholders": {
"description": {
Expand Down

0 comments on commit bc2f006

Please sign in to comment.