From e703adb168fc56c99900aaa862bd566c34b65da6 Mon Sep 17 00:00:00 2001
From: gdlbo <41114720+gdlbo@users.noreply.github.com>
Date: Wed, 27 Jul 2022 13:33:47 +0300
Subject: [PATCH] some music fixes
---
.../ru/vtosters/lite/hooks/JsonInjectors.java | 19 +++++++++++++++++--
smali/res/values-ru/arrays.xml | 1 +
smali/res/values/arrays.xml | 2 ++
smali/res/xml/preferences_media.xml | 2 +-
4 files changed, 21 insertions(+), 3 deletions(-)
diff --git a/app/src/main/java/ru/vtosters/lite/hooks/JsonInjectors.java b/app/src/main/java/ru/vtosters/lite/hooks/JsonInjectors.java
index 2367646bb..49c7e7d20 100644
--- a/app/src/main/java/ru/vtosters/lite/hooks/JsonInjectors.java
+++ b/app/src/main/java/ru/vtosters/lite/hooks/JsonInjectors.java
@@ -239,12 +239,27 @@ public class JsonInjectors{
return json.putOpt("items", newItems);
}
- public static JSONObject musiclink(JSONObject json){
+ public static JSONObject musiclink(JSONObject json) throws JSONException{
var oldItems = json.optJSONArray("links");
+ var section = json.optJSONObject("section");
+ var linksblock = section.optJSONArray("blocks");
+ var newBlock = new JSONArray();
if (oldItems != null) {
if (oldItems.optJSONObject(0).optString("url").contains("?section=recent")) {
json.remove("links");
+
+ for (int i = 0; i < linksblock.length(); i++) {
+ var item = linksblock.optJSONObject(i);
+ var datatype = item.optString("data_type");
+ var layname = item.optJSONObject("layout").optString("name");
+ if (!datatype.equals("links") && !layname.equals("separator")) {
+ newBlock.put(item);
+ }
+ }
+
+ section.putOpt("blocks", newBlock);
+
if (dev()) Log.d("VKMusic", "Removed links buttons");
}
}
@@ -499,7 +514,7 @@ public class JsonInjectors{
Log.d("VKMusic", "title: " + title + " id: " + id + " url: " + url + " value: " + value);
- if (url.contains(value)) {
+ if (url.contains(value) && !value.isEmpty() && !value.equals("default")) {
catalog.put("default_section", id);
if (dev()) Log.d("VKMusic", "Added " + title + " as default music section");
}
diff --git a/smali/res/values-ru/arrays.xml b/smali/res/values-ru/arrays.xml
index b6b9a3505..5d7270814 100644
--- a/smali/res/values-ru/arrays.xml
+++ b/smali/res/values-ru/arrays.xml
@@ -623,6 +623,7 @@
- По умолчанию
+ - Главная
- Недавно прослушанные
- Моя музыка
- Плейлисты
diff --git a/smali/res/values/arrays.xml b/smali/res/values/arrays.xml
index 7e64bac60..65b92f703 100644
--- a/smali/res/values/arrays.xml
+++ b/smali/res/values/arrays.xml
@@ -800,6 +800,7 @@
- Default
+ - General
- Recent
- My music
- Playlists
@@ -807,6 +808,7 @@
- Explore
+ - default
- general
- recent
- all
diff --git a/smali/res/xml/preferences_media.xml b/smali/res/xml/preferences_media.xml
index 0dbc1e2a9..52d2e7bd9 100644
--- a/smali/res/xml/preferences_media.xml
+++ b/smali/res/xml/preferences_media.xml
@@ -43,7 +43,7 @@
android:summary="Новый каталог музыкального раздела с динамическим контентом"
android:title="Новый раздел музыки" />