def catalog music

This commit is contained in:
gdlbo
2022-07-21 14:16:22 +03:00
parent 21d9c13fdf
commit 69a4cfa715
4 changed files with 53 additions and 3 deletions
@@ -6,6 +6,7 @@ import static ru.vtosters.lite.f0x1d.VTVerifications.isVerified;
import static ru.vtosters.lite.hooks.DateHook.getLocale;
import static ru.vtosters.lite.utils.Base64Utils.decode;
import static ru.vtosters.lite.utils.Globals.getContext;
import static ru.vtosters.lite.utils.Globals.getPrefsValue;
import static ru.vtosters.lite.utils.Globals.getUserToken;
import static ru.vtosters.lite.utils.Preferences.dev;
import static ru.vtosters.lite.utils.Preferences.friendsblock;
@@ -89,6 +90,8 @@ public class JsonInjectors{
}
}
if (!dev()) return orig.optJSONObject("conversation_bar");
// JSONObject("{\"name\":\"group_admin_welcome\",\"text\":\"" + textverif + "\",\"buttons\":[],\"icon\":\"" + pic + "\"}");
return new JSONObject(decode("eyJuYW1lIjoiZ3JvdXBfYWRtaW5fd2VsY29tZSIsInRleHQiOiI=")
+ text + decode("IiwiYnV0dG9ucyI6Ww==")
@@ -151,7 +154,9 @@ public class JsonInjectors{
}
public static JSONObject music(JSONObject json) throws JSONException{
var oldItems = json.optJSONObject("catalog").optJSONArray("sections");
var catalog = json.optJSONObject("catalog");
var oldItems = catalog.optJSONArray("sections");
if (oldItems != null) {
var playlists = fetchCatalogId("https://vk.com/audio?section=my_playlists");
@@ -186,6 +191,20 @@ public class JsonInjectors{
oldItems.put(new JSONObject().put("id", id).put("title", title).put("url", url));
}
for (int i = 0; i < oldItems.length(); i++) {
var item = oldItems.optJSONObject(i);
var title = item.optString("title");
var id = item.optString("id");
var url = item.optString("url");
var value = getPrefsValue("musicdefcatalog");
Log.d("VKMusic", "title: " + title + " id: " + id + " url: " + url + " value: " + value);
if (url.contains(value)) {
catalog.put("default_section", id);
}
}
}
return json;
+8
View File
@@ -621,6 +621,14 @@
<item>Не обновлять</item>
<item>Обновлять мгновенно</item>
</string-array>
<string-array name="musicdefcatalog_value">
<item>По умолчанию</item>
<item>Недавно прослушанные</item>
<item>Моя музыка</item>
<item>Плейлисты</item>
<item>Альбомы</item>
<item>Обзор</item>
</string-array>
<string-array name="undel_value">
<item>[Удалено]</item>
<item>🗑</item>
+16
View File
@@ -798,6 +798,22 @@
<item>no_update</item>
<item>imd_update</item>
</string-array>
<string-array name="musicdefcatalog_value">
<item>Default</item>
<item>Recent</item>
<item>My music</item>
<item>Playlists</item>
<item>Albums</item>
<item>Explore</item>
</string-array>
<string-array name="musicdefcatalog">
<item>general</item>
<item>recent</item>
<item>all</item>
<item>my_playlists</item>
<item>albums</item>
<item>explore</item>
</string-array>
<string-array name="undel_value">
<item>[Deleted]</item>
<item>🗑</item>
+9 -2
View File
@@ -45,8 +45,15 @@
<com.vtosters.lite.ui.MaterialSwitchPreference
android:defaultValue="true"
android:key="musicnewcatalog"
android:summary="Новый каталог музыкального раздела с динамическим контентом. Возможны пропажи некоторорых существующих разделов тк каталоги ещё не доработаны"
android:title="Новый раздел музыки (beta)" />
android:summary="Новый каталог музыкального раздела с динамическим контентом"
android:title="Новый раздел музыки" />
<com.vtosters.lite.ui.SummaryListPreference
android:defaultValue="general"
android:dialogTitle="Выберите раздел по умолчанию"
android:entries="@array/musicdefcatalog_value"
android:entryValues="@array/musicdefcatalog"
android:key="musicdefcatalog"
android:title="Раздел музыки по умолчанию" />
</PreferenceCategory>
<PreferenceCategory android:title="Видео">
<Preference