diff --git a/app/build.gradle.kts b/app/build.gradle.kts index b5c16f3..357e6e2 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -5,7 +5,6 @@ @file:Suppress("UnstableApiUsage", "SpellCheckingInspection") import com.android.build.api.variant.FilterConfiguration.FilterType.ABI -import io.sentry.android.gradle.extensions.InstrumentationFeature import io.sentry.android.gradle.instrumentation.logcat.LogcatLevel import java.util.Properties @@ -53,7 +52,7 @@ android { applicationId = "com.fox2code.mmm" minSdk = 26 targetSdk = 34 - versionCode = 83 + versionCode = 85 versionName = "2.3.1" vectorDrawables { useSupportLibrary = true @@ -106,7 +105,7 @@ android { // Specifies a list of ABIs for Gradle to create APKs for. include("x86", "x86_64", "arm64-v8a", "armeabi-v7a") - isUniversalApk = true + isUniversalApk = false } } @@ -137,11 +136,6 @@ android { proguardFiles( getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro" ) - - // ONLY FOR TESTING SENTRY - // minifyEnabled true - // shrinkResources true - // proguardFiles getDefaultProguardFile("proguard-android-optimize.txt"),"proguard-rules.pro" } } @@ -378,15 +372,6 @@ sentry { tracingInstrumentation { enabled.set(true) - features.set( - setOf( - InstrumentationFeature.DATABASE, - InstrumentationFeature.FILE_IO, - InstrumentationFeature.OKHTTP, - InstrumentationFeature.COMPOSE - ) - ) - logcat { enabled.set(true) @@ -407,10 +392,10 @@ sentry { org.set("androidacy") projectName.set("foxmmm") - uploadNativeSymbols.set(true) + uploadNativeSymbols.set(hasSentryConfig) } -val abiCodes = mapOf("armeabi-v7a" to 1, "x86" to 2, "x86_64" to 3) +val abiCodes = mapOf("armeabi-v7a" to 1, "x86" to 2, "x86_64" to 3, "arm64-v8a" to 4) // For per-density APKs, create a similar map: // val densityCodes = mapOf("mdpi" to 1, "hdpi" to 2, "xhdpi" to 3) diff --git a/app/src/main/kotlin/com/fox2code/mmm/MainApplication.kt b/app/src/main/kotlin/com/fox2code/mmm/MainApplication.kt index f624ba5..0ed3bbe 100644 --- a/app/src/main/kotlin/com/fox2code/mmm/MainApplication.kt +++ b/app/src/main/kotlin/com/fox2code/mmm/MainApplication.kt @@ -365,7 +365,7 @@ class MainApplication : FoxApplication(), Configuration.Provider { val newTimeFormatLocale = newConfig.locales[0] if (timeFormatLocale !== newTimeFormatLocale) { timeFormatLocale = newTimeFormatLocale - timeFormat = SimpleDateFormat(timeFormatString, timeFormatLocale) + timeFormat = SimpleDateFormat(TFS, timeFormatLocale) } super.onConfigurationChanged(newConfig) } @@ -485,7 +485,7 @@ class MainApplication : FoxApplication(), Configuration.Provider { // Anything that is commented out is supported but the translation is not complete to at least 60% @JvmField val supportedLocales = HashSet() - private const val timeFormatString = "dd MMM yyyy" // Example: 13 july 2001 + private const val TFS = "dd MMM yyyy" // Example: 13 july 2001 private var shellBuilder: Shell.Builder? = null // Is application wrapped, and therefore must reduce it's feature set. @@ -497,9 +497,9 @@ class MainApplication : FoxApplication(), Configuration.Provider { @JvmField var o = false private var SHOWCASE_MODE_TRUE: String? = null - private var secret: Long = 0 + private var sc: Long = 0 private var timeFormatLocale = Resources.getSystem().configuration.locales[0] - private var timeFormat = SimpleDateFormat(timeFormatString, timeFormatLocale) + private var timeFormat = SimpleDateFormat(TFS, timeFormatLocale) private var relPackageName = BuildConfig.APPLICATION_ID @SuppressLint("StaticFieldLeak") @@ -532,8 +532,8 @@ class MainApplication : FoxApplication(), Configuration.Provider { } val random = Random() do { - secret = random.nextLong() - } while (secret == 0L) + sc = random.nextLong() + } while (sc == 0L) } fun build(vararg command: String?): Shell { @@ -551,7 +551,7 @@ class MainApplication : FoxApplication(), Configuration.Provider { // Code safeguard, we should never reach here. "Can't add secret to outbound Intent" } - intent.putExtra("secret", secret) + intent.putExtra("secret", sc) } @Suppress("NAME_SHADOWING") @@ -591,7 +591,7 @@ class MainApplication : FoxApplication(), Configuration.Provider { } fun checkSecret(intent: Intent?): Boolean { - return intent != null && intent.getLongExtra("secret", secret.inv()) == secret + return intent != null && intent.getLongExtra("secret", sc.inv()) == sc } // convert from String to boolean diff --git a/app/src/main/kotlin/com/fox2code/mmm/UpdateActivity.kt b/app/src/main/kotlin/com/fox2code/mmm/UpdateActivity.kt index 13d16b5..a8e07f3 100644 --- a/app/src/main/kotlin/com/fox2code/mmm/UpdateActivity.kt +++ b/app/src/main/kotlin/com/fox2code/mmm/UpdateActivity.kt @@ -13,6 +13,7 @@ import android.webkit.CookieManager import android.webkit.WebSettings import android.webkit.WebView import android.widget.Toast +import androidx.appcompat.content.res.AppCompatResources import androidx.core.content.FileProvider import androidx.webkit.WebSettingsCompat import androidx.webkit.WebViewFeature @@ -21,6 +22,7 @@ import com.fox2code.mmm.androidacy.AndroidacyRepoData import com.fox2code.mmm.utils.io.net.Http import com.google.android.material.bottomnavigation.BottomNavigationItemView import com.google.android.material.bottomnavigation.BottomNavigationView +import com.google.android.material.button.MaterialButton import com.google.android.material.progressindicator.LinearProgressIndicator import com.google.android.material.textview.MaterialTextView import org.json.JSONException @@ -31,7 +33,6 @@ import java.io.FileOutputStream import java.io.IOException import java.sql.Timestamp import java.util.Objects -import com.google.android.material.button.MaterialButton class UpdateActivity : FoxActivity() { private var chgWv: WebView? = null @@ -47,7 +48,7 @@ class UpdateActivity : FoxActivity() { if (ts.time > buildTime.time) { val pm = packageManager val intent = Intent(this, ExpiredActivity::class.java) - @Suppress("DEPRECATION") val resolveInfo = pm.queryIntentActivities(intent, 0) + val resolveInfo = pm.queryIntentActivities(intent, 0) if (resolveInfo.size > 0) { startActivity(intent) finish() @@ -122,7 +123,6 @@ class UpdateActivity : FoxActivity() { // if extras is null, then we are in a bad state or user launched the activity manually if (extras == null) { runOnUiThread { - // set status text to error statusTextView.setText(R.string.error_no_extras) // set progress bar to error @@ -137,7 +137,6 @@ class UpdateActivity : FoxActivity() { // if action is null, then we are in a bad state or user launched the activity manually if (Objects.isNull(action)) { runOnUiThread { - // set status text to error statusTextView.setText(R.string.error_no_action) // set progress bar to error @@ -278,12 +277,12 @@ class UpdateActivity : FoxActivity() { // set button text to download val button = findViewById(R.id.action_update) button.text = getString(R.string.download_update) - button.icon = getDrawable(R.drawable.baseline_cloud_download_24) + button.icon = AppCompatResources.getDrawable(this, R.drawable.baseline_cloud_download_24) button.isEnabled = true button.visibility = View.VISIBLE - button.setOnClickListener({ + button.setOnClickListener { downloadUpdate() - }) + } } // return } diff --git a/app/src/main/kotlin/com/fox2code/mmm/utils/sentry/SentryMain.kt b/app/src/main/kotlin/com/fox2code/mmm/utils/sentry/SentryMain.kt index 86d3465..ebe18e2 100644 --- a/app/src/main/kotlin/com/fox2code/mmm/utils/sentry/SentryMain.kt +++ b/app/src/main/kotlin/com/fox2code/mmm/utils/sentry/SentryMain.kt @@ -79,7 +79,7 @@ object SentryMain { isSentryEnabled = sharedPreferences.getBoolean("pref_crash_reporting_enabled", false) // set sentryEnabled on preference change of pref_crash_reporting_enabled sharedPreferences.registerOnSharedPreferenceChangeListener { sharedPreferences1: SharedPreferences, s: String? -> - if (s!== null && s == "pref_crash_reporting_enabled") { + if (s !== null && s == "pref_crash_reporting_enabled") { isSentryEnabled = sharedPreferences1.getBoolean(s, false) } } @@ -137,7 +137,10 @@ object SentryMain { } } // remove all failed to fetch data messages - if (event?.message?.message?.contains("Failed to fetch") == true || event?.message?.message?.contains("Failed to load") == true) { + if (event?.message?.message?.contains("Failed to fetch") == true || event?.message?.message?.contains( + "Failed to load" + ) == true + ) { return@BeforeSendCallback null } // for httpexception, do not send if error is 401, 403, 404, 429 @@ -155,13 +158,15 @@ object SentryMain { // Filter breadcrumb content from crash report. options.beforeBreadcrumb = BeforeBreadcrumbCallback { breadcrumb: Breadcrumb, _: Hint? -> + if (!isSentryEnabled) { + return@BeforeBreadcrumbCallback null + } val url = breadcrumb.getData("url") as String? - if (url.isNullOrEmpty()) return@BeforeBreadcrumbCallback null if ("cloudflare-dns.com" == Uri.parse(url).host) { return@BeforeBreadcrumbCallback null } if (isAndroidacyLink(url)) { - breadcrumb.setData("url", hideToken(url)) + url?.let { hideToken(it) }?.let { breadcrumb.setData("url", it) } } breadcrumb }