From 5725bd8ec9a0646217ccde92cc8572a6ecb0e358 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Harrault?= <benoit@harrault.fr> Date: Thu, 26 Oct 2023 11:24:43 +0200 Subject: [PATCH] Display last received scrobble data/time --- android/gradle.properties | 4 ++-- assets/translations/en.json | 1 + assets/translations/fr.json | 1 + fastlane/metadata/android/en-US/changelogs/5.txt | 1 + fastlane/metadata/android/fr-FR/changelogs/5.txt | 1 + lib/models/statistics.dart | 5 +++++ lib/ui/widgets/main_screen/statistics.dart | 6 ++++++ pubspec.yaml | 2 +- 8 files changed, 18 insertions(+), 3 deletions(-) create mode 100644 fastlane/metadata/android/en-US/changelogs/5.txt create mode 100644 fastlane/metadata/android/fr-FR/changelogs/5.txt diff --git a/android/gradle.properties b/android/gradle.properties index 14eed39..aa51064 100644 --- a/android/gradle.properties +++ b/android/gradle.properties @@ -1,5 +1,5 @@ org.gradle.jvmargs=-Xmx1536M android.useAndroidX=true android.enableJetifier=true -app.versionName=0.0.4 -app.versionCode=4 +app.versionName=0.0.5 +app.versionCode=5 diff --git a/assets/translations/en.json b/assets/translations/en.json index 1ec64c1..d829a40 100644 --- a/assets/translations/en.json +++ b/assets/translations/en.json @@ -3,6 +3,7 @@ "global_statistics": "Global statistics", "statistics_total_scrobbles_count": "Total scrobbles count:", + "statistics_last_scrobble": "Last scrobble: ", "statistics_selected_period": "On last {daysCount} days:", "statistics_recent_scrobbles_count": "Scrobbles:", "statistics_discoveries": "Discoveries:", diff --git a/assets/translations/fr.json b/assets/translations/fr.json index 9800cee..d6bb8b0 100644 --- a/assets/translations/fr.json +++ b/assets/translations/fr.json @@ -3,6 +3,7 @@ "global_statistics": "Statistiques globales d'écoutes", "statistics_total_scrobbles_count": "Nombre total d'écoutes :", + "statistics_last_scrobble": "Dernière écoute :", "statistics_selected_period": "Sur les {daysCount} derniers jours:", "statistics_recent_scrobbles_count": "Écoutes :", "statistics_discoveries": "Découvertes :", diff --git a/fastlane/metadata/android/en-US/changelogs/5.txt b/fastlane/metadata/android/en-US/changelogs/5.txt new file mode 100644 index 0000000..95c7174 --- /dev/null +++ b/fastlane/metadata/android/en-US/changelogs/5.txt @@ -0,0 +1 @@ +Display last scrobble date/time diff --git a/fastlane/metadata/android/fr-FR/changelogs/5.txt b/fastlane/metadata/android/fr-FR/changelogs/5.txt new file mode 100644 index 0000000..c44ae99 --- /dev/null +++ b/fastlane/metadata/android/fr-FR/changelogs/5.txt @@ -0,0 +1 @@ +Affiche la date/heure de la dernière écoute enregistrée diff --git a/lib/models/statistics.dart b/lib/models/statistics.dart index 70ff49d..aebb596 100644 --- a/lib/models/statistics.dart +++ b/lib/models/statistics.dart @@ -4,6 +4,7 @@ class StatisticsData { final int firstPlayedArtistsCount; final int firstPlayedTracksCount; final int selectedPeriod; + final DateTime lastScrobble; const StatisticsData({ required this.totalCount, @@ -11,6 +12,7 @@ class StatisticsData { required this.firstPlayedArtistsCount, required this.firstPlayedTracksCount, required this.selectedPeriod, + required this.lastScrobble, }); factory StatisticsData.fromJson(Map<String, dynamic> json) { @@ -20,6 +22,9 @@ class StatisticsData { firstPlayedArtistsCount: json['firstPlayedArtistsCount'] as int, firstPlayedTracksCount: json['firstPlayedTracksCount'] as int, selectedPeriod: json['selectedPeriod'] as int, + lastScrobble: DateTime.parse( + json['lastScrobble']['date'], + ), ); } } diff --git a/lib/ui/widgets/main_screen/statistics.dart b/lib/ui/widgets/main_screen/statistics.dart index c0b555b..0dd1aeb 100644 --- a/lib/ui/widgets/main_screen/statistics.dart +++ b/lib/ui/widgets/main_screen/statistics.dart @@ -40,6 +40,12 @@ class Statistics extends StatelessWidget { snapshot.data!.totalCount.toString(), style: textTheme.bodyMedium, ), + Text( + tr('statistics_last_scrobble') + + ' ' + + DateFormat().format(snapshot.data!.lastScrobble), + style: textTheme.bodyMedium, + ), Text( 'statistics_selected_period', style: textTheme.bodyMedium, diff --git a/pubspec.yaml b/pubspec.yaml index 973a1df..e80d1d1 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -3,7 +3,7 @@ description: Display scrobbles data and charts publish_to: 'none' -version: 0.0.4+4 +version: 0.0.5+5 environment: sdk: '^3.0.0' -- GitLab