Skip to content

Commit

Permalink
added new block to remove
Browse files Browse the repository at this point in the history
cyz unsupported
  • Loading branch information
gdlbo committed Mar 18, 2024
1 parent 5aa0fe9 commit 6998bdb
Showing 1 changed file with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import ru.vtosters.sponsorpost.utils.GzipDecompressor;

import java.io.IOException;
import java.util.Objects;

import static com.vk.core.network.Network.ClientType.CLIENT_API;
import static ru.vtosters.hooks.DateHook.getLocale;
Expand Down Expand Up @@ -89,6 +90,7 @@ public static void catalogInjector(JSONObject json) {
var blocks = section.getJSONArray("blocks");

fixDailyMix(blocks);
removeUnsupportedLayouts(blocks);

if (!isUsersCatalog || MusicCacheImpl.isEmpty() || LibVKXClient.isIntegrationEnabled()) {
return; // early return if not users catalog or no tracks or integration enabled
Expand Down Expand Up @@ -221,6 +223,14 @@ private static void removeUnsupportedLayouts(JSONArray blocks) throws JSONExcept
for (int i = 0; i < blocks.length(); i++) {
var block = blocks.optJSONObject(i);
var layout = block.optJSONObject("layout");
var data_type = block.optString("data_type");

if (Objects.equals(data_type, "music_recommended_playlists")) {
blocks.remove(i);
blocks.remove(i - 1);
blocks.remove(i - 2);
}

if (layout != null) {
var name = layout.optString("name");
if (name.equals("header_extended")) {
Expand Down

0 comments on commit 6998bdb

Please sign in to comment.