From 62d277dbc4105cb0b357040a9e4e4f8aa6e81f3e Mon Sep 17 00:00:00 2001 From: Felipe Celestino Date: Thu, 4 Jul 2024 23:25:37 -0300 Subject: [PATCH 1/2] changed storage path --- composeApp/build.gradle.kts | 1 + composeApp/src/commonMain/kotlin/utils/FileExtensions.kt | 8 ++++++++ .../src/desktopMain/kotlin/shared/data/DataActual.kt | 6 ++++-- gradle/libs.versions.toml | 2 ++ 4 files changed, 15 insertions(+), 2 deletions(-) create mode 100644 composeApp/src/commonMain/kotlin/utils/FileExtensions.kt diff --git a/composeApp/build.gradle.kts b/composeApp/build.gradle.kts index 0861352..e92e955 100644 --- a/composeApp/build.gradle.kts +++ b/composeApp/build.gradle.kts @@ -57,6 +57,7 @@ kotlin { //implementation(fileTree(mapOf("dir" to "libs", "include" to listOf("*.jar", "*.aar")))) implementation(libs.bundletool) + implementation(libs.kotlin.multiplatform.appdirs) } desktopMain.dependencies { diff --git a/composeApp/src/commonMain/kotlin/utils/FileExtensions.kt b/composeApp/src/commonMain/kotlin/utils/FileExtensions.kt new file mode 100644 index 0000000..15b6e2d --- /dev/null +++ b/composeApp/src/commonMain/kotlin/utils/FileExtensions.kt @@ -0,0 +1,8 @@ +package utils + +import ca.gosyer.appdirs.AppDirs + +fun getUserDataDirPath(): String { + val appDirs = AppDirs("AabToApk", "mobileti") + return appDirs.getUserDataDir() +} \ No newline at end of file diff --git a/composeApp/src/desktopMain/kotlin/shared/data/DataActual.kt b/composeApp/src/desktopMain/kotlin/shared/data/DataActual.kt index a1857fd..83e194f 100644 --- a/composeApp/src/desktopMain/kotlin/shared/data/DataActual.kt +++ b/composeApp/src/desktopMain/kotlin/shared/data/DataActual.kt @@ -4,18 +4,20 @@ import androidx.datastore.core.DataStore import androidx.datastore.preferences.core.Preferences import androidx.room.Room import androidx.room.RoomDatabase +import ca.gosyer.appdirs.AppDirs import data.local.db.ExtractorDatabase import shared.settings.AppSettings import shared.settings.createDataStore +import utils.getUserDataDirPath import java.io.File fun dataStore(): DataStore = createDataStore( - producePath = { System.getProperty("java.io.tmpdir")+"/"+AppSettings.DATA_STORE_FILE } + producePath = { getUserDataDirPath()+"/"+AppSettings.DATA_STORE_FILE } ) fun getDatabaseBuilder(): RoomDatabase.Builder { - val dbFile = File(System.getProperty("java.io.tmpdir"), ExtractorDatabase.DATABASE_NAME) + val dbFile = File(getUserDataDirPath(), ExtractorDatabase.DATABASE_NAME) return Room.databaseBuilder( name = dbFile.absolutePath, ) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 4148c2e..30d7e80 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,6 +1,7 @@ [versions] agp = "8.2.0" bundletool = "1.16.0" +kotlinMultiplatformAppdirs = "1.1.1" ksp = "2.0.0-1.0.21" android-compileSdk = "34" android-minSdk = "26" @@ -35,6 +36,7 @@ koin-android = { module = "io.insert-koin:koin-android", version.ref = "koin" } koin-test = { module = "io.insert-koin:koin-test", version.ref = "koin" } koin-compose = { module = "io.insert-koin:koin-compose", version.ref = "koinCompose" } koin-compose-viewmodel = { module = "io.insert-koin:koin-compose-viewmodel", version.ref = "koinCompose" } +kotlin-multiplatform-appdirs = { module = "ca.gosyer:kotlin-multiplatform-appdirs", version.ref = "kotlinMultiplatformAppdirs" } kotlin-test = { module = "org.jetbrains.kotlin:kotlin-test", version.ref = "kotlin" } kotlin-test-junit = { module = "org.jetbrains.kotlin:kotlin-test-junit", version.ref = "kotlin" } junit = { group = "junit", name = "junit", version.ref = "junit" } From fe676bd0fa5e8f7f28c923e94c31a58d15349af4 Mon Sep 17 00:00:00 2001 From: Felipe Celestino Date: Sat, 6 Jul 2024 19:44:46 -0300 Subject: [PATCH 2/2] package refactor --- composeApp/build.gradle.kts | 10 +++++----- composeApp/src/androidMain/AndroidManifest.xml | 2 +- .../github/feliperce}/aabtoapk/DefaultApplication.kt | 2 +- .../github/feliperce}/aabtoapk/MainActivity.kt | 2 +- .../github/feliperce}/aabtoapk/Permissions.kt | 2 +- .../src/commonMain/kotlin/utils/FileExtensions.kt | 2 +- 6 files changed, 10 insertions(+), 10 deletions(-) rename composeApp/src/androidMain/kotlin/{br/com/mobileti => io/github/feliperce}/aabtoapk/DefaultApplication.kt (93%) rename composeApp/src/androidMain/kotlin/{br/com/mobileti => io/github/feliperce}/aabtoapk/MainActivity.kt (95%) rename composeApp/src/androidMain/kotlin/{br/com/mobileti => io/github/feliperce}/aabtoapk/Permissions.kt (97%) diff --git a/composeApp/build.gradle.kts b/composeApp/build.gradle.kts index e92e955..72073bf 100644 --- a/composeApp/build.gradle.kts +++ b/composeApp/build.gradle.kts @@ -67,7 +67,7 @@ kotlin { } android { - namespace = "br.com.mobileti.aabtoapk" + namespace = "io.github.feliperce.aabtoapk" compileSdk = libs.versions.android.compileSdk.get().toInt() sourceSets["main"].manifest.srcFile("src/androidMain/AndroidManifest.xml") @@ -75,11 +75,11 @@ android { sourceSets["main"].resources.srcDirs("src/commonMain/resources") defaultConfig { - applicationId = "br.com.mobileti.aabtoapk" + applicationId = "io.github.feliperce.aabtoapk" minSdk = libs.versions.android.minSdk.get().toInt() targetSdk = libs.versions.android.targetSdk.get().toInt() - versionCode = 1 - versionName = "0.5" + versionCode = 2 + versionName = "0.5.1" } packaging { resources { @@ -113,7 +113,7 @@ compose.desktop { targetFormats(TargetFormat.Dmg, TargetFormat.Msi, TargetFormat.Deb, TargetFormat.AppImage, TargetFormat.Exe) packageName = "AabToApk" description = "Extract .apk from .aab" - packageVersion = "1.0.0" + packageVersion = "1.0.1" macOS { iconFile.set(project.file("icons/ic_aabtoapk.icns")) } diff --git a/composeApp/src/androidMain/AndroidManifest.xml b/composeApp/src/androidMain/AndroidManifest.xml index 7e7e605..b388ac6 100644 --- a/composeApp/src/androidMain/AndroidManifest.xml +++ b/composeApp/src/androidMain/AndroidManifest.xml @@ -16,7 +16,7 @@