Skip to content

Commit

Permalink
Merge pull request #85 from odaridavid/move-to-shared
Browse files Browse the repository at this point in the history
Move interfaces to `commonMain`
  • Loading branch information
odaridavid authored Mar 21, 2024
2 parents 9d170ee + 3c21810 commit d8f29e3
Show file tree
Hide file tree
Showing 24 changed files with 36 additions and 91 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -83,4 +83,4 @@ class SettingsRepositoryTest {
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -28,5 +28,4 @@ interface RepositoryModule {

@Binds
fun bindRemoteWeatherDataSource(remoteWeatherDataSource: DefaultRemoteWeatherDataSource): RemoteWeatherDataSource

}
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
25 changes: 2 additions & 23 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -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"
Expand All @@ -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" }
Expand All @@ -69,21 +56,17 @@ 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" }
firebase-bom = { module = "com.google.firebase:firebase-bom", version.ref = "firebase-bom" }
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" }
Expand All @@ -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" }
Expand All @@ -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" }
Expand Down
3 changes: 1 addition & 2 deletions iOSApp/iOSApp/ContentView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ struct ContentView: View {
VStack {
Image(systemName: "globe")
.imageScale(.large)
.foregroundStyle(.tint)
Text(Greeting().greet()).padding()}
.foregroundStyle(.tint) }
.padding()
}
}
Expand Down
2 changes: 1 addition & 1 deletion shared/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ kotlin {

sourceSets {
commonMain.dependencies {
// put your multiplatform dependencies here
implementation(libs.coroutines)
}
commonTest.dependencies {
// TODO Add common test dependencies
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.github.odaridavid.weatherapp.core.api
package com.github.odaridavid.weatherapp.api

interface Logger {
fun logException(throwable: Throwable)
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down

This file was deleted.

0 comments on commit d8f29e3

Please sign in to comment.