diff --git a/api/agata/src/commonMain/kotlin/cz/lastaapps/menza/api/agata/data/repo/TodayDishSubsystemRepoImpl.kt b/api/agata/src/commonMain/kotlin/cz/lastaapps/menza/api/agata/data/repo/TodayDishSubsystemRepoImpl.kt index 8239725e..4c2121ef 100644 --- a/api/agata/src/commonMain/kotlin/cz/lastaapps/menza/api/agata/data/repo/TodayDishSubsystemRepoImpl.kt +++ b/api/agata/src/commonMain/kotlin/cz/lastaapps/menza/api/agata/data/repo/TodayDishSubsystemRepoImpl.kt @@ -1,5 +1,5 @@ /* - * Copyright 2023, Petr Laštovička as Lasta apps, All rights reserved + * Copyright 2024, Petr Laštovička as Lasta apps, All rights reserved * * This file is part of Menza. * @@ -144,12 +144,12 @@ internal class TodayDishSubsystemRepoImpl( .toImmutableList() } - mapped.collectLatest { + mapped.collectLatest { categories -> log.i { - val dishCount = it.sumOf { it.dishList.size } - "Collected ${it.size} categories and $dishCount dishes" + val dishCount = categories.sumOf { it.dishList.size } + "Collected ${categories.size} categories and $dishCount dishes" } - send(it) + send(categories) } } }.onStart { diff --git a/api/agata/src/commonMain/kotlin/cz/lastaapps/menza/api/agata/util/ApiCall.kt b/api/agata/src/commonMain/kotlin/cz/lastaapps/menza/api/agata/util/ApiCall.kt index 23014235..50851f03 100644 --- a/api/agata/src/commonMain/kotlin/cz/lastaapps/menza/api/agata/util/ApiCall.kt +++ b/api/agata/src/commonMain/kotlin/cz/lastaapps/menza/api/agata/util/ApiCall.kt @@ -1,5 +1,5 @@ /* - * Copyright 2023, Petr Laštovička as Lasta apps, All rights reserved + * Copyright 2024, Petr Laštovička as Lasta apps, All rights reserved * * This file is part of Menza. * @@ -28,7 +28,7 @@ internal suspend fun HttpClient.getFun( func: Func, subsystemId: Int? = null, secondId: Int? = null, -) = get() { +) = get { parameter("Funkce", func.funName) subsystemId?.let { parameter("Podsystem", it) diff --git a/api/agata/src/commonMain/sqldelight/agata/Address.sq b/api/agata/src/commonMain/sqldelight/agata/Address.sq index fb9a9924..124dddf3 100644 --- a/api/agata/src/commonMain/sqldelight/agata/Address.sq +++ b/api/agata/src/commonMain/sqldelight/agata/Address.sq @@ -1,6 +1,3 @@ -import cz.lastaapps.api.core.domain.model.LatLong; - - CREATE TABLE AddressEntity( id INTEGER NOT NULL, subsystemId INTEGER NOT NULL, diff --git a/api/agata/src/jvmTest/kotlin/cz/lastaapps/api/agata/test/CafeteriaTest.kt b/api/agata/src/jvmTest/kotlin/cz/lastaapps/api/agata/test/CafeteriaTest.kt index 7afe1539..5aceb580 100644 --- a/api/agata/src/jvmTest/kotlin/cz/lastaapps/api/agata/test/CafeteriaTest.kt +++ b/api/agata/src/jvmTest/kotlin/cz/lastaapps/api/agata/test/CafeteriaTest.kt @@ -1,5 +1,5 @@ /* - * Copyright 2023, Petr Laštovička as Lasta apps, All rights reserved + * Copyright 2024, Petr Laštovička as Lasta apps, All rights reserved * * This file is part of Menza. * @@ -22,6 +22,7 @@ package cz.lastaapps.api.agata.test import arrow.core.Either.Right import cz.lastaapps.menza.api.agata.api.CafeteriaApiImpl import cz.lastaapps.menza.api.agata.data.createAgataClient +import cz.lastaapps.menza.api.agata.data.model.AgataBEConfig import cz.lastaapps.menza.api.agata.data.model.dto.DishTypeDto import cz.lastaapps.menza.api.agata.data.model.dto.ServingPlaceDto import cz.lastaapps.menza.api.agata.data.model.dto.SubsystemDto @@ -35,11 +36,12 @@ class CafeteriaTest : StringSpec( { fun client() = createAgataClient( - HttpClient() { + HttpClient { install(Logging) { level = BODY } }, + AgataBEConfig.prod, ) fun api() = CafeteriaApiImpl(client()) diff --git a/api/agata/src/jvmTest/kotlin/cz/lastaapps/api/agata/test/DishApiTest.kt b/api/agata/src/jvmTest/kotlin/cz/lastaapps/api/agata/test/DishApiTest.kt index 96c85e48..82ee8606 100644 --- a/api/agata/src/jvmTest/kotlin/cz/lastaapps/api/agata/test/DishApiTest.kt +++ b/api/agata/src/jvmTest/kotlin/cz/lastaapps/api/agata/test/DishApiTest.kt @@ -1,5 +1,5 @@ /* - * Copyright 2023, Petr Laštovička as Lasta apps, All rights reserved + * Copyright 2024, Petr Laštovička as Lasta apps, All rights reserved * * This file is part of Menza. * @@ -40,7 +40,7 @@ class DishApiTest : StringSpec( { fun client() = createAgataClient( - HttpClient() { + HttpClient { install(Logging) { level = BODY } diff --git a/api/agata/src/jvmTest/kotlin/cz/lastaapps/api/agata/test/SubsystemApiTest.kt b/api/agata/src/jvmTest/kotlin/cz/lastaapps/api/agata/test/SubsystemApiTest.kt index 94f64acf..d4eb5bfc 100644 --- a/api/agata/src/jvmTest/kotlin/cz/lastaapps/api/agata/test/SubsystemApiTest.kt +++ b/api/agata/src/jvmTest/kotlin/cz/lastaapps/api/agata/test/SubsystemApiTest.kt @@ -1,5 +1,5 @@ /* - * Copyright 2023, Petr Laštovička as Lasta apps, All rights reserved + * Copyright 2024, Petr Laštovička as Lasta apps, All rights reserved * * This file is part of Menza. * @@ -39,7 +39,7 @@ class SubsystemApiTest : StringSpec( { fun client() = createAgataClient( - HttpClient() { + HttpClient { install(Logging) { level = BODY } diff --git a/app/src/main/kotlin/cz/lastaapps/menza/features/main/ui/layout/MenzaScaffold.kt b/app/src/main/kotlin/cz/lastaapps/menza/features/main/ui/layout/MenzaScaffold.kt index cd77d976..0db2bc5a 100644 --- a/app/src/main/kotlin/cz/lastaapps/menza/features/main/ui/layout/MenzaScaffold.kt +++ b/app/src/main/kotlin/cz/lastaapps/menza/features/main/ui/layout/MenzaScaffold.kt @@ -1,5 +1,5 @@ /* - * Copyright 2023, Petr Laštovička as Lasta apps, All rights reserved + * Copyright 2024, Petr Laštovička as Lasta apps, All rights reserved * * This file is part of Menza. * @@ -25,7 +25,6 @@ import androidx.compose.foundation.layout.BoxWithConstraints import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.padding import androidx.compose.material3.DrawerState -import androidx.compose.material3.ExperimentalMaterial3Api import androidx.compose.material3.Scaffold import androidx.compose.material3.windowsizeclass.WindowWidthSizeClass import androidx.compose.runtime.Composable diff --git a/app/src/main/kotlin/cz/lastaapps/menza/features/main/ui/vm/AgataWalletViewModel.kt b/app/src/main/kotlin/cz/lastaapps/menza/features/main/ui/vm/AgataWalletViewModel.kt index a54548a8..2c7e4649 100644 --- a/app/src/main/kotlin/cz/lastaapps/menza/features/main/ui/vm/AgataWalletViewModel.kt +++ b/app/src/main/kotlin/cz/lastaapps/menza/features/main/ui/vm/AgataWalletViewModel.kt @@ -112,5 +112,4 @@ internal data class AgataWalletState( val isLoading: Boolean = false, val isWarning: Boolean = false, val balance: Option = None, -) : VMState { -} +) : VMState diff --git a/app/src/main/kotlin/cz/lastaapps/menza/features/other/ui/screen/LicenseScreen.kt b/app/src/main/kotlin/cz/lastaapps/menza/features/other/ui/screen/LicenseScreen.kt index 906b050f..7df642e3 100644 --- a/app/src/main/kotlin/cz/lastaapps/menza/features/other/ui/screen/LicenseScreen.kt +++ b/app/src/main/kotlin/cz/lastaapps/menza/features/other/ui/screen/LicenseScreen.kt @@ -70,7 +70,10 @@ private fun LicenseContent( ) }, detailNode = { - Crossfade(state.selectedLibrary) { lib -> + Crossfade( + state.selectedLibrary, + label = "library_detail", + ) { lib -> if (lib != null) { LibraryDetail(library = lib) } diff --git a/app/src/main/kotlin/cz/lastaapps/menza/features/other/ui/widgets/CrashesList.kt b/app/src/main/kotlin/cz/lastaapps/menza/features/other/ui/widgets/CrashesList.kt index e7fa36cf..5ee48159 100644 --- a/app/src/main/kotlin/cz/lastaapps/menza/features/other/ui/widgets/CrashesList.kt +++ b/app/src/main/kotlin/cz/lastaapps/menza/features/other/ui/widgets/CrashesList.kt @@ -27,7 +27,6 @@ import androidx.compose.foundation.lazy.items import androidx.compose.material3.Button import androidx.compose.material3.Card import androidx.compose.material3.ElevatedCard -import androidx.compose.material3.ExperimentalMaterial3Api import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Surface import androidx.compose.material3.Text @@ -105,7 +104,7 @@ internal fun CrashesList( private fun NoContent() { Text( stringResource(R.string.crash_none_title), - style = MaterialTheme.typography.headlineMedium + style = MaterialTheme.typography.headlineMedium, ) Text(stringResource(R.string.crash_none_subtitle)) Text(stringResource(R.string.crash_none_subsubtitle)) @@ -114,11 +113,11 @@ private fun NoContent() { @Composable private fun Content( crashes: ImmutableList>, - onItemSelected: (Pair) -> Unit + onItemSelected: (Pair) -> Unit, ) { Text( stringResource(R.string.crash_title), - style = MaterialTheme.typography.headlineMedium + style = MaterialTheme.typography.headlineMedium, ) Text(stringResource(R.string.crash_subtitle)) @@ -133,49 +132,49 @@ private fun Content( } } -@OptIn(ExperimentalMaterial3Api::class) @Composable private fun CrashItem(crash: Crash, onClick: () -> Unit) { ElevatedCard(onClick = onClick) { Column(Modifier.padding(16.dp), verticalArrangement = Arrangement.spacedBy(4.dp)) { - with(crash) { + Text( + crash.message ?: stringResource(R.string.crash_message_unknown), + style = MaterialTheme.typography.titleLarge, + ) + Column { Text( - message ?: stringResource(R.string.crash_message_unknown), - style = MaterialTheme.typography.titleLarge, + stringResource( + R.string.crash_date_title, + crash.date.format( + DateTimeFormatter.ISO_LOCAL_DATE_TIME, + ), + ), + ) + Text( + stringResource( + R.string.crash_severity_title, + when (crash.severity) { + ErrorSeverity.CRASH -> stringResource(R.string.crash_severity_crash) + ErrorSeverity.HANDLED -> stringResource(R.string.crash_severity_internal) + }, + ), + ) + Text( + stringResource( + R.string.crash_status_title, + when (crash.reported) { + ReportState.UNREPORTED -> stringResource(R.string.crash_status_unreported) + ReportState.DISMISSED -> stringResource(R.string.crash_status_dismissed) + ReportState.REPORTED -> stringResource(R.string.crash_status_reported) + }, + ), + ) + } + Card { + Text( + crash.trace, + style = MaterialTheme.typography.bodySmall, + modifier = Modifier.padding(8.dp), ) - Column { - Text( - stringResource( - R.string.crash_date_title, crash.date.format( - DateTimeFormatter.ISO_LOCAL_DATE_TIME - ) - ) - ) - Text( - stringResource( - R.string.crash_severity_title, when (crash.severity) { - ErrorSeverity.CRASH -> stringResource(R.string.crash_severity_crash) - ErrorSeverity.HANDLED -> stringResource(R.string.crash_severity_internal) - } - ) - ) - Text( - stringResource( - R.string.crash_status_title, when (crash.reported) { - ReportState.UNREPORTED -> stringResource(R.string.crash_status_unreported) - ReportState.DISMISSED -> stringResource(R.string.crash_status_dismissed) - ReportState.REPORTED -> stringResource(R.string.crash_status_reported) - } - ) - ) - } - Card { - Text( - crash.trace, - style = MaterialTheme.typography.bodySmall, - modifier = Modifier.padding(8.dp) - ) - } } } } diff --git a/app/src/main/kotlin/cz/lastaapps/menza/features/panels/crashreport/ui/CrashesViewModel.kt b/app/src/main/kotlin/cz/lastaapps/menza/features/panels/crashreport/ui/CrashesViewModel.kt index da7a689f..06482307 100644 --- a/app/src/main/kotlin/cz/lastaapps/menza/features/panels/crashreport/ui/CrashesViewModel.kt +++ b/app/src/main/kotlin/cz/lastaapps/menza/features/panels/crashreport/ui/CrashesViewModel.kt @@ -1,5 +1,5 @@ /* - * Copyright 2023, Petr Laštovička as Lasta apps, All rights reserved + * Copyright 2024, Petr Laštovička as Lasta apps, All rights reserved * * This file is part of Menza. * @@ -19,7 +19,6 @@ package cz.lastaapps.menza.features.panels.crashreport.ui -import androidx.lifecycle.viewModelScope import app.cash.sqldelight.coroutines.asFlow import app.cash.sqldelight.coroutines.mapToList import app.cash.sqldelight.coroutines.mapToOne diff --git a/app/src/main/kotlin/cz/lastaapps/menza/features/panels/whatsnew/ui/vm/WhatsNewViewModel.kt b/app/src/main/kotlin/cz/lastaapps/menza/features/panels/whatsnew/ui/vm/WhatsNewViewModel.kt index 7a015add..f2c2dab7 100644 --- a/app/src/main/kotlin/cz/lastaapps/menza/features/panels/whatsnew/ui/vm/WhatsNewViewModel.kt +++ b/app/src/main/kotlin/cz/lastaapps/menza/features/panels/whatsnew/ui/vm/WhatsNewViewModel.kt @@ -19,8 +19,8 @@ package cz.lastaapps.menza.features.panels.whatsnew.ui.vm -import GetAppVersionUC import cz.lastaapps.core.data.DeviceLocalesProvider +import cz.lastaapps.core.domain.usecase.GetAppVersionUC import cz.lastaapps.core.ui.vm.Appearing import cz.lastaapps.core.ui.vm.StateViewModel import cz.lastaapps.core.ui.vm.VMContext diff --git a/app/src/main/kotlin/cz/lastaapps/menza/features/settings/ui/widget/ImageSize.kt b/app/src/main/kotlin/cz/lastaapps/menza/features/settings/ui/widget/ImageSize.kt index 3c117132..3e05f164 100644 --- a/app/src/main/kotlin/cz/lastaapps/menza/features/settings/ui/widget/ImageSize.kt +++ b/app/src/main/kotlin/cz/lastaapps/menza/features/settings/ui/widget/ImageSize.kt @@ -30,7 +30,7 @@ import androidx.compose.material3.Slider import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue -import androidx.compose.runtime.mutableStateOf +import androidx.compose.runtime.mutableFloatStateOf import androidx.compose.runtime.remember import androidx.compose.runtime.setValue import androidx.compose.ui.Alignment @@ -52,7 +52,7 @@ internal fun ImageSizeSetting( onProgressChanged: (Float) -> Unit, modifier: Modifier = Modifier, ) { - var uiProgress by remember(progress) { mutableStateOf(progress) } + var uiProgress by remember(progress) { mutableFloatStateOf(progress) } Column(modifier = modifier) { Row( diff --git a/app/src/main/kotlin/cz/lastaapps/menza/features/settings/ui/widget/apptheme/AppThemeItem.kt b/app/src/main/kotlin/cz/lastaapps/menza/features/settings/ui/widget/apptheme/AppThemeItem.kt index a38f1dc7..88e1658d 100644 --- a/app/src/main/kotlin/cz/lastaapps/menza/features/settings/ui/widget/apptheme/AppThemeItem.kt +++ b/app/src/main/kotlin/cz/lastaapps/menza/features/settings/ui/widget/apptheme/AppThemeItem.kt @@ -33,7 +33,7 @@ import androidx.compose.material3.Surface import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue -import androidx.compose.runtime.mutableStateOf +import androidx.compose.runtime.mutableIntStateOf import androidx.compose.runtime.remember import androidx.compose.runtime.setValue import androidx.compose.ui.Alignment @@ -114,7 +114,7 @@ private object AppThemeItem { @Composable private fun ThemeItemPreview() { Column(verticalArrangement = Arrangement.spacedBy(Padding.Medium)) { - var selected by remember { mutableStateOf(1) } + var selected by remember { mutableIntStateOf(1) } AppThemeType.entries.forEachIndexed { index, theme -> AppThemeItem(theme, DarkMode.Light, selected != index, { selected = index }) } diff --git a/app/src/main/kotlin/cz/lastaapps/menza/features/settings/ui/widget/apptheme/DarkThemeChooser.kt b/app/src/main/kotlin/cz/lastaapps/menza/features/settings/ui/widget/apptheme/DarkThemeChooser.kt index 36841d29..a5d74730 100644 --- a/app/src/main/kotlin/cz/lastaapps/menza/features/settings/ui/widget/apptheme/DarkThemeChooser.kt +++ b/app/src/main/kotlin/cz/lastaapps/menza/features/settings/ui/widget/apptheme/DarkThemeChooser.kt @@ -32,7 +32,6 @@ import androidx.compose.material.icons.Icons import androidx.compose.material.icons.filled.Brightness3 import androidx.compose.material.icons.filled.BrightnessMedium import androidx.compose.material.icons.filled.WbSunny -import androidx.compose.material3.ExperimentalMaterial3Api import androidx.compose.material3.Icon import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Surface @@ -114,7 +113,6 @@ internal fun DarkThemeChooser( } } -@OptIn(ExperimentalMaterial3Api::class) @Composable private fun DarkThemeItem( item: DarkThemeItem, diff --git a/app/src/main/kotlin/cz/lastaapps/menza/features/starting/ui/screen/DownloadScreen.kt b/app/src/main/kotlin/cz/lastaapps/menza/features/starting/ui/screen/DownloadScreen.kt index ba638ced..1c481819 100644 --- a/app/src/main/kotlin/cz/lastaapps/menza/features/starting/ui/screen/DownloadScreen.kt +++ b/app/src/main/kotlin/cz/lastaapps/menza/features/starting/ui/screen/DownloadScreen.kt @@ -119,6 +119,7 @@ private fun DownloadContent( Crossfade( targetState = state.isLoading to state.isReady, modifier = Modifier.fillMaxWidth(), + label = "download_state", ) { (isLoading, isReady) -> when { isLoading && isReady -> { diff --git a/app/src/main/kotlin/cz/lastaapps/menza/ui/components/BadgeIcon.kt b/app/src/main/kotlin/cz/lastaapps/menza/ui/components/BadgeIcon.kt index 60c853dd..480b36a1 100644 --- a/app/src/main/kotlin/cz/lastaapps/menza/ui/components/BadgeIcon.kt +++ b/app/src/main/kotlin/cz/lastaapps/menza/ui/components/BadgeIcon.kt @@ -1,5 +1,5 @@ /* - * Copyright 2023, Petr Laštovička as Lasta apps, All rights reserved + * Copyright 2024, Petr Laštovička as Lasta apps, All rights reserved * * This file is part of Menza. * @@ -21,12 +21,10 @@ package cz.lastaapps.menza.ui.components import androidx.compose.material3.Badge import androidx.compose.material3.BadgedBox -import androidx.compose.material3.ExperimentalMaterial3Api import androidx.compose.material3.Icon import androidx.compose.runtime.Composable import androidx.compose.ui.graphics.vector.ImageVector -@OptIn(ExperimentalMaterial3Api::class) @Composable fun BadgeIcon(icon: ImageVector, showBadge: Boolean) { if (showBadge) diff --git a/app/src/main/kotlin/cz/lastaapps/menza/ui/components/CheckboxWithText.kt b/app/src/main/kotlin/cz/lastaapps/menza/ui/components/CheckboxWithText.kt index 9214b103..cbee07da 100644 --- a/app/src/main/kotlin/cz/lastaapps/menza/ui/components/CheckboxWithText.kt +++ b/app/src/main/kotlin/cz/lastaapps/menza/ui/components/CheckboxWithText.kt @@ -1,5 +1,5 @@ /* - * Copyright 2023, Petr Laštovička as Lasta apps, All rights reserved + * Copyright 2024, Petr Laštovička as Lasta apps, All rights reserved * * This file is part of Menza. * @@ -26,7 +26,6 @@ import androidx.compose.foundation.layout.padding import androidx.compose.material3.Checkbox import androidx.compose.material3.CheckboxColors import androidx.compose.material3.CheckboxDefaults -import androidx.compose.material3.ExperimentalMaterial3Api import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Surface import androidx.compose.runtime.Composable diff --git a/app/src/main/kotlin/cz/lastaapps/menza/ui/components/draggablelazylist/DraggableLazyListState.kt b/app/src/main/kotlin/cz/lastaapps/menza/ui/components/draggablelazylist/DraggableLazyListState.kt index 3dce20a4..ca51e0ca 100644 --- a/app/src/main/kotlin/cz/lastaapps/menza/ui/components/draggablelazylist/DraggableLazyListState.kt +++ b/app/src/main/kotlin/cz/lastaapps/menza/ui/components/draggablelazylist/DraggableLazyListState.kt @@ -1,5 +1,5 @@ /* - * Copyright 2023, Petr Laštovička as Lasta apps, All rights reserved + * Copyright 2024, Petr Laštovička as Lasta apps, All rights reserved * * This file is part of Menza. * @@ -24,6 +24,7 @@ import androidx.compose.foundation.lazy.LazyListState import androidx.compose.foundation.lazy.rememberLazyListState import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue +import androidx.compose.runtime.mutableFloatStateOf import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember import androidx.compose.runtime.setValue @@ -54,10 +55,10 @@ class DraggableLazyListState( private val onMoveFinished: () -> Unit, private val reverse: Boolean = false, ) { - var draggedDistance by mutableStateOf(0f) + private var draggedDistance by mutableFloatStateOf(0f) // used to obtain initial offsets on drag start - var initiallyDraggedElement by mutableStateOf(null) + private var initiallyDraggedElement by mutableStateOf(null) var currentIndexOfDraggedItem by mutableStateOf(null) diff --git a/app/src/main/kotlin/cz/lastaapps/menza/ui/components/placeholders/Placeholder.kt b/app/src/main/kotlin/cz/lastaapps/menza/ui/components/placeholders/Placeholder.kt index 59dfa6ad..d6dc9907 100644 --- a/app/src/main/kotlin/cz/lastaapps/menza/ui/components/placeholders/Placeholder.kt +++ b/app/src/main/kotlin/cz/lastaapps/menza/ui/components/placeholders/Placeholder.kt @@ -1,5 +1,5 @@ /* - * Copyright 2023, Petr Laštovička as Lasta apps, All rights reserved + * Copyright 2024, Petr Laštovička as Lasta apps, All rights reserved * * This file is part of Menza. * @@ -34,7 +34,7 @@ import androidx.compose.animation.core.tween import androidx.compose.animation.core.updateTransition import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue -import androidx.compose.runtime.mutableStateOf +import androidx.compose.runtime.mutableFloatStateOf import androidx.compose.runtime.remember import androidx.compose.runtime.setValue import androidx.compose.ui.Modifier @@ -130,9 +130,9 @@ fun Modifier.placeholder( val lastOutline = remember { Ref() } // The current highlight animation progress - var highlightProgress: Float by remember { mutableStateOf(0f) } + var highlightProgress: Float by remember { mutableFloatStateOf(0f) } - // This is our crossfade transition + // This is our cross-fade transition val transitionState = remember { MutableTransitionState(visible) }.apply { targetState = visible } diff --git a/app/src/main/kotlin/cz/lastaapps/menza/ui/locals/LocalActivityViewModelOwner.kt b/app/src/main/kotlin/cz/lastaapps/menza/ui/locals/LocalActivityViewModelOwner.kt deleted file mode 100644 index df9b2799..00000000 --- a/app/src/main/kotlin/cz/lastaapps/menza/ui/locals/LocalActivityViewModelOwner.kt +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright 2024, Petr Laštovička as Lasta apps, All rights reserved - * - * This file is part of Menza. - * - * Menza is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Menza is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Menza. If not, see . - */ - -package cz.lastaapps.menza.ui.locals - -import androidx.compose.runtime.Composable -import androidx.compose.runtime.ProvidedValue -import androidx.compose.runtime.compositionLocalOf -import androidx.lifecycle.ViewModelStoreOwner - -// Stolen from LocalViewModelOwner -object LocalActivityViewModelOwner { - private val LocalActivityViewModelOwner = - compositionLocalOf { null } - - val current: ViewModelStoreOwner - @Composable - get() = LocalActivityViewModelOwner.current!! - - infix fun provides(viewModelStoreOwner: ViewModelStoreOwner): - ProvidedValue { - return LocalActivityViewModelOwner.provides(viewModelStoreOwner) - } -} diff --git a/app/src/main/kotlin/cz/lastaapps/menza/ui/locals/LocalSnackbarProvider.kt b/app/src/main/kotlin/cz/lastaapps/menza/ui/locals/LocalSnackbarProvider.kt deleted file mode 100644 index 282ed049..00000000 --- a/app/src/main/kotlin/cz/lastaapps/menza/ui/locals/LocalSnackbarProvider.kt +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright 2023, Petr Laštovička as Lasta apps, All rights reserved - * - * This file is part of Menza. - * - * Menza is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * Menza is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Menza. If not, see . - */ - -package cz.lastaapps.menza.ui.locals - -import androidx.compose.material3.SnackbarHostState -import androidx.compose.runtime.Composable -import androidx.compose.runtime.CompositionLocalProvider -import androidx.compose.runtime.compositionLocalOf - -val LocalSnackbarProvider = compositionLocalOf { SnackbarHostState() } - -@Composable -fun WithSnackbarProvider( - snackbarHostState: SnackbarHostState, - content: @Composable () -> Unit, -) { - CompositionLocalProvider(LocalSnackbarProvider provides snackbarHostState) { - content() - } -} \ No newline at end of file diff --git a/app/src/main/kotlin/cz/lastaapps/menza/ui/util/Autofill.kt b/app/src/main/kotlin/cz/lastaapps/menza/ui/util/Autofill.kt index 7ca8e3b6..51b6730d 100644 --- a/app/src/main/kotlin/cz/lastaapps/menza/ui/util/Autofill.kt +++ b/app/src/main/kotlin/cz/lastaapps/menza/ui/util/Autofill.kt @@ -1,5 +1,5 @@ /* - * Copyright 2023, Petr Laštovička as Lasta apps, All rights reserved + * Copyright 2024, Petr Laštovička as Lasta apps, All rights reserved * * This file is part of Menza. * @@ -19,7 +19,6 @@ package cz.lastaapps.menza.ui.util -import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableStateOf import androidx.compose.runtime.remember @@ -28,16 +27,16 @@ import androidx.compose.ui.ExperimentalComposeUiApi import androidx.compose.ui.Modifier import androidx.compose.ui.autofill.AutofillNode import androidx.compose.ui.autofill.AutofillType +import androidx.compose.ui.composed import androidx.compose.ui.geometry.Rect import androidx.compose.ui.layout.boundsInWindow import androidx.compose.ui.layout.onGloballyPositioned @OptIn(ExperimentalComposeUiApi::class) -@Composable fun Modifier.withAutofill( autofillTypes: List = listOf(), onFill: (String) -> Unit, -): Modifier { +): Modifier = composed { var rect by remember { mutableStateOf(null) } AutofillNode( autofillTypes = autofillTypes, @@ -45,7 +44,7 @@ fun Modifier.withAutofill( onFill = onFill, ) - return onGloballyPositioned { + onGloballyPositioned { rect = it.boundsInWindow() } } diff --git a/core/src/commonMain/kotlin/cz/lastaapps/core/data/HttpClient.kt b/core/src/commonMain/kotlin/cz/lastaapps/core/data/HttpClient.kt index 6a86003c..086fc518 100644 --- a/core/src/commonMain/kotlin/cz/lastaapps/core/data/HttpClient.kt +++ b/core/src/commonMain/kotlin/cz/lastaapps/core/data/HttpClient.kt @@ -1,5 +1,5 @@ /* - * Copyright 2023, Petr Laštovička as Lasta apps, All rights reserved + * Copyright 2024, Petr Laštovička as Lasta apps, All rights reserved * * This file is part of Menza. * @@ -30,7 +30,7 @@ import kotlinx.serialization.ExperimentalSerializationApi import kotlinx.serialization.json.Json @OptIn(ExperimentalSerializationApi::class) -internal val httpClient = HttpClient() { +internal val httpClient = HttpClient { install(ContentNegotiation) { json( Json { diff --git a/core/src/commonMain/kotlin/cz/lastaapps/core/di/CoreModule.kt b/core/src/commonMain/kotlin/cz/lastaapps/core/di/CoreModule.kt index a6679595..60b3a170 100644 --- a/core/src/commonMain/kotlin/cz/lastaapps/core/di/CoreModule.kt +++ b/core/src/commonMain/kotlin/cz/lastaapps/core/di/CoreModule.kt @@ -1,5 +1,5 @@ /* - * Copyright 2023, Petr Laštovička as Lasta apps, All rights reserved + * Copyright 2024, Petr Laštovička as Lasta apps, All rights reserved * * This file is part of Menza. * @@ -19,9 +19,9 @@ package cz.lastaapps.core.di -import GetAppVersionUC import cz.lastaapps.core.data.httpClient import cz.lastaapps.core.domain.UCContext +import cz.lastaapps.core.domain.usecase.GetAppVersionUC import cz.lastaapps.core.domain.usecase.IsOnMeteredUC import cz.lastaapps.core.domain.usecase.OpenAppSocialUC import kotlinx.coroutines.Dispatchers diff --git a/core/src/commonMain/kotlin/cz/lastaapps/core/domain/usecase/GetAppVersionUC.kt b/core/src/commonMain/kotlin/cz/lastaapps/core/domain/usecase/GetAppVersionUC.kt index e3f2a522..b2d564fd 100644 --- a/core/src/commonMain/kotlin/cz/lastaapps/core/domain/usecase/GetAppVersionUC.kt +++ b/core/src/commonMain/kotlin/cz/lastaapps/core/domain/usecase/GetAppVersionUC.kt @@ -1,5 +1,5 @@ /* - * Copyright 2023, Petr Laštovička as Lasta apps, All rights reserved + * Copyright 2024, Petr Laštovička as Lasta apps, All rights reserved * * This file is part of Menza. * @@ -17,6 +17,8 @@ * along with Menza. If not, see . */ +package cz.lastaapps.core.domain.usecase + import cz.lastaapps.core.data.AppInfoProvider class GetAppVersionUC internal constructor(private val appInfo: AppInfoProvider) { diff --git a/gradle/plugins/convention/src/main/kotlin/cz/lastaapps/plugin/android/config/KoltinAndroidConfig.kt b/gradle/plugins/convention/src/main/kotlin/cz/lastaapps/plugin/android/config/KoltinAndroidConfig.kt index 9b74e30d..e0925987 100644 --- a/gradle/plugins/convention/src/main/kotlin/cz/lastaapps/plugin/android/config/KoltinAndroidConfig.kt +++ b/gradle/plugins/convention/src/main/kotlin/cz/lastaapps/plugin/android/config/KoltinAndroidConfig.kt @@ -26,7 +26,6 @@ import cz.lastaapps.extensions.kotlinOptions import cz.lastaapps.extensions.libs import org.gradle.api.JavaVersion import org.gradle.api.Project -import org.gradle.jvm.toolchain.JavaLanguageVersion import org.gradle.kotlin.dsl.dependencies internal fun Project.configureKotlinAndroid( diff --git a/lastaapps/crash/src/main/kotlin/cz/lastaapps/crash/db/Adapters.kt b/lastaapps/crash/src/main/kotlin/cz/lastaapps/crash/db/Adapters.kt index 9f3753e9..51e98798 100644 --- a/lastaapps/crash/src/main/kotlin/cz/lastaapps/crash/db/Adapters.kt +++ b/lastaapps/crash/src/main/kotlin/cz/lastaapps/crash/db/Adapters.kt @@ -1,5 +1,5 @@ /* - * Copyright 2023, Petr Laštovička as Lasta apps, All rights reserved + * Copyright 2024, Petr Laštovička as Lasta apps, All rights reserved * * This file is part of Menza. * @@ -39,7 +39,7 @@ object CrashAdapter { } val severityAdapter = object : ColumnAdapter { override fun decode(databaseValue: Long): ErrorSeverity { - return ErrorSeverity.values().find { it.id == databaseValue.toByte() } + return ErrorSeverity.entries.find { it.id == databaseValue.toByte() } ?: error("Error severity not found: $databaseValue") } @@ -47,7 +47,7 @@ object CrashAdapter { } val reportedAdapter = object : ColumnAdapter { override fun decode(databaseValue: Long): ReportState { - return ReportState.values().find { it.id == databaseValue.toByte() } + return ReportState.entries.find { it.id == databaseValue.toByte() } ?: error("Report state not found: $databaseValue") }