From 4dce06f8283f0f5583c7fad93f14d6c01167b443 Mon Sep 17 00:00:00 2001 From: cioccarellia Date: Thu, 29 Aug 2024 17:25:10 +0200 Subject: [PATCH] v2024.8.e --- app/build.gradle | 4 ++-- .../androoster/ui/UIGraphic.kt | 6 +----- .../androoster/ui/UIStorage.kt | 6 +----- .../androoster/ui/boot/UIBoot.kt | 19 +++++++++++-------- .../androoster/ui/dashboard/UIDashboard.kt | 17 ++++++++++------- 5 files changed, 25 insertions(+), 27 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index df8fc00..4edb569 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -21,8 +21,8 @@ android { applicationId "com.andreacioccarelli.androoster" minSdkVersion 16 targetSdkVersion 35 - versionCode 58 - versionName "1.5.8" + versionCode 59 + versionName "1.5.9" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" vectorDrawables.useSupportLibrary = true } diff --git a/app/src/main/kotlin/com/andreacioccarelli/androoster/ui/UIGraphic.kt b/app/src/main/kotlin/com/andreacioccarelli/androoster/ui/UIGraphic.kt index 9380302..5a685b5 100644 --- a/app/src/main/kotlin/com/andreacioccarelli/androoster/ui/UIGraphic.kt +++ b/app/src/main/kotlin/com/andreacioccarelli/androoster/ui/UIGraphic.kt @@ -793,11 +793,7 @@ class UIGraphic : BaseActivity(), NavigationView.OnNavigationItemSelectedListene closeApp() return } - if (preferencesBuilder.getPreferenceBoolean( - SettingStore.GENERAL.PRESS_TWICE_TO_EXIT, - false - ) - ) { + if (preferencesBuilder.getPreferenceBoolean(SettingStore.GENERAL.PRESS_TWICE_TO_EXIT, false)) { this.doubleBackToExitPressedOnce = true val UI = UI(this@UIGraphic) UI.normal(getString(R.string.click_again_to_exit)) diff --git a/app/src/main/kotlin/com/andreacioccarelli/androoster/ui/UIStorage.kt b/app/src/main/kotlin/com/andreacioccarelli/androoster/ui/UIStorage.kt index 9a1f5da..be9f95b 100644 --- a/app/src/main/kotlin/com/andreacioccarelli/androoster/ui/UIStorage.kt +++ b/app/src/main/kotlin/com/andreacioccarelli/androoster/ui/UIStorage.kt @@ -590,11 +590,7 @@ class UIStorage : BaseActivity(), NavigationView.OnNavigationItemSelectedListene closeApp() return } - if (preferencesBuilder.getPreferenceBoolean( - SettingStore.GENERAL.PRESS_TWICE_TO_EXIT, - false - ) - ) { + if (preferencesBuilder.getPreferenceBoolean(SettingStore.GENERAL.PRESS_TWICE_TO_EXIT, false)) { this.doubleBackToExitPressedOnce = true UI.normal(getString(R.string.click_again_to_exit)) diff --git a/app/src/main/kotlin/com/andreacioccarelli/androoster/ui/boot/UIBoot.kt b/app/src/main/kotlin/com/andreacioccarelli/androoster/ui/boot/UIBoot.kt index c8038c5..29c8043 100644 --- a/app/src/main/kotlin/com/andreacioccarelli/androoster/ui/boot/UIBoot.kt +++ b/app/src/main/kotlin/com/andreacioccarelli/androoster/ui/boot/UIBoot.kt @@ -38,6 +38,7 @@ import com.kabouzeid.appthemehelper.ThemeStore import es.dmoral.toasty.Toasty import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.Dispatchers +import kotlinx.coroutines.delay import kotlinx.coroutines.launch import java.util.* import kotlin.concurrent.schedule @@ -47,10 +48,9 @@ class UIBoot : BaseActivity(), LaunchStruct { private var TESTING_RELEASE: Boolean = false private var COMPATIBILITY_MODE: Boolean = true private var root: Boolean = false - private var bbInstalled: Boolean = false + private var busyBoxInstalled: Boolean = false private var fs: Boolean = false private var isSedInstalled: Boolean = false - private var permission_write_external: Boolean = false private var environmentChecksPassed = false internal lateinit var UI: UI private lateinit var passwordInput: EditText @@ -356,17 +356,16 @@ class UIBoot : BaseActivity(), LaunchStruct { CoroutineScope(Dispatchers.Main).launch { root = Shell.SU.available() val busyboxOutput = Shell.SH.run("busybox").getStdout() - bbInstalled = !busyboxOutput.contains("not found") + busyBoxInstalled = !busyboxOutput.contains("not found") fs = preferencesBuilder.getBoolean("firstStart", true) - permission_write_external = Assent.isPermissionGranted(Assent.WRITE_EXTERNAL_STORAGE) preferencesBuilder.putBoolean("root", root) - preferencesBuilder.putBoolean("busybox", bbInstalled) + preferencesBuilder.putBoolean("busybox", busyBoxInstalled) // Crashlytics.setBool("has_root", root) // Crashlytics.setBool("has_busybox", bbInstalled) // Crashlytics.setString("details_busybox", busyboxOutput) - COMPATIBILITY_MODE = false + COMPATIBILITY_MODE = true CoroutineScope(Dispatchers.Main).launch { if (COMPATIBILITY_MODE) { @@ -374,6 +373,9 @@ class UIBoot : BaseActivity(), LaunchStruct { // if no root is detected, we just notify with a toast that the app wont work, but boot regardless Toasty.error(this@UIBoot, "Root access not detected! Application running in compatibility mode", Toast.LENGTH_LONG).show() Toasty.warning(this@UIBoot, "Tweaks will not work, no root access detected/granted", Toast.LENGTH_LONG).show() + + // To read toasts in boot screen + delay(500) } bootApp() } else { @@ -433,7 +435,7 @@ class UIBoot : BaseActivity(), LaunchStruct { CoroutineScope(Dispatchers.Main).launch { isSedInstalled = false - isSedInstalled = bbInstalled || Build.VERSION.SDK_INT <= Build.VERSION_CODES.LOLLIPOP_MR1 && !Shell.SU.run("sed").getStdout().toLowerCase().contains("not found") + isSedInstalled = busyBoxInstalled || Build.VERSION.SDK_INT <= Build.VERSION_CODES.LOLLIPOP_MR1 && !Shell.SU.run("sed").getStdout().toLowerCase().contains("not found") val sedCheck = run("sed -i") @@ -474,6 +476,7 @@ class UIBoot : BaseActivity(), LaunchStruct { bootApp() return + /* checkingPermissions = false if (permission_write_external) { checkingPermissions = false @@ -519,7 +522,7 @@ class UIBoot : BaseActivity(), LaunchStruct { .show() } }, 69, Assent.WRITE_EXTERNAL_STORAGE) - } + }*/ } override fun onResume() { diff --git a/app/src/main/kotlin/com/andreacioccarelli/androoster/ui/dashboard/UIDashboard.kt b/app/src/main/kotlin/com/andreacioccarelli/androoster/ui/dashboard/UIDashboard.kt index 51e4c1e..02c4dbd 100644 --- a/app/src/main/kotlin/com/andreacioccarelli/androoster/ui/dashboard/UIDashboard.kt +++ b/app/src/main/kotlin/com/andreacioccarelli/androoster/ui/dashboard/UIDashboard.kt @@ -42,6 +42,10 @@ import com.mikepenz.materialdrawer.DrawerBuilder import com.mikepenz.materialdrawer.model.DividerDrawerItem import com.mikepenz.materialdrawer.model.PrimaryDrawerItem import es.dmoral.toasty.Toasty +import kotlinx.coroutines.CoroutineScope +import kotlinx.coroutines.Dispatchers +import kotlinx.coroutines.delay +import kotlinx.coroutines.launch import java.util.* class UIDashboard : BaseActivity(), NavigationView.OnNavigationItemSelectedListener, LaunchStruct { @@ -484,7 +488,7 @@ class UIDashboard : BaseActivity(), NavigationView.OnNavigationItemSelectedListe drawer.closeDrawer() } else { if (doubleBackToExitPressedOnce) { - super.onBackPressed() + finishAffinity() return } if (preferencesBuilder.getPreferenceBoolean(SettingStore.GENERAL.PRESS_TWICE_TO_EXIT, false)) { @@ -492,15 +496,14 @@ class UIDashboard : BaseActivity(), NavigationView.OnNavigationItemSelectedListe val UI = UI(this@UIDashboard) UI.normal(getString(R.string.click_again_to_exit)) - Timer().schedule(1500){ doubleBackToExitPressedOnce = false } + CoroutineScope(Dispatchers.Main).launch { + delay(1500) + doubleBackToExitPressedOnce = false + } } else { - super.onBackPressed() + finishAffinity() } } - - - - }