fixed profile hiding

This commit is contained in:
Vologhat
2022-07-05 20:43:20 +03:00
parent f224645c9c
commit bf3dab1585
2 changed files with 56 additions and 25 deletions
@@ -78,7 +78,6 @@ public class VTVerifications{
private static void parseJson(String payload){
try {
var json = new JSONObject(payload);
Log.d("VTVerifications", payload);
processIds(json.optJSONArray("0"), sVerifications);
processIds(json.optJSONArray("228"), sPrometheuses);
processIds(json.optJSONArray("404"), sDevelopers);
@@ -1,63 +1,95 @@
package ru.vtosters.lite.utils;
import static ru.vtosters.lite.utils.Globals.*;
import static ru.vtosters.lite.utils.Globals.getContext;
import static ru.vtosters.lite.utils.Globals.getIdentifier;
import static ru.vtosters.lite.utils.Globals.getUserID;
import static ru.vtosters.lite.utils.Globals.getUserId;
import android.text.TextUtils;
import android.util.Log;
import com.vk.profile.presenter.UserPresenter;
import com.vtosters.lite.api.ExtendedUserProfile;
import com.vtosters.lite.fragments.messages.chat.vc.MsgSendVc;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.IOException;
import java.lang.reflect.Field;
import java.util.HashMap;
import okhttp3.HttpUrl;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import ru.vtosters.lite.f0x1d.VTVerifications;
public class ProfileHide{
private static final OkHttpClient client = new OkHttpClient();
// Jesus cries
public class ProfileHide {
private static final OkHttpClient mClient = new OkHttpClient();
public static void injectMap(HashMap<Integer, UserPresenter.a.a> hashMap) {
for (int i = 0; VTVerifications.sServiceAccounts.get(i) < 0; i++) {
boolean valueOf = VTVerifications.sServiceAccounts.equals(getUserId());
if (valueOf) {
hashMap.put(100, new UserPresenter.a.a(getIdentifier("service_account_admin_100_info", "string"), getIdentifier("service_account_admin_100", "color"), getIdentifier("ic_custom_avatar_id100", "drawable")));
hashMap.put(101, new UserPresenter.a.a(getIdentifier("service_account_admin_101_info", "string"), getIdentifier("service_account_admin_101", "color"), getIdentifier("ic_custom_avatar_id101", "drawable")));
hashMap.put(333, new UserPresenter.a.a(getIdentifier("service_account_mobile_info", "string"), getIdentifier("service_account_admin_333", "color"), getIdentifier("ic_custom_avatar_id333", "drawable")));
}
if (VTVerifications.isServiceAccount(getUserId())) {
hashMap.put(100, makeSecond(
"service_account_admin_100_info",
"service_account_admin_100",
"ic_custom_avatar_id100")
);
hashMap.put(101, makeSecond(
"service_account_admin_101_info",
"service_account_admin_101",
"ic_custom_avatar_id101")
);
hashMap.put(333, makeSecond(
"service_account_mobile_info",
"service_account_admin_333",
"ic_custom_avatar_id333")
);
}
}
private static UserPresenter.a.a makeSecond(String stringRes, String colorRes, String drawableRes) {
return new UserPresenter.a.a(
getIdentifier(stringRes, "string"),
getIdentifier(colorRes, "color"),
getIdentifier(drawableRes, "drawable")
);
}
public static void fetchInfo(ExtendedUserProfile extendedUserProfile) {
int userID = getUserID(extendedUserProfile.a);
if (VTVerifications.sServiceAccounts.equals(userID)) {
Request.a builder = new Request.a();
if (VTVerifications.isServiceAccount(userID)) {
Request request = new Request.a()
.b("https://sf.vknext.net/block_text?user_id=" + userID)
.a();
try {
String string = new JSONObject(client.a(builder.a(HttpUrl.e("https://sf.vknext.net/block_text?user_id=" + userID)).a()).execute().c().a().g()).getJSONObject(MsgSendVc.d0).getString("response");
if (!string.equals("")) {
ExtendedUserProfile.class.getDeclaredField("z2").set(extendedUserProfile, string);
JSONObject payload = new JSONObject(mClient.a(request)
.execute()
.c()
.a()
.g());
String response = payload.optJSONObject(MsgSendVc.d0).optString("response");
if (!response.isEmpty()) {
Field z2 = ExtendedUserProfile.class.getDeclaredField("z2");
z2.setAccessible(true);
z2.set(extendedUserProfile, response);
}
} catch (Exception e) {
} catch (IOException | JSONException | NoSuchFieldException | IllegalAccessException e) {
e.printStackTrace();
} catch (NullPointerException e) {
Log.e("ProfileHide", "null \"profiles\" node\n" + e);
}
}
}
public static String getInfo(ExtendedUserProfile extendedUserProfile) {
int userID = getUserID(extendedUserProfile);
if (VTVerifications.sServiceAccounts.equals(userID)) {
if (VTVerifications.isServiceAccount(userID)) {
try {
String str = (String) ExtendedUserProfile.class.getDeclaredField("z2").get(extendedUserProfile);
if (!TextUtils.equals(str, "") && str != null) {
return str;
}
} catch (Exception e) {
Field z2 = ExtendedUserProfile.class.getDeclaredField("z2");
z2.setAccessible(true);
String val = (String) z2.get(extendedUserProfile);
if (val != null && !val.isEmpty())
return val;
} catch (NoSuchFieldException | IllegalAccessException e) {
e.printStackTrace();
}
}