Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ android {
applicationId = AppConfig.appId
minSdk = AppConfig.minSdkVersion
targetSdk = AppConfig.targetSdkVersion
versionCode = 17
versionName = "3.0.0"
versionCode = 20
versionName = "3.0.1"
vectorDrawables.useSupportLibrary = true
androidResources {
localeFilters += listOf("en", "de", "pt-rBR", "tr")
Expand Down
3 changes: 2 additions & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,13 @@
<application
android:name=".SysctlGuiApp"
android:allowBackup="false"
android:enableOnBackInvokedCallback="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:localeConfig="@xml/locales_config"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme"
android:enableOnBackInvokedCallback="true"
tools:ignore="GoogleAppIndexingWarning">
<activity android:name=".ui.main.MainActivity" />
<activity
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.SupervisorJob
import kotlinx.coroutines.delay
import kotlinx.coroutines.withContext
import kotlinx.coroutines.withTimeoutOrNull
import org.koin.core.component.KoinComponent
import org.koin.core.component.inject
import kotlin.time.Duration.Companion.seconds
Expand All @@ -31,7 +32,7 @@ class StartUpWorker(
private val context: Context,
workerParams: WorkerParameters
) : CoroutineWorker(context, workerParams), KoinComponent {
private val mainContext = Dispatchers.Main + SupervisorJob()
private val mainContext = Dispatchers.Main.immediate + SupervisorJob()
private val workerContext = Dispatchers.Default
private val appPrefs: AppPrefs by inject()
private val rootUtils: RootUtils by inject()
Expand All @@ -57,7 +58,6 @@ class StartUpWorker(
}
}


return Result.success()
}

Expand All @@ -71,7 +71,10 @@ class StartUpWorker(
}

private suspend fun checkRequirements(): Boolean {
return appPrefs.runOnStartUp && rootUtils.isRootAvailable()
return withTimeoutOrNull(5.seconds) {
rootUtils.getRootShell()
appPrefs.runOnStartUp && rootUtils.isRootAvailable()
} ?: false
}

private suspend inline fun showNotificationAndThen(
Expand Down Expand Up @@ -137,7 +140,6 @@ class StartUpWorker(
delayCount++
}
}

} else {
builder.setContentText(context.getString(R.string.notification_start_up_description))
notifyIfPossible(builder)
Expand All @@ -152,7 +154,7 @@ class StartUpWorker(
) == PackageManager.PERMISSION_GRANTED ||
Build.VERSION.SDK_INT <= Build.VERSION_CODES.TIRAMISU
) {
runCatching { notificationManager.notify(SERVICE_ID, builder.build()) }.onFailure { it.printStackTrace() }
runCatching { notificationManager.notify(SERVICE_ID, builder.build()) }
}
}

Expand Down
7 changes: 7 additions & 0 deletions app/src/main/res/xml/locales_config.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<locale-config xmlns:android="http://schemas.android.com/apk/res/android">
<locale android:name="en" />
<locale android:name="de" />
<locale android:name="pt-rBR" />
<locale android:name="tr" />
</locale-config>
2 changes: 1 addition & 1 deletion buildSrc/src/main/kotlin/AppConfig.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
object AppConfig {
val devCycle = true
val devCycle = false

const val appId = "com.androidvip.sysctlgui"
const val compileSdkVersion = 36
Expand Down