added vkn online fix disabler
This commit is contained in:
@@ -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"));
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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));
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user