Carles Sentis 9 miesięcy temu
rodzic
commit
84fe712fcb

+ 2 - 0
.idea/.gitignore

@@ -1,3 +1,5 @@
 # Default ignored files
 /shelf/
 /workspace.xml
+# GitHub Copilot persisted chat sessions
+/copilot/chatSessions

+ 2 - 2
app/build.gradle.kts

@@ -16,8 +16,8 @@ android {
         applicationId = "com.arklan.weather"
         minSdk = ConfigData.minSdk
         targetSdk = ConfigData.targetSdk
-        versionCode = 13
-        versionName = "2.3"
+        versionCode = 14
+        versionName = "2.4"
         setProperty("archivesBaseName", "weekly-weather-v$versionName.$versionCode")
 
         testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"

+ 1 - 0
core/local/src/main/java/com/codeskraps/core/local/data/db/GeocodingDB.kt

@@ -2,6 +2,7 @@ package com.codeskraps.core.local.data.db
 
 import androidx.room.Database
 import androidx.room.RoomDatabase
+import com.codeskraps.core.local.data.model.GeoLocationEntity
 
 @Database(
     entities = [GeoLocationEntity::class],

+ 1 - 0
core/local/src/main/java/com/codeskraps/core/local/data/db/GeocodingDao.kt

@@ -3,6 +3,7 @@ package com.codeskraps.core.local.data.db
 import androidx.room.Dao
 import androidx.room.Query
 import androidx.room.Upsert
+import com.codeskraps.core.local.data.model.GeoLocationEntity
 
 @Dao
 interface GeocodingDao {

+ 1 - 1
core/local/src/main/java/com/codeskraps/core/local/data/mappers/GeocodingMapper.kt

@@ -1,6 +1,6 @@
 package com.codeskraps.core.local.data.mappers
 
-import com.codeskraps.core.local.data.db.GeoLocationEntity
+import com.codeskraps.core.local.data.model.GeoLocationEntity
 import com.codeskraps.core.local.domain.model.GeoLocation
 import kotlin.random.Random
 

+ 1 - 1
core/local/src/main/java/com/codeskraps/core/local/data/db/GeoLocationEntity.kt → core/local/src/main/java/com/codeskraps/core/local/data/model/GeoLocationEntity.kt

@@ -1,4 +1,4 @@
-package com.codeskraps.core.local.data.db
+package com.codeskraps.core.local.data.model
 
 import androidx.room.Entity
 import androidx.room.PrimaryKey

+ 2 - 5
feature/common/src/main/java/com/codeskraps/feature/common/mvi/StateReducerFlow.kt

@@ -52,17 +52,14 @@ private class StateReducerFlowImpl<STATE, EVENT>(
     }
 }
 
-abstract class StateReducerViewModel<STATE, EVENT, ACTION> : ViewModel() {
+abstract class StateReducerViewModel<STATE, EVENT, ACTION>(initialState: STATE) : ViewModel() {
 
-    private val initState by lazy { initState() }
     val state = StateReducerFlow(
-        initialState = initState,
+        initialState = initialState,
         reduceState = ::reduceState
     )
 
     protected val actionChannel = Channel<ACTION>()
     val action = actionChannel.receiveAsFlow()
-
-    protected abstract fun initState(): STATE
     protected abstract fun reduceState(currentState: STATE, event: EVENT): STATE
 }

+ 1 - 3
feature/geocoding/src/main/java/com/codeskraps/feature/geocoding/presentation/GeocodingViewModel.kt

@@ -23,9 +23,7 @@ class GeocodingViewModel @Inject constructor(
     private val geocodingRepository: GeocodingRepository,
     private val localResources: LocalResourceRepository,
     private val dispatcherProvider: DispatcherProvider
-) : StateReducerViewModel<GeoState, GeoEvent, GeoAction>() {
-
-    override fun initState(): GeoState = GeoState.initial
+) : StateReducerViewModel<GeoState, GeoEvent, GeoAction>(GeoState.initial) {
 
     private var searchJob: Job? = null
 

+ 1 - 1
feature/geocoding/src/main/java/com/codeskraps/feature/geocoding/repository/GeocodingRepository.kt

@@ -5,5 +5,5 @@ import com.codeskraps.feature.common.util.Resource
 
 interface GeocodingRepository {
 
-    suspend fun getGeoLocation(query: String): Resource<List<com.codeskraps.core.local.domain.model.GeoLocation>>
+    suspend fun getGeoLocation(query: String): Resource<List<GeoLocation>>
 }

+ 1 - 2
feature/maps/src/main/java/com/codeskraps/maps/presentation/MapViewModel.kt

@@ -22,8 +22,7 @@ class MapViewModel @Inject constructor(
     private val localGeocodingRepository: LocalGeocodingRepository,
     private val localResources: LocalResourceRepository,
     private val dispatcherProvider: DispatcherProvider,
-) : StateReducerViewModel<MapState, MapEvent, MapAction>() {
-    override fun initState(): MapState = MapState.initial
+) : StateReducerViewModel<MapState, MapEvent, MapAction>(MapState.initial) {
 
     override fun reduceState(currentState: MapState, event: MapEvent): MapState {
         return when (event) {

+ 1 - 2
feature/weather/src/main/java/com/codeskraps/feature/weather/presentation/WeatherViewModel.kt

@@ -28,9 +28,8 @@ class WeatherViewModel @Inject constructor(
     private val localResource: LocalResourceRepository,
     private val dispatcherProvider: DispatcherProvider,
     private val savedStateHandle: SavedStateHandle
-) : StateReducerViewModel<WeatherState, WeatherEvent, WeatherAction>() {
+) : StateReducerViewModel<WeatherState, WeatherEvent, WeatherAction>(WeatherState.initial) {
 
-    override fun initState(): WeatherState = WeatherState.initial
 
     private var currentLocationString: String = ""
 

+ 5 - 2
feature/weather/src/main/java/com/codeskraps/feature/weather/presentation/components/WeatherScreen.kt

@@ -42,6 +42,7 @@ import androidx.compose.ui.Alignment
 import androidx.compose.ui.Modifier
 import androidx.compose.ui.platform.LocalContext
 import androidx.compose.ui.text.style.TextAlign
+import androidx.compose.ui.text.style.TextOverflow
 import androidx.compose.ui.unit.dp
 import androidx.lifecycle.compose.LifecycleResumeEffect
 import com.codeskraps.feature.common.R
@@ -115,13 +116,15 @@ fun WeatherScreen(
                 ),
                 title = {
                     Text(
-                        if (state.error != null) {
+                        text = if (state.error != null) {
                             resources.getString(R.string.error)
                         } else if (state.isLoading) {
                             resources.getString(R.string.loading)
                         } else {
                             state.weatherInfo?.geoLocation ?: ""
-                        }
+                        },
+                        maxLines = 1,
+                        overflow = TextOverflow.Clip
                     )
                 },
                 actions = {

+ 9 - 9
gradle/libs.versions.toml

@@ -1,13 +1,13 @@
 [versions]
-androidxComposeBom = "2023.10.01"
-androidGradlePlugin = "8.2.2"
+androidxComposeBom = "2024.02.02"
+androidGradlePlugin = "8.3.0"
 ktx = "1.12.0"
 compose = "1.8.2"
 immutable = "0.3.7"
-location = "21.1.0"
-hilt = "2.50"
-hilt-navigation = "1.1.0"
-navigationCompose = "2.7.6"
+location = "21.2.0"
+hilt = "2.51"
+hilt-navigation = "1.2.0"
+navigationCompose = "2.7.7"
 lyfecyleCompose = "2.7.0"
 retrofit = "2.9.0"
 junit = "4.13.2"
@@ -15,13 +15,13 @@ junittest = "1.1.5"
 espresso = "3.5.1"
 coroutines = "1.7.3"
 room = "2.6.1"
-material = "1.5.4"
-material3 = "1.1.2"
+material = "1.6.3"
+material3 = "1.2.1"
 org-jetbrains-kotlin-android = "1.9.22"
 appcompat = "1.6.1"
 com-google-android-material-material = "1.11.0"
 ksp = "1.9.22-1.0.17"
-animationGraphicsAndroid = "1.5.4"
+animationGraphicsAndroid = "1.6.3"
 play-services-maps = "18.2.0"
 maps-compose = "4.3.0"
 secretsGradlePlugin = "2.0.1"

+ 1 - 1
gradle/wrapper/gradle-wrapper.properties

@@ -1,6 +1,6 @@
 #Fri Oct 06 11:44:37 CEST 2023
 distributionBase=GRADLE_USER_HOME
 distributionPath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
 zipStoreBase=GRADLE_USER_HOME
 zipStorePath=wrapper/dists