refactor: fix caching isn't working with spotify 0.12

This commit is contained in:
Kingkor Roy Tirtho 2023-09-26 20:22:05 +06:00
parent afbb8ba5a7
commit ae2745fdb7
5 changed files with 9 additions and 7 deletions

View File

@ -3,7 +3,7 @@ import 'package:spotify/spotify.dart';
extension AlbumJson on AlbumSimple {
Map<String, dynamic> toJson() {
return {
"albumType": albumType,
"albumType": albumType?.name,
"id": id,
"name": name,
"images": images

View File

@ -40,7 +40,7 @@ class LocalTrack extends Track {
return {
"album": album?.toJson(),
"artists": artists?.map((artist) => artist.toJson()).toList(),
"availableMarkets": availableMarkets,
"availableMarkets": availableMarkets?.map((m) => m.name),
"discNumber": discNumber,
"duration": duration.toString(),
"durationMs": durationMs,

View File

@ -250,7 +250,7 @@ class SpotubeTrack extends Track {
// super values
"album": album?.toJson(),
"artists": artists?.map((artist) => artist.toJson()).toList(),
"availableMarkets": availableMarkets,
"availableMarkets": availableMarkets?.map((m) => m.name),
"discNumber": discNumber,
"duration": duration.toString(),
"durationMs": durationMs,

View File

@ -370,8 +370,7 @@ class SettingsPage extends HookConsumerWidget {
TextSpan(
text:
"${e.name.trim()}\n",
style: Theme.of(context)
.textTheme
style: theme.textTheme
.labelLarge,
),
TextSpan(

View File

@ -246,7 +246,10 @@ class UserPreferences extends PersistedChangeNotifier {
@override
FutureOr<void> loadFromLocal(Map<String, dynamic> map) async {
saveTrackLyrics = map["saveTrackLyrics"] ?? false;
recommendationMarket = map["recommendationMarket"] ?? recommendationMarket;
recommendationMarket = Market.values.firstWhere(
(market) =>
market.name == (map["recommendationMarket"] ?? recommendationMarket),
);
checkUpdate = map["checkUpdate"] ?? checkUpdate;
themeMode = ThemeMode.values[map["themeMode"] ?? 0];
@ -306,7 +309,7 @@ class UserPreferences extends PersistedChangeNotifier {
FutureOr<Map<String, dynamic>> toMap() {
return {
"saveTrackLyrics": saveTrackLyrics,
"recommendationMarket": recommendationMarket,
"recommendationMarket": recommendationMarket.name,
"themeMode": themeMode.index,
"accentColorScheme": accentColorScheme.toString(),
"albumColorSync": albumColorSync,