added donate button

This commit is contained in:
gdlbo
2022-06-25 00:22:15 +03:00
parent f72ff25ebe
commit dd591ee78b
5 changed files with 16 additions and 42 deletions
@@ -1,6 +1,6 @@
package ru.vtosters.lite.utils;
import static ru.vtosters.lite.utils.Preferences.donaterecomm;
import static ru.vtosters.lite.f0x1d.VTVerifications.decode;
import static ru.vtosters.lite.utils.Preferences.hasVerification;
import org.json.JSONException;
@@ -9,45 +9,21 @@ import org.json.JSONObject;
import java.util.Random;
public class JsonInjectors{
public static JSONObject profileButton() throws JSONException{
public static JSONObject profileButton(JSONObject orig) throws JSONException{
if(haveDonateButton()) return orig;
String pic = "https:\\/\\/sun1-18.userapi.com\\/NLd_rNpGuSaBnPV6O-j5mqCGZk8BK8drAMd2LQ\\/5R-DEF37PFs.png";
String title = "Помоги проекту донатом и получи бонус!";
String link = "https:\\/\\/vk.com\\/vtosters_official";
String text_color = "2D81E0";
JSONObject jsonObj = new JSONObject("{\"action\":{\"target\":\"internal\",\"type\":\"open_url\",\"url\":\"" + link + "\"},\"title\":\"" + title + "\",\"icons\":[{\"url\":\"" + pic + "\",\"width\":20,\"height\":20},{\"url\":\"" + pic + "\",\"width\":40,\"height\":40},{\"url\":\"" + pic + "\",\"width\":60,\"height\":60},{\"url\":\"" + pic + "\",\"width\":80,\"height\":80}],\"text_color\":\"" + text_color + "\"}");
return jsonObj;
// new JSONObject("{\"title\":\"" + title + "\",\"description\":\"" + desc + "\",\"text_color\":\"#" + text_color + "\",\"image\":[{\"url\":\"" + smallimg + "\",\"width\":72,\"height\":72},{\"url\":\"" + smallimg + "\",\"width\":108,\"height\":108},{\"url\":\"" + smallimg + "\",\"width\":144,\"height\":144},{\"url\":\"" + smallimg + "\",\"width\":216,\"height\":216},{\"url\":\"" + smallimg + "\",\"width\":288,\"height\":288}],\"background\":[{\"url\":\"" + background + "\",\"width\":344,\"height\":215},{\"url\":\"" + background + "\",\"width\":516,\"height\":323},{\"url\":\"" + background + "\",\"width\":680,\"height\":426},{\"url\":\"" + background + "\",\"width\":1032,\"height\":645},{\"url\":\"" + background + "\",\"width\":1376,\"height\":860}]}");
return new JSONObject(decode("eyJhY3Rpb24iOnsidGFyZ2V0IjoiaW50ZXJuYWwiLCJ0eXBlIjoib3Blbl91cmwiLCJ1cmwiOiI=") + link + decode("In0sInRpdGxlIjoi") + title + decode("IiwiaWNvbnMiOlt7InVybCI6Ig==") + pic + decode("Iiwid2lkdGgiOjIwLCJoZWlnaHQiOjIwfSx7InVybCI6Ig==") + pic + decode("Iiwid2lkdGgiOjQwLCJoZWlnaHQiOjQwfSx7InVybCI6Ig==") + pic + decode("Iiwid2lkdGgiOjYwLCJoZWlnaHQiOjYwfSx7InVybCI6Ig==") + pic + decode("Iiwid2lkdGgiOjgwLCJoZWlnaHQiOjgwfV0sInRleHRfY29sb3IiOiI=") + text_color + decode("In0="));
}
public static JSONObject discoverBanner() throws JSONException{
String smallimg = "https:\\/\\/sun1-25.userapi.com\\/3D4YtNHjgwoyxav3FksnYRINp_FhWULuDKYdcA\\/zfCUgKMS0O4.png";
String background = "https:\\/\\/images.wsj.net\\/im-501403";
String title = "Задонать";
String desc = "Помоги проекту донатом и получи приятные бонусы на аккаунт";
String text_color = "ffffff";
public static boolean haveDonateButton(){
int randomshower = new Random().nextInt(10);
JSONObject jsonObj = new JSONObject("{\"title\":\"" + title + "\",\"description\":\"" + desc + "\",\"text_color\":\"#" + text_color + "\",\"image\":[{\"url\":\"" + smallimg + "\",\"width\":72,\"height\":72},{\"url\":\"" + smallimg + "\",\"width\":108,\"height\":108},{\"url\":\"" + smallimg + "\",\"width\":144,\"height\":144},{\"url\":\"" + smallimg + "\",\"width\":216,\"height\":216},{\"url\":\"" + smallimg + "\",\"width\":288,\"height\":288}],\"background\":[{\"url\":\"" + background + "\",\"width\":344,\"height\":215},{\"url\":\"" + background + "\",\"width\":516,\"height\":323},{\"url\":\"" + background + "\",\"width\":680,\"height\":426},{\"url\":\"" + background + "\",\"width\":1032,\"height\":645},{\"url\":\"" + background + "\",\"width\":1376,\"height\":860}]}");
return jsonObj;
}
public static JSONObject discoverBannerButton() throws JSONException{
String link = "vk.com\\/vtosters_official";
JSONObject jsonObj = new JSONObject("{\"type\":\"open_url\",\"url\":\"" + link + "\",\"target\":\"internal\"}");
return jsonObj;
}
public static String haveDonateBanner(){
Random random = new Random();
int randomshower = random.nextInt(8);
return hasVerification() || donaterecomm() || randomshower != 1 ? "null" : "info";
}
public static String haveDonateButton(){
Random random = new Random();
int randomshower = random.nextInt(10);
return hasVerification() || donaterecomm() || randomshower != 1 ? "null" : "buttons";
return hasVerification() || randomshower != 1;
}
}
@@ -353,10 +353,6 @@ public class Preferences{
return getBoolValue("disableSettingsSumms", false);
}
public static boolean donaterecomm(){
return getBoolValue("donaterecomm", false);
}
public static boolean hasVerification(){
return isVerified(getUserId());
}
-4
View File
@@ -65,9 +65,5 @@
android:defaultValue="true"
android:key="VT_Fire"
android:title="@string/showvtfire" />
<com.vtosters.lite.ui.MaterialSwitchPreference
android:defaultValue="false"
android:key="donaterecomm"
android:title="@string/donaterecomm" />
</PreferenceCategory>
</PreferenceScreen>
@@ -39,6 +39,10 @@
.method public static a(Lorg/json/JSONObject;)Lcom/vtosters/lite/api/ExtendedUserProfile$d;
.locals 3
invoke-static {p0}, Lru/vtosters/lite/utils/JsonInjectors;->profileButton(Lorg/json/JSONObject;)Lorg/json/JSONObject;
move-result-object p0
.line 1
new-instance v0, Lcom/vtosters/lite/api/ExtendedUserProfile$d;
@@ -2501,7 +2501,9 @@
iput-boolean v2, v0, Lcom/vtosters/lite/api/ExtendedUserProfile;->u1:Z
const-string v2, "friends_recommendations"
## useless recomms must die
const-string v2, "null"
.line 192
invoke-virtual {v1, v2}, Lorg/json/JSONObject;->optJSONObject(Ljava/lang/String;)Lorg/json/JSONObject;