From e7d22b7c01c2bbb66543c32bb06526709cd1da95 Mon Sep 17 00:00:00 2001 From: odaridavid Date: Thu, 21 Mar 2024 02:31:09 +0100 Subject: [PATCH 1/3] move core interfaces to `commonMain` --- .../odaridavid/weatherapp/SettingsRepositoryTest.kt | 2 +- .../com/github/odaridavid/weatherapp/MainViewModel.kt | 4 ++-- .../data/settings/DefaultSettingsRepository.kt | 2 +- .../weatherapp/data/weather/DefaultWeatherRepository.kt | 6 +++--- .../odaridavid/weatherapp/data/weather/FirebaseLogger.kt | 2 +- .../github/odaridavid/weatherapp/di/RepositoryModule.kt | 8 ++++---- .../odaridavid/weatherapp/ui/home/HomeViewModel.kt | 4 ++-- .../weatherapp/ui/settings/SettingsViewModel.kt | 4 ++-- .../github/odaridavid/weatherapp/HomeViewModelTest.kt | 6 +++--- .../github/odaridavid/weatherapp/MainViewModelTest.kt | 4 ++-- .../odaridavid/weatherapp/SettingsRepositoryTest.kt | 2 +- .../odaridavid/weatherapp/SettingsViewModelTest.kt | 4 ++-- .../odaridavid/weatherapp/WeatherRepositoryTest.kt | 6 +++--- .../weatherapp/fakes/FakeSettingsRepository.kt | 2 +- iOSApp/iOSApp/ContentView.swift | 3 +-- .../com/github/odaridavid/weatherapp/Platform.android.kt | 7 ------- .../kotlin/com/github/odaridavid/weatherapp/Greeting.kt | 9 --------- .../kotlin/com/github/odaridavid/weatherapp/Platform.kt | 7 ------- .../com/github/odaridavid/weatherapp}/api/Logger.kt | 2 +- .../odaridavid/weatherapp}/api/SettingsRepository.kt | 2 +- .../odaridavid/weatherapp}/api/WeatherRepository.kt | 2 +- .../com/github/odaridavid/weatherapp/Platform.ios.kt | 9 --------- 22 files changed, 32 insertions(+), 65 deletions(-) delete mode 100644 shared/src/androidMain/kotlin/com/github/odaridavid/weatherapp/Platform.android.kt delete mode 100644 shared/src/commonMain/kotlin/com/github/odaridavid/weatherapp/Greeting.kt delete mode 100644 shared/src/commonMain/kotlin/com/github/odaridavid/weatherapp/Platform.kt rename {app/src/main/java/com/github/odaridavid/weatherapp/core => shared/src/commonMain/kotlin/com/github/odaridavid/weatherapp}/api/Logger.kt (56%) rename {app/src/main/java/com/github/odaridavid/weatherapp/core => shared/src/commonMain/kotlin/com/github/odaridavid/weatherapp}/api/SettingsRepository.kt (94%) rename {app/src/main/java/com/github/odaridavid/weatherapp/core => shared/src/commonMain/kotlin/com/github/odaridavid/weatherapp}/api/WeatherRepository.kt (87%) delete mode 100644 shared/src/iosMain/kotlin/com/github/odaridavid/weatherapp/Platform.ios.kt diff --git a/app/src/androidTest/kotlin/com/github/odaridavid/weatherapp/SettingsRepositoryTest.kt b/app/src/androidTest/kotlin/com/github/odaridavid/weatherapp/SettingsRepositoryTest.kt index d5c69d4..31bab17 100644 --- a/app/src/androidTest/kotlin/com/github/odaridavid/weatherapp/SettingsRepositoryTest.kt +++ b/app/src/androidTest/kotlin/com/github/odaridavid/weatherapp/SettingsRepositoryTest.kt @@ -4,7 +4,7 @@ import android.content.Context import androidx.test.core.app.ApplicationProvider import androidx.test.filters.SmallTest import app.cash.turbine.test -import com.github.odaridavid.weatherapp.core.api.SettingsRepository +import com.github.odaridavid.weatherapp.api.SettingsRepository import com.github.odaridavid.weatherapp.data.settings.DefaultSettingsRepository import com.github.odaridavid.weatherapp.model.DefaultLocation import com.github.odaridavid.weatherapp.model.ExcludedData diff --git a/app/src/main/java/com/github/odaridavid/weatherapp/MainViewModel.kt b/app/src/main/java/com/github/odaridavid/weatherapp/MainViewModel.kt index 37f987e..397acf4 100644 --- a/app/src/main/java/com/github/odaridavid/weatherapp/MainViewModel.kt +++ b/app/src/main/java/com/github/odaridavid/weatherapp/MainViewModel.kt @@ -2,8 +2,8 @@ package com.github.odaridavid.weatherapp import androidx.lifecycle.ViewModel import androidx.lifecycle.viewModelScope -import com.github.odaridavid.weatherapp.core.api.Logger -import com.github.odaridavid.weatherapp.core.api.SettingsRepository +import com.github.odaridavid.weatherapp.api.Logger +import com.github.odaridavid.weatherapp.api.SettingsRepository import com.github.odaridavid.weatherapp.model.DefaultLocation import dagger.hilt.android.lifecycle.HiltViewModel import kotlinx.coroutines.flow.MutableStateFlow diff --git a/app/src/main/java/com/github/odaridavid/weatherapp/data/settings/DefaultSettingsRepository.kt b/app/src/main/java/com/github/odaridavid/weatherapp/data/settings/DefaultSettingsRepository.kt index c78082c..3006d5c 100644 --- a/app/src/main/java/com/github/odaridavid/weatherapp/data/settings/DefaultSettingsRepository.kt +++ b/app/src/main/java/com/github/odaridavid/weatherapp/data/settings/DefaultSettingsRepository.kt @@ -5,7 +5,7 @@ import androidx.datastore.preferences.core.Preferences import androidx.datastore.preferences.core.edit import androidx.datastore.preferences.core.stringPreferencesKey import com.github.odaridavid.weatherapp.BuildConfig -import com.github.odaridavid.weatherapp.core.api.SettingsRepository +import com.github.odaridavid.weatherapp.api.SettingsRepository import com.github.odaridavid.weatherapp.data.dataStore import com.github.odaridavid.weatherapp.model.DefaultLocation import com.github.odaridavid.weatherapp.model.ExcludedData diff --git a/app/src/main/java/com/github/odaridavid/weatherapp/data/weather/DefaultWeatherRepository.kt b/app/src/main/java/com/github/odaridavid/weatherapp/data/weather/DefaultWeatherRepository.kt index cbc4eea..310f225 100644 --- a/app/src/main/java/com/github/odaridavid/weatherapp/data/weather/DefaultWeatherRepository.kt +++ b/app/src/main/java/com/github/odaridavid/weatherapp/data/weather/DefaultWeatherRepository.kt @@ -1,8 +1,8 @@ package com.github.odaridavid.weatherapp.data.weather -import com.github.odaridavid.weatherapp.core.api.Logger -import com.github.odaridavid.weatherapp.core.api.SettingsRepository -import com.github.odaridavid.weatherapp.core.api.WeatherRepository +import com.github.odaridavid.weatherapp.api.Logger +import com.github.odaridavid.weatherapp.api.SettingsRepository +import com.github.odaridavid.weatherapp.api.WeatherRepository import com.github.odaridavid.weatherapp.data.weather.remote.RemoteWeatherDataSource import com.github.odaridavid.weatherapp.data.weather.remote.mapThrowableToErrorType import com.github.odaridavid.weatherapp.model.DefaultLocation diff --git a/app/src/main/java/com/github/odaridavid/weatherapp/data/weather/FirebaseLogger.kt b/app/src/main/java/com/github/odaridavid/weatherapp/data/weather/FirebaseLogger.kt index c5470f5..71a4c63 100644 --- a/app/src/main/java/com/github/odaridavid/weatherapp/data/weather/FirebaseLogger.kt +++ b/app/src/main/java/com/github/odaridavid/weatherapp/data/weather/FirebaseLogger.kt @@ -1,6 +1,6 @@ package com.github.odaridavid.weatherapp.data.weather -import com.github.odaridavid.weatherapp.core.api.Logger +import com.github.odaridavid.weatherapp.api.Logger import com.google.firebase.crashlytics.ktx.crashlytics import com.google.firebase.ktx.Firebase import javax.inject.Inject diff --git a/app/src/main/java/com/github/odaridavid/weatherapp/di/RepositoryModule.kt b/app/src/main/java/com/github/odaridavid/weatherapp/di/RepositoryModule.kt index 6f45b68..888dd60 100644 --- a/app/src/main/java/com/github/odaridavid/weatherapp/di/RepositoryModule.kt +++ b/app/src/main/java/com/github/odaridavid/weatherapp/di/RepositoryModule.kt @@ -1,10 +1,10 @@ package com.github.odaridavid.weatherapp.di -import com.github.odaridavid.weatherapp.core.api.Logger -import com.github.odaridavid.weatherapp.core.api.SettingsRepository -import com.github.odaridavid.weatherapp.data.weather.DefaultWeatherRepository -import com.github.odaridavid.weatherapp.core.api.WeatherRepository +import com.github.odaridavid.weatherapp.api.Logger +import com.github.odaridavid.weatherapp.api.SettingsRepository +import com.github.odaridavid.weatherapp.api.WeatherRepository import com.github.odaridavid.weatherapp.data.settings.DefaultSettingsRepository +import com.github.odaridavid.weatherapp.data.weather.DefaultWeatherRepository import com.github.odaridavid.weatherapp.data.weather.FirebaseLogger import com.github.odaridavid.weatherapp.data.weather.remote.DefaultRemoteWeatherDataSource import com.github.odaridavid.weatherapp.data.weather.remote.RemoteWeatherDataSource diff --git a/app/src/main/java/com/github/odaridavid/weatherapp/ui/home/HomeViewModel.kt b/app/src/main/java/com/github/odaridavid/weatherapp/ui/home/HomeViewModel.kt index 7a95809..ed79788 100644 --- a/app/src/main/java/com/github/odaridavid/weatherapp/ui/home/HomeViewModel.kt +++ b/app/src/main/java/com/github/odaridavid/weatherapp/ui/home/HomeViewModel.kt @@ -3,8 +3,8 @@ package com.github.odaridavid.weatherapp.ui.home import androidx.annotation.StringRes import androidx.lifecycle.ViewModel import androidx.lifecycle.viewModelScope -import com.github.odaridavid.weatherapp.core.api.SettingsRepository -import com.github.odaridavid.weatherapp.core.api.WeatherRepository +import com.github.odaridavid.weatherapp.api.SettingsRepository +import com.github.odaridavid.weatherapp.api.WeatherRepository import com.github.odaridavid.weatherapp.model.DefaultLocation import com.github.odaridavid.weatherapp.model.Result import com.github.odaridavid.weatherapp.model.SupportedLanguage diff --git a/app/src/main/java/com/github/odaridavid/weatherapp/ui/settings/SettingsViewModel.kt b/app/src/main/java/com/github/odaridavid/weatherapp/ui/settings/SettingsViewModel.kt index 08ce0ec..6a17073 100644 --- a/app/src/main/java/com/github/odaridavid/weatherapp/ui/settings/SettingsViewModel.kt +++ b/app/src/main/java/com/github/odaridavid/weatherapp/ui/settings/SettingsViewModel.kt @@ -2,8 +2,8 @@ package com.github.odaridavid.weatherapp.ui.settings import androidx.lifecycle.ViewModel import androidx.lifecycle.viewModelScope -import com.github.odaridavid.weatherapp.core.api.Logger -import com.github.odaridavid.weatherapp.core.api.SettingsRepository +import com.github.odaridavid.weatherapp.api.Logger +import com.github.odaridavid.weatherapp.api.SettingsRepository import com.github.odaridavid.weatherapp.model.ExcludedData import com.github.odaridavid.weatherapp.model.SupportedLanguage import com.github.odaridavid.weatherapp.model.TimeFormat diff --git a/app/src/test/java/com/github/odaridavid/weatherapp/HomeViewModelTest.kt b/app/src/test/java/com/github/odaridavid/weatherapp/HomeViewModelTest.kt index 7e8888f..ff7a910 100644 --- a/app/src/test/java/com/github/odaridavid/weatherapp/HomeViewModelTest.kt +++ b/app/src/test/java/com/github/odaridavid/weatherapp/HomeViewModelTest.kt @@ -1,9 +1,9 @@ package com.github.odaridavid.weatherapp import app.cash.turbine.test -import com.github.odaridavid.weatherapp.core.api.Logger -import com.github.odaridavid.weatherapp.core.api.SettingsRepository -import com.github.odaridavid.weatherapp.core.api.WeatherRepository +import com.github.odaridavid.weatherapp.api.Logger +import com.github.odaridavid.weatherapp.api.SettingsRepository +import com.github.odaridavid.weatherapp.api.WeatherRepository import com.github.odaridavid.weatherapp.data.weather.DefaultWeatherRepository import com.github.odaridavid.weatherapp.data.weather.remote.DefaultRemoteWeatherDataSource import com.github.odaridavid.weatherapp.data.weather.remote.OpenWeatherService diff --git a/app/src/test/java/com/github/odaridavid/weatherapp/MainViewModelTest.kt b/app/src/test/java/com/github/odaridavid/weatherapp/MainViewModelTest.kt index 7c8f499..9e62a18 100644 --- a/app/src/test/java/com/github/odaridavid/weatherapp/MainViewModelTest.kt +++ b/app/src/test/java/com/github/odaridavid/weatherapp/MainViewModelTest.kt @@ -1,8 +1,8 @@ package com.github.odaridavid.weatherapp import app.cash.turbine.test -import com.github.odaridavid.weatherapp.core.api.Logger -import com.github.odaridavid.weatherapp.core.api.SettingsRepository +import com.github.odaridavid.weatherapp.api.Logger +import com.github.odaridavid.weatherapp.api.SettingsRepository import com.github.odaridavid.weatherapp.fakes.FakeSettingsRepository import com.github.odaridavid.weatherapp.rules.MainCoroutineRule import io.mockk.every diff --git a/app/src/test/java/com/github/odaridavid/weatherapp/SettingsRepositoryTest.kt b/app/src/test/java/com/github/odaridavid/weatherapp/SettingsRepositoryTest.kt index 72e9d6f..26301cb 100644 --- a/app/src/test/java/com/github/odaridavid/weatherapp/SettingsRepositoryTest.kt +++ b/app/src/test/java/com/github/odaridavid/weatherapp/SettingsRepositoryTest.kt @@ -1,6 +1,6 @@ package com.github.odaridavid.weatherapp -import com.github.odaridavid.weatherapp.core.api.SettingsRepository +import com.github.odaridavid.weatherapp.api.SettingsRepository import com.github.odaridavid.weatherapp.data.settings.DefaultSettingsRepository import com.github.odaridavid.weatherapp.fakes.FakeSettingsRepository import com.github.odaridavid.weatherapp.model.DefaultLocation diff --git a/app/src/test/java/com/github/odaridavid/weatherapp/SettingsViewModelTest.kt b/app/src/test/java/com/github/odaridavid/weatherapp/SettingsViewModelTest.kt index a2220b1..75c6bda 100644 --- a/app/src/test/java/com/github/odaridavid/weatherapp/SettingsViewModelTest.kt +++ b/app/src/test/java/com/github/odaridavid/weatherapp/SettingsViewModelTest.kt @@ -1,8 +1,8 @@ package com.github.odaridavid.weatherapp import app.cash.turbine.test -import com.github.odaridavid.weatherapp.core.api.Logger -import com.github.odaridavid.weatherapp.core.api.SettingsRepository +import com.github.odaridavid.weatherapp.api.Logger +import com.github.odaridavid.weatherapp.api.SettingsRepository import com.github.odaridavid.weatherapp.fakes.FakeSettingsRepository import com.github.odaridavid.weatherapp.model.ExcludedData import com.github.odaridavid.weatherapp.model.SupportedLanguage diff --git a/app/src/test/java/com/github/odaridavid/weatherapp/WeatherRepositoryTest.kt b/app/src/test/java/com/github/odaridavid/weatherapp/WeatherRepositoryTest.kt index 94fdb29..24e41cd 100644 --- a/app/src/test/java/com/github/odaridavid/weatherapp/WeatherRepositoryTest.kt +++ b/app/src/test/java/com/github/odaridavid/weatherapp/WeatherRepositoryTest.kt @@ -1,8 +1,8 @@ package com.github.odaridavid.weatherapp -import com.github.odaridavid.weatherapp.core.api.Logger -import com.github.odaridavid.weatherapp.core.api.SettingsRepository -import com.github.odaridavid.weatherapp.core.api.WeatherRepository +import com.github.odaridavid.weatherapp.api.Logger +import com.github.odaridavid.weatherapp.api.SettingsRepository +import com.github.odaridavid.weatherapp.api.WeatherRepository import com.github.odaridavid.weatherapp.data.weather.DefaultWeatherRepository import com.github.odaridavid.weatherapp.data.weather.remote.DefaultRemoteWeatherDataSource import com.github.odaridavid.weatherapp.data.weather.remote.OpenWeatherService diff --git a/app/src/test/java/com/github/odaridavid/weatherapp/fakes/FakeSettingsRepository.kt b/app/src/test/java/com/github/odaridavid/weatherapp/fakes/FakeSettingsRepository.kt index 9dd3162..585473a 100644 --- a/app/src/test/java/com/github/odaridavid/weatherapp/fakes/FakeSettingsRepository.kt +++ b/app/src/test/java/com/github/odaridavid/weatherapp/fakes/FakeSettingsRepository.kt @@ -1,6 +1,6 @@ package com.github.odaridavid.weatherapp.fakes -import com.github.odaridavid.weatherapp.core.api.SettingsRepository +import com.github.odaridavid.weatherapp.api.SettingsRepository import com.github.odaridavid.weatherapp.data.settings.DefaultSettingsRepository.Companion.KEY_EXCLUDED_DATA import com.github.odaridavid.weatherapp.data.settings.DefaultSettingsRepository.Companion.KEY_LANGUAGE import com.github.odaridavid.weatherapp.data.settings.DefaultSettingsRepository.Companion.KEY_LAT_LNG diff --git a/iOSApp/iOSApp/ContentView.swift b/iOSApp/iOSApp/ContentView.swift index c9b60cb..24d52ce 100644 --- a/iOSApp/iOSApp/ContentView.swift +++ b/iOSApp/iOSApp/ContentView.swift @@ -13,8 +13,7 @@ struct ContentView: View { VStack { Image(systemName: "globe") .imageScale(.large) - .foregroundStyle(.tint) - Text(Greeting().greet()).padding()} + .foregroundStyle(.tint) } .padding() } } diff --git a/shared/src/androidMain/kotlin/com/github/odaridavid/weatherapp/Platform.android.kt b/shared/src/androidMain/kotlin/com/github/odaridavid/weatherapp/Platform.android.kt deleted file mode 100644 index 37e8f1f..0000000 --- a/shared/src/androidMain/kotlin/com/github/odaridavid/weatherapp/Platform.android.kt +++ /dev/null @@ -1,7 +0,0 @@ -package com.github.odaridavid.weatherapp - -class AndroidPlatform : Platform { - override val name: String = "Android ${android.os.Build.VERSION.SDK_INT}" -} - -actual fun getPlatform(): Platform = AndroidPlatform() diff --git a/shared/src/commonMain/kotlin/com/github/odaridavid/weatherapp/Greeting.kt b/shared/src/commonMain/kotlin/com/github/odaridavid/weatherapp/Greeting.kt deleted file mode 100644 index ff23e00..0000000 --- a/shared/src/commonMain/kotlin/com/github/odaridavid/weatherapp/Greeting.kt +++ /dev/null @@ -1,9 +0,0 @@ -package com.github.odaridavid.weatherapp - -class Greeting { - private val platform: Platform = getPlatform() - - fun greet(): String { - return "Hello, ${platform.name}!" - } -} diff --git a/shared/src/commonMain/kotlin/com/github/odaridavid/weatherapp/Platform.kt b/shared/src/commonMain/kotlin/com/github/odaridavid/weatherapp/Platform.kt deleted file mode 100644 index fab8d24..0000000 --- a/shared/src/commonMain/kotlin/com/github/odaridavid/weatherapp/Platform.kt +++ /dev/null @@ -1,7 +0,0 @@ -package com.github.odaridavid.weatherapp - -interface Platform { - val name: String -} - -expect fun getPlatform(): Platform diff --git a/app/src/main/java/com/github/odaridavid/weatherapp/core/api/Logger.kt b/shared/src/commonMain/kotlin/com/github/odaridavid/weatherapp/api/Logger.kt similarity index 56% rename from app/src/main/java/com/github/odaridavid/weatherapp/core/api/Logger.kt rename to shared/src/commonMain/kotlin/com/github/odaridavid/weatherapp/api/Logger.kt index 51ebe32..aff8288 100644 --- a/app/src/main/java/com/github/odaridavid/weatherapp/core/api/Logger.kt +++ b/shared/src/commonMain/kotlin/com/github/odaridavid/weatherapp/api/Logger.kt @@ -1,4 +1,4 @@ -package com.github.odaridavid.weatherapp.core.api +package com.github.odaridavid.weatherapp.api interface Logger { fun logException(throwable: Throwable) diff --git a/app/src/main/java/com/github/odaridavid/weatherapp/core/api/SettingsRepository.kt b/shared/src/commonMain/kotlin/com/github/odaridavid/weatherapp/api/SettingsRepository.kt similarity index 94% rename from app/src/main/java/com/github/odaridavid/weatherapp/core/api/SettingsRepository.kt rename to shared/src/commonMain/kotlin/com/github/odaridavid/weatherapp/api/SettingsRepository.kt index b394235..53d855b 100644 --- a/app/src/main/java/com/github/odaridavid/weatherapp/core/api/SettingsRepository.kt +++ b/shared/src/commonMain/kotlin/com/github/odaridavid/weatherapp/api/SettingsRepository.kt @@ -1,4 +1,4 @@ -package com.github.odaridavid.weatherapp.core.api +package com.github.odaridavid.weatherapp.api import com.github.odaridavid.weatherapp.model.DefaultLocation import com.github.odaridavid.weatherapp.model.ExcludedData diff --git a/app/src/main/java/com/github/odaridavid/weatherapp/core/api/WeatherRepository.kt b/shared/src/commonMain/kotlin/com/github/odaridavid/weatherapp/api/WeatherRepository.kt similarity index 87% rename from app/src/main/java/com/github/odaridavid/weatherapp/core/api/WeatherRepository.kt rename to shared/src/commonMain/kotlin/com/github/odaridavid/weatherapp/api/WeatherRepository.kt index c701d6a..5808c89 100644 --- a/app/src/main/java/com/github/odaridavid/weatherapp/core/api/WeatherRepository.kt +++ b/shared/src/commonMain/kotlin/com/github/odaridavid/weatherapp/api/WeatherRepository.kt @@ -1,4 +1,4 @@ -package com.github.odaridavid.weatherapp.core.api +package com.github.odaridavid.weatherapp.api import com.github.odaridavid.weatherapp.model.DefaultLocation import com.github.odaridavid.weatherapp.model.Result diff --git a/shared/src/iosMain/kotlin/com/github/odaridavid/weatherapp/Platform.ios.kt b/shared/src/iosMain/kotlin/com/github/odaridavid/weatherapp/Platform.ios.kt deleted file mode 100644 index fbdb4c2..0000000 --- a/shared/src/iosMain/kotlin/com/github/odaridavid/weatherapp/Platform.ios.kt +++ /dev/null @@ -1,9 +0,0 @@ -package com.github.odaridavid.weatherapp - -import platform.UIKit.UIDevice - -class IOSPlatform: Platform { - override val name: String = UIDevice.currentDevice.systemName() + " " + UIDevice.currentDevice.systemVersion -} - -actual fun getPlatform(): Platform = IOSPlatform() From 2e742f86245ea611c01cbfe145c1e7c36dbb9a17 Mon Sep 17 00:00:00 2001 From: odaridavid Date: Thu, 21 Mar 2024 03:01:11 +0100 Subject: [PATCH 2/3] add coroutines to `commonMain` --- gradle/libs.versions.toml | 25 ++----------------------- shared/build.gradle.kts | 2 +- 2 files changed, 3 insertions(+), 24 deletions(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 6278c0c..f5c33a1 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,26 +1,20 @@ [versions] activity-compose = "1.9.0-alpha03" -# Plugins android-gradle-plugin = "8.3.0" ben-manes-gradle = "0.51.0" chucker = "4.0.0" coil-compose = "2.6.0" -# Firebase com-google-services = "4.4.1" compose-bom = "2024.02.01" compose-navigation = "2.8.0-alpha03" -# Android X core-ktx-version = "1.13.0-alpha05" coroutines-test = "1.8.0" crashlytics-plugin = "2.9.9" datastore = "1.1.0-beta01" firebase-bom = "32.7.3" compose-constraint = "1.0.1" - -# DI hilt = "2.51" hilt-nav-compose = "1.2.0" -# Testing junit = "4.13.2" kotlin = "1.9.22" kotlin-serialization = "1.9.22" @@ -29,38 +23,31 @@ kotlinx-serialization = "1.6.3" kotlinx-serialization-converter = "1.0.0" lifecycle-runtime-ktx = "2.8.0-alpha02" lifecycle-viewmodel-compose = "2.8.0-alpha02" -# Versioning mapsplatform-secrets = "2.0.1" mockk = "1.13.3" okhttp = "4.10.0" -# Play Services play-services-location = "21.1.0" -# Async retrofit = "2.9.0" truth = "1.4.2" turbine = "1.0.0" leakcanary = "3.0-alpha-1" -#InAppUpdate inappupdate = "2.1.0" -#About about-lib = "11.1.0" firebase-perf = "1.4.2" compose-material3 = "1.2.1" androidx-test-runner = "1.5.2" androidx-test-rules = "1.5.0" core-ktx = "1.5.0" +coroutines = "1.8.0" [libraries] activity-compose = { group = "androidx.activity", name = "activity-compose", version.ref = "activity-compose" } -#chucker chucker-debug = { module = "com.github.chuckerteam.chucker:library", version.ref = "chucker" } chucker-release = { module = "com.github.chuckerteam.chucker:library-no-op", version.ref = "chucker" } coil = { module = "io.coil-kt:coil-compose", version.ref = "coil-compose" } com-firebase-crashlytics-plugin = { module = "com.google.firebase:firebase-crashlytics-gradle", version.ref = "crashlytics-plugin" } -#Firebase com-google-services = { module = "com.google.gms:google-services", version.ref = "com-google-services" } compose-bom = { group = "androidx.compose", name = "compose-bom", version.ref = "compose-bom" } - compose-material3 = { group = "androidx.compose.material3", name = "material3-android", version.ref = "compose-material3" } compose-navigation = { group = "androidx.navigation", name = "navigation-compose", version.ref = "compose-navigation" } compose-preview = { group = "androidx.compose.ui", name = "ui-tooling-preview" } @@ -69,7 +56,6 @@ compose-ui-test-manifest = { module = "androidx.compose.ui:ui-test-manifest" } compose-ui-tooling = { module = "androidx.compose.ui:ui-tooling" } compose-viewmodel-lifecycle = { module = "androidx.lifecycle:lifecycle-viewmodel-compose", version.ref = "lifecycle-viewmodel-compose" } compose-constraint = { group = "androidx.constraintlayout", name = "constraintlayout-compose", version.ref = "compose-constraint" } -#AndroidX core-ktx = { module = "androidx.core:core-ktx", version.ref = "core-ktx-version" } coroutines-test = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-test", version.ref = "coroutines-test" } firebase-analytics = { module = "com.google.firebase:firebase-analytics-ktx" } @@ -77,13 +63,10 @@ firebase-bom = { module = "com.google.firebase:firebase-bom", version.ref = "fir firebase-crashlytics = { module = "com.google.firebase:firebase-crashlytics-ktx" } firebase-perfomance-monitoring = { module = "com.google.firebase:firebase-perf" } datastore = { group = "androidx.datastore", name = "datastore-preferences", version.ref = "datastore" } - -#DI +coroutines = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "coroutines" } hilt-android = { module = "com.google.dagger:hilt-android", version.ref = "hilt" } hilt-compiler = { module = "com.google.dagger:hilt-compiler", version.ref = "hilt" } hilt-nav-compose = { group = "androidx.hilt", name = "hilt-navigation-compose", version.ref = "hilt-nav-compose" } - -# Testing junit = { module = "junit:junit", version.ref = "junit" } kotlinx-coroutines-android = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-android", version.ref = "kotlinx-coroutines-android" } kotlinx-serialization = { module = "org.jetbrains.kotlinx:kotlinx-serialization-json", version.ref = "kotlinx-serialization" } @@ -95,15 +78,12 @@ okhttp = { module = "com.squareup.okhttp3:okhttp" } okhttp-bom = { module = "com.squareup.okhttp3:okhttp-bom", version.ref = "okhttp" } okhttp-logging-interceptor = { module = "com.squareup.okhttp3:logging-interceptor" } playservices-location = { module = "com.google.android.gms:play-services-location", version.ref = "play-services-location" } -# Async retrofit = { module = "com.squareup.retrofit2:retrofit", version.ref = "retrofit" } truth = { module = "com.google.truth:truth", version.ref = "truth" } turbine = { module = "app.cash.turbine:turbine", version.ref = "turbine" } leakcanary = { module = "com.squareup.leakcanary:leakcanary-android", version.ref = "leakcanary" } -#InAppUpdate inapp-update = { module = "com.google.android.play:app-update", version.ref = "inappupdate" } inapp-update-ktx = { module = "com.google.android.play:app-update-ktx", version.ref = "inappupdate" } -#About about-lib-core = { module = "com.mikepenz:aboutlibraries-core", version.ref = "about-lib" } about-lib-compose-ui = { module = "com.mikepenz:aboutlibraries-compose-m3", version.ref = "about-lib" } android-test-runner = { module = "androidx.test:runner", version.ref = "androidx-test-runner" } @@ -117,7 +97,6 @@ dagger-hilt-android = { id = "com.google.dagger.hilt.android", version.ref = "hi mapsplatform-secrets-gradle-plugin = { id = "com.google.android.libraries.mapsplatform.secrets-gradle-plugin", version.ref = "mapsplatform-secrets" } org-jetbrains-kotlin-android = { id = "org.jetbrains.kotlin.android", version.ref = "kotlin" } org-jetbrains-kotlin-plugin-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin-serialization" } -#Multiplatform kotlinMultiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin" } kotlinCocoapods = { id = "org.jetbrains.kotlin.native.cocoapods", version.ref = "kotlin" } about-lib-plugin = { id = "com.mikepenz.aboutlibraries.plugin", version.ref = "about-lib" } diff --git a/shared/build.gradle.kts b/shared/build.gradle.kts index 7e83653..03a7af8 100644 --- a/shared/build.gradle.kts +++ b/shared/build.gradle.kts @@ -25,7 +25,7 @@ kotlin { sourceSets { commonMain.dependencies { - // put your multiplatform dependencies here + implementation(libs.coroutines) } commonTest.dependencies { // TODO Add common test dependencies From 3c2181042c2a69f9b7e0e175277dc264aac9467d Mon Sep 17 00:00:00 2001 From: odaridavid Date: Thu, 21 Mar 2024 03:03:14 +0100 Subject: [PATCH 3/3] ktlint fix --- .../com/github/odaridavid/weatherapp/SettingsRepositoryTest.kt | 2 +- .../com/github/odaridavid/weatherapp/di/RepositoryModule.kt | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/app/src/androidTest/kotlin/com/github/odaridavid/weatherapp/SettingsRepositoryTest.kt b/app/src/androidTest/kotlin/com/github/odaridavid/weatherapp/SettingsRepositoryTest.kt index 31bab17..a716980 100644 --- a/app/src/androidTest/kotlin/com/github/odaridavid/weatherapp/SettingsRepositoryTest.kt +++ b/app/src/androidTest/kotlin/com/github/odaridavid/weatherapp/SettingsRepositoryTest.kt @@ -83,4 +83,4 @@ class SettingsRepositoryTest { } } } -} \ No newline at end of file +} diff --git a/app/src/main/java/com/github/odaridavid/weatherapp/di/RepositoryModule.kt b/app/src/main/java/com/github/odaridavid/weatherapp/di/RepositoryModule.kt index 888dd60..de4035b 100644 --- a/app/src/main/java/com/github/odaridavid/weatherapp/di/RepositoryModule.kt +++ b/app/src/main/java/com/github/odaridavid/weatherapp/di/RepositoryModule.kt @@ -28,5 +28,4 @@ interface RepositoryModule { @Binds fun bindRemoteWeatherDataSource(remoteWeatherDataSource: DefaultRemoteWeatherDataSource): RemoteWeatherDataSource - }