From 161f9e094bb895649da2b0ab323c66fbbdb8d34a Mon Sep 17 00:00:00 2001 From: Luong Vo Date: Mon, 28 Aug 2023 22:05:13 +0700 Subject: [PATCH] [#515] Use the plural for packages with homogeneous contents --- template-compose/app/proguard-rules.pro | 4 ++-- .../template/compose/di/modules/MoshiModule.kt | 2 +- .../template/compose/di/modules/PreferencesModule.kt | 4 ++-- .../template/compose/di/modules/RepositoryModule.kt | 6 +++--- .../template/compose/di/modules/RetrofitModule.kt | 6 ++---- .../template/compose/di/modules/StorageModule.kt | 2 +- .../java/co/nimblehq/template/compose/model/UiModel.kt | 9 --------- .../co/nimblehq/template/compose/ui/models/UiModel.kt | 9 +++++++++ .../template/compose/ui/screens/home/HomeScreen.kt | 2 +- .../template/compose/ui/screens/home/HomeViewModel.kt | 6 +++--- .../java/co/nimblehq/template/compose/test/MockUtil.kt | 2 +- .../template/compose/ui/screens/home/HomeScreenTest.kt | 2 +- .../compose/ui/screens/home/HomeViewModelTest.kt | 4 ++-- .../compose/data/extensions/ResponseMapping.kt | 6 +++--- .../AppPreferencesRepositoryImpl.kt | 4 ++-- .../{repository => repositories}/RepositoryImpl.kt | 10 +++++----- .../co/nimblehq/template/compose/data/requests/.keep | 0 .../data/{response => responses}/ErrorResponse.kt | 4 ++-- .../compose/data/{response => responses}/Response.kt | 4 ++-- .../compose/data/{service => services}/ApiService.kt | 4 ++-- .../providers/ApiServiceProvider.kt | 4 ++-- .../providers/ConverterFactoryProvider.kt | 2 +- .../providers/MoshiBuilderProvider.kt | 4 ++-- .../providers/RetrofitProvider.kt | 2 +- .../{storage => storages}/BaseSharedPreferences.kt | 2 +- .../EncryptedSharedPreferences.kt | 2 +- .../data/{storage => storages}/SharedPreferencesExt.kt | 2 +- .../compose/data/extensions/ResponseMappingTest.kt | 4 ++-- .../AppPreferencesRepositoryImplTest.kt | 4 ++-- .../{repository => repositories}/RepositoryTest.kt | 8 ++++---- .../co/nimblehq/template/compose/data/test/MockUtil.kt | 4 ++-- .../template/compose/domain/exceptions/Exceptions.kt | 2 +- .../co/nimblehq/template/compose/domain/model/Error.kt | 5 ----- .../co/nimblehq/template/compose/domain/model/Model.kt | 5 ----- .../nimblehq/template/compose/domain/models/Error.kt | 5 +++++ .../nimblehq/template/compose/domain/models/Model.kt | 5 +++++ .../AppPreferencesRepository.kt | 2 +- .../template/compose/domain/repositories/Repository.kt | 9 +++++++++ .../template/compose/domain/repository/Repository.kt | 9 --------- .../compose/domain/{usecase => usecases}/UseCase.kt | 6 +++--- .../nimblehq/template/compose/domain/test/MockUtil.kt | 2 +- .../domain/{usecase => usecases}/UseCaseTest.kt | 4 ++-- 42 files changed, 90 insertions(+), 92 deletions(-) delete mode 100644 template-compose/app/src/main/java/co/nimblehq/template/compose/model/UiModel.kt create mode 100644 template-compose/app/src/main/java/co/nimblehq/template/compose/ui/models/UiModel.kt rename template-compose/data/src/main/java/co/nimblehq/template/compose/data/{repository => repositories}/AppPreferencesRepositoryImpl.kt (90%) rename template-compose/data/src/main/java/co/nimblehq/template/compose/data/{repository => repositories}/RepositoryImpl.kt (51%) create mode 100644 template-compose/data/src/main/java/co/nimblehq/template/compose/data/requests/.keep rename template-compose/data/src/main/java/co/nimblehq/template/compose/data/{response => responses}/ErrorResponse.kt (62%) rename template-compose/data/src/main/java/co/nimblehq/template/compose/data/{response => responses}/Response.kt (65%) rename template-compose/data/src/main/java/co/nimblehq/template/compose/data/{service => services}/ApiService.kt (51%) rename template-compose/data/src/main/java/co/nimblehq/template/compose/data/{service => services}/providers/ApiServiceProvider.kt (59%) rename template-compose/data/src/main/java/co/nimblehq/template/compose/data/{service => services}/providers/ConverterFactoryProvider.kt (82%) rename template-compose/data/src/main/java/co/nimblehq/template/compose/data/{service => services}/providers/MoshiBuilderProvider.kt (85%) rename template-compose/data/src/main/java/co/nimblehq/template/compose/data/{service => services}/providers/RetrofitProvider.kt (87%) rename template-compose/data/src/main/java/co/nimblehq/template/compose/data/{storage => storages}/BaseSharedPreferences.kt (96%) rename template-compose/data/src/main/java/co/nimblehq/template/compose/data/{storage => storages}/EncryptedSharedPreferences.kt (93%) rename template-compose/data/src/main/java/co/nimblehq/template/compose/data/{storage => storages}/SharedPreferencesExt.kt (78%) rename template-compose/data/src/test/java/co/nimblehq/template/compose/data/{repository => repositories}/AppPreferencesRepositoryImplTest.kt (95%) rename template-compose/data/src/test/java/co/nimblehq/template/compose/data/{repository => repositories}/RepositoryTest.kt (82%) delete mode 100644 template-compose/domain/src/main/java/co/nimblehq/template/compose/domain/model/Error.kt delete mode 100644 template-compose/domain/src/main/java/co/nimblehq/template/compose/domain/model/Model.kt create mode 100644 template-compose/domain/src/main/java/co/nimblehq/template/compose/domain/models/Error.kt create mode 100644 template-compose/domain/src/main/java/co/nimblehq/template/compose/domain/models/Model.kt rename template-compose/domain/src/main/java/co/nimblehq/template/compose/domain/{repository => repositories}/AppPreferencesRepository.kt (76%) create mode 100644 template-compose/domain/src/main/java/co/nimblehq/template/compose/domain/repositories/Repository.kt delete mode 100644 template-compose/domain/src/main/java/co/nimblehq/template/compose/domain/repository/Repository.kt rename template-compose/domain/src/main/java/co/nimblehq/template/compose/domain/{usecase => usecases}/UseCase.kt (56%) rename template-compose/domain/src/test/java/co/nimblehq/template/compose/domain/{usecase => usecases}/UseCaseTest.kt (90%) diff --git a/template-compose/app/proguard-rules.pro b/template-compose/app/proguard-rules.pro index eb250ec43..a3bbef242 100644 --- a/template-compose/app/proguard-rules.pro +++ b/template-compose/app/proguard-rules.pro @@ -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.** { *; } diff --git a/template-compose/app/src/main/java/co/nimblehq/template/compose/di/modules/MoshiModule.kt b/template-compose/app/src/main/java/co/nimblehq/template/compose/di/modules/MoshiModule.kt index 49e68107a..396fde5c8 100644 --- a/template-compose/app/src/main/java/co/nimblehq/template/compose/di/modules/MoshiModule.kt +++ b/template-compose/app/src/main/java/co/nimblehq/template/compose/di/modules/MoshiModule.kt @@ -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 diff --git a/template-compose/app/src/main/java/co/nimblehq/template/compose/di/modules/PreferencesModule.kt b/template-compose/app/src/main/java/co/nimblehq/template/compose/di/modules/PreferencesModule.kt index 3caf86d60..aa1857a6c 100644 --- a/template-compose/app/src/main/java/co/nimblehq/template/compose/di/modules/PreferencesModule.kt +++ b/template-compose/app/src/main/java/co/nimblehq/template/compose/di/modules/PreferencesModule.kt @@ -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 diff --git a/template-compose/app/src/main/java/co/nimblehq/template/compose/di/modules/RepositoryModule.kt b/template-compose/app/src/main/java/co/nimblehq/template/compose/di/modules/RepositoryModule.kt index 46fd8b572..6399e632f 100644 --- a/template-compose/app/src/main/java/co/nimblehq/template/compose/di/modules/RepositoryModule.kt +++ b/template-compose/app/src/main/java/co/nimblehq/template/compose/di/modules/RepositoryModule.kt @@ -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 diff --git a/template-compose/app/src/main/java/co/nimblehq/template/compose/di/modules/RetrofitModule.kt b/template-compose/app/src/main/java/co/nimblehq/template/compose/di/modules/RetrofitModule.kt index 0df4d624b..56100dd74 100644 --- a/template-compose/app/src/main/java/co/nimblehq/template/compose/di/modules/RetrofitModule.kt +++ b/template-compose/app/src/main/java/co/nimblehq/template/compose/di/modules/RetrofitModule.kt @@ -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 diff --git a/template-compose/app/src/main/java/co/nimblehq/template/compose/di/modules/StorageModule.kt b/template-compose/app/src/main/java/co/nimblehq/template/compose/di/modules/StorageModule.kt index 22d9dcc32..8744865c9 100644 --- a/template-compose/app/src/main/java/co/nimblehq/template/compose/di/modules/StorageModule.kt +++ b/template-compose/app/src/main/java/co/nimblehq/template/compose/di/modules/StorageModule.kt @@ -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 diff --git a/template-compose/app/src/main/java/co/nimblehq/template/compose/model/UiModel.kt b/template-compose/app/src/main/java/co/nimblehq/template/compose/model/UiModel.kt deleted file mode 100644 index 7a5dda66a..000000000 --- a/template-compose/app/src/main/java/co/nimblehq/template/compose/model/UiModel.kt +++ /dev/null @@ -1,9 +0,0 @@ -package co.nimblehq.template.compose.model - -import co.nimblehq.template.compose.domain.model.Model - -data class UiModel( - val id: Int -) - -fun Model.toUiModel() = UiModel(id = id ?: -1) diff --git a/template-compose/app/src/main/java/co/nimblehq/template/compose/ui/models/UiModel.kt b/template-compose/app/src/main/java/co/nimblehq/template/compose/ui/models/UiModel.kt new file mode 100644 index 000000000..66a942839 --- /dev/null +++ b/template-compose/app/src/main/java/co/nimblehq/template/compose/ui/models/UiModel.kt @@ -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) diff --git a/template-compose/app/src/main/java/co/nimblehq/template/compose/ui/screens/home/HomeScreen.kt b/template-compose/app/src/main/java/co/nimblehq/template/compose/ui/screens/home/HomeScreen.kt index b64aee61e..aa23c3465 100644 --- a/template-compose/app/src/main/java/co/nimblehq/template/compose/ui/screens/home/HomeScreen.kt +++ b/template-compose/app/src/main/java/co/nimblehq/template/compose/ui/screens/home/HomeScreen.kt @@ -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 diff --git a/template-compose/app/src/main/java/co/nimblehq/template/compose/ui/screens/home/HomeViewModel.kt b/template-compose/app/src/main/java/co/nimblehq/template/compose/ui/screens/home/HomeViewModel.kt index 1b3085ba5..243f48553 100644 --- a/template-compose/app/src/main/java/co/nimblehq/template/compose/ui/screens/home/HomeViewModel.kt +++ b/template-compose/app/src/main/java/co/nimblehq/template/compose/ui/screens/home/HomeViewModel.kt @@ -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.* diff --git a/template-compose/app/src/test/java/co/nimblehq/template/compose/test/MockUtil.kt b/template-compose/app/src/test/java/co/nimblehq/template/compose/test/MockUtil.kt index 60e91c791..58744e76c 100644 --- a/template-compose/app/src/test/java/co/nimblehq/template/compose/test/MockUtil.kt +++ b/template-compose/app/src/test/java/co/nimblehq/template/compose/test/MockUtil.kt @@ -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 { diff --git a/template-compose/app/src/test/java/co/nimblehq/template/compose/ui/screens/home/HomeScreenTest.kt b/template-compose/app/src/test/java/co/nimblehq/template/compose/ui/screens/home/HomeScreenTest.kt index 25514e885..b61dd0c11 100644 --- a/template-compose/app/src/test/java/co/nimblehq/template/compose/ui/screens/home/HomeScreenTest.kt +++ b/template-compose/app/src/test/java/co/nimblehq/template/compose/ui/screens/home/HomeScreenTest.kt @@ -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 diff --git a/template-compose/app/src/test/java/co/nimblehq/template/compose/ui/screens/home/HomeViewModelTest.kt b/template-compose/app/src/test/java/co/nimblehq/template/compose/ui/screens/home/HomeViewModelTest.kt index 842b01a52..2ac3e76fd 100644 --- a/template-compose/app/src/test/java/co/nimblehq/template/compose/ui/screens/home/HomeViewModelTest.kt +++ b/template-compose/app/src/test/java/co/nimblehq/template/compose/ui/screens/home/HomeViewModelTest.kt @@ -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 diff --git a/template-compose/data/src/main/java/co/nimblehq/template/compose/data/extensions/ResponseMapping.kt b/template-compose/data/src/main/java/co/nimblehq/template/compose/data/extensions/ResponseMapping.kt index 0dfcf96b7..e4119ef94 100644 --- a/template-compose/data/src/main/java/co/nimblehq/template/compose/data/extensions/ResponseMapping.kt +++ b/template-compose/data/src/main/java/co/nimblehq/template/compose/data/extensions/ResponseMapping.kt @@ -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 diff --git a/template-compose/data/src/main/java/co/nimblehq/template/compose/data/repository/AppPreferencesRepositoryImpl.kt b/template-compose/data/src/main/java/co/nimblehq/template/compose/data/repositories/AppPreferencesRepositoryImpl.kt similarity index 90% rename from template-compose/data/src/main/java/co/nimblehq/template/compose/data/repository/AppPreferencesRepositoryImpl.kt rename to template-compose/data/src/main/java/co/nimblehq/template/compose/data/repositories/AppPreferencesRepositoryImpl.kt index bcda37b0e..dd3178b4f 100644 --- a/template-compose/data/src/main/java/co/nimblehq/template/compose/data/repository/AppPreferencesRepositoryImpl.kt +++ b/template-compose/data/src/main/java/co/nimblehq/template/compose/data/repositories/AppPreferencesRepositoryImpl.kt @@ -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 diff --git a/template-compose/data/src/main/java/co/nimblehq/template/compose/data/repository/RepositoryImpl.kt b/template-compose/data/src/main/java/co/nimblehq/template/compose/data/repositories/RepositoryImpl.kt similarity index 51% rename from template-compose/data/src/main/java/co/nimblehq/template/compose/data/repository/RepositoryImpl.kt rename to template-compose/data/src/main/java/co/nimblehq/template/compose/data/repositories/RepositoryImpl.kt index 3c97a4474..27fe20eab 100644 --- a/template-compose/data/src/main/java/co/nimblehq/template/compose/data/repository/RepositoryImpl.kt +++ b/template-compose/data/src/main/java/co/nimblehq/template/compose/data/repositories/RepositoryImpl.kt @@ -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( diff --git a/template-compose/data/src/main/java/co/nimblehq/template/compose/data/requests/.keep b/template-compose/data/src/main/java/co/nimblehq/template/compose/data/requests/.keep new file mode 100644 index 000000000..e69de29bb diff --git a/template-compose/data/src/main/java/co/nimblehq/template/compose/data/response/ErrorResponse.kt b/template-compose/data/src/main/java/co/nimblehq/template/compose/data/responses/ErrorResponse.kt similarity index 62% rename from template-compose/data/src/main/java/co/nimblehq/template/compose/data/response/ErrorResponse.kt rename to template-compose/data/src/main/java/co/nimblehq/template/compose/data/responses/ErrorResponse.kt index d887a9cae..f3a7cf672 100644 --- a/template-compose/data/src/main/java/co/nimblehq/template/compose/data/response/ErrorResponse.kt +++ b/template-compose/data/src/main/java/co/nimblehq/template/compose/data/responses/ErrorResponse.kt @@ -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( diff --git a/template-compose/data/src/main/java/co/nimblehq/template/compose/data/response/Response.kt b/template-compose/data/src/main/java/co/nimblehq/template/compose/data/responses/Response.kt similarity index 65% rename from template-compose/data/src/main/java/co/nimblehq/template/compose/data/response/Response.kt rename to template-compose/data/src/main/java/co/nimblehq/template/compose/data/responses/Response.kt index 4d0f34d2c..b6a1a4c51 100644 --- a/template-compose/data/src/main/java/co/nimblehq/template/compose/data/response/Response.kt +++ b/template-compose/data/src/main/java/co/nimblehq/template/compose/data/responses/Response.kt @@ -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( diff --git a/template-compose/data/src/main/java/co/nimblehq/template/compose/data/service/ApiService.kt b/template-compose/data/src/main/java/co/nimblehq/template/compose/data/services/ApiService.kt similarity index 51% rename from template-compose/data/src/main/java/co/nimblehq/template/compose/data/service/ApiService.kt rename to template-compose/data/src/main/java/co/nimblehq/template/compose/data/services/ApiService.kt index 144b88d88..ba12c82e7 100644 --- a/template-compose/data/src/main/java/co/nimblehq/template/compose/data/service/ApiService.kt +++ b/template-compose/data/src/main/java/co/nimblehq/template/compose/data/services/ApiService.kt @@ -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 { diff --git a/template-compose/data/src/main/java/co/nimblehq/template/compose/data/service/providers/ApiServiceProvider.kt b/template-compose/data/src/main/java/co/nimblehq/template/compose/data/services/providers/ApiServiceProvider.kt similarity index 59% rename from template-compose/data/src/main/java/co/nimblehq/template/compose/data/service/providers/ApiServiceProvider.kt rename to template-compose/data/src/main/java/co/nimblehq/template/compose/data/services/providers/ApiServiceProvider.kt index 2a8808864..4d93e9ef0 100644 --- a/template-compose/data/src/main/java/co/nimblehq/template/compose/data/service/providers/ApiServiceProvider.kt +++ b/template-compose/data/src/main/java/co/nimblehq/template/compose/data/services/providers/ApiServiceProvider.kt @@ -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 { diff --git a/template-compose/data/src/main/java/co/nimblehq/template/compose/data/service/providers/ConverterFactoryProvider.kt b/template-compose/data/src/main/java/co/nimblehq/template/compose/data/services/providers/ConverterFactoryProvider.kt similarity index 82% rename from template-compose/data/src/main/java/co/nimblehq/template/compose/data/service/providers/ConverterFactoryProvider.kt rename to template-compose/data/src/main/java/co/nimblehq/template/compose/data/services/providers/ConverterFactoryProvider.kt index dad3af3e5..c0992f3a6 100644 --- a/template-compose/data/src/main/java/co/nimblehq/template/compose/data/service/providers/ConverterFactoryProvider.kt +++ b/template-compose/data/src/main/java/co/nimblehq/template/compose/data/services/providers/ConverterFactoryProvider.kt @@ -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 diff --git a/template-compose/data/src/main/java/co/nimblehq/template/compose/data/service/providers/MoshiBuilderProvider.kt b/template-compose/data/src/main/java/co/nimblehq/template/compose/data/services/providers/MoshiBuilderProvider.kt similarity index 85% rename from template-compose/data/src/main/java/co/nimblehq/template/compose/data/service/providers/MoshiBuilderProvider.kt rename to template-compose/data/src/main/java/co/nimblehq/template/compose/data/services/providers/MoshiBuilderProvider.kt index db83074ae..667c8d9cb 100644 --- a/template-compose/data/src/main/java/co/nimblehq/template/compose/data/service/providers/MoshiBuilderProvider.kt +++ b/template-compose/data/src/main/java/co/nimblehq/template/compose/data/services/providers/MoshiBuilderProvider.kt @@ -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 { diff --git a/template-compose/data/src/main/java/co/nimblehq/template/compose/data/service/providers/RetrofitProvider.kt b/template-compose/data/src/main/java/co/nimblehq/template/compose/data/services/providers/RetrofitProvider.kt similarity index 87% rename from template-compose/data/src/main/java/co/nimblehq/template/compose/data/service/providers/RetrofitProvider.kt rename to template-compose/data/src/main/java/co/nimblehq/template/compose/data/services/providers/RetrofitProvider.kt index c08f61115..1ec48b823 100644 --- a/template-compose/data/src/main/java/co/nimblehq/template/compose/data/service/providers/RetrofitProvider.kt +++ b/template-compose/data/src/main/java/co/nimblehq/template/compose/data/services/providers/RetrofitProvider.kt @@ -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 diff --git a/template-compose/data/src/main/java/co/nimblehq/template/compose/data/storage/BaseSharedPreferences.kt b/template-compose/data/src/main/java/co/nimblehq/template/compose/data/storages/BaseSharedPreferences.kt similarity index 96% rename from template-compose/data/src/main/java/co/nimblehq/template/compose/data/storage/BaseSharedPreferences.kt rename to template-compose/data/src/main/java/co/nimblehq/template/compose/data/storages/BaseSharedPreferences.kt index 72242e9e8..e6fb7ba12 100644 --- a/template-compose/data/src/main/java/co/nimblehq/template/compose/data/storage/BaseSharedPreferences.kt +++ b/template-compose/data/src/main/java/co/nimblehq/template/compose/data/storages/BaseSharedPreferences.kt @@ -1,4 +1,4 @@ -package co.nimblehq.template.compose.data.storage +package co.nimblehq.template.compose.data.storages import android.content.SharedPreferences diff --git a/template-compose/data/src/main/java/co/nimblehq/template/compose/data/storage/EncryptedSharedPreferences.kt b/template-compose/data/src/main/java/co/nimblehq/template/compose/data/storages/EncryptedSharedPreferences.kt similarity index 93% rename from template-compose/data/src/main/java/co/nimblehq/template/compose/data/storage/EncryptedSharedPreferences.kt rename to template-compose/data/src/main/java/co/nimblehq/template/compose/data/storages/EncryptedSharedPreferences.kt index f7bf88c38..f9c687266 100644 --- a/template-compose/data/src/main/java/co/nimblehq/template/compose/data/storage/EncryptedSharedPreferences.kt +++ b/template-compose/data/src/main/java/co/nimblehq/template/compose/data/storages/EncryptedSharedPreferences.kt @@ -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 diff --git a/template-compose/data/src/main/java/co/nimblehq/template/compose/data/storage/SharedPreferencesExt.kt b/template-compose/data/src/main/java/co/nimblehq/template/compose/data/storages/SharedPreferencesExt.kt similarity index 78% rename from template-compose/data/src/main/java/co/nimblehq/template/compose/data/storage/SharedPreferencesExt.kt rename to template-compose/data/src/main/java/co/nimblehq/template/compose/data/storages/SharedPreferencesExt.kt index 0ec8b46d9..99b1e5be2 100644 --- a/template-compose/data/src/main/java/co/nimblehq/template/compose/data/storage/SharedPreferencesExt.kt +++ b/template-compose/data/src/main/java/co/nimblehq/template/compose/data/storages/SharedPreferencesExt.kt @@ -1,4 +1,4 @@ -package co.nimblehq.template.compose.data.storage +package co.nimblehq.template.compose.data.storages import android.content.SharedPreferences diff --git a/template-compose/data/src/test/java/co/nimblehq/template/compose/data/extensions/ResponseMappingTest.kt b/template-compose/data/src/test/java/co/nimblehq/template/compose/data/extensions/ResponseMappingTest.kt index d0b149b62..7ccc3b4e1 100644 --- a/template-compose/data/src/test/java/co/nimblehq/template/compose/data/extensions/ResponseMappingTest.kt +++ b/template-compose/data/src/test/java/co/nimblehq/template/compose/data/extensions/ResponseMappingTest.kt @@ -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 diff --git a/template-compose/data/src/test/java/co/nimblehq/template/compose/data/repository/AppPreferencesRepositoryImplTest.kt b/template-compose/data/src/test/java/co/nimblehq/template/compose/data/repositories/AppPreferencesRepositoryImplTest.kt similarity index 95% rename from template-compose/data/src/test/java/co/nimblehq/template/compose/data/repository/AppPreferencesRepositoryImplTest.kt rename to template-compose/data/src/test/java/co/nimblehq/template/compose/data/repositories/AppPreferencesRepositoryImplTest.kt index c9d8c10a1..29e2c2e6f 100644 --- a/template-compose/data/src/test/java/co/nimblehq/template/compose/data/repository/AppPreferencesRepositoryImplTest.kt +++ b/template-compose/data/src/test/java/co/nimblehq/template/compose/data/repositories/AppPreferencesRepositoryImplTest.kt @@ -1,4 +1,4 @@ -package co.nimblehq.template.compose.data.repository +package co.nimblehq.template.compose.data.repositories import android.content.Context import androidx.datastore.core.DataStore @@ -6,7 +6,7 @@ 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 diff --git a/template-compose/data/src/test/java/co/nimblehq/template/compose/data/repository/RepositoryTest.kt b/template-compose/data/src/test/java/co/nimblehq/template/compose/data/repositories/RepositoryTest.kt similarity index 82% rename from template-compose/data/src/test/java/co/nimblehq/template/compose/data/repository/RepositoryTest.kt rename to template-compose/data/src/test/java/co/nimblehq/template/compose/data/repositories/RepositoryTest.kt index 137167a1e..a316679f2 100644 --- a/template-compose/data/src/test/java/co/nimblehq/template/compose/data/repository/RepositoryTest.kt +++ b/template-compose/data/src/test/java/co/nimblehq/template/compose/data/repositories/RepositoryTest.kt @@ -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 diff --git a/template-compose/data/src/test/java/co/nimblehq/template/compose/data/test/MockUtil.kt b/template-compose/data/src/test/java/co/nimblehq/template/compose/data/test/MockUtil.kt index b94b35c78..c7c26da9a 100644 --- a/template-compose/data/src/test/java/co/nimblehq/template/compose/data/test/MockUtil.kt +++ b/template-compose/data/src/test/java/co/nimblehq/template/compose/data/test/MockUtil.kt @@ -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 @@ -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) ) } diff --git a/template-compose/domain/src/main/java/co/nimblehq/template/compose/domain/exceptions/Exceptions.kt b/template-compose/domain/src/main/java/co/nimblehq/template/compose/domain/exceptions/Exceptions.kt index a6ae3ba92..bbb01e775 100644 --- a/template-compose/domain/src/main/java/co/nimblehq/template/compose/domain/exceptions/Exceptions.kt +++ b/template-compose/domain/src/main/java/co/nimblehq/template/compose/domain/exceptions/Exceptions.kt @@ -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() diff --git a/template-compose/domain/src/main/java/co/nimblehq/template/compose/domain/model/Error.kt b/template-compose/domain/src/main/java/co/nimblehq/template/compose/domain/model/Error.kt deleted file mode 100644 index 2d78dafbe..000000000 --- a/template-compose/domain/src/main/java/co/nimblehq/template/compose/domain/model/Error.kt +++ /dev/null @@ -1,5 +0,0 @@ -package co.nimblehq.template.compose.domain.model - -data class Error( - val message: String -) diff --git a/template-compose/domain/src/main/java/co/nimblehq/template/compose/domain/model/Model.kt b/template-compose/domain/src/main/java/co/nimblehq/template/compose/domain/model/Model.kt deleted file mode 100644 index 90c613383..000000000 --- a/template-compose/domain/src/main/java/co/nimblehq/template/compose/domain/model/Model.kt +++ /dev/null @@ -1,5 +0,0 @@ -package co.nimblehq.template.compose.domain.model - -data class Model( - val id: Int? -) diff --git a/template-compose/domain/src/main/java/co/nimblehq/template/compose/domain/models/Error.kt b/template-compose/domain/src/main/java/co/nimblehq/template/compose/domain/models/Error.kt new file mode 100644 index 000000000..ad1dc389d --- /dev/null +++ b/template-compose/domain/src/main/java/co/nimblehq/template/compose/domain/models/Error.kt @@ -0,0 +1,5 @@ +package co.nimblehq.template.compose.domain.models + +data class Error( + val message: String +) diff --git a/template-compose/domain/src/main/java/co/nimblehq/template/compose/domain/models/Model.kt b/template-compose/domain/src/main/java/co/nimblehq/template/compose/domain/models/Model.kt new file mode 100644 index 000000000..2da5bb267 --- /dev/null +++ b/template-compose/domain/src/main/java/co/nimblehq/template/compose/domain/models/Model.kt @@ -0,0 +1,5 @@ +package co.nimblehq.template.compose.domain.models + +data class Model( + val id: Int? +) diff --git a/template-compose/domain/src/main/java/co/nimblehq/template/compose/domain/repository/AppPreferencesRepository.kt b/template-compose/domain/src/main/java/co/nimblehq/template/compose/domain/repositories/AppPreferencesRepository.kt similarity index 76% rename from template-compose/domain/src/main/java/co/nimblehq/template/compose/domain/repository/AppPreferencesRepository.kt rename to template-compose/domain/src/main/java/co/nimblehq/template/compose/domain/repositories/AppPreferencesRepository.kt index edef9baa4..8f2b5c48c 100644 --- a/template-compose/domain/src/main/java/co/nimblehq/template/compose/domain/repository/AppPreferencesRepository.kt +++ b/template-compose/domain/src/main/java/co/nimblehq/template/compose/domain/repositories/AppPreferencesRepository.kt @@ -1,4 +1,4 @@ -package co.nimblehq.template.compose.domain.repository +package co.nimblehq.template.compose.domain.repositories import kotlinx.coroutines.flow.Flow diff --git a/template-compose/domain/src/main/java/co/nimblehq/template/compose/domain/repositories/Repository.kt b/template-compose/domain/src/main/java/co/nimblehq/template/compose/domain/repositories/Repository.kt new file mode 100644 index 000000000..362c09add --- /dev/null +++ b/template-compose/domain/src/main/java/co/nimblehq/template/compose/domain/repositories/Repository.kt @@ -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> +} diff --git a/template-compose/domain/src/main/java/co/nimblehq/template/compose/domain/repository/Repository.kt b/template-compose/domain/src/main/java/co/nimblehq/template/compose/domain/repository/Repository.kt deleted file mode 100644 index 638ce630e..000000000 --- a/template-compose/domain/src/main/java/co/nimblehq/template/compose/domain/repository/Repository.kt +++ /dev/null @@ -1,9 +0,0 @@ -package co.nimblehq.template.compose.domain.repository - -import co.nimblehq.template.compose.domain.model.Model -import kotlinx.coroutines.flow.Flow - -interface Repository { - - fun getModels(): Flow> -} diff --git a/template-compose/domain/src/main/java/co/nimblehq/template/compose/domain/usecase/UseCase.kt b/template-compose/domain/src/main/java/co/nimblehq/template/compose/domain/usecases/UseCase.kt similarity index 56% rename from template-compose/domain/src/main/java/co/nimblehq/template/compose/domain/usecase/UseCase.kt rename to template-compose/domain/src/main/java/co/nimblehq/template/compose/domain/usecases/UseCase.kt index 92732b613..d6e827b2b 100644 --- a/template-compose/domain/src/main/java/co/nimblehq/template/compose/domain/usecase/UseCase.kt +++ b/template-compose/domain/src/main/java/co/nimblehq/template/compose/domain/usecases/UseCase.kt @@ -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 diff --git a/template-compose/domain/src/test/java/co/nimblehq/template/compose/domain/test/MockUtil.kt b/template-compose/domain/src/test/java/co/nimblehq/template/compose/domain/test/MockUtil.kt index f11ab0ba1..fc2dcb327 100644 --- a/template-compose/domain/src/test/java/co/nimblehq/template/compose/domain/test/MockUtil.kt +++ b/template-compose/domain/src/test/java/co/nimblehq/template/compose/domain/test/MockUtil.kt @@ -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 { diff --git a/template-compose/domain/src/test/java/co/nimblehq/template/compose/domain/usecase/UseCaseTest.kt b/template-compose/domain/src/test/java/co/nimblehq/template/compose/domain/usecases/UseCaseTest.kt similarity index 90% rename from template-compose/domain/src/test/java/co/nimblehq/template/compose/domain/usecase/UseCaseTest.kt rename to template-compose/domain/src/test/java/co/nimblehq/template/compose/domain/usecases/UseCaseTest.kt index 7dc0a17ae..c002b9011 100644 --- a/template-compose/domain/src/test/java/co/nimblehq/template/compose/domain/usecase/UseCaseTest.kt +++ b/template-compose/domain/src/test/java/co/nimblehq/template/compose/domain/usecases/UseCaseTest.kt @@ -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