Skip to content

Commit 8633544

Browse files
authored
fix(Spotify - Unlock Premium): Remove wrongfully hidden non ad browse sections (#5403)
1 parent 9d31238 commit 8633544

File tree

3 files changed

+12
-10
lines changed

3 files changed

+12
-10
lines changed

extensions/spotify/src/main/java/app/revanced/extension/spotify/layout/hide/createbutton/HideCreateButtonPatch.java

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
package app.revanced.extension.spotify.layout.hide.createbutton;
22

3-
import java.util.List;
4-
53
import app.revanced.extension.shared.Logger;
6-
import app.revanced.extension.spotify.shared.ComponentFilters.*;
4+
import app.revanced.extension.spotify.shared.ComponentFilters.ComponentFilter;
5+
import app.revanced.extension.spotify.shared.ComponentFilters.ResourceIdComponentFilter;
6+
import app.revanced.extension.spotify.shared.ComponentFilters.StringComponentFilter;
7+
8+
import java.util.List;
79

810
@SuppressWarnings("unused")
911
public final class HideCreateButtonPatch {
@@ -53,7 +55,9 @@ public static Object returnNullIfIsCreateButton(Object navigationBarItem) {
5355
return null;
5456
}
5557
}
56-
} catch (Exception ex) {
58+
} catch (Throwable ex) {
59+
// Catch Throwable as calling toString can cause crashes with wrongfully generated code that throws
60+
// NoSuchMethod errors.
5761
Logger.printException(() -> "returnNullIfIsCreateButton failure", ex);
5862
}
5963

extensions/spotify/src/main/java/app/revanced/extension/spotify/misc/UnlockPremiumPatch.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,7 @@ private static class OverrideAttribute {
8888
* response which delivers browse sections.
8989
*/
9090
private static final List<Integer> REMOVED_BROWSE_SECTIONS = List.of(
91-
com.spotify.browsita.v1.resolved.Section.BRAND_ADS_FIELD_NUMBER,
92-
com.spotify.browsita.v1.resolved.Section.PROMOTION_V1_FIELD_NUMBER,
93-
com.spotify.browsita.v1.resolved.Section.PROMOTION_V3_FIELD_NUMBER
91+
com.spotify.browsita.v1.resolved.Section.BRAND_ADS_FIELD_NUMBER
9492
);
9593

9694
/**
@@ -249,7 +247,9 @@ public static boolean isFilteredContextMenuItem(Object contextMenuItem) {
249247
return true;
250248
}
251249
}
252-
} catch (Exception ex) {
250+
} catch (Throwable ex) {
251+
// Catch Throwable as calling toString can cause crashes with wrongfully generated code that throws
252+
// NoSuchMethod errors.
253253
Logger.printException(() -> "isFilteredContextMenuItem failure", ex);
254254
}
255255

extensions/spotify/stub/src/main/java/com/spotify/browsita/v1/resolved/Section.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,5 @@
22

33
public final class Section {
44
public static final int BRAND_ADS_FIELD_NUMBER = 6;
5-
public static final int PROMOTION_V1_FIELD_NUMBER = 3;
6-
public static final int PROMOTION_V3_FIELD_NUMBER = 5;
75
public int sectionTypeCase_;
86
}

0 commit comments

Comments
 (0)