Skip to content

Commit

Permalink
v2024.8.e
Browse files Browse the repository at this point in the history
  • Loading branch information
cioccarellia committed Aug 29, 2024
1 parent 27cfb4e commit 4dce06f
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 27 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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))

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -356,24 +356,26 @@ 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) {
if (!root) {
// 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 {
Expand Down Expand Up @@ -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")

Expand Down Expand Up @@ -474,6 +476,7 @@ class UIBoot : BaseActivity(), LaunchStruct {
bootApp()
return

/*
checkingPermissions = false
if (permission_write_external) {
checkingPermissions = false
Expand Down Expand Up @@ -519,7 +522,7 @@ class UIBoot : BaseActivity(), LaunchStruct {
.show()
}
}, 69, Assent.WRITE_EXTERNAL_STORAGE)
}
}*/
}

override fun onResume() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -484,23 +488,22 @@ class UIDashboard : BaseActivity(), NavigationView.OnNavigationItemSelectedListe
drawer.closeDrawer()
} else {
if (doubleBackToExitPressedOnce) {
super.onBackPressed()
finishAffinity()
return
}
if (preferencesBuilder.getPreferenceBoolean(SettingStore.GENERAL.PRESS_TWICE_TO_EXIT, false)) {
this.doubleBackToExitPressedOnce = true
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()
}
}




}


Expand Down

0 comments on commit 4dce06f

Please sign in to comment.