Skip to content

Commit

Permalink
Merge pull request #520 from nimblehq/feature/kmm-support-refactor-al…
Browse files Browse the repository at this point in the history
…l-package-names

[#515] [KMM Support] Refactor package names (reopen)
  • Loading branch information
ryan-conway authored Oct 2, 2023
2 parents 72a7df8 + 161f9e0 commit 0a6b800
Show file tree
Hide file tree
Showing 42 changed files with 90 additions and 92 deletions.
4 changes: 2 additions & 2 deletions template-compose/app/proguard-rules.pro
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,5 @@
#-renamesourcefileattribute SourceFile

# Data class
-keepclassmembers class co.nimblehq.template.compose.data.request.** { *; }
-keepclassmembers class co.nimblehq.template.compose.data.response.** { *; }
-keepclassmembers class co.nimblehq.template.compose.data.requests.** { *; }
-keepclassmembers class co.nimblehq.template.compose.data.responses.** { *; }
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package co.nimblehq.template.compose.di.modules

import co.nimblehq.template.compose.data.service.providers.MoshiBuilderProvider
import co.nimblehq.template.compose.data.services.providers.MoshiBuilderProvider
import com.squareup.moshi.Moshi
import dagger.Module
import dagger.Provides
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import androidx.datastore.core.DataStore
import androidx.datastore.preferences.core.PreferenceDataStoreFactory
import androidx.datastore.preferences.core.Preferences
import androidx.datastore.preferences.preferencesDataStoreFile
import co.nimblehq.template.compose.data.repository.AppPreferencesRepositoryImpl
import co.nimblehq.template.compose.domain.repository.AppPreferencesRepository
import co.nimblehq.template.compose.data.repositories.AppPreferencesRepositoryImpl
import co.nimblehq.template.compose.domain.repositories.AppPreferencesRepository
import dagger.*
import dagger.hilt.InstallIn
import dagger.hilt.android.qualifiers.ApplicationContext
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package co.nimblehq.template.compose.di.modules

import co.nimblehq.template.compose.data.repository.RepositoryImpl
import co.nimblehq.template.compose.data.service.ApiService
import co.nimblehq.template.compose.domain.repository.Repository
import co.nimblehq.template.compose.data.repositories.RepositoryImpl
import co.nimblehq.template.compose.data.services.ApiService
import co.nimblehq.template.compose.domain.repositories.Repository
import dagger.Module
import dagger.Provides
import dagger.hilt.InstallIn
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
package co.nimblehq.template.compose.di.modules

import co.nimblehq.template.compose.BuildConfig
import co.nimblehq.template.compose.data.service.ApiService
import co.nimblehq.template.compose.data.service.providers.ApiServiceProvider
import co.nimblehq.template.compose.data.service.providers.ConverterFactoryProvider
import co.nimblehq.template.compose.data.service.providers.RetrofitProvider
import co.nimblehq.template.compose.data.services.ApiService
import co.nimblehq.template.compose.data.services.providers.*
import com.squareup.moshi.Moshi
import dagger.Module
import dagger.Provides
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package co.nimblehq.template.compose.di.modules

import android.content.Context
import co.nimblehq.template.compose.data.storage.EncryptedSharedPreferences
import co.nimblehq.template.compose.data.storages.EncryptedSharedPreferences
import dagger.Module
import dagger.Provides
import dagger.hilt.InstallIn
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package co.nimblehq.template.compose.ui.models

import co.nimblehq.template.compose.domain.models.Model

data class UiModel(
val id: Int
)

fun Model.toUiModel() = UiModel(id = id ?: -1)
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ import androidx.hilt.navigation.compose.hiltViewModel
import androidx.lifecycle.compose.collectAsStateWithLifecycle
import co.nimblehq.template.compose.R
import co.nimblehq.template.compose.extensions.collectAsEffect
import co.nimblehq.template.compose.model.UiModel
import co.nimblehq.template.compose.ui.AppDestination
import co.nimblehq.template.compose.ui.models.UiModel
import co.nimblehq.template.compose.ui.showToast
import co.nimblehq.template.compose.ui.theme.AppTheme.dimensions
import co.nimblehq.template.compose.ui.theme.ComposeTheme
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package co.nimblehq.template.compose.ui.screens.home

import androidx.lifecycle.viewModelScope
import co.nimblehq.template.compose.domain.usecase.UseCase
import co.nimblehq.template.compose.model.UiModel
import co.nimblehq.template.compose.model.toUiModel
import co.nimblehq.template.compose.domain.usecases.UseCase
import co.nimblehq.template.compose.ui.base.BaseViewModel
import co.nimblehq.template.compose.ui.models.UiModel
import co.nimblehq.template.compose.ui.models.toUiModel
import co.nimblehq.template.compose.util.DispatchersProvider
import dagger.hilt.android.lifecycle.HiltViewModel
import kotlinx.coroutines.flow.*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package co.nimblehq.template.compose.test

import co.nimblehq.template.compose.domain.model.Model
import co.nimblehq.template.compose.domain.models.Model

object MockUtil {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import androidx.compose.ui.test.*
import androidx.compose.ui.test.junit4.*
import androidx.test.ext.junit.rules.ActivityScenarioRule
import co.nimblehq.template.compose.R
import co.nimblehq.template.compose.domain.usecase.UseCase
import co.nimblehq.template.compose.domain.usecases.UseCase
import co.nimblehq.template.compose.test.MockUtil
import co.nimblehq.template.compose.ui.AppDestination
import co.nimblehq.template.compose.ui.screens.BaseScreenTest
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package co.nimblehq.template.compose.ui.screens.home

import app.cash.turbine.test
import co.nimblehq.template.compose.domain.usecase.UseCase
import co.nimblehq.template.compose.model.toUiModel
import co.nimblehq.template.compose.domain.usecases.UseCase
import co.nimblehq.template.compose.test.CoroutineTestRule
import co.nimblehq.template.compose.test.MockUtil
import co.nimblehq.template.compose.ui.models.toUiModel
import co.nimblehq.template.compose.util.DispatchersProvider
import io.kotest.matchers.shouldBe
import io.mockk.every
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package co.nimblehq.template.compose.data.extensions

import co.nimblehq.template.compose.data.response.ErrorResponse
import co.nimblehq.template.compose.data.response.toModel
import co.nimblehq.template.compose.data.service.providers.MoshiBuilderProvider
import co.nimblehq.template.compose.data.responses.ErrorResponse
import co.nimblehq.template.compose.data.responses.toModel
import co.nimblehq.template.compose.data.services.providers.MoshiBuilderProvider
import co.nimblehq.template.compose.domain.exceptions.ApiException
import co.nimblehq.template.compose.domain.exceptions.NoConnectivityException
import com.squareup.moshi.JsonDataException
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package co.nimblehq.template.compose.data.repository
package co.nimblehq.template.compose.data.repositories

import android.util.Log
import androidx.datastore.core.DataStore
import androidx.datastore.preferences.core.*
import co.nimblehq.template.compose.domain.repository.AppPreferencesRepository
import co.nimblehq.template.compose.domain.repositories.AppPreferencesRepository
import kotlinx.coroutines.flow.*
import java.io.IOException
import javax.inject.Inject
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package co.nimblehq.template.compose.data.repository
package co.nimblehq.template.compose.data.repositories

import co.nimblehq.template.compose.data.extensions.flowTransform
import co.nimblehq.template.compose.data.response.toModels
import co.nimblehq.template.compose.data.service.ApiService
import co.nimblehq.template.compose.domain.model.Model
import co.nimblehq.template.compose.domain.repository.Repository
import co.nimblehq.template.compose.data.responses.toModels
import co.nimblehq.template.compose.data.services.ApiService
import co.nimblehq.template.compose.domain.models.Model
import co.nimblehq.template.compose.domain.repositories.Repository
import kotlinx.coroutines.flow.Flow

class RepositoryImpl constructor(
Expand Down
Empty file.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package co.nimblehq.template.compose.data.response
package co.nimblehq.template.compose.data.responses

import co.nimblehq.template.compose.domain.model.Error
import co.nimblehq.template.compose.domain.models.Error
import com.squareup.moshi.Json

data class ErrorResponse(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package co.nimblehq.template.compose.data.response
package co.nimblehq.template.compose.data.responses

import co.nimblehq.template.compose.domain.model.Model
import co.nimblehq.template.compose.domain.models.Model
import com.squareup.moshi.Json

data class Response(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package co.nimblehq.template.compose.data.service
package co.nimblehq.template.compose.data.services

import co.nimblehq.template.compose.data.response.Response
import co.nimblehq.template.compose.data.responses.Response
import retrofit2.http.GET

interface ApiService {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package co.nimblehq.template.compose.data.service.providers
package co.nimblehq.template.compose.data.services.providers

import co.nimblehq.template.compose.data.service.ApiService
import co.nimblehq.template.compose.data.services.ApiService
import retrofit2.Retrofit

object ApiServiceProvider {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package co.nimblehq.template.compose.data.service.providers
package co.nimblehq.template.compose.data.services.providers

import com.squareup.moshi.Moshi
import retrofit2.Converter
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package co.nimblehq.template.compose.data.service.providers
package co.nimblehq.template.compose.data.services.providers

import com.squareup.moshi.Moshi
import com.squareup.moshi.adapters.Rfc3339DateJsonAdapter
import com.squareup.moshi.kotlin.reflect.KotlinJsonAdapterFactory
import java.util.*
import java.util.Date

object MoshiBuilderProvider {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package co.nimblehq.template.compose.data.service.providers
package co.nimblehq.template.compose.data.services.providers

import okhttp3.OkHttpClient
import retrofit2.Converter
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package co.nimblehq.template.compose.data.storage
package co.nimblehq.template.compose.data.storages

import android.content.SharedPreferences

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package co.nimblehq.template.compose.data.storage
package co.nimblehq.template.compose.data.storages

import android.content.Context
import androidx.security.crypto.EncryptedSharedPreferences
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package co.nimblehq.template.compose.data.storage
package co.nimblehq.template.compose.data.storages

import android.content.SharedPreferences

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
package co.nimblehq.template.compose.data.extensions

import co.nimblehq.template.compose.data.response.toModel
import co.nimblehq.template.compose.data.responses.toModel
import co.nimblehq.template.compose.data.test.MockUtil
import co.nimblehq.template.compose.domain.exceptions.ApiException
import co.nimblehq.template.compose.domain.exceptions.NoConnectivityException
import co.nimblehq.template.compose.domain.model.Model
import co.nimblehq.template.compose.domain.models.Model
import io.kotest.matchers.shouldBe
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.flow.catch
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
package co.nimblehq.template.compose.data.repository
package co.nimblehq.template.compose.data.repositories

import android.content.Context
import androidx.datastore.core.DataStore
import androidx.datastore.preferences.core.*
import androidx.datastore.preferences.preferencesDataStoreFile
import androidx.test.core.app.ApplicationProvider
import app.cash.turbine.test
import co.nimblehq.template.compose.domain.repository.AppPreferencesRepository
import co.nimblehq.template.compose.domain.repositories.AppPreferencesRepository
import io.kotest.matchers.shouldBe
import io.mockk.every
import io.mockk.mockk
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package co.nimblehq.template.compose.data.repository
package co.nimblehq.template.compose.data.repositories

import co.nimblehq.template.compose.data.response.toModels
import co.nimblehq.template.compose.data.service.ApiService
import co.nimblehq.template.compose.data.responses.toModels
import co.nimblehq.template.compose.data.services.ApiService
import co.nimblehq.template.compose.data.test.MockUtil
import co.nimblehq.template.compose.domain.repository.Repository
import co.nimblehq.template.compose.domain.repositories.Repository
import io.kotest.matchers.shouldBe
import io.mockk.coEvery
import io.mockk.mockk
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package co.nimblehq.template.compose.data.test

import co.nimblehq.template.compose.data.response.ErrorResponse
import co.nimblehq.template.compose.data.responses.ErrorResponse
import io.mockk.every
import io.mockk.mockk
import okhttp3.ResponseBody
Expand Down Expand Up @@ -31,6 +31,6 @@ object MockUtil {
)

val responses = listOf(
co.nimblehq.template.compose.data.response.Response(id = 1)
co.nimblehq.template.compose.data.responses.Response(id = 1)
)
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package co.nimblehq.template.compose.domain.exceptions

import co.nimblehq.template.compose.domain.model.Error
import co.nimblehq.template.compose.domain.models.Error

object NoConnectivityException : RuntimeException()

Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package co.nimblehq.template.compose.domain.models

data class Error(
val message: String
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package co.nimblehq.template.compose.domain.models

data class Model(
val id: Int?
)
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package co.nimblehq.template.compose.domain.repository
package co.nimblehq.template.compose.domain.repositories

import kotlinx.coroutines.flow.Flow

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package co.nimblehq.template.compose.domain.repositories

import co.nimblehq.template.compose.domain.models.Model
import kotlinx.coroutines.flow.Flow

interface Repository {

fun getModels(): Flow<List<Model>>
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package co.nimblehq.template.compose.domain.usecase
package co.nimblehq.template.compose.domain.usecases

import co.nimblehq.template.compose.domain.model.Model
import co.nimblehq.template.compose.domain.repository.Repository
import co.nimblehq.template.compose.domain.models.Model
import co.nimblehq.template.compose.domain.repositories.Repository
import kotlinx.coroutines.flow.Flow
import javax.inject.Inject

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package co.nimblehq.template.compose.domain.test

import co.nimblehq.template.compose.domain.model.Model
import co.nimblehq.template.compose.domain.models.Model

object MockUtil {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package co.nimblehq.template.compose.domain.usecase
package co.nimblehq.template.compose.domain.usecases

import co.nimblehq.template.compose.domain.repository.Repository
import co.nimblehq.template.compose.domain.repositories.Repository
import co.nimblehq.template.compose.domain.test.MockUtil
import io.kotest.matchers.shouldBe
import io.mockk.every
Expand Down

0 comments on commit 0a6b800

Please sign in to comment.