Compare commits

..
Author SHA1 Message Date
gdlbo cc55d5ddaa new btn injector for groups 2023-04-29 19:24:55 +03:00
gdlbo 522290e4a5 Update GroupsCatalogInjector.java 2023-04-28 22:26:38 +03:00
gdlbo 78191b716a Update GroupsCatalogInjector.java 2023-04-28 22:16:20 +03:00
gdlbo dcf14266f2 cleanup catalog json injector 2023-04-28 22:11:53 +03:00
gdlbo a295e11a9d fixed issues with music 2023-04-28 21:58:14 +03:00
gdlbo 67ba4319f8 fixed groups fix for catalogs 2023-04-28 21:30:33 +03:00
aliveoutside f4d4c622eb fix #1235 2023-04-28 21:19:50 +03:00
gdlbo 0d61904b19 Update GmsUtils.java 2023-04-26 19:41:22 +03:00
gdlbo 8d9d025f11 some cleanup 2023-04-23 17:22:41 +03:00
gdlbo 6cac613f70 fixed microg pushes 2023-04-20 18:24:29 +03:00
gdlbo a5d0f1b730 microg settings and force microg usage 2023-04-20 16:14:52 +03:00
gdlbo 47465356fa fixed some spoof issues 2023-04-20 15:44:49 +03:00
gdlbo 4c6eed7dad added support for microg 2023-04-20 15:36:09 +03:00
gdlbo 7bdc8b21e4 updated jars 2023-04-20 15:31:59 +03:00
gdlbo 21fc171363 Update ThemesFragment.java 2023-04-03 21:11:55 +03:00
gdlbo fb09513ca7 samsung best fix 2023-04-03 17:43:55 +03:00
gdlbo dc49c75992 Update OEMDetector.java 2023-04-03 16:30:19 +03:00
gdlbo dd289f1933 another theme at start fix..? 2023-04-03 16:01:34 +03:00
gdlbo 360c5db990 fixed shit miui issue 2023-04-03 15:54:08 +03:00
gdlbo 0df490dc55 fixed perms 2023-04-03 15:46:16 +03:00
gdlbo 064f5d8b31 some wallpapers fixes 2023-04-02 21:37:06 +03:00
gdlbo 40f3d74f07 fixed strange bug 2023-04-02 19:54:52 +03:00
awers24 cd08354b5e ukrainian translation 2023-03-31 08:58:19 +03:00
mysh228 64a9a3c1e8 belarusian translation 2023-03-30 20:09:53 +03:00
gdlbo 8770712687 dockbar editor moved to dockbar settings in appearance sett 2023-03-30 14:25:05 +03:00
gdlbo 009f856b33 deleted useless vk apps menu in dockbar editor 2023-03-30 14:24:06 +03:00
gdlbo 022c264740 removed recomm menu in discover 2023-03-30 14:23:39 +03:00
gdlbo dd2d79e474 Update DataSettingsFragment.java 2023-03-29 00:07:40 +03:00
gdlbo f2fe2ec362 added language settings for a13+ 2023-03-28 22:42:45 +03:00
k1zn 46ef15d9c8 /ru/ translate [main] 2023-03-28 02:13:05 +05:00
k1zn 93a507a314 /ru/ localization 2023-03-28 01:36:38 +05:00
gdlbo a3853a012d Сохранение аккаунтов (#1165) 2023-03-27 21:55:57 +03:00
gdlbo 10ed61acfc new color engine now is optional 2023-03-27 21:00:40 +03:00
aliveoutside 8b434d4cae revert apktool 2023-03-27 19:00:13 +03:00
gdlbo 92a33995bd fixed adaptive icons 2023-03-27 17:35:47 +03:00
gdlbo d994439561 fixed cringe build update detection v2 2023-03-25 22:44:58 +03:00
gdlbo ed751bdc30 fixed cringe build update detection 2023-03-25 22:24:33 +03:00
gdlbo ababaad45f revert old theme engine for monet theme 2023-03-25 20:32:44 +03:00
gdlbo 9a76492c06 Update custom_thumb_selector.xml 2023-03-21 16:15:38 +03:00
gdlbo 2d19254d51 fixed start issue 2023-03-21 16:13:18 +03:00
gdlbo d557abe6e9 md3 switch 2023-03-21 16:05:55 +03:00
gdlbo 658c4bcaf6 fixed issue with system theme applying + crashes 2023-03-21 15:21:31 +03:00
gdlbo 7b12be3736 disabled switch coloring 2023-03-20 00:30:06 +03:00
gdlbo 9e2bfe83b8 Revert "disable out api inj for pinned msg"
This reverts commit 8ca73197d6.
2023-03-19 21:06:30 +03:00
gdlbo 817bdd8198 Update strings.xml 2023-03-19 21:06:22 +03:00
gdlbo 230f8e5cd3 Update GiftSendFragment$b.smali 2023-03-19 19:37:32 +03:00
gdlbo cfce4cd1ff fixed polls colors 2023-03-19 19:06:21 +03:00
gdlbo c9c602b1f9 added new icons 2023-03-19 18:14:25 +03:00
gdlbo 8ca73197d6 disable out api inj for pinned msg 2023-03-19 12:17:43 +03:00
gdlbo 2cf60aedac added enc key delete 2023-03-19 12:05:32 +03:00
gdlbo 207a63117e added identity frag support 2023-03-18 19:55:21 +03:00
gdlbo 14e92e7352 removed calls pref 2023-03-18 19:35:08 +03:00
gdlbo 23c60bdf2d reduced logging + reworked debug menu 2023-03-18 19:23:07 +03:00
gdlbo 680dcf9cf2 useCustomPrefsStyle optional 2023-03-18 13:36:36 +03:00
gdlbo 5249600b76 many build features upgrades 2023-03-18 13:10:12 +03:00
gdlbo bc5a401e0e useCustomPrefsStyle true 2023-03-18 11:37:43 +03:00
gdlbo 125c2d3d69 fix switches 2023-03-18 03:14:42 +03:00
gdlbo db95b53d41 added text coloring 2023-03-17 22:31:08 +03:00
417 changed files with 4554 additions and 3251 deletions
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,16 +1,21 @@
package com.vk.api.audio;
import android.text.TextUtils;
import androidx.annotation.NonNull;
import com.vk.api.base.ApiRequest;
import com.vk.dto.music.MusicTrack;
import com.vk.log.L;
import org.json.JSONObject;
import ru.vtosters.lite.music.Genius;
import ru.vtosters.lite.utils.Preferences;
import java.util.ArrayList;
import ru.vtosters.lite.music.Genius;
import ru.vtosters.lite.utils.AndroidUtils;
import ru.vtosters.lite.utils.Preferences;
public class AudioGetLyrics extends ApiRequest<AudioGetLyrics.a> {
private final MusicTrack musicTrack;
@@ -65,7 +70,7 @@ public class AudioGetLyrics extends ApiRequest<AudioGetLyrics.a> {
return aVar;
} catch (Exception e) {
L.e("vk", e);
aVar.a = "Ошибка получения текста" + "\n\n" + "Ошибка: \n" + e.getLocalizedMessage();
aVar.a = AndroidUtils.getString("failed_to_get_text") + "\n\n" + AndroidUtils.getString("error") + ": \n" + e.getLocalizedMessage();
return aVar;
}
}
@@ -0,0 +1,128 @@
package com.vk.core.extensions;
import android.content.res.ColorStateList;
import android.graphics.drawable.Drawable;
import android.text.TextUtils;
import android.view.View;
import android.widget.TextView;
import androidx.annotation.AttrRes;
import androidx.annotation.ColorRes;
import androidx.annotation.DrawableRes;
import androidx.core.content.ContextCompat;
import androidx.core.graphics.drawable.DrawableCompat;
import b.h.v.InitialValueObservable;
import b.h.v.TextViewTextChangeEvent;
import b.h.v.TextViewTextChangeEventObservable;
import com.vk.core.util.ContextExtKt;
import ru.vtosters.lite.utils.ThemesUtils;
public final class TextViewExt {
public static void a(TextView textView, Drawable drawable) {
a(textView, null, drawable);
}
public static boolean b(TextView textView) {
return textView == null || TextUtils.isEmpty(textView.getEditableText());
}
public static InitialValueObservable<TextViewTextChangeEvent> c(TextView textView) {
return new TextViewTextChangeEventObservable(textView);
}
public static void d(TextView textView, @DrawableRes int i, @AttrRes int i2) {
b(textView, ThemesUtils.recolorDrawable(ContextExtKt.a(textView.getContext(), i, ContextExtKt.h(textView.getContext(), i2))));
}
public static void a(TextView textView, Drawable drawable, ColorStateList colorStateList) {
a(textView, null, a(drawable, colorStateList));
}
public static void b(TextView textView, Drawable drawable) {
a(textView, drawable, (Drawable) null);
}
public static void c(TextView textView, @DrawableRes int i, @ColorRes int i2) {
if (i == 0) {
b(textView, null);
} else if (i2 == 0) {
b(textView, ContextCompat.getDrawable(textView.getContext(), i));
} else {
b(textView, ContextCompat.getDrawable(textView.getContext(), i), ContextCompat.getColorStateList(textView.getContext(), i2));
}
}
public static void d(TextView textView, int i) {
textView.setTextSize(0, i);
}
public static void a(TextView textView, @DrawableRes int i) {
a(textView, i, 0);
}
public static void b(TextView textView, Drawable drawable, ColorStateList colorStateList) {
a(textView, a(drawable, colorStateList), (Drawable) null);
}
public static void a(TextView textView, @DrawableRes int i, @ColorRes int i2) {
if (i == 0) {
a(textView, (Drawable) null);
} else if (i2 == 0) {
a(textView, ContextCompat.getDrawable(textView.getContext(), i));
} else {
a(textView, ContextCompat.getDrawable(textView.getContext(), i), ContextCompat.getColorStateList(textView.getContext(), i2));
}
}
public static void b(TextView textView, @DrawableRes int i) {
c(textView, i, 0);
}
public static void b(TextView textView, @DrawableRes int i, @AttrRes int i2) {
if (i == 0) {
a(textView, (Drawable) null);
} else if (i2 == 0) {
a(textView, ContextCompat.getDrawable(textView.getContext(), i));
} else {
Drawable drawable = ContextCompat.getDrawable(textView.getContext(), i);
a(textView, drawable, ColorStateList.valueOf(ContextExtKt.h(textView.getContext(), i2)));
}
}
public static void c(TextView textView, @ColorRes int i) {
textView.setTextColor(ContextExtKt.a(textView.getContext(), i));
}
private static void a(TextView textView, Drawable drawable, Drawable drawable2) {
textView.setCompoundDrawablesRelativeWithIntrinsicBounds(drawable, null, drawable2, null);
}
public static void a(TextView textView) {
textView.setCompoundDrawablesRelativeWithIntrinsicBounds(null, null, null, null);
}
public static Drawable a(Drawable drawable, ColorStateList colorStateList) {
if (colorStateList == null) return drawable;
if (drawable != null) {
Drawable wrap = DrawableCompat.wrap(drawable.mutate());
DrawableCompat.setTintList(wrap, colorStateList);
return wrap;
}
return null;
}
public static void a(TextView textView, CharSequence charSequence) {
if (TextUtils.isEmpty(charSequence)) {
textView.setVisibility(View.GONE);
return;
}
textView.setVisibility(View.VISIBLE);
textView.setText(charSequence);
}
public static void a(TextView textView, float f) {
textView.setTextSize(0, f);
}
}
@@ -0,0 +1,11 @@
package com.vk.extensions;
import android.widget.TextView;
import androidx.annotation.AttrRes;
import com.vk.core.ui.themes.VKThemeHelper;
public final class TextViewExt {
public static void a(TextView textView, @AttrRes int i) {
VKThemeHelper.a(textView, i);
}
}
@@ -1,12 +1,11 @@
package ru.vtosters.lite.concurrent;
import com.vk.core.concurrent.VkExecutors;
import io.reactivex.Scheduler;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import io.reactivex.Scheduler;
public class VTExecutors {
public static ExecutorService getMusicDownloadExecutor() {
return VTMusicDownloadExecutor.getInstance();
@@ -3,10 +3,7 @@ package ru.vtosters.lite.deviceinfo;
import ru.vtosters.lite.utils.AndroidUtils;
import ru.vtosters.lite.utils.ThemesUtils;
import static ru.vtosters.lite.deviceinfo.OEMDetector.hasMiuiIncrCode;
import static ru.vtosters.lite.deviceinfo.OEMDetector.isEMUI;
import static ru.vtosters.lite.deviceinfo.OEMDetector.isMIUI;
import static ru.vtosters.lite.deviceinfo.OEMDetector.isSamsung;
import static ru.vtosters.lite.deviceinfo.OEMDetector.*;
import static ru.vtosters.lite.utils.About.getBuildNumber;
public class Device {
@@ -1,14 +1,9 @@
package ru.vtosters.lite.deviceinfo;
import static ru.vtosters.lite.deviceinfo.OEMDetector.getEmuiVersionCode;
import static ru.vtosters.lite.deviceinfo.OEMDetector.getMiuiUiVersionCode;
import static ru.vtosters.lite.deviceinfo.OEMDetector.getMiuiUiVersionIncrementalCode;
import static ru.vtosters.lite.deviceinfo.OEMDetector.getMiuiUiVersionName;
import static ru.vtosters.lite.deviceinfo.OEMDetector.getOneUiMajorVersion;
import static ru.vtosters.lite.deviceinfo.OEMDetector.getOneUiMinorVersion;
import android.os.Build;
import static ru.vtosters.lite.deviceinfo.OEMDetector.*;
public class DeviceInfoCollector {
public Device collect() {
@@ -1,18 +1,17 @@
package ru.vtosters.lite.deviceinfo;
import static ru.vtosters.lite.utils.AndroidUtils.getGlobalContext;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.os.Build;
import android.text.TextUtils;
import ru.vtosters.lite.utils.ReflectionUtils;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import ru.vtosters.lite.utils.ReflectionUtils;
import static ru.vtosters.lite.utils.AndroidUtils.getGlobalContext;
public class OEMDetector {
private static Field semPlatformIntField;
@@ -25,8 +24,7 @@ public class OEMDetector {
try {
getPropMtd = ReflectionUtils.findMethod(Class.forName("android.os.SystemProperties"), "get", String.class);
semPlatformIntField = ReflectionUtils.findField(Build.VERSION.class, "SEM_PLATFORM_INT");
} catch (NoSuchFieldException | ClassNotFoundException | NoSuchMethodException e) {
e.printStackTrace();
} catch (NoSuchFieldException | ClassNotFoundException | NoSuchMethodException ignored) {
}
}
@@ -58,7 +56,7 @@ public class OEMDetector {
}
public static boolean isOEM() {
return isMIUI() || isEMUI() || isFlyme() || isZenUI() || isSamsung() || isVivo();
return isMIUI() || isEMUI() || isFlyme() || isZenUI() || isSamsung() || isVivo() || isOneUi();
}
public static boolean isMIUI() {
@@ -24,7 +24,9 @@ import ru.vtosters.lite.downloaders.messages.MessagesDownloader;
import ru.vtosters.lite.encryption.EncryptProvider;
import ru.vtosters.lite.encryption.base.IMProcessor;
import ru.vtosters.lite.hooks.CryptImHook;
import ru.vtosters.lite.proxy.ProxyUtils;
import ru.vtosters.lite.ui.dialogs.Translate;
import ru.vtosters.lite.utils.AccountManagerUtils;
import ru.vtosters.lite.utils.AndroidUtils;
import java.io.File;
@@ -33,13 +35,6 @@ import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import static ru.vtosters.lite.dnr.DNRModule.*;
import static ru.vtosters.lite.encryption.EncryptProvider.decryptMessage;
import static ru.vtosters.lite.proxy.ProxyUtils.getApi;
import static ru.vtosters.lite.utils.AccountManagerUtils.getUserToken;
import static ru.vtosters.lite.utils.AndroidUtils.isTablet;
import static ru.vtosters.lite.utils.AndroidUtils.sendToast;
public class DNRInjector {
public static void inject(Dialog dialog, List<DialogAction> list) {
int peerId = 0;
@@ -61,13 +56,13 @@ public class DNRInjector {
list.add(DialogAction.pinmsg);
list.add(DialogAction.unpinmsg);
if (isDnrEnabledFor(peerId)) {
if (DNRModule.isDnrEnabledFor(peerId)) {
list.add(DialogAction.DNR_OFF);
} else {
list.add(DialogAction.DNR_ON);
}
if (isDntEnabledFor(peerId)) {
if (DNRModule.isDntEnabledFor(peerId)) {
list.add(DialogAction.DNT_OFF);
} else {
list.add(DialogAction.DNT_ON);
@@ -110,7 +105,7 @@ public class DNRInjector {
list.add(new DialogActionsListView.b.a(DialogAction.DNT_ON, 2, R.attr.im_ic_edit_msg, R.string.DNT_ON)); // DialogAction, Int, Icon, String
list.add(new DialogActionsListView.b.a(DialogAction.DNT_OFF, 2, R.attr.im_ic_edit_msg, R.string.DNT_OFF)); // DialogAction, Int, Icon, String
if (!isTablet()) {
if (!AndroidUtils.isTablet()) {
list.add(new DialogActionsListView.b.a(DialogAction.ENCRYPT, 3, R.attr.im_ic_keyboard, R.string.encryption)); // DialogAction, Int, Icon, String
list.add(new DialogActionsListView.b.a(DialogAction.ENCRYPT_SETT, 3, R.attr.im_ic_more_vertical, R.string.encryption_sett)); // DialogAction, Int, Icon, String
}
@@ -145,13 +140,13 @@ public class DNRInjector {
actions.add(DialogAction.DOWNLOAD);
if (isDnrEnabledFor(peerId)) {
if (DNRModule.isDnrEnabledFor(peerId)) {
actions.add(DialogAction.DNR_OFF);
} else {
actions.add(DialogAction.DNR_ON);
}
if (isDntEnabledFor(peerId)) {
if (DNRModule.isDntEnabledFor(peerId)) {
actions.add(DialogAction.DNT_OFF);
} else {
actions.add(DialogAction.DNT_ON);
@@ -197,7 +192,7 @@ public class DNRInjector {
try {
new MessagesDownloader().downloadDialog(peerId, new HtmlDialogDownloaderFormatProvider(), out);
} catch (Exception e) {
sendToast(AndroidUtils.getString(R.string.download_dl_error));
AndroidUtils.sendToast(AndroidUtils.getString(R.string.download_dl_error));
e.printStackTrace();
}
return true;
@@ -321,14 +316,14 @@ public class DNRInjector {
var isTextExist = !text.isEmpty() && !text.equals(" ");
if (isTextExist) {
text = decryptMessage(text, peerId);
text = EncryptProvider.decryptMessage(text, peerId);
}
if (action == MsgAction.valueOf("TRANSLATE")) {
if (isTextExist) {
Translate.showTranslatedText(context, text);
} else {
sendToast(context.getString(R.string.translator_no_text));
AndroidUtils.sendToast(context.getString(R.string.translator_no_text));
}
}
}
@@ -340,7 +335,7 @@ public class DNRInjector {
Thread thread = new Thread(() -> {
try {
var request = new Request.a()
.b("https://" + getApi() + "/method/" + (needToBePinned ? "messages.pinConversation" : "messages.unpinConversation") + "?peer_id=" + dialogid + "&access_token=" + getUserToken() + "&v=5.119")
.b("https://" + ProxyUtils.getApi() + "/method/" + (needToBePinned ? "messages.pinConversation" : "messages.unpinConversation") + "?peer_id=" + dialogid + "&access_token=" + AccountManagerUtils.getUserToken() + "&v=5.119")
.a(Headers.a("User-Agent", Network.l.c().a(), "Content-Type", "application/x-www-form-urlencoded; charset=utf-8"))
.a();
@@ -357,7 +352,7 @@ public class DNRInjector {
thread.start();
sendToast(AndroidUtils.getString(R.string.pin_dialog) + " " + AndroidUtils.getString(needToBePinned ? R.string.dialog_pinned : R.string.dialog_unpinned));
AndroidUtils.sendToast(AndroidUtils.getString(R.string.pin_dialog) + " " + AndroidUtils.getString(needToBePinned ? R.string.dialog_pinned : R.string.dialog_unpinned));
}
public static void setDnr(Dialog dialog, boolean value) {
@@ -367,7 +362,7 @@ public class DNRInjector {
peerId = dialog.getId();
}
hookDNR(peerId);
DNRModule.hookDNR(peerId);
}
public static void setDnt(Dialog dialog, boolean value) {
@@ -377,7 +372,7 @@ public class DNRInjector {
peerId = dialog.getId();
}
hookDNT(peerId);
DNRModule.hookDNT(peerId);
}
}
@@ -1,35 +1,21 @@
package ru.vtosters.lite.dnr;
import static ru.vtosters.lite.net.Request.makeRequest;
import static ru.vtosters.lite.proxy.ProxyUtils.getApi;
import static ru.vtosters.lite.utils.AccountManagerUtils.getUserToken;
import android.content.Intent;
import android.net.Uri;
import android.os.MessageQueue;
import android.util.Log;
import com.vk.core.util.LangUtils;
import com.vk.im.engine.commands.messages.SetUserActivityCmd;
import com.vk.im.engine.models.dialogs.Dialog;
import com.vk.im.engine.models.messages.Msg;
import java.util.List;
import com.vk.im.ui.fragments.ChatFragment;
import com.vk.navigation.Navigator;
import com.vk.webapp.VkUiFragment;
import com.vtosters.lite.general.fragments.WebViewFragment;
import ru.vtosters.lite.dnr.helpers.DoNotReadDBHelper;
import ru.vtosters.lite.dnr.helpers.DoNotTypeDBHelper;
import ru.vtosters.lite.ssfs.Utils;
import ru.vtosters.lite.ui.fragments.VKUIwrapper;
import ru.vtosters.lite.ui.fragments.VTSettings;
import ru.vtosters.lite.net.Request;
import ru.vtosters.lite.proxy.ProxyUtils;
import ru.vtosters.lite.utils.AccountManagerUtils;
import ru.vtosters.lite.utils.AndroidUtils;
import ru.vtosters.lite.utils.LifecycleUtils;
import ru.vtosters.lite.utils.ThemesUtils;
import java.util.List;
public class DNRModule {
public static DoNotReadDBHelper mDoNotReadDBHelper = new DoNotReadDBHelper();
public static DoNotTypeDBHelper mDoNotTypeDBHelper = new DoNotTypeDBHelper();
@@ -68,13 +54,13 @@ public class DNRModule {
}
public static void hookRead(Dialog dialog) {
makeRequest("https://" + getApi() + "/method/messages.markAsRead?start_message_id=" + dialog.F1() + "&peer_id=" + dialog.getId() + "&v=5.119&access_token=" + getUserToken(), response -> {
Request.makeRequest("https://" + ProxyUtils.getApi() + "/method/messages.markAsRead?start_message_id=" + dialog.F1() + "&peer_id=" + dialog.getId() + "&v=5.119&access_token=" + AccountManagerUtils.getUserToken(), response -> {
});
}
public static void hookReadStartMsgTo(Msg dialog) {
Log.d("DNR", "hookReadStartMsgTo: " + dialog.C1() + " " + dialog.v1());
makeRequest("https://" + getApi() + "/method/messages.markAsRead?start_message_id=" + dialog.C1() + "&peer_id=" + dialog.v1() + "&v=5.119&access_token=" + getUserToken(), response -> {
Request.makeRequest("https://" + ProxyUtils.getApi() + "/method/messages.markAsRead?start_message_id=" + dialog.C1() + "&peer_id=" + dialog.v1() + "&v=5.119&access_token=" + AccountManagerUtils.getUserToken(), response -> {
});
}
@@ -1,16 +1,15 @@
package ru.vtosters.lite.dnr.helpers;
import static ru.vtosters.lite.utils.AndroidUtils.getGlobalContext;
import android.content.ContentValues;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import ru.vtosters.lite.dnr.DNRPrefs;
import java.util.ArrayList;
import java.util.List;
import ru.vtosters.lite.dnr.DNRPrefs;
import static ru.vtosters.lite.utils.AndroidUtils.getGlobalContext;
public class DoNotReadDBHelper extends SQLiteOpenHelper {
public DoNotReadDBHelper() {
@@ -1,20 +1,18 @@
package ru.vtosters.lite.dnr.helpers;
import static ru.vtosters.lite.utils.AndroidUtils.getGlobalContext;
import android.content.ContentValues;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import ru.vtosters.lite.dnr.DNRPrefs;
import ru.vtosters.lite.utils.AndroidUtils;
import java.util.ArrayList;
import java.util.List;
import ru.vtosters.lite.dnr.DNRPrefs;
public class DoNotTypeDBHelper extends SQLiteOpenHelper {
public DoNotTypeDBHelper() {
super(getGlobalContext(), "dnt", null, 1);
super(AndroidUtils.getGlobalContext(), "dnt", null, 1);
}
@Override
@@ -1,19 +1,11 @@
package ru.vtosters.lite.downloaders;
import static ru.vtosters.lite.utils.AndroidUtils.getString;
import android.os.Environment;
import bruhcollective.itaysonlab.libvkx.client.LibVKXClient;
import com.vk.core.util.ToastUtils;
import com.vk.dto.music.MusicTrack;
import com.vk.dto.music.Playlist;
import com.vtosters.lite.R;
import java.io.File;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import bruhcollective.itaysonlab.libvkx.client.LibVKXClient;
import ru.vtosters.lite.music.cache.CacheDatabaseDelegate;
import ru.vtosters.lite.music.cache.FileCacheImplementation;
import ru.vtosters.lite.music.callback.MusicCallbackBuilder;
@@ -26,6 +18,12 @@ import ru.vtosters.lite.utils.AccountManagerUtils;
import ru.vtosters.lite.utils.AndroidUtils;
import ru.vtosters.lite.utils.IOUtils;
import java.io.File;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import static ru.vtosters.lite.utils.AndroidUtils.getString;
/**
* Entrypoint for downloading audio
* <p>
@@ -8,17 +8,14 @@ import android.content.Intent;
import android.content.IntentFilter;
import android.net.Uri;
import android.os.Environment;
import androidx.core.content.FileProvider;
import com.vk.core.dialogs.alert.VkAlertDialog;
import com.vtosters.lite.R;
import java.io.File;
import ru.vtosters.lite.ui.activities.APKInstallActivity;
import ru.vtosters.lite.utils.AndroidUtils;
import java.io.File;
public class OTADownloader {
private static final BroadcastReceiver callback = new BroadcastReceiver() {
@@ -1,27 +1,23 @@
package ru.vtosters.lite.downloaders;
import static ru.vtosters.lite.downloaders.VideoDownloader.downloadVideo;
import static ru.vtosters.lite.utils.AndroidUtils.getGlobalContext;
import android.app.DownloadManager;
import android.content.Context;
import android.net.Uri;
import android.os.Environment;
import android.util.Log;
import com.vk.dto.common.ImageSize;
import com.vk.dto.stories.model.StoryEntry;
import org.json.JSONArray;
import java.util.List;
import static ru.vtosters.lite.downloaders.VideoDownloader.downloadVideo;
import static ru.vtosters.lite.utils.AndroidUtils.getGlobalContext;
public class StoryDownloader {
public static Runnable injectButton(StoryEntry story) {
return () -> downloadStory(story);
}
public static void downloadStory(StoryEntry story){
public static void downloadStory(StoryEntry story) {
if (story.T1()) {
List<ImageSize> imageSizes = story.E.Q.t1();
String url = imageSizes.get(imageSizes.size() - 1).url;
@@ -79,12 +79,12 @@ public class VideoDownloader {
qualities.add("720p");
urls.add(videoFile.h);
}
if (!TextUtils.isEmpty(videoFile.g)) {
qualities.add("480p");
urls.add(videoFile.g);
}
if (!TextUtils.isEmpty(videoFile.f)) {
qualities.add("360p");
urls.add(videoFile.f);
@@ -105,12 +105,12 @@ public class VideoDownloader {
finalContext,
android.R.layout.simple_list_item_1,
qualities.toArray(new String[0])) {
@Override
public View getView(int position, View convertView, ViewGroup parent) {
TextView textView = (TextView) super.getView(position, convertView, parent);
textView.setTextColor(getTextAttr());
return textView;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
TextView textView = (TextView) super.getView(position, convertView, parent);
textView.setTextColor(getTextAttr());
return textView;
}
};
new VkAlertDialog.Builder(finalContext)
@@ -90,7 +90,6 @@ public class Constants {
"}\n" +
".vtex-milk-msg.poll p { color: white; }\n" +
".vtex-milk-msg.poll hr { border-top: 1px; background: #ffffff; }\n" +
"\n" +
"";
"\n";
}
@@ -39,6 +39,7 @@ public class HtmlDialogDownloaderFormatProvider extends DialogDownloaderFormatPr
+ AndroidUtils.getString(R.string.chat_export_header)
+ " (" + date + ")</h5></div><div class=\"vtex-milk-msgcont\">";
}
@Override
public String provideMessage(MiniMsg message, MiniUser user) throws JSONException {
String isOut = (user.id == getUserId()) ? " vtex-milk-msg-out" : "";
@@ -64,8 +65,8 @@ public class HtmlDialogDownloaderFormatProvider extends DialogDownloaderFormatPr
return "<div class=\"vtex-milk-msg" + isOut + "\" id=\"" + message.id + "\">" +
"<p class=\"msg-from\">" + AndroidUtils.getString(R.string.from_lower)
+ " <a href=\"https://" + Constants.VK_DOMAIN + "/" + userLink + "\">" + user.firstName + " " + user.lastName
+ "</a> <span class=\"msg-from-date\">" + MessagesDownloader.formatTime(message.date) + "</span></p>" + // TODO photo100
+ " <a href=\"https://" + Constants.VK_DOMAIN + "/" + userLink + "\">" + user.firstName + " " + user.lastName
+ "</a> <span class=\"msg-from-date\">" + MessagesDownloader.formatTime(message.date) + "</span></p>" + // TODO photo100
"<p class=\"msg-body\">" + mentionsReplace(message.text) + "</p>" +
geoPosition +
chatAction +
@@ -30,7 +30,7 @@ import java.util.Iterator;
import java.util.List;
public class MessagesDownloader {
private static final int[] VIDEO_QUALITIES = { 144, 240, 360, 480, 720, 1080, 1440, 2160 };
private static final int[] VIDEO_QUALITIES = {144, 240, 360, 480, 720, 1080, 1440, 2160};
private static final SimpleDateFormat SDFORMAT = new SimpleDateFormat("EEE, d MMM yyyy HH:mm:ss", AndroidUtils.getResources().getConfiguration().locale);
@@ -111,7 +111,7 @@ public class MessagesDownloader {
VtOkHttpClient.getInstance().a(req).a(new Callback() {
@Override
public void a(Call call, IOException e) {
Log.d("MessagesDownloader", e+"");
Log.d("MessagesDownloader", String.valueOf(e));
}
@Override
@@ -8,6 +8,7 @@ import java.util.ArrayList;
import java.util.List;
import static ru.vtosters.lite.encryption.EncryptProvider.decryptMessage;
public class MiniMsg {
public long date;
public int fromId;
@@ -4,12 +4,9 @@ import android.app.Notification;
import android.app.NotificationChannel;
import android.app.NotificationManager;
import android.os.Build;
import androidx.annotation.RequiresApi;
import androidx.core.app.NotificationManagerCompat;
import com.vtosters.lite.R;
import ru.vtosters.lite.utils.AndroidUtils;
public class NotificationChannels {
@@ -1,27 +1,20 @@
package ru.vtosters.lite.encryption;
import static ru.vtosters.lite.hooks.MessagesHook.injectOwnText;
import static ru.vtosters.lite.hooks.MessagesHook.injectOwnTextAll;
import android.util.Log;
import android.util.Pair;
import com.vk.im.engine.models.messages.Msg;
import com.vk.im.engine.models.messages.MsgFromUser;
import com.vk.im.ui.components.msg_list.MsgListComponent;
import ru.vtosters.lite.encryption.base.IMProcessor;
import ru.vtosters.lite.encryption.processors.*;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.ArrayList;
import java.util.List;
import ru.vtosters.lite.encryption.base.IMProcessor;
import ru.vtosters.lite.encryption.processors.BeeCryptProcessor;
import ru.vtosters.lite.encryption.processors.DefaultCoffeeProcessor;
import ru.vtosters.lite.encryption.processors.DonateCoffeeProcessor;
import ru.vtosters.lite.encryption.processors.MP3InvisibleProcessor;
import ru.vtosters.lite.encryption.processors.VTostersAESProcessor;
import ru.vtosters.lite.encryption.processors.VTostersProcessor;
import static ru.vtosters.lite.hooks.MessagesHook.injectOwnText;
import static ru.vtosters.lite.hooks.MessagesHook.injectOwnTextAll;
public class EncryptProvider {
public static List<IMProcessor> processors = new ArrayList<>();
@@ -1,13 +1,11 @@
package ru.vtosters.lite.encryption.base;
import static ru.vtosters.lite.utils.Preferences.getBoolValue;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import ru.vtosters.lite.utils.AndroidUtils;
import ru.vtosters.lite.utils.Preferences;
import static ru.vtosters.lite.utils.Preferences.getBoolValue;
public abstract class IMProcessor {
// By default it checks start and end tag.
public boolean isEncrypted(String source) {
@@ -84,4 +82,8 @@ public abstract class IMProcessor {
public String getEncryptionKeyFor(int id) {
return Preferences.getPreferences().getString("VT_IMEncodeKey_" + getPrefKey() + "_" + id, null);
}
public void removeEncryptionKeyFor(int id) {
Preferences.getPreferences().edit().remove("VT_IMEncodeKey_" + getPrefKey() + "_" + id).apply();
}
}
@@ -1,14 +1,12 @@
package ru.vtosters.lite.encryption.processors;
import android.util.Base64;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import ru.vtosters.lite.encryption.base.IMProcessor;
import java.nio.charset.StandardCharsets;
import ru.vtosters.lite.encryption.base.IMProcessor;
public class BeeCryptProcessor extends IMProcessor {
private static final String BC_CHARSET = "жъЖЪ";
@@ -1,15 +1,13 @@
package ru.vtosters.lite.encryption.processors;
import android.util.Base64;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import ru.vtosters.lite.encryption.base.IMProcessor;
import javax.crypto.Cipher;
import javax.crypto.spec.SecretKeySpec;
import ru.vtosters.lite.encryption.base.IMProcessor;
public class DefaultCoffeeProcessor extends IMProcessor {
private final static String KEY = "stupidUsersMustD";
private static Cipher dCipher, eCipher;
@@ -1,14 +1,12 @@
package ru.vtosters.lite.encryption.processors;
import android.text.TextUtils;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import ru.vtosters.lite.encryption.base.IMProcessor;
import java.nio.charset.StandardCharsets;
import ru.vtosters.lite.encryption.base.IMProcessor;
public class MP3InvisibleProcessor extends IMProcessor {
private static String toStr(int a, String cc) {
StringBuilder s = new StringBuilder();
@@ -1,24 +1,20 @@
package ru.vtosters.lite.encryption.processors;
import android.util.Base64;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import java.nio.charset.StandardCharsets;
import java.security.InvalidAlgorithmParameterException;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;
import java.util.HashMap;
import ru.vtosters.lite.encryption.base.IMProcessor;
import ru.vtosters.lite.utils.Preferences;
import javax.crypto.Cipher;
import javax.crypto.NoSuchPaddingException;
import javax.crypto.spec.IvParameterSpec;
import javax.crypto.spec.SecretKeySpec;
import ru.vtosters.lite.encryption.base.IMProcessor;
import ru.vtosters.lite.utils.AndroidUtils;
import ru.vtosters.lite.utils.Preferences;
import java.nio.charset.StandardCharsets;
import java.security.InvalidAlgorithmParameterException;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;
import java.util.HashMap;
public class VTostersAESProcessor extends IMProcessor {
private final static String CIPHER_INSTANCE = "AES/CBC/PKCS7Padding";
@@ -1,10 +1,8 @@
package ru.vtosters.lite.encryption.processors;
import android.util.Base64;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import ru.vtosters.lite.encryption.base.IMProcessor;
public class VTostersProcessor extends IMProcessor {
@@ -0,0 +1,92 @@
package ru.vtosters.lite.feature.groupslist;
import android.util.Log;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import ru.vtosters.lite.utils.AndroidUtils;
import java.util.ArrayList;
public class GroupsCatalogInjector {
public static JSONObject injectIntoGetGroups(JSONObject jsonObject) {
var sections = jsonObject.optJSONObject("catalog").optJSONArray("sections");
if (sections == null) return jsonObject;
fixGroups(sections.optJSONObject(0));
return jsonObject;
}
public static void injectIntoCatalog(JSONObject jsonObject) {
var section = jsonObject.optJSONObject("section");
if (section == null) return; // early return if section is null
var blocks = section.optJSONArray("blocks");
if (blocks == null) return; // early return if blocks are null
var json = blocks.optJSONObject(1);
if (json == null) return; // early return if json is null
var data_type = json.optString("data_type");
if (!data_type.contains("groups")) return; // early return if data_type does not contain "groups"
fixGroups(section);
}
public static void fixGroups(JSONObject section) {
var blocks = section.optJSONArray("blocks");
if (blocks == null) return;
for (int i = 0; i < blocks.length(); i++) {
var currBlock = blocks.optJSONObject(i);
var badge = currBlock.optJSONObject("badge");
if (badge != null && badge.optString("type").equals("transparent")) {
addNewButton(currBlock, blocks.optJSONObject(i + 1));
break;
}
}
}
private static void addNewButton(JSONObject currBlock, JSONObject nextBlock) {
try {
var newButtons = new JSONArray();
var newButton = createNewButton(nextBlock);
newButtons.put(newButton);
currBlock.put("buttons", newButtons);
} catch (JSONException e) {
Log.d("CatalogButtonOpen", "Error: " + e);
}
}
private static JSONObject createNewButton(JSONObject nextBlock) throws JSONException {
var newButton = new JSONObject();
var type = new JSONObject();
type.put("type", "open_section");
newButton.put("action", type);
newButton.put("section_id", nextBlock.optString("id"));
newButton.put("title", AndroidUtils.getGlobalContext().getString(com.vtosters.lite.R.string.catalog_button_show_all));
newButton.put("ref_items_count", 30);
newButton.put("ref_layout_name", "list");
newButton.put("ref_data_type", "groups");
return newButton;
}
public static ArrayList<String> injectIntoJsonParser(JSONObject jsonObject, String str) {
JSONArray optJSONArray = jsonObject.optJSONArray(str);
if (optJSONArray != null) {
int length = optJSONArray.length();
ArrayList<String> arrayList = new ArrayList<>(length);
for (int i = 0; i < length; i++) {
String optString = optJSONArray.optString(i);
if (optString != null) {
arrayList.add(optString);
}
}
return arrayList;
}
return null;
}
}
@@ -1,31 +0,0 @@
package ru.vtosters.lite.feature.msgDelete;
import com.vk.im.ui.components.viewcontrollers.popup.DelegateMsg;
import kotlin.Unit;
import kotlin.jvm.b.Functions;
import kotlin.jvm.internal.Lambda;
import ru.vtosters.lite.utils.ReflectionUtils;
public final class DelegateMsg$showDeleteSubmit$builder$2 extends Lambda<Unit> implements Functions<Unit> {
final DelegateMsg this$0;
public DelegateMsg$showDeleteSubmit$builder$2(DelegateMsg delegateMsg) {
super(0);
this.this$0 = delegateMsg;
}
@Override
public Unit invoke() {
invoke2();
return Unit.a;
}
public final void invoke2() {
try {
var dialog = ReflectionUtils.findField(this$0, "a");
dialog.setAccessible(true);
dialog.set(this$0, null);
} catch (Exception ignored) { }
}
}
@@ -1,127 +0,0 @@
package ru.vtosters.lite.feature.msgDelete;
import android.content.Context;
import android.content.DialogInterface;
import androidx.appcompat.app.AlertDialog;
import com.vk.im.engine.models.messages.Msg;
import com.vk.im.ui.components.viewcontrollers.msg_list.MsgListVc;
import com.vk.im.ui.components.viewcontrollers.msg_list.MsgListVcCallback;
import com.vk.im.ui.components.viewcontrollers.popup.DelegateMsg;
import com.vk.im.ui.components.viewcontrollers.popup.PopupUtils;
import com.vk.im.ui.l;
import com.vk.im.ui.m;
import java.util.Collections;
import java.util.List;
import kotlin.Unit;
import kotlin.jvm.b.Functions;
import kotlin.jvm.b.Functions2;
import kotlin.jvm.internal.Lambda;
import kotlin.jvm.internal.Ref$BooleanRef;
import ru.vtosters.lite.utils.AndroidUtils;
public class MsgDeleteDialogHook {
// давайте представим что здесь нет никакого кода и это лишь страшный сон
public static AlertDialog.Builder getDialog(int i, boolean z, boolean z2, Functions2<Boolean, Unit> functions2, Context context, DelegateMsg delegateMsg) {
int i2;
if (z && i == 1) {
i2 = m.vkim_popup_msg_delete_submit_title_question_single;
} else if (z) {
i2 = m.vkim_popup_msg_delete_submit_title_question_many;
} else if (i == 1) {
i2 = m.vkim_popup_msg_delete_submit_title_default_single;
} else {
i2 = m.vkim_popup_msg_delete_submit_title_default_many;
}
var i3 = i2;
String string;
if (context != null) {
string = context.getString(m.vkim_popup_msg_delete_submit_checkbox_for_all);
} else {
string = AndroidUtils.getString(m.vkim_popup_msg_delete_submit_checkbox_for_all);
}
var stringArr = new String[]{string, "Эта галочка ничего не делает (совсем.)"};
var boolArr = new boolean[]{z2, false};
var boolRef = new Ref$BooleanRef();
boolRef.element = z & z2;
var dialogBuilder = PopupUtils.a(context, i3, "", 0, "", m.vkim_popup_msg_delete_submit_yes, "", m.vkim_popup_msg_delete_submit_cancel, "", false, new DelegateMsgShowDeleteSubmit(functions2, boolRef), null, null, new DelegateMsg$showDeleteSubmit$builder$2(delegateMsg));
if (z) {
dialogBuilder.setMultiChoiceItems(stringArr, boolArr, new ClickListener(boolRef));
} else {
var quantityStrring = context.getResources().getQuantityString(l.vkim_popup_msg_delete_submit_desc, i, i);
dialogBuilder.setMessage(quantityStrring);
}
return dialogBuilder;
}
public static class ClickListener implements DialogInterface.OnMultiChoiceClickListener {
final Ref$BooleanRef checkForAll;
public ClickListener(Ref$BooleanRef checkForAll) {
this.checkForAll = checkForAll;
}
@Override
public void onClick(DialogInterface dialog, int which, boolean isChecked) {
this.checkForAll.element = isChecked;
}
}
static class DelegateMsgShowDeleteSubmit extends Lambda<Unit> implements Functions<Unit> {
final Ref$BooleanRef checkForAll;
final Functions2<Boolean, Unit> onSubmitListener;
public DelegateMsgShowDeleteSubmit(Functions2<Boolean, Unit> onSubmitListener, Ref$BooleanRef checkForAll) {
super(0);
this.checkForAll = checkForAll;
this.onSubmitListener = onSubmitListener;
}
@Override
public Unit invoke() {
if (onSubmitListener != null) {
return onSubmitListener.invoke(checkForAll.element);
}
return Unit.a;
}
}
static class MsgListVcShowMsgDeleteSubmitDialog extends Lambda<Unit> implements Functions2<Boolean, Unit> {
final Functions<? extends Unit> $callback;
final Msg $msg;
final MsgListVc this$0;
public MsgListVcShowMsgDeleteSubmitDialog(MsgListVc msgListVc, Msg msg, Functions<? extends Unit> functions) {
super(1);
this.this$0 = msgListVc;
this.$msg = msg;
this.$callback = functions;
}
public final void a(boolean z) {
List<Msg> a;
MsgListVcCallback g = this.this$0.g();
if (g != null) {
a = Collections.singletonList($msg);
g.a(a, z);
}
Functions<? extends Unit> functions = this.$callback;
if (functions != null) {
Unit unit = functions.invoke();
}
}
@Override
public Unit invoke(Boolean bool) {
a(bool);
return Unit.a;
}
}
}
@@ -1,22 +1,19 @@
package ru.vtosters.lite.foaf;
import static android.widget.Toast.LENGTH_SHORT;
import static android.widget.Toast.makeText;
import static ru.vtosters.lite.proxy.ProxyUtils.getApi;
import static ru.vtosters.lite.proxy.ProxyUtils.isAnyProxyEnabled;
import static ru.vtosters.lite.utils.AndroidUtils.getGlobalContext;
import android.annotation.SuppressLint;
import android.app.ProgressDialog;
import android.content.Context;
import android.util.Log;
import com.vk.core.dialogs.alert.VkAlertDialog;
import com.vk.core.network.Network;
import com.vtosters.lite.R;
import okhttp3.Headers;
import okhttp3.OkHttpClient;
import org.json.JSONException;
import org.json.JSONObject;
import ru.vtosters.lite.di.singleton.VtOkHttpClient;
import ru.vtosters.lite.net.Request;
import ru.vtosters.lite.utils.LifecycleUtils;
import java.io.IOException;
import java.text.ParseException;
@@ -29,11 +26,11 @@ import java.util.concurrent.TimeUnit;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import okhttp3.Headers;
import okhttp3.OkHttpClient;
import ru.vtosters.lite.di.singleton.VtOkHttpClient;
import ru.vtosters.lite.net.Request;
import ru.vtosters.lite.utils.LifecycleUtils;
import static android.widget.Toast.LENGTH_SHORT;
import static android.widget.Toast.makeText;
import static ru.vtosters.lite.proxy.ProxyUtils.getApi;
import static ru.vtosters.lite.proxy.ProxyUtils.isAnyProxyEnabled;
import static ru.vtosters.lite.utils.AndroidUtils.getGlobalContext;
public class FoafBase {
private static final Pattern FOAF_REGEX = Pattern.compile("<ya:created dc:date=\"(.+?)\"");
@@ -1,28 +1,16 @@
package ru.vtosters.lite.hooks;
import static ru.vtosters.lite.utils.NewsFeedFiltersUtils.checkCaption;
import static ru.vtosters.lite.utils.NewsFeedFiltersUtils.checkCopyright;
import static ru.vtosters.lite.utils.NewsFeedFiltersUtils.isBadNews;
import static ru.vtosters.lite.utils.Preferences.ads;
import static ru.vtosters.lite.utils.Preferences.adsgroup;
import static ru.vtosters.lite.utils.Preferences.adsstories;
import static ru.vtosters.lite.utils.Preferences.authorsrecomm;
import static ru.vtosters.lite.utils.Preferences.dev;
import static ru.vtosters.lite.utils.Preferences.friendsrecomm;
import static ru.vtosters.lite.utils.Preferences.getBoolValue;
import static ru.vtosters.lite.utils.Preferences.postsrecomm;
import android.util.Log;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import ru.vtosters.lite.utils.NewsFeedFiltersUtils;
import ru.vtosters.lite.utils.Preferences;
import java.util.Collections;
import ru.vtosters.lite.utils.AndroidUtils;
import ru.vtosters.lite.utils.NewsFeedFiltersUtils;
import ru.vtosters.lite.utils.Preferences;
import static ru.vtosters.lite.utils.NewsFeedFiltersUtils.*;
import static ru.vtosters.lite.utils.Preferences.*;
public class AdBlockHook {
public static Boolean discoverAdBlock(JSONObject jsonObject) {
@@ -267,7 +255,8 @@ public class AdBlockHook {
newStories.put(story);
}
} else {
if (dev()) Log.d("StoriesAds", "Fetched ad, owner id " + story.optString("owner_id") + ", caption " + story.optString("caption"));
if (dev())
Log.d("StoriesAds", "Fetched ad, owner id " + story.optString("owner_id") + ", caption " + story.optString("caption"));
}
}
@@ -315,7 +304,7 @@ public class AdBlockHook {
return json;
}
public static Boolean isAds(JSONObject list, String type) throws JSONException {
public static Boolean isAds(JSONObject list, String type) {
if (list == null || type == null || !ads()) return false;
if (list.has("ads")
@@ -1,9 +1,9 @@
package ru.vtosters.lite.hooks;
import static ru.vtosters.lite.utils.Preferences.getBoolValue;
import b.h.g.g.BuildInfo;
import static ru.vtosters.lite.utils.Preferences.getBoolValue;
public class AppVerHook {
public static int appBuild() {
return getBoolValue("useOldAppVer", false) ? 6561 : BuildInfo.i.e();
@@ -3,7 +3,7 @@ package ru.vtosters.lite.hooks;
import static ru.vtosters.lite.utils.Preferences.getBoolValue;
public class BusinessNotifHook {
public static boolean hook(boolean i){
public static boolean hook(boolean i) {
return !getBoolValue("businessDisabler", false) && i;
}
}
@@ -1,11 +1,5 @@
package ru.vtosters.lite.hooks;
import static ru.vtosters.lite.dnr.DNRInjector.forceInvalidateDialogActions;
import static ru.vtosters.lite.utils.AndroidUtils.dp2px;
import static ru.vtosters.lite.utils.AndroidUtils.sendToast;
import static ru.vtosters.lite.utils.LifecycleUtils.getCurrentActivity;
import static ru.vtosters.lite.utils.ThemesUtils.getSTextAttr;
import android.app.Activity;
import android.content.Context;
import android.content.res.ColorStateList;
@@ -13,17 +7,21 @@ import android.text.Editable;
import android.view.ViewGroup;
import android.widget.EditText;
import android.widget.LinearLayout;
import com.vk.core.dialogs.alert.VkAlertDialog;
import com.vk.im.engine.models.dialogs.Dialog;
import com.vtosters.lite.R;
import ru.vtosters.lite.encryption.EncryptProvider;
import ru.vtosters.lite.encryption.base.IMProcessor;
import ru.vtosters.lite.utils.AndroidUtils;
import java.util.List;
import java.util.Objects;
import ru.vtosters.lite.encryption.EncryptProvider;
import ru.vtosters.lite.encryption.base.IMProcessor;
import ru.vtosters.lite.utils.AndroidUtils;
import static ru.vtosters.lite.dnr.DNRInjector.forceInvalidateDialogActions;
import static ru.vtosters.lite.utils.AndroidUtils.dp2px;
import static ru.vtosters.lite.utils.AndroidUtils.sendToast;
import static ru.vtosters.lite.utils.LifecycleUtils.getCurrentActivity;
import static ru.vtosters.lite.utils.ThemesUtils.getSTextAttr;
public class CryptImHook {
public static boolean isPrivateProcessor(int peerID) {
@@ -100,7 +98,7 @@ public class CryptImHook {
key = enabled.getEncryptionKeyFor(peerId);
}
if (key.equals("VTAesDefault")) {
if (Objects.equals(key, "VTAesDefault")) {
key = null;
}
@@ -128,6 +126,9 @@ public class CryptImHook {
Editable edit = editText.getText();
finalEnabled.setEncryptionKeyFor(peerId, edit == null ? null : edit.toString());
}).setNegativeButton(android.R.string.cancel, null)
.setNeutralButton(AndroidUtils.getString("remove_encryption_key"), (dialog, which) -> {
finalEnabled.removeEncryptionKeyFor(peerId);
})
.show();
}
}
@@ -1,17 +1,15 @@
package ru.vtosters.lite.hooks;
import static ru.vtosters.lite.utils.Preferences.getString;
import static ru.vtosters.lite.utils.AndroidUtils.getStringDate;
import android.annotation.SuppressLint;
import com.vtosters.lite.R;
import ru.vtosters.lite.utils.AndroidUtils;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;
import ru.vtosters.lite.utils.AndroidUtils;
import static ru.vtosters.lite.utils.AndroidUtils.getStringDate;
import static ru.vtosters.lite.utils.Preferences.getString;
public class DateHook {
public static boolean fulltime() {
@@ -1,14 +1,14 @@
package ru.vtosters.lite.hooks;
import static ru.vtosters.lite.utils.AndroidUtils.MD5;
import static ru.vtosters.lite.utils.AndroidUtils.getGlobalContext;
import static ru.vtosters.lite.utils.Preferences.getBoolValue;
import android.annotation.SuppressLint;
import android.os.Build;
import android.provider.Settings;
import android.util.Log;
import static ru.vtosters.lite.utils.AndroidUtils.MD5;
import static ru.vtosters.lite.utils.AndroidUtils.getGlobalContext;
import static ru.vtosters.lite.utils.Preferences.getBoolValue;
public class DeviceInfoHook {
public static String getDeviceInfo(String input) {
Log.d("DeviceInfoHook", "getDeviceInfo: " + input);
@@ -40,7 +40,7 @@ public class DeviceInfoHook {
}
@SuppressLint("HardwareIds")
private static String findDeviceId() {
return Settings.Secure.getString(getGlobalContext().getContentResolver(), "android_id");
public static String findDeviceId() {
return Settings.Secure.getString(getGlobalContext().getContentResolver(), Settings.Secure.ANDROID_ID);
}
}
@@ -1,34 +1,9 @@
package ru.vtosters.lite.hooks;
import static com.vtosters.lite.R.id.menu_fave;
import static com.vtosters.lite.R.id.menu_feedback;
import static com.vtosters.lite.R.id.menu_friends;
import static com.vtosters.lite.R.id.menu_games;
import static com.vtosters.lite.R.id.menu_groups;
import static com.vtosters.lite.R.id.menu_messages;
import static com.vtosters.lite.R.id.menu_newsfeed;
import static com.vtosters.lite.R.id.menu_photos;
import static com.vtosters.lite.R.id.menu_search;
import static com.vtosters.lite.R.id.menu_videos;
import static com.vtosters.lite.R.id.menu_vk_pay;
import static com.vtosters.lite.R.id.tab_discover;
import static com.vtosters.lite.R.id.tab_feedback;
import static com.vtosters.lite.R.id.tab_menu;
import static com.vtosters.lite.R.id.tab_messages;
import static com.vtosters.lite.R.id.tab_news;
import static ru.vtosters.lite.utils.AndroidUtils.getGlobalContext;
import static ru.vtosters.lite.utils.AndroidUtils.getResources;
import static ru.vtosters.lite.utils.Preferences.dockcounter;
import static ru.vtosters.lite.utils.Preferences.getBoolValue;
import static ru.vtosters.lite.utils.Preferences.milkshake;
import static ru.vtosters.lite.utils.ThemesUtils.getCSTDock;
import android.annotation.SuppressLint;
import android.graphics.drawable.Drawable;
import android.view.Menu;
import android.view.MenuItem;
import android.view.ViewGroup;
import com.vk.apps.AppsFragment;
import com.vk.core.drawable.RecoloredDrawable;
import com.vk.core.fragments.FragmentImpl;
@@ -37,22 +12,22 @@ import com.vk.navigation.right.RightMenu;
import com.vtosters.lite.MenuCountersState;
import com.vtosters.lite.ui.bottomnavigation.BottomNavigationMenuView;
import com.vtosters.lite.ui.bottomnavigation.BottomNavigationView;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import ru.vtosters.lite.ui.components.DockBarEditorManager;
import ru.vtosters.lite.ui.items.DockBarTab;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
import ru.vtosters.lite.ui.components.DockBarEditorManager;
import ru.vtosters.lite.ui.items.DockBarTab;
import static com.vtosters.lite.R.id.*;
import static ru.vtosters.lite.utils.AndroidUtils.getGlobalContext;
import static ru.vtosters.lite.utils.AndroidUtils.getResources;
import static ru.vtosters.lite.utils.Preferences.*;
import static ru.vtosters.lite.utils.ThemesUtils.getCSTDock;
public class DockBarInjector {
private static final DockBarEditorManager sManager = DockBarEditorManager.getInstance();
@@ -83,7 +58,7 @@ public class DockBarInjector {
}
} catch (NoSuchFieldException | IllegalAccessException | ClassNotFoundException |
NoSuchMethodException | InvocationTargetException e) {
NoSuchMethodException | InvocationTargetException e) {
e.printStackTrace();
}
@@ -1,10 +1,10 @@
package ru.vtosters.lite.hooks;
import androidx.fragment.app.FragmentTransaction;
import static ru.vtosters.lite.ui.components.FragAnimationKit.setAnimations;
import static ru.vtosters.lite.utils.Preferences.getString;
import androidx.fragment.app.FragmentTransaction;
public class FragAnimationHook {
public static boolean animateOpen(FragmentTransaction transaction) {
setAnimations(transaction);
@@ -1,23 +1,13 @@
package ru.vtosters.lite.hooks;
import static ru.vtosters.lite.utils.Preferences.isValidSignature;
import android.os.Build;
import android.util.Base64;
import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStreamReader;
import javax.net.ssl.HttpsURLConnection;
import java.io.*;
import java.net.URL;
import java.nio.charset.StandardCharsets;
import java.security.KeyPair;
import java.security.KeyPairGenerator;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.security.PrivateKey;
import java.security.Signature;
import java.security.*;
import java.security.interfaces.RSAPrivateKey;
import java.util.ArrayList;
import java.util.Arrays;
@@ -25,7 +15,7 @@ import java.util.List;
import java.util.Random;
import java.util.concurrent.atomic.AtomicBoolean;
import javax.net.ssl.HttpsURLConnection;
import static ru.vtosters.lite.utils.Preferences.isValidSignature;
public class GcmHook {
@@ -6,7 +6,6 @@ import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import ru.vtosters.lite.utils.AccountManagerUtils;
import ru.vtosters.lite.utils.AndroidUtils;
import ru.vtosters.lite.utils.Preferences;
import java.io.IOException;
@@ -8,6 +8,7 @@ import com.vk.core.dialogs.alert.VkAlertDialog;
import com.vtosters.lite.R;
import ru.vtosters.lite.concurrent.VTExecutors;
import ru.vtosters.lite.downloaders.notifications.NotificationChannels;
import ru.vtosters.lite.hooks.ui.SystemThemeChangerHook;
import ru.vtosters.lite.ssfs.UsersList;
import ru.vtosters.lite.themes.ThemesManager;
import ru.vtosters.lite.ui.dialogs.DisableBattery;
@@ -20,11 +21,10 @@ import static ru.vtosters.lite.ui.dialogs.ServerDialog.sendRequest;
import static ru.vtosters.lite.utils.CacheUtils.getInstance;
import static ru.vtosters.lite.utils.NewsFeedFiltersUtils.setupFilters;
import static ru.vtosters.lite.utils.Preferences.checkupdates;
import static ru.vtosters.lite.utils.ThemesUtils.setNeededTheme;
public class MainActivityInjector {
public static void inject(Activity activity) {
setNeededTheme(activity);
SystemThemeChangerHook.themeOnStart(activity);
sendRequest();
UsersList.getUsersList();
@@ -40,14 +40,14 @@ public class MainActivityInjector {
NotificationChannels.createChannels();
}
if(Preferences.isNewBuild() && !ThemesUtils.isMonetTheme() && ThemesManager.canApplyCustomAccent()) {
if (Preferences.isNewBuild() && !ThemesUtils.isMonetTheme() && ThemesManager.canApplyCustomAccent() && ThemesUtils.useNewColorEngine()) {
Preferences.updateBuildNumber();
updateBinsAndTmpArchive(activity);
}
VTExecutors.getIoScheduler().a(DeletedMessagesHandler::reloadMessagesList); // ioScheduler
if(activity.getIntent().getAction() != null && Intent.ACTION_APPLICATION_PREFERENCES.equals(activity.getIntent().getAction())) {
if (activity.getIntent().getAction() != null && Intent.ACTION_APPLICATION_PREFERENCES.equals(activity.getIntent().getAction())) {
NavigatorUtils.switchToSettings(activity);
return;
}
@@ -57,24 +57,24 @@ public class MainActivityInjector {
DisableBattery.alert(activity);
// VKIDProtection.alert(activity);
}
private static void updateBinsAndTmpArchive(Activity activity) {
final VKProgressDialog dialog = new VKProgressDialog(activity);
dialog.setMessage("Применение акцента");
dialog.setMessage(AndroidUtils.getString("applying_accent"));
dialog.show();
VTExecutors.getIoExecutor().execute(() -> {
try {
ThemesManager.generateModApk(ThemesUtils.getReservedAccent());
activity.runOnUiThread(LifecycleUtils::restartApplication);
} catch(Throwable e) {
} catch (Throwable e) {
e.printStackTrace();
activity.runOnUiThread(() -> {
dialog.cancel();
new VkAlertDialog.Builder(activity)
.setTitle("Ошикба")
.setMessage("Ошибка при применении акцента:\n" + e)
.setTitle(activity.getString(R.string.error))
.setMessage(AndroidUtils.getString("error_applying_accent") + ":\n" + e)
.setPositiveButton(R.string.ok, null)
.show();
});
@@ -1,23 +1,19 @@
package ru.vtosters.lite.hooks;
import static ru.vtosters.lite.ui.dialogs.MessageSettings.bombCount;
import static ru.vtosters.lite.ui.dialogs.MessageSettings.isSilentEnabled;
import static ru.vtosters.lite.utils.Preferences.autoalltranslate;
import static ru.vtosters.lite.utils.Preferences.autotranslate;
import static ru.vtosters.lite.utils.Preferences.savemsgsett;
import android.content.Context;
import android.text.TextUtils;
import android.view.View;
import com.vk.api.internal.MethodCall;
import ru.vtosters.lite.translators.BaseTranslator;
import ru.vtosters.lite.ui.dialogs.MessageSettings;
import ru.vtosters.lite.utils.LifecycleUtils;
import java.util.ArrayList;
import java.util.regex.Pattern;
import ru.vtosters.lite.translators.BaseTranslator;
import ru.vtosters.lite.ui.dialogs.MessageSettings;
import ru.vtosters.lite.utils.LifecycleUtils;
import static ru.vtosters.lite.ui.dialogs.MessageSettings.bombCount;
import static ru.vtosters.lite.ui.dialogs.MessageSettings.isSilentEnabled;
import static ru.vtosters.lite.utils.Preferences.*;
public class MessagesHook {
public static String injectOwnText(String oldText) {
@@ -46,7 +42,7 @@ public class MessagesHook {
var mentions = new ArrayList<String>();
while (matcher.find()) {
mentions.add(matcher.group());
matcher.appendReplacement(textBuff, "vtl_mention" + mentionsCount + "");
matcher.appendReplacement(textBuff, "vtl_mention" + mentionsCount);
++mentionsCount;
}
matcher.appendTail(textBuff);
@@ -1,29 +1,20 @@
package ru.vtosters.lite.hooks;
import static java.lang.Long.MAX_VALUE;
import static ru.vtosters.lite.utils.AndroidUtils.getGlobalContext;
import static ru.vtosters.lite.utils.Preferences.getString;
import static ru.vtosters.lite.utils.Preferences.ads;
import static ru.vtosters.lite.utils.Preferences.authorsrecomm;
import static ru.vtosters.lite.utils.Preferences.friendsrecomm;
import static ru.vtosters.lite.utils.Preferences.getBoolValue;
import static ru.vtosters.lite.utils.Preferences.vkme;
import android.content.Context;
import android.os.PowerManager;
import androidx.recyclerview.widget.RecyclerView;
import com.vk.core.preference.Preference;
import com.vk.discover.DiscoverItemDecorator;
import com.vtosters.lite.api.ExtendedCommunityProfile;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
import java.util.LinkedHashSet;
import java.util.List;
import ru.vtosters.lite.utils.AccountManagerUtils;
import ru.vtosters.lite.utils.Preferences;
import java.util.*;
import static java.lang.Long.MAX_VALUE;
import static ru.vtosters.lite.utils.AndroidUtils.getGlobalContext;
import static ru.vtosters.lite.utils.Preferences.*;
public class NewsfeedHook {
public static long getUpdateNewsfeed(boolean refresh_timeout) {
if (vkme()) {
@@ -37,6 +28,24 @@ public class NewsfeedHook {
};
}
public static boolean samsungFixRem(RecyclerView recyclerView, DiscoverItemDecorator discoverItemDecorator) {
if (!recyclerView.isComputingLayout() && recyclerView.getScrollState() == RecyclerView.SCROLL_STATE_IDLE) {
recyclerView.removeItemDecoration(discoverItemDecorator);
return true;
}
return false;
}
public static boolean samsungFixAdd(RecyclerView recyclerView, DiscoverItemDecorator discoverItemDecorator) {
if (!recyclerView.isComputingLayout() && recyclerView.getScrollState() == RecyclerView.SCROLL_STATE_IDLE) {
recyclerView.addItemDecoration(discoverItemDecorator);
return true;
}
return false;
}
public static List hideElement(ArrayList list) {
if (!getBoolValue("whatsnew", true)) {
list.clear();
@@ -1,27 +1,22 @@
package ru.vtosters.lite.hooks;
import android.util.Log;
import com.vtosters.lite.R;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import ru.vtosters.lite.utils.AndroidUtils;
import java.io.IOException;
import java.text.ParseException;
import static ru.vtosters.lite.hooks.JsonInjectors.setOnlineInfo;
import static ru.vtosters.lite.hooks.JsonInjectors.setOnlineInfoUsers;
import static ru.vtosters.lite.net.Request.makeRequest;
import static ru.vtosters.lite.proxy.ProxyUtils.getApi;
import static ru.vtosters.lite.utils.AccountManagerUtils.getUserToken;
import static ru.vtosters.lite.utils.AndroidUtils.sendToast;
import static ru.vtosters.lite.utils.Preferences.dev;
import static ru.vtosters.lite.utils.Preferences.getBoolValue;
import static ru.vtosters.lite.utils.Preferences.getPrefsFromFile;
import android.util.Log;
import com.vtosters.lite.R;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.IOException;
import java.text.ParseException;
import ru.vtosters.lite.utils.AndroidUtils;
import static ru.vtosters.lite.utils.Preferences.*;
public class OnlineFormatterHook {
private static String AppName;
@@ -226,7 +226,7 @@ public class PhotoViewer {
client.a(request).a(new Callback() {
@Override
public void a(Call call, IOException e) {
Log.d("PhotoViewer", e + "");
Log.d("PhotoViewer", String.valueOf(e));
}
@Override
@@ -1,14 +1,13 @@
package ru.vtosters.lite.hooks;
import static ru.vtosters.lite.utils.Preferences.getBoolValue;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import com.vk.dto.polls.PollOption;
import com.vk.polls.ui.views.PollOptionView;
import static ru.vtosters.lite.utils.Preferences.getBoolValue;
public class PollHook {
public static void show(PollOptionView view) {
if (!getBoolValue("pollresults", false)) return;
@@ -3,12 +3,9 @@ package ru.vtosters.lite.hooks;
import android.view.View;
import android.view.ViewGroup;
import android.widget.RelativeLayout;
import androidx.recyclerview.widget.RecyclerView;
import com.vk.newsfeed.holders.BaseFooterHolder;
import com.vtosters.lite.R;
import ru.vtosters.lite.utils.Preferences;
public class PostViewHook {
@@ -10,7 +10,9 @@ import androidx.appcompat.view.ContextThemeWrapper;
import com.vk.auth.ui.VkAuthTextView;
import com.vk.core.dialogs.alert.VkAlertDialog;
import com.vtosters.lite.R;
import ru.vtosters.lite.ui.fragments.DataSettingsFragment;
import ru.vtosters.lite.ui.fragments.ProxySettingsFragment;
import ru.vtosters.lite.utils.AndroidUtils;
import ru.vtosters.lite.utils.NavigatorUtils;
import ru.vtosters.lite.utils.Preferences;
@@ -21,9 +23,13 @@ import static ru.vtosters.lite.utils.ThemesUtils.getTextAttr;
public class ProxyHook {
public static void hookAuth(View v) {
VkAuthTextView button = (VkAuthTextView) v;
VkAuthTextView button = v.findViewById(AndroidUtils.getIdentifier("already_have_account", "id"));
button.setText(R.string.proxy_setup);
button.setOnClickListener(v1 -> callProxyDialog(v1.getContext()));
VkAuthTextView recoverAccounts = v.findViewById(AndroidUtils.getIdentifier("account_backup_view", "id"));
recoverAccounts.setText(AndroidUtils.getString("restore_accounts"));
recoverAccounts.setOnClickListener(v1 -> NavigatorUtils.switchFragment(v.getContext(), DataSettingsFragment.class));
}
@SuppressLint("SetTextI18n")
@@ -1,12 +1,12 @@
package ru.vtosters.lite.hooks;
import static ru.vtosters.lite.encryption.EncryptProvider.decryptMessage;
import com.vk.im.engine.models.ProfilesSimpleInfo;
import com.vk.im.engine.models.messages.MsgFromUser;
import com.vk.im.engine.models.messages.NestedMsg;
import com.vk.im.ui.views.ReplyView;
import static ru.vtosters.lite.encryption.EncryptProvider.decryptMessage;
public class ReplyMsgHook {
public static void injectWithDecrypt(ReplyView replyView, MsgFromUser msgFromUser, ProfilesSimpleInfo profilesSimpleInfo, boolean someBool) {
msgFromUser.d(decryptMessage(msgFromUser)); // set new value of text in MsgFromUser class
@@ -1,13 +1,12 @@
package ru.vtosters.lite.hooks;
import static ru.vtosters.lite.utils.Preferences.dev;
import android.util.Log;
import com.vk.api.internal.MethodCall;
import java.util.LinkedHashMap;
import static ru.vtosters.lite.utils.Preferences.dev;
public class RequestDumper {
public static void addParams(MethodCall.a paramslist, String method, LinkedHashMap<String, String> params, String apiver) {
if (method.contains("execute.getGiftByStickerId")) {
@@ -1,12 +1,5 @@
package ru.vtosters.lite.hooks;
import static ru.vtosters.lite.ui.components.DockBarEditorManager.getInstance;
import static ru.vtosters.lite.utils.Preferences.getString;
import static ru.vtosters.lite.utils.Preferences.milkshake;
import static ru.vtosters.lite.utils.Preferences.superapp;
import static ru.vtosters.lite.utils.Preferences.useNewSettings;
import static ru.vtosters.lite.utils.Preferences.vkme;
import com.vk.apps.AppsFragment;
import com.vk.discover.DiscoverFragment;
import com.vk.fave.fragments.FaveTabFragment;
@@ -30,6 +23,9 @@ import com.vtosters.lite.fragments.y2.VideoCatalogFragment;
import com.vtosters.lite.general.fragments.GamesFragment;
import com.vtosters.lite.general.fragments.PhotosFragment;
import static ru.vtosters.lite.ui.components.DockBarEditorManager.getInstance;
import static ru.vtosters.lite.utils.Preferences.*;
public class StartFragmentHook {
public static Class getStartFragment() {
if (vkme()) {
@@ -1,5 +1,6 @@
package ru.vtosters.lite.hooks;
import android.content.Context;
import android.content.res.ColorStateList;
import android.graphics.drawable.Drawable;
import android.widget.CompoundButton;
@@ -8,46 +9,50 @@ import androidx.appcompat.widget.SwitchCompat;
import androidx.core.content.ContextCompat;
import androidx.core.graphics.drawable.DrawableCompat;
import androidx.core.widget.CompoundButtonCompat;
import com.vk.core.ui.themes.VKThemeHelper;
import com.vk.core.util.ColorUtils;
import ru.vtosters.lite.utils.AndroidUtils;
import ru.vtosters.lite.utils.Preferences;
import ru.vtosters.lite.utils.ThemesUtils;
import static com.vk.core.ui.themes.VKThemeHelper.r;
import static com.vtosters.lite.R.color.*;
public class SwitchHook {
private static final int[] SWITCH_COLORS = {
getSwitchColor(),
getDisabledSwitchColor(),
ContextCompat.getColor(VKThemeHelper.u(), gray_20),
ThemesUtils.getAccentColor()
};
private static final int[] TRACK_COLORS = {
ColorUtils.b(ThemesUtils.getColorFromAttr(com.vtosters.lite.R.attr.loader_track_fill), 0.4f),
ColorUtils.b(ThemesUtils.getAccentColor(), 0.12f),
ThemesUtils.getColorFromAttr(com.vtosters.lite.R.attr.loader_track_fill),
ColorUtils.b(ThemesUtils.getAccentColor(), 0.48f)
};
private static int[] getSwitchColors(Context ctx) {
return new int[]{
ContextCompat.getColor(ctx, ThemesUtils.isDarkTheme() ? gray_800 : white),
ContextCompat.getColor(ctx, ThemesUtils.isDarkTheme() ? switch_disabled_on_dark : switch_disabled_on_light),
ContextCompat.getColor(ctx, gray_20),
ThemesUtils.getAccentColor()
};
}
public static void setSwitchCompatColors(SwitchCompat switchCompat) {
if (Preferences.getBoolValue("useCustomPrefsStyle", false)) {
switchCompat.setThumbDrawable(setTintList(getCustomThumb(), new ColorStateList(createTrackColorStateList(), SWITCH_COLORS)));
switchCompat.setTrackDrawable(setTintList(getCustomTrack(), new ColorStateList(createTrackColorStateList(), TRACK_COLORS)));
private static int[] getTrackColors() {
return new int[]{
ColorUtils.b(ThemesUtils.getColorFromAttr(com.vtosters.lite.R.attr.loader_track_fill), 0.4f),
ColorUtils.b(ThemesUtils.getAccentColor(), 0.12f),
ThemesUtils.getColorFromAttr(com.vtosters.lite.R.attr.loader_track_fill),
ColorUtils.b(ThemesUtils.getAccentColor(), 0.48f)
};
}
public static void setSwitchCompatColors(SwitchCompat switchCompat, Context ctx) {
if (Preferences.getBoolValue("useCustomPrefsStyle", true)) {
switchCompat.setThumbDrawable(setTintList(getCustomThumb(), new ColorStateList(createColorStateList(), getSwitchColors(ctx))));
switchCompat.setTrackDrawable(setTintList(getCustomTrack(), new ColorStateList(createColorStateList(), getTrackColors())));
} else {
setTintList(switchCompat.getThumbDrawable(), new ColorStateList(createTrackColorStateList(), SWITCH_COLORS));
setTintList(switchCompat.getTrackDrawable(), new ColorStateList(createTrackColorStateList(), TRACK_COLORS));
setTintList(switchCompat.getThumbDrawable(), new ColorStateList(createColorStateList(), getSwitchColors(ctx)));
setTintList(switchCompat.getTrackDrawable(), new ColorStateList(createColorStateList(), getTrackColors()));
}
}
public static void setSwitchColors(Switch drawableCompat) {
if (Preferences.getBoolValue("useCustomPrefsStyle", false)) {
drawableCompat.setThumbDrawable(setTintList(getCustomThumb(), new ColorStateList(createTrackColorStateList(), SWITCH_COLORS)));
drawableCompat.setTrackDrawable(setTintList(getCustomTrack(), new ColorStateList(createTrackColorStateList(), TRACK_COLORS)));
public static void setSwitchColors(Switch drawableCompat, Context ctx) {
if (Preferences.getBoolValue("useCustomPrefsStyle", true)) {
drawableCompat.setThumbDrawable(setTintList(getCustomThumb(), new ColorStateList(createColorStateList(), getSwitchColors(ctx))));
drawableCompat.setTrackDrawable(setTintList(getCustomTrack(), new ColorStateList(createColorStateList(), getTrackColors())));
} else {
setTintList(drawableCompat.getThumbDrawable(), new ColorStateList(createTrackColorStateList(), SWITCH_COLORS));
setTintList(drawableCompat.getTrackDrawable(), new ColorStateList(createTrackColorStateList(), TRACK_COLORS));
setTintList(drawableCompat.getThumbDrawable(), new ColorStateList(createColorStateList(), getSwitchColors(ctx)));
setTintList(drawableCompat.getTrackDrawable(), new ColorStateList(createColorStateList(), getTrackColors()));
}
}
@@ -55,15 +60,15 @@ public class SwitchHook {
CompoundButtonCompat.setButtonTintList(
compoundButton,
new ColorStateList(
createTrackColorStateList(),
new int[]{
ColorUtils.b(ThemesUtils.getColorFromAttr(com.vtosters.lite.R.attr.selection_off_icon), 0.4f),
ColorUtils.b(ThemesUtils.getAccentColor(), 0.4f),
ThemesUtils.getColorFromAttr(com.vtosters.lite.R.attr.selection_off_icon),
ThemesUtils.getAccentColor()}));
createColorStateList(),
new int[]{
ColorUtils.b(ThemesUtils.getColorFromAttr(com.vtosters.lite.R.attr.selection_off_icon), 0.4f),
ColorUtils.b(ThemesUtils.getAccentColor(), 0.4f),
ThemesUtils.getColorFromAttr(com.vtosters.lite.R.attr.selection_off_icon),
ThemesUtils.getAccentColor()}));
}
private static int[][] createTrackColorStateList() {
private static int[][] createColorStateList() {
return new int[][]{
new int[]{-android.R.attr.state_enabled, -android.R.attr.state_checked},
new int[]{-android.R.attr.state_enabled, android.R.attr.state_checked},
@@ -78,10 +83,6 @@ public class SwitchHook {
return wrappedDrawable;
}
private static int getSwitchColor() {
return ContextCompat.getColor(VKThemeHelper.u(), r() ? gray_800 : white);
}
private static Drawable getCustomTrack() {
return AndroidUtils.getGlobalContext().getDrawable(AndroidUtils.getIdentifier("custom_track_selector", "drawable"));
}
@@ -89,8 +90,4 @@ public class SwitchHook {
private static Drawable getCustomThumb() {
return AndroidUtils.getGlobalContext().getDrawable(AndroidUtils.getIdentifier("custom_thumb_selector", "drawable"));
}
private static int getDisabledSwitchColor() {
return ContextCompat.getColor(VKThemeHelper.u(), r() ? switch_disabled_on_dark : switch_disabled_on_light);
}
}
@@ -1,19 +1,14 @@
package ru.vtosters.lite.hooks;
import static ru.vtosters.lite.utils.Preferences.feedcache;
import static ru.vtosters.lite.utils.Preferences.getBoolValue;
import static ru.vtosters.lite.utils.Preferences.milkshake;
import static ru.vtosters.lite.utils.Preferences.miniapps;
import static ru.vtosters.lite.utils.Preferences.postsredesign;
import static ru.vtosters.lite.utils.Preferences.superapp;
import com.vk.toggle.FeatureManager;
import com.vk.toggle.Features;
import static ru.vtosters.lite.utils.Preferences.*;
public class TogglesHook {
public static boolean shouldPatch(Features.Type feature) {
return switch (feature) {
case AB_IM_LONGPOLL_MSG_BATCHING, FEATURE_MOZJPEG, AB_IM_VIEW_POOL, AB_MULTI_GIFTS, AB_NEWS_VIDEO_LAYOUT_TEXT, AB_STICKERS_DISCOVER, AB_GIFTS_FROM_KEYBOARD, FEATURE_FEED_DEFAULT_LIST_ALWAYS, EXPERIMENT_NEWS_VIDEO_LAYOUT_TEXT, FEATURE_MILKSHAKE_DISCOVER_IN_MENU, FEATURE_DISCOVER_CATEGORIES, FEATURE_FAVE_PERF_IMPROVE, FEATURE_GROUP_ADMIN_MESSAGES, FEATURE_GROUP_MSG_PUSH_PARAM, FEATURE_IMAGE_QUALITY_UPGRADE, FEATURE_IM_AUDIO_MSG_TRANSCRIPT, FEATURE_IM_CASPER_MSGS, FEATURE_IM_DISABLE_FORCE_OPEN_VK_ME, FEATURE_IM_GIF_AUTOPLAY, FEATURE_IM_MR_IN_VKAPP, FEATURE_MEMORIES_ENABLED, FEATURE_MENU_GAMES_CAROUSEL, FEATURE_MILKSHAKE, FEATURE_MILKSHAKE_CHANGE_FEED_BY_TIMEOUT, FEATURE_MILKSHAKE_NEWS_SCROLL_ON_BACK, FEATURE_MILKSHAKE_SWITCH_THEME_ON_TAP, FEATURE_ML_BRANDS, FEATURE_ML_FEATURES, FEATURE_ML_MODELS_LOADING, FEATURE_MONEY_TRANSFERS_VKPAY, FEATURE_MUSIC_ARTIST_CATALOG, FEATURE_MUSIC_NEW_CATALOG, FEATURE_NARRATIVE_SNIPPET_TYPE, FEATURE_NEWS_GAMES_IN_DISCOVER, FEATURE_NEWS_HEADER_SCROLL, FEATURE_NEW_FORMAT_SHOW_WPB, FEATURE_PODCASTS_PAGE, FEATURE_QR_CREATE_QR, FEATURE_QR_DYNAMIC_FRAME, FEATURE_QR_SCAN_FROM_PHOTO, FEATURE_QR_VISION_DECODER, FEATURE_QUEUE_COUNTERS, FEATURE_REEF, FEATURE_ROAMING_AUTOPLAY, FEATURE_SHARE_MSGS_ON_INVITE, FEATURE_STICKERS_BOT_LINK, FEATURE_STICKERS_NEW_CATALOG, FEATURE_STORIES_AVATAR, FEATURE_STORIES_FEED_TYPE, FEATURE_STORIES_SHOW_ALWAYS, FEATURE_STORY_ANSWER_PUBLIC, FEATURE_STORY_APP_STICKER, FEATURE_STORY_ARCHIVE, FEATURE_STORY_ARCHIVE_POST, FEATURE_STORY_BAKGROUND_ALL, FEATURE_STORY_BOX, FEATURE_STORY_CADRE, FEATURE_STORY_CAMERA_TOOLTIP, FEATURE_STORY_EDITOR_GALLERY, FEATURE_STORY_EDITOR_TYPE, FEATURE_STORY_ENDLESS_VIDEO, FEATURE_STORY_FAST_REACTIONS, FEATURE_STORY_GIF, FEATURE_STORY_GROUPED, FEATURE_STORY_HIGH_QUALITY, FEATURE_STORY_MASKS_FRONTAL, FEATURE_STORY_MENTION_ICON, FEATURE_STORY_MODERN_PUBLISH, FEATURE_STORY_MUSIC_EDITOR, FEATURE_STORY_MUSIC_REPLIES, FEATURE_STORY_MUSIC_REPLIES_2, FEATURE_STORY_NEW_FRAME, FEATURE_STORY_ONE_TIME, FEATURE_STORY_PHOTO_SHARING, FEATURE_STORY_PHOTO_STICKER, FEATURE_STORY_POLLS, FEATURE_STORY_POST_REPOST, FEATURE_STORY_PRELOADING, FEATURE_STORY_QUESTION, FEATURE_STORY_QUESTION_STYLE, FEATURE_STORY_RLOTTIE, FEATURE_STORY_RLOTTIE_CACHE, FEATURE_STORY_SAVE_DEFAULT_ON, FEATURE_STORY_SEND_DIALOG_LIST, FEATURE_STORY_STICKER_PACK, FEATURE_STORY_TIME, FEATURE_STORY_VIEWER_CAMERA, FEATURE_STORY_VOICE_ANSWER, FEATURE_STORY_WITH_CONTEXT, FEATURE_SUPERAPP_MENU, FEATURE_TRAFFIC_SAVER, FEATURE_VKPAY_WIDGET, FEATURE_VKUI_INTERNAL_TO_MINI_APPS, FEATURE_VKUI_TOKEN_CACHE, FEATURE_VK_APPS_SEARCH, FEATURE_VOTES_BALANCE, FEATURE_WEBVIEW_TOKEN_ACTIVE, FEATURE_MILKSHAKE_FORCE_DISABLED, FEATURE_MILKSHAKE_ACTIVATION_DISABLED, EXPERIMENT_NEWS_DISABLE_CACHE ->
case AB_IM_LONGPOLL_MSG_BATCHING, FEATURE_MOZJPEG, AB_IM_VIEW_POOL, AB_MULTI_GIFTS, AB_NEWS_VIDEO_LAYOUT_TEXT, AB_STICKERS_DISCOVER, AB_GIFTS_FROM_KEYBOARD, FEATURE_FEED_DEFAULT_LIST_ALWAYS, EXPERIMENT_NEWS_VIDEO_LAYOUT_TEXT, FEATURE_DISCOVER_CATEGORIES, FEATURE_FAVE_PERF_IMPROVE, FEATURE_GROUP_ADMIN_MESSAGES, FEATURE_GROUP_MSG_PUSH_PARAM, FEATURE_IMAGE_QUALITY_UPGRADE, FEATURE_IM_AUDIO_MSG_TRANSCRIPT, FEATURE_IM_CASPER_MSGS, FEATURE_IM_DISABLE_FORCE_OPEN_VK_ME, FEATURE_IM_GIF_AUTOPLAY, FEATURE_IM_MR_IN_VKAPP, FEATURE_MEMORIES_ENABLED, FEATURE_MENU_GAMES_CAROUSEL, FEATURE_MILKSHAKE, FEATURE_MILKSHAKE_CHANGE_FEED_BY_TIMEOUT, FEATURE_MILKSHAKE_NEWS_SCROLL_ON_BACK, FEATURE_MILKSHAKE_SWITCH_THEME_ON_TAP, FEATURE_ML_BRANDS, FEATURE_ML_FEATURES, FEATURE_ML_MODELS_LOADING, FEATURE_MONEY_TRANSFERS_VKPAY, FEATURE_MUSIC_ARTIST_CATALOG, FEATURE_MUSIC_NEW_CATALOG, FEATURE_NARRATIVE_SNIPPET_TYPE, FEATURE_NEWS_GAMES_IN_DISCOVER, FEATURE_NEWS_HEADER_SCROLL, FEATURE_NEW_FORMAT_SHOW_WPB, FEATURE_PODCASTS_PAGE, FEATURE_QR_CREATE_QR, FEATURE_QR_DYNAMIC_FRAME, FEATURE_QR_SCAN_FROM_PHOTO, FEATURE_QR_VISION_DECODER, FEATURE_QUEUE_COUNTERS, FEATURE_REEF, FEATURE_ROAMING_AUTOPLAY, FEATURE_SHARE_MSGS_ON_INVITE, FEATURE_STICKERS_BOT_LINK, FEATURE_STICKERS_NEW_CATALOG, FEATURE_STORIES_AVATAR, FEATURE_STORIES_FEED_TYPE, FEATURE_STORIES_SHOW_ALWAYS, FEATURE_STORY_ANSWER_PUBLIC, FEATURE_STORY_APP_STICKER, FEATURE_STORY_ARCHIVE, FEATURE_STORY_ARCHIVE_POST, FEATURE_STORY_BAKGROUND_ALL, FEATURE_STORY_BOX, FEATURE_STORY_CADRE, FEATURE_STORY_CAMERA_TOOLTIP, FEATURE_STORY_EDITOR_GALLERY, FEATURE_STORY_EDITOR_TYPE, FEATURE_STORY_ENDLESS_VIDEO, FEATURE_STORY_FAST_REACTIONS, FEATURE_STORY_GIF, FEATURE_STORY_GROUPED, FEATURE_STORY_HIGH_QUALITY, FEATURE_STORY_MASKS_FRONTAL, FEATURE_STORY_MENTION_ICON, FEATURE_STORY_MODERN_PUBLISH, FEATURE_STORY_MUSIC_EDITOR, FEATURE_STORY_MUSIC_REPLIES, FEATURE_STORY_MUSIC_REPLIES_2, FEATURE_STORY_NEW_FRAME, FEATURE_STORY_ONE_TIME, FEATURE_STORY_PHOTO_SHARING, FEATURE_STORY_PHOTO_STICKER, FEATURE_STORY_POLLS, FEATURE_STORY_POST_REPOST, FEATURE_STORY_PRELOADING, FEATURE_STORY_QUESTION, FEATURE_STORY_QUESTION_STYLE, FEATURE_STORY_RLOTTIE, FEATURE_STORY_RLOTTIE_CACHE, FEATURE_STORY_SAVE_DEFAULT_ON, FEATURE_STORY_SEND_DIALOG_LIST, FEATURE_STORY_STICKER_PACK, FEATURE_STORY_TIME, FEATURE_STORY_VIEWER_CAMERA, FEATURE_STORY_VOICE_ANSWER, FEATURE_STORY_WITH_CONTEXT, FEATURE_SUPERAPP_MENU, FEATURE_TRAFFIC_SAVER, FEATURE_VKPAY_WIDGET, FEATURE_VKUI_INTERNAL_TO_MINI_APPS, FEATURE_VKUI_TOKEN_CACHE, FEATURE_VK_APPS_SEARCH, FEATURE_VOTES_BALANCE, FEATURE_WEBVIEW_TOKEN_ACTIVE, FEATURE_MILKSHAKE_FORCE_DISABLED, FEATURE_MILKSHAKE_ACTIVATION_DISABLED, EXPERIMENT_NEWS_DISABLE_CACHE ->
true;
default -> false;
};
@@ -71,7 +71,7 @@ public class VKUIHook {
}
public static void inject(WebView webView) {
if (Preferences.dev()) {
if (Preferences.getBoolValue("__dbg_webview", false)) {
WebView.setWebContentsDebuggingEnabled(true);
webView.loadUrl("javascript:(function() {let parent = document.head || document.documentElement; let script = parent.appendChild(document.createElement('script')); script.src = 'https://cdn.jsdelivr.net/npm/eruda'; script.onload = () => eruda.init();})()");
}
@@ -1,11 +1,10 @@
package ru.vtosters.lite.hooks;
import static ru.vtosters.lite.utils.Preferences.wbios;
import com.vtosters.lite.R;
import ru.vtosters.lite.utils.ThemesUtils;
import static ru.vtosters.lite.utils.Preferences.wbios;
public class WritebarHook {
public static int getWriteBar() {
return wbios() ? R.layout.write_bar_i : R.layout.write_bar;
@@ -2,23 +2,19 @@ package ru.vtosters.lite.hooks.ui;
import android.app.Activity;
import android.content.res.Configuration;
import com.vk.core.ui.themes.VKTheme;
import com.vk.core.ui.themes.VKThemeHelper;
import com.vtosters.lite.data.ThemeTracker;
import ru.vtosters.lite.utils.LifecycleUtils;
import ru.vtosters.lite.utils.Preferences;
import ru.vtosters.lite.utils.ThemesUtils;
import static ru.vtosters.lite.utils.AndroidUtils.getCenterScreenCoords;
public class SystemThemeChangerHook {
private static int sPrevUiMode = 0;
public static void onThemeChanged(Configuration configuration) {
onThemeChanged(configuration, true);
}
public static void onThemeChanged(Configuration configuration, Boolean restartActivity) {
if (Preferences.systemtheme()) {
var uiMode = configuration.uiMode & Configuration.UI_MODE_NIGHT_MASK;
if (uiMode == sPrevUiMode) return;
VKTheme theme = null;
if (uiMode == Configuration.UI_MODE_NIGHT_YES)
@@ -28,29 +24,14 @@ public class SystemThemeChangerHook {
theme = ThemesUtils.getLightTheme();
if (theme != null && theme != ThemesUtils.getCurrentTheme()) {
ThemesUtils.applyTheme(theme);
sPrevUiMode = uiMode;
ThemesUtils.applyTheme(theme, restartActivity);
}
}
}
public static void themeOnStart(Activity activity) {
if (Preferences.systemtheme()) {
var uiMode = activity.getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK;
if (uiMode == sPrevUiMode) return;
if (activity == null) activity = LifecycleUtils.getCurrentActivity();
VKTheme theme = null;
if (uiMode == Configuration.UI_MODE_NIGHT_YES)
theme = ThemesUtils.getDarkTheme();
else if (uiMode == Configuration.UI_MODE_NIGHT_UNDEFINED
|| uiMode == Configuration.UI_MODE_NIGHT_NO)
theme = ThemesUtils.getLightTheme();
if (theme != null && theme != ThemesUtils.getCurrentTheme()) {
VKThemeHelper.theme(theme, activity, getCenterScreenCoords());
ThemeTracker.a();
sPrevUiMode = uiMode;
}
}
onThemeChanged(activity.getResources().getConfiguration(), false);
}
}
@@ -3,11 +3,13 @@ package ru.vtosters.lite.music;
import android.text.TextUtils;
import android.util.Log;
import com.vk.dto.music.MusicTrack;
import com.vtosters.lite.R;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import org.json.JSONException;
import org.json.JSONObject;
import ru.vtosters.lite.di.singleton.VtOkHttpClient;
import ru.vtosters.lite.utils.AndroidUtils;
import java.io.IOException;
@@ -15,6 +17,7 @@ public class Genius {
private static final String KEY = "Bearer ZTejoT_ojOEasIkT9WrMBhBQOz6eYKK5QULCMECmOhvwqjRZ6WbpamFe3geHnvp3";
private static final String URL = "https://api.genius.com";
private static final OkHttpClient client = VtOkHttpClient.getInstance();
public static String getTextMusic(MusicTrack musictrack) {
var uid = musictrack.y1();
var artist = musictrack.C;
@@ -65,9 +68,9 @@ public class Genius {
}
}
return "Ошибка получения текста, возможно текст не найден";
return AndroidUtils.getString("error_no_text");
} catch (JSONException | IOException e) {
return "Ошибка получения текста, возможно текст не найден" + "\n\n" + "Ошибка: \n" + e.getLocalizedMessage();
return AndroidUtils.getString("error_no_text") + "\n\n" + AndroidUtils.getString(R.string.error) + ": \n" + e.getLocalizedMessage();
}
}
@@ -92,12 +95,12 @@ public class Genius {
Log.d("Genius", String.valueOf(payload));
if (!payload.has("response")) {
return "Ошибка получения текста, возможно текст не найден";
return AndroidUtils.getString("error_no_text");
}
return " " + payload.getJSONObject("response").getJSONObject("song").getJSONObject("lyrics").getString("plain");
} catch (JSONException | IOException e) {
return "Ошибка получения текста, возможно текст не найден" + "\n\n" + "Ошибка: \n" + e.getLocalizedMessage();
return AndroidUtils.getString("error_no_text") + "\n\n" + AndroidUtils.getString(R.string.error) + ": \n" + e.getLocalizedMessage();
}
}
}
@@ -3,14 +3,19 @@ package ru.vtosters.lite.music;
import android.os.RemoteException;
import android.text.TextUtils;
import android.util.Log;
import androidx.annotation.Nullable;
import bruhcollective.itaysonlab.libvkx.client.LibVKXClient;
import com.vk.dto.music.MusicTrack;
import com.vtosters.lite.R;
import okhttp3.Callback;
import okhttp3.*;
import org.json.JSONException;
import org.json.JSONObject;
import ru.vtosters.lite.di.singleton.VtOkHttpClient;
import ru.vtosters.lite.downloaders.AudioDownloader;
import ru.vtosters.lite.music.cache.CacheDatabaseDelegate;
import ru.vtosters.lite.utils.AndroidUtils;
import ru.vtosters.lite.utils.Preferences;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
@@ -19,19 +24,6 @@ import java.util.List;
import java.util.Map;
import java.util.TreeMap;
import bruhcollective.itaysonlab.libvkx.client.LibVKXClient;
import okhttp3.Call;
import okhttp3.Callback;
import okhttp3.FormBody;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.Response;
import ru.vtosters.lite.di.singleton.VtOkHttpClient;
import ru.vtosters.lite.downloaders.AudioDownloader;
import ru.vtosters.lite.music.cache.CacheDatabaseDelegate;
import ru.vtosters.lite.utils.AndroidUtils;
import ru.vtosters.lite.utils.Preferences;
public class LastFMScrobbler {
private static final String KEY = "5965d63402414776c54c266db0211746";
private static final String KEY_SECRET = "d982180eed13275bb948e41cf225f88f";
@@ -101,7 +93,7 @@ public class LastFMScrobbler {
fetch(params, new Callback() {
@Override
public void a(Call call, IOException e) {
Log.d("Scrobbler", e + "");
Log.d("Scrobbler", String.valueOf(e));
}
@Override
@@ -33,6 +33,19 @@ public class M3UDownloader implements ITrackDownloader {
return Holder.INSTANCE;
}
public static String getTitle(MusicTrack track) {
String title = null;
if (track.f != null) {
title = track.f;
if (!track.g.isEmpty()) {
title += " (" + track.g + ")";
}
}
return title;
}
public void downloadTrack(MusicTrack track, File outDir, Callback callback, boolean cache) {
if (track.D.isEmpty()) {
Log.d("TrackDownloader", "link error: " + track.y1() + ", title: " + M3UDownloader.getTitle(track));
@@ -88,7 +101,8 @@ public class M3UDownloader implements ITrackDownloader {
IOUtils.writeToFile(tsDump, content);
callback.onProgress(10 + Math.round(80.0f * progress.addAndGet(1) / tses.size()));
callback.onSizeReceived((long) content.length * tses.size(), parser.getHeapSize());
} catch (IOException | NoSuchPaddingException | NoSuchAlgorithmException | InvalidAlgorithmParameterException | InvalidKeyException e) {
} catch (IOException | NoSuchPaddingException | NoSuchAlgorithmException |
InvalidAlgorithmParameterException | InvalidKeyException e) {
callback.onFailure();
throw new RuntimeException(e);
}
@@ -107,19 +121,6 @@ public class M3UDownloader implements ITrackDownloader {
}).thenRun(() -> IOUtils.deleteRecursive(tsesDir)).thenRun(callback::onSuccess);
}
public static String getTitle(MusicTrack track) {
String title = null;
if (track.f != null) {
title = track.f;
if (!track.g.isEmpty()) {
title += " (" + track.g + ")";
}
}
return title;
}
// Initialization-on-demand
private static class Holder {
private static final M3UDownloader INSTANCE = new M3UDownloader();
@@ -1,10 +1,5 @@
package ru.vtosters.lite.music.cache;
import static ru.vtosters.lite.music.cache.FileCacheImplementation.getCacheDir;
import static ru.vtosters.lite.utils.AndroidUtils.getGlobalContext;
import static ru.vtosters.lite.utils.AndroidUtils.sendToast;
import static ru.vtosters.lite.utils.IOUtils.deleteRecursive;
import android.content.Context;
import android.database.Cursor;
import android.database.DatabaseUtils;
@@ -12,25 +7,26 @@ import android.database.SQLException;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.os.RemoteException;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import bruhcollective.itaysonlab.libvkx.ILibVkxService;
import bruhcollective.itaysonlab.libvkx.client.LibVKXClient;
import bruhcollective.itaysonlab.libvkx.client.LibVKXClientImpl;
import com.vk.core.util.ToastUtils;
import com.vk.dto.music.MusicTrack;
import com.vtosters.lite.R;
import org.json.JSONObject;
import ru.vtosters.lite.utils.AndroidUtils;
import java.net.URLDecoder;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.List;
import bruhcollective.itaysonlab.libvkx.ILibVkxService;
import bruhcollective.itaysonlab.libvkx.client.LibVKXClient;
import bruhcollective.itaysonlab.libvkx.client.LibVKXClientImpl;
import ru.vtosters.lite.utils.AndroidUtils;
import static ru.vtosters.lite.music.cache.FileCacheImplementation.getCacheDir;
import static ru.vtosters.lite.utils.AndroidUtils.getGlobalContext;
import static ru.vtosters.lite.utils.AndroidUtils.sendToast;
import static ru.vtosters.lite.utils.IOUtils.deleteRecursive;
public class CacheDatabaseDelegate {
private static final int DB_VERSION = 0x1;
@@ -1,14 +1,12 @@
package ru.vtosters.lite.music.cache;
import android.net.Uri;
import com.vk.dto.music.MusicTrack;
import java.io.File;
import ru.vtosters.lite.utils.AndroidUtils;
import ru.vtosters.lite.utils.IOUtils;
import java.io.File;
public class FileCacheImplementation {
public static void clear() {
@@ -1,20 +1,18 @@
package ru.vtosters.lite.music.cache.helpers;
import static ru.vtosters.lite.utils.AccountManagerUtils.getUserId;
import com.vk.dto.music.Playlist;
import com.vtosters.lite.R;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import ru.vtosters.lite.music.cache.CacheDatabaseDelegate;
import ru.vtosters.lite.music.cache.FileCacheImplementation;
import ru.vtosters.lite.utils.AndroidUtils;
import java.util.ArrayList;
import java.util.List;
import ru.vtosters.lite.music.cache.CacheDatabaseDelegate;
import ru.vtosters.lite.music.cache.FileCacheImplementation;
import ru.vtosters.lite.utils.AndroidUtils;
import static ru.vtosters.lite.utils.AccountManagerUtils.getUserId;
public class PlaylistHelper {
@@ -1,21 +1,18 @@
package ru.vtosters.lite.music.cache.helpers;
import android.util.Log;
import bruhcollective.itaysonlab.libvkx.client.LibVKXClient;
import com.vk.dto.music.MusicTrack;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import ru.vtosters.lite.music.cache.CacheDatabaseDelegate;
import ru.vtosters.lite.music.cache.FileCacheImplementation;
import java.io.File;
import java.net.MalformedURLException;
import java.util.List;
import bruhcollective.itaysonlab.libvkx.client.LibVKXClient;
import ru.vtosters.lite.music.cache.CacheDatabaseDelegate;
import ru.vtosters.lite.music.cache.FileCacheImplementation;
public class TracklistHelper {
public static List<MusicTrack> getTracks() {
@@ -3,27 +3,24 @@ package ru.vtosters.lite.music.cache.injectors;
import android.os.RemoteException;
import android.text.TextUtils;
import android.util.Log;
import bruhcollective.itaysonlab.libvkx.client.LibVKXClient;
import com.vk.api.audio.AudioGetPlaylist;
import com.vk.dto.music.MusicTrack;
import com.vk.dto.music.Playlist;
import io.reactivex.Observable;
import io.reactivex.ObservableOnSubscribe;
import org.json.JSONException;
import org.json.JSONObject;
import ru.vtosters.lite.downloaders.AudioDownloader;
import ru.vtosters.lite.music.cache.CacheDatabaseDelegate;
import ru.vtosters.lite.music.cache.helpers.PlaylistHelper;
import ru.vtosters.lite.music.cache.helpers.TracklistHelper;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import bruhcollective.itaysonlab.libvkx.client.LibVKXClient;
import io.reactivex.Observable;
import io.reactivex.ObservableOnSubscribe;
import ru.vtosters.lite.downloaders.AudioDownloader;
import ru.vtosters.lite.music.cache.CacheDatabaseDelegate;
import ru.vtosters.lite.music.cache.helpers.PlaylistHelper;
import ru.vtosters.lite.music.cache.helpers.TracklistHelper;
public class PlaylistInjector {
public final static String CHANNEL_NAME = "VTCH";
private static final ExecutorService executor = Executors.newCachedThreadPool();
@@ -1,34 +1,28 @@
package ru.vtosters.lite.music.cache.injectors;
import static ru.vtosters.lite.music.cache.CacheDatabaseDelegate.hasTracks;
import static ru.vtosters.lite.music.cache.helpers.PlaylistHelper.getCatalogHeader;
import static ru.vtosters.lite.music.cache.helpers.PlaylistHelper.getCatalogPlaylist;
import static ru.vtosters.lite.music.cache.helpers.PlaylistHelper.getCatalogSeparator;
import static ru.vtosters.lite.music.cache.helpers.PlaylistHelper.getPlaylist;
import static ru.vtosters.lite.utils.AccountManagerUtils.getUserId;
import android.util.Log;
import bruhcollective.itaysonlab.libvkx.client.LibVKXClient;
import com.vk.catalog2.core.CatalogParser;
import com.vk.catalog2.core.api.dto.CatalogResponse;
import com.vk.dto.music.MusicTrack;
import com.vtosters.lite.R;
import io.reactivex.Observable;
import io.reactivex.ObservableOnSubscribe;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import ru.vtosters.lite.music.cache.CacheDatabaseDelegate;
import ru.vtosters.lite.music.cache.helpers.TracklistHelper;
import ru.vtosters.lite.utils.AndroidUtils;
import ru.vtosters.lite.utils.NetworkUtils;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import bruhcollective.itaysonlab.libvkx.client.LibVKXClient;
import io.reactivex.Observable;
import io.reactivex.ObservableOnSubscribe;
import ru.vtosters.lite.music.cache.CacheDatabaseDelegate;
import ru.vtosters.lite.music.cache.helpers.TracklistHelper;
import ru.vtosters.lite.utils.AndroidUtils;
import ru.vtosters.lite.utils.NetworkUtils;
import static ru.vtosters.lite.music.cache.CacheDatabaseDelegate.hasTracks;
import static ru.vtosters.lite.music.cache.helpers.PlaylistHelper.*;
import static ru.vtosters.lite.utils.AccountManagerUtils.getUserId;
public class TracklistInjector {
@@ -1,12 +1,9 @@
package ru.vtosters.lite.music.callback;
import android.util.Log;
import androidx.core.app.NotificationCompat;
import androidx.core.app.NotificationManagerCompat;
import com.vtosters.lite.R;
import ru.vtosters.lite.downloaders.notifications.NotificationChannels;
import ru.vtosters.lite.music.Callback;
import ru.vtosters.lite.utils.AndroidUtils;
@@ -18,6 +18,7 @@ import ru.vtosters.lite.utils.Preferences;
import java.io.IOException;
import static ru.vtosters.lite.feature.groupslist.GroupsCatalogInjector.*;
import static ru.vtosters.lite.hooks.DateHook.getLocale;
import static ru.vtosters.lite.music.cache.helpers.PlaylistHelper.*;
import static ru.vtosters.lite.proxy.ProxyUtils.getApi;
@@ -144,67 +145,65 @@ public class CatalogJsonInjector {
return json;
}
public static JSONObject catalogInjector(JSONObject json) {
public static void catalogInjector(JSONObject json) {
try {
var section = json.optJSONObject("section");
if (section == null) return; // early return if section is null
var useOldAppVer = getBoolValue("useOldAppVer", false);
var isUsersCatalog = section.optString("url").equals("https://vk.com/audios" + getUserId() + "?section=" + (useOldAppVer ? "all" : "general"));
if (isUsersCatalog && CacheDatabaseDelegate.hasTracks() && !LibVKXClient.isIntegrationEnabled()) {
var blocks = section.getJSONArray("blocks");
var noPlaylists = !json.has("playlists");
if (!isUsersCatalog || !CacheDatabaseDelegate.hasTracks() || LibVKXClient.isIntegrationEnabled()) return; // early return if not users catalog or no tracks or integration enabled
var blocks = section.getJSONArray("blocks");
var noPlaylists = !json.has("playlists");
// Log.d("catalogInjector", "type: " + blocks.optJSONObject(0).optJSONArray("buttons").optJSONObject(0).optJSONObject("action").optString("type"));
if (noPlaylists) {
json.put("playlists", new JSONArray().put(getPlaylist()));
Log.d("catalogInjector", "added new pl");
} else {
try {
json.optJSONArray("playlists").put(getPlaylist());
Log.d("catalogInjector", "added to exist pl");
} catch (Exception e) {
Log.d("catalogInjector", e.toString());
}
}
if (noPlaylists) {
json.put("playlists", new JSONArray().put(getPlaylist()));
Log.d("catalogInjector", "added new pl");
} else {
try {
json.optJSONArray("playlists").put(getPlaylist());
Log.d("catalogInjector", "added to exist pl");
} catch (Exception e) {
Log.d("catalogInjector", e.toString());
}
if ((!useOldAppVer || noPlaylists) && !isLoaded) {
var newBlocks = new JSONArray();
newBlocks
.put(getCatalogHeader())
.put(getCatalogPlaylist())
.put(getCatalogSeparator());
isLoaded = true;
Log.d("catalogInjector", "added cache catalog playlist");
for (int i = 0; i < blocks.length(); i++) {
newBlocks.put(blocks.optJSONObject(i));
}
if ((!useOldAppVer || noPlaylists) && !isLoaded) {
var newBlocks = new JSONArray();
section.put("blocks", newBlocks);
} else {
for (int i = 0; i < blocks.length(); i++) {
var j = blocks.optJSONObject(i);
var type = j.optString("data_type");
newBlocks
.put(getCatalogHeader())
.put(getCatalogPlaylist())
.put(getCatalogSeparator());
if (type.equals("music_playlists") && j.has("playlists_ids")) {
var newarr = new JSONArray();
var playlists_ids = j.optJSONArray("playlists_ids");
isLoaded = true;
newarr.put(getUserId() + "_-1");
Log.d("catalogInjector", "added cache catalog playlist");
for (int i = 0; i < blocks.length(); i++) {
newBlocks.put(blocks.optJSONObject(i));
}
section.put("blocks", newBlocks);
} else {
for (int i = 0; i < blocks.length(); i++) {
var j = blocks.optJSONObject(i);
var type = j.optString("data_type");
if (type.equals("music_playlists") && j.has("playlists_ids")) {
var newarr = new JSONArray();
var playlists_ids = j.optJSONArray("playlists_ids");
newarr.put(getUserId() + "_-1");
for (int n = 0; n < playlists_ids.length(); n++) {
newarr.put(playlists_ids.optString(n));
}
Log.d("catalogInjector", "added to pl ids");
j.put("playlists_ids", newarr);
break;
for (int n = 0; n < playlists_ids.length(); n++) {
newarr.put(playlists_ids.optString(n));
}
Log.d("catalogInjector", "added to pl ids");
j.put("playlists_ids", newarr);
break;
}
}
}
@@ -212,11 +211,18 @@ public class CatalogJsonInjector {
} catch (JSONException e) {
Log.d("catalogInjector", e.toString());
}
}
public static JSONObject injectIntoCatalogs(JSONObject json) {
musicLinkFix(json);
injectIntoCatalog(json);
return json;
}
public static JSONObject musiclink(JSONObject json) {
public static void musicLinkFix(JSONObject json) {
var links = json.optJSONArray("links");
if (links != null && !getBoolValue("useOldAppVer", false)) {
@@ -233,7 +239,7 @@ public class CatalogJsonInjector {
e.printStackTrace();
}
return catalogInjector(json);
catalogInjector(json);
}
public static JSONObject fixArtists(JSONObject json) {
@@ -250,21 +256,18 @@ public class CatalogJsonInjector {
public static void fixHeaders(JSONObject json) {
var blocks = json.optJSONArray("blocks");
if (blocks != null) {
for (int i = 0; i < blocks.length(); i++) {
var block = blocks.optJSONObject(i);
var layout = block.optJSONObject("layout");
if (layout != null) {
var name = layout.optString("name");
if (name.equals("header_extended")) {
if (layout.has("top_title")) blocks.remove(i);
try {
layout.put("name", "header");
} catch (JSONException e) {
e.printStackTrace();
}
}
}
if (blocks == null) return; // early return if blocks are null
for (int i = 0; i < blocks.length(); i++) {
var block = blocks.optJSONObject(i);
var layout = block.optJSONObject("layout");
if (layout == null) continue; // skip iteration if layout is null
var name = layout.optString("name");
if (!name.equals("header_extended")) continue; // skip iteration if name is not "header_extended"
if (layout.has("top_title")) blocks.remove(i);
try {
layout.put("name", "header");
} catch (JSONException e) {
e.printStackTrace();
}
}
}
@@ -1,15 +1,17 @@
package ru.vtosters.lite.music.converter.playlist;
import static ru.vtosters.lite.hooks.DateHook.getLocale;
import static ru.vtosters.lite.proxy.ProxyUtils.getApi;
import com.vk.core.network.Network;
import com.vk.core.util.DeviceIdProvider;
import com.vk.dto.music.MusicTrack;
import com.vk.dto.music.Playlist;
import java8.util.concurrent.CompletableFuture;
import okhttp3.Headers;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import org.json.JSONException;
import org.json.JSONObject;
import ru.vtosters.lite.utils.AccountManagerUtils;
import ru.vtosters.lite.utils.AndroidUtils;
import java.io.IOException;
import java.util.ArrayList;
@@ -17,12 +19,8 @@ import java.util.List;
import java.util.concurrent.ExecutionException;
import java.util.stream.Collectors;
import java8.util.concurrent.CompletableFuture;
import okhttp3.Headers;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import ru.vtosters.lite.utils.AccountManagerUtils;
import ru.vtosters.lite.utils.AndroidUtils;
import static ru.vtosters.lite.hooks.DateHook.getLocale;
import static ru.vtosters.lite.proxy.ProxyUtils.getApi;
/**
* stuff for converting playlists DTO
@@ -1,13 +1,14 @@
package ru.vtosters.lite.music.converter.ts;
import android.util.Log;
import com.arthenica.ffmpegkit.FFmpegKit;
import com.arthenica.ffmpegkit.ReturnCode;
import com.vk.core.util.ToastUtils;
import com.vk.dto.music.Artist;
import com.vk.dto.music.MusicTrack;
import com.vtosters.lite.R;
import ru.vtosters.lite.utils.AndroidUtils;
import ru.vtosters.lite.utils.IOUtils;
import java.io.File;
import java.io.FileOutputStream;
@@ -15,9 +16,6 @@ import java.io.IOException;
import java.io.InputStream;
import java.util.stream.Collectors;
import ru.vtosters.lite.utils.AndroidUtils;
import ru.vtosters.lite.utils.IOUtils;
public class FFMpeg {
private static final int BUFFER_SIZE = 2048;
@@ -1,6 +1,7 @@
package ru.vtosters.lite.music.converter.ts;
import android.os.Build;
import ru.vtosters.lite.utils.IOUtils;
import java.io.ByteArrayOutputStream;
import java.io.File;
@@ -9,8 +10,6 @@ import java.io.IOException;
import java.nio.file.Files;
import java.util.Arrays;
import ru.vtosters.lite.utils.IOUtils;
public class TSMerger {
/**
* Merge multiple .ts files into one .ts file
@@ -1,18 +1,16 @@
package ru.vtosters.lite.music.downloader;
import static ru.vtosters.lite.hooks.DateHook.getLocale;
import static ru.vtosters.lite.proxy.ProxyUtils.getApi;
import static ru.vtosters.lite.utils.AccountManagerUtils.getUserId;
import static ru.vtosters.lite.utils.AccountManagerUtils.getUserToken;
import android.util.Log;
import com.vk.core.network.Network;
import com.vk.core.util.DeviceIdProvider;
import com.vk.dto.music.MusicTrack;
import java8.util.concurrent.CompletableFuture;
import okhttp3.Headers;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import org.json.JSONException;
import org.json.JSONObject;
import ru.vtosters.lite.utils.AndroidUtils;
import java.io.IOException;
import java.util.ArrayList;
@@ -20,11 +18,10 @@ import java.util.List;
import java.util.concurrent.ExecutionException;
import java.util.stream.Collectors;
import java8.util.concurrent.CompletableFuture;
import okhttp3.Headers;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import ru.vtosters.lite.utils.AndroidUtils;
import static ru.vtosters.lite.hooks.DateHook.getLocale;
import static ru.vtosters.lite.proxy.ProxyUtils.getApi;
import static ru.vtosters.lite.utils.AccountManagerUtils.getUserId;
import static ru.vtosters.lite.utils.AccountManagerUtils.getUserToken;
public class AudioGet {
public static List<MusicTrack> getAudios() {
@@ -1,15 +1,13 @@
package ru.vtosters.lite.music.downloader;
import android.util.Log;
import com.vk.dto.music.MusicTrack;
import ru.vtosters.lite.music.Callback;
import java.io.File;
import java.util.List;
import java.util.concurrent.atomic.AtomicInteger;
import ru.vtosters.lite.music.Callback;
public class PlaylistDownloader {
public static void downloadPlaylist(List<MusicTrack> playlist, String playlistName, String path, Callback callback) {
File outDir = new File(path);
@@ -1,14 +1,13 @@
package ru.vtosters.lite.music.downloader;
import bruhcollective.itaysonlab.libvkx.client.LibVKXClient;
import com.vk.dto.music.MusicTrack;
import ru.vtosters.lite.music.cache.FileCacheImplementation;
import ru.vtosters.lite.utils.IOUtils;
import java.io.IOException;
import java.net.URL;
import bruhcollective.itaysonlab.libvkx.client.LibVKXClient;
import ru.vtosters.lite.music.cache.FileCacheImplementation;
import ru.vtosters.lite.utils.IOUtils;
public class ThumbnailDownloader {
public static void downloadThumbnails(MusicTrack track)
@@ -1,12 +1,8 @@
package ru.vtosters.lite.music.downloader;
import android.util.Log;
import com.vk.dto.music.MusicTrack;
import java.io.File;
import bruhcollective.itaysonlab.libvkx.client.LibVKXClient;
import com.vk.dto.music.MusicTrack;
import ru.vtosters.lite.concurrent.VTExecutors;
import ru.vtosters.lite.music.Callback;
import ru.vtosters.lite.music.M3UDownloader;
@@ -14,6 +10,8 @@ import ru.vtosters.lite.music.cache.CacheDatabaseDelegate;
import ru.vtosters.lite.music.cache.FileCacheImplementation;
import ru.vtosters.lite.music.interfaces.ITrackDownloader;
import java.io.File;
public class TrackDownloader {
public static void downloadTrack(MusicTrack track, String path, Callback callback) {
if (track.D.isEmpty()) {
@@ -1,7 +1,6 @@
package ru.vtosters.lite.music.hook;
import android.content.Context;
import com.vk.music.fragment.MusicFragment;
public class MusicArtistSelectorHook {
@@ -1,30 +1,24 @@
package ru.vtosters.lite.music.hook;
import static bruhcollective.itaysonlab.libvkx.client.LibVKXClient.asId;
import static bruhcollective.itaysonlab.libvkx.client.LibVKXClient.getInstance;
import static bruhcollective.itaysonlab.libvkx.client.LibVKXClient.isIntegrationEnabled;
import static bruhcollective.itaysonlab.libvkx.client.LibVKXClient.isVkxInstalled;
import static bruhcollective.itaysonlab.libvkx.client.LibVKXClient.lambdaplay;
import static ru.vtosters.lite.music.cache.CacheDatabaseDelegate.isCached;
import static ru.vtosters.lite.music.cache.CacheDatabaseDelegate.isVkxCached;
import static ru.vtosters.lite.utils.NetworkUtils.isNetworkConnected;
import static ru.vtosters.lite.utils.Preferences.milkshake;
import android.os.RemoteException;
import bruhcollective.itaysonlab.libvkx.client.LibVKXClientImpl;
import com.vk.dto.music.MusicTrack;
import com.vk.dto.music.Playlist;
import com.vk.music.bottomsheets.a.MusicAction;
import com.vk.music.common.MusicPlaybackLaunchContext;
import com.vtosters.lite.R;
import java.util.ArrayList;
import bruhcollective.itaysonlab.libvkx.client.LibVKXClientImpl;
import ru.vtosters.lite.downloaders.AudioDownloader;
import ru.vtosters.lite.music.cache.CacheDatabaseDelegate;
import ru.vtosters.lite.utils.AndroidUtils;
import java.util.ArrayList;
import static bruhcollective.itaysonlab.libvkx.client.LibVKXClient.*;
import static ru.vtosters.lite.music.cache.CacheDatabaseDelegate.isCached;
import static ru.vtosters.lite.music.cache.CacheDatabaseDelegate.isVkxCached;
import static ru.vtosters.lite.utils.NetworkUtils.isNetworkConnected;
import static ru.vtosters.lite.utils.Preferences.milkshake;
public class MusicBottomSheetHook {
public static ArrayList<MusicAction> hook(ArrayList<MusicAction> actions, MusicTrack musicTrack) {
if (musicTrack.F1()) return actions;
@@ -38,13 +32,13 @@ public class MusicBottomSheetHook {
if (isIntegrationEnabled()) {
if (isVkxCached(trackid)) {
actions.add(getRemoveCacheTrackVkxAction());
} else if (isNetworkConnected()){
} else if (isNetworkConnected()) {
actions.add(addToCacheTrackVkxAction());
}
} else {
if (isCached(trackid)) {
actions.add(getRemoveCacheTrackAction());
} else if (isNetworkConnected()){
} else if (isNetworkConnected()) {
actions.add(addToCacheTrackAction());
}
}
@@ -93,10 +87,10 @@ public class MusicBottomSheetHook {
if (isIntegrationEnabled()) {
if (isVkxCached(playlist.a, playlist.b)) {
actions.add(getRemoveCacheTrackVkxAction());
} else if (isNetworkConnected()){
} else if (isNetworkConnected()) {
actions.add(addToCacheTrackVkxAction());
}
} else if (isNetworkConnected()){
} else if (isNetworkConnected()) {
actions.add(addToCacheTrackAction());
}
@@ -1,11 +1,10 @@
package ru.vtosters.lite.music.interfaces;
import com.vk.dto.music.MusicTrack;
import ru.vtosters.lite.music.Callback;
import java.io.File;
import ru.vtosters.lite.music.Callback;
/**
* Interface for track downloaders
*/
@@ -2,13 +2,10 @@ package ru.vtosters.lite.music.notification;
import android.app.Notification;
import android.os.Build;
import androidx.core.app.NotificationCompat;
import androidx.core.app.NotificationManagerCompat;
import com.vk.dto.music.MusicTrack;
import com.vtosters.lite.R;
import ru.vtosters.lite.downloaders.notifications.NotificationChannels;
import ru.vtosters.lite.utils.AccountManagerUtils;
import ru.vtosters.lite.utils.AndroidUtils;
@@ -7,11 +7,7 @@ import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.UnsupportedEncodingException;
import java.net.HttpURLConnection;
import java.net.PasswordAuthentication;
import java.net.Proxy;
import java.net.URL;
import java.net.URLEncoder;
import java.net.*;
import java.nio.charset.StandardCharsets;
import java.util.Map;
import java.util.TreeMap;
@@ -20,7 +16,7 @@ public final class NetCall {
private final NetRequest req;
private final NetClient cl;
protected NetCall(NetClient cl, NetRequest req) {
NetCall(NetClient cl, NetRequest req) {
this.req = req;
this.cl = cl;
}
@@ -8,11 +8,11 @@ public final class NetResponse {
private final byte[] data;
private int code;
protected NetResponse(byte[] data) {
NetResponse(byte[] data) {
this.data = data;
}
protected void setCode(int code) {
void setCode(int code) {
this.code = code;
}
@@ -1,9 +1,6 @@
package ru.vtosters.lite.net;
import static ru.vtosters.lite.utils.AccountManagerUtils.getUserToken;
import android.os.AsyncTask;
import com.vk.core.network.Network;
import java.io.BufferedReader;
@@ -11,6 +8,8 @@ import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import static ru.vtosters.lite.utils.AccountManagerUtils.getUserToken;
public class Request {
public static void makeRequest(byte[] bArr, RequestCallback RequestCallback) {
new MakeRequestTask(bArr, RequestCallback).execute();
@@ -1,15 +1,14 @@
package ru.vtosters.lite.proxy;
import android.util.Log;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import ru.vtosters.lite.di.singleton.VtOkHttpClient;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import ru.vtosters.lite.di.singleton.VtOkHttpClient;
public class GithubList {
private static final OkHttpClient mClient = VtOkHttpClient.getInstance();
@@ -1,28 +1,24 @@
package ru.vtosters.lite.proxy;
import static java.lang.System.clearProperty;
import static ru.vtosters.lite.proxy.api.VikaMobile.getApiHost;
import static ru.vtosters.lite.proxy.api.VikaMobile.getOauthHost;
import static ru.vtosters.lite.proxy.api.VikaMobile.getStaticHost;
import static ru.vtosters.lite.utils.AndroidUtils.getGlobalContext;
import android.annotation.SuppressLint;
import android.content.Context;
import android.content.Intent;
import android.util.ArrayMap;
import android.util.Log;
import java.io.IOException;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import ru.vtosters.lite.proxy.http.CustomHttp;
import ru.vtosters.lite.proxy.https.CustomHttps;
import ru.vtosters.lite.proxy.socks.CustomSocks;
import ru.vtosters.lite.proxy.socks.Zaborona;
import ru.vtosters.lite.utils.Preferences;
import java.io.IOException;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import static java.lang.System.clearProperty;
import static ru.vtosters.lite.proxy.api.VikaMobile.*;
import static ru.vtosters.lite.utils.AndroidUtils.getGlobalContext;
public class ProxyUtils {
public static String getApi() {
var proxyapi = Preferences.getString("proxyapi");
@@ -1,11 +1,11 @@
package ru.vtosters.lite.proxy.api;
import android.util.Log;
import static ru.vtosters.lite.proxy.ProxyUtils.isAnyProxyEnabled;
import static ru.vtosters.lite.proxy.ProxyUtils.isVikaProxyEnabled;
import static ru.vtosters.lite.utils.Preferences.getString;
import android.util.Log;
public class ApiProxy {
public static String linkReplacer(String link) {
var vkapi = "api.vk.com";
@@ -1,19 +1,17 @@
package ru.vtosters.lite.proxy.http;
import static ru.vtosters.lite.proxy.GithubList.getProxy;
import static ru.vtosters.lite.proxy.ProxyUtils.forceProxyApplying;
import static ru.vtosters.lite.proxy.ProxyUtils.hasProxy;
import android.util.Log;
import com.vtosters.lite.R;
import ru.vtosters.lite.proxy.RandomProxy;
import ru.vtosters.lite.utils.AndroidUtils;
import ru.vtosters.lite.utils.Preferences;
import java.io.IOException;
import java.util.ArrayList;
import ru.vtosters.lite.proxy.RandomProxy;
import ru.vtosters.lite.utils.AndroidUtils;
import ru.vtosters.lite.utils.Preferences;
import static ru.vtosters.lite.proxy.GithubList.getProxy;
import static ru.vtosters.lite.proxy.ProxyUtils.forceProxyApplying;
import static ru.vtosters.lite.proxy.ProxyUtils.hasProxy;
public class Jetkai {
private static final String TAG = "Jetkai_Http";
@@ -1,19 +1,17 @@
package ru.vtosters.lite.proxy.http;
import static ru.vtosters.lite.proxy.GithubList.getProxy;
import static ru.vtosters.lite.proxy.ProxyUtils.forceProxyApplying;
import static ru.vtosters.lite.proxy.ProxyUtils.hasProxy;
import android.util.Log;
import com.vtosters.lite.R;
import ru.vtosters.lite.proxy.RandomProxy;
import ru.vtosters.lite.utils.AndroidUtils;
import ru.vtosters.lite.utils.Preferences;
import java.io.IOException;
import java.util.ArrayList;
import ru.vtosters.lite.proxy.RandomProxy;
import ru.vtosters.lite.utils.AndroidUtils;
import ru.vtosters.lite.utils.Preferences;
import static ru.vtosters.lite.proxy.GithubList.getProxy;
import static ru.vtosters.lite.proxy.ProxyUtils.forceProxyApplying;
import static ru.vtosters.lite.proxy.ProxyUtils.hasProxy;
public class TheSpeedX {
private static final String TAG = "TheSpeedX_Http";
@@ -1,19 +1,17 @@
package ru.vtosters.lite.proxy.https;
import static ru.vtosters.lite.proxy.GithubList.getProxy;
import static ru.vtosters.lite.proxy.ProxyUtils.forceProxyApplying;
import static ru.vtosters.lite.proxy.ProxyUtils.hasProxy;
import android.util.Log;
import com.vtosters.lite.R;
import ru.vtosters.lite.proxy.RandomProxy;
import ru.vtosters.lite.utils.AndroidUtils;
import ru.vtosters.lite.utils.Preferences;
import java.io.IOException;
import java.util.ArrayList;
import ru.vtosters.lite.proxy.RandomProxy;
import ru.vtosters.lite.utils.AndroidUtils;
import ru.vtosters.lite.utils.Preferences;
import static ru.vtosters.lite.proxy.GithubList.getProxy;
import static ru.vtosters.lite.proxy.ProxyUtils.forceProxyApplying;
import static ru.vtosters.lite.proxy.ProxyUtils.hasProxy;
public class Jetkai {
private static final String TAG = "Jetkai_Https";
@@ -1,19 +1,17 @@
package ru.vtosters.lite.proxy.https;
import static ru.vtosters.lite.proxy.GithubList.getProxy;
import static ru.vtosters.lite.proxy.ProxyUtils.forceProxyApplying;
import static ru.vtosters.lite.proxy.ProxyUtils.hasProxy;
import android.util.Log;
import com.vtosters.lite.R;
import ru.vtosters.lite.proxy.RandomProxy;
import ru.vtosters.lite.utils.AndroidUtils;
import ru.vtosters.lite.utils.Preferences;
import java.io.IOException;
import java.util.ArrayList;
import ru.vtosters.lite.proxy.RandomProxy;
import ru.vtosters.lite.utils.AndroidUtils;
import ru.vtosters.lite.utils.Preferences;
import static ru.vtosters.lite.proxy.GithubList.getProxy;
import static ru.vtosters.lite.proxy.ProxyUtils.forceProxyApplying;
import static ru.vtosters.lite.proxy.ProxyUtils.hasProxy;
public class Roosterkid {
private static final String TAG = "Roosterkid_Https";
@@ -1,19 +1,17 @@
package ru.vtosters.lite.proxy.socks;
import static ru.vtosters.lite.proxy.GithubList.getProxy;
import static ru.vtosters.lite.proxy.ProxyUtils.forceProxyApplying;
import static ru.vtosters.lite.proxy.ProxyUtils.hasProxy;
import android.util.Log;
import com.vtosters.lite.R;
import ru.vtosters.lite.proxy.RandomProxy;
import ru.vtosters.lite.utils.AndroidUtils;
import ru.vtosters.lite.utils.Preferences;
import java.io.IOException;
import java.util.ArrayList;
import ru.vtosters.lite.proxy.RandomProxy;
import ru.vtosters.lite.utils.AndroidUtils;
import ru.vtosters.lite.utils.Preferences;
import static ru.vtosters.lite.proxy.GithubList.getProxy;
import static ru.vtosters.lite.proxy.ProxyUtils.forceProxyApplying;
import static ru.vtosters.lite.proxy.ProxyUtils.hasProxy;
public class Hookzof {
private static final String TAG = "Hookzof_Socks";
@@ -1,19 +1,17 @@
package ru.vtosters.lite.proxy.socks;
import static ru.vtosters.lite.proxy.GithubList.getProxy;
import static ru.vtosters.lite.proxy.ProxyUtils.forceProxyApplying;
import static ru.vtosters.lite.proxy.ProxyUtils.hasProxy;
import android.util.Log;
import com.vtosters.lite.R;
import ru.vtosters.lite.proxy.RandomProxy;
import ru.vtosters.lite.utils.AndroidUtils;
import ru.vtosters.lite.utils.Preferences;
import java.io.IOException;
import java.util.ArrayList;
import ru.vtosters.lite.proxy.RandomProxy;
import ru.vtosters.lite.utils.AndroidUtils;
import ru.vtosters.lite.utils.Preferences;
import static ru.vtosters.lite.proxy.GithubList.getProxy;
import static ru.vtosters.lite.proxy.ProxyUtils.forceProxyApplying;
import static ru.vtosters.lite.proxy.ProxyUtils.hasProxy;
public class Jetkai {
private static final String TAG = "Jetkai_Socks";
@@ -1,19 +1,17 @@
package ru.vtosters.lite.proxy.socks;
import static ru.vtosters.lite.proxy.GithubList.getProxy;
import static ru.vtosters.lite.proxy.ProxyUtils.forceProxyApplying;
import static ru.vtosters.lite.proxy.ProxyUtils.hasProxy;
import android.util.Log;
import com.vtosters.lite.R;
import ru.vtosters.lite.proxy.RandomProxy;
import ru.vtosters.lite.utils.AndroidUtils;
import ru.vtosters.lite.utils.Preferences;
import java.io.IOException;
import java.util.ArrayList;
import ru.vtosters.lite.proxy.RandomProxy;
import ru.vtosters.lite.utils.AndroidUtils;
import ru.vtosters.lite.utils.Preferences;
import static ru.vtosters.lite.proxy.GithubList.getProxy;
import static ru.vtosters.lite.proxy.ProxyUtils.forceProxyApplying;
import static ru.vtosters.lite.proxy.ProxyUtils.hasProxy;
public class Roosterkid {
private static final String TAG = "Roosterkid_Socks";
@@ -1,19 +1,17 @@
package ru.vtosters.lite.proxy.socks;
import static ru.vtosters.lite.proxy.GithubList.getProxy;
import static ru.vtosters.lite.proxy.ProxyUtils.forceProxyApplying;
import static ru.vtosters.lite.proxy.ProxyUtils.hasProxy;
import android.util.Log;
import com.vtosters.lite.R;
import ru.vtosters.lite.proxy.RandomProxy;
import ru.vtosters.lite.utils.AndroidUtils;
import ru.vtosters.lite.utils.Preferences;
import java.io.IOException;
import java.util.ArrayList;
import ru.vtosters.lite.proxy.RandomProxy;
import ru.vtosters.lite.utils.AndroidUtils;
import ru.vtosters.lite.utils.Preferences;
import static ru.vtosters.lite.proxy.GithubList.getProxy;
import static ru.vtosters.lite.proxy.ProxyUtils.forceProxyApplying;
import static ru.vtosters.lite.proxy.ProxyUtils.hasProxy;
public class TheSpeedX {
private static final String TAG = "TheSpeedX_Socks";
@@ -1,9 +1,5 @@
package ru.vtosters.lite.services;
import static android.widget.Toast.LENGTH_SHORT;
import static android.widget.Toast.makeText;
import static ru.vtosters.lite.utils.AndroidUtils.getGlobalContext;
import android.app.NotificationManager;
import android.app.Service;
import android.content.Context;
@@ -11,10 +7,9 @@ import android.content.Intent;
import android.os.Environment;
import android.os.IBinder;
import android.util.Log;
import androidx.annotation.Nullable;
import com.vtosters.lite.R;
import ru.vtosters.lite.utils.AndroidUtils;
import java.io.File;
import java.io.FileOutputStream;
@@ -24,7 +19,9 @@ import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;
import ru.vtosters.lite.utils.AndroidUtils;
import static android.widget.Toast.LENGTH_SHORT;
import static android.widget.Toast.makeText;
import static ru.vtosters.lite.utils.AndroidUtils.getGlobalContext;
public class LogWriterService extends Service {
public LogWriterService() {
@@ -2,10 +2,10 @@ package ru.vtosters.lite.ssfs;
import android.util.Log;
import com.vk.core.dialogs.alert.VkAlertDialog;
import com.vtosters.lite.R;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import com.vtosters.lite.R;
import ru.vtosters.lite.utils.AndroidUtils;
import ru.vtosters.lite.utils.LifecycleUtils;
import ru.vtosters.lite.utils.Preferences;

Some files were not shown because too many files have changed in this diff Show More