From fbdf1b33c30a469931a6ae8cc23524818381292d Mon Sep 17 00:00:00 2001 From: Maciej Procyk Date: Sat, 16 Mar 2024 20:04:58 +0100 Subject: [PATCH] cleanup code --- .../src/androidMain/AndroidManifest.xml | 22 ++++++------ .../res/drawable/ic_launcher_foreground.xml | 36 +++++++++---------- .../src/androidMain/res/drawable/link.xml | 26 +++++++------- .../in/procyk/shin/ui/ShortenRequest.kt | 6 ++-- .../in/procyk/shin/ui/ShortenResponse.kt | 2 -- .../in/procyk/shin/ui/util/DateTimeUtil.kt | 5 ++- .../in/procyk/shin/ui/util/DecomposeUtil.kt | 1 - .../src/iosMain/kotlin/StateKeeperUtils.kt | 3 +- .../src/main/kotlin/in/procyk/shin/Routes.kt | 5 ++- .../main/kotlin/in/procyk/shin/db/Database.kt | 1 - 10 files changed, 54 insertions(+), 53 deletions(-) diff --git a/composeApp/src/androidMain/AndroidManifest.xml b/composeApp/src/androidMain/AndroidManifest.xml index b87d944..7a863e3 100644 --- a/composeApp/src/androidMain/AndroidManifest.xml +++ b/composeApp/src/androidMain/AndroidManifest.xml @@ -2,20 +2,20 @@ + android:allowBackup="true" + android:icon="@mipmap/ic_launcher" + android:label="@string/app_name" + android:roundIcon="@mipmap/ic_launcher_round" + android:supportsRtl="true" + android:theme="@android:style/Theme.Material.Light.NoActionBar"> + android:exported="true" + android:configChanges="orientation|screenSize|screenLayout|keyboardHidden|mnc|colorMode|density|fontScale|fontWeightAdjustment|keyboard|layoutDirection|locale|mcc|navigation|smallestScreenSize|touchscreen|uiMode" + android:name=".MainActivity"> - + - + diff --git a/composeApp/src/androidMain/res/drawable/ic_launcher_foreground.xml b/composeApp/src/androidMain/res/drawable/ic_launcher_foreground.xml index ced3fd4..5a7ce0b 100644 --- a/composeApp/src/androidMain/res/drawable/ic_launcher_foreground.xml +++ b/composeApp/src/androidMain/res/drawable/ic_launcher_foreground.xml @@ -1,21 +1,21 @@ - + android:width="108dp" + android:height="108dp" + android:viewportWidth="1080" + android:viewportHeight="1080" + android:autoMirrored="true"> + - - + + diff --git a/composeApp/src/androidMain/res/drawable/link.xml b/composeApp/src/androidMain/res/drawable/link.xml index c32b5df..6ffb8a7 100644 --- a/composeApp/src/androidMain/res/drawable/link.xml +++ b/composeApp/src/androidMain/res/drawable/link.xml @@ -1,17 +1,17 @@ + xmlns:android="http://schemas.android.com/apk/res/android" + android:width="200dp" + android:height="200dp" + android:autoMirrored="true" + android:viewportWidth="1080" + android:viewportHeight="1080"> + android:fillColor="#FFFFFF" + android:fillType="nonZero" + android:pathData="M653.6,710.4L540,824Q481.1,882.9 398,882.9Q314.9,882.9 256,824Q197.1,765.1 197.1,682Q197.1,598.9 256,540L369.6,426.4L426.4,483.2L312.8,596.8Q277.3,632.3 277.3,682Q277.3,731.7 312.8,767.2Q348.3,802.7 398,802.7Q447.7,802.7 483.2,767.2L596.8,653.6L653.6,710.4ZM454.8,682L398,625.2L625.2,398L682,454.8L454.8,682ZM710.4,653.6L653.6,596.8L767.2,483.2Q802.7,447.7 802.7,398Q802.7,348.3 767.2,312.8Q731.7,277.3 682,277.3Q632.3,277.3 596.8,312.8L483.2,426.4L426.4,369.6L540,256Q598.9,197.1 682,197.1Q765.1,197.1 824,256Q882.9,314.9 882.9,398Q882.9,481.1 824,540L710.4,653.6Z" + android:strokeWidth="0" + android:strokeColor="#FFFFFF" + android:strokeLineCap="butt" + android:strokeLineJoin="miter"/> diff --git a/composeApp/src/commonMain/kotlin/in/procyk/shin/ui/ShortenRequest.kt b/composeApp/src/commonMain/kotlin/in/procyk/shin/ui/ShortenRequest.kt index 3886e53..5d3395f 100644 --- a/composeApp/src/commonMain/kotlin/in/procyk/shin/ui/ShortenRequest.kt +++ b/composeApp/src/commonMain/kotlin/in/procyk/shin/ui/ShortenRequest.kt @@ -10,7 +10,10 @@ import androidx.compose.foundation.text.KeyboardOptions import androidx.compose.material.icons.Icons import androidx.compose.material.icons.filled.ArrowDropDown import androidx.compose.material3.* -import androidx.compose.runtime.* +import androidx.compose.runtime.Composable +import androidx.compose.runtime.LaunchedEffect +import androidx.compose.runtime.getValue +import androidx.compose.runtime.remember import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.draw.rotate @@ -29,7 +32,6 @@ import `in`.procyk.compose.calendar.rememberSelectableCalendarState import `in`.procyk.compose.calendar.year.YearMonth import `in`.procyk.shin.component.ShinComponent import `in`.procyk.shin.model.ShortenedProtocol -import toNullable @Composable internal fun ShortenRequest( diff --git a/composeApp/src/commonMain/kotlin/in/procyk/shin/ui/ShortenResponse.kt b/composeApp/src/commonMain/kotlin/in/procyk/shin/ui/ShortenResponse.kt index b6f9034..9434b98 100644 --- a/composeApp/src/commonMain/kotlin/in/procyk/shin/ui/ShortenResponse.kt +++ b/composeApp/src/commonMain/kotlin/in/procyk/shin/ui/ShortenResponse.kt @@ -13,7 +13,6 @@ import androidx.compose.material3.OutlinedButton import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue -import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier @@ -24,7 +23,6 @@ import androidx.compose.ui.text.style.TextAlign import androidx.compose.ui.text.style.TextDecoration import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.sp -import applyIf @Composable internal fun ShortenResponse( diff --git a/composeApp/src/commonMain/kotlin/in/procyk/shin/ui/util/DateTimeUtil.kt b/composeApp/src/commonMain/kotlin/in/procyk/shin/ui/util/DateTimeUtil.kt index 3856655..1b7ecf7 100644 --- a/composeApp/src/commonMain/kotlin/in/procyk/shin/ui/util/DateTimeUtil.kt +++ b/composeApp/src/commonMain/kotlin/in/procyk/shin/ui/util/DateTimeUtil.kt @@ -1,4 +1,7 @@ -import kotlinx.datetime.* +import kotlinx.datetime.Instant +import kotlinx.datetime.LocalDate +import kotlinx.datetime.TimeZone +import kotlinx.datetime.toLocalDateTime fun Instant.toLocalDate(): LocalDate = toLocalDateTime(TimeZone.currentSystemDefault()).date diff --git a/composeApp/src/commonMain/kotlin/in/procyk/shin/ui/util/DecomposeUtil.kt b/composeApp/src/commonMain/kotlin/in/procyk/shin/ui/util/DecomposeUtil.kt index 5092a15..58323fc 100644 --- a/composeApp/src/commonMain/kotlin/in/procyk/shin/ui/util/DecomposeUtil.kt +++ b/composeApp/src/commonMain/kotlin/in/procyk/shin/ui/util/DecomposeUtil.kt @@ -1,6 +1,5 @@ package `in`.procyk.shin.ui.util -import com.arkivanov.decompose.Cancellation import com.arkivanov.decompose.value.MutableValue import com.arkivanov.decompose.value.Value import com.arkivanov.essenty.lifecycle.Lifecycle diff --git a/composeApp/src/iosMain/kotlin/StateKeeperUtils.kt b/composeApp/src/iosMain/kotlin/StateKeeperUtils.kt index b937aeb..5dc52fc 100644 --- a/composeApp/src/iosMain/kotlin/StateKeeperUtils.kt +++ b/composeApp/src/iosMain/kotlin/StateKeeperUtils.kt @@ -21,7 +21,8 @@ fun save(coder: NSCoder, state: SerializableContainer) { @Suppress("unused") @OptIn(ExperimentalForeignApi::class, BetaInteropApi::class) fun restore(coder: NSCoder): SerializableContainer? { - val string = coder.decodeTopLevelObjectOfClass(aClass = NSString, forKey = STATE_KEY, error = null) as? String? ?: return null + val string = coder.decodeTopLevelObjectOfClass(aClass = NSString, forKey = STATE_KEY, error = null) as? String? + ?: return null return try { json.decodeFromString(SerializableContainer.serializer(), string) } catch (e: Exception) { diff --git a/server/src/main/kotlin/in/procyk/shin/Routes.kt b/server/src/main/kotlin/in/procyk/shin/Routes.kt index fe22eb1..9ec0021 100644 --- a/server/src/main/kotlin/in/procyk/shin/Routes.kt +++ b/server/src/main/kotlin/in/procyk/shin/Routes.kt @@ -10,16 +10,15 @@ import io.github.cdimascio.dotenv.Dotenv import io.ktor.http.* import io.ktor.server.application.* import io.ktor.server.request.* -import io.ktor.server.resources.* -import io.ktor.server.resources.get as getResource import io.ktor.server.response.* import io.ktor.server.routing.* import io.ktor.util.pipeline.* import kotlinx.coroutines.* -import io.ktor.server.routing.post as postBody import org.koin.ktor.ext.inject import kotlin.time.Duration import kotlin.time.Duration.Companion.hours +import io.ktor.server.resources.get as getResource +import io.ktor.server.routing.post as postBody @OptIn(DelicateCoroutinesApi::class) internal fun Application.installRoutes(): Routing = routing { diff --git a/server/src/main/kotlin/in/procyk/shin/db/Database.kt b/server/src/main/kotlin/in/procyk/shin/db/Database.kt index 98d089e..8e1137d 100644 --- a/server/src/main/kotlin/in/procyk/shin/db/Database.kt +++ b/server/src/main/kotlin/in/procyk/shin/db/Database.kt @@ -1,6 +1,5 @@ package `in`.procyk.shin.db -import RedirectType import `in`.procyk.shin.util.env import io.github.cdimascio.dotenv.Dotenv import org.jetbrains.exposed.sql.Database