Revert "chore: spotify home feed recommendations now showing up"

This reverts commit 290affd435.
This commit is contained in:
Kingkor Roy Tirtho 2025-03-15 17:15:29 +06:00
parent 290affd435
commit 764950b286
3 changed files with 17 additions and 3 deletions

View File

@ -1,4 +1,5 @@
import 'package:hooks_riverpod/hooks_riverpod.dart'; 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/custom_spotify_endpoint_provider.dart';
import 'package:spotube/provider/user_preferences/user_preferences_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( final country = ref.watch(
userPreferencesProvider.select((s) => s.market), userPreferencesProvider.select((s) => s.market),
); );
final spTCookie = ref.watch(
authenticationProvider.select((s) => s.asData?.value?.getCookie("sp_t")),
);
final spotify = ref.watch(customSpotifyEndpointProvider); final spotify = ref.watch(customSpotifyEndpointProvider);
return spotify.getHomeFeed(country: country); return spotify.getHomeFeed(
country: country,
spTCookie: spTCookie,
);
}); });

View File

@ -1,5 +1,6 @@
import 'package:hooks_riverpod/hooks_riverpod.dart'; import 'package:hooks_riverpod/hooks_riverpod.dart';
import 'package:spotube/models/spotify/home_feed.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/custom_spotify_endpoint_provider.dart';
import 'package:spotube/provider/user_preferences/user_preferences_provider.dart'; import 'package:spotube/provider/user_preferences/user_preferences_provider.dart';
@ -9,11 +10,15 @@ final homeSectionViewProvider =
final country = ref.watch( final country = ref.watch(
userPreferencesProvider.select((s) => s.market), userPreferencesProvider.select((s) => s.market),
); );
final spTCookie = ref.watch(
authenticationProvider.select((s) => s.asData?.value?.getCookie("sp_t")),
);
final spotify = ref.watch(customSpotifyEndpointProvider); final spotify = ref.watch(customSpotifyEndpointProvider);
return spotify.getHomeFeedSection( return spotify.getHomeFeedSection(
sectionUri, sectionUri,
country: country, country: country,
spTCookie: spTCookie,
); );
}); });

View File

@ -118,6 +118,7 @@ class CustomSpotifyEndpoints {
Future<SpotifyHomeFeed> getHomeFeed({ Future<SpotifyHomeFeed> getHomeFeed({
required Market country, required Market country,
String? spTCookie,
}) async { }) async {
final headers = { final headers = {
'app-platform': 'WebPlayer', 'app-platform': 'WebPlayer',
@ -136,7 +137,7 @@ class CustomSpotifyEndpoints {
"operationName": "home", "operationName": "home",
"variables": jsonEncode({ "variables": jsonEncode({
"timeZone": tz.local.name, "timeZone": tz.local.name,
"sp_t": "", "sp_t": spTCookie ?? "",
"country": country.name, "country": country.name,
"facet": null, "facet": null,
"sectionItemsLimit": 10 "sectionItemsLimit": 10
@ -168,6 +169,7 @@ class CustomSpotifyEndpoints {
Future<SpotifyHomeFeedSection> getHomeFeedSection( Future<SpotifyHomeFeedSection> getHomeFeedSection(
String sectionUri, { String sectionUri, {
String? spTCookie,
required Market country, required Market country,
}) async { }) async {
final headers = { final headers = {
@ -187,7 +189,7 @@ class CustomSpotifyEndpoints {
"operationName": "homeSection", "operationName": "homeSection",
"variables": jsonEncode({ "variables": jsonEncode({
"timeZone": tz.local.name, "timeZone": tz.local.name,
"sp_t": "", "sp_t": spTCookie ?? "",
"country": country.name, "country": country.name,
"uri": sectionUri "uri": sectionUri
}), }),