Compare commits
5
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bf4cf2be53 | ||
|
|
aac86a9952 | ||
|
|
ae00e72bac | ||
|
|
fea984f6fd | ||
|
|
d870c2f984 |
@@ -23,14 +23,12 @@ import ru.vtosters.lite.utils.NavigatorUtils;
|
||||
import ru.vtosters.lite.utils.VTVerifications;
|
||||
|
||||
import static ru.vtosters.hooks.other.Preferences.checkupdates;
|
||||
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;
|
||||
|
||||
public class MainActivityInjector {
|
||||
public static void inject(Activity activity) {
|
||||
SystemThemeChangerHook.themeOnStart(activity);
|
||||
sendRequest();
|
||||
UsersList.getUsersList();
|
||||
VTVerifications.load(activity);
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ public class VerificationsHook {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!getBoolValue("VT_Verification", true)) {
|
||||
if (!getBoolValue("VT_Verification", true) || getBoolValue("serverFeaturesDisable", false)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ public class VerificationsHook {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!getBoolValue("VT_Fire", true)) {
|
||||
if (!getBoolValue("VT_Fire", true) || getBoolValue("serverFeaturesDisable", false)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -40,10 +40,6 @@ public class VerificationsHook {
|
||||
}
|
||||
|
||||
public static boolean hasDeveloper(JSONObject jSONObject) {
|
||||
if (!getBoolValue("VT_Dev", true)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return VTVerifications.isDeveloper(VTVerifications.getId(jSONObject));
|
||||
}
|
||||
|
||||
|
||||
@@ -34,43 +34,15 @@ import static ru.vtosters.lite.utils.AndroidUtils.getGlobalContext;
|
||||
|
||||
public class FoafBase {
|
||||
private static final Pattern FOAF_REGEX = Pattern.compile("<ya:created dc:date=\"(.+?)\"");
|
||||
private static final Pattern FOAF_REGEX_LAST_SEEN = Pattern.compile("<ya:lastLoggedIn dc:date=\"(.*)(((\\+|-)\\d\\d):(\\d\\d))\"");
|
||||
private static final String API_VKNEXT = "https://api.vtosters.app/v1/getBypassedOnlineInfo?json=1&ids=";
|
||||
private static final OkHttpClient client = VtOkHttpClient.getInstance();
|
||||
|
||||
public static long getLastSeen(long origtime, int id) throws ParseException {
|
||||
var request = new okhttp3.Request.a()
|
||||
.b(getLink(id))
|
||||
.a(Headers.a("User-Agent", Network.l.c().a(), "Content-Type", "application/x-www-form-urlencoded; charset=utf-8")).a();
|
||||
|
||||
String response = null;
|
||||
|
||||
try {
|
||||
response = client.a(request).execute().a().g();
|
||||
} catch (IOException e) {
|
||||
Log.e("FoafBase", e.getMessage());
|
||||
}
|
||||
|
||||
Matcher matcher = FOAF_REGEX_LAST_SEEN.matcher(response);
|
||||
|
||||
if (!matcher.find()) {
|
||||
return origtime;
|
||||
}
|
||||
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss", Locale.US);
|
||||
sdf.setTimeZone(TimeZone.getTimeZone("Europe/Moscow"));
|
||||
Date date = sdf.parse(Objects.requireNonNull(matcher.group(1)));
|
||||
sdf.setTimeZone(TimeZone.getDefault());
|
||||
return sdf.parse(sdf.format(date)).getTime() / 1000;
|
||||
}
|
||||
|
||||
|
||||
public static JSONObject getBypassedOnlineInfo(int id) throws JSONException {
|
||||
var request = new okhttp3.Request.a()
|
||||
.b(API_VKNEXT + id)
|
||||
.a();
|
||||
|
||||
String response = null;
|
||||
String response;
|
||||
|
||||
var dummy = new JSONObject();
|
||||
dummy.put("last_seen", 0);
|
||||
@@ -86,7 +58,6 @@ public class FoafBase {
|
||||
}
|
||||
|
||||
public static JSONObject getBypassedOnlineInfo(String ids) {
|
||||
|
||||
var request = new okhttp3.Request.a()
|
||||
.b(API_VKNEXT + ids)
|
||||
.a();
|
||||
@@ -135,7 +106,15 @@ public class FoafBase {
|
||||
progressDialog.cancel();
|
||||
Matcher matcher = FOAF_REGEX.matcher(str);
|
||||
matcher.find();
|
||||
String normalHumanDate = getNormalHumanDate(Objects.requireNonNull(matcher.group(1)));
|
||||
|
||||
String m = matcher.group(1);
|
||||
|
||||
if (m == null) {
|
||||
LifecycleUtils.getCurrentActivity().runOnUiThread(() -> makeText(getGlobalContext(), context.getString(R.string.foaferr), LENGTH_SHORT).show());
|
||||
return;
|
||||
}
|
||||
|
||||
String normalHumanDate = getNormalHumanDate(m);
|
||||
|
||||
LifecycleUtils.getCurrentActivity().runOnUiThread(() -> new VkAlertDialog.Builder(context)
|
||||
.setTitle(R.string.addinf)
|
||||
@@ -147,17 +126,14 @@ public class FoafBase {
|
||||
.show());
|
||||
} catch (Exception e) {
|
||||
LifecycleUtils.getCurrentActivity().runOnUiThread(() -> makeText(getGlobalContext(), context.getString(R.string.foaferr), LENGTH_SHORT).show());
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private static long daysPassedFromFoafDate(String str) {
|
||||
try {
|
||||
@SuppressLint("SimpleDateFormat")
|
||||
Date parse = new SimpleDateFormat("yyyy-MM-dd").parse(str.split(" ")[1]);
|
||||
return TimeUnit.DAYS.convert(new Date().getTime() - parse.getTime(), TimeUnit.MILLISECONDS);
|
||||
} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,20 +26,20 @@ public class ProfileButtons {
|
||||
newItem = orig.getJSONArray("buttons");
|
||||
}
|
||||
|
||||
if (!VTVerifications.haveDonateButton() && id == AccountManagerUtils.getUserId()) {
|
||||
var map = new HashMap<>();
|
||||
map.put("20", "https://raw.githubusercontent.com/vtosters/lite/main/.github/images/donate_icon/20.png");
|
||||
map.put("40", "https://raw.githubusercontent.com/vtosters/lite/main/.github/images/donate_icon/40.png");
|
||||
map.put("80", "https://raw.githubusercontent.com/vtosters/lite/main/.github/images/donate_icon/80.png");
|
||||
|
||||
newItem.put(generateJsonObject(
|
||||
AndroidUtils.getString(com.vtosters.lite.R.string.donate_to_vtl),
|
||||
"https://vk.com/vtosters_official",
|
||||
"2D81E0",
|
||||
"open_url",
|
||||
map
|
||||
));
|
||||
}
|
||||
// if (!VTVerifications.haveDonateButton() && id == AccountManagerUtils.getUserId()) {
|
||||
// var map = new HashMap<>();
|
||||
// map.put("20", "https://raw.githubusercontent.com/vtosters/lite/main/.github/images/donate_icon/20.png");
|
||||
// map.put("40", "https://raw.githubusercontent.com/vtosters/lite/main/.github/images/donate_icon/40.png");
|
||||
// map.put("80", "https://raw.githubusercontent.com/vtosters/lite/main/.github/images/donate_icon/80.png");
|
||||
//
|
||||
// newItem.put(generateJsonObject(
|
||||
// AndroidUtils.getString(com.vtosters.lite.R.string.donate_to_vtl),
|
||||
// "https://vk.com/vtosters_official",
|
||||
// "2D81E0",
|
||||
// "open_url",
|
||||
// map
|
||||
// ));
|
||||
// }
|
||||
|
||||
if (!orig.has("type") && AccountManagerUtils.isVKTester()) {
|
||||
var map = new HashMap<>();
|
||||
|
||||
@@ -17,6 +17,8 @@ import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static ru.vtosters.hooks.other.Preferences.getBoolValue;
|
||||
|
||||
public class UsersList {
|
||||
private static final String TAG = "UsersList";
|
||||
private static final List<Integer> descriptionsList = new ArrayList<>();
|
||||
@@ -25,7 +27,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")) {
|
||||
if ((!NetworkUtils.isNetworkConnected() || NetworkUtils.isInternetSlow()) && prefs.contains("ids") || getBoolValue("serverFeaturesDisable", false)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -39,11 +39,11 @@ public class IconManager {
|
||||
);
|
||||
|
||||
public static List<String> icons() {
|
||||
return Preferences.hasVerification() && Preferences.isValidSignature() ? sIconsPlusNames : sIconsNames; // delete later sdk check
|
||||
return sIconsPlusNames; // delete later sdk check
|
||||
}
|
||||
|
||||
public static List<String> iconsValues() {
|
||||
return Preferences.hasVerification() && Preferences.isValidSignature() ? sIconsPlus : sIcons; // delete later sdk check
|
||||
return sIconsPlus; // delete later sdk check
|
||||
}
|
||||
|
||||
public static void switchComponent(String icon, String appName) {
|
||||
@@ -55,7 +55,7 @@ public class IconManager {
|
||||
|
||||
Log.d("IconManager", "iconSwitcher: icon = " + icon + ", appname = " + appName);
|
||||
|
||||
List<String> iconsList = (Preferences.hasVerification() && Preferences.isValidSignature()) ? sIconsPlus : sIcons;
|
||||
List<String> iconsList = sIconsPlus;
|
||||
List<String> labelsList = sLabels;
|
||||
|
||||
// check if icon is exist
|
||||
|
||||
@@ -1,108 +0,0 @@
|
||||
package ru.vtosters.lite.ui.dialogs;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.util.Log;
|
||||
import com.vk.core.dialogs.alert.VkAlertDialog;
|
||||
import okhttp3.*;
|
||||
import org.json.JSONObject;
|
||||
import ru.vtosters.hooks.other.Preferences;
|
||||
import ru.vtosters.lite.di.singleton.VtOkHttpClient;
|
||||
import ru.vtosters.lite.utils.LifecycleUtils;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Random;
|
||||
|
||||
import static android.content.ContentValues.TAG;
|
||||
import static ru.vtosters.hooks.other.Preferences.getBoolValue;
|
||||
import static ru.vtosters.hooks.other.Preferences.hasVerification;
|
||||
|
||||
public class ServerDialog {
|
||||
private static final OkHttpClient client = VtOkHttpClient.getInstance();
|
||||
public static Boolean showAlert;
|
||||
private static String title;
|
||||
private static String message;
|
||||
private static String positiveButton;
|
||||
private static String neutralButton;
|
||||
private static String link;
|
||||
private static String key;
|
||||
private static Boolean cancelable;
|
||||
private static Boolean isNotForVerified;
|
||||
|
||||
public static void sendRequest() {
|
||||
if (getBoolValue("dialogrecomm", false)) return;
|
||||
|
||||
if (!getBoolValue("isRoamingState", false)) {
|
||||
Request request = new Request.a()
|
||||
.b("https://vtosters.app/dialog.json")
|
||||
.a();
|
||||
|
||||
client.a(request).a(new Callback() {
|
||||
@Override
|
||||
public void a(Call call, IOException e) {
|
||||
Log.d(TAG, e.getMessage());
|
||||
showAlert = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void a(Call call, Response response) {
|
||||
try {
|
||||
getResponse(response.a().g());
|
||||
} catch (Exception e) {
|
||||
showAlert = false;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private static Boolean showForNotVerified() {
|
||||
int random = new Random().nextInt(6);
|
||||
|
||||
if (isNotForVerified) {
|
||||
return !hasVerification() && random != 0;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private static void getResponse(String body) throws Exception {
|
||||
JSONObject jSONObject = new JSONObject(body);
|
||||
|
||||
if (jSONObject.getString("title").equals("")) {
|
||||
showAlert = false;
|
||||
return;
|
||||
}
|
||||
|
||||
title = jSONObject.getString("title");
|
||||
message = jSONObject.getString("message");
|
||||
positiveButton = jSONObject.getString("positiveButton");
|
||||
neutralButton = jSONObject.getString("neutralButton");
|
||||
link = jSONObject.getString("link");
|
||||
key = jSONObject.getString("key");
|
||||
cancelable = jSONObject.getBoolean("cancelable");
|
||||
isNotForVerified = jSONObject.getBoolean("isNotForVerified");
|
||||
|
||||
showAlert = true;
|
||||
|
||||
Activity activity = LifecycleUtils.getCurrentActivity();
|
||||
if (getBoolValue(key, true) && showForNotVerified() && showAlert) {
|
||||
activity.runOnUiThread(() -> {
|
||||
new VkAlertDialog.Builder(activity)
|
||||
.setTitle(title)
|
||||
.setMessage(message)
|
||||
.setCancelable(cancelable)
|
||||
.setPositiveButton(positiveButton,
|
||||
(dialogInterface, i) -> Preferences.getPreferences().edit().putBoolean(key, false).apply())
|
||||
.setNeutralButton(neutralButton, (dialogInterface, i) -> {
|
||||
Preferences.getPreferences().edit().putBoolean(key, false).apply();
|
||||
Intent intent = new Intent(Intent.ACTION_VIEW)
|
||||
.setData(Uri.parse(link));
|
||||
activity.startActivity(intent);
|
||||
})
|
||||
.show();
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -301,6 +301,20 @@ public class DataSettingsFragment extends TrackedMaterialPreferenceToolbarFragme
|
||||
}
|
||||
);
|
||||
|
||||
PreferenceFragmentUtils.addMaterialSwitchPreference(
|
||||
getPreferenceScreen(),
|
||||
"serverFeaturesDisable",
|
||||
"Отключить всю работу с сервером",
|
||||
"Отключает галочки и все дополнительные функции связанные с получением данных с сервера ВТостерс",
|
||||
null,
|
||||
false,
|
||||
(preference, o) -> {
|
||||
Preferences.getPreferences().edit().putBoolean("serverFeaturesDisable", (boolean) o).apply();
|
||||
LifecycleUtils.restartApplicationWithTimer();
|
||||
return true;
|
||||
}
|
||||
);
|
||||
|
||||
findPreference("analyticsDisabled").setVisible(Preferences.isValidSignature());
|
||||
}
|
||||
|
||||
|
||||
@@ -92,13 +92,6 @@ public class IconsFragment extends TrackedMaterialPreferenceToolbarFragment {
|
||||
|
||||
this.addPreferencesFromResource(R.xml.empty);
|
||||
|
||||
if (!Preferences.hasVerification() && !Preferences.getBoolValue("dialogrecomm", false)) {
|
||||
PreferenceFragmentUtils.addPreference(getPreferenceScreen(), "", requireContext().getString(R.string.icons_warning), requireContext().getString(R.string.icons_warning_info), R.drawable.ic_about_outline_28, preference -> {
|
||||
getContext().startActivity(new Intent(Intent.ACTION_VIEW).setData(Uri.parse("https://vtosters.app/donate/")));
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
PreferenceFragmentUtils.addPreferenceCategory(getPreferenceScreen(), requireContext().getString(R.string.icons_title));
|
||||
|
||||
for (var i = 0; i < IconManager.icons().size(); i++) {
|
||||
@@ -128,37 +121,5 @@ public class IconsFragment extends TrackedMaterialPreferenceToolbarFragment {
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
if (!Preferences.hasVerification() && !Preferences.getBoolValue("dialogrecomm", false)) {
|
||||
PreferenceFragmentUtils.addPreferenceCategory(getPreferenceScreen(), requireContext().getString(R.string.unavailable_icons));
|
||||
|
||||
for (var i = 2; i < IconManager.sIconsPlusNames.size(); i++) {
|
||||
if (IconManager.sIconsPlusNames.get(i) == null || IconManager.sIconsPlus.get(i) == null) return;
|
||||
|
||||
String iconname = IconManager.sIconsPlusNames.get(i);
|
||||
String icon = IconManager.sIconsPlus.get(i);
|
||||
|
||||
int iconRes;
|
||||
|
||||
if (icon.equals("vt")) {
|
||||
iconRes = R.mipmap.vt_launcher_round;
|
||||
} else if (icon.contains("standard")) {
|
||||
iconRes = R.mipmap.ic_launcher_round;
|
||||
} else {
|
||||
iconRes = AndroidUtils.getIdentifier("ic_launcher_" + icon, "mipmap");
|
||||
}
|
||||
|
||||
Drawable drawable = ResourcesCompat.getDrawable(getResources(), iconRes, null);
|
||||
|
||||
if (drawable == null) {
|
||||
drawable = ResourcesCompat.getDrawable(getResources(), R.drawable.ic_bug_outline_28, null);
|
||||
}
|
||||
|
||||
PreferenceFragmentUtils.addPreference(getPreferenceScreen(), icon, iconname, "", drawable, preference -> {
|
||||
AndroidUtils.sendToast(requireContext().getString(R.string.unavailable_icon_warning));
|
||||
return false;
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,13 +13,15 @@ public class InstallGMSFragment extends TrackedMaterialPreferenceToolbarFragment
|
||||
addPreferencesFromResource(R.xml.preferences_gms);
|
||||
|
||||
findPreference("microg").setOnPreferenceClickListener((preference) -> {
|
||||
String[] items = {"Уменьшенный MicroG (Vanced MicroG)", "Полноценный MicroG (Замена GMS)"};
|
||||
String[] items = {"Уменьшенный MicroG (ReVanced)", "Альтернативный MicroG (ReVanced)", "Полноценный MicroG (Замена GMS)"};
|
||||
|
||||
new VkAlertDialog.Builder(requireActivity()).setItems(items, (dialog, which) -> {
|
||||
switch (which) {
|
||||
case 0 ->
|
||||
requireContext().startActivity(new Intent(Intent.ACTION_VIEW).setData(Uri.parse("https://github.com/TeamVanced/VancedMicroG/releases/latest/download/microg.apk")));
|
||||
case 1 ->
|
||||
requireContext().startActivity(new Intent(Intent.ACTION_VIEW).setData(Uri.parse("https://github.com/inotia00/mMicroG/releases/latest/download/microg.apk")));
|
||||
case 2 ->
|
||||
requireContext().startActivity(new Intent(Intent.ACTION_VIEW).setData(Uri.parse("https://github.com/microg/GmsCore/releases")));
|
||||
}
|
||||
dismiss();
|
||||
|
||||
@@ -16,6 +16,8 @@ import ru.vtosters.lite.ssfs.UsersList;
|
||||
import ru.vtosters.lite.ui.activities.VKAdminTokenActivity;
|
||||
import ru.vtosters.lite.utils.*;
|
||||
|
||||
import static ru.vtosters.hooks.other.Preferences.getBoolValue;
|
||||
|
||||
public class OtherFragment extends TrackedMaterialPreferenceToolbarFragment {
|
||||
private static final int VK_ADMIN_TOKEN_REQUEST_CODE = 1;
|
||||
|
||||
@@ -110,6 +112,10 @@ 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));
|
||||
|
||||
var vkAdminTokenPref = findPreference("vk_admin_token");
|
||||
vkAdminTokenPref.setVisible(Preferences.getPreferences().getBoolean("new_music_downloading_way", false));
|
||||
if (vkAdminTokenPref.isVisible()) {
|
||||
|
||||
@@ -108,7 +108,7 @@ public class VTSettings extends TrackedMaterialPreferenceToolbarFragment {
|
||||
PowerManager manager = (PowerManager) requireActivity().getSystemService(Context.POWER_SERVICE);
|
||||
boolean isLinksUnverified = AndroidUtils.isLinksUnverified(requireActivity());
|
||||
boolean isDozingAvailable = Build.VERSION.SDK_INT >= 23 && !manager.isIgnoringBatteryOptimizations(AndroidUtils.getPackageName());
|
||||
boolean areNotificationsDisabled = !AndroidUtils.areNotificationsEnabled();
|
||||
boolean areNotificationsDisabled = !AndroidUtils.areNotificationsEnabled() && Build.VERSION.SDK_INT >= Build.VERSION_CODES.O;
|
||||
boolean isGMSNotInstalled = !GmsHook.isAnyServicesInstalled();
|
||||
|
||||
if (AccountManagerUtils.isLogin()) {
|
||||
@@ -142,18 +142,20 @@ public class VTSettings extends TrackedMaterialPreferenceToolbarFragment {
|
||||
});
|
||||
});
|
||||
|
||||
PreferenceFragmentUtils.addPreference(
|
||||
getPreferenceScreen(),
|
||||
"",
|
||||
requireContext().getString(R.string.vtssfs),
|
||||
getSSFSsumm(),
|
||||
R.drawable.ic_link_circle_outline_28,
|
||||
preference -> {
|
||||
VKUIwrapper.setLink(Utils.getVKUILink());
|
||||
NavigatorUtils.switchFragment(requireContext(), VKUIwrapper.class);
|
||||
return false;
|
||||
}
|
||||
);
|
||||
if (Preferences.hasSpecialVerif()) {
|
||||
PreferenceFragmentUtils.addPreference(
|
||||
getPreferenceScreen(),
|
||||
"",
|
||||
requireContext().getString(R.string.vtssfs),
|
||||
getSSFSsumm(),
|
||||
R.drawable.ic_link_circle_outline_28,
|
||||
preference -> {
|
||||
VKUIwrapper.setLink(Utils.getVKUILink());
|
||||
NavigatorUtils.switchFragment(requireContext(), VKUIwrapper.class);
|
||||
return false;
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
PreferenceFragmentUtils.addPreferenceCategory(getPreferenceScreen(), R.string.appearance_theme_use_system);
|
||||
@@ -649,20 +651,6 @@ public class VTSettings extends TrackedMaterialPreferenceToolbarFragment {
|
||||
}
|
||||
);
|
||||
|
||||
if (!Preferences.hasVerification() && !Preferences.getBoolValue("dialogrecomm", false)) {
|
||||
PreferenceFragmentUtils.addPreference(
|
||||
getPreferenceScreen(),
|
||||
"",
|
||||
"Помочь проекту",
|
||||
"За донат можно получить приятные бонусы на аккаунт",
|
||||
R.drawable.ic_money_circle_outline_28,
|
||||
preference -> {
|
||||
requireContext().startActivity(new Intent(Intent.ACTION_VIEW).setData(Uri.parse("https://vtosters.app/donate")));
|
||||
return false;
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
PreferenceFragmentUtils.addPreference(
|
||||
getPreferenceScreen(),
|
||||
"",
|
||||
|
||||
@@ -11,8 +11,7 @@ import java.nio.ByteBuffer;
|
||||
import static ru.vtosters.lite.utils.AndroidUtils.getGlobalContext;
|
||||
|
||||
enum ImageEffects {
|
||||
Blur(true,
|
||||
AndroidUtils.getArray(R.array.filter_types),
|
||||
Blur(AndroidUtils.getArray(R.array.filter_types),
|
||||
new String[]{"disabled", "low", "med", "high"},
|
||||
getGlobalContext().getString(R.string.filter_blur)
|
||||
) {
|
||||
@@ -40,8 +39,7 @@ enum ImageEffects {
|
||||
};
|
||||
}
|
||||
},
|
||||
Dim(true,
|
||||
AndroidUtils.getArray(R.array.filter_dim_types),
|
||||
Dim(AndroidUtils.getArray(R.array.filter_dim_types),
|
||||
new String[]{"disabled", "dim_black", "dim_white"},
|
||||
getGlobalContext().getString(R.string.filter_dim)) {
|
||||
@Override
|
||||
@@ -66,8 +64,7 @@ enum ImageEffects {
|
||||
};
|
||||
}
|
||||
},
|
||||
Mosaic(true,
|
||||
AndroidUtils.getArray(R.array.filter_types),
|
||||
Mosaic(AndroidUtils.getArray(R.array.filter_types),
|
||||
new String[]{"disabled", "low", "med", "high"},
|
||||
getGlobalContext().getString(R.string.filter_mosaic)) {
|
||||
@Override
|
||||
@@ -94,7 +91,7 @@ enum ImageEffects {
|
||||
};
|
||||
}
|
||||
},
|
||||
Monochrome(false, null, null,
|
||||
Monochrome(null, null,
|
||||
getGlobalContext().getString(R.string.filter_monochrome)) {
|
||||
@Override
|
||||
public void applyEffect(ByteBuffer bitmap, int height, int width) {
|
||||
@@ -103,7 +100,7 @@ enum ImageEffects {
|
||||
}
|
||||
}
|
||||
},
|
||||
Invert(false, null, null,
|
||||
Invert(null, null,
|
||||
getGlobalContext().getString(R.string.filter_invert_colors)) {
|
||||
@Override
|
||||
public void applyEffect(ByteBuffer bitmap, int height, int width) {
|
||||
@@ -112,7 +109,7 @@ enum ImageEffects {
|
||||
}
|
||||
}
|
||||
},
|
||||
Sepia(false, null, null,
|
||||
Sepia(null, null,
|
||||
getGlobalContext().getString(R.string.filter_sepia)) {
|
||||
@Override
|
||||
public void applyEffect(ByteBuffer bitmap, int height, int width) {
|
||||
@@ -121,7 +118,7 @@ enum ImageEffects {
|
||||
}
|
||||
}
|
||||
},
|
||||
Emboss(false, null, null,
|
||||
Emboss(null, null,
|
||||
getGlobalContext().getString(R.string.filter_emboss)) {
|
||||
@Override
|
||||
public String getSummary() {
|
||||
@@ -135,7 +132,7 @@ enum ImageEffects {
|
||||
}
|
||||
}
|
||||
},
|
||||
Engrave(false, null, null,
|
||||
Engrave(null, null,
|
||||
getGlobalContext().getString(R.string.filter_engrave)) {
|
||||
@Override
|
||||
public String getSummary() {
|
||||
@@ -149,7 +146,7 @@ enum ImageEffects {
|
||||
}
|
||||
}
|
||||
},
|
||||
Flea(false, null, null,
|
||||
Flea(null, null,
|
||||
getGlobalContext().getString(R.string.filter_flea)) {
|
||||
@Override
|
||||
public void applyEffect(ByteBuffer bitmap, int height, int width) {
|
||||
@@ -158,7 +155,7 @@ enum ImageEffects {
|
||||
}
|
||||
}
|
||||
},
|
||||
Snow(false, null, null,
|
||||
Snow(null, null,
|
||||
getGlobalContext().getString(R.string.filter_snow)) {
|
||||
@Override
|
||||
public void applyEffect(ByteBuffer bitmap, int height, int width) {
|
||||
@@ -168,15 +165,13 @@ enum ImageEffects {
|
||||
}
|
||||
};
|
||||
|
||||
private final boolean free;
|
||||
private final String title;
|
||||
@Nullable
|
||||
private final String[] entryValues;
|
||||
@Nullable
|
||||
private final String[] entries;
|
||||
|
||||
ImageEffects(boolean free, @Nullable String[] entries, @Nullable String[] entryValues, String title) {
|
||||
this.free = free;
|
||||
ImageEffects(@Nullable String[] entries, @Nullable String[] entryValues, String title) {
|
||||
this.entries = entries;
|
||||
this.entryValues = entryValues;
|
||||
this.title = title;
|
||||
@@ -207,10 +202,6 @@ enum ImageEffects {
|
||||
return entryValues != null && entryValues.length > 0;
|
||||
}
|
||||
|
||||
public boolean isFree() {
|
||||
return free;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public String[] getEntries() {
|
||||
return entries;
|
||||
|
||||
@@ -80,24 +80,7 @@ public class WallpaperMenuFragment extends MaterialPreferenceToolbarFragment {
|
||||
|
||||
PreferenceFragmentUtils.addPreferenceCategory(getPreferenceScreen(), requireContext().getString(R.string.vtlfilters));
|
||||
|
||||
if (!Preferences.hasVerification() && !Preferences.getBoolValue("dialogrecomm", false)) {
|
||||
PreferenceFragmentUtils.addPreference(
|
||||
getPreferenceScreen(),
|
||||
"",
|
||||
requireContext().getString(R.string.filters_warning),
|
||||
requireContext().getString(R.string.icons_warning_info),
|
||||
0,
|
||||
preference -> {
|
||||
requireContext().startActivity(
|
||||
new Intent(Intent.ACTION_VIEW)
|
||||
.setData(Uri.parse("https://vtosters.app/donate/"))
|
||||
);
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
Arrays.stream(ImageEffects.values())
|
||||
.filter(imageEffects -> imageEffects.isFree() || Preferences.hasVerification())
|
||||
.forEach(it -> {
|
||||
if (it.isList()) {
|
||||
var pref = PreferenceFragmentUtils.addListPreference(
|
||||
|
||||
@@ -12,10 +12,8 @@ import ru.vtosters.lite.di.singleton.VtOkHttpClient;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import static ru.vtosters.hooks.other.Preferences.getBoolValue;
|
||||
import static ru.vtosters.hooks.other.Preferences.hasVerification;
|
||||
|
||||
public class VTVerifications {
|
||||
public static final List<Integer> sVerifications = new ArrayList<>();
|
||||
@@ -33,7 +31,7 @@ public class VTVerifications {
|
||||
return;
|
||||
}
|
||||
|
||||
if ((!NetworkUtils.isNetworkConnected() && NetworkUtils.isInternetSlow() || getBoolValue("isRoamingState", false)) && prefs.contains("ids")) {
|
||||
if ((!NetworkUtils.isNetworkConnected() && NetworkUtils.isInternetSlow() || getBoolValue("isRoamingState", false)) && prefs.contains("ids") || getBoolValue("serverFeaturesDisable", false)) {
|
||||
parseJson(prefs.getString("ids", "[]"));
|
||||
Log.d("VTVerifications", "load from memory. Roaming or Network issues");
|
||||
isLoaded = true;
|
||||
@@ -129,7 +127,7 @@ public class VTVerifications {
|
||||
return -id;
|
||||
}
|
||||
|
||||
public static boolean haveDonateButton() {
|
||||
return hasVerification() || new Random().nextInt(6) != 1;
|
||||
}
|
||||
// public static boolean haveDonateButton() {
|
||||
// return hasVerification() || new Random().nextInt(6) != 1;
|
||||
// }
|
||||
}
|
||||
|
||||
@@ -5981,6 +5981,7 @@
|
||||
<string name="any_bank_card">Карта любога банка</string>
|
||||
<string name="current_place_number">Нумар бягучага месца</string>
|
||||
<string name="eight_friends">Гуляе 8 Вашых сяброў</string>
|
||||
|
||||
<string name="vtlfeed">Стужка</string>
|
||||
<string name="vtlinterface">Інтэрфейс</string>
|
||||
<string name="vtlmedia">Медыякантэнт</string>
|
||||
@@ -6066,7 +6067,7 @@
|
||||
<string name="gms_download_microg">Спампаваць MicroG</string>
|
||||
<string name="gms_what_to_do_next">Што рабіць далей?</string>
|
||||
<string name="gms_what_to_do_after_microg_title">Што рабіць пасля ўстаноўкі MicroG?</string>
|
||||
<string name="gms_what_to_do_after_microg_summ">1. Увайдзіце ў свой Google акаўнт \n2. Пераўсталюеце прыкладанне VTLite</string>
|
||||
<string name="gms_what_to_do_after_microg_summ">1. Увайдзіце ў свой Google рахунак на наладах MicroG\n2. Уключыце рэгістрацыю прылады\n3. Уключыце воблачны абмен паведамленнямі\n4. Пераўсталюеце VTLite\n5. Дазвольце яму прымаць паведамлення</string>
|
||||
<string name="donate">Дапамагчы праекту</string>
|
||||
<string name="fulltime">dd MMMM yyyy у HH:mm:ss</string>
|
||||
<string name="fulltime2">dd MMMM у HH:mm:ss</string>
|
||||
|
||||
@@ -5420,7 +5420,7 @@
|
||||
<string name="gms_download_microg">Скачать MicroG</string>
|
||||
<string name="gms_what_to_do_next">Что делать дальше?</string>
|
||||
<string name="gms_what_to_do_after_microg_title">Что делать после установки MicroG?</string>
|
||||
<string name="gms_what_to_do_after_microg_summ">1. Войдите в свой Google аккаунт в MicroG \n2. Переустановите приложение VTLite</string>
|
||||
<string name="gms_what_to_do_after_microg_summ">1. Войдите в свой Google аккаунт в настройках MicroG \n2. Включите регистрацию устройства \n3. Включите облачный обмен сообщениями \n4. Переустановите VTLite \n5. Разрешите ему принимать уведомления</string>
|
||||
<string name="donate">Помочь проекту</string>
|
||||
<string name="fulltime">dd MMMM yyyy в HH:mm:ss</string>
|
||||
<string name="fulltime2">dd MMMM в HH:mm:ss</string>
|
||||
|
||||
@@ -5347,7 +5347,7 @@
|
||||
<string name="gms_download_microg">Завантажити MicroG</string>
|
||||
<string name="gms_what_to_do_next">Що робити далі?</string>
|
||||
<string name="gms_what_to_do_after_microg_title">Що робити після встановлення MicroG?</string>
|
||||
<string name="gms_what_to_do_after_microg_summ">1. Увійдіть до свого облікового запису Google \n2. Перевстановіть додаток VTLite"</string>
|
||||
<string name="gms_what_to_do_after_microg_summ">"1. Увійдіть у свій обліковий запис Google у налаштуваннях MicroG\n2. Увімкніть реєстрацію пристрою\n3. Увімкніть Хмарний обмін повідомленнями\n4. Перевстановіть VTLite\n5. Дозвольте йому приймати повідомлення"</string>
|
||||
<string name="donate">Допомогти проекту</string>
|
||||
<string name="fulltime">dd MMMM yyyy в HH:mm:ss</string>
|
||||
<string name="fulltime2">dd MMMM в HH:mm:ss</string>
|
||||
|
||||
@@ -5554,7 +5554,7 @@ Filters are not case-sensitive!"</string>
|
||||
<string name="gms_download_microg">Download MicroG</string>
|
||||
<string name="gms_what_to_do_next">What to do next?</string>
|
||||
<string name="gms_what_to_do_after_microg_title">What to do after installing MicroG?</string>
|
||||
<string name="gms_what_to_do_after_microg_summ">1. Log in to your Google account \n2. Reinstall VTLite application</string>
|
||||
<string name="gms_what_to_do_after_microg_summ">1. Log in to your Google account in the MicroG settings\n2. Enable device registration\n3. Enable cloud messaging\n4. Reinstall VTLite\n5. Allow him to receive notifications</string>
|
||||
<string name="donate">Donate</string>
|
||||
<string name="fulltime">dd MMMM yyyy HH:mm:ss</string>
|
||||
<string name="fulltime2">dd MMMM HH:mm:ss</string>
|
||||
|
||||
@@ -10,25 +10,12 @@
|
||||
android:title="@string/microgsett"/>
|
||||
</PreferenceCategory>
|
||||
<PreferenceCategory android:title="@string/vtverify">
|
||||
<Preference
|
||||
android:enabled="false"
|
||||
android:summary="@string/vtverifyinfosum"
|
||||
android:title="@string/vtverifyinfo"/>
|
||||
<Preference
|
||||
android:persistent="false"
|
||||
android:summary="vtosters.app/donate"
|
||||
android:title="@string/getvtverify">
|
||||
<intent
|
||||
android:action="android.intent.action.VIEW"
|
||||
android:data="https://vtosters.app/donate"/>
|
||||
</Preference>
|
||||
<Preference
|
||||
android:key="updateverifdata"
|
||||
android:summary="@string/updateverifdata_summ"
|
||||
android:title="@string/updateverifdata_title"/>
|
||||
<Preference
|
||||
android:key="copyownlink"
|
||||
android:summary="@string/copyownlink_summ"
|
||||
android:title="@string/copyownlink_title"/>
|
||||
<com.vtosters.lite.ui.MaterialSwitchPreference
|
||||
android:defaultValue="true"
|
||||
|
||||
Reference in New Issue
Block a user