superapp editor test
This commit is contained in:
@@ -89,7 +89,7 @@ public class EncryptProvider{
|
||||
|
||||
String msgBody = getBody(msg);
|
||||
|
||||
Log.d("EncryptProvider", "encryptMessage: msg = " + msg.toString());
|
||||
Log.d("EncryptProvider", "encryptMessage: msg = " + msg);
|
||||
Log.d("EncryptProvider", "encryptMessage: body = " + msgBody);
|
||||
Log.d("EncryptProvider", "encryptMessage: peerId = " + getPeerId(msg));
|
||||
|
||||
|
||||
@@ -23,7 +23,8 @@ public class VTostersAESProcessor extends IMProcessor{
|
||||
private final static String CIPHER_INSTANCE = "AES/CBC/PKCS7Padding";
|
||||
private final static String KEY_METHOD = "AES";
|
||||
|
||||
private HashMap<byte[], Cipher> decodeMap = new HashMap<>(), encodeMap = new HashMap<>();
|
||||
private final HashMap<byte[], Cipher> decodeMap = new HashMap<>();
|
||||
private final HashMap<byte[], Cipher> encodeMap = new HashMap<>();
|
||||
|
||||
public void free(byte[] key){
|
||||
decodeMap.remove(key);
|
||||
|
||||
@@ -26,20 +26,18 @@ import okhttp3.RequestBody;
|
||||
import okhttp3.Response;
|
||||
import ru.vtosters.lite.utils.Globals;
|
||||
|
||||
public class VTVerifications {
|
||||
private static List<Integer> sVerifications = new ArrayList<>();
|
||||
private static List<Integer> sPrometheuses = new ArrayList<>();
|
||||
private static List<Integer> sDevelopers = new ArrayList<>();
|
||||
private static List<Integer> sServiceAccounts = new ArrayList<>();
|
||||
|
||||
public class VTVerifications{
|
||||
private static final OkHttpClient sClient = new OkHttpClient();
|
||||
|
||||
private static final List<Integer> sVerifications = new ArrayList<>();
|
||||
private static final List<Integer> sPrometheuses = new ArrayList<>();
|
||||
private static final List<Integer> sDevelopers = new ArrayList<>();
|
||||
private static final List<Integer> sServiceAccounts = new ArrayList<>();
|
||||
private static SharedPreferences sVerificationsPrefs;
|
||||
|
||||
public static void load(Context context){
|
||||
sVerificationsPrefs = context.getSharedPreferences("vt_another_data", 0);
|
||||
|
||||
if (!Globals.isNetworkConnected() && sVerificationsPrefs.contains("ids")) {
|
||||
if(!Globals.isNetworkConnected() && sVerificationsPrefs.contains("ids")){
|
||||
parseJson(sVerificationsPrefs.getString("ids", "[]"));
|
||||
return;
|
||||
}
|
||||
@@ -63,7 +61,7 @@ public class VTVerifications {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void a(Call call, IOException e) {
|
||||
public void a(Call call, IOException e){
|
||||
Log.d("VTVerifications", "" + e);
|
||||
}
|
||||
|
||||
@@ -74,8 +72,9 @@ public class VTVerifications {
|
||||
* 0 - Verifications
|
||||
* 228 - Prometheus
|
||||
* 404 - Developer
|
||||
* 1337 - Service account*/
|
||||
private static void parseJson(String payload) {
|
||||
* 1337 - Service account
|
||||
*/
|
||||
private static void parseJson(String payload){
|
||||
try {
|
||||
var json = new JSONObject(payload);
|
||||
|
||||
@@ -88,11 +87,11 @@ public class VTVerifications {
|
||||
}
|
||||
}
|
||||
|
||||
private static void processIds(JSONArray jsonIds, List<Integer> member) {
|
||||
if (jsonIds == null || jsonIds.length() == 0)
|
||||
private static void processIds(JSONArray jsonIds, List<Integer> member){
|
||||
if(jsonIds == null || jsonIds.length() == 0)
|
||||
return;
|
||||
|
||||
for (int i = 0; i < jsonIds.length(); i++)
|
||||
for(int i = 0; i < jsonIds.length(); i++)
|
||||
member.add(jsonIds.optInt(i));
|
||||
}
|
||||
|
||||
@@ -112,52 +111,52 @@ public class VTVerifications {
|
||||
return sServiceAccounts.contains(i);
|
||||
}
|
||||
|
||||
public static boolean vtverif() {
|
||||
public static boolean vtverif(){
|
||||
return getBoolValue("VT_Verification", true);
|
||||
}
|
||||
|
||||
private static int getId(JSONObject json) {
|
||||
private static int getId(JSONObject json){
|
||||
var id = json.optInt("id", 0);
|
||||
if (!json.optString(NavigatorKeys.e).equals("group") && !json.optString(NavigatorKeys.e).equals("page")
|
||||
if(!json.optString(NavigatorKeys.e).equals("group") && !json.optString(NavigatorKeys.e).equals("page")
|
||||
|| json.optString(NavigatorKeys.e) == null)
|
||||
return id;
|
||||
else
|
||||
return -id;
|
||||
}
|
||||
|
||||
public static boolean isVerified(JSONObject jSONObject) {
|
||||
if (jSONObject.optInt("verified", 0) == 1) {
|
||||
public static boolean isVerified(JSONObject jSONObject){
|
||||
if(jSONObject.optInt("verified", 0) == 1){
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!getBoolValue("VT_Verification", true)) {
|
||||
if(!getBoolValue("VT_Verification", true)){
|
||||
return false;
|
||||
}
|
||||
|
||||
return isVerified(getId(jSONObject));
|
||||
}
|
||||
|
||||
public static boolean hasPrometheus(JSONObject jSONObject) {
|
||||
if (jSONObject.optInt("trending", 0) == 1) {
|
||||
public static boolean hasPrometheus(JSONObject jSONObject){
|
||||
if(jSONObject.optInt("trending", 0) == 1){
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!getBoolValue("VT_Fire", true)) {
|
||||
if(!getBoolValue("VT_Fire", true)){
|
||||
return false;
|
||||
}
|
||||
|
||||
return isPrometheus(getId(jSONObject));
|
||||
}
|
||||
|
||||
public static boolean hasDeveloper(JSONObject jSONObject) {
|
||||
if (!getBoolValue("VT_Dev", true)) {
|
||||
public static boolean hasDeveloper(JSONObject jSONObject){
|
||||
if(!getBoolValue("VT_Dev", true)){
|
||||
return false;
|
||||
}
|
||||
|
||||
return isDeveloper(getId(jSONObject));
|
||||
}
|
||||
|
||||
public static VerifyInfo VerifyInfo(JSONObject jSONObject) {
|
||||
public static VerifyInfo VerifyInfo(JSONObject jSONObject){
|
||||
return new VerifyInfo(isVerified(jSONObject), hasPrometheus(jSONObject));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,8 +27,8 @@ public class Request{
|
||||
private static class MakeRequestTask extends AsyncTask<Void, Void, String>{
|
||||
private final RequestCallback callback;
|
||||
private final byte[] url;
|
||||
private boolean mIsPut;
|
||||
private boolean mIsVTostersRequest;
|
||||
private final boolean mIsPut;
|
||||
private final boolean mIsVTostersRequest;
|
||||
|
||||
public MakeRequestTask(byte[] bArr, RequestCallback RequestCallback){
|
||||
mIsVTostersRequest = false;
|
||||
|
||||
@@ -10,9 +10,9 @@ import ru.vtosters.lite.utils.OTAHelper;
|
||||
|
||||
public class OTADialog implements OTAHelper.OTAListener{
|
||||
|
||||
private Activity mActivity;
|
||||
private final Activity mActivity;
|
||||
|
||||
private OTAHelper mHelper;
|
||||
private final OTAHelper mHelper;
|
||||
|
||||
public OTADialog(Activity activity){
|
||||
mActivity = activity;
|
||||
|
||||
@@ -2,11 +2,14 @@ package ru.vtosters.lite.ui.fragments;
|
||||
|
||||
import static bruhcollective.itaysonlab.libvkx.client.LibVKXClient.isIntegrationEnabled;
|
||||
import static ru.vtosters.lite.f0x1d.VTVerifications.vtverif;
|
||||
import static ru.vtosters.lite.ui.vkui.VBListBuilder.VBListItem;
|
||||
import static ru.vtosters.lite.ui.vkui.VBListBuilder.buildListOf;
|
||||
import static ru.vtosters.lite.ui.vkui.VBottomSheetBuilder.VBSContent;
|
||||
import static ru.vtosters.lite.utils.About.getBuildNumber;
|
||||
import static ru.vtosters.lite.utils.About.getCommitLink;
|
||||
import static ru.vtosters.lite.utils.CacheUtils.humanReadableByteCountBin;
|
||||
import static ru.vtosters.lite.utils.Globals.getAvatarDrawable;
|
||||
import static ru.vtosters.lite.utils.Globals.edit;
|
||||
import static ru.vtosters.lite.utils.Globals.getAvatarDrawable;
|
||||
import static ru.vtosters.lite.utils.Globals.getIdentifier;
|
||||
import static ru.vtosters.lite.utils.Globals.getPrefsValue;
|
||||
import static ru.vtosters.lite.utils.Globals.getUserPhoto;
|
||||
@@ -50,11 +53,15 @@ import com.vtosters.lite.general.fragments.MaterialPreferenceToolbarFragment;
|
||||
import com.vtosters.lite.general.fragments.SettingsAccountFragment;
|
||||
import com.vtosters.lite.general.fragments.SettingsGeneralFragment;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import ru.vtosters.lite.ui.PreferencesUtil;
|
||||
import ru.vtosters.lite.ui.dialogs.OTADialog;
|
||||
import ru.vtosters.lite.ui.fragments.dockbar.DockBarFragment;
|
||||
import ru.vtosters.lite.ui.fragments.dockbar.DockBarManager;
|
||||
import ru.vtosters.lite.ui.fragments.tgstickers.StickersFragment;
|
||||
import ru.vtosters.lite.ui.vkui.VBottomSheetBuilder;
|
||||
import ru.vtosters.lite.utils.CacheUtils;
|
||||
import ru.vtosters.lite.utils.Globals;
|
||||
import ru.vtosters.lite.utils.SSFS;
|
||||
@@ -374,6 +381,44 @@ public class VTSettings extends MaterialPreferenceToolbarFragment{
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
||||
PreferencesUtil.addPreference(this, "p1", "Настроить скрытие пунктов меню", null, null, (preference) -> {
|
||||
callEditorPopup();
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
||||
private void callEditorPopup(){
|
||||
List<VBListItem> list = Arrays.asList(
|
||||
new VBListItem("promo", "Mini Apps: промо"),
|
||||
new VBListItem("miniapps", "Mini Apps: виджет"),
|
||||
new VBListItem("vkpay_slim", "VK Pay"),
|
||||
new VBListItem("greeting", "Приветствие"),
|
||||
new VBListItem("holiday", "Дни рождения у друзей"),
|
||||
new VBListItem("weather", "Погода"),
|
||||
new VBListItem("sport", "Спортивные события"),
|
||||
new VBListItem("games", "Игры"),
|
||||
new VBListItem("informer", "Информер"),
|
||||
new VBListItem("food", "Еда"),
|
||||
new VBListItem("event", "Мероприятия"),
|
||||
new VBListItem("music", "Музыка"),
|
||||
new VBListItem("vk_run", "VK Run")
|
||||
);
|
||||
|
||||
VBottomSheetBuilder.show(getActivity(), new VBSContent(
|
||||
null,
|
||||
null,
|
||||
buildListOf(getActivity(), list),
|
||||
|
||||
new VBSContent.VBSButton(
|
||||
"Сохранить",
|
||||
() -> {
|
||||
for(VBListItem item : list) {
|
||||
edit().putBoolean("superapp_" + item.id, item.checked).commit();
|
||||
}
|
||||
}
|
||||
)
|
||||
));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package ru.vtosters.lite.ui.vkui;
|
||||
|
||||
import static ru.vtosters.lite.utils.Globals.getString;
|
||||
import static ru.vtosters.lite.utils.Themes.getTextAttr;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.graphics.Typeface;
|
||||
@@ -11,7 +12,6 @@ import android.widget.TextView;
|
||||
import com.vk.core.dialogs.bottomsheet.ModalBottomSheet;
|
||||
|
||||
import ru.vtosters.lite.utils.Globals;
|
||||
import ru.vtosters.lite.utils.Themes;
|
||||
|
||||
public class ModalBottomSheetWrapper{
|
||||
public final ModalBottomSheet.a builder;
|
||||
@@ -37,13 +37,13 @@ public class ModalBottomSheetWrapper{
|
||||
title.setTypeface(title.getTypeface(), Typeface.BOLD);
|
||||
title.setSingleLine(true);
|
||||
title.setTextAlignment(View.TEXT_ALIGNMENT_CENTER);
|
||||
title.setTextColor(Themes.getTextAttr());
|
||||
title.setTextColor(getTextAttr());
|
||||
title.setTextSize(24.0f);
|
||||
container.addView(title, new LinearLayout.LayoutParams(-1, -2));
|
||||
|
||||
changelogView.setPadding(0, Globals.convertDpToPixel(8), 0, 0);
|
||||
changelogView.setText(getString("changelog") + ": \n" + changelog);
|
||||
changelogView.setTextColor(Themes.getTextAttr());
|
||||
changelogView.setTextColor(getTextAttr());
|
||||
container.addView(changelogView, new LinearLayout.LayoutParams(-1, -2));
|
||||
|
||||
builder.a(container);
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
package ru.vtosters.lite.ui.vkui;
|
||||
import static ru.vtosters.lite.utils.Globals.convertDpToPixel;
|
||||
import static ru.vtosters.lite.utils.Preferences.getBoolValue;
|
||||
import static ru.vtosters.lite.utils.Themes.getTextAttr;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.TypedValue;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.LinearLayout;
|
||||
|
||||
import androidx.appcompat.widget.AppCompatCheckBox;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class VBListBuilder{
|
||||
public static ViewGroup buildListOf(Context ctx, List<VBListItem> items){
|
||||
LinearLayout mainView = new LinearLayout(ctx);
|
||||
mainView.setOrientation(LinearLayout.VERTICAL);
|
||||
mainView.setPadding(convertDpToPixel(8f), 0, convertDpToPixel(8f), 0);
|
||||
|
||||
for(VBListItem item : items) {
|
||||
AppCompatCheckBox mcb = new AppCompatCheckBox(ctx, null);
|
||||
mcb.setPadding(0, convertDpToPixel(8f), 0, convertDpToPixel(8f));
|
||||
|
||||
mcb.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14f);
|
||||
mcb.setTextColor(getTextAttr());
|
||||
|
||||
mcb.setChecked(item.checked);
|
||||
mcb.setText(item.title);
|
||||
|
||||
mcb.setOnCheckedChangeListener((buttonView, isChecked) -> {
|
||||
item.checked = isChecked;
|
||||
});
|
||||
|
||||
mainView.addView(mcb);
|
||||
}
|
||||
|
||||
return mainView;
|
||||
}
|
||||
|
||||
public static class VBListItem{
|
||||
public String id;
|
||||
public String title;
|
||||
public boolean checked;
|
||||
|
||||
public VBListItem(String id, String title){
|
||||
this(id, title, getBoolValue("superapp_" + id, false));
|
||||
}
|
||||
|
||||
public VBListItem(String id, String title, boolean checked){
|
||||
this.id = id;
|
||||
this.title = title;
|
||||
this.checked = checked;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
package ru.vtosters.lite.ui.vkui;
|
||||
import android.app.Activity;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
public class VBottomSheetBuilder{
|
||||
public static void show(Activity activity, VBSContent content){
|
||||
ModalBottomSheetWrapper builder = new ModalBottomSheetWrapper(activity);
|
||||
|
||||
builder.setView(content.view);
|
||||
|
||||
builder.setPositiveButton(content.button.title, () -> {
|
||||
// Button OnClick
|
||||
new Handler(Looper.getMainLooper()).post(content.button.action);
|
||||
}); // Positive
|
||||
|
||||
builder.show(); // Build+Show
|
||||
}
|
||||
|
||||
public static class VBSContent{
|
||||
public String title;
|
||||
@Nullable
|
||||
public String subtitle;
|
||||
public View view;
|
||||
public VBSButton button;
|
||||
|
||||
public VBSContent(String title, @Nullable String subtitle, View view, VBSButton button){
|
||||
this.title = title;
|
||||
this.subtitle = subtitle;
|
||||
this.view = view;
|
||||
this.button = button;
|
||||
}
|
||||
|
||||
public static class VBSButton{
|
||||
public String title;
|
||||
public Runnable action;
|
||||
|
||||
public VBSButton(String title, Runnable action){
|
||||
this.title = title;
|
||||
this.action = action;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -87,11 +87,11 @@ public class Globals{
|
||||
// VKIDProtection.alert(activity);
|
||||
}
|
||||
|
||||
public static byte[] readFileFully(File file) throws IOException {
|
||||
public static byte[] readFileFully(File file) throws IOException{
|
||||
return readFully(new FileInputStream(file));
|
||||
}
|
||||
|
||||
public static byte[] readFully(InputStream is) throws IOException {
|
||||
public static byte[] readFully(InputStream is) throws IOException{
|
||||
ByteArrayOutputStream bos = new ByteArrayOutputStream();
|
||||
|
||||
byte[] buffer = new byte[BUFFER_SIZE];
|
||||
|
||||
@@ -3,7 +3,9 @@ package ru.vtosters.lite.utils;
|
||||
import static ru.vtosters.lite.f0x1d.VTVerifications.isPrometheus;
|
||||
import static ru.vtosters.lite.f0x1d.VTVerifications.isDeveloper;
|
||||
import static ru.vtosters.lite.f0x1d.VTVerifications.isVerified;
|
||||
import static ru.vtosters.lite.utils.Preferences.getBoolValue;
|
||||
import static ru.vtosters.lite.utils.Preferences.hasVerification;
|
||||
import static ru.vtosters.lite.utils.Preferences.preferences;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
@@ -70,38 +72,12 @@ public class JsonInjectors{
|
||||
if(Items != null) {
|
||||
for(int i = 0; i < Items.length(); i++){
|
||||
var items = Items.optJSONObject(i);
|
||||
var types = items.optString("type");
|
||||
var type = items.optString("type");
|
||||
|
||||
switch(types){
|
||||
case "promo":
|
||||
Items.remove(i);
|
||||
case "vkpay_slim":
|
||||
Items.remove(i);
|
||||
case "greeting":
|
||||
Items.remove(i);
|
||||
case "sport":
|
||||
Items.remove(i);
|
||||
case "games":
|
||||
Items.remove(i);
|
||||
case "miniapps":
|
||||
Items.remove(i);
|
||||
case "informer":
|
||||
Items.remove(i);
|
||||
case "holiday":
|
||||
Items.remove(i);
|
||||
case "vk_run":
|
||||
Items.remove(i);
|
||||
case "weather":
|
||||
Items.remove(i);
|
||||
case "food":
|
||||
Items.remove(i);
|
||||
case "event":
|
||||
Items.remove(i);
|
||||
case "birthdays":
|
||||
Items.remove(i);
|
||||
case "music":
|
||||
Items.remove(i);
|
||||
if(getBoolValue("superapp_" + type, false)){
|
||||
Items.remove(i);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -116,9 +116,7 @@ public class Newsfeed{
|
||||
|
||||
if(isGroupAds(obj)) return false;
|
||||
|
||||
if(injectFiltersReposts(obj)) return false;
|
||||
|
||||
return true;
|
||||
return !injectFiltersReposts(obj);
|
||||
}
|
||||
|
||||
public static boolean injectFiltersReposts(JSONObject obj){
|
||||
|
||||
@@ -18,7 +18,7 @@ public class OTAHelper{
|
||||
private static final String LATEST_RELEASE_URL = "https://api.github.com/repositories/473685743/releases/latest";
|
||||
private static final String LATEST_RELEASE_COMMIT_URL = "https://api.github.com/repositories/473685743/git/ref/tags/%s";
|
||||
private final OkHttpClient mClient = new OkHttpClient();
|
||||
private OTAListener mListener;
|
||||
private final OTAListener mListener;
|
||||
private JSONObject mReleaseJson;
|
||||
private JSONObject mCommitJson;
|
||||
|
||||
|
||||
@@ -11,8 +11,8 @@ import com.vk.toggle.FeatureManager;
|
||||
import com.vk.toggle.Features;
|
||||
|
||||
public class Toggles{
|
||||
public static boolean shouldPatch(Features.Type feature) {
|
||||
switch (feature) {
|
||||
public static boolean shouldPatch(Features.Type feature){
|
||||
switch(feature) {
|
||||
case AB_IM_LONGPOLL_MSG_BATCHING:
|
||||
case AB_IM_LP_ATTACHES:
|
||||
case AB_IM_VIEW_POOL:
|
||||
@@ -123,6 +123,7 @@ public class Toggles{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean redirect(Features.Type feature){
|
||||
switch(feature) {
|
||||
case EXPERIMENT_NEWS_DISABLE_CACHE:
|
||||
|
||||
Reference in New Issue
Block a user