mirror of
https://github.com/KRTirtho/spotube.git
synced 2025-12-06 07:29:42 +00:00
Compare commits
3 Commits
08d41e3b66
...
903b6a2fba
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
903b6a2fba | ||
|
|
d9057dae57 | ||
|
|
3ff0f6dd27 |
@ -138,8 +138,10 @@ class LocalLibraryPage extends HookConsumerWidget {
|
||||
icon: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
const Icon(SpotubeIcons.delete),
|
||||
Text(context.l10n.clear_cache)
|
||||
const Expanded(child: Icon(SpotubeIcons.delete)),
|
||||
Text(
|
||||
context.l10n.clear_cache,
|
||||
)
|
||||
],
|
||||
).xSmall().iconSmall(),
|
||||
onPressed: () async {
|
||||
@ -180,7 +182,7 @@ class LocalLibraryPage extends HookConsumerWidget {
|
||||
icon: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
const Icon(SpotubeIcons.export),
|
||||
const Expanded(child: Icon(SpotubeIcons.export)),
|
||||
Text(
|
||||
context.l10n.export,
|
||||
)
|
||||
|
||||
@ -30,12 +30,31 @@ class FeaturedPlaylistsNotifier
|
||||
|
||||
@override
|
||||
fetch(int offset, int limit) async {
|
||||
try {
|
||||
final playlists = await spotify.playlists.featured.getPage(
|
||||
limit,
|
||||
offset,
|
||||
);
|
||||
|
||||
return playlists.items?.toList() ?? [];
|
||||
} catch (e) {
|
||||
/// This check only needs to be done once. Since this is one of the very first
|
||||
/// request
|
||||
///
|
||||
/// If the token is invalid, we refresh it and retry the request.
|
||||
/// Same goes for expired tokens
|
||||
if ((e is AuthorizationException && e.error == 'invalid_token') ||
|
||||
e is ExpirationException) {
|
||||
await ref.read(authenticationProvider.notifier).refreshCredentials();
|
||||
|
||||
final playlists = await spotify.playlists.featured.getPage(
|
||||
limit,
|
||||
offset,
|
||||
);
|
||||
return playlists.items?.toList() ?? [];
|
||||
}
|
||||
rethrow;
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
|
||||
Loading…
Reference in New Issue
Block a user