diff --git a/app/src/main/java/ru/vtosters/lite/utils/JsonInjectors.java b/app/src/main/java/ru/vtosters/lite/utils/JsonInjectors.java index 5b438d18d..addb135b2 100644 --- a/app/src/main/java/ru/vtosters/lite/utils/JsonInjectors.java +++ b/app/src/main/java/ru/vtosters/lite/utils/JsonInjectors.java @@ -4,7 +4,9 @@ import static ru.vtosters.lite.f0x1d.VTVerifications.isDeveloper; import static ru.vtosters.lite.f0x1d.VTVerifications.isPrometheus; import static ru.vtosters.lite.f0x1d.VTVerifications.isVerified; import static ru.vtosters.lite.utils.Base64Utils.decode; +import static ru.vtosters.lite.utils.Globals.sendToast; import static ru.vtosters.lite.utils.Preferences.dev; +import static ru.vtosters.lite.utils.Preferences.friendsblock; import static ru.vtosters.lite.utils.Preferences.getBoolValue; import static ru.vtosters.lite.utils.Preferences.hasVerification; @@ -97,6 +99,63 @@ public class JsonInjectors{ return json.putOpt("items", newItems); } + public static JSONObject friends(JSONObject json) throws JSONException{ + JSONObject catalog = json; + Boolean sectionexecute = true; + + if (json.optJSONObject("catalog") != null) { + catalog = json.optJSONObject("catalog"); + sectionexecute = false; + } + + JSONArray section = null; + JSONObject sections = null; + + if (sectionexecute) { + sections = catalog.optJSONObject("section"); + } else { + section = catalog.optJSONArray("sections"); + } + + JSONArray oldItems; + + if (sectionexecute) { + oldItems = sections.optJSONArray("blocks"); + } else { + oldItems = section.optJSONObject(0).optJSONArray("blocks"); + } + + var newItems = new JSONArray(); + if (oldItems != null) { + for (int i = 0; i < oldItems.length(); i++) { + var type = oldItems.optJSONObject(i); + var name = type.optJSONObject("layout").optString("name"); + var buttons = ""; + var skip = false; + if (type.optJSONArray("buttons") != null) { + buttons = type.optJSONArray("buttons").optJSONObject(0).optString("ref_layout_name"); + } + if (name.contains("list_friend_suggests") || buttons.contains("list_friend_suggests") || name.contains("separator")) { + skip = friendsblock(); + } + + if (!skip) { + newItems.put(type); + } + + } + } + + if (sectionexecute) { + sections.putOpt("blocks", newItems); + } else { + section.optJSONObject(0).putOpt("blocks", newItems); + } + + return json; + } + + public static boolean haveDonateButton(){ int randomshower = new Random().nextInt(6); diff --git a/app/src/main/java/ru/vtosters/lite/utils/Preferences.java b/app/src/main/java/ru/vtosters/lite/utils/Preferences.java index 549dc08dc..ac836bf94 100644 --- a/app/src/main/java/ru/vtosters/lite/utils/Preferences.java +++ b/app/src/main/java/ru/vtosters/lite/utils/Preferences.java @@ -194,6 +194,10 @@ public class Preferences{ return getBoolValue("superapp", true); } + public static boolean friendsblock(){ + return getBoolValue("friendsblock", false); + } + public static boolean milkshake(){ return getBoolValue("milkshake", false); } diff --git a/smali/res/xml/preferences_interface.xml b/smali/res/xml/preferences_interface.xml index 7e526da11..f68570dee 100644 --- a/smali/res/xml/preferences_interface.xml +++ b/smali/res/xml/preferences_interface.xml @@ -40,6 +40,11 @@ android:key="superapp" android:summary="Новый вид меню как в новых версиях ВКонтакте" android:title="Супераппы" /> + friends(Lorg/json/JSONObject;)Lorg/json/JSONObject; + + move-result-object p1 + const-string v1, "r.getJSONObject(ServerKeys.RESPONSE)" invoke-static {p1, v1}, Lkotlin/jvm/internal/Intrinsics;->a(Ljava/lang/Object;Ljava/lang/String;)V diff --git a/smali/smali_classes2/com/vk/catalog2/core/api/i/CatalogGetSectionFriends.smali b/smali/smali_classes2/com/vk/catalog2/core/api/i/CatalogGetSectionFriends.smali index b78eeb4e4..ecd4e64e5 100644 --- a/smali/smali_classes2/com/vk/catalog2/core/api/i/CatalogGetSectionFriends.smali +++ b/smali/smali_classes2/com/vk/catalog2/core/api/i/CatalogGetSectionFriends.smali @@ -79,6 +79,10 @@ move-result-object p1 + invoke-static {p1}, Lru/vtosters/lite/utils/JsonInjectors;->friends(Lorg/json/JSONObject;)Lorg/json/JSONObject; + + move-result-object p1 + const-string v1, "r.getJSONObject(ServerKeys.RESPONSE)" invoke-static {p1, v1}, Lkotlin/jvm/internal/Intrinsics;->a(Ljava/lang/Object;Ljava/lang/String;)V