Skip to content

Liquid Glass and Apple Music touches for the Spotify iOS app. A GPL-3.0 fork of spoti.pw 0.21.1.

C

feat: block the ad card under the player and make crossfade and automix play

Vojtěch Škopek55c3c60f7726
diff --git a/docs/tweaks.md b/docs/tweaks.md
index a8e08471..4435aa14 100644
--- a/docs/tweaks.md
+++ b/docs/tweaks.md
@@ -42,7 +42,8 @@ app:
Privacy/ telemetry blocking and its counters
AdBlock/ EeveeSpotify's ad blocking: the ad and upsell services silenced (AdServices.x), ad components out of the
Hub JSON (AdHubs.x) and the feeds (Feeds.m), Premium pop-ups dropped (AdPopups.x), and the responses
- rewritten on the way in (AdNetwork.x, Premium.m over the protobuf walker in Protobuf.m)
+ rewritten on the way in (AdNetwork.x, Premium.m over the protobuf walker in Protobuf.m), with crossfade
+ and automix switched on in the player core and crossfade's switch kept in step with its slider (Crossfade.x)
ArtistBlock/ tracks by blocked artists skipped as they start (ArtistSkip.x), the list and the Blocked artists page under Player
Karaoke/ Apple Music style lyrics on the full screen page: lines read from color-lyrics and the player's clock (KaraokeSource.x),
words timed by estimate inside Spotify's line times (KaraokeTiming.m), drawn by KaraokeView.m over the page (KaraokePage.x)
@@ -84,8 +85,9 @@ the player buttons to hide, and Queue & devices and Lock screen widget as flag p
the Gradient page (the wash behind the top of Home in one of eight colours, at three strengths and
four heights) and the Home flags, the parts of Home to hide including the DJ button and badge, the
playlist header, buttons and pills to hide, and the Library flags. Then Premium, ads & privacy
-(EeveeSpotify's Hide ads and Hide upsells with an Ad and upsell flags page under them, every switch
-there forcing a flag Spotify ships on to off; Spoof Premium; Block telemetry; then what the ad
+(EeveeSpotify's Hide ads and Hide upsells, hiding the video carousel and social proof in Search, and
+an Ad and upsell flags page under them, every switch there forcing a flag Spotify ships on to off;
+Spoof Premium; Block telemetry; then what the ad
blocking and the telemetry blocking have stopped) and Labs (features Spotify built and did not ship,
AI Chat (Martini) first). Last, All flags, Spotify's remote-config flags with a search field and an
Auto / Off / On control per flag (a text field for the number and text ones), and Mod: the update
diff --git a/tweak/Sources/Features/AdBlock/AdBlock.h b/tweak/Sources/Features/AdBlock/AdBlock.h
index 5ced12ae..5fa37cef 100644
--- a/tweak/Sources/Features/AdBlock/AdBlock.h
+++ b/tweak/Sources/Features/AdBlock/AdBlock.h
@@ -3,13 +3,16 @@
// before they render (AdHubs.x, Feeds.m) and answers the requests behind them empty (AdNetwork.x).
// Hide upsells drops the Premium prompts (AdPopups.x, AdServices.x) and forces the flags that show
// them off (AdBlock.m, through Flags.x). Spoof Premium rewrites the product state and remote
-// config as they arrive (Premium.m) and keeps the session alive when the server disagrees
-// (AdNetwork.x).
+// config as they arrive (Premium.m), crossfade and automix included (Crossfade.x), and keeps the
+// session alive when the server disagrees (AdNetwork.x). The two Search switches force their flags
+// off (AdBlock.m, through Flags.x).
#import <UIKit/UIKit.h>
#define SGKeyHideAds @"spotifyglass.adblock.ads"
#define SGKeyHideUpsells @"spotifyglass.adblock.upsells"
#define SGKeyFakePremium @"spotifyglass.adblock.premium"
+#define SGKeyHideSearchVideos @"spotifyglass.adblock.searchVideos"
+#define SGKeyHideSocialProof @"spotifyglass.adblock.socialProof"
// What a switch turning Spoof Premium on is told first.
extern NSString *const SGFakePremiumWarning;
diff --git a/tweak/Sources/Features/AdBlock/AdBlock.m b/tweak/Sources/Features/AdBlock/AdBlock.m
index d1202387..c393bee3 100644
--- a/tweak/Sources/Features/AdBlock/AdBlock.m
+++ b/tweak/Sources/Features/AdBlock/AdBlock.m
@@ -39,6 +39,11 @@ static NSString *const upsellFlags[] = {
@"ios-system-listeningparties.preview_ended_upsell_enabled",
};
+static NSString *const socialProofFlags[] = {
+ @"ios-feature-search.social_proof_playlist_enabled",
+ @"ios-feature-search.social_proof_plays_in_search_enabled",
+};
+
static BOOL listed(NSString *key, NSString *const list[], size_t count) {
for (size_t i = 0; i < count; i++) {
if ([key isEqualToString:list[i]]) return YES;
@@ -48,6 +53,8 @@ static BOOL listed(NSString *key, NSString *const list[], size_t count) {
BOOL SGAdBlockForcesFlagOff(NSString *key) {
if (SGHidden(SGKeyHideAds) && listed(key, adFlags, sizeof(adFlags) / sizeof(adFlags[0]))) return YES;
+ if (SGHidden(SGKeyHideSearchVideos) && [key isEqualToString:@"ios-feature-search.video_carousel_section_enabled"]) return YES;
+ if (SGHidden(SGKeyHideSocialProof) && listed(key, socialProofFlags, sizeof(socialProofFlags) / sizeof(socialProofFlags[0]))) return YES;
return SGHidden(SGKeyHideUpsells) && listed(key, upsellFlags, sizeof(upsellFlags) / sizeof(upsellFlags[0]));
}
diff --git a/tweak/Sources/Features/AdBlock/AdBlockSettings.m b/tweak/Sources/Features/AdBlock/AdBlockSettings.m
index da29a401..96a6113d 100644
--- a/tweak/Sources/Features/AdBlock/AdBlockSettings.m
+++ b/tweak/Sources/Features/AdBlock/AdBlockSettings.m
@@ -55,6 +55,8 @@ UIViewController *SGAdsSettingsPage(void) {
SGNotedSection(@"Ads", @[
SGWithSymbol(SGOptionRow(@"Hide ads", @"The ad services never start, ad components leave Home and Search before they render, and the requests behind them are answered empty", SGKeyHideAds), @"speaker.slash"),
SGWithSymbol(SGOptionRow(@"Hide upsells", @"Premium prompts, banners and sheets dropped, and the flags that show them forced off", SGKeyHideUpsells), @"hand.raised"),
+ SGWithSymbol(SGOptionRow(@"Hide the video carousel in Search", nil, SGKeyHideSearchVideos), @"play.rectangle.on.rectangle"),
+ SGWithSymbol(SGOptionRow(@"Hide social proof in Search", nil, SGKeyHideSocialProof), @"person.2"),
SGWithSymbol(SGPageRow(@"Ad and upsell flags", ^UIViewController *{ return adFlagsPage(); }), @"flag"),
], @"From EeveeSpotify, off until switched on. They reach only what is drawn; audio ads between songs are Spoof Premium's to stop."),
SGNotedSection(@"Premium", @[
diff --git a/tweak/Sources/Features/AdBlock/AdServices.x b/tweak/Sources/Features/AdBlock/AdServices.x
index 3ea83879..77a1f212 100644
--- a/tweak/Sources/Features/AdBlock/AdServices.x
+++ b/tweak/Sources/Features/AdBlock/AdServices.x
@@ -41,6 +41,11 @@ static void takeDown(UIView *view) {
%hook _TtC20NativeAds_LoggerImpl26NativeAdsLoggerServiceImpl
- (void)load { SGAdBlockCountOne(@"Ad services"); }
%end
+// The leavebehind card among the player's scroll cards. It has no -load; its card is added the way
+// lyrics and credits add theirs, so it is kept off the list instead.
+%hook _TtC32AdsEmbedded_EmbeddedCTACardsImpl23EmbeddedCTACardsService
+- (void)registerScrollProviderIn:(id)registry { SGAdBlockCountOne(@"Ad services"); }
+%end
%hook _TtC18AdsPlatform_ECMKit37AdsSponsoredPlaylistHeaderCentralView
- (void)didMoveToSuperview {
@@ -100,6 +105,7 @@ static void takeDown(UIView *view) {
@"_TtC48AdsEmbedded_AdsSponsoredContextNPBAttachmentImpl43AdsSponsoredContextNPBAttachmentServiceImpl",
@"_TtC42AdsEmbedded_AdsSponsoredPlaylistHeaderImpl37AdsSponsoredPlaylistHeaderServiceImpl",
@"_TtC20NativeAds_LoggerImpl26NativeAdsLoggerServiceImpl",
+ @"_TtC32AdsEmbedded_EmbeddedCTACardsImpl23EmbeddedCTACardsService",
@"_TtC18AdsPlatform_ECMKit37AdsSponsoredPlaylistHeaderCentralView",
]);
}
diff --git a/tweak/Sources/Features/AdBlock/Crossfade.x b/tweak/Sources/Features/AdBlock/Crossfade.x
new file mode 100644
index 00000000..ea71958a
--- /dev/null
+++ b/tweak/Sources/Features/AdBlock/Crossfade.x
@@ -0,0 +1,21 @@
+// Crossfade under Spoof Premium (EeveeSpotify's): the fade engine reads the stored crossfade switch,
+// but the duration slider only writes the duration, so the fade stayed off at any length.
+#import "Core/SGCore.h"
+#import "AdBlock.h"
+
+@interface _TtC31Preferences_CorePreferencesImpl28SPTPreferencesImplementation : NSObject
+- (void)setAudioCrossfade:(BOOL)on;
+@end
+
+%hook _TtC31Preferences_CorePreferencesImpl28SPTPreferencesImplementation
+- (void)setAudioCrossfadeTime:(NSInteger)time {
+ %orig;
+ [self setAudioCrossfade:time > 0];
+}
+%end
+
+%ctor {
+ if (!SGHidden(SGKeyFakePremium)) return;
+ %init;
+ SGRequireClasses(@[@"_TtC31Preferences_CorePreferencesImpl28SPTPreferencesImplementation"]);
+}
diff --git a/tweak/Sources/Features/AdBlock/Premium.m b/tweak/Sources/Features/AdBlock/Premium.m
index 3ad0a195..e7219292 100644
--- a/tweak/Sources/Features/AdBlock/Premium.m
+++ b/tweak/Sources/Features/AdBlock/Premium.m
@@ -100,6 +100,13 @@ typedef NS_ENUM(NSInteger, SGRuleKind) { SGRuleRemove, SGRuleSet, SGRuleForce, S
typedef struct { const char *scope, *name; SGRuleKind kind; BOOL on; const char *text; } SGRule;
static const SGRule rules[] = {
+ // The ios-feature-settings flags only draw the rows; the player core gates each on its own scope.
+ {"ios-feature-settings", "crossfade_enabled", SGRuleForce, YES, NULL},
+ {"ios-feature-settings", "automix_enabled", SGRuleForce, YES, NULL},
+ {"core-playback-setup", "crossfade_enabled", SGRuleForce, YES, NULL},
+ {"core-automix", "automix_enabled", SGRuleForce, YES, NULL},
+ {"ios-feature-settings", "use_playback_settings_crossfade", SGRuleForce, NO, NULL},
+ {"ios-feature-settings", "use_playback_settings_gapless", SGRuleForce, NO, NULL},
{NULL, "enable_common_capping", SGRuleRemove, NO, NULL},
{NULL, "enable_pns_common_capping", SGRuleRemove, NO, NULL},
{NULL, "enable_pick_and_shuffle_common_capping", SGRuleRemove, NO, NULL},
@@ -271,9 +278,9 @@ static const SGRule rules[] = {
{NULL, "is_ad_on_app_open_enabled", SGRuleSet, NO, NULL},
{NULL, "ad_on_app_open_enabled", SGRuleSet, NO, NULL},
{NULL, "adonappopen_enabled", SGRuleSet, NO, NULL},
- {NULL, "marquee", SGRuleRemove, NO, NULL},
+ {"marquee", NULL, SGRuleRemove, NO, NULL},
{"ios-feature-marquee", NULL, SGRuleRemove, NO, NULL},
- {NULL, "leavebehindadsbase", SGRuleRemove, NO, NULL},
+ {"leavebehindadsbase", NULL, SGRuleRemove, NO, NULL},
{"ios-feature-leavebehindadsbase", NULL, SGRuleRemove, NO, NULL},
{"ios-nowplaying-scroll-impl", "unified_leavebehind_npv_scroll_music_enabled", SGRuleForce, NO, NULL},
{"ios-nowplaying-scroll-impl", "unified_leavebehind_npv_scroll_podcast_enabled", SGRuleForce, NO, NULL},
@@ -334,6 +341,7 @@ static const SGRule rules[] = {
{NULL, "enable_video_ads_player_v2", SGRuleSet, NO, NULL},
{NULL, "enable_sponsored_search_results_v2", SGRuleSet, NO, NULL},
{NULL, "enable_sponsored_home_results_v2", SGRuleSet, NO, NULL},
+ {"ios-feature-search", "prompted_playlist_merchandizing_enabled", SGRuleSet, NO, NULL},
{NULL, "should_nova_scroll_use_scrollsita", SGRuleRemove, NO, NULL},
{"ios-sociallistening-configuration-impl", "premium_gated_start_jam_buttons_enabled", SGRuleForce, NO, NULL},
};