Skip to content

Commit a308f17

Browse files
final touches for 2.3.1
Signed-off-by: androidacy-user <opensource@androidacy.com>
1 parent 2552bf3 commit a308f17

4 files changed

Lines changed: 27 additions & 38 deletions

File tree

app/build.gradle.kts

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
@file:Suppress("UnstableApiUsage", "SpellCheckingInspection")
66

77
import com.android.build.api.variant.FilterConfiguration.FilterType.ABI
8-
import io.sentry.android.gradle.extensions.InstrumentationFeature
98
import io.sentry.android.gradle.instrumentation.logcat.LogcatLevel
109
import java.util.Properties
1110

@@ -53,7 +52,7 @@ android {
5352
applicationId = "com.fox2code.mmm"
5453
minSdk = 26
5554
targetSdk = 34
56-
versionCode = 83
55+
versionCode = 85
5756
versionName = "2.3.1"
5857
vectorDrawables {
5958
useSupportLibrary = true
@@ -106,7 +105,7 @@ android {
106105
// Specifies a list of ABIs for Gradle to create APKs for.
107106
include("x86", "x86_64", "arm64-v8a", "armeabi-v7a")
108107

109-
isUniversalApk = true
108+
isUniversalApk = false
110109
}
111110
}
112111

@@ -137,11 +136,6 @@ android {
137136
proguardFiles(
138137
getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro"
139138
)
140-
141-
// ONLY FOR TESTING SENTRY
142-
// minifyEnabled true
143-
// shrinkResources true
144-
// proguardFiles getDefaultProguardFile("proguard-android-optimize.txt"),"proguard-rules.pro"
145139
}
146140
}
147141

@@ -378,15 +372,6 @@ sentry {
378372
tracingInstrumentation {
379373
enabled.set(true)
380374

381-
features.set(
382-
setOf(
383-
InstrumentationFeature.DATABASE,
384-
InstrumentationFeature.FILE_IO,
385-
InstrumentationFeature.OKHTTP,
386-
InstrumentationFeature.COMPOSE
387-
)
388-
)
389-
390375
logcat {
391376
enabled.set(true)
392377

@@ -407,10 +392,10 @@ sentry {
407392

408393
org.set("androidacy")
409394
projectName.set("foxmmm")
410-
uploadNativeSymbols.set(true)
395+
uploadNativeSymbols.set(hasSentryConfig)
411396
}
412397

413-
val abiCodes = mapOf("armeabi-v7a" to 1, "x86" to 2, "x86_64" to 3)
398+
val abiCodes = mapOf("armeabi-v7a" to 1, "x86" to 2, "x86_64" to 3, "arm64-v8a" to 4)
414399

415400
// For per-density APKs, create a similar map:
416401
// val densityCodes = mapOf("mdpi" to 1, "hdpi" to 2, "xhdpi" to 3)

app/src/main/kotlin/com/fox2code/mmm/MainApplication.kt

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,7 @@ class MainApplication : FoxApplication(), Configuration.Provider {
365365
val newTimeFormatLocale = newConfig.locales[0]
366366
if (timeFormatLocale !== newTimeFormatLocale) {
367367
timeFormatLocale = newTimeFormatLocale
368-
timeFormat = SimpleDateFormat(timeFormatString, timeFormatLocale)
368+
timeFormat = SimpleDateFormat(TFS, timeFormatLocale)
369369
}
370370
super.onConfigurationChanged(newConfig)
371371
}
@@ -485,7 +485,7 @@ class MainApplication : FoxApplication(), Configuration.Provider {
485485
// Anything that is commented out is supported but the translation is not complete to at least 60%
486486
@JvmField
487487
val supportedLocales = HashSet<String>()
488-
private const val timeFormatString = "dd MMM yyyy" // Example: 13 july 2001
488+
private const val TFS = "dd MMM yyyy" // Example: 13 july 2001
489489
private var shellBuilder: Shell.Builder? = null
490490

491491
// Is application wrapped, and therefore must reduce it's feature set.
@@ -497,9 +497,9 @@ class MainApplication : FoxApplication(), Configuration.Provider {
497497
@JvmField
498498
var o = false
499499
private var SHOWCASE_MODE_TRUE: String? = null
500-
private var secret: Long = 0
500+
private var sc: Long = 0
501501
private var timeFormatLocale = Resources.getSystem().configuration.locales[0]
502-
private var timeFormat = SimpleDateFormat(timeFormatString, timeFormatLocale)
502+
private var timeFormat = SimpleDateFormat(TFS, timeFormatLocale)
503503
private var relPackageName = BuildConfig.APPLICATION_ID
504504

505505
@SuppressLint("StaticFieldLeak")
@@ -532,8 +532,8 @@ class MainApplication : FoxApplication(), Configuration.Provider {
532532
}
533533
val random = Random()
534534
do {
535-
secret = random.nextLong()
536-
} while (secret == 0L)
535+
sc = random.nextLong()
536+
} while (sc == 0L)
537537
}
538538

539539
fun build(vararg command: String?): Shell {
@@ -551,7 +551,7 @@ class MainApplication : FoxApplication(), Configuration.Provider {
551551
// Code safeguard, we should never reach here.
552552
"Can't add secret to outbound Intent"
553553
}
554-
intent.putExtra("secret", secret)
554+
intent.putExtra("secret", sc)
555555
}
556556

557557
@Suppress("NAME_SHADOWING")
@@ -591,7 +591,7 @@ class MainApplication : FoxApplication(), Configuration.Provider {
591591
}
592592

593593
fun checkSecret(intent: Intent?): Boolean {
594-
return intent != null && intent.getLongExtra("secret", secret.inv()) == secret
594+
return intent != null && intent.getLongExtra("secret", sc.inv()) == sc
595595
}
596596

597597
// convert from String to boolean

app/src/main/kotlin/com/fox2code/mmm/UpdateActivity.kt

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import android.webkit.CookieManager
1313
import android.webkit.WebSettings
1414
import android.webkit.WebView
1515
import android.widget.Toast
16+
import androidx.appcompat.content.res.AppCompatResources
1617
import androidx.core.content.FileProvider
1718
import androidx.webkit.WebSettingsCompat
1819
import androidx.webkit.WebViewFeature
@@ -21,6 +22,7 @@ import com.fox2code.mmm.androidacy.AndroidacyRepoData
2122
import com.fox2code.mmm.utils.io.net.Http
2223
import com.google.android.material.bottomnavigation.BottomNavigationItemView
2324
import com.google.android.material.bottomnavigation.BottomNavigationView
25+
import com.google.android.material.button.MaterialButton
2426
import com.google.android.material.progressindicator.LinearProgressIndicator
2527
import com.google.android.material.textview.MaterialTextView
2628
import org.json.JSONException
@@ -31,7 +33,6 @@ import java.io.FileOutputStream
3133
import java.io.IOException
3234
import java.sql.Timestamp
3335
import java.util.Objects
34-
import com.google.android.material.button.MaterialButton
3536

3637
class UpdateActivity : FoxActivity() {
3738
private var chgWv: WebView? = null
@@ -47,7 +48,7 @@ class UpdateActivity : FoxActivity() {
4748
if (ts.time > buildTime.time) {
4849
val pm = packageManager
4950
val intent = Intent(this, ExpiredActivity::class.java)
50-
@Suppress("DEPRECATION") val resolveInfo = pm.queryIntentActivities(intent, 0)
51+
val resolveInfo = pm.queryIntentActivities(intent, 0)
5152
if (resolveInfo.size > 0) {
5253
startActivity(intent)
5354
finish()
@@ -122,7 +123,6 @@ class UpdateActivity : FoxActivity() {
122123
// if extras is null, then we are in a bad state or user launched the activity manually
123124
if (extras == null) {
124125
runOnUiThread {
125-
126126
// set status text to error
127127
statusTextView.setText(R.string.error_no_extras)
128128
// set progress bar to error
@@ -137,7 +137,6 @@ class UpdateActivity : FoxActivity() {
137137
// if action is null, then we are in a bad state or user launched the activity manually
138138
if (Objects.isNull(action)) {
139139
runOnUiThread {
140-
141140
// set status text to error
142141
statusTextView.setText(R.string.error_no_action)
143142
// set progress bar to error
@@ -278,12 +277,12 @@ class UpdateActivity : FoxActivity() {
278277
// set button text to download
279278
val button = findViewById<MaterialButton>(R.id.action_update)
280279
button.text = getString(R.string.download_update)
281-
button.icon = getDrawable(R.drawable.baseline_cloud_download_24)
280+
button.icon = AppCompatResources.getDrawable(this, R.drawable.baseline_cloud_download_24)
282281
button.isEnabled = true
283282
button.visibility = View.VISIBLE
284-
button.setOnClickListener({
283+
button.setOnClickListener {
285284
downloadUpdate()
286-
})
285+
}
287286
}
288287
// return
289288
}

app/src/main/kotlin/com/fox2code/mmm/utils/sentry/SentryMain.kt

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ object SentryMain {
7979
isSentryEnabled = sharedPreferences.getBoolean("pref_crash_reporting_enabled", false)
8080
// set sentryEnabled on preference change of pref_crash_reporting_enabled
8181
sharedPreferences.registerOnSharedPreferenceChangeListener { sharedPreferences1: SharedPreferences, s: String? ->
82-
if (s!== null && s == "pref_crash_reporting_enabled") {
82+
if (s !== null && s == "pref_crash_reporting_enabled") {
8383
isSentryEnabled = sharedPreferences1.getBoolean(s, false)
8484
}
8585
}
@@ -137,7 +137,10 @@ object SentryMain {
137137
}
138138
}
139139
// remove all failed to fetch data messages
140-
if (event?.message?.message?.contains("Failed to fetch") == true || event?.message?.message?.contains("Failed to load") == true) {
140+
if (event?.message?.message?.contains("Failed to fetch") == true || event?.message?.message?.contains(
141+
"Failed to load"
142+
) == true
143+
) {
141144
return@BeforeSendCallback null
142145
}
143146
// for httpexception, do not send if error is 401, 403, 404, 429
@@ -155,13 +158,15 @@ object SentryMain {
155158
// Filter breadcrumb content from crash report.
156159
options.beforeBreadcrumb =
157160
BeforeBreadcrumbCallback { breadcrumb: Breadcrumb, _: Hint? ->
161+
if (!isSentryEnabled) {
162+
return@BeforeBreadcrumbCallback null
163+
}
158164
val url = breadcrumb.getData("url") as String?
159-
if (url.isNullOrEmpty()) return@BeforeBreadcrumbCallback null
160165
if ("cloudflare-dns.com" == Uri.parse(url).host) {
161166
return@BeforeBreadcrumbCallback null
162167
}
163168
if (isAndroidacyLink(url)) {
164-
breadcrumb.setData("url", hideToken(url))
169+
url?.let { hideToken(it) }?.let { breadcrumb.setData("url", it) }
165170
}
166171
breadcrumb
167172
}

0 commit comments

Comments
 (0)