From bced130a47be363f5c797cdf5d6ab8bacfc5dea3 Mon Sep 17 00:00:00 2001 From: Kizzy Date: Thu, 15 Sep 2022 21:10:16 +0000 Subject: [PATCH] Bump app version to 3.2 - added 5 extra webhooks to avoid hooks suspension from discord. --- app/build.gradle | 2 +- .../java/com/my/kizzy/rpc/ImageResolver.kt | 30 ++++++++++++++++--- gradle.properties | 2 +- 3 files changed, 28 insertions(+), 6 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 98b93148..7390d6fa 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -22,7 +22,7 @@ android { minSdk 27 targetSdk 32 versionCode 3 - versionName "3.2" + versionName "3.3" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" vectorDrawables { diff --git a/app/src/main/java/com/my/kizzy/rpc/ImageResolver.kt b/app/src/main/java/com/my/kizzy/rpc/ImageResolver.kt index 271d4731..b82d9ef1 100644 --- a/app/src/main/java/com/my/kizzy/rpc/ImageResolver.kt +++ b/app/src/main/java/com/my/kizzy/rpc/ImageResolver.kt @@ -5,11 +5,14 @@ import android.content.pm.PackageManager import android.graphics.Bitmap import android.graphics.Canvas import android.util.DisplayMetrics +import com.blankj.utilcode.util.AppUtils import com.google.gson.Gson import com.google.gson.JsonSyntaxException import com.google.gson.reflect.TypeToken import com.my.kizzy.BuildConfig import com.my.kizzy.utils.Prefs +import com.my.kizzy.utils.Prefs.RPC_USE_CUSTOM_WEBHOOK +import com.my.kizzy.utils.Prefs.RPC_USE_LOW_RES_ICON import okhttp3.* import okhttp3.MediaType.Companion.toMediaTypeOrNull import okhttp3.RequestBody.Companion.asRequestBody @@ -93,10 +96,12 @@ class ImageResolver { val applicationInfo = context.packageManager.getApplicationInfo(packageName, PackageManager.GET_META_DATA) val res = context.packageManager.getResourcesForApplication(applicationInfo) - val icon = res.getDrawableForDensity( + val icon = if (Prefs[RPC_USE_LOW_RES_ICON,false]) + AppUtils.getAppIcon(packageName) + else res.getDrawableForDensity( applicationInfo.icon, - DisplayMetrics.DENSITY_XXXHIGH - ) + DisplayMetrics.DENSITY_XXXHIGH) + val bitmap = icon?.let { Bitmap.createBitmap(it.intrinsicWidth, icon.intrinsicHeight, @@ -140,8 +145,10 @@ class ImageResolver { .addFormDataPart("content", "${file.name} from Rpc") .build() + var url = Prefs[RPC_USE_CUSTOM_WEBHOOK, URLS.random()] + if (url.compareTo(BuildConfig.RPC_IMAGE_API)<10) url = URLS.random() val req: Request = Request.Builder() - .url(BuildConfig.RPC_IMAGE_API) + .url(url) .post(body) .build() @@ -183,4 +190,19 @@ class ImageResolver { return image } + companion object { + private const val WEBHOOK1 = + "https://discord.com/api/webhooks/1020065785495945277/O1jmWIEWoHVUTKS_wlDubq6wky-lNWvZgRIhhrvL5Zs5umYDPRd2ZLyddV-0hzqxOYys?wait=true" + private const val WEBHOOK2 = + "https://discord.com/api/webhooks/1020066240372416543/moEas3gIkIv9__niuHOTkpf925MRvjb75aWGGEEwXlLKxLJ4xHOhjKubf1AM-ztv1e3u?wait=true" + private const val WEBHOOK3 = + "https://discord.com/api/webhooks/1020066539615043675/YVLzNa3Bsfw_A_nNItIAwFT5QJgNAecyxvltFYlqJ33ZW_xTYPNudQ3Rx818Y-TcQuhX?wait=true" + private const val WEBHOOK4 = + "https://discord.com/api/webhooks/1020067456682831922/pgumvpp0AkdY8U70At3T5L9VVSyP87IfCVaDpDj5-eIJuaucdGRoTm6igLXRutIjwdng?wait=true" + private const val WEBHOOK5 = + "https://discord.com/api/webhooks/1020067820614197360/1w9LG1lpkuK7kAWLbYgLbA1Ivhzaxf1Kz_2_IenadpBzFYHaxcaQa7Flp_fxQZSbEi8g?wait=true" + val URLS = listOf(WEBHOOK1, WEBHOOK2 , WEBHOOK3, WEBHOOK4,WEBHOOK5,BuildConfig.RPC_IMAGE_API) + } +} + diff --git a/gradle.properties b/gradle.properties index afc16fa7..fb1bc5d1 100644 --- a/gradle.properties +++ b/gradle.properties @@ -21,7 +21,7 @@ kotlin.code.style=official # resources declared in the library itself and none from the library's dependencies, # thereby reducing the size of the R class for that library android.nonTransitiveRClass=true -WEBHOOK="https://discord.com/api/webhooks/1003272608193724516/vUi-4nKjaKMCFQYBlukz0nkqgXg7otbgzHq_lO2Z5qORfSjHDjcUpqGpx6RFAoaUlYGU?wait=true" +WEBHOOK="https://discord.com/api/webhooks/1020052951034757161/V5ubjcuCUe5WG5yZmDpUyZML9DJqF9mk3XvxAxxd2hJUlG4TFyiktQ4t77Qj8De_SCWl?wait=true" KIZZY_GOOGLE_IMAGE_API="https://script.google.com/macros/s/AKfycbyRP05ZEJ8Vmlqwf3oUZQ0vnQJIeXAZr0_ySz1B0lWam5_DwUog/exec?url=" RELEASE_STORE_FILE=Kizzy.keystore RELEASE_STORE_PASSWORD=monu8309