From ac87a140cc4f3362da99f9402937756fc73b7573 Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Sat, 4 Sep 2021 19:34:24 +0600 Subject: [PATCH] fixes --- .../kmppscriptbuilder/core/models/License.kt | 16 +++++++-------- .../inmo/kmppscriptbuilder/desktop/Builder.kt | 8 +++++--- .../desktop/utils/OpenLink.kt | 1 - .../desktop/views/BuilderView.kt | 20 ++++++------------- .../desktop/views/DevelopersView.kt | 2 +- .../desktop/views/LicensesView.kt | 2 +- .../desktop/views/ListView.kt | 8 +++++--- .../desktop/views/RepositoriesView.kt | 2 +- gradle.properties | 2 +- 9 files changed, 28 insertions(+), 33 deletions(-) diff --git a/core/src/commonMain/kotlin/dev/inmo/kmppscriptbuilder/core/models/License.kt b/core/src/commonMain/kotlin/dev/inmo/kmppscriptbuilder/core/models/License.kt index 5ce25f9..0a36c49 100644 --- a/core/src/commonMain/kotlin/dev/inmo/kmppscriptbuilder/core/models/License.kt +++ b/core/src/commonMain/kotlin/dev/inmo/kmppscriptbuilder/core/models/License.kt @@ -30,19 +30,19 @@ suspend fun HttpClient.getLicenses(): Map { suspend fun HttpClient.searchLicense(name: String): List { val licenses = licenses ?: getLicenses() - val lowerCase = name.toLowerCase() - val upperCase = name.toUpperCase() + val lowerCase = name.lowercase() + val upperCase = name.uppercase() return licenses.values.filter { - it.title.toLowerCase().contains(lowerCase) || it.title.toUpperCase().contains(upperCase) || it.title.contains(name) - || it.id.toLowerCase().contains(lowerCase) || it.id.toUpperCase().contains(upperCase) || it.id.contains(name) + it.title.lowercase().contains(lowerCase) || it.title.uppercase().contains(upperCase) || it.title.contains(name) + || it.id.lowercase().contains(lowerCase) || it.id.uppercase().contains(upperCase) || it.id.contains(name) } } fun Map.searchLicense(name: String): List { - val lowerCase = name.toLowerCase() - val upperCase = name.toUpperCase() + val lowerCase = name.lowercase() + val upperCase = name.uppercase() return values.filter { - it.title.toLowerCase().contains(lowerCase) || it.title.toUpperCase().contains(upperCase) || it.title.contains(name) - || it.id.toLowerCase().contains(lowerCase) || it.id.toUpperCase().contains(upperCase) || it.id.contains(name) + it.title.lowercase().contains(lowerCase) || it.title.uppercase().contains(upperCase) || it.title.contains(name) + || it.id.lowercase().contains(lowerCase) || it.id.uppercase().contains(upperCase) || it.id.contains(name) } } diff --git a/desktop/src/jvmMain/kotlin/dev/inmo/kmppscriptbuilder/desktop/Builder.kt b/desktop/src/jvmMain/kotlin/dev/inmo/kmppscriptbuilder/desktop/Builder.kt index d010436..4c625ab 100644 --- a/desktop/src/jvmMain/kotlin/dev/inmo/kmppscriptbuilder/desktop/Builder.kt +++ b/desktop/src/jvmMain/kotlin/dev/inmo/kmppscriptbuilder/desktop/Builder.kt @@ -3,12 +3,14 @@ package dev.inmo.kmppscriptbuilder.desktop import androidx.compose.desktop.Window import androidx.compose.foundation.* import androidx.compose.foundation.layout.* -import androidx.compose.material.* +import androidx.compose.material.Colors +import androidx.compose.material.MaterialTheme import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color -import dev.inmo.kmppscriptbuilder.desktop.utils.* -import dev.inmo.kmppscriptbuilder.desktop.views.* +import dev.inmo.kmppscriptbuilder.desktop.utils.init +import dev.inmo.kmppscriptbuilder.desktop.utils.loadConfigFile +import dev.inmo.kmppscriptbuilder.desktop.views.BuilderView import java.io.File //private val uncaughtExceptionsBC = BroadcastChannel(Channel.CONFLATED) diff --git a/desktop/src/jvmMain/kotlin/dev/inmo/kmppscriptbuilder/desktop/utils/OpenLink.kt b/desktop/src/jvmMain/kotlin/dev/inmo/kmppscriptbuilder/desktop/utils/OpenLink.kt index e64b29e..c3550ec 100644 --- a/desktop/src/jvmMain/kotlin/dev/inmo/kmppscriptbuilder/desktop/utils/OpenLink.kt +++ b/desktop/src/jvmMain/kotlin/dev/inmo/kmppscriptbuilder/desktop/utils/OpenLink.kt @@ -1,7 +1,6 @@ package dev.inmo.kmppscriptbuilder.desktop.utils import java.awt.Desktop -import java.lang.Exception import java.net.URI fun openLink(link: String): Boolean { diff --git a/desktop/src/jvmMain/kotlin/dev/inmo/kmppscriptbuilder/desktop/views/BuilderView.kt b/desktop/src/jvmMain/kotlin/dev/inmo/kmppscriptbuilder/desktop/views/BuilderView.kt index 7e9200f..3288142 100644 --- a/desktop/src/jvmMain/kotlin/dev/inmo/kmppscriptbuilder/desktop/views/BuilderView.kt +++ b/desktop/src/jvmMain/kotlin/dev/inmo/kmppscriptbuilder/desktop/views/BuilderView.kt @@ -6,18 +6,10 @@ import androidx.compose.foundation.layout.* import androidx.compose.material.* import androidx.compose.runtime.* import androidx.compose.ui.Modifier -import androidx.compose.ui.graphics.asImageBitmap -import androidx.compose.ui.platform.DesktopPlatform -import androidx.compose.ui.res.loadSvgResource -import androidx.compose.ui.res.svgResource -import androidx.compose.ui.unit.Density +import androidx.compose.ui.res.painterResource import androidx.compose.ui.unit.dp import dev.inmo.kmppscriptbuilder.core.models.Config import dev.inmo.kmppscriptbuilder.desktop.utils.* -import dev.inmo.micro_utils.coroutines.safelyWithoutExceptions -import java.awt.Desktop -import java.lang.Exception -import java.net.URL class BuilderView : View() { private val projectTypeView = ProjectTypeView() @@ -53,7 +45,7 @@ class BuilderView : View() { } ) { Image( - painter = svgResource("images/open_file.svg"), + painter = painterResource("images/open_file.svg"), contentDescription = "Open file" ) } @@ -65,7 +57,7 @@ class BuilderView : View() { } ) { Image( - painter = svgResource("images/save_file.svg"), + painter = painterResource("images/save_file.svg"), contentDescription = "Save file" ) } @@ -78,7 +70,7 @@ class BuilderView : View() { } ) { Image( - painter = svgResource("images/export_gradle.svg"), + painter = painterResource("images/export_gradle.svg"), contentDescription = "Export Gradle script" ) } @@ -92,7 +84,7 @@ class BuilderView : View() { } ) { Image( - painter = svgResource("images/save_as.svg"), + painter = painterResource("images/save_as.svg"), contentDescription = "Export Gradle script" ) } @@ -108,4 +100,4 @@ class BuilderView : View() { } } } -} \ No newline at end of file +} diff --git a/desktop/src/jvmMain/kotlin/dev/inmo/kmppscriptbuilder/desktop/views/DevelopersView.kt b/desktop/src/jvmMain/kotlin/dev/inmo/kmppscriptbuilder/desktop/views/DevelopersView.kt index 14599b8..389185a 100644 --- a/desktop/src/jvmMain/kotlin/dev/inmo/kmppscriptbuilder/desktop/views/DevelopersView.kt +++ b/desktop/src/jvmMain/kotlin/dev/inmo/kmppscriptbuilder/desktop/views/DevelopersView.kt @@ -2,7 +2,7 @@ package dev.inmo.kmppscriptbuilder.desktop.views import androidx.compose.runtime.* import dev.inmo.kmppscriptbuilder.core.models.Developer -import dev.inmo.kmppscriptbuilder.desktop.utils.* +import dev.inmo.kmppscriptbuilder.desktop.utils.CommonTextField class DeveloperState( id: String = "", diff --git a/desktop/src/jvmMain/kotlin/dev/inmo/kmppscriptbuilder/desktop/views/LicensesView.kt b/desktop/src/jvmMain/kotlin/dev/inmo/kmppscriptbuilder/desktop/views/LicensesView.kt index dff383b..721ad7c 100644 --- a/desktop/src/jvmMain/kotlin/dev/inmo/kmppscriptbuilder/desktop/views/LicensesView.kt +++ b/desktop/src/jvmMain/kotlin/dev/inmo/kmppscriptbuilder/desktop/views/LicensesView.kt @@ -53,7 +53,7 @@ class LicensesView: VerticalView("Licenses") { licensesOffersToShow.clear() if (licenseSearchFilter.isNotEmpty()) { licensesOffersToShow.addAll( - availableLicensesState.filter { filterText.all { symbol -> symbol.toLowerCase() in it.title } } + availableLicensesState.filter { filterText.all { symbol -> symbol.lowercaseChar() in it.title } } ) } } diff --git a/desktop/src/jvmMain/kotlin/dev/inmo/kmppscriptbuilder/desktop/views/ListView.kt b/desktop/src/jvmMain/kotlin/dev/inmo/kmppscriptbuilder/desktop/views/ListView.kt index ed6161e..5f26c30 100644 --- a/desktop/src/jvmMain/kotlin/dev/inmo/kmppscriptbuilder/desktop/views/ListView.kt +++ b/desktop/src/jvmMain/kotlin/dev/inmo/kmppscriptbuilder/desktop/views/ListView.kt @@ -1,11 +1,13 @@ package dev.inmo.kmppscriptbuilder.desktop.views import androidx.compose.foundation.layout.* -import androidx.compose.material.* -import androidx.compose.runtime.* +import androidx.compose.material.Button +import androidx.compose.runtime.Composable +import androidx.compose.runtime.mutableStateListOf import androidx.compose.ui.Modifier import androidx.compose.ui.unit.dp -import dev.inmo.kmppscriptbuilder.desktop.utils.* +import dev.inmo.kmppscriptbuilder.desktop.utils.CommonText +import dev.inmo.kmppscriptbuilder.desktop.utils.VerticalView abstract class ListView(title: String) : VerticalView(title) { protected val itemsList = mutableStateListOf() diff --git a/desktop/src/jvmMain/kotlin/dev/inmo/kmppscriptbuilder/desktop/views/RepositoriesView.kt b/desktop/src/jvmMain/kotlin/dev/inmo/kmppscriptbuilder/desktop/views/RepositoriesView.kt index f76b2cf..5c36f15 100644 --- a/desktop/src/jvmMain/kotlin/dev/inmo/kmppscriptbuilder/desktop/views/RepositoriesView.kt +++ b/desktop/src/jvmMain/kotlin/dev/inmo/kmppscriptbuilder/desktop/views/RepositoriesView.kt @@ -2,7 +2,7 @@ package dev.inmo.kmppscriptbuilder.desktop.views import androidx.compose.runtime.* import dev.inmo.kmppscriptbuilder.core.models.MavenPublishingRepository -import dev.inmo.kmppscriptbuilder.desktop.utils.* +import dev.inmo.kmppscriptbuilder.desktop.utils.CommonTextField class RepositoryState( name: String = "", diff --git a/gradle.properties b/gradle.properties index d0aabe6..7964ee7 100644 --- a/gradle.properties +++ b/gradle.properties @@ -6,7 +6,7 @@ kotlin.incremental.js=true android.useAndroidX=true android.enableJetifier=true -kotlin_version=1.5.30 +kotlin_version=1.5.21 kotlin_coroutines_version=1.5.2 kotlin_serialisation_core_version=1.2.2 ktor_version=1.6.3