Compare commits
5
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cf05e051e8 | ||
|
|
963c4d81ba | ||
|
|
099c699702 | ||
|
|
1117fc19d4 | ||
|
|
78dca26063 |
@@ -5,6 +5,7 @@ import com.vtosters.lite.R;
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
import ru.vtosters.hooks.other.Preferences;
|
||||
import ru.vtosters.lite.utils.AndroidUtils;
|
||||
|
||||
import java.io.IOException;
|
||||
@@ -115,14 +116,20 @@ public class OnlineFormatterHook {
|
||||
return AndroidUtils.getString(R.string.custom_online) + " " + appname;
|
||||
}
|
||||
|
||||
public static JSONObject onlineHook(JSONObject json) throws ParseException, IOException, JSONException {
|
||||
if (getBoolValue("onlinefix", false)) JsonInjectors.setOnlineInfo(json);
|
||||
public static JSONObject onlineHook(JSONObject json) {
|
||||
if (!getBoolValue("onlinefix", false) || Preferences.serverFeaturesDisable()) return json;
|
||||
|
||||
try {
|
||||
JsonInjectors.setOnlineInfo(json);
|
||||
} catch (JSONException e) {
|
||||
Log.e("onlineHook", e.getMessage());
|
||||
}
|
||||
|
||||
return json;
|
||||
}
|
||||
|
||||
public static JSONArray onlineHookList(JSONArray jsonArr) throws ParseException, IOException, JSONException {
|
||||
if (!getBoolValue("onlinefix", false)) return jsonArr;
|
||||
public static JSONArray onlineHookList(JSONArray jsonArr) {
|
||||
if (!getBoolValue("onlinefix", false) || Preferences.serverFeaturesDisable()) return jsonArr;
|
||||
|
||||
try {
|
||||
JsonInjectors.setOnlineInfoUsers(jsonArr);
|
||||
@@ -134,7 +141,7 @@ public class OnlineFormatterHook {
|
||||
}
|
||||
|
||||
public static JSONObject onlineHookProfiles(JSONObject json) {
|
||||
if (!getBoolValue("onlinefix", false)) return json;
|
||||
if (!getBoolValue("onlinefix", false) || Preferences.serverFeaturesDisable()) return json;
|
||||
|
||||
try {
|
||||
JsonInjectors.setOnlineInfoUsers(json.optJSONArray("profiles"));
|
||||
@@ -146,7 +153,7 @@ public class OnlineFormatterHook {
|
||||
}
|
||||
|
||||
public static JSONObject onlineHookItems(JSONObject json) {
|
||||
if (!getBoolValue("onlinefix", false)) return json;
|
||||
if (!getBoolValue("onlinefix", false) || Preferences.serverFeaturesDisable()) return json;
|
||||
|
||||
try {
|
||||
JsonInjectors.setOnlineInfoUsers(json.optJSONArray("items"));
|
||||
@@ -157,8 +164,8 @@ public class OnlineFormatterHook {
|
||||
return json;
|
||||
}
|
||||
|
||||
public static JSONObject onlineHookRequestsAndRecommendations(JSONObject json) throws ParseException, IOException, JSONException {
|
||||
if (!getBoolValue("onlinefix", false)) return json;
|
||||
public static JSONObject onlineHookRequestsAndRecommendations(JSONObject json) {
|
||||
if (!getBoolValue("onlinefix", false) || Preferences.serverFeaturesDisable()) return json;
|
||||
|
||||
try {
|
||||
JsonInjectors.setOnlineInfoUsers(json.optJSONObject("read_requests").optJSONArray("items"));
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
package ru.vtosters.hooks;
|
||||
|
||||
import ru.vtosters.hooks.other.Preferences;
|
||||
import ru.vtosters.lite.utils.AndroidUtils;
|
||||
|
||||
public class TabletHook {
|
||||
public static boolean hook() {
|
||||
return AndroidUtils.isTablet() && !Preferences.getBoolValue("disableForceTabletMode", false);
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@ package ru.vtosters.hooks;
|
||||
|
||||
import com.vk.dto.common.VerifyInfo;
|
||||
import org.json.JSONObject;
|
||||
import ru.vtosters.hooks.other.Preferences;
|
||||
import ru.vtosters.lite.utils.VTVerifications;
|
||||
|
||||
import static ru.vtosters.hooks.other.Preferences.getBoolValue;
|
||||
@@ -20,7 +21,7 @@ public class VerificationsHook {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!getBoolValue("VT_Verification", true) || getBoolValue("serverFeaturesDisable", false)) {
|
||||
if (!getBoolValue("VT_Verification", true) || Preferences.serverFeaturesDisable()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -32,7 +33,7 @@ public class VerificationsHook {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!getBoolValue("VT_Fire", true) || getBoolValue("serverFeaturesDisable", false)) {
|
||||
if (!getBoolValue("VT_Fire", true) || Preferences.serverFeaturesDisable()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -242,6 +242,10 @@ public class Preferences {
|
||||
return getBoolValue("autoalltranslate", false);
|
||||
}
|
||||
|
||||
public static boolean serverFeaturesDisable() {
|
||||
return getBoolValue("serverFeaturesDisable", false);
|
||||
}
|
||||
|
||||
public static boolean shortinfo() {
|
||||
return getBoolValue("shortinfo", true);
|
||||
}
|
||||
|
||||
@@ -48,25 +48,23 @@ public class M3UDownloader
|
||||
var resultMp3 = getResultMp3File(outDir, cache, track);
|
||||
try {
|
||||
CompletableFuture.allOf(createFutures(baseUri, segments, progress, callback, track))
|
||||
.thenRun(() ->
|
||||
{
|
||||
if (cache)
|
||||
.thenRun(() -> {
|
||||
if (cache) {
|
||||
try {
|
||||
ThumbnailDownloader.downloadThumbnails(track);
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException("Failed to download thumbs", e);
|
||||
}
|
||||
}
|
||||
})
|
||||
.thenRun(() ->
|
||||
{
|
||||
.thenRun(() -> {
|
||||
try {
|
||||
TSMerger.merge(getTsesDir(track), resultTs);
|
||||
} catch (Throwable e) {
|
||||
throw new RuntimeException("Failed to merge ts files", e);
|
||||
}
|
||||
})
|
||||
.thenRun(() ->
|
||||
{
|
||||
.thenRun(() -> {
|
||||
try {
|
||||
FFMpeg.convert(resultTs, resultMp3.getAbsolutePath(), track);
|
||||
} catch (Throwable e) {
|
||||
@@ -74,12 +72,18 @@ public class M3UDownloader
|
||||
}
|
||||
})
|
||||
.thenRun(() -> callback.onProgress(10 + Math.round(80.0f * progress.addAndGet(1) / segments.size())))
|
||||
.thenRun(() -> MusicCacheImpl.addTrack(track))
|
||||
.thenRun(() -> {
|
||||
if (cache) {
|
||||
MusicCacheImpl.addTrack(track);
|
||||
}
|
||||
})
|
||||
.whenComplete((unused, tr) -> {
|
||||
if (tr != null) {
|
||||
IOUtils.deleteRecursive(MusicCacheStorageUtils.getTrackDirById(track.y1()));
|
||||
callback.onFailure();
|
||||
} else callback.onSuccess();
|
||||
} else {
|
||||
callback.onSuccess();
|
||||
}
|
||||
IOUtils.deleteRecursive(getTsesDir(track));
|
||||
})
|
||||
.join();
|
||||
|
||||
@@ -8,6 +8,7 @@ import okhttp3.Response;
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
import ru.vtosters.hooks.other.Preferences;
|
||||
import ru.vtosters.lite.di.singleton.VtOkHttpClient;
|
||||
import ru.vtosters.lite.utils.AccountManagerUtils;
|
||||
import ru.vtosters.lite.utils.AndroidUtils;
|
||||
@@ -27,7 +28,7 @@ public class UsersList {
|
||||
public static void getUsersList() {
|
||||
var prefs = AndroidUtils.getGlobalContext().getSharedPreferences("vt_another_data", 0);
|
||||
|
||||
if ((!NetworkUtils.isNetworkConnected() || NetworkUtils.isInternetSlow()) && prefs.contains("ids") || getBoolValue("serverFeaturesDisable", false)) {
|
||||
if ((!NetworkUtils.isNetworkConnected() || NetworkUtils.isInternetSlow()) && prefs.contains("ids") || Preferences.serverFeaturesDisable()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,9 @@ package ru.vtosters.lite.ui.fragments;
|
||||
import android.os.Bundle;
|
||||
import androidx.preference.Preference;
|
||||
import com.vtosters.lite.R;
|
||||
import ru.vtosters.hooks.other.Preferences;
|
||||
|
||||
import static ru.vtosters.hooks.other.Preferences.getBoolValue;
|
||||
import static ru.vtosters.hooks.other.Preferences.offline;
|
||||
|
||||
public class ActivityFragment extends TrackedMaterialPreferenceToolbarFragment {
|
||||
@@ -12,6 +14,7 @@ public class ActivityFragment extends TrackedMaterialPreferenceToolbarFragment {
|
||||
super.onCreate(bundle);
|
||||
addPreferencesFromResource(R.xml.preferences_activity);
|
||||
findPreference("setoffline").setEnabled(offline());
|
||||
findPreference("onlinefixcategory").setVisible(!Preferences.serverFeaturesDisable());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -67,6 +67,13 @@ public class InterfaceFragment extends TrackedMaterialPreferenceToolbarFragment
|
||||
findPreference("showmenu").setVisible(false);
|
||||
}
|
||||
|
||||
var tablet = findPreference("disableForceTabletMode");
|
||||
tablet.setVisible(AndroidUtils.isTablet());
|
||||
tablet.setOnPreferenceClickListener(preference -> {
|
||||
LifecycleUtils.restartApplicationWithTimer();
|
||||
return true;
|
||||
});
|
||||
|
||||
findPreference("customrounding").setOnPreferenceClickListener(preference -> {
|
||||
RoundingSeekbarDialog.dialog(getContext());
|
||||
return true;
|
||||
|
||||
@@ -112,9 +112,9 @@ public class OtherFragment extends TrackedMaterialPreferenceToolbarFragment {
|
||||
return true;
|
||||
});
|
||||
|
||||
findPreference("VT_Verification").setVisible(!getBoolValue("serverFeaturesDisable", false));
|
||||
findPreference("VT_Fire").setVisible(!getBoolValue("serverFeaturesDisable", false));
|
||||
findPreference("updateverifdata").setVisible(!getBoolValue("serverFeaturesDisable", false));
|
||||
findPreference("VT_Verification").setVisible(!Preferences.serverFeaturesDisable());
|
||||
findPreference("VT_Fire").setVisible(!Preferences.serverFeaturesDisable());
|
||||
findPreference("updateverifdata").setVisible(!Preferences.serverFeaturesDisable());
|
||||
|
||||
var vkAdminTokenPref = findPreference("vk_admin_token");
|
||||
vkAdminTokenPref.setVisible(Preferences.getPreferences().getBoolean("new_music_downloading_way", false));
|
||||
|
||||
@@ -12,13 +12,14 @@ import android.content.res.Resources;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.provider.Settings;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.StringRes;
|
||||
import androidx.core.app.NotificationManagerCompat;
|
||||
import com.vk.core.util.Screen;
|
||||
import com.vk.core.util.ToastUtils;
|
||||
import com.vtosters.lite.general.fragments.WebViewFragment;
|
||||
import ru.vtosters.hooks.other.Preferences;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
@@ -32,6 +33,12 @@ import java.util.Random;
|
||||
|
||||
public class AndroidUtils {
|
||||
private static final String ALLOWED_CHARACTERS = "0123456789qwertyuiopasdfghjklzxcvbnm";
|
||||
public enum ScreenSize {
|
||||
small,
|
||||
normal,
|
||||
large,
|
||||
xlarge
|
||||
}
|
||||
|
||||
public static boolean isDebuggable() {
|
||||
return 0 != (AndroidUtils.getGlobalContext().getApplicationInfo().flags & ApplicationInfo.FLAG_DEBUGGABLE);
|
||||
@@ -44,7 +51,8 @@ public class AndroidUtils {
|
||||
}
|
||||
|
||||
public static boolean isTablet() {
|
||||
return Screen.l(getGlobalContext());
|
||||
String string = getGlobalContext().getResources().getString(b.h.g.d.screen_size);
|
||||
return TextUtils.equals(string, ScreenSize.large.name()) || TextUtils.equals(string, ScreenSize.xlarge.name());
|
||||
}
|
||||
|
||||
@NonNull
|
||||
|
||||
@@ -3,6 +3,7 @@ package ru.vtosters.lite.utils;
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
import ru.vtosters.hooks.other.Preferences;
|
||||
|
||||
import static ru.vtosters.lite.foaf.FoafBase.getBypassedOnlineInfo;
|
||||
|
||||
@@ -13,7 +14,7 @@ public class OnlineBypass {
|
||||
return json;
|
||||
}
|
||||
var onlineinfo = json.optJSONObject("online_info");
|
||||
if (onlineinfo != null && !onlineinfo.optBoolean("visible")) {
|
||||
if (onlineinfo != null && !onlineinfo.optBoolean("visible") && !Preferences.serverFeaturesDisable()) {
|
||||
var bypassed = getBypassedOnlineInfo(id);
|
||||
if (bypassed.optInt("last_seen", 0) != 0) {
|
||||
json.remove("online_info");
|
||||
@@ -37,7 +38,7 @@ public class OnlineBypass {
|
||||
}
|
||||
|
||||
public static JSONArray setOnlineInfoUsers(JSONArray profiles) throws JSONException {
|
||||
if (profiles == null || profiles.length() == 0) return profiles;
|
||||
if (profiles == null || profiles.length() == 0 || Preferences.serverFeaturesDisable()) return profiles;
|
||||
StringBuilder sb = new StringBuilder();
|
||||
var curVkId = AccountManagerUtils.getUserId();
|
||||
for (int i = 0; i < profiles.length(); i++) {
|
||||
@@ -51,7 +52,7 @@ public class OnlineBypass {
|
||||
sb.append(",");
|
||||
}
|
||||
var ids = sb.toString();
|
||||
if (ids.length() > 0) {
|
||||
if (!ids.isEmpty()) {
|
||||
ids = ids.substring(0, ids.length() - 1);
|
||||
} else {
|
||||
return profiles;
|
||||
|
||||
@@ -7,6 +7,7 @@ import okhttp3.*;
|
||||
import org.json.JSONArray;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
import ru.vtosters.hooks.other.Preferences;
|
||||
import ru.vtosters.lite.di.singleton.VtOkHttpClient;
|
||||
|
||||
import java.io.IOException;
|
||||
@@ -31,7 +32,7 @@ public class VTVerifications {
|
||||
return;
|
||||
}
|
||||
|
||||
if ((!NetworkUtils.isNetworkConnected() && NetworkUtils.isInternetSlow() || getBoolValue("isRoamingState", false)) && prefs.contains("ids") || getBoolValue("serverFeaturesDisable", false)) {
|
||||
if ((!NetworkUtils.isNetworkConnected() && NetworkUtils.isInternetSlow() || getBoolValue("isRoamingState", false)) && prefs.contains("ids") || Preferences.serverFeaturesDisable()) {
|
||||
parseJson(prefs.getString("ids", "[]"));
|
||||
Log.d("VTVerifications", "load from memory. Roaming or Network issues");
|
||||
isLoaded = true;
|
||||
|
||||
+1
-1
@@ -25,5 +25,5 @@ usesFramework:
|
||||
tag: null
|
||||
version: 2.6.0
|
||||
versionInfo:
|
||||
versionCode: '4838'
|
||||
versionCode: '4839'
|
||||
versionName: 5.56.1
|
||||
|
||||
@@ -6311,7 +6311,7 @@
|
||||
<string name="friendsblock_title">Схаваць сяброў</string>
|
||||
<string name="friendsblock_summ">Схаваць блок рэкамендацый сяброў у сябрах</string>
|
||||
<string name="onlineformatter_title">Пашыраны анлайн</string>
|
||||
<string name="onlineformatter_summ">Паказваць з якога прыкладання/кліента чалавек у анлайне</string>
|
||||
<string name="onlineformatter_summ">Паказваць з якога прыкладання/кліента чалавек у анлайне\n\nНапрыклад: Онлайн З дапамогай Kate Mobile</string>
|
||||
<string name="voices_vtl">Галасавыя паведамленні</string>
|
||||
<string name="disable_voice_listening_summ">Функцыя дазваляе не адпраўляць статут праслухоўвання галасавых
|
||||
паведамленняў чалавека вамі
|
||||
|
||||
@@ -5640,7 +5640,7 @@
|
||||
<string name="friendsblock_title">Скрыть друзей</string>
|
||||
<string name="friendsblock_summ">Скрыть блок рекомендаций друзей в друзьях</string>
|
||||
<string name="onlineformatter_title">Расширенный онлайн</string>
|
||||
<string name="onlineformatter_summ">Показывать с какого приложения/клиента человек в онлайне</string>
|
||||
<string name="onlineformatter_summ">Показывать с какого приложения/клиента человек в онлайне\n\nНапример: Онлайн с помощью Kate Mobile</string>
|
||||
<string name="voices_vtl">Голосовые сообщения</string>
|
||||
<string name="disable_voice_listening_summ">Функция позволяет не отправлять статус прослушивания голосовых сообщений человека вами</string>
|
||||
<string name="listen_v_title">Отключить статус прослушивания</string>
|
||||
|
||||
@@ -5567,7 +5567,7 @@
|
||||
<string name="friendsblock_title">Приховати друзів</string>
|
||||
<string name="friendsblock_summ">Приховати блок рекомендацій друзів у друзях</string>
|
||||
<string name="onlineformatter_title">Розширений онлайн</string>
|
||||
<string name="onlineformatter_summ">Показувати з якого додатка/клієнта людина в онлайні</string>
|
||||
<string name="onlineformatter_summ">Показувати з якого додатка/клієнта людина в онлайні\n\nНаприклад: Онлайн за допомогою Kate Mobile</string>
|
||||
<string name="voices_vtl">Голосові повідомлення</string>
|
||||
<string name="disable_voice_listening_summ">Функція дозволяє не надсилати статус прослуховування голосових повідомлень вами</string>
|
||||
<string name="listen_v_title">Вимкнути статус прослуховування</string>
|
||||
|
||||
@@ -5774,7 +5774,7 @@ You need to restart the application to apply proxy settings"</string>
|
||||
<string name="friendsblock_title">Hide friends</string>
|
||||
<string name="friendsblock_summ">Hide the block of recommendations of friends in friends section</string>
|
||||
<string name="onlineformatter_title">Extended online indicator</string>
|
||||
<string name="onlineformatter_summ">Show what app/device a person is online from</string>
|
||||
<string name="onlineformatter_summ">Show what app/device a person is online from\n\nFor example: Online using Kate Mobile</string>
|
||||
<string name="voices_vtl">Voice messages</string>
|
||||
<string name="disable_voice_listening_summ">The function allows you not to send the status of listening to the person\'s voice messages by you</string>
|
||||
<string name="listen_v_title">Disable listening status</string>
|
||||
|
||||
@@ -92,7 +92,7 @@
|
||||
android:key="listen_v"
|
||||
android:title="@string/listen_v_title"/>
|
||||
</PreferenceCategory>
|
||||
<PreferenceCategory android:title="@string/vkme_online_vtl">
|
||||
<PreferenceCategory android:title="@string/vkme_online_vtl" android:key="onlinefixcategory">
|
||||
<com.vtosters.lite.ui.MaterialSwitchPreference
|
||||
android:defaultValue="false"
|
||||
android:key="onlinefix"
|
||||
|
||||
@@ -94,6 +94,11 @@
|
||||
android:key="pollresults"
|
||||
android:summary="@string/pollresults_summ"
|
||||
android:title="@string/pollresults_title"/>
|
||||
<com.vtosters.lite.ui.MaterialSwitchPreference
|
||||
android:defaultValue="false"
|
||||
android:key="disableForceTabletMode"
|
||||
android:summary="Отключает интерфейс для планшетов и возвращает докбар"
|
||||
android:title="Отключить режим планшета"/>
|
||||
<com.vtosters.lite.ui.MaterialSwitchPreference
|
||||
android:defaultValue="false"
|
||||
android:key="friendsblock"
|
||||
|
||||
@@ -1088,31 +1088,10 @@
|
||||
.end annotation
|
||||
.end param
|
||||
|
||||
.line 1
|
||||
invoke-static {p0}, Lcom/vk/core/util/Screen;->f(Landroid/content/Context;)Lcom/vk/core/util/Screen$ScreenSize;
|
||||
|
||||
move-result-object p0
|
||||
|
||||
invoke-virtual {p0}, Ljava/lang/Enum;->ordinal()I
|
||||
invoke-static {}, Lru/vtosters/hooks/TabletHook;->hook()Z
|
||||
|
||||
move-result p0
|
||||
|
||||
sget-object v0, Lcom/vk/core/util/Screen$ScreenSize;->normal:Lcom/vk/core/util/Screen$ScreenSize;
|
||||
|
||||
invoke-virtual {v0}, Ljava/lang/Enum;->ordinal()I
|
||||
|
||||
move-result v0
|
||||
|
||||
if-le p0, v0, :cond_0
|
||||
|
||||
const/4 p0, 0x1
|
||||
|
||||
goto :goto_0
|
||||
|
||||
:cond_0
|
||||
const/4 p0, 0x0
|
||||
|
||||
:goto_0
|
||||
return p0
|
||||
.end method
|
||||
|
||||
|
||||
Reference in New Issue
Block a user