Skip to content
Open
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
140 changes: 69 additions & 71 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
plugins {
alias(libs.plugins.android.application)
alias(libs.plugins.devtools.ksp)
alias(libs.plugins.kotlin.android)
alias(libs.plugins.kotlin.serialization)
alias(libs.plugins.kotlin.compose.compiler)
}

android {
compileSdk = 36
compileSdk = 37
namespace = "com.github.capntrips.kernelflasher"

defaultConfig {
Expand All @@ -34,85 +33,84 @@ android {
vectorDrawables {
useSupportLibrary = true
}
}
}

buildTypes {
release {
isMinifyEnabled = false
isShrinkResources = false
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro"
)
}
buildTypes {
release {
isMinifyEnabled = true
isShrinkResources = true
proguardFiles(
getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro"
)
}
}

sourceSets {
getByName("main") {
jniLibs.srcDirs("src/main/jniLibs")
}
sourceSets {
getByName("main") {
jniLibs.directories += "src/main/jniLibs"
}
}

buildFeatures {
buildConfig = true
aidl = true
compose = true
}
buildFeatures {
buildConfig = true
aidl = true
compose = true
}

compileOptions {
sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21
}

kotlin {
jvmToolchain(21)
compileOptions {
sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21
}

packaging {
resources {
excludes += setOf("/META-INF/{AL2.0,LGPL2.1}")
}

packaging {
resources {
excludes += setOf("/META-INF/{AL2.0,LGPL2.1}")
}
jniLibs {
useLegacyPackaging = true
}
dex {
useLegacyPackaging = true
}
jniLibs {
useLegacyPackaging = true
}

androidResources {
generateLocaleConfig = true
dex {
useLegacyPackaging = true
}
}

ksp {
arg("room.schemaLocation", "$projectDir/schemas")
arg("room.incremental", "true")
}
androidResources {
generateLocaleConfig = true
}
}

kotlin {
jvmToolchain(21)
}

ksp {
arg("room.schemaLocation", "$projectDir/schemas")
arg("room.incremental", "true")
}

dependencies {
implementation(libs.androidx.activity.compose)
implementation(libs.androidx.appcompat)
implementation(libs.androidx.compose.material)
implementation(libs.androidx.compose.material3)
implementation(libs.androidx.compose.foundation)
implementation(libs.androidx.compose.ui)
implementation(libs.androidx.core.ktx)
implementation(libs.androidx.core.splashscreen)
implementation(libs.androidx.lifecycle.runtime.ktx)
implementation(libs.androidx.lifecycle.viewmodel.compose)
implementation(libs.androidx.navigation.compose)
implementation(libs.androidx.room.runtime)
annotationProcessor(libs.androidx.room.compiler)
ksp(libs.androidx.room.compiler)
implementation(libs.libsu.core)
implementation(libs.libsu.io)
implementation(libs.libsu.nio)
implementation(libs.libsu.service)
implementation(libs.material)
implementation(libs.okhttp)
implementation(libs.kotlinx.serialization.json)
implementation(libs.kotlinx.serialization.json)
implementation(libs.retrofit)
implementation(libs.converter.gson)
}
dependencies {
implementation(libs.androidx.activity.compose)
implementation(libs.androidx.appcompat)
implementation(libs.androidx.compose.material)
implementation(libs.androidx.compose.material3)
implementation(libs.androidx.compose.material.icons.core)
implementation(libs.androidx.compose.foundation)
implementation(libs.androidx.compose.ui)
implementation(libs.androidx.core.ktx)
implementation(libs.androidx.core.splashscreen)
implementation(libs.androidx.lifecycle.runtime.ktx)
implementation(libs.androidx.lifecycle.viewmodel.compose)
implementation(libs.androidx.navigation.compose)
implementation(libs.androidx.room.runtime)
annotationProcessor(libs.androidx.room.compiler)
ksp(libs.androidx.room.compiler)
implementation(libs.libsu.core)
implementation(libs.libsu.io)
implementation(libs.libsu.nio)
implementation(libs.libsu.service)
implementation(libs.material)
implementation(libs.okhttp)
implementation(libs.kotlinx.serialization.json)
implementation(libs.retrofit)
implementation(libs.converter.gson)
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.verticalScroll
import androidx.compose.material.ExperimentalMaterialApi
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.ArrowBack
import androidx.compose.material.icons.automirrored.filled.ArrowBack
import androidx.compose.material.pullrefresh.PullRefreshIndicator
import androidx.compose.material.pullrefresh.pullRefresh
import androidx.compose.material.pullrefresh.rememberPullRefreshState
Expand Down Expand Up @@ -73,7 +73,7 @@ fun RefreshableScreen(
modifier = Modifier.padding(16.dp, 8.dp, 0.dp, 8.dp)
) {
Icon(
Icons.Filled.ArrowBack,
Icons.AutoMirrored.Filled.ArrowBack,
contentDescription = stringResource(R.string.back),
tint = MaterialTheme.colorScheme.onSurface
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,7 @@ fun ColumnScope.BackupsContent(
DataCard (viewModel.currentBackup!!) {
val cardWidth = remember { mutableIntStateOf(0) }
val backupId = viewModel.currentBackup!!
val currentBackup = viewModel.backups[backupId]
if(currentBackup == null) return@DataCard
val currentBackup = viewModel.backups[backupId] ?: return@DataCard
DataRow(stringResource(R.string.backup_type), currentBackup.type, mutableMaxWidth = cardWidth)
DataRow(stringResource(R.string.kernel_version), currentBackup.kernelVersion, mutableMaxWidth = cardWidth, clickable = true)
if (currentBackup.type == "raw") {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import java.util.Date
import java.util.Locale
import kotlin.io.path.Path
import kotlin.io.path.name
import androidx.core.net.toUri

@ExperimentalSerializationApi
class UpdatesViewModel(
Expand Down Expand Up @@ -74,7 +75,7 @@ class UpdatesViewModel(
try {
block()
} catch (e: Exception) {
withContext (Dispatchers.Main) {
withContext(Dispatchers.Main) {
Log.e(TAG, e.message, e)
navController.navigate("error/${e.message}") {
popUpTo("main")
Expand Down Expand Up @@ -112,7 +113,7 @@ class UpdatesViewModel(

client.newCall(request).execute().use { response ->
if (!response.isSuccessful) throw IOException("Unexpected response: $response")
val update: Update = Json.decodeFromString(UpdateSerializer, response.body!!.string())
val update: Update = Json.decodeFromString(UpdateSerializer, response.body.string())
update.updateUri = url
update.lastUpdated = Date()
val updateId = updateDao.insert(update).toInt()
Expand All @@ -133,7 +134,7 @@ class UpdatesViewModel(

client.newCall(request).execute().use { response ->
if (!response.isSuccessful) throw IOException("Unexpected response: $response")
val update: Update = Json.decodeFromString(UpdateSerializer, response.body!!.string())
val update: Update = Json.decodeFromString(UpdateSerializer, response.body.string())
currentUpdate!!.let {
withContext (Dispatchers.Main) {
it.kernelName = update.kernelName
Expand Down Expand Up @@ -161,7 +162,7 @@ class UpdatesViewModel(

client.newCall(request).execute().use { response ->
if (!response.isSuccessful) throw IOException("Unexpected response: $response")
changelog = response.body!!.string()
changelog = response.body.string()
withContext (Dispatchers.Main) {
callback.invoke()
}
Expand All @@ -180,7 +181,7 @@ class UpdatesViewModel(

fun downloadKernel(context: Context) {
launch {
val remoteUri = Uri.parse(currentUpdate!!.kernelLink)
val remoteUri = currentUpdate!!.kernelLink.toUri()
val filename = Path(remoteUri.path!!).name
val localUri = insertDownload(context, filename)
localUri!!.let { uri ->
Expand All @@ -190,7 +191,7 @@ class UpdatesViewModel(

client.newCall(request).execute().use { response ->
if (!response.isSuccessful) throw IOException("Unexpected response: $response")
response.body!!.byteStream().use { inputStream ->
response.body.byteStream().use { inputStream ->
context.contentResolver.openOutputStream(uri)!!.use { outputStream ->
inputStream.copyTo(outputStream)
}
Expand Down
6 changes: 4 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,7 @@ kotlin.code.style=official
# resources declared in the library itself and none from the library's dependencies,
# thereby reducing the size of the R class for that library
android.nonTransitiveRClass=true

android.defaults.buildfeatures.buildconfig=true
android.uniquePackageNames=false
android.dependency.useConstraints=true
android.r8.strictFullModeForKeepRules=false
android.generateSyncIssueWhenLibraryConstraintsAreEnabled=false
13 changes: 13 additions & 0 deletions gradle/gradle-daemon-jvm.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#This file is generated by updateDaemonJvm
toolchainUrl.FREE_BSD.AARCH64=https\://api.foojay.io/disco/v3.0/ids/491f83666ae7f4d6ebb28fee72ebb035/redirect
toolchainUrl.FREE_BSD.X86_64=https\://api.foojay.io/disco/v3.0/ids/0d1a1acdc708062093673f65aa9aba4b/redirect
toolchainUrl.LINUX.AARCH64=https\://api.foojay.io/disco/v3.0/ids/491f83666ae7f4d6ebb28fee72ebb035/redirect
toolchainUrl.LINUX.X86_64=https\://api.foojay.io/disco/v3.0/ids/0d1a1acdc708062093673f65aa9aba4b/redirect
toolchainUrl.MAC_OS.AARCH64=https\://api.foojay.io/disco/v3.0/ids/7083b89563e7ce20943037b8cd2b8cc2/redirect
toolchainUrl.MAC_OS.X86_64=https\://api.foojay.io/disco/v3.0/ids/060bbb778a1f55ea705fdebd2ccfeab9/redirect
toolchainUrl.UNIX.AARCH64=https\://api.foojay.io/disco/v3.0/ids/491f83666ae7f4d6ebb28fee72ebb035/redirect
toolchainUrl.UNIX.X86_64=https\://api.foojay.io/disco/v3.0/ids/0d1a1acdc708062093673f65aa9aba4b/redirect
toolchainUrl.WINDOWS.AARCH64=https\://api.foojay.io/disco/v3.0/ids/d09679dc60fe5aa05ef7d03efdefac20/redirect
toolchainUrl.WINDOWS.X86_64=https\://api.foojay.io/disco/v3.0/ids/ed4e3bf2f5e7c5d9aabc4cbd8acd555e/redirect
toolchainVendor=JETBRAINS
toolchainVersion=21
22 changes: 12 additions & 10 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,29 +1,31 @@
[versions]
kotlin = "2.3.0"
kotlin = "2.4.0"

androidx-activity-compose = "1.12.2"
androidx-activity-compose = "1.13.0"
androidx-appcompat = "1.7.1"
androidx-compose = "1.10.0"
androidx-compose-material3 = "1.3.2"
androidx-core-ktx = "1.17.0"
androidx-compose = "1.11.2"
androidx-compose-material3 = "1.4.0"
androidx-compose-material-icons = "1.7.8"
androidx-core-ktx = "1.19.0"
androidx-core-splashscreen = "1.2.0"
androidx-lifecycle = "2.10.0"
androidx-navigation-compose = "2.9.6"
androidx-navigation-compose = "2.9.8"
androidx-room = "2.8.4"
kotlinx-serialization-json = "1.9.0"
libsu = "6.0.0"
material = "1.13.0"
okhttp = "5.3.2"
material = "1.14.0"
okhttp = "5.4.0"

android-application = "8.13.2"
devtools-ksp = "2.3.4"
android-application = "9.2.1"
devtools-ksp = "2.3.9"
retrofit = "3.0.0"

[libraries]
androidx-activity-compose = { group = "androidx.activity", name = "activity-compose", version.ref = "androidx-activity-compose" }
androidx-appcompat = { group = "androidx.appcompat", name = "appcompat", version.ref = "androidx-appcompat" }
androidx-compose-foundation = { group = "androidx.compose.foundation", name = "foundation", version.ref = "androidx-compose" }
androidx-compose-material = { group = "androidx.compose.material", name = "material", version.ref = "androidx-compose" }
androidx-compose-material-icons-core = { group = "androidx.compose.material", name = "material-icons-core", version.ref = "androidx-compose-material-icons" }
androidx-compose-material3 = { group = "androidx.compose.material3", name = "material3", version.ref = "androidx-compose-material3" }
androidx-compose-ui = { group = "androidx.compose.ui", name="ui", version.ref = "androidx-compose" }
androidx-core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "androidx-core-ktx" }
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Fri Apr 14 13:36:42 CDT 2023
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.3-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-9.5.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
3 changes: 3 additions & 0 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ pluginManagement {
mavenCentral()
}
}
plugins {
id("org.gradle.toolchains.foojay-resolver-convention") version "0.10.0"
}
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
Expand Down
Loading