From 764950b2863b210a1d8ea02697ad7ff5d3392e4a Mon Sep 17 00:00:00 2001 From: Kingkor Roy Tirtho Date: Sat, 15 Mar 2025 17:15:29 +0600 Subject: [PATCH] Revert "chore: spotify home feed recommendations now showing up" This reverts commit 290affd435c77fc1712663aa83c38f5e76f609d9. --- lib/provider/spotify/views/home.dart | 9 ++++++++- lib/provider/spotify/views/home_section.dart | 5 +++++ .../custom_spotify_endpoints/spotify_endpoints.dart | 6 ++++-- 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/lib/provider/spotify/views/home.dart b/lib/provider/spotify/views/home.dart index 3e186c24..87c049f9 100644 --- a/lib/provider/spotify/views/home.dart +++ b/lib/provider/spotify/views/home.dart @@ -1,4 +1,5 @@ import 'package:hooks_riverpod/hooks_riverpod.dart'; +import 'package:spotube/provider/authentication/authentication.dart'; import 'package:spotube/provider/custom_spotify_endpoint_provider.dart'; import 'package:spotube/provider/user_preferences/user_preferences_provider.dart'; @@ -6,8 +7,14 @@ final homeViewProvider = FutureProvider((ref) async { final country = ref.watch( userPreferencesProvider.select((s) => s.market), ); + final spTCookie = ref.watch( + authenticationProvider.select((s) => s.asData?.value?.getCookie("sp_t")), + ); final spotify = ref.watch(customSpotifyEndpointProvider); - return spotify.getHomeFeed(country: country); + return spotify.getHomeFeed( + country: country, + spTCookie: spTCookie, + ); }); diff --git a/lib/provider/spotify/views/home_section.dart b/lib/provider/spotify/views/home_section.dart index e876065e..13f547e1 100644 --- a/lib/provider/spotify/views/home_section.dart +++ b/lib/provider/spotify/views/home_section.dart @@ -1,5 +1,6 @@ import 'package:hooks_riverpod/hooks_riverpod.dart'; import 'package:spotube/models/spotify/home_feed.dart'; +import 'package:spotube/provider/authentication/authentication.dart'; import 'package:spotube/provider/custom_spotify_endpoint_provider.dart'; import 'package:spotube/provider/user_preferences/user_preferences_provider.dart'; @@ -9,11 +10,15 @@ final homeSectionViewProvider = final country = ref.watch( userPreferencesProvider.select((s) => s.market), ); + final spTCookie = ref.watch( + authenticationProvider.select((s) => s.asData?.value?.getCookie("sp_t")), + ); final spotify = ref.watch(customSpotifyEndpointProvider); return spotify.getHomeFeedSection( sectionUri, country: country, + spTCookie: spTCookie, ); }); diff --git a/lib/services/custom_spotify_endpoints/spotify_endpoints.dart b/lib/services/custom_spotify_endpoints/spotify_endpoints.dart index 964d3e76..c05095b3 100644 --- a/lib/services/custom_spotify_endpoints/spotify_endpoints.dart +++ b/lib/services/custom_spotify_endpoints/spotify_endpoints.dart @@ -118,6 +118,7 @@ class CustomSpotifyEndpoints { Future getHomeFeed({ required Market country, + String? spTCookie, }) async { final headers = { 'app-platform': 'WebPlayer', @@ -136,7 +137,7 @@ class CustomSpotifyEndpoints { "operationName": "home", "variables": jsonEncode({ "timeZone": tz.local.name, - "sp_t": "", + "sp_t": spTCookie ?? "", "country": country.name, "facet": null, "sectionItemsLimit": 10 @@ -168,6 +169,7 @@ class CustomSpotifyEndpoints { Future getHomeFeedSection( String sectionUri, { + String? spTCookie, required Market country, }) async { final headers = { @@ -187,7 +189,7 @@ class CustomSpotifyEndpoints { "operationName": "homeSection", "variables": jsonEncode({ "timeZone": tz.local.name, - "sp_t": "", + "sp_t": spTCookie ?? "", "country": country.name, "uri": sectionUri }),