From 3fea0e9c40744af64cae649091f9597bcf01c206 Mon Sep 17 00:00:00 2001
From: gdlbo <41114720+gdlbo@users.noreply.github.com>
Date: Wed, 27 Jul 2022 18:03:45 +0300
Subject: [PATCH] podcasts are dead + returned old vk pay
---
.../ru/vtosters/lite/hooks/JsonInjectors.java | 39 +++++++++++++++++++
.../ru/vtosters/lite/utils/Preferences.java | 4 ++
smali/res/xml/preferences_debug.xml | 4 ++
.../com/vk/auth/api/VKAccount.smali | 2 +
.../com/vk/menu/MenuUtils.smali | 4 +-
.../general/fragments/WebViewFragment.smali | 25 +++---------
.../lite/ui/widget/MenuListView.smali | 2 +-
7 files changed, 58 insertions(+), 22 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 49c7e7d20..3c79c406b 100644
--- a/app/src/main/java/ru/vtosters/lite/hooks/JsonInjectors.java
+++ b/app/src/main/java/ru/vtosters/lite/hooks/JsonInjectors.java
@@ -23,6 +23,7 @@ import static ru.vtosters.lite.utils.Preferences.friendsblock;
import static ru.vtosters.lite.utils.Preferences.friendsrecomm;
import static ru.vtosters.lite.utils.Preferences.getBoolValue;
import static ru.vtosters.lite.utils.Preferences.hasVerification;
+import static ru.vtosters.lite.utils.Preferences.podcastcatalog;
import static ru.vtosters.lite.utils.Preferences.postsrecomm;
import android.net.Uri;
@@ -465,7 +466,23 @@ public class JsonInjectors{
oldItems = catalog.optJSONArray("sections");
}
+
if (oldItems != null) {
+ if (podcastcatalog()) {
+ var podcasts = fetchCatalogPodcast();
+ if (podcasts != null) {
+ var catalogarr = podcasts.optJSONObject("catalog").optJSONArray("sections").optJSONObject(0);
+
+ var title = catalogarr.optString("title");
+ var id = catalogarr.optString("id");
+ var url = catalogarr.optString("url");
+
+ if (dev()) Log.d("VKMusic", "Added " + title + " in music sections");
+
+ oldItems.put(new JSONObject().put("id", id).put("title", title).put("url", url));
+ }
+ }
+
var playlists = fetchCatalogId("https://vk.com/audio?section=my_playlists");
if (playlists != null) {
var catalogarr = playlists.optJSONObject("catalog").optJSONArray("sections").optJSONObject(0);
@@ -550,6 +567,28 @@ public class JsonInjectors{
return null;
}
+ public static JSONObject fetchCatalogPodcast(){
+ var request = new Request.a()
+ .b("https://api.vk.com/method/catalog.getPodcasts"
+ + "?v=5.119"
+ + "&https=1"
+ + "&need_blocks=1"
+ + "&lang="
+ + getLocale()
+ + "&device_id="
+ + DeviceIdProvider.d(getContext())
+ + "&access_token="
+ + getUserToken())
+ .a(Headers.a("User-Agent", Network.l.c().a(), "Content-Type", "application/x-www-form-urlencoded; charset=utf-8")).a();
+ try {
+ return new JSONObject(mClient.a(request).execute().a().g()).getJSONObject("response");
+ } catch (JSONException | IOException e) {
+ Log.d("VTLMusic", "Error: " + e.getMessage());
+ }
+
+ return null;
+ }
+
public static JSONObject friends(JSONObject json) throws JSONException{
JSONObject catalog = json;
boolean sectionexecute = true;
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 f5287bb71..d643a916c 100644
--- a/app/src/main/java/ru/vtosters/lite/utils/Preferences.java
+++ b/app/src/main/java/ru/vtosters/lite/utils/Preferences.java
@@ -319,6 +319,10 @@ public class Preferences{
return getBoolValue("vkme_notifs", false);
}
+ public static boolean podcastcatalog(){
+ return getBoolValue("podcastcatalog", false);
+ }
+
public static boolean checkupdates(){
return getBoolValue("checkupdates", true) && isValidSignature();
}
diff --git a/smali/res/xml/preferences_debug.xml b/smali/res/xml/preferences_debug.xml
index 23ecfa1b7..d2771cc29 100644
--- a/smali/res/xml/preferences_debug.xml
+++ b/smali/res/xml/preferences_debug.xml
@@ -26,6 +26,10 @@
android:defaultValue="true"
android:key="newadblock"
android:title="Использовать новый AdBlock (Beta)" />
+
c:Lcom/vk/menu/MenuUtils;
- const-class v5, Lru/vtosters/lite/ui/fragments/VKPayFragment;
+ const-class v5, Lcom/vk/webapp/fragments/VkPayFragment;
const-string v1, "vk_pay"
@@ -2543,7 +2543,7 @@
invoke-virtual {v0, p1, v1}, Landroid/os/Bundle;->putInt(Ljava/lang/String;I)V
.line 27
- const-class p1, Lru/vtosters/lite/ui/fragments/VKPayFragment;
+ const-class p1, Lcom/vk/webapp/fragments/VkPayFragment;
invoke-static {v0, p1}, Lkotlin/Tuples;->a(Ljava/lang/Object;Ljava/lang/Object;)Lkotlin/Pair;
diff --git a/smali/smali_classes4/com/vtosters/lite/general/fragments/WebViewFragment.smali b/smali/smali_classes4/com/vtosters/lite/general/fragments/WebViewFragment.smali
index faebf8c63..af80fd4a0 100644
--- a/smali/smali_classes4/com/vtosters/lite/general/fragments/WebViewFragment.smali
+++ b/smali/smali_classes4/com/vtosters/lite/general/fragments/WebViewFragment.smali
@@ -312,7 +312,7 @@
.end method
.method private T(Ljava/lang/String;)V
- .locals 9
+ .locals 1
.line 1
invoke-static {p1}, Lcom/vk/webapp/fragments/VkPayFragment;->P(Ljava/lang/String;)Z
@@ -339,27 +339,14 @@
if-eqz v0, :cond_1
- invoke-static {}, Lru/vtosters/lite/utils/Globals;->getContext()Landroid/content/Context;
+ .line 3
+ new-instance v0, Lcom/vk/webapp/fragments/VkPayFragment$a;
- move-result-object v1
+ invoke-direct {v0, p1}, Lcom/vk/webapp/fragments/VkPayFragment$a;->(Ljava/lang/String;)V
- new-instance v8, Lcom/vk/navigation/Navigator;
+ const/16 p1, 0x66
- const-class v0, Lru/vtosters/lite/ui/fragments/VKPayFragment;
-
- invoke-direct {v8, v0}, Lcom/vk/navigation/Navigator;->(Ljava/lang/Class;)V
-
- invoke-virtual {v8, v1}, Lcom/vk/navigation/Navigator;->b(Landroid/content/Context;)Landroid/content/Intent;
-
- move-result-object v8
-
- const/high16 v0, 0x10000000
-
- .line 15
- invoke-virtual {v8, v0}, Landroid/content/Intent;->addFlags(I)Landroid/content/Intent;
-
- .line 16
- invoke-virtual {v1, v8}, Landroid/content/Context;->startActivity(Landroid/content/Intent;)V
+ invoke-virtual {v0, p0, p1}, Lcom/vk/navigation/Navigator;->a(Lcom/vk/core/fragments/FragmentImpl;I)V
:cond_1
return-void
diff --git a/smali/smali_classes5/com/vtosters/lite/ui/widget/MenuListView.smali b/smali/smali_classes5/com/vtosters/lite/ui/widget/MenuListView.smali
index 571977e4f..86ca33816 100644
--- a/smali/smali_classes5/com/vtosters/lite/ui/widget/MenuListView.smali
+++ b/smali/smali_classes5/com/vtosters/lite/ui/widget/MenuListView.smali
@@ -1985,7 +1985,7 @@
.line 34
:cond_11
- instance-of v2, v0, Lru/vtosters/lite/ui/fragments/VKPayFragment;
+ instance-of v2, v0, Lcom/vk/webapp/fragments/VkPayFragment;
if-eqz v2, :cond_12