From 45ea565b08bc037efdbfa6b1cf3797d31151ea51 Mon Sep 17 00:00:00 2001 From: KWY0218 Date: Fri, 5 Aug 2022 09:18:44 +0900 Subject: [PATCH 01/11] =?UTF-8?q?#173=20[add]=20data=20=EB=AA=A8=EB=93=88?= =?UTF-8?q?=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- data/.gitignore | 1 + data/build.gradle | 40 +++++++++++++++++++ data/consumer-rules.pro | 0 data/proguard-rules.pro | 21 ++++++++++ .../com/hous/data/ExampleInstrumentedTest.kt | 22 ++++++++++ data/src/main/AndroidManifest.xml | 5 +++ .../java/com/hous/data/ExampleUnitTest.kt | 16 ++++++++ settings.gradle | 1 + 8 files changed, 106 insertions(+) create mode 100644 data/.gitignore create mode 100644 data/build.gradle create mode 100644 data/consumer-rules.pro create mode 100644 data/proguard-rules.pro create mode 100644 data/src/androidTest/java/com/hous/data/ExampleInstrumentedTest.kt create mode 100644 data/src/main/AndroidManifest.xml create mode 100644 data/src/test/java/com/hous/data/ExampleUnitTest.kt diff --git a/data/.gitignore b/data/.gitignore new file mode 100644 index 00000000..42afabfd --- /dev/null +++ b/data/.gitignore @@ -0,0 +1 @@ +/build \ No newline at end of file diff --git a/data/build.gradle b/data/build.gradle new file mode 100644 index 00000000..879afb5d --- /dev/null +++ b/data/build.gradle @@ -0,0 +1,40 @@ +plugins { + id 'com.android.library' + id 'org.jetbrains.kotlin.android' +} + +android { + compileSdk 32 + + defaultConfig { + minSdk 26 + targetSdk 32 + + testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" + consumerProguardFiles "consumer-rules.pro" + } + + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' + } + } + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 + } + kotlinOptions { + jvmTarget = '1.8' + } +} + +dependencies { + + implementation 'androidx.core:core-ktx:1.7.0' + implementation 'androidx.appcompat:appcompat:1.4.2' + implementation 'com.google.android.material:material:1.6.1' + testImplementation 'junit:junit:4.13.2' + androidTestImplementation 'androidx.test.ext:junit:1.1.3' + androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0' +} \ No newline at end of file diff --git a/data/consumer-rules.pro b/data/consumer-rules.pro new file mode 100644 index 00000000..e69de29b diff --git a/data/proguard-rules.pro b/data/proguard-rules.pro new file mode 100644 index 00000000..481bb434 --- /dev/null +++ b/data/proguard-rules.pro @@ -0,0 +1,21 @@ +# Add project specific ProGuard rules here. +# You can control the set of applied configuration files using the +# proguardFiles setting in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} + +# Uncomment this to preserve the line number information for +# debugging stack traces. +#-keepattributes SourceFile,LineNumberTable + +# If you keep the line number information, uncomment this to +# hide the original source file name. +#-renamesourcefileattribute SourceFile \ No newline at end of file diff --git a/data/src/androidTest/java/com/hous/data/ExampleInstrumentedTest.kt b/data/src/androidTest/java/com/hous/data/ExampleInstrumentedTest.kt new file mode 100644 index 00000000..5e9ccb70 --- /dev/null +++ b/data/src/androidTest/java/com/hous/data/ExampleInstrumentedTest.kt @@ -0,0 +1,22 @@ +package com.hous.data + +import androidx.test.ext.junit.runners.AndroidJUnit4 +import androidx.test.platform.app.InstrumentationRegistry +import org.junit.Assert.assertEquals +import org.junit.Test +import org.junit.runner.RunWith + +/** + * Instrumented test, which will execute on an Android device. + * + * See [testing documentation](http://d.android.com/tools/testing). + */ +@RunWith(AndroidJUnit4::class) +class ExampleInstrumentedTest { + @Test + fun useAppContext() { + // Context of the app under test. + val appContext = InstrumentationRegistry.getInstrumentation().targetContext + assertEquals("com.hous.data.test", appContext.packageName) + } +} diff --git a/data/src/main/AndroidManifest.xml b/data/src/main/AndroidManifest.xml new file mode 100644 index 00000000..fd60495a --- /dev/null +++ b/data/src/main/AndroidManifest.xml @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/data/src/test/java/com/hous/data/ExampleUnitTest.kt b/data/src/test/java/com/hous/data/ExampleUnitTest.kt new file mode 100644 index 00000000..2823ce08 --- /dev/null +++ b/data/src/test/java/com/hous/data/ExampleUnitTest.kt @@ -0,0 +1,16 @@ +package com.hous.data + +import org.junit.Assert.assertEquals +import org.junit.Test + +/** + * Example local unit test, which will execute on the development machine (host). + * + * See [testing documentation](http://d.android.com/tools/testing). + */ +class ExampleUnitTest { + @Test + fun addition_isCorrect() { + assertEquals(4, 2 + 2) + } +} diff --git a/settings.gradle b/settings.gradle index f76033e6..3e237be1 100644 --- a/settings.gradle +++ b/settings.gradle @@ -14,3 +14,4 @@ dependencyResolutionManagement { } rootProject.name = "Hous-Aos" include ':app' +include ':data' From 9596e06c31e47323f7ea2cf51a5ddcd35d743a6d Mon Sep 17 00:00:00 2001 From: KWY0218 Date: Fri, 5 Aug 2022 09:28:31 +0900 Subject: [PATCH 02/11] =?UTF-8?q?#173=20[refact]=20=ED=8C=A8=ED=82=A4?= =?UTF-8?q?=EC=A7=80=EC=97=90=EC=84=9C=20data=20=EB=AA=A8=EB=93=88?= =?UTF-8?q?=EB=A1=9C=20=EC=9D=B4=EB=8F=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/hous/hous_aos/data/api/NewRulesApi.kt | 22 ---------- .../com/hous/hous_aos/data/api/ProfileApi.kt | 27 ------------ .../data/entity/rules/RequestEventData.kt | 14 ------ .../data/repository/NewRulesRepository.kt | 8 ++-- .../data/repository/NewRulesRepositoryImpl.kt | 20 ++++----- .../data/source/local/LocalDataSource.kt | 3 -- .../data/source/local/LocalDataSourceImpl.kt | 9 ---- .../source/remote/RemoteNewRulesDataSource.kt | 10 ----- .../source/remote/RemoteProfileDataSource.kt | 14 ------ .../com/hous/hous_aos/di/LocalSourceModule.kt | 6 +-- .../com/hous/hous_aos/di/NetworkModule.kt | 28 ++++++------ .../hous/hous_aos/di/RemoteSourceModule.kt | 16 +++---- .../com/hous/hous_aos/di/RepositoryModule.kt | 24 +++++------ .../hous/hous_aos/ui/home/EventViewModel.kt | 32 +++++++------- .../hous/hous_aos/ui/home/RommateViewModel.kt | 12 ++++-- .../hous_aos/ui/home/adapter/EventAdapter.kt | 12 +++--- .../home/adapter/EventParticipantAdapter.kt | 12 +++--- .../hous_aos/ui/home/adapter/HomieAdapter.kt | 13 +++--- .../hous_aos/ui/home/adapter/ToDoAdapter.kt | 12 +++--- .../hous_aos/ui/newrules/NewRulesScreen.kt | 4 +- .../hous_aos/ui/newrules/NewRulesViewModel.kt | 43 +++++++++++-------- .../ui/newrules/component/CategoryDropDown.kt | 4 +- .../ui/newrules/component/CategoryItem.kt | 4 +- .../ui/newrules/component/ManagerAddButton.kt | 4 +- .../ui/newrules/component/ManagerBox.kt | 6 +-- .../ui/newrules/component/ManagerDropDown.kt | 6 +-- .../ui/newrules/component/ManagerItem.kt | 6 +-- .../hous_aos/ui/profile/ProfileViewModel.kt | 8 ++-- .../hous_aos/ui/profile/ResultViewModel.kt | 12 +++--- .../hous_aos/ui/profile/TendencyAdapter.kt | 26 +++++------ .../hous_aos/ui/profile/TendencyViewModel.kt | 30 ++++++------- .../ui/rules/HomeRulesCategoryAdapter.kt | 18 ++++---- .../hous/hous_aos/ui/rules/RulesViewModel.kt | 34 ++++++++------- .../ui/rules/my_to_do/MyToDoAdapter.kt | 16 +++---- .../rules/rules_table/GeneralRulesAdapter.kt | 16 +++---- .../ui/rules/rules_table/KeyRulesAdapter.kt | 12 +++--- .../ui/rules/today_to_do/TodayTodoAdapter.kt | 26 +++++------ .../tem_dialog/TempMangerAdapter.kt | 16 +++---- .../com/hous/hous_aos/util/GetColorSet.kt | 14 +++--- app/src/main/res/layout/item_home_event.xml | 2 +- app/src/main/res/layout/item_home_homie.xml | 2 +- .../main/res/layout/item_home_homie_copy.xml | 2 +- .../res/layout/item_home_participants.xml | 2 +- app/src/main/res/layout/item_home_to_do.xml | 2 +- .../main/res/layout/item_rules_my_to_do.xml | 2 +- app/src/main/res/layout/item_rules_rule.xml | 2 +- .../res/layout/item_rules_table_general.xml | 2 +- .../main/res/layout/item_rules_table_keys.xml | 2 +- .../res/layout/item_rules_tmp_managers.xml | 2 +- .../item_rules_today_to_do_item_multi.xml | 2 +- .../item_rules_today_to_do_item_none.xml | 2 +- .../item_rules_today_to_do_item_one.xml | 2 +- .../main/res/layout/item_tendency_test.xml | 4 +- .../main/java/com/hous}/data/api/HomeApi.kt | 34 +++++++-------- .../java/com/hous/data/api/NewRulesApi.kt | 22 ++++++++++ .../main/java/com/hous/data/api/ProfileApi.kt | 26 +++++++++++ .../main/java/com/hous}/data/api/RulesApi.kt | 25 ++++------- .../java/com/hous}/data/entity/Category.kt | 2 +- .../java/com/hous}/data/entity/ColorSet.kt | 2 +- .../main/java/com/hous}/data/entity/Event.kt | 2 +- .../main/java/com/hous}/data/entity/Homie.kt | 2 +- .../java/com/hous}/data/entity/ResultData.kt | 2 +- .../main/java/com/hous}/data/entity/Rule.kt | 2 +- .../java/com/hous}/data/entity/TypeTest.kt | 2 +- .../java/com/hous}/data/model/WrapperClass.kt | 2 +- .../data/model/request/EventListRequest.kt | 2 +- .../data/model/request/MyToDoCheckRequest.kt | 2 +- .../data/model/request/NewRulesRequest.kt | 2 +- .../model/request/PutTestResultRequest.kt | 2 +- .../data/model/response/EventResponse.kt | 2 +- .../hous}/data/model/response/HomeResponse.kt | 2 +- .../model/response/NewRulesListResponse.kt | 2 +- .../data/model/response/RulesTableResponse.kt | 2 +- .../response/RulesTodayInfoListResponse.kt | 2 +- .../data/model/response/TempManagerRequest.kt | 2 +- .../model/response/TempManagerResponse.kt | 2 +- .../model/response/TypeTestListResponse.kt | 2 +- .../hous}/data/repository/HomeRepository.kt | 14 +++--- .../data/repository/HomeRepositoryImpl.kt | 21 +++++---- .../data/repository/ProfileRepository.kt | 12 +++--- .../data/repository/ProfileRepositoryImpl.kt | 15 +++---- .../data/repository/RulesTodayRepository.kt | 18 ++++---- .../repository/RulesTodayRepositoryImpl.kt | 20 ++++----- .../hous/data/source/local/LocalDataSource.kt | 3 ++ .../data/source/local/LocalDataSourceImpl.kt | 7 +++ .../source/remote/RemoteHomeDataSource.kt | 15 ++++--- .../source/remote/RemoteHomeDataSourceImpl.kt | 18 ++++---- .../source/remote/RemoteNewRulesDataSource.kt | 10 +++++ .../remote/RemoteNewRulesDataSourceImpl.kt | 10 ++--- .../source/remote/RemoteProfileDataSource.kt | 14 ++++++ .../remote/RemoteProfileDataSourceImpl.kt | 14 +++--- .../remote/RemoteRulesTodayDataSource.kt | 18 ++++---- .../remote/RemoteRulesTodayDataSourceImpl.kt | 26 ++++++----- 93 files changed, 500 insertions(+), 511 deletions(-) delete mode 100644 app/src/main/java/com/hous/hous_aos/data/api/NewRulesApi.kt delete mode 100644 app/src/main/java/com/hous/hous_aos/data/api/ProfileApi.kt delete mode 100644 app/src/main/java/com/hous/hous_aos/data/entity/rules/RequestEventData.kt delete mode 100644 app/src/main/java/com/hous/hous_aos/data/source/local/LocalDataSource.kt delete mode 100644 app/src/main/java/com/hous/hous_aos/data/source/local/LocalDataSourceImpl.kt delete mode 100644 app/src/main/java/com/hous/hous_aos/data/source/remote/RemoteNewRulesDataSource.kt delete mode 100644 app/src/main/java/com/hous/hous_aos/data/source/remote/RemoteProfileDataSource.kt rename {app/src/main/java/com/hous/hous_aos => data/src/main/java/com/hous}/data/api/HomeApi.kt (52%) create mode 100644 data/src/main/java/com/hous/data/api/NewRulesApi.kt create mode 100644 data/src/main/java/com/hous/data/api/ProfileApi.kt rename {app/src/main/java/com/hous/hous_aos => data/src/main/java/com/hous}/data/api/RulesApi.kt (57%) rename {app/src/main/java/com/hous/hous_aos => data/src/main/java/com/hous}/data/entity/Category.kt (87%) rename {app/src/main/java/com/hous/hous_aos => data/src/main/java/com/hous}/data/entity/ColorSet.kt (81%) rename {app/src/main/java/com/hous/hous_aos => data/src/main/java/com/hous}/data/entity/Event.kt (90%) rename {app/src/main/java/com/hous/hous_aos => data/src/main/java/com/hous}/data/entity/Homie.kt (92%) rename {app/src/main/java/com/hous/hous_aos => data/src/main/java/com/hous}/data/entity/ResultData.kt (91%) rename {app/src/main/java/com/hous/hous_aos => data/src/main/java/com/hous}/data/entity/Rule.kt (92%) rename {app/src/main/java/com/hous/hous_aos => data/src/main/java/com/hous}/data/entity/TypeTest.kt (90%) rename {app/src/main/java/com/hous/hous_aos => data/src/main/java/com/hous}/data/model/WrapperClass.kt (77%) rename {app/src/main/java/com/hous/hous_aos => data/src/main/java/com/hous}/data/model/request/EventListRequest.kt (76%) rename {app/src/main/java/com/hous/hous_aos => data/src/main/java/com/hous}/data/model/request/MyToDoCheckRequest.kt (56%) rename {app/src/main/java/com/hous/hous_aos => data/src/main/java/com/hous}/data/model/request/NewRulesRequest.kt (86%) rename {app/src/main/java/com/hous/hous_aos => data/src/main/java/com/hous}/data/model/request/PutTestResultRequest.kt (59%) rename {app/src/main/java/com/hous/hous_aos => data/src/main/java/com/hous}/data/model/response/EventResponse.kt (85%) rename {app/src/main/java/com/hous/hous_aos => data/src/main/java/com/hous}/data/model/response/HomeResponse.kt (87%) rename {app/src/main/java/com/hous/hous_aos => data/src/main/java/com/hous}/data/model/response/NewRulesListResponse.kt (82%) rename {app/src/main/java/com/hous/hous_aos => data/src/main/java/com/hous}/data/model/response/RulesTableResponse.kt (74%) rename {app/src/main/java/com/hous/hous_aos => data/src/main/java/com/hous}/data/model/response/RulesTodayInfoListResponse.kt (83%) rename {app/src/main/java/com/hous/hous_aos => data/src/main/java/com/hous}/data/model/response/TempManagerRequest.kt (64%) rename {app/src/main/java/com/hous/hous_aos => data/src/main/java/com/hous}/data/model/response/TempManagerResponse.kt (82%) rename {app/src/main/java/com/hous/hous_aos => data/src/main/java/com/hous}/data/model/response/TypeTestListResponse.kt (70%) rename {app/src/main/java/com/hous/hous_aos => data/src/main/java/com/hous}/data/repository/HomeRepository.kt (66%) rename {app/src/main/java/com/hous/hous_aos => data/src/main/java/com/hous}/data/repository/HomeRepositoryImpl.kt (74%) rename {app/src/main/java/com/hous/hous_aos => data/src/main/java/com/hous}/data/repository/ProfileRepository.kt (51%) rename {app/src/main/java/com/hous/hous_aos => data/src/main/java/com/hous}/data/repository/ProfileRepositoryImpl.kt (61%) rename {app/src/main/java/com/hous/hous_aos => data/src/main/java/com/hous}/data/repository/RulesTodayRepository.kt (62%) rename {app/src/main/java/com/hous/hous_aos => data/src/main/java/com/hous}/data/repository/RulesTodayRepositoryImpl.kt (74%) create mode 100644 data/src/main/java/com/hous/data/source/local/LocalDataSource.kt create mode 100644 data/src/main/java/com/hous/data/source/local/LocalDataSourceImpl.kt rename {app/src/main/java/com/hous/hous_aos => data/src/main/java/com/hous}/data/source/remote/RemoteHomeDataSource.kt (64%) rename {app/src/main/java/com/hous/hous_aos => data/src/main/java/com/hous}/data/source/remote/RemoteHomeDataSourceImpl.kt (75%) create mode 100644 data/src/main/java/com/hous/data/source/remote/RemoteNewRulesDataSource.kt rename {app/src/main/java/com/hous/hous_aos => data/src/main/java/com/hous}/data/source/remote/RemoteNewRulesDataSourceImpl.kt (66%) create mode 100644 data/src/main/java/com/hous/data/source/remote/RemoteProfileDataSource.kt rename {app/src/main/java/com/hous/hous_aos => data/src/main/java/com/hous}/data/source/remote/RemoteProfileDataSourceImpl.kt (65%) rename {app/src/main/java/com/hous/hous_aos => data/src/main/java/com/hous}/data/source/remote/RemoteRulesTodayDataSource.kt (60%) rename {app/src/main/java/com/hous/hous_aos => data/src/main/java/com/hous}/data/source/remote/RemoteRulesTodayDataSourceImpl.kt (66%) diff --git a/app/src/main/java/com/hous/hous_aos/data/api/NewRulesApi.kt b/app/src/main/java/com/hous/hous_aos/data/api/NewRulesApi.kt deleted file mode 100644 index f209b13c..00000000 --- a/app/src/main/java/com/hous/hous_aos/data/api/NewRulesApi.kt +++ /dev/null @@ -1,22 +0,0 @@ -package com.hous.hous_aos.data.api - -import com.hous.hous_aos.data.model.WrapperClass -import com.hous.hous_aos.data.model.request.NewRulesRequest -import com.hous.hous_aos.data.model.response.NewRulesListResponse -import retrofit2.http.Body -import retrofit2.http.GET -import retrofit2.http.POST -import retrofit2.http.Path - -interface NewRulesApi { - @POST("room/{roomId}/rule") - suspend fun addNewRule( - @Path("roomId") roomId: String, - @Body newRulesRequest: NewRulesRequest - ): WrapperClass - - @GET("room/{roomId}/rule/new") - suspend fun getNewRuleList( - @Path("roomId") roomId: String - ): WrapperClass -} diff --git a/app/src/main/java/com/hous/hous_aos/data/api/ProfileApi.kt b/app/src/main/java/com/hous/hous_aos/data/api/ProfileApi.kt deleted file mode 100644 index 7c207d31..00000000 --- a/app/src/main/java/com/hous/hous_aos/data/api/ProfileApi.kt +++ /dev/null @@ -1,27 +0,0 @@ -package com.hous.hous_aos.data.api - -import com.hous.hous_aos.data.entity.Homie -import com.hous.hous_aos.data.model.WrapperClass -import com.hous.hous_aos.data.model.request.PutTestResultRequest -import com.hous.hous_aos.data.model.response.TypeTestResponse -import com.hous.hous_aos.data.entity.ResultData -import retrofit2.http.Body -import retrofit2.http.GET -import retrofit2.http.PUT -import retrofit2.http.Path - -interface ProfileApi { - @GET("user/profile") - suspend fun getUserProfile(): WrapperClass - - @PUT("user/type/test") - suspend fun putTestResult( - @Body body: PutTestResultRequest - ): WrapperClass - - @GET("type/test") - suspend fun getTypeTestList(): WrapperClass - - @GET("user/me/type") - suspend fun getMyResult(): WrapperClass -} diff --git a/app/src/main/java/com/hous/hous_aos/data/entity/rules/RequestEventData.kt b/app/src/main/java/com/hous/hous_aos/data/entity/rules/RequestEventData.kt deleted file mode 100644 index c1c23af6..00000000 --- a/app/src/main/java/com/hous/hous_aos/data/entity/rules/RequestEventData.kt +++ /dev/null @@ -1,14 +0,0 @@ -package com.hous.hous_aos.data.entity.rules - -import com.google.gson.annotations.SerializedName - -/** - * EventData에서 paricipants랑 지네릭 T이 달라서 따로 빼야할 듯??*/ -data class RequestEventData( - @SerializedName("_id") - val id: String, - val eventName: String, - val eventIcon: String, - val date: String, - val participants: List -) diff --git a/app/src/main/java/com/hous/hous_aos/data/repository/NewRulesRepository.kt b/app/src/main/java/com/hous/hous_aos/data/repository/NewRulesRepository.kt index b637728d..212c49a1 100644 --- a/app/src/main/java/com/hous/hous_aos/data/repository/NewRulesRepository.kt +++ b/app/src/main/java/com/hous/hous_aos/data/repository/NewRulesRepository.kt @@ -1,10 +1,10 @@ package com.hous.hous_aos.data.repository -import com.hous.hous_aos.data.model.WrapperClass -import com.hous.hous_aos.data.model.response.NewRulesListResponse +import com.hous.data.model.WrapperClass +import com.hous.data.model.response.NewRulesListResponse import com.hous.hous_aos.ui.newrules.NewRulesUiState interface NewRulesRepository { - suspend fun addNewRule(newRulesUiState: NewRulesUiState): Result> - suspend fun getNewRuleList(roomId: String): Result> + suspend fun addNewRule(newRulesUiState: NewRulesUiState): Result> + suspend fun getNewRuleList(roomId: String): Result> } diff --git a/app/src/main/java/com/hous/hous_aos/data/repository/NewRulesRepositoryImpl.kt b/app/src/main/java/com/hous/hous_aos/data/repository/NewRulesRepositoryImpl.kt index fbd01439..ee5a4dd9 100644 --- a/app/src/main/java/com/hous/hous_aos/data/repository/NewRulesRepositoryImpl.kt +++ b/app/src/main/java/com/hous/hous_aos/data/repository/NewRulesRepositoryImpl.kt @@ -1,28 +1,28 @@ package com.hous.hous_aos.data.repository import android.util.Log -import com.hous.hous_aos.data.model.WrapperClass -import com.hous.hous_aos.data.model.request.Member -import com.hous.hous_aos.data.model.request.NewRulesRequest -import com.hous.hous_aos.data.model.response.NewRulesListResponse -import com.hous.hous_aos.data.source.remote.RemoteNewRulesDataSource +import com.hous.data.model.WrapperClass +import com.hous.data.model.request.Member +import com.hous.data.model.request.NewRulesRequest +import com.hous.data.model.response.NewRulesListResponse +import com.hous.data.source.remote.RemoteNewRulesDataSource import com.hous.hous_aos.ui.newrules.DayData import com.hous.hous_aos.ui.newrules.NewRulesUiState import com.hous.hous_aos.ui.newrules.component.State import javax.inject.Inject class NewRulesRepositoryImpl @Inject constructor( - private val remoteNewRulesDataSource: RemoteNewRulesDataSource + private val remoteNewRulesDataSource: com.hous.data.source.remote.RemoteNewRulesDataSource ) : NewRulesRepository { - override suspend fun addNewRule(newRulesUiState: NewRulesUiState): Result> { + override suspend fun addNewRule(newRulesUiState: NewRulesUiState): Result> { val ruleMember = newRulesUiState.ManagerList.map { val dayList = dayToInt(it.dayDataList) - Member( + com.hous.data.model.request.Member( userId = it.managerHomie.id, day = dayList ) } - val newRulesRequest = NewRulesRequest( + val newRulesRequest = com.hous.data.model.request.NewRulesRequest( notificationState = newRulesUiState.notificationState, ruleName = newRulesUiState.ruleName, categoryId = newRulesUiState.categoryId, @@ -33,7 +33,7 @@ class NewRulesRepositoryImpl @Inject constructor( return runCatching { remoteNewRulesDataSource.addNewRule(newRulesRequest) } } - override suspend fun getNewRuleList(roomId: String): Result> = + override suspend fun getNewRuleList(roomId: String): Result> = runCatching { remoteNewRulesDataSource.getNewRuleList(roomId) } private fun dayToInt(dayDataList: List): List { diff --git a/app/src/main/java/com/hous/hous_aos/data/source/local/LocalDataSource.kt b/app/src/main/java/com/hous/hous_aos/data/source/local/LocalDataSource.kt deleted file mode 100644 index 682cbff9..00000000 --- a/app/src/main/java/com/hous/hous_aos/data/source/local/LocalDataSource.kt +++ /dev/null @@ -1,3 +0,0 @@ -package com.hous.hous_aos.data.source.local - -interface LocalDataSource diff --git a/app/src/main/java/com/hous/hous_aos/data/source/local/LocalDataSourceImpl.kt b/app/src/main/java/com/hous/hous_aos/data/source/local/LocalDataSourceImpl.kt deleted file mode 100644 index d81eb769..00000000 --- a/app/src/main/java/com/hous/hous_aos/data/source/local/LocalDataSourceImpl.kt +++ /dev/null @@ -1,9 +0,0 @@ -package com.hous.hous_aos.data.source.local - -import android.content.Context -import dagger.hilt.android.qualifiers.ApplicationContext -import javax.inject.Inject - -class LocalDataSourceImpl @Inject constructor( - @ApplicationContext context: Context -) : LocalDataSource diff --git a/app/src/main/java/com/hous/hous_aos/data/source/remote/RemoteNewRulesDataSource.kt b/app/src/main/java/com/hous/hous_aos/data/source/remote/RemoteNewRulesDataSource.kt deleted file mode 100644 index 8ae67ef2..00000000 --- a/app/src/main/java/com/hous/hous_aos/data/source/remote/RemoteNewRulesDataSource.kt +++ /dev/null @@ -1,10 +0,0 @@ -package com.hous.hous_aos.data.source.remote - -import com.hous.hous_aos.data.model.WrapperClass -import com.hous.hous_aos.data.model.request.NewRulesRequest -import com.hous.hous_aos.data.model.response.NewRulesListResponse - -interface RemoteNewRulesDataSource { - suspend fun addNewRule(newRulesRequest: NewRulesRequest): WrapperClass - suspend fun getNewRuleList(roomId: String): WrapperClass -} diff --git a/app/src/main/java/com/hous/hous_aos/data/source/remote/RemoteProfileDataSource.kt b/app/src/main/java/com/hous/hous_aos/data/source/remote/RemoteProfileDataSource.kt deleted file mode 100644 index 2b4c5b85..00000000 --- a/app/src/main/java/com/hous/hous_aos/data/source/remote/RemoteProfileDataSource.kt +++ /dev/null @@ -1,14 +0,0 @@ -package com.hous.hous_aos.data.source.remote - -import com.hous.hous_aos.data.entity.Homie -import com.hous.hous_aos.data.entity.ResultData -import com.hous.hous_aos.data.model.WrapperClass -import com.hous.hous_aos.data.model.request.PutTestResultRequest -import com.hous.hous_aos.data.model.response.TypeTestResponse - -interface RemoteProfileDataSource { - suspend fun getUserProfile(): WrapperClass - suspend fun putTestResult(typeScore: PutTestResultRequest): WrapperClass - suspend fun getTypeTestList(): WrapperClass - suspend fun getMyResult(): WrapperClass -} diff --git a/app/src/main/java/com/hous/hous_aos/di/LocalSourceModule.kt b/app/src/main/java/com/hous/hous_aos/di/LocalSourceModule.kt index 86733bea..fee8e550 100644 --- a/app/src/main/java/com/hous/hous_aos/di/LocalSourceModule.kt +++ b/app/src/main/java/com/hous/hous_aos/di/LocalSourceModule.kt @@ -1,7 +1,7 @@ package com.hous.hous_aos.di -import com.hous.hous_aos.data.source.local.LocalDataSource -import com.hous.hous_aos.data.source.local.LocalDataSourceImpl +import com.hous.data.source.local.LocalDataSource +import com.hous.data.source.local.LocalDataSourceImpl import dagger.Module import dagger.Provides import dagger.hilt.InstallIn @@ -13,5 +13,5 @@ import javax.inject.Singleton object LocalSourceModule { @Singleton @Provides - fun providesLocalDataSource(impl: LocalDataSourceImpl): LocalDataSource = impl + fun providesLocalDataSource(impl: com.hous.data.source.local.LocalDataSourceImpl): com.hous.data.source.local.LocalDataSource = impl } diff --git a/app/src/main/java/com/hous/hous_aos/di/NetworkModule.kt b/app/src/main/java/com/hous/hous_aos/di/NetworkModule.kt index 2f20a593..9349aa54 100644 --- a/app/src/main/java/com/hous/hous_aos/di/NetworkModule.kt +++ b/app/src/main/java/com/hous/hous_aos/di/NetworkModule.kt @@ -2,11 +2,11 @@ package com.hous.hous_aos.di import com.google.gson.GsonBuilder import com.hous.hous_aos.BuildConfig -import com.hous.hous_aos.data.api.HomeApi -import com.hous.hous_aos.data.api.NewRulesApi -import com.hous.hous_aos.data.api.ProfileApi -import com.hous.hous_aos.data.api.RulesApi -import com.hous.hous_aos.data.source.local.LocalDataSource +import com.hous.data.api.HomeApi +import com.hous.data.api.NewRulesApi +import com.hous.data.api.ProfileApi +import com.hous.data.api.RulesApi +import com.hous.data.source.local.LocalDataSource import dagger.Module import dagger.Provides import dagger.hilt.InstallIn @@ -28,7 +28,7 @@ object NetworkModule { @Provides @Singleton fun providesHousInterceptor( - localDataSource: LocalDataSource + localDataSource: com.hous.data.source.local.LocalDataSource ): Interceptor = Interceptor { chain -> with(chain) { @@ -78,21 +78,21 @@ object NetworkModule { @Provides @Singleton - fun provideHomeService(retrofit: Retrofit): HomeApi = - retrofit.create(HomeApi::class.java) + fun provideHomeService(retrofit: Retrofit): com.hous.data.api.HomeApi = + retrofit.create(com.hous.data.api.HomeApi::class.java) @Provides @Singleton - fun provideRulesService(retrofit: Retrofit): RulesApi = - retrofit.create(RulesApi::class.java) + fun provideRulesService(retrofit: Retrofit): com.hous.data.api.RulesApi = + retrofit.create(com.hous.data.api.RulesApi::class.java) @Provides @Singleton - fun provideProfileService(retrofit: Retrofit): ProfileApi = - retrofit.create(ProfileApi::class.java) + fun provideProfileService(retrofit: Retrofit): com.hous.data.api.ProfileApi = + retrofit.create(com.hous.data.api.ProfileApi::class.java) @Provides @Singleton - fun provideNewRulesApi(retrofit: Retrofit): NewRulesApi = - retrofit.create(NewRulesApi::class.java) + fun provideNewRulesApi(retrofit: Retrofit): com.hous.data.api.NewRulesApi = + retrofit.create(com.hous.data.api.NewRulesApi::class.java) } diff --git a/app/src/main/java/com/hous/hous_aos/di/RemoteSourceModule.kt b/app/src/main/java/com/hous/hous_aos/di/RemoteSourceModule.kt index 1d99ff3c..5deea800 100644 --- a/app/src/main/java/com/hous/hous_aos/di/RemoteSourceModule.kt +++ b/app/src/main/java/com/hous/hous_aos/di/RemoteSourceModule.kt @@ -13,24 +13,24 @@ object RemoteSourceModule { @Provides @Singleton fun providesRemoteHomeSource( - impl: RemoteHomeDataSourceImpl - ): RemoteHomeDataSource = impl + impl: com.hous.data.source.remote.RemoteHomeDataSourceImpl + ): com.hous.data.source.remote.RemoteHomeDataSource = impl @Provides @Singleton fun providesRemoteRulesSource( - impl: RemoteRulesTodayDataSourceImpl - ): RemoteRulesTodayDataSource = impl + impl: com.hous.data.source.remote.RemoteRulesTodayDataSourceImpl + ): com.hous.data.source.remote.RemoteRulesTodayDataSource = impl @Provides @Singleton fun providesRemoteProfileSource( - impl: RemoteProfileDataSourceImpl - ): RemoteProfileDataSource = impl + impl: com.hous.data.source.remote.RemoteProfileDataSourceImpl + ): com.hous.data.source.remote.RemoteProfileDataSource = impl @Provides @Singleton fun providesRemoteNewRulesSource( - impl: RemoteNewRulesDataSourceImpl - ): RemoteNewRulesDataSource = impl + impl: com.hous.data.source.remote.RemoteNewRulesDataSourceImpl + ): com.hous.data.source.remote.RemoteNewRulesDataSource = impl } diff --git a/app/src/main/java/com/hous/hous_aos/di/RepositoryModule.kt b/app/src/main/java/com/hous/hous_aos/di/RepositoryModule.kt index ca3c09ba..814b49cd 100644 --- a/app/src/main/java/com/hous/hous_aos/di/RepositoryModule.kt +++ b/app/src/main/java/com/hous/hous_aos/di/RepositoryModule.kt @@ -1,13 +1,13 @@ package com.hous.hous_aos.di -import com.hous.hous_aos.data.repository.HomeRepository -import com.hous.hous_aos.data.repository.HomeRepositoryImpl +import com.hous.data.repository.HomeRepository +import com.hous.data.repository.HomeRepositoryImpl import com.hous.hous_aos.data.repository.NewRulesRepository import com.hous.hous_aos.data.repository.NewRulesRepositoryImpl -import com.hous.hous_aos.data.repository.ProfileRepository -import com.hous.hous_aos.data.repository.ProfileRepositoryImpl -import com.hous.hous_aos.data.repository.RulesTodayRepository -import com.hous.hous_aos.data.repository.RulesTodayRepositoryImpl +import com.hous.data.repository.ProfileRepository +import com.hous.data.repository.ProfileRepositoryImpl +import com.hous.data.repository.RulesTodayRepository +import com.hous.data.repository.RulesTodayRepositoryImpl import dagger.Module import dagger.Provides import dagger.hilt.InstallIn @@ -26,19 +26,19 @@ object RepositoryModule { @Provides @Singleton fun providesRulesTodayRepository( - impl: RulesTodayRepositoryImpl - ): RulesTodayRepository = impl + impl: com.hous.data.repository.RulesTodayRepositoryImpl + ): com.hous.data.repository.RulesTodayRepository = impl @Provides @Singleton fun providesProfileRepository( - impl: ProfileRepositoryImpl - ): ProfileRepository = impl + impl: com.hous.data.repository.ProfileRepositoryImpl + ): com.hous.data.repository.ProfileRepository = impl @Provides @Singleton fun providesHomeRepository( - impl: HomeRepositoryImpl - ): HomeRepository = impl + impl: com.hous.data.repository.HomeRepositoryImpl + ): com.hous.data.repository.HomeRepository = impl } diff --git a/app/src/main/java/com/hous/hous_aos/ui/home/EventViewModel.kt b/app/src/main/java/com/hous/hous_aos/ui/home/EventViewModel.kt index 38b166e8..0750cb8f 100644 --- a/app/src/main/java/com/hous/hous_aos/ui/home/EventViewModel.kt +++ b/app/src/main/java/com/hous/hous_aos/ui/home/EventViewModel.kt @@ -4,11 +4,11 @@ import android.util.Log import androidx.lifecycle.MutableLiveData import androidx.lifecycle.ViewModel import androidx.lifecycle.viewModelScope -import com.hous.hous_aos.data.entity.Event -import com.hous.hous_aos.data.entity.Homie -import com.hous.hous_aos.data.entity.Rule -import com.hous.hous_aos.data.model.request.EventListRequest -import com.hous.hous_aos.data.repository.HomeRepository +import com.hous.data.entity.Event +import com.hous.data.entity.Homie +import com.hous.data.entity.Rule +import com.hous.data.model.request.EventListRequest +import com.hous.data.repository.HomeRepository import dagger.hilt.android.lifecycle.HiltViewModel import kotlinx.coroutines.launch import java.time.LocalDateTime @@ -17,7 +17,7 @@ import javax.inject.Inject @HiltViewModel class EventViewModel @Inject constructor( - private val homeRepository: HomeRepository + private val homeRepository: com.hous.data.repository.HomeRepository ) : ViewModel() { private var _tmpEventId = MutableLiveData("") val tmpEventId get() = _tmpEventId @@ -28,7 +28,7 @@ class EventViewModel @Inject constructor( private var _eventIconPosition = MutableLiveData(START_POSITION) val eventIconPosition get() = _eventIconPosition - private val _responseEventData = MutableLiveData() + private val _responseEventData = MutableLiveData() val responseEventData get() = _responseEventData private val _eventName = MutableLiveData() @@ -37,7 +37,7 @@ class EventViewModel @Inject constructor( private val _selectedEvent = MutableLiveData(EventIcon.FIRST) val selectedEvent get() = _selectedEvent - private var _eventParticipantList = MutableLiveData>() + private var _eventParticipantList = MutableLiveData>() val eventParticipantList get() = _eventParticipantList // 받아올 때 @@ -140,7 +140,7 @@ class EventViewModel @Inject constructor( viewModelScope.launch { homeRepository.putEventList( "", _tmpEventId.value!!, - EventListRequest( + com.hous.data.model.request.EventListRequest( eventName = eventName.value!!, date = eventDate.value!!, participants = clickedTmpManagerList, @@ -158,16 +158,16 @@ class EventViewModel @Inject constructor( /************************************************************************************************** * 영주 코드 */ - private val _eventList = MutableLiveData>() + private val _eventList = MutableLiveData>() val eventList get() = _eventList private val _keyRulesList = MutableLiveData>() val keyRulesList get() = _keyRulesList - private val _todoList = MutableLiveData>() + private val _todoList = MutableLiveData>() val todoList get() = _todoList - private val _homieList = MutableLiveData>() + private val _homieList = MutableLiveData>() val homieList get() = _homieList private val _roomCode = MutableLiveData() @@ -178,14 +178,14 @@ class EventViewModel @Inject constructor( homeRepository.getHomeList("") .onSuccess { result -> Log.d("asdf", "success ${result.data}") - val tempEventList = mutableListOf(Event()) + val tempEventList = mutableListOf(com.hous.data.entity.Event()) result.data!!.eventList.forEach { tempEventList.add(it) } _eventList.value = tempEventList _roomCode.value = result.data!!.roomCode _todoList.value = result.data!!.todoList _keyRulesList.value = result.data!!.keyRulesList _homieList.value = result.data!!.homieProfileList - val tempHomieList = mutableListOf(Homie()) + val tempHomieList = mutableListOf(com.hous.data.entity.Homie()) _homieList.value = _homieList.value?.plus(tempHomieList) } .onFailure { result -> @@ -202,7 +202,7 @@ class EventViewModel @Inject constructor( viewModelScope.launch { homeRepository.addEvent( "", - EventListRequest( + com.hous.data.model.request.EventListRequest( eventName = eventName.value!!, date = eventDate.value!!, participants = clickedTmpManagerList, @@ -231,7 +231,7 @@ class EventViewModel @Inject constructor( private suspend fun getEventList() { homeRepository.getHomeList("").onSuccess { result -> Log.d("asdf", "success ${result.message}") - val tempEventList = mutableListOf(Event()) + val tempEventList = mutableListOf(com.hous.data.entity.Event()) result.data!!.eventList.forEach { tempEventList.add(it) } _eventList.value = tempEventList }.onFailure { result -> diff --git a/app/src/main/java/com/hous/hous_aos/ui/home/RommateViewModel.kt b/app/src/main/java/com/hous/hous_aos/ui/home/RommateViewModel.kt index aff6a907..761b241f 100644 --- a/app/src/main/java/com/hous/hous_aos/ui/home/RommateViewModel.kt +++ b/app/src/main/java/com/hous/hous_aos/ui/home/RommateViewModel.kt @@ -4,17 +4,21 @@ import android.util.Log import androidx.lifecycle.MutableLiveData import androidx.lifecycle.ViewModel import androidx.lifecycle.viewModelScope -import com.hous.hous_aos.data.entity.Homie -import com.hous.hous_aos.data.repository.HomeRepository +import com.hous.data.entity.Homie +import com.hous.data.repository.HomeRepository import dagger.hilt.android.lifecycle.HiltViewModel import kotlinx.coroutines.launch import javax.inject.Inject @HiltViewModel class RommateViewModel @Inject constructor( - private val homeRepository: HomeRepository + private val homeRepository: com.hous.data.repository.HomeRepository ) : ViewModel() { - private val _homieData = MutableLiveData(Homie(typeScore = listOf(3, 3, 3, 3, 3))) + private val _homieData = MutableLiveData( + com.hous.data.entity.Homie( + typeScore = listOf(3, 3, 3, 3, 3) + ) + ) val homieData get() = _homieData private val _homieId = MutableLiveData() diff --git a/app/src/main/java/com/hous/hous_aos/ui/home/adapter/EventAdapter.kt b/app/src/main/java/com/hous/hous_aos/ui/home/adapter/EventAdapter.kt index 5ae1c85e..64efe6ae 100644 --- a/app/src/main/java/com/hous/hous_aos/ui/home/adapter/EventAdapter.kt +++ b/app/src/main/java/com/hous/hous_aos/ui/home/adapter/EventAdapter.kt @@ -7,13 +7,13 @@ import androidx.recyclerview.widget.DiffUtil import androidx.recyclerview.widget.ListAdapter import androidx.recyclerview.widget.RecyclerView import com.hous.hous_aos.R -import com.hous.hous_aos.data.entity.Event +import com.hous.data.entity.Event import com.hous.hous_aos.databinding.ItemHomeEventBinding class EventAdapter( private val onClickEventIcon: (Int) -> Unit ) : - ListAdapter(eventDiffUtil) { + ListAdapter(eventDiffUtil) { override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): EventViewHolder { val binding = @@ -30,7 +30,7 @@ class EventAdapter( private val onClickEventIcon: (Int) -> Unit, ) : RecyclerView.ViewHolder(binding.root) { - fun onBind(data: Event) { + fun onBind(data: com.hous.data.entity.Event) { binding.event = data binding.position = absoluteAdapterPosition when (data.eventIcon) { @@ -63,11 +63,11 @@ class EventAdapter( } companion object { - private val eventDiffUtil = object : DiffUtil.ItemCallback() { - override fun areItemsTheSame(oldItem: Event, newItem: Event): Boolean = + private val eventDiffUtil = object : DiffUtil.ItemCallback() { + override fun areItemsTheSame(oldItem: com.hous.data.entity.Event, newItem: com.hous.data.entity.Event): Boolean = oldItem.id == newItem.id - override fun areContentsTheSame(oldItem: Event, newItem: Event): Boolean = + override fun areContentsTheSame(oldItem: com.hous.data.entity.Event, newItem: com.hous.data.entity.Event): Boolean = oldItem == newItem } private val TAG = "dialod" diff --git a/app/src/main/java/com/hous/hous_aos/ui/home/adapter/EventParticipantAdapter.kt b/app/src/main/java/com/hous/hous_aos/ui/home/adapter/EventParticipantAdapter.kt index 5dcd731b..669ad3db 100644 --- a/app/src/main/java/com/hous/hous_aos/ui/home/adapter/EventParticipantAdapter.kt +++ b/app/src/main/java/com/hous/hous_aos/ui/home/adapter/EventParticipantAdapter.kt @@ -5,12 +5,12 @@ import android.view.ViewGroup import androidx.recyclerview.widget.DiffUtil import androidx.recyclerview.widget.ListAdapter import androidx.recyclerview.widget.RecyclerView -import com.hous.hous_aos.data.entity.Homie +import com.hous.data.entity.Homie import com.hous.hous_aos.databinding.ItemHomeParticipantsBinding import com.hous.hous_aos.ui.rules.HomieIconType class EventParticipantAdapter(private val setSelectedEventParticipant: (Int) -> Unit) : - ListAdapter( + ListAdapter( eventParticipantDiffUtil ) { @@ -44,7 +44,7 @@ class EventParticipantAdapter(private val setSelectedEventParticipant: (Int) -> private val setSelectedTmpManager: (Int) -> Unit ) : RecyclerView.ViewHolder(binding.root) { - fun onBind(data: Homie) { + fun onBind(data: com.hous.data.entity.Homie) { binding.data = data binding.homieIconType = homieIconHashMap[data.typeColor] binding.ivManagerIcon.setOnClickListener { @@ -56,12 +56,12 @@ class EventParticipantAdapter(private val setSelectedEventParticipant: (Int) -> } companion object { - private val eventParticipantDiffUtil = object : DiffUtil.ItemCallback() { - override fun areItemsTheSame(oldItem: Homie, newItem: Homie): Boolean { + private val eventParticipantDiffUtil = object : DiffUtil.ItemCallback() { + override fun areItemsTheSame(oldItem: com.hous.data.entity.Homie, newItem: com.hous.data.entity.Homie): Boolean { return oldItem.id == newItem.id } - override fun areContentsTheSame(oldItem: Homie, newItem: Homie): Boolean { + override fun areContentsTheSame(oldItem: com.hous.data.entity.Homie, newItem: com.hous.data.entity.Homie): Boolean { return oldItem == newItem } } diff --git a/app/src/main/java/com/hous/hous_aos/ui/home/adapter/HomieAdapter.kt b/app/src/main/java/com/hous/hous_aos/ui/home/adapter/HomieAdapter.kt index c06ebf12..84ac3eb0 100644 --- a/app/src/main/java/com/hous/hous_aos/ui/home/adapter/HomieAdapter.kt +++ b/app/src/main/java/com/hous/hous_aos/ui/home/adapter/HomieAdapter.kt @@ -1,13 +1,12 @@ package com.hous.hous_aos.ui.home.adapter -import android.util.Log import android.view.LayoutInflater import android.view.ViewGroup import androidx.recyclerview.widget.DiffUtil import androidx.recyclerview.widget.ListAdapter import androidx.recyclerview.widget.RecyclerView import com.hous.hous_aos.R -import com.hous.hous_aos.data.entity.Homie +import com.hous.data.entity.Homie import com.hous.hous_aos.databinding.ItemHomeHomieBinding import com.hous.hous_aos.databinding.ItemHomeHomieCopyBinding @@ -15,7 +14,7 @@ class HomieAdapter( private val showToast: () -> Unit, private val onClickHomie: (Int) -> Unit, ) : - ListAdapter(homieDiffUtil) { + ListAdapter(homieDiffUtil) { private lateinit var itemHomeHomieBinding: ItemHomeHomieBinding private lateinit var itemHomeHomieCopyBinding: ItemHomeHomieCopyBinding @@ -66,7 +65,7 @@ class HomieAdapter( private val onClickHomie: (Int) -> Unit ) : RecyclerView.ViewHolder(binding.root) { - fun onBind(data: Homie) { + fun onBind(data: com.hous.data.entity.Homie) { itemView.setOnClickListener { onClickHomie(absoluteAdapterPosition) } @@ -114,11 +113,11 @@ class HomieAdapter( } companion object { - private val homieDiffUtil = object : DiffUtil.ItemCallback() { - override fun areItemsTheSame(oldItem: Homie, newItem: Homie): Boolean = + private val homieDiffUtil = object : DiffUtil.ItemCallback() { + override fun areItemsTheSame(oldItem: com.hous.data.entity.Homie, newItem: com.hous.data.entity.Homie): Boolean = oldItem.id == newItem.id - override fun areContentsTheSame(oldItem: Homie, newItem: Homie): Boolean = + override fun areContentsTheSame(oldItem: com.hous.data.entity.Homie, newItem: com.hous.data.entity.Homie): Boolean = oldItem == newItem } diff --git a/app/src/main/java/com/hous/hous_aos/ui/home/adapter/ToDoAdapter.kt b/app/src/main/java/com/hous/hous_aos/ui/home/adapter/ToDoAdapter.kt index 233337d7..0c36a741 100644 --- a/app/src/main/java/com/hous/hous_aos/ui/home/adapter/ToDoAdapter.kt +++ b/app/src/main/java/com/hous/hous_aos/ui/home/adapter/ToDoAdapter.kt @@ -5,10 +5,10 @@ import android.view.ViewGroup import androidx.recyclerview.widget.DiffUtil import androidx.recyclerview.widget.ListAdapter import androidx.recyclerview.widget.RecyclerView -import com.hous.hous_aos.data.entity.Rule +import com.hous.data.entity.Rule import com.hous.hous_aos.databinding.ItemHomeToDoBinding -class ToDoAdapter : ListAdapter(toDoDiffUtil) { +class ToDoAdapter : ListAdapter(toDoDiffUtil) { override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ToDoViewHolder { val binding = @@ -22,18 +22,18 @@ class ToDoAdapter : ListAdapter(toDoDiffUtil) class ToDoViewHolder(val binding: ItemHomeToDoBinding) : RecyclerView.ViewHolder(binding.root) { - fun onBind(data: Rule) { + fun onBind(data: com.hous.data.entity.Rule) { binding.cbToDo.isChecked = data.isChecked != false binding.todo = data } } companion object { - private val toDoDiffUtil = object : DiffUtil.ItemCallback() { - override fun areItemsTheSame(oldItem: Rule, newItem: Rule): Boolean = + private val toDoDiffUtil = object : DiffUtil.ItemCallback() { + override fun areItemsTheSame(oldItem: com.hous.data.entity.Rule, newItem: com.hous.data.entity.Rule): Boolean = oldItem.id == newItem.id - override fun areContentsTheSame(oldItem: Rule, newItem: Rule): Boolean = + override fun areContentsTheSame(oldItem: com.hous.data.entity.Rule, newItem: com.hous.data.entity.Rule): Boolean = oldItem == newItem } } diff --git a/app/src/main/java/com/hous/hous_aos/ui/newrules/NewRulesScreen.kt b/app/src/main/java/com/hous/hous_aos/ui/newrules/NewRulesScreen.kt index 51004539..1fd95da9 100644 --- a/app/src/main/java/com/hous/hous_aos/ui/newrules/NewRulesScreen.kt +++ b/app/src/main/java/com/hous/hous_aos/ui/newrules/NewRulesScreen.kt @@ -25,7 +25,7 @@ import androidx.compose.ui.text.font.FontStyle import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp import com.hous.hous_aos.R -import com.hous.hous_aos.data.entity.Homie +import com.hous.data.entity.Homie import com.hous.hous_aos.ui.newrules.component.CategoryItem import com.hous.hous_aos.ui.newrules.component.ManagerItem import com.hous.hous_aos.ui.newrules.component.NewRulesAddMangerButton @@ -177,7 +177,7 @@ fun NewRulesScreen( } fun isAddDay( - homies: List, + homies: List, homieState: HashMap ): Boolean { var temp = false diff --git a/app/src/main/java/com/hous/hous_aos/ui/newrules/NewRulesViewModel.kt b/app/src/main/java/com/hous/hous_aos/ui/newrules/NewRulesViewModel.kt index 283626d7..683cb9c2 100644 --- a/app/src/main/java/com/hous/hous_aos/ui/newrules/NewRulesViewModel.kt +++ b/app/src/main/java/com/hous/hous_aos/ui/newrules/NewRulesViewModel.kt @@ -3,8 +3,8 @@ package com.hous.hous_aos.ui.newrules import android.util.Log import androidx.lifecycle.ViewModel import androidx.lifecycle.viewModelScope -import com.hous.hous_aos.data.entity.Category -import com.hous.hous_aos.data.entity.Homie +import com.hous.data.entity.Category +import com.hous.data.entity.Homie import com.hous.hous_aos.data.repository.NewRulesRepository import com.hous.hous_aos.ui.newrules.component.State import dagger.hilt.android.lifecycle.HiltViewModel @@ -147,7 +147,7 @@ class NewRulesViewModel @Inject constructor( } } - fun choiceManager(managerIndex: Int, homie: Homie) { + fun choiceManager(managerIndex: Int, homie: com.hous.data.entity.Homie) { if (uiState.value.ManagerList[managerIndex].managerHomie.userName != "담당자 없음") _uiState.value.homieState[uiState.value.ManagerList[managerIndex].managerHomie.userName] = true @@ -195,11 +195,15 @@ class NewRulesViewModel @Inject constructor( } } - private fun nextManager(): Homie { - var tempHomie = Homie("", "담당자 없음", typeColor = "NULL") + private fun nextManager(): com.hous.data.entity.Homie { + var tempHomie = com.hous.data.entity.Homie("", "담당자 없음", typeColor = "NULL") for (i in uiState.value.homies) { if (uiState.value.homieState[i.userName]!!) { - tempHomie = Homie(id = i.id, userName = i.userName, typeColor = i.typeColor) + tempHomie = com.hous.data.entity.Homie( + id = i.id, + userName = i.userName, + typeColor = i.typeColor + ) uiState.value.homieState[tempHomie.userName] = false break } @@ -240,20 +244,20 @@ data class NewRulesUiState( val categoryId: String = "", val notificationState: Boolean = false, val checkBoxState: State = State.UNSELECT, - val ruleCategory: List = + val ruleCategory: List = listOf( - Category("1", "청소기"), - Category("2", "분리수거"), - Category("3", "세탁기"), - Category("4", "물 주기"), + com.hous.data.entity.Category("1", "청소기"), + com.hous.data.entity.Category("2", "분리수거"), + com.hous.data.entity.Category("3", "세탁기"), + com.hous.data.entity.Category("4", "물 주기"), ), - val homies: List = + val homies: List = listOf( - Homie("1", "강원용", typeColor = "RED"), - Homie("2", "이영주", typeColor = "BLUE"), - Homie("3", "이준원", typeColor = "YELLOW"), - Homie("4", "최인영", typeColor = "GREEN"), - Homie("5", "최소현", typeColor = "PURPLE"), + com.hous.data.entity.Homie("1", "강원용", typeColor = "RED"), + com.hous.data.entity.Homie("2", "이영주", typeColor = "BLUE"), + com.hous.data.entity.Homie("3", "이준원", typeColor = "YELLOW"), + com.hous.data.entity.Homie("4", "최인영", typeColor = "GREEN"), + com.hous.data.entity.Homie("5", "최소현", typeColor = "PURPLE"), ), val homieState: HashMap = hashMapOf( "강원용" to true, @@ -266,7 +270,10 @@ data class NewRulesUiState( ) data class Manager( - val managerHomie: Homie = Homie(userName = "담당자 없음", typeColor = "NULL"), + val managerHomie: com.hous.data.entity.Homie = com.hous.data.entity.Homie( + userName = "담당자 없음", + typeColor = "NULL" + ), val dayDataList: List = listOf( DayData("월", State.UNSELECT), DayData("화", State.UNSELECT), diff --git a/app/src/main/java/com/hous/hous_aos/ui/newrules/component/CategoryDropDown.kt b/app/src/main/java/com/hous/hous_aos/ui/newrules/component/CategoryDropDown.kt index e3bdcbce..f02e90a7 100644 --- a/app/src/main/java/com/hous/hous_aos/ui/newrules/component/CategoryDropDown.kt +++ b/app/src/main/java/com/hous/hous_aos/ui/newrules/component/CategoryDropDown.kt @@ -17,11 +17,11 @@ import androidx.compose.ui.Modifier import androidx.compose.ui.layout.ContentScale import androidx.compose.ui.res.painterResource import com.hous.hous_aos.R -import com.hous.hous_aos.data.entity.Category +import com.hous.data.entity.Category @Composable fun CategoryDropDownMenu( - ruleCategoryList: List, + ruleCategoryList: List, setCategory: (String, String) -> Unit ) { var isExpanded by remember { mutableStateOf(false) } diff --git a/app/src/main/java/com/hous/hous_aos/ui/newrules/component/CategoryItem.kt b/app/src/main/java/com/hous/hous_aos/ui/newrules/component/CategoryItem.kt index 32698e37..b3583c35 100644 --- a/app/src/main/java/com/hous/hous_aos/ui/newrules/component/CategoryItem.kt +++ b/app/src/main/java/com/hous/hous_aos/ui/newrules/component/CategoryItem.kt @@ -19,13 +19,13 @@ import androidx.compose.ui.text.font.FontStyle import androidx.compose.ui.unit.Dp import androidx.compose.ui.unit.dp import com.hous.hous_aos.R -import com.hous.hous_aos.data.entity.Category +import com.hous.data.entity.Category @Composable fun CategoryItem( radius: Dp, categoryName: String, - ruleCategoryList: List, + ruleCategoryList: List, setCategory: (String, String) -> Unit ) { Box( diff --git a/app/src/main/java/com/hous/hous_aos/ui/newrules/component/ManagerAddButton.kt b/app/src/main/java/com/hous/hous_aos/ui/newrules/component/ManagerAddButton.kt index d37789ee..d8920ffc 100644 --- a/app/src/main/java/com/hous/hous_aos/ui/newrules/component/ManagerAddButton.kt +++ b/app/src/main/java/com/hous/hous_aos/ui/newrules/component/ManagerAddButton.kt @@ -17,12 +17,12 @@ import androidx.compose.ui.res.colorResource import androidx.compose.ui.res.painterResource import androidx.compose.ui.unit.dp import com.hous.hous_aos.R -import com.hous.hous_aos.data.entity.Homie +import com.hous.data.entity.Homie import com.hous.hous_aos.ui.newrules.isAddDay @Composable fun NewRulesAddMangerButton( - homies: List, + homies: List, homieState: HashMap, isShowAddButton: () -> Boolean, addManager: () -> Unit diff --git a/app/src/main/java/com/hous/hous_aos/ui/newrules/component/ManagerBox.kt b/app/src/main/java/com/hous/hous_aos/ui/newrules/component/ManagerBox.kt index 21d2837e..e56d58e3 100644 --- a/app/src/main/java/com/hous/hous_aos/ui/newrules/component/ManagerBox.kt +++ b/app/src/main/java/com/hous/hous_aos/ui/newrules/component/ManagerBox.kt @@ -21,7 +21,7 @@ import androidx.compose.ui.text.font.FontStyle import androidx.compose.ui.unit.Dp import androidx.compose.ui.unit.dp import com.hous.hous_aos.R -import com.hous.hous_aos.data.entity.Homie +import com.hous.data.entity.Homie import com.hous.hous_aos.ui.newrules.Manager @Composable @@ -29,10 +29,10 @@ fun ManagerBox( radius: Dp, managerIndex: Int, manager: Manager, - homies: List, + homies: List, homieState: HashMap, checkBoxState: State, - choiceManager: (Int, Homie) -> Unit + choiceManager: (Int, com.hous.data.entity.Homie) -> Unit ) { Box( modifier = Modifier diff --git a/app/src/main/java/com/hous/hous_aos/ui/newrules/component/ManagerDropDown.kt b/app/src/main/java/com/hous/hous_aos/ui/newrules/component/ManagerDropDown.kt index d2042fc4..ad4e0df4 100644 --- a/app/src/main/java/com/hous/hous_aos/ui/newrules/component/ManagerDropDown.kt +++ b/app/src/main/java/com/hous/hous_aos/ui/newrules/component/ManagerDropDown.kt @@ -30,16 +30,16 @@ import androidx.compose.ui.text.font.FontFamily import androidx.compose.ui.text.font.FontStyle import androidx.compose.ui.unit.dp import com.hous.hous_aos.R -import com.hous.hous_aos.data.entity.Homie +import com.hous.data.entity.Homie import com.hous.hous_aos.ui.newrules.isAddDay @Composable fun ManagerDropDownMenu( managerIndex: Int, - homies: List, + homies: List, homieState: HashMap, checkBoxState: State, - choiceManager: (Int, Homie) -> Unit + choiceManager: (Int, com.hous.data.entity.Homie) -> Unit ) { if (checkBoxState != State.SELECT && isAddDay(homies, homieState)) { var isExpanded by remember { mutableStateOf(false) } diff --git a/app/src/main/java/com/hous/hous_aos/ui/newrules/component/ManagerItem.kt b/app/src/main/java/com/hous/hous_aos/ui/newrules/component/ManagerItem.kt index 7ba300ed..2458e1ba 100644 --- a/app/src/main/java/com/hous/hous_aos/ui/newrules/component/ManagerItem.kt +++ b/app/src/main/java/com/hous/hous_aos/ui/newrules/component/ManagerItem.kt @@ -8,7 +8,7 @@ import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.unit.dp -import com.hous.hous_aos.data.entity.Homie +import com.hous.data.entity.Homie import com.hous.hous_aos.ui.newrules.DayData import com.hous.hous_aos.ui.newrules.Manager @@ -17,11 +17,11 @@ fun ManagerItem( manager: Manager, currentIndex: Int, checkBoxState: State, - homies: List, + homies: List, homieState: HashMap, setCheckBoxState: (String, State) -> Unit, deleteManager: (Int) -> Unit, - choiceManager: (Int, Homie) -> Unit, + choiceManager: (Int, com.hous.data.entity.Homie) -> Unit, selectDay: (Int, DayData) -> Unit ) { Column { diff --git a/app/src/main/java/com/hous/hous_aos/ui/profile/ProfileViewModel.kt b/app/src/main/java/com/hous/hous_aos/ui/profile/ProfileViewModel.kt index d99cddfa..06a70310 100644 --- a/app/src/main/java/com/hous/hous_aos/ui/profile/ProfileViewModel.kt +++ b/app/src/main/java/com/hous/hous_aos/ui/profile/ProfileViewModel.kt @@ -4,17 +4,17 @@ import android.util.Log import androidx.lifecycle.MutableLiveData import androidx.lifecycle.ViewModel import androidx.lifecycle.viewModelScope -import com.hous.hous_aos.data.entity.Homie -import com.hous.hous_aos.data.repository.ProfileRepository +import com.hous.data.entity.Homie +import com.hous.data.repository.ProfileRepository import dagger.hilt.android.lifecycle.HiltViewModel import javax.inject.Inject import kotlinx.coroutines.launch @HiltViewModel class ProfileViewModel @Inject constructor( - private val profileRepository: ProfileRepository + private val profileRepository: com.hous.data.repository.ProfileRepository ) : ViewModel() { - private val _profileData = MutableLiveData() + private val _profileData = MutableLiveData() val profileData get() = _profileData init { diff --git a/app/src/main/java/com/hous/hous_aos/ui/profile/ResultViewModel.kt b/app/src/main/java/com/hous/hous_aos/ui/profile/ResultViewModel.kt index 23d40980..e23d3093 100644 --- a/app/src/main/java/com/hous/hous_aos/ui/profile/ResultViewModel.kt +++ b/app/src/main/java/com/hous/hous_aos/ui/profile/ResultViewModel.kt @@ -4,19 +4,19 @@ import android.util.Log import androidx.lifecycle.MutableLiveData import androidx.lifecycle.ViewModel import androidx.lifecycle.viewModelScope -import com.hous.hous_aos.data.entity.ResultData -import com.hous.hous_aos.data.repository.HomeRepository -import com.hous.hous_aos.data.repository.ProfileRepository +import com.hous.data.entity.ResultData +import com.hous.data.repository.HomeRepository +import com.hous.data.repository.ProfileRepository import dagger.hilt.android.lifecycle.HiltViewModel import kotlinx.coroutines.launch import javax.inject.Inject @HiltViewModel class ResultViewModel @Inject constructor( - private val profileRepository: ProfileRepository, - private val homeRepository: HomeRepository + private val profileRepository: com.hous.data.repository.ProfileRepository, + private val homeRepository: com.hous.data.repository.HomeRepository ) : ViewModel() { - private val _resultData = MutableLiveData() + private val _resultData = MutableLiveData() val resultData get() = _resultData private val _userId = MutableLiveData() diff --git a/app/src/main/java/com/hous/hous_aos/ui/profile/TendencyAdapter.kt b/app/src/main/java/com/hous/hous_aos/ui/profile/TendencyAdapter.kt index 8646bc4b..539e37aa 100644 --- a/app/src/main/java/com/hous/hous_aos/ui/profile/TendencyAdapter.kt +++ b/app/src/main/java/com/hous/hous_aos/ui/profile/TendencyAdapter.kt @@ -8,13 +8,13 @@ import androidx.recyclerview.widget.RecyclerView import com.hous.hous_aos.databinding.ItemTendencyTestBinding class TendencyAdapter( - private val select: (Int, TypeState) -> Unit, + private val select: (Int, com.hous.data.entity.TypeState) -> Unit, private val backPage: () -> Unit, private val nextPage: () -> Unit, private val sendData: () -> Unit, private val showDialog: () -> Unit ) : - ListAdapter(tendencyDiffUtil) { + ListAdapter(tendencyDiffUtil) { override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): TendencyViewHolder { val binding = @@ -28,30 +28,30 @@ class TendencyAdapter( class TendencyViewHolder( private val binding: ItemTendencyTestBinding, - private val select: (Int, TypeState) -> Unit, + private val select: (Int, com.hous.data.entity.TypeState) -> Unit, private val backPage: () -> Unit, private val nextPage: () -> Unit, private val sendData: () -> Unit, private val showDialog: () -> Unit ) : RecyclerView.ViewHolder(binding.root) { - fun onBind(typeTest: TypeTest) { + fun onBind(typeTest: com.hous.data.entity.TypeTest) { with(binding) { data = typeTest tvAnswer1.setOnClickListener { - select(adapterPosition, TypeState.ONE) + select(adapterPosition, com.hous.data.entity.TypeState.ONE) if (typeTest.testNum == 15) { sendData() } } tvAnswer2.setOnClickListener { - select(adapterPosition, TypeState.TWO) + select(adapterPosition, com.hous.data.entity.TypeState.TWO) if (typeTest.testNum == 15) { sendData() } } tvAnswer3.setOnClickListener { - select(adapterPosition, TypeState.THREE) + select(adapterPosition, com.hous.data.entity.TypeState.THREE) if (typeTest.testNum == 15) { sendData() } @@ -60,9 +60,9 @@ class TendencyAdapter( ivLeft.setOnClickListener { backPage() } ivRight.setOnClickListener { nextPage() } - tvAnswer1.isSelected = typeTest.type == TypeState.ONE - tvAnswer2.isSelected = typeTest.type == TypeState.TWO - tvAnswer3.isSelected = typeTest.type == TypeState.THREE + tvAnswer1.isSelected = typeTest.type == com.hous.data.entity.TypeState.ONE + tvAnswer2.isSelected = typeTest.type == com.hous.data.entity.TypeState.TWO + tvAnswer3.isSelected = typeTest.type == com.hous.data.entity.TypeState.THREE tvQuit.setOnClickListener { showDialog() } } @@ -70,11 +70,11 @@ class TendencyAdapter( } companion object { - private val tendencyDiffUtil = object : DiffUtil.ItemCallback() { - override fun areItemsTheSame(oldItem: TypeTest, newItem: TypeTest): Boolean = + private val tendencyDiffUtil = object : DiffUtil.ItemCallback() { + override fun areItemsTheSame(oldItem: com.hous.data.entity.TypeTest, newItem: com.hous.data.entity.TypeTest): Boolean = oldItem.id == newItem.id - override fun areContentsTheSame(oldItem: TypeTest, newItem: TypeTest): Boolean = + override fun areContentsTheSame(oldItem: com.hous.data.entity.TypeTest, newItem: com.hous.data.entity.TypeTest): Boolean = oldItem == newItem } } diff --git a/app/src/main/java/com/hous/hous_aos/ui/profile/TendencyViewModel.kt b/app/src/main/java/com/hous/hous_aos/ui/profile/TendencyViewModel.kt index c6a89b01..21a2ee1a 100644 --- a/app/src/main/java/com/hous/hous_aos/ui/profile/TendencyViewModel.kt +++ b/app/src/main/java/com/hous/hous_aos/ui/profile/TendencyViewModel.kt @@ -5,8 +5,8 @@ import androidx.lifecycle.LiveData import androidx.lifecycle.MutableLiveData import androidx.lifecycle.ViewModel import androidx.lifecycle.viewModelScope -import com.hous.hous_aos.data.model.request.PutTestResultRequest -import com.hous.hous_aos.data.repository.ProfileRepository +import com.hous.data.model.request.PutTestResultRequest +import com.hous.data.repository.ProfileRepository import dagger.hilt.android.lifecycle.HiltViewModel import javax.inject.Inject import kotlinx.coroutines.delay @@ -16,7 +16,7 @@ import kotlinx.coroutines.launch @HiltViewModel class TendencyViewModel @Inject constructor( - private val profileRepository: ProfileRepository + private val profileRepository: com.hous.data.repository.ProfileRepository ) : ViewModel() { private val _move = MutableLiveData() val move: LiveData = _move @@ -29,14 +29,14 @@ class TendencyViewModel @Inject constructor( .onSuccess { Log.d("TendencyViewModel", "success ${it.data!!.typeTests}") val tempList = it.data.typeTests.map { typeTest -> - TypeTest( + com.hous.data.entity.TypeTest( id = typeTest.id, testNum = typeTest.testNum, question = typeTest.question, questionType = typeTest.questionType, answers = typeTest.answers, questionImg = typeTest.questionImg, - type = TypeState.NONE + type = com.hous.data.entity.TypeState.NONE ) } _uiState.value = _uiState.value.copy(typeTests = tempList) @@ -47,11 +47,11 @@ class TendencyViewModel @Inject constructor( } } - fun select(position: Int, state: TypeState) { + fun select(position: Int, state: com.hous.data.entity.TypeState) { viewModelScope.launch { - val tempTest = mutableListOf() + val tempTest = mutableListOf() _uiState.value.typeTests.forEach { tempTest.add(it) } - val tempTypeTest = TypeTest( + val tempTypeTest = com.hous.data.entity.TypeTest( id = _uiState.value.typeTests[position].id, question = _uiState.value.typeTests[position].question, questionType = _uiState.value.typeTests[position].questionType, @@ -78,7 +78,7 @@ class TendencyViewModel @Inject constructor( fun sendData() { viewModelScope.launch { sumScore() - profileRepository.putTestResult(PutTestResultRequest(uiState.value.answerHolder)) + profileRepository.putTestResult(com.hous.data.model.request.PutTestResultRequest(uiState.value.answerHolder)) .onSuccess { Log.d("TendencyViewModel", "result success : ${it.message}") } .onFailure { Log.d("TendencyViewModel", "fail : ${it.message}") } } @@ -92,15 +92,15 @@ class TendencyViewModel @Inject constructor( _uiState.value = _uiState.value.copy(answerHolder = tempAnswer) } - private fun getScore(state: TypeState): Int = when (state) { - TypeState.ONE -> 1 - TypeState.TWO -> 2 - TypeState.THREE -> 3 - TypeState.NONE -> 0 + private fun getScore(state: com.hous.data.entity.TypeState): Int = when (state) { + com.hous.data.entity.TypeState.ONE -> 1 + com.hous.data.entity.TypeState.TWO -> 2 + com.hous.data.entity.TypeState.THREE -> 3 + com.hous.data.entity.TypeState.NONE -> 0 } } data class TestUiState( - val typeTests: List = listOf(), + val typeTests: List = listOf(), val answerHolder: List = listOf(0, 0, 0, 0, 0) ) diff --git a/app/src/main/java/com/hous/hous_aos/ui/rules/HomeRulesCategoryAdapter.kt b/app/src/main/java/com/hous/hous_aos/ui/rules/HomeRulesCategoryAdapter.kt index 7e21d704..d203d51d 100644 --- a/app/src/main/java/com/hous/hous_aos/ui/rules/HomeRulesCategoryAdapter.kt +++ b/app/src/main/java/com/hous/hous_aos/ui/rules/HomeRulesCategoryAdapter.kt @@ -7,7 +7,7 @@ import androidx.recyclerview.widget.DiffUtil import androidx.recyclerview.widget.ListAdapter import androidx.recyclerview.widget.RecyclerView import com.hous.hous_aos.R -import com.hous.hous_aos.data.entity.Category +import com.hous.data.entity.Category import com.hous.hous_aos.databinding.ItemRulesRuleBinding class HomeRulesCategoryAdapter( @@ -16,7 +16,7 @@ class HomeRulesCategoryAdapter( private val onPlusClick: () -> Unit, private val onChangeIsSelected: (Int) -> Unit, ) : - ListAdapter( + ListAdapter( CategoryOfRuleDiffUtilCallback ) { private val iconTypeHashMap: HashMap = hashMapOf( @@ -77,7 +77,7 @@ class HomeRulesCategoryAdapter( private val binding: ItemRulesRuleBinding ) : RecyclerView.ViewHolder(binding.root) { - fun onBind(data: Category) { + fun onBind(data: com.hous.data.entity.Category) { binding.data = data binding.iconType = iconTypeHashMap[data.categoryIcon] /** 앱잼 내에서는 비활성화*/ @@ -98,7 +98,7 @@ class HomeRulesCategoryAdapter( private val binding: ItemRulesRuleBinding ) : RecyclerView.ViewHolder(binding.root) { - fun onBind(data: Category) { + fun onBind(data: com.hous.data.entity.Category) { binding.data = data binding.iconType = CategoryIconType.NONE /** 앱잼 내에서는 비활성화*/ @@ -110,17 +110,17 @@ class HomeRulesCategoryAdapter( companion object { private val CategoryOfRuleDiffUtilCallback = - object : DiffUtil.ItemCallback() { + object : DiffUtil.ItemCallback() { override fun areItemsTheSame( - oldItem: Category, - newItem: Category + oldItem: com.hous.data.entity.Category, + newItem: com.hous.data.entity.Category ): Boolean { return oldItem.id == newItem.id } override fun areContentsTheSame( - oldItem: Category, - newItem: Category + oldItem: com.hous.data.entity.Category, + newItem: com.hous.data.entity.Category ): Boolean { return oldItem == newItem } diff --git a/app/src/main/java/com/hous/hous_aos/ui/rules/RulesViewModel.kt b/app/src/main/java/com/hous/hous_aos/ui/rules/RulesViewModel.kt index 5b681961..94de891d 100644 --- a/app/src/main/java/com/hous/hous_aos/ui/rules/RulesViewModel.kt +++ b/app/src/main/java/com/hous/hous_aos/ui/rules/RulesViewModel.kt @@ -5,19 +5,19 @@ import androidx.lifecycle.LiveData import androidx.lifecycle.MutableLiveData import androidx.lifecycle.ViewModel import androidx.lifecycle.viewModelScope -import com.hous.hous_aos.data.entity.Category -import com.hous.hous_aos.data.entity.Homie -import com.hous.hous_aos.data.entity.Rule -import com.hous.hous_aos.data.model.request.MyToDoCheckRequest -import com.hous.hous_aos.data.model.response.TempManagerRequest -import com.hous.hous_aos.data.repository.RulesTodayRepository +import com.hous.data.entity.Category +import com.hous.data.entity.Homie +import com.hous.data.entity.Rule +import com.hous.data.model.request.MyToDoCheckRequest +import com.hous.data.model.response.TempManagerRequest +import com.hous.data.repository.RulesTodayRepository import dagger.hilt.android.lifecycle.HiltViewModel import kotlinx.coroutines.launch import javax.inject.Inject @HiltViewModel class RulesViewModel @Inject constructor( - private val rulesTodayRepository: RulesTodayRepository + private val rulesTodayRepository: com.hous.data.repository.RulesTodayRepository ) : ViewModel() { private var _toDoViewType = MutableLiveData(ToDoViewType.TODAY_TO_DO) val toDoViewType: LiveData get() = _toDoViewType @@ -26,26 +26,26 @@ class RulesViewModel @Inject constructor( val isSelectedCategorySmile: LiveData get() = _isSelectedCategorySmile private var _categoryOfRuleList = - MutableLiveData>() + MutableLiveData>() val categoryOfRuleList get() = _categoryOfRuleList private var _todayTodoList = - MutableLiveData>() + MutableLiveData>() val todayTodoList get() = _todayTodoList private var _myTodoList = - MutableLiveData>() + MutableLiveData>() val myTodoList get() = _myTodoList private var _keyRulesTableList = - MutableLiveData>() + MutableLiveData>() val keyRulesTableList get() = _keyRulesTableList private var _generalRulesTableList = - MutableLiveData>() + MutableLiveData>() val generalRulesTableList get() = _generalRulesTableList - private var _tmpManagerList = MutableLiveData>() + private var _tmpManagerList = MutableLiveData>() val tmpManagerList get() = _tmpManagerList private var _tmpTodayToDoPosition = MutableLiveData(0) @@ -67,7 +67,7 @@ class RulesViewModel @Inject constructor( _todayTodoList.value = it.data!!.todayTodoRules _categoryOfRuleList.value = it.data.homeRuleCategories _categoryOfRuleList.value = (_categoryOfRuleList.value!!).plus( - Category( + com.hous.data.entity.Category( id = "62d6b94e0e9be86f165d48db", categoryName = "없음", categoryIcon = "CLEAN" @@ -93,7 +93,7 @@ class RulesViewModel @Inject constructor( _tmpManagerList.value?.forEach { if (it.isChecked) clickedTmpManagerList.add(it.id!!) } - val tmp = TempManagerRequest(clickedTmpManagerList) + val tmp = com.hous.data.model.response.TempManagerRequest(clickedTmpManagerList) Log.d( TAG, "Put -- tmp.tmpRuleMembers: ${tmp.tmpRuleMembers} tmp.size : ${tmp.tmpRuleMembers.size}" @@ -185,7 +185,9 @@ class RulesViewModel @Inject constructor( val checked = myTodoList.value!![position].isChecked val id = myTodoList.value!![position].id viewModelScope.launch { - rulesTodayRepository.putMyToDoCheckLust("", id, MyToDoCheckRequest(checked)) + rulesTodayRepository.putMyToDoCheckLust("", id, + com.hous.data.model.request.MyToDoCheckRequest(checked) + ) .onSuccess { Log.d(TAG, "Success - id: $id, checked: $checked ") } diff --git a/app/src/main/java/com/hous/hous_aos/ui/rules/my_to_do/MyToDoAdapter.kt b/app/src/main/java/com/hous/hous_aos/ui/rules/my_to_do/MyToDoAdapter.kt index 846121a2..7c11daca 100644 --- a/app/src/main/java/com/hous/hous_aos/ui/rules/my_to_do/MyToDoAdapter.kt +++ b/app/src/main/java/com/hous/hous_aos/ui/rules/my_to_do/MyToDoAdapter.kt @@ -5,11 +5,11 @@ import android.view.ViewGroup import androidx.recyclerview.widget.DiffUtil import androidx.recyclerview.widget.ListAdapter import androidx.recyclerview.widget.RecyclerView -import com.hous.hous_aos.data.entity.Rule +import com.hous.data.entity.Rule import com.hous.hous_aos.databinding.ItemRulesMyToDoBinding class MyToDoAdapter(private val onClickIcon: (Int) -> Unit) : - ListAdapter( + ListAdapter( MyTodoDiffUtilCallback ) { private val iconTypeHashMap: HashMap = hashMapOf( @@ -28,7 +28,7 @@ class MyToDoAdapter(private val onClickIcon: (Int) -> Unit) : private val iconTypeHashMap: HashMap, private val onClickIcon: (Int) -> Unit ) : RecyclerView.ViewHolder(binding.root) { - fun onBind(data: Rule) { + fun onBind(data: com.hous.data.entity.Rule) { binding.data = data binding.iconType = iconTypeHashMap[data.categoryIcon] binding.clMyToDo.setOnClickListener { @@ -56,18 +56,18 @@ class MyToDoAdapter(private val onClickIcon: (Int) -> Unit) : companion object { private val MyTodoDiffUtilCallback = - object : DiffUtil.ItemCallback() { + object : DiffUtil.ItemCallback() { override fun areItemsTheSame( - oldItem: Rule, - newItem: Rule + oldItem: com.hous.data.entity.Rule, + newItem: com.hous.data.entity.Rule ): Boolean { return oldItem.id == newItem.id } override fun areContentsTheSame( - oldItem: Rule, - newItem: Rule + oldItem: com.hous.data.entity.Rule, + newItem: com.hous.data.entity.Rule ): Boolean { return oldItem == newItem } diff --git a/app/src/main/java/com/hous/hous_aos/ui/rules/rules_table/GeneralRulesAdapter.kt b/app/src/main/java/com/hous/hous_aos/ui/rules/rules_table/GeneralRulesAdapter.kt index a242cad3..a398e259 100644 --- a/app/src/main/java/com/hous/hous_aos/ui/rules/rules_table/GeneralRulesAdapter.kt +++ b/app/src/main/java/com/hous/hous_aos/ui/rules/rules_table/GeneralRulesAdapter.kt @@ -6,12 +6,12 @@ import android.view.ViewGroup import androidx.recyclerview.widget.DiffUtil import androidx.recyclerview.widget.ListAdapter import androidx.recyclerview.widget.RecyclerView -import com.hous.hous_aos.data.entity.Rule +import com.hous.data.entity.Rule import com.hous.hous_aos.databinding.ItemRulesTableGeneralBinding import com.hous.hous_aos.ui.rules.IconColor class GeneralRulesAdapter : - ListAdapter(generalRulesDiffUtil) { + ListAdapter(generalRulesDiffUtil) { private val iconColorHashMap: HashMap = hashMapOf( "RED" to IconColor.RED, @@ -40,7 +40,7 @@ class GeneralRulesAdapter : private val iconColorHashMap: HashMap ) : RecyclerView.ViewHolder(binding.root) { - fun onBind(data: Rule) { + fun onBind(data: com.hous.data.entity.Rule) { binding.data = data val memberCnt = if (data.membersCnt >= 4) 3 else data.membersCnt Log.d( @@ -73,17 +73,17 @@ class GeneralRulesAdapter : } companion object { - private val generalRulesDiffUtil = object : DiffUtil.ItemCallback() { + private val generalRulesDiffUtil = object : DiffUtil.ItemCallback() { override fun areItemsTheSame( - oldItem: Rule, - newItem: Rule + oldItem: com.hous.data.entity.Rule, + newItem: com.hous.data.entity.Rule ): Boolean { return oldItem.id == newItem.id } override fun areContentsTheSame( - oldItem: Rule, - newItem: Rule + oldItem: com.hous.data.entity.Rule, + newItem: com.hous.data.entity.Rule ): Boolean { return oldItem == newItem } diff --git a/app/src/main/java/com/hous/hous_aos/ui/rules/rules_table/KeyRulesAdapter.kt b/app/src/main/java/com/hous/hous_aos/ui/rules/rules_table/KeyRulesAdapter.kt index 6f00a926..de375b74 100644 --- a/app/src/main/java/com/hous/hous_aos/ui/rules/rules_table/KeyRulesAdapter.kt +++ b/app/src/main/java/com/hous/hous_aos/ui/rules/rules_table/KeyRulesAdapter.kt @@ -5,11 +5,11 @@ import android.view.ViewGroup import androidx.recyclerview.widget.DiffUtil import androidx.recyclerview.widget.ListAdapter import androidx.recyclerview.widget.RecyclerView -import com.hous.hous_aos.data.entity.Rule +import com.hous.data.entity.Rule import com.hous.hous_aos.databinding.ItemRulesTableKeysBinding class KeyRulesAdapter : - ListAdapter(rulesTableDiffUtil) { + ListAdapter(rulesTableDiffUtil) { override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): KeyRulesViewHolder { val binding = @@ -24,18 +24,18 @@ class KeyRulesAdapter : class KeyRulesViewHolder(private val binding: ItemRulesTableKeysBinding) : RecyclerView.ViewHolder(binding.root) { - fun onBind(data: Rule) { + fun onBind(data: com.hous.data.entity.Rule) { binding.data = data } } companion object { - private val rulesTableDiffUtil = object : DiffUtil.ItemCallback() { - override fun areItemsTheSame(oldItem: Rule, newItem: Rule): Boolean { + private val rulesTableDiffUtil = object : DiffUtil.ItemCallback() { + override fun areItemsTheSame(oldItem: com.hous.data.entity.Rule, newItem: com.hous.data.entity.Rule): Boolean { return oldItem.id == newItem.id } - override fun areContentsTheSame(oldItem: Rule, newItem: Rule): Boolean { + override fun areContentsTheSame(oldItem: com.hous.data.entity.Rule, newItem: com.hous.data.entity.Rule): Boolean { return oldItem == newItem } } diff --git a/app/src/main/java/com/hous/hous_aos/ui/rules/today_to_do/TodayTodoAdapter.kt b/app/src/main/java/com/hous/hous_aos/ui/rules/today_to_do/TodayTodoAdapter.kt index d5a6d6ff..f227dcce 100644 --- a/app/src/main/java/com/hous/hous_aos/ui/rules/today_to_do/TodayTodoAdapter.kt +++ b/app/src/main/java/com/hous/hous_aos/ui/rules/today_to_do/TodayTodoAdapter.kt @@ -6,8 +6,8 @@ import android.view.ViewGroup import androidx.recyclerview.widget.DiffUtil import androidx.recyclerview.widget.ListAdapter import androidx.recyclerview.widget.RecyclerView -import com.hous.hous_aos.data.entity.Homie -import com.hous.hous_aos.data.entity.Rule +import com.hous.data.entity.Homie +import com.hous.data.entity.Rule import com.hous.hous_aos.databinding.ItemRulesTodayToDoItemMultiBinding import com.hous.hous_aos.databinding.ItemRulesTodayToDoItemNoneBinding import com.hous.hous_aos.databinding.ItemRulesTodayToDoItemOneBinding @@ -18,7 +18,7 @@ class TodayTodoAdapter( private val onClickIcon: () -> Unit, private val fetchToTmpManagerList: (Int) -> Unit ) : - ListAdapter( + ListAdapter( TodayTodoDiffUtilCallback ) { @@ -82,7 +82,7 @@ class TodayTodoAdapter( private val onClickIcon: () -> Unit, private val binding: ItemRulesTodayToDoItemNoneBinding ) : RecyclerView.ViewHolder(binding.root) { - fun onBind(data: Rule) { + fun onBind(data: com.hous.data.entity.Rule) { Log.d(TAG, "NONE : , data: $data") binding.data = data binding.ivManagerEmpty.setOnClickListener { @@ -97,7 +97,7 @@ class TodayTodoAdapter( private val onClickIcon: () -> Unit, private val binding: ItemRulesTodayToDoItemOneBinding ) : RecyclerView.ViewHolder(binding.root) { - fun onBind(data: Rule) { + fun onBind(data: com.hous.data.entity.Rule) { Log.d(TAG, "One : , data: $data") binding.data = data binding.tvManager.text = @@ -110,7 +110,7 @@ class TodayTodoAdapter( } } - private fun changeListToString(managerDataList: List): String { + private fun changeListToString(managerDataList: List): String { val textList = managerDataList.map { it.userName } return textList[0] } @@ -133,7 +133,7 @@ class TodayTodoAdapter( private val onClickIcon: () -> Unit, private val binding: ItemRulesTodayToDoItemMultiBinding ) : RecyclerView.ViewHolder(binding.root) { - fun onBind(data: Rule) { + fun onBind(data: com.hous.data.entity.Rule) { Log.d(TAG, "MULTI : , data: $data") binding.data = data binding.tvManager.text = @@ -168,7 +168,7 @@ class TodayTodoAdapter( } } - private fun changeListToString(managerDataList: List): String { + private fun changeListToString(managerDataList: List): String { val textList = managerDataList.map { it.userName } val sizeOfTextList = textList.size return if (sizeOfTextList in 2..3) { @@ -203,18 +203,18 @@ class TodayTodoAdapter( companion object { private val TodayTodoDiffUtilCallback = - object : DiffUtil.ItemCallback() { + object : DiffUtil.ItemCallback() { override fun areItemsTheSame( - oldItem: Rule, - newItem: Rule + oldItem: com.hous.data.entity.Rule, + newItem: com.hous.data.entity.Rule ): Boolean { return oldItem.id == newItem.id } override fun areContentsTheSame( - oldItem: Rule, - newItem: Rule + oldItem: com.hous.data.entity.Rule, + newItem: com.hous.data.entity.Rule ): Boolean { return oldItem == newItem } diff --git a/app/src/main/java/com/hous/hous_aos/ui/rules/today_to_do/tem_dialog/TempMangerAdapter.kt b/app/src/main/java/com/hous/hous_aos/ui/rules/today_to_do/tem_dialog/TempMangerAdapter.kt index c3443b5e..19701e6a 100644 --- a/app/src/main/java/com/hous/hous_aos/ui/rules/today_to_do/tem_dialog/TempMangerAdapter.kt +++ b/app/src/main/java/com/hous/hous_aos/ui/rules/today_to_do/tem_dialog/TempMangerAdapter.kt @@ -5,12 +5,12 @@ import android.view.ViewGroup import androidx.recyclerview.widget.DiffUtil import androidx.recyclerview.widget.ListAdapter import androidx.recyclerview.widget.RecyclerView -import com.hous.hous_aos.data.entity.Homie +import com.hous.data.entity.Homie import com.hous.hous_aos.databinding.ItemRulesTmpManagersBinding import com.hous.hous_aos.ui.rules.HomieIconType class TempMangerAdapter(private val setSelectedTmpManager: (Int) -> Unit) : - ListAdapter(tempManagerDiffUtil) { + ListAdapter(tempManagerDiffUtil) { private val homieIconHashMap: HashMap = hashMapOf( "RED" to HomieIconType.RED, "BLUE" to HomieIconType.BLUE, @@ -37,7 +37,7 @@ class TempMangerAdapter(private val setSelectedTmpManager: (Int) -> Unit) : private val setSelectedTmpManager: (Int) -> Unit ) : RecyclerView.ViewHolder(binding.root) { - fun onBind(data: Homie) { + fun onBind(data: com.hous.data.entity.Homie) { binding.data = data binding.homieIconType = homieIconHashMap[data.typeColor] binding.ivManagerIcon.setOnClickListener { @@ -48,17 +48,17 @@ class TempMangerAdapter(private val setSelectedTmpManager: (Int) -> Unit) : } companion object { - private val tempManagerDiffUtil = object : DiffUtil.ItemCallback() { + private val tempManagerDiffUtil = object : DiffUtil.ItemCallback() { override fun areItemsTheSame( - oldItem: Homie, - newItem: Homie + oldItem: com.hous.data.entity.Homie, + newItem: com.hous.data.entity.Homie ): Boolean { return oldItem.id == newItem.id } override fun areContentsTheSame( - oldItem: Homie, - newItem: Homie + oldItem: com.hous.data.entity.Homie, + newItem: com.hous.data.entity.Homie ): Boolean { return oldItem == newItem } diff --git a/app/src/main/java/com/hous/hous_aos/util/GetColorSet.kt b/app/src/main/java/com/hous/hous_aos/util/GetColorSet.kt index 56192d37..eaafc202 100644 --- a/app/src/main/java/com/hous/hous_aos/util/GetColorSet.kt +++ b/app/src/main/java/com/hous/hous_aos/util/GetColorSet.kt @@ -1,31 +1,31 @@ package com.hous.hous_aos.util import com.hous.hous_aos.R -import com.hous.hous_aos.data.entity.ColorSet +import com.hous.data.entity.ColorSet -fun String.getColorSet(colorType: String): ColorSet { +fun String.getColorSet(colorType: String): com.hous.data.entity.ColorSet { return when (colorType) { - "PURPLE", "하이레벨 오돌이" -> ColorSet( + "PURPLE", "하이레벨 오돌이" -> com.hous.data.entity.ColorSet( colorBg = R.color.hous_purple_bg, colorBg2 = R.color.hous_purple_bg_2, colorPrimary = R.color.hous_purple ) - "GREEN", "룰 세터 육각이" -> ColorSet( + "GREEN", "룰 세터 육각이" -> com.hous.data.entity.ColorSet( colorBg = R.color.hous_green_bg, colorBg2 = R.color.hous_green_bg_2, colorPrimary = R.color.hous_green ) - "YELLOW", "늘 행복한 동글이" -> ColorSet( + "YELLOW", "늘 행복한 동글이" -> com.hous.data.entity.ColorSet( colorBg = R.color.hous_yellow_bg, colorBg2 = R.color.hous_yellow_bg_2, colorPrimary = R.color.hous_yellow ) - "BLUE", "룸메 맞춤형 네각이" -> ColorSet( + "BLUE", "룸메 맞춤형 네각이" -> com.hous.data.entity.ColorSet( colorBg = R.color.hous_blue_bg, colorBg2 = R.color.hous_blue_bg_2, colorPrimary = R.color.hous_blue ) - else -> ColorSet( + else -> com.hous.data.entity.ColorSet( colorBg = R.color.hous_red_bg, colorBg2 = R.color.hous_red_bg_2, colorPrimary = R.color.hous_red diff --git a/app/src/main/res/layout/item_home_event.xml b/app/src/main/res/layout/item_home_event.xml index c2519847..7c868dc3 100644 --- a/app/src/main/res/layout/item_home_event.xml +++ b/app/src/main/res/layout/item_home_event.xml @@ -9,7 +9,7 @@ + type="com.hous.data.entity.Event" /> + type="com.hous.data.entity.Homie" /> + type="com.hous.data.entity.Homie" /> + type="com.hous.data.entity.Homie" /> + type="com.hous.data.entity.Rule" /> + type="com.hous.data.entity.Rule" /> + type="com.hous.data.entity.Category" /> + type="com.hous.data.entity.Rule" /> + type="com.hous.data.entity.Rule" /> + type="com.hous.data.entity.Homie" /> + type="com.hous.data.entity.Rule" /> + type="com.hous.data.entity.Rule" /> + type="com.hous.data.entity.Rule" /> - + + type="com.hous.data.entity.TypeTest" /> + ): com.hous.data.model.WrapperClass @DELETE("room/{roomId}/event/{eventId}") suspend fun deleteEvent( @Path("roomId") roomId: String, @Path("eventId") eventId: String - ): WrapperClass + ): com.hous.data.model.WrapperClass @GET("room/{roomId}/event/{eventId}") suspend fun getEventList( @Path("roomId") roomId: String, @Path("eventId") eventId: String - ): WrapperClass + ): com.hous.data.model.WrapperClass @PUT("room/{roomId}/event/{eventId}") suspend fun putEventList( @Path("roomId") roomId: String, @Path("eventId") eventId: String, - @Body body: EventListRequest - ): WrapperClass + @Body body: com.hous.data.model.request.EventListRequest + ): com.hous.data.model.WrapperClass @POST("room/{roomId}/event") suspend fun addEvent( @Path("roomId") roomId: String, - @Body body: EventListRequest - ): WrapperClass + @Body body: com.hous.data.model.request.EventListRequest + ): com.hous.data.model.WrapperClass @GET("user/{homieId}") suspend fun getHomieList( @Path("homieId") homieId: String - ): WrapperClass + ): com.hous.data.model.WrapperClass @GET("user/{userId}/type") suspend fun getHomieResult( @Path("userId") userId: String - ): WrapperClass + ): com.hous.data.model.WrapperClass } diff --git a/data/src/main/java/com/hous/data/api/NewRulesApi.kt b/data/src/main/java/com/hous/data/api/NewRulesApi.kt new file mode 100644 index 00000000..b4cf1151 --- /dev/null +++ b/data/src/main/java/com/hous/data/api/NewRulesApi.kt @@ -0,0 +1,22 @@ +package com.hous.data.api + +import com.hous.data.model.WrapperClass +import com.hous.data.model.request.NewRulesRequest +import com.hous.data.model.response.NewRulesListResponse +import retrofit2.http.Body +import retrofit2.http.GET +import retrofit2.http.POST +import retrofit2.http.Path + +interface NewRulesApi { + @POST("room/{roomId}/rule") + suspend fun addNewRule( + @Path("roomId") roomId: String, + @Body newRulesRequest: com.hous.data.model.request.NewRulesRequest + ): com.hous.data.model.WrapperClass + + @GET("room/{roomId}/rule/new") + suspend fun getNewRuleList( + @Path("roomId") roomId: String + ): com.hous.data.model.WrapperClass +} diff --git a/data/src/main/java/com/hous/data/api/ProfileApi.kt b/data/src/main/java/com/hous/data/api/ProfileApi.kt new file mode 100644 index 00000000..4d2e0ea1 --- /dev/null +++ b/data/src/main/java/com/hous/data/api/ProfileApi.kt @@ -0,0 +1,26 @@ +package com.hous.data.api + +import com.hous.data.entity.Homie +import com.hous.data.model.WrapperClass +import com.hous.data.model.request.PutTestResultRequest +import com.hous.data.model.response.TypeTestResponse +import com.hous.data.entity.ResultData +import retrofit2.http.Body +import retrofit2.http.GET +import retrofit2.http.PUT + +interface ProfileApi { + @GET("user/profile") + suspend fun getUserProfile(): com.hous.data.model.WrapperClass + + @PUT("user/type/test") + suspend fun putTestResult( + @Body body: com.hous.data.model.request.PutTestResultRequest + ): com.hous.data.model.WrapperClass + + @GET("type/test") + suspend fun getTypeTestList(): com.hous.data.model.WrapperClass + + @GET("user/me/type") + suspend fun getMyResult(): com.hous.data.model.WrapperClass +} diff --git a/app/src/main/java/com/hous/hous_aos/data/api/RulesApi.kt b/data/src/main/java/com/hous/data/api/RulesApi.kt similarity index 57% rename from app/src/main/java/com/hous/hous_aos/data/api/RulesApi.kt rename to data/src/main/java/com/hous/data/api/RulesApi.kt index d589bf5b..ae041bd4 100644 --- a/app/src/main/java/com/hous/hous_aos/data/api/RulesApi.kt +++ b/data/src/main/java/com/hous/data/api/RulesApi.kt @@ -1,12 +1,5 @@ -package com.hous.hous_aos.data.api +package com.hous.data.api -import com.hous.hous_aos.data.entity.Rule -import com.hous.hous_aos.data.model.WrapperClass -import com.hous.hous_aos.data.model.request.MyToDoCheckRequest -import com.hous.hous_aos.data.model.response.RulesTableResponse -import com.hous.hous_aos.data.model.response.RulesTodayInfoListResponse -import com.hous.hous_aos.data.model.response.TempManagerRequest -import com.hous.hous_aos.data.model.response.TempManagerResponse import retrofit2.http.Body import retrofit2.http.GET import retrofit2.http.PUT @@ -16,36 +9,36 @@ interface RulesApi { @GET("room/{roomId}/rules") suspend fun getTodayTodayInfoList( @Path("roomId") roomId: String - ): WrapperClass + ): com.hous.data.model.WrapperClass @GET("/room/{roomId}/rule/{ruleId}/today") suspend fun getTempManagerInfoList( @Path("roomId") roomId: String, @Path("ruleId") ruleId: String - ): WrapperClass + ): com.hous.data.model.WrapperClass @PUT("/room/{roomId}/rule/{ruleId}/today") suspend fun putTempManagerInfoList( @Path("roomId") roomId: String, @Path("ruleId") ruleId: String, - @Body tmpRuleMembers: TempManagerRequest - ): WrapperClass + @Body tmpRuleMembers: com.hous.data.model.response.TempManagerRequest + ): com.hous.data.model.WrapperClass @GET("/room/{roomId}/rules/me") suspend fun getMyTodoInfoList( @Path("roomId") roomId: String - ): WrapperClass> + ): com.hous.data.model.WrapperClass> @PUT("room/{roomId}/rule/{ruleId}/check") suspend fun putMyToDoCheckList( @Path("roomId") roomId: String, @Path("ruleId") ruleId: String, - @Body isCheck: MyToDoCheckRequest - ): WrapperClass + @Body isCheck: com.hous.data.model.request.MyToDoCheckRequest + ): com.hous.data.model.WrapperClass @GET("/room/{roomId}/category/{categoryId}/rule") suspend fun getRuleTableInfoList( @Path("roomId") roomId: String, @Path("categoryId") categoryId: String, - ): WrapperClass + ): com.hous.data.model.WrapperClass } diff --git a/app/src/main/java/com/hous/hous_aos/data/entity/Category.kt b/data/src/main/java/com/hous/data/entity/Category.kt similarity index 87% rename from app/src/main/java/com/hous/hous_aos/data/entity/Category.kt rename to data/src/main/java/com/hous/data/entity/Category.kt index 453368cb..3a216cba 100644 --- a/app/src/main/java/com/hous/hous_aos/data/entity/Category.kt +++ b/data/src/main/java/com/hous/data/entity/Category.kt @@ -1,4 +1,4 @@ -package com.hous.hous_aos.data.entity +package com.hous.data.entity import com.google.gson.annotations.SerializedName diff --git a/app/src/main/java/com/hous/hous_aos/data/entity/ColorSet.kt b/data/src/main/java/com/hous/data/entity/ColorSet.kt similarity index 81% rename from app/src/main/java/com/hous/hous_aos/data/entity/ColorSet.kt rename to data/src/main/java/com/hous/data/entity/ColorSet.kt index bfd45a9f..db66262c 100644 --- a/app/src/main/java/com/hous/hous_aos/data/entity/ColorSet.kt +++ b/data/src/main/java/com/hous/data/entity/ColorSet.kt @@ -1,4 +1,4 @@ -package com.hous.hous_aos.data.entity +package com.hous.data.entity import androidx.annotation.ColorRes diff --git a/app/src/main/java/com/hous/hous_aos/data/entity/Event.kt b/data/src/main/java/com/hous/data/entity/Event.kt similarity index 90% rename from app/src/main/java/com/hous/hous_aos/data/entity/Event.kt rename to data/src/main/java/com/hous/data/entity/Event.kt index 1b152481..b55ff032 100644 --- a/app/src/main/java/com/hous/hous_aos/data/entity/Event.kt +++ b/data/src/main/java/com/hous/data/entity/Event.kt @@ -1,4 +1,4 @@ -package com.hous.hous_aos.data.entity +package com.hous.data.entity import com.google.gson.annotations.SerializedName diff --git a/app/src/main/java/com/hous/hous_aos/data/entity/Homie.kt b/data/src/main/java/com/hous/data/entity/Homie.kt similarity index 92% rename from app/src/main/java/com/hous/hous_aos/data/entity/Homie.kt rename to data/src/main/java/com/hous/data/entity/Homie.kt index 309b1b11..f315822f 100644 --- a/app/src/main/java/com/hous/hous_aos/data/entity/Homie.kt +++ b/data/src/main/java/com/hous/data/entity/Homie.kt @@ -1,4 +1,4 @@ -package com.hous.hous_aos.data.entity +package com.hous.data.entity import com.google.gson.annotations.SerializedName diff --git a/app/src/main/java/com/hous/hous_aos/data/entity/ResultData.kt b/data/src/main/java/com/hous/data/entity/ResultData.kt similarity index 91% rename from app/src/main/java/com/hous/hous_aos/data/entity/ResultData.kt rename to data/src/main/java/com/hous/data/entity/ResultData.kt index 4f1f0c45..b1b9fcf0 100644 --- a/app/src/main/java/com/hous/hous_aos/data/entity/ResultData.kt +++ b/data/src/main/java/com/hous/data/entity/ResultData.kt @@ -1,4 +1,4 @@ -package com.hous.hous_aos.data.entity +package com.hous.data.entity data class ResultData( val userName: String, diff --git a/app/src/main/java/com/hous/hous_aos/data/entity/Rule.kt b/data/src/main/java/com/hous/data/entity/Rule.kt similarity index 92% rename from app/src/main/java/com/hous/hous_aos/data/entity/Rule.kt rename to data/src/main/java/com/hous/data/entity/Rule.kt index 8f99c2c9..431e58b4 100644 --- a/app/src/main/java/com/hous/hous_aos/data/entity/Rule.kt +++ b/data/src/main/java/com/hous/data/entity/Rule.kt @@ -1,4 +1,4 @@ -package com.hous.hous_aos.data.entity +package com.hous.data.entity import com.google.gson.annotations.SerializedName diff --git a/app/src/main/java/com/hous/hous_aos/data/entity/TypeTest.kt b/data/src/main/java/com/hous/data/entity/TypeTest.kt similarity index 90% rename from app/src/main/java/com/hous/hous_aos/data/entity/TypeTest.kt rename to data/src/main/java/com/hous/data/entity/TypeTest.kt index e34de05e..6f6a2325 100644 --- a/app/src/main/java/com/hous/hous_aos/data/entity/TypeTest.kt +++ b/data/src/main/java/com/hous/data/entity/TypeTest.kt @@ -1,4 +1,4 @@ -package com.hous.hous_aos.ui.profile +package com.hous.data.entity import com.google.gson.annotations.SerializedName diff --git a/app/src/main/java/com/hous/hous_aos/data/model/WrapperClass.kt b/data/src/main/java/com/hous/data/model/WrapperClass.kt similarity index 77% rename from app/src/main/java/com/hous/hous_aos/data/model/WrapperClass.kt rename to data/src/main/java/com/hous/data/model/WrapperClass.kt index 9a4bec67..42361332 100644 --- a/app/src/main/java/com/hous/hous_aos/data/model/WrapperClass.kt +++ b/data/src/main/java/com/hous/data/model/WrapperClass.kt @@ -1,4 +1,4 @@ -package com.hous.hous_aos.data.model +package com.hous.data.model data class WrapperClass( val status: Int, diff --git a/app/src/main/java/com/hous/hous_aos/data/model/request/EventListRequest.kt b/data/src/main/java/com/hous/data/model/request/EventListRequest.kt similarity index 76% rename from app/src/main/java/com/hous/hous_aos/data/model/request/EventListRequest.kt rename to data/src/main/java/com/hous/data/model/request/EventListRequest.kt index 49608045..c1213c30 100644 --- a/app/src/main/java/com/hous/hous_aos/data/model/request/EventListRequest.kt +++ b/data/src/main/java/com/hous/data/model/request/EventListRequest.kt @@ -1,4 +1,4 @@ -package com.hous.hous_aos.data.model.request +package com.hous.data.model.request data class EventListRequest( val eventName: String, diff --git a/app/src/main/java/com/hous/hous_aos/data/model/request/MyToDoCheckRequest.kt b/data/src/main/java/com/hous/data/model/request/MyToDoCheckRequest.kt similarity index 56% rename from app/src/main/java/com/hous/hous_aos/data/model/request/MyToDoCheckRequest.kt rename to data/src/main/java/com/hous/data/model/request/MyToDoCheckRequest.kt index 757a8b85..ecd7eb64 100644 --- a/app/src/main/java/com/hous/hous_aos/data/model/request/MyToDoCheckRequest.kt +++ b/data/src/main/java/com/hous/data/model/request/MyToDoCheckRequest.kt @@ -1,4 +1,4 @@ -package com.hous.hous_aos.data.model.request +package com.hous.data.model.request data class MyToDoCheckRequest( val isCheck: Boolean diff --git a/app/src/main/java/com/hous/hous_aos/data/model/request/NewRulesRequest.kt b/data/src/main/java/com/hous/data/model/request/NewRulesRequest.kt similarity index 86% rename from app/src/main/java/com/hous/hous_aos/data/model/request/NewRulesRequest.kt rename to data/src/main/java/com/hous/data/model/request/NewRulesRequest.kt index f6ae8d78..a48301d7 100644 --- a/app/src/main/java/com/hous/hous_aos/data/model/request/NewRulesRequest.kt +++ b/data/src/main/java/com/hous/data/model/request/NewRulesRequest.kt @@ -1,4 +1,4 @@ -package com.hous.hous_aos.data.model.request +package com.hous.data.model.request data class NewRulesRequest( val notificationState: Boolean = false, diff --git a/app/src/main/java/com/hous/hous_aos/data/model/request/PutTestResultRequest.kt b/data/src/main/java/com/hous/data/model/request/PutTestResultRequest.kt similarity index 59% rename from app/src/main/java/com/hous/hous_aos/data/model/request/PutTestResultRequest.kt rename to data/src/main/java/com/hous/data/model/request/PutTestResultRequest.kt index caefa6eb..dee3395a 100644 --- a/app/src/main/java/com/hous/hous_aos/data/model/request/PutTestResultRequest.kt +++ b/data/src/main/java/com/hous/data/model/request/PutTestResultRequest.kt @@ -1,4 +1,4 @@ -package com.hous.hous_aos.data.model.request +package com.hous.data.model.request data class PutTestResultRequest( val typeScore: List diff --git a/app/src/main/java/com/hous/hous_aos/data/model/response/EventResponse.kt b/data/src/main/java/com/hous/data/model/response/EventResponse.kt similarity index 85% rename from app/src/main/java/com/hous/hous_aos/data/model/response/EventResponse.kt rename to data/src/main/java/com/hous/data/model/response/EventResponse.kt index d68a9ad6..f2d7a582 100644 --- a/app/src/main/java/com/hous/hous_aos/data/model/response/EventResponse.kt +++ b/data/src/main/java/com/hous/data/model/response/EventResponse.kt @@ -1,4 +1,4 @@ -package com.hous.hous_aos.data.model.response +package com.hous.data.model.response import com.google.gson.annotations.SerializedName import com.hous.hous_aos.data.entity.Homie diff --git a/app/src/main/java/com/hous/hous_aos/data/model/response/HomeResponse.kt b/data/src/main/java/com/hous/data/model/response/HomeResponse.kt similarity index 87% rename from app/src/main/java/com/hous/hous_aos/data/model/response/HomeResponse.kt rename to data/src/main/java/com/hous/data/model/response/HomeResponse.kt index 079f646f..03533680 100644 --- a/app/src/main/java/com/hous/hous_aos/data/model/response/HomeResponse.kt +++ b/data/src/main/java/com/hous/data/model/response/HomeResponse.kt @@ -1,4 +1,4 @@ -package com.hous.hous_aos.data.model.response +package com.hous.data.model.response import com.hous.hous_aos.data.entity.Event import com.hous.hous_aos.data.entity.Homie diff --git a/app/src/main/java/com/hous/hous_aos/data/model/response/NewRulesListResponse.kt b/data/src/main/java/com/hous/data/model/response/NewRulesListResponse.kt similarity index 82% rename from app/src/main/java/com/hous/hous_aos/data/model/response/NewRulesListResponse.kt rename to data/src/main/java/com/hous/data/model/response/NewRulesListResponse.kt index 91a7c376..b669111e 100644 --- a/app/src/main/java/com/hous/hous_aos/data/model/response/NewRulesListResponse.kt +++ b/data/src/main/java/com/hous/data/model/response/NewRulesListResponse.kt @@ -1,4 +1,4 @@ -package com.hous.hous_aos.data.model.response +package com.hous.data.model.response import com.hous.hous_aos.data.entity.Category import com.hous.hous_aos.data.entity.Homie diff --git a/app/src/main/java/com/hous/hous_aos/data/model/response/RulesTableResponse.kt b/data/src/main/java/com/hous/data/model/response/RulesTableResponse.kt similarity index 74% rename from app/src/main/java/com/hous/hous_aos/data/model/response/RulesTableResponse.kt rename to data/src/main/java/com/hous/data/model/response/RulesTableResponse.kt index 8032c1ef..dc78b3f3 100644 --- a/app/src/main/java/com/hous/hous_aos/data/model/response/RulesTableResponse.kt +++ b/data/src/main/java/com/hous/data/model/response/RulesTableResponse.kt @@ -1,4 +1,4 @@ -package com.hous.hous_aos.data.model.response +package com.hous.data.model.response import com.hous.hous_aos.data.entity.Rule diff --git a/app/src/main/java/com/hous/hous_aos/data/model/response/RulesTodayInfoListResponse.kt b/data/src/main/java/com/hous/data/model/response/RulesTodayInfoListResponse.kt similarity index 83% rename from app/src/main/java/com/hous/hous_aos/data/model/response/RulesTodayInfoListResponse.kt rename to data/src/main/java/com/hous/data/model/response/RulesTodayInfoListResponse.kt index ff27389d..634a4093 100644 --- a/app/src/main/java/com/hous/hous_aos/data/model/response/RulesTodayInfoListResponse.kt +++ b/data/src/main/java/com/hous/data/model/response/RulesTodayInfoListResponse.kt @@ -1,4 +1,4 @@ -package com.hous.hous_aos.data.model.response +package com.hous.data.model.response import com.hous.hous_aos.data.entity.Category import com.hous.hous_aos.data.entity.Rule diff --git a/app/src/main/java/com/hous/hous_aos/data/model/response/TempManagerRequest.kt b/data/src/main/java/com/hous/data/model/response/TempManagerRequest.kt similarity index 64% rename from app/src/main/java/com/hous/hous_aos/data/model/response/TempManagerRequest.kt rename to data/src/main/java/com/hous/data/model/response/TempManagerRequest.kt index 95704f2f..d88975bd 100644 --- a/app/src/main/java/com/hous/hous_aos/data/model/response/TempManagerRequest.kt +++ b/data/src/main/java/com/hous/data/model/response/TempManagerRequest.kt @@ -1,4 +1,4 @@ -package com.hous.hous_aos.data.model.response +package com.hous.data.model.response data class TempManagerRequest( val tmpRuleMembers: List = emptyList() diff --git a/app/src/main/java/com/hous/hous_aos/data/model/response/TempManagerResponse.kt b/data/src/main/java/com/hous/data/model/response/TempManagerResponse.kt similarity index 82% rename from app/src/main/java/com/hous/hous_aos/data/model/response/TempManagerResponse.kt rename to data/src/main/java/com/hous/data/model/response/TempManagerResponse.kt index 345c1551..271dabc0 100644 --- a/app/src/main/java/com/hous/hous_aos/data/model/response/TempManagerResponse.kt +++ b/data/src/main/java/com/hous/data/model/response/TempManagerResponse.kt @@ -1,4 +1,4 @@ -package com.hous.hous_aos.data.model.response +package com.hous.data.model.response import com.google.gson.annotations.SerializedName import com.hous.hous_aos.data.entity.Homie diff --git a/app/src/main/java/com/hous/hous_aos/data/model/response/TypeTestListResponse.kt b/data/src/main/java/com/hous/data/model/response/TypeTestListResponse.kt similarity index 70% rename from app/src/main/java/com/hous/hous_aos/data/model/response/TypeTestListResponse.kt rename to data/src/main/java/com/hous/data/model/response/TypeTestListResponse.kt index 288bb3c8..d852623a 100644 --- a/app/src/main/java/com/hous/hous_aos/data/model/response/TypeTestListResponse.kt +++ b/data/src/main/java/com/hous/data/model/response/TypeTestListResponse.kt @@ -1,4 +1,4 @@ -package com.hous.hous_aos.data.model.response +package com.hous.data.model.response import com.hous.hous_aos.ui.profile.TypeTest diff --git a/app/src/main/java/com/hous/hous_aos/data/repository/HomeRepository.kt b/data/src/main/java/com/hous/data/repository/HomeRepository.kt similarity index 66% rename from app/src/main/java/com/hous/hous_aos/data/repository/HomeRepository.kt rename to data/src/main/java/com/hous/data/repository/HomeRepository.kt index b9d043eb..8f622ca2 100644 --- a/app/src/main/java/com/hous/hous_aos/data/repository/HomeRepository.kt +++ b/data/src/main/java/com/hous/data/repository/HomeRepository.kt @@ -1,11 +1,11 @@ -package com.hous.hous_aos.data.repository +package com.hous.data.repository -import com.hous.hous_aos.data.entity.Event -import com.hous.hous_aos.data.entity.Homie -import com.hous.hous_aos.data.entity.ResultData -import com.hous.hous_aos.data.model.WrapperClass -import com.hous.hous_aos.data.model.request.EventListRequest -import com.hous.hous_aos.data.model.response.HomeResponse +import com.hous.data.entity.Event +import com.hous.data.entity.Homie +import com.hous.data.entity.ResultData +import com.hous.data.model.WrapperClass +import com.hous.data.model.request.EventListRequest +import com.hous.data.model.response.HomeResponse interface HomeRepository { suspend fun getHomeList(roomId: String): Result> diff --git a/app/src/main/java/com/hous/hous_aos/data/repository/HomeRepositoryImpl.kt b/data/src/main/java/com/hous/data/repository/HomeRepositoryImpl.kt similarity index 74% rename from app/src/main/java/com/hous/hous_aos/data/repository/HomeRepositoryImpl.kt rename to data/src/main/java/com/hous/data/repository/HomeRepositoryImpl.kt index ded9cd34..c1703d2f 100644 --- a/app/src/main/java/com/hous/hous_aos/data/repository/HomeRepositoryImpl.kt +++ b/data/src/main/java/com/hous/data/repository/HomeRepositoryImpl.kt @@ -1,16 +1,15 @@ -package com.hous.hous_aos.data.repository - -import com.hous.hous_aos.data.entity.Event -import com.hous.hous_aos.data.entity.Homie -import com.hous.hous_aos.data.entity.ResultData -import com.hous.hous_aos.data.model.WrapperClass -import com.hous.hous_aos.data.model.request.EventListRequest -import com.hous.hous_aos.data.model.response.HomeResponse -import com.hous.hous_aos.data.source.remote.RemoteHomeDataSource +package com.hous.data.repository + +import com.hous.data.entity.Event +import com.hous.data.entity.Homie +import com.hous.data.entity.ResultData +import com.hous.data.model.WrapperClass +import com.hous.data.model.request.EventListRequest +import com.hous.data.model.response.HomeResponse import javax.inject.Inject class HomeRepositoryImpl @Inject constructor( - private val homeDataSource: RemoteHomeDataSource + private val homeDataSource: com.hous.data.source.remote.RemoteHomeDataSource ) : HomeRepository { override suspend fun getHomeList(roomId: String): Result> { return runCatching { homeDataSource.getHomeList(roomId) } @@ -44,4 +43,4 @@ class HomeRepositoryImpl @Inject constructor( override suspend fun getHomieResult(userId: String): Result> { return runCatching { homeDataSource.getHomieResult(userId) } } -} \ No newline at end of file +} diff --git a/app/src/main/java/com/hous/hous_aos/data/repository/ProfileRepository.kt b/data/src/main/java/com/hous/data/repository/ProfileRepository.kt similarity index 51% rename from app/src/main/java/com/hous/hous_aos/data/repository/ProfileRepository.kt rename to data/src/main/java/com/hous/data/repository/ProfileRepository.kt index 5f767ebb..cd001ed7 100644 --- a/app/src/main/java/com/hous/hous_aos/data/repository/ProfileRepository.kt +++ b/data/src/main/java/com/hous/data/repository/ProfileRepository.kt @@ -1,10 +1,10 @@ -package com.hous.hous_aos.data.repository +package com.hous.data.repository -import com.hous.hous_aos.data.entity.Homie -import com.hous.hous_aos.data.entity.ResultData -import com.hous.hous_aos.data.model.WrapperClass -import com.hous.hous_aos.data.model.request.PutTestResultRequest -import com.hous.hous_aos.data.model.response.TypeTestResponse +import com.hous.data.entity.Homie +import com.hous.data.entity.ResultData +import com.hous.data.model.WrapperClass +import com.hous.data.model.request.PutTestResultRequest +import com.hous.data.model.response.TypeTestResponse interface ProfileRepository { suspend fun getUserProfile(): Result> diff --git a/app/src/main/java/com/hous/hous_aos/data/repository/ProfileRepositoryImpl.kt b/data/src/main/java/com/hous/data/repository/ProfileRepositoryImpl.kt similarity index 61% rename from app/src/main/java/com/hous/hous_aos/data/repository/ProfileRepositoryImpl.kt rename to data/src/main/java/com/hous/data/repository/ProfileRepositoryImpl.kt index 379591e5..17a318b6 100644 --- a/app/src/main/java/com/hous/hous_aos/data/repository/ProfileRepositoryImpl.kt +++ b/data/src/main/java/com/hous/data/repository/ProfileRepositoryImpl.kt @@ -1,15 +1,14 @@ -package com.hous.hous_aos.data.repository +package com.hous.data.repository -import com.hous.hous_aos.data.entity.Homie -import com.hous.hous_aos.data.entity.ResultData -import com.hous.hous_aos.data.model.WrapperClass -import com.hous.hous_aos.data.model.request.PutTestResultRequest -import com.hous.hous_aos.data.model.response.TypeTestResponse -import com.hous.hous_aos.data.source.remote.RemoteProfileDataSource +import com.hous.data.entity.Homie +import com.hous.data.entity.ResultData +import com.hous.data.model.WrapperClass +import com.hous.data.model.request.PutTestResultRequest +import com.hous.data.model.response.TypeTestResponse import javax.inject.Inject class ProfileRepositoryImpl @Inject constructor( - private val profileDataSource: RemoteProfileDataSource + private val profileDataSource: com.hous.data.source.remote.RemoteProfileDataSource ) : ProfileRepository { override suspend fun getUserProfile(): Result> = runCatching { profileDataSource.getUserProfile() } diff --git a/app/src/main/java/com/hous/hous_aos/data/repository/RulesTodayRepository.kt b/data/src/main/java/com/hous/data/repository/RulesTodayRepository.kt similarity index 62% rename from app/src/main/java/com/hous/hous_aos/data/repository/RulesTodayRepository.kt rename to data/src/main/java/com/hous/data/repository/RulesTodayRepository.kt index 45a16318..8b9654fc 100644 --- a/app/src/main/java/com/hous/hous_aos/data/repository/RulesTodayRepository.kt +++ b/data/src/main/java/com/hous/data/repository/RulesTodayRepository.kt @@ -1,12 +1,12 @@ -package com.hous.hous_aos.data.repository +package com.hous.data.repository -import com.hous.hous_aos.data.entity.Rule -import com.hous.hous_aos.data.model.WrapperClass -import com.hous.hous_aos.data.model.request.MyToDoCheckRequest -import com.hous.hous_aos.data.model.response.RulesTableResponse -import com.hous.hous_aos.data.model.response.RulesTodayInfoListResponse -import com.hous.hous_aos.data.model.response.TempManagerRequest -import com.hous.hous_aos.data.model.response.TempManagerResponse +import com.hous.data.entity.Rule +import com.hous.data.model.WrapperClass +import com.hous.data.model.request.MyToDoCheckRequest +import com.hous.data.model.response.RulesTableResponse +import com.hous.data.model.response.RulesTodayInfoListResponse +import com.hous.data.model.response.TempManagerRequest +import com.hous.data.model.response.TempManagerResponse interface RulesTodayRepository { suspend fun getTodayTodayInfoList(roomId: String): Result> @@ -32,6 +32,6 @@ interface RulesTodayRepository { suspend fun getRuleTableInfoList( roomId: String, - categoryId: String, + categoryId: String ): Result> } diff --git a/app/src/main/java/com/hous/hous_aos/data/repository/RulesTodayRepositoryImpl.kt b/data/src/main/java/com/hous/data/repository/RulesTodayRepositoryImpl.kt similarity index 74% rename from app/src/main/java/com/hous/hous_aos/data/repository/RulesTodayRepositoryImpl.kt rename to data/src/main/java/com/hous/data/repository/RulesTodayRepositoryImpl.kt index afdad258..5dea7b3e 100644 --- a/app/src/main/java/com/hous/hous_aos/data/repository/RulesTodayRepositoryImpl.kt +++ b/data/src/main/java/com/hous/data/repository/RulesTodayRepositoryImpl.kt @@ -1,20 +1,18 @@ -package com.hous.hous_aos.data.repository +package com.hous.data.repository -import com.hous.hous_aos.data.entity.Rule -import com.hous.hous_aos.data.model.WrapperClass -import com.hous.hous_aos.data.model.request.MyToDoCheckRequest -import com.hous.hous_aos.data.model.response.RulesTableResponse -import com.hous.hous_aos.data.model.response.RulesTodayInfoListResponse -import com.hous.hous_aos.data.model.response.TempManagerRequest -import com.hous.hous_aos.data.model.response.TempManagerResponse -import com.hous.hous_aos.data.source.remote.RemoteRulesTodayDataSource +import com.hous.data.entity.Rule +import com.hous.data.model.WrapperClass +import com.hous.data.model.request.MyToDoCheckRequest +import com.hous.data.model.response.RulesTableResponse +import com.hous.data.model.response.RulesTodayInfoListResponse +import com.hous.data.model.response.TempManagerRequest +import com.hous.data.model.response.TempManagerResponse import javax.inject.Inject class RulesTodayRepositoryImpl @Inject constructor( - private val remoteRulesTodayDataSource: RemoteRulesTodayDataSource + private val remoteRulesTodayDataSource: com.hous.data.source.remote.RemoteRulesTodayDataSource ) : RulesTodayRepository { override suspend fun getTodayTodayInfoList(roomId: String): Result> { - return runCatching { remoteRulesTodayDataSource.getTodayTodayInfoList(roomId) } } diff --git a/data/src/main/java/com/hous/data/source/local/LocalDataSource.kt b/data/src/main/java/com/hous/data/source/local/LocalDataSource.kt new file mode 100644 index 00000000..7559a836 --- /dev/null +++ b/data/src/main/java/com/hous/data/source/local/LocalDataSource.kt @@ -0,0 +1,3 @@ +package com.hous.data.source.local + +interface LocalDataSource diff --git a/data/src/main/java/com/hous/data/source/local/LocalDataSourceImpl.kt b/data/src/main/java/com/hous/data/source/local/LocalDataSourceImpl.kt new file mode 100644 index 00000000..27b55d21 --- /dev/null +++ b/data/src/main/java/com/hous/data/source/local/LocalDataSourceImpl.kt @@ -0,0 +1,7 @@ +package com.hous.data.source.local + +import javax.inject.Inject + +class LocalDataSourceImpl @Inject constructor( +// @ApplicationContext context: Context +) : LocalDataSource diff --git a/app/src/main/java/com/hous/hous_aos/data/source/remote/RemoteHomeDataSource.kt b/data/src/main/java/com/hous/data/source/remote/RemoteHomeDataSource.kt similarity index 64% rename from app/src/main/java/com/hous/hous_aos/data/source/remote/RemoteHomeDataSource.kt rename to data/src/main/java/com/hous/data/source/remote/RemoteHomeDataSource.kt index 2359b9ea..67fa7b6f 100644 --- a/app/src/main/java/com/hous/hous_aos/data/source/remote/RemoteHomeDataSource.kt +++ b/data/src/main/java/com/hous/data/source/remote/RemoteHomeDataSource.kt @@ -1,11 +1,11 @@ -package com.hous.hous_aos.data.source.remote +package com.hous.data.source.remote -import com.hous.hous_aos.data.entity.Event -import com.hous.hous_aos.data.entity.Homie -import com.hous.hous_aos.data.entity.ResultData -import com.hous.hous_aos.data.model.WrapperClass -import com.hous.hous_aos.data.model.request.EventListRequest -import com.hous.hous_aos.data.model.response.HomeResponse +import com.hous.data.entity.Event +import com.hous.data.entity.Homie +import com.hous.data.entity.ResultData +import com.hous.data.model.WrapperClass +import com.hous.data.model.request.EventListRequest +import com.hous.data.model.response.HomeResponse interface RemoteHomeDataSource { suspend fun getHomeList(roomId: String): WrapperClass @@ -15,6 +15,7 @@ interface RemoteHomeDataSource { eventId: String, body: EventListRequest ): WrapperClass + suspend fun addEvent(roomId: String, body: EventListRequest): WrapperClass suspend fun deleteEvent(roomId: String, eventId: String): WrapperClass suspend fun getHomieList(homieId: String): WrapperClass diff --git a/app/src/main/java/com/hous/hous_aos/data/source/remote/RemoteHomeDataSourceImpl.kt b/data/src/main/java/com/hous/data/source/remote/RemoteHomeDataSourceImpl.kt similarity index 75% rename from app/src/main/java/com/hous/hous_aos/data/source/remote/RemoteHomeDataSourceImpl.kt rename to data/src/main/java/com/hous/data/source/remote/RemoteHomeDataSourceImpl.kt index 1464b4a1..d313cb69 100644 --- a/app/src/main/java/com/hous/hous_aos/data/source/remote/RemoteHomeDataSourceImpl.kt +++ b/data/src/main/java/com/hous/data/source/remote/RemoteHomeDataSourceImpl.kt @@ -1,13 +1,13 @@ -package com.hous.hous_aos.data.source.remote - +package com.hous.data.source.remote + +import com.hous.data.api.HomeApi +import com.hous.data.entity.Event +import com.hous.data.entity.Homie +import com.hous.data.entity.ResultData +import com.hous.data.model.WrapperClass +import com.hous.data.model.request.EventListRequest +import com.hous.data.model.response.HomeResponse import com.hous.hous_aos.BuildConfig -import com.hous.hous_aos.data.api.HomeApi -import com.hous.hous_aos.data.entity.Event -import com.hous.hous_aos.data.entity.Homie -import com.hous.hous_aos.data.entity.ResultData -import com.hous.hous_aos.data.model.WrapperClass -import com.hous.hous_aos.data.model.request.EventListRequest -import com.hous.hous_aos.data.model.response.HomeResponse import javax.inject.Inject class RemoteHomeDataSourceImpl @Inject constructor( diff --git a/data/src/main/java/com/hous/data/source/remote/RemoteNewRulesDataSource.kt b/data/src/main/java/com/hous/data/source/remote/RemoteNewRulesDataSource.kt new file mode 100644 index 00000000..9ace7dac --- /dev/null +++ b/data/src/main/java/com/hous/data/source/remote/RemoteNewRulesDataSource.kt @@ -0,0 +1,10 @@ +package com.hous.data.source.remote + +import com.hous.data.model.WrapperClass +import com.hous.data.model.request.NewRulesRequest +import com.hous.data.model.response.NewRulesListResponse + +interface RemoteNewRulesDataSource { + suspend fun addNewRule(newRulesRequest: NewRulesRequest): WrapperClass + suspend fun getNewRuleList(roomId: String): WrapperClass +} diff --git a/app/src/main/java/com/hous/hous_aos/data/source/remote/RemoteNewRulesDataSourceImpl.kt b/data/src/main/java/com/hous/data/source/remote/RemoteNewRulesDataSourceImpl.kt similarity index 66% rename from app/src/main/java/com/hous/hous_aos/data/source/remote/RemoteNewRulesDataSourceImpl.kt rename to data/src/main/java/com/hous/data/source/remote/RemoteNewRulesDataSourceImpl.kt index 19f27a9b..c0a519be 100644 --- a/app/src/main/java/com/hous/hous_aos/data/source/remote/RemoteNewRulesDataSourceImpl.kt +++ b/data/src/main/java/com/hous/data/source/remote/RemoteNewRulesDataSourceImpl.kt @@ -1,10 +1,10 @@ -package com.hous.hous_aos.data.source.remote +package com.hous.data.source.remote +import com.hous.data.api.NewRulesApi +import com.hous.data.model.WrapperClass +import com.hous.data.model.request.NewRulesRequest +import com.hous.data.model.response.NewRulesListResponse import com.hous.hous_aos.BuildConfig -import com.hous.hous_aos.data.api.NewRulesApi -import com.hous.hous_aos.data.model.WrapperClass -import com.hous.hous_aos.data.model.request.NewRulesRequest -import com.hous.hous_aos.data.model.response.NewRulesListResponse import javax.inject.Inject class RemoteNewRulesDataSourceImpl @Inject constructor( diff --git a/data/src/main/java/com/hous/data/source/remote/RemoteProfileDataSource.kt b/data/src/main/java/com/hous/data/source/remote/RemoteProfileDataSource.kt new file mode 100644 index 00000000..b0195048 --- /dev/null +++ b/data/src/main/java/com/hous/data/source/remote/RemoteProfileDataSource.kt @@ -0,0 +1,14 @@ +package com.hous.data.source.remote + +import com.hous.data.entity.Homie +import com.hous.data.entity.ResultData +import com.hous.data.model.WrapperClass +import com.hous.data.model.request.PutTestResultRequest +import com.hous.data.model.response.TypeTestResponse + +interface RemoteProfileDataSource { + suspend fun getUserProfile(): WrapperClass + suspend fun putTestResult(typeScore: PutTestResultRequest): WrapperClass + suspend fun getTypeTestList(): WrapperClass + suspend fun getMyResult(): WrapperClass +} diff --git a/app/src/main/java/com/hous/hous_aos/data/source/remote/RemoteProfileDataSourceImpl.kt b/data/src/main/java/com/hous/data/source/remote/RemoteProfileDataSourceImpl.kt similarity index 65% rename from app/src/main/java/com/hous/hous_aos/data/source/remote/RemoteProfileDataSourceImpl.kt rename to data/src/main/java/com/hous/data/source/remote/RemoteProfileDataSourceImpl.kt index 499f2063..9d29f5ca 100644 --- a/app/src/main/java/com/hous/hous_aos/data/source/remote/RemoteProfileDataSourceImpl.kt +++ b/data/src/main/java/com/hous/data/source/remote/RemoteProfileDataSourceImpl.kt @@ -1,12 +1,12 @@ -package com.hous.hous_aos.data.source.remote +package com.hous.data.source.remote +import com.hous.data.api.ProfileApi +import com.hous.data.entity.Homie +import com.hous.data.entity.ResultData +import com.hous.data.model.WrapperClass +import com.hous.data.model.request.PutTestResultRequest +import com.hous.data.model.response.TypeTestResponse import com.hous.hous_aos.BuildConfig -import com.hous.hous_aos.data.api.ProfileApi -import com.hous.hous_aos.data.entity.Homie -import com.hous.hous_aos.data.entity.ResultData -import com.hous.hous_aos.data.model.WrapperClass -import com.hous.hous_aos.data.model.request.PutTestResultRequest -import com.hous.hous_aos.data.model.response.TypeTestResponse import javax.inject.Inject class RemoteProfileDataSourceImpl @Inject constructor( diff --git a/app/src/main/java/com/hous/hous_aos/data/source/remote/RemoteRulesTodayDataSource.kt b/data/src/main/java/com/hous/data/source/remote/RemoteRulesTodayDataSource.kt similarity index 60% rename from app/src/main/java/com/hous/hous_aos/data/source/remote/RemoteRulesTodayDataSource.kt rename to data/src/main/java/com/hous/data/source/remote/RemoteRulesTodayDataSource.kt index ef00c13b..c2e95549 100644 --- a/app/src/main/java/com/hous/hous_aos/data/source/remote/RemoteRulesTodayDataSource.kt +++ b/data/src/main/java/com/hous/data/source/remote/RemoteRulesTodayDataSource.kt @@ -1,12 +1,12 @@ -package com.hous.hous_aos.data.source.remote +package com.hous.data.source.remote -import com.hous.hous_aos.data.entity.Rule -import com.hous.hous_aos.data.model.WrapperClass -import com.hous.hous_aos.data.model.request.MyToDoCheckRequest -import com.hous.hous_aos.data.model.response.RulesTableResponse -import com.hous.hous_aos.data.model.response.RulesTodayInfoListResponse -import com.hous.hous_aos.data.model.response.TempManagerRequest -import com.hous.hous_aos.data.model.response.TempManagerResponse +import com.hous.data.entity.Rule +import com.hous.data.model.WrapperClass +import com.hous.data.model.request.MyToDoCheckRequest +import com.hous.data.model.response.RulesTableResponse +import com.hous.data.model.response.RulesTodayInfoListResponse +import com.hous.data.model.response.TempManagerRequest +import com.hous.data.model.response.TempManagerResponse interface RemoteRulesTodayDataSource { suspend fun getTodayTodayInfoList(roomId: String): WrapperClass @@ -32,6 +32,6 @@ interface RemoteRulesTodayDataSource { suspend fun getRuleTableInfoList( roomId: String, - categoryId: String, + categoryId: String ): WrapperClass } diff --git a/app/src/main/java/com/hous/hous_aos/data/source/remote/RemoteRulesTodayDataSourceImpl.kt b/data/src/main/java/com/hous/data/source/remote/RemoteRulesTodayDataSourceImpl.kt similarity index 66% rename from app/src/main/java/com/hous/hous_aos/data/source/remote/RemoteRulesTodayDataSourceImpl.kt rename to data/src/main/java/com/hous/data/source/remote/RemoteRulesTodayDataSourceImpl.kt index b4576a9f..e6c3010d 100644 --- a/app/src/main/java/com/hous/hous_aos/data/source/remote/RemoteRulesTodayDataSourceImpl.kt +++ b/data/src/main/java/com/hous/data/source/remote/RemoteRulesTodayDataSourceImpl.kt @@ -1,14 +1,14 @@ -package com.hous.hous_aos.data.source.remote - +package com.hous.data.source.remote + +import com.hous.data.api.RulesApi +import com.hous.data.entity.Rule +import com.hous.data.model.WrapperClass +import com.hous.data.model.request.MyToDoCheckRequest +import com.hous.data.model.response.RulesTableResponse +import com.hous.data.model.response.RulesTodayInfoListResponse +import com.hous.data.model.response.TempManagerRequest +import com.hous.data.model.response.TempManagerResponse import com.hous.hous_aos.BuildConfig -import com.hous.hous_aos.data.api.RulesApi -import com.hous.hous_aos.data.entity.Rule -import com.hous.hous_aos.data.model.WrapperClass -import com.hous.hous_aos.data.model.request.MyToDoCheckRequest -import com.hous.hous_aos.data.model.response.RulesTableResponse -import com.hous.hous_aos.data.model.response.RulesTodayInfoListResponse -import com.hous.hous_aos.data.model.response.TempManagerRequest -import com.hous.hous_aos.data.model.response.TempManagerResponse import javax.inject.Inject class RemoteRulesTodayDataSourceImpl @Inject constructor( @@ -40,7 +40,11 @@ class RemoteRulesTodayDataSourceImpl @Inject constructor( return rulesApi.getMyTodoInfoList(ROOM_ID) } - override suspend fun putMyToDoCheckLust(roomId: String, ruleId: String, isCheck: MyToDoCheckRequest): WrapperClass { + override suspend fun putMyToDoCheckLust( + roomId: String, + ruleId: String, + isCheck: MyToDoCheckRequest + ): WrapperClass { return rulesApi.putMyToDoCheckList(ROOM_ID, ruleId, isCheck) } From a6c5be0f8705e2905411ff918c49e17e9fb132cc Mon Sep 17 00:00:00 2001 From: KWY0218 Date: Fri, 5 Aug 2022 09:32:36 +0900 Subject: [PATCH 03/11] =?UTF-8?q?#173=20[add]=20buildSrc=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- buildSrc/build.gradle.kts | 8 ++++++++ buildSrc/src/main/java/Constants.kt | 1 + buildSrc/src/main/java/Dependencies.kt | 1 + buildSrc/src/main/java/Versions.kt | 1 + 4 files changed, 11 insertions(+) create mode 100644 buildSrc/build.gradle.kts create mode 100644 buildSrc/src/main/java/Constants.kt create mode 100644 buildSrc/src/main/java/Dependencies.kt create mode 100644 buildSrc/src/main/java/Versions.kt diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts new file mode 100644 index 00000000..02398e3a --- /dev/null +++ b/buildSrc/build.gradle.kts @@ -0,0 +1,8 @@ +plugins { + `kotlin-dsl` +} + +repositories { + google() + mavenCentral() +} diff --git a/buildSrc/src/main/java/Constants.kt b/buildSrc/src/main/java/Constants.kt new file mode 100644 index 00000000..24b6c457 --- /dev/null +++ b/buildSrc/src/main/java/Constants.kt @@ -0,0 +1 @@ +class Constants diff --git a/buildSrc/src/main/java/Dependencies.kt b/buildSrc/src/main/java/Dependencies.kt new file mode 100644 index 00000000..b96ab1b1 --- /dev/null +++ b/buildSrc/src/main/java/Dependencies.kt @@ -0,0 +1 @@ +object Dependencies diff --git a/buildSrc/src/main/java/Versions.kt b/buildSrc/src/main/java/Versions.kt new file mode 100644 index 00000000..888fb963 --- /dev/null +++ b/buildSrc/src/main/java/Versions.kt @@ -0,0 +1 @@ +class Versions From b2d28108c2d8cae1572ffa6c260e08647d106be1 Mon Sep 17 00:00:00 2001 From: KWY0218 Date: Fri, 5 Aug 2022 09:36:38 +0900 Subject: [PATCH 04/11] =?UTF-8?q?#173=20[add]=20dependency,=20=EB=B2=84?= =?UTF-8?q?=EC=A0=84=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- buildSrc/src/main/java/Constants.kt | 9 +++- buildSrc/src/main/java/Dependencies.kt | 67 +++++++++++++++++++++++++- buildSrc/src/main/java/Versions.kt | 32 +++++++++++- 3 files changed, 105 insertions(+), 3 deletions(-) diff --git a/buildSrc/src/main/java/Constants.kt b/buildSrc/src/main/java/Constants.kt index 24b6c457..dd439019 100644 --- a/buildSrc/src/main/java/Constants.kt +++ b/buildSrc/src/main/java/Constants.kt @@ -1 +1,8 @@ -class Constants +object Constants { + const val packageName = "com.hous.hous_aos" + const val compileSdk = 32 + const val minSdk = 26 + const val targetSdk = 32 + const val versionCode = 1 + const val versionName = "1.0" +} diff --git a/buildSrc/src/main/java/Dependencies.kt b/buildSrc/src/main/java/Dependencies.kt index b96ab1b1..4a35c626 100644 --- a/buildSrc/src/main/java/Dependencies.kt +++ b/buildSrc/src/main/java/Dependencies.kt @@ -1 +1,66 @@ -object Dependencies +object KotlinDependencies { + const val kotlin = "org.jetbrains.kotlin:kotlin-stdlib:${Versions.kotlinVersion}" + const val coroutine = + "org.jetbrains.kotlinx:kotlinx-coroutines-android:${Versions.coroutineVersion}" + const val inject = "javax.inject:javax.inject:1" +} + +object AndroidXDependencies { + const val appCompat = "androidx.appcompat:appcompat:${Versions.appCompatVersion}" + const val constraintLayout = + "androidx.constraintlayout:constraintlayout:${Versions.constraintLayoutVersion}" + const val hilt = "com.google.dagger:hilt-android:${Versions.hiltVersion}" + const val recyclerview = "androidx.recyclerview:recyclerview:${Versions.recyclerviewVersion}" + const val composeActivity = + "androidx.activity:activity-compose:${Versions.composeActivityVersion}" + const val composeAnimation = "androidx.compose.animation:animation:${Versions.composeVersion}" + const val composeUi = "androidx.compose.ui:ui-tooling:${Versions.composeVersion}" + const val composeViewModel = + "androidx.lifecycle:lifecycle-viewmodel-compose:${Versions.composeViewModelVersion}" + const val composeTheme = + "com.google.accompanist:accompanist-appcompat-theme:${Versions.composeThemeVersion}" +} + +object KTXDependencies { + const val coreKTX = "androidx.core:core-ktx:${Versions.coreKtxVersion}" + const val activityKTX = "androidx.activity:activity-ktx:${Versions.activityKTXVersion}" + const val lifecycleKTX = + "androidx.lifecycle:lifecycle-runtime-ktx:${Versions.lifecycleKTXVersion}" + const val fragmentKTX = "androidx.fragment:fragment-ktx:${Versions.fragmentKTXVersion}" +} + +object TestDependencies { + const val jUnit = "junit:junit:${Versions.jUnitVersion}" + const val androidTest = "androidx.test.ext:junit:${Versions.androidTestVersion}" + const val espresso = "androidx.test.espresso:espresso-core:${Versions.espressoVersion}" + const val composeTest = "androidx.compose.ui:ui-test-junit4:${Versions.composeVersion}" +} + +object MaterialDependencies { + const val material = "com.google.android.material:material:${Versions.materialVersion}" + const val composeMaterial = "androidx.compose.material:material:${Versions.composeVersion}" + const val composeAdapter = + "com.google.android.material:compose-theme-adapter:${Versions.composeAdapterVersion}" +} + +object KaptDependencies { + const val hiltKapt = "com.google.dagger:hilt-android-compiler:${Versions.hiltVersion}" + const val glideKapt = "com.github.bumptech.glide:compiler:${Versions.glideVersion}" +} + +object ThirdPartyDependencies { + const val coil = "io.coil-kt:coil:${Versions.coilVersion}" + const val interceptor = + "com.squareup.okhttp3:logging-interceptor:${Versions.interceptorVersion}" + const val gson = "com.google.code.gson:gson:${Versions.gsonVersion}" + const val retrofit2 = "com.squareup.retrofit2:retrofit:${Versions.retrofit2Version}" + const val retrofit2Converter = + "com.squareup.retrofit2:converter-gson:${Versions.retrofit2Version}" + const val timber = "com.jakewharton.timber:timber:${Versions.timberVersion}" + const val lottie = "com.airbnb.android:lottie:${Versions.lottieVersion}" + const val glide = "com.github.bumptech.glide:glide:${Versions.glideVersion}" +} + +object ClassPathPlugins { + const val hilt = "com.google.dagger:hilt-android-gradle-plugin:${Versions.hiltVersion}" +} diff --git a/buildSrc/src/main/java/Versions.kt b/buildSrc/src/main/java/Versions.kt index 888fb963..b5b00743 100644 --- a/buildSrc/src/main/java/Versions.kt +++ b/buildSrc/src/main/java/Versions.kt @@ -1 +1,31 @@ -class Versions +object Versions { + const val coreKtxVersion = "1.8.0" + const val appCompatVersion = "1.4.2" + const val materialVersion = "1.6.1" + const val constraintLayoutVersion = "2.1.4" + const val jUnitVersion = "4.13.2" + const val androidTestVersion = "1.1.3" + const val espressoVersion = "3.4.0" + const val coilVersion = "2.1.0" + const val interceptorVersion = "4.10.0" + const val gsonVersion = "2.9.0" + const val timberVersion = "5.0.1" + const val recyclerviewVersion = "1.2.1" + const val coroutineVersion = "1.6.3" + const val hiltVersion = "2.38.1" + const val retrofit2Version = "2.9.0" + const val lottieVersion = "5.2.0" + const val composeActivityVersion = "1.5.1" + const val composeVersion = "1.1.1" + const val composeViewModelVersion = "2.5.0" + const val composeAdapterVersion = "1.1.14" + const val composeThemeVersion = "0.16.0" + const val glideVersion = "4.13.2" + + const val activityKTXVersion = "1.5.1" + const val lifecycleKTXVersion = "2.6.0-alpha01" + const val fragmentKTXVersion = "1.5.0" + + const val gradleVersion = "7.1.1" + const val kotlinVersion = "1.6.10" +} From a389778b9bbeeba75972ff69e45669c987189703 Mon Sep 17 00:00:00 2001 From: KWY0218 Date: Fri, 5 Aug 2022 09:57:45 +0900 Subject: [PATCH 05/11] =?UTF-8?q?#173=20[refact]=20kotlin=20dsl=EB=A1=9C?= =?UTF-8?q?=20=EC=A0=84=ED=99=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/build.gradle | 115 ---------------- app/build.gradle.kts | 127 ++++++++++++++++++ app/proguard-rules.pro | 2 +- .../com/hous/hous_aos/di/RepositoryModule.kt | 10 +- .../hous_aos/ui/newrules/NewRulesScreen.kt | 1 - .../hous_aos/ui/newrules/NewRulesViewModel.kt | 26 ++-- build.gradle | 17 --- build.gradle.kts | 19 +++ data/build.gradle | 40 ------ data/build.gradle.kts | 79 +++++++++++ data/proguard-rules.pro | 2 +- .../model/response/NewRulesListResponse.kt | 4 +- .../data/repository/NewRulesRepository.kt | 4 +- .../data/repository/NewRulesRepositoryImpl.kt | 12 +- settings.gradle => settings.gradle.kts | 4 +- 15 files changed, 253 insertions(+), 209 deletions(-) delete mode 100644 app/build.gradle create mode 100644 app/build.gradle.kts delete mode 100644 build.gradle create mode 100644 build.gradle.kts delete mode 100644 data/build.gradle create mode 100644 data/build.gradle.kts rename {app/src/main/java/com/hous/hous_aos => data/src/main/java/com/hous}/data/repository/NewRulesRepository.kt (70%) rename {app/src/main/java/com/hous/hous_aos => data/src/main/java/com/hous}/data/repository/NewRulesRepositoryImpl.kt (81%) rename settings.gradle => settings.gradle.kts (90%) diff --git a/app/build.gradle b/app/build.gradle deleted file mode 100644 index fadd88fc..00000000 --- a/app/build.gradle +++ /dev/null @@ -1,115 +0,0 @@ -plugins { - id 'com.android.application' - id 'org.jetbrains.kotlin.android' - id 'kotlin-kapt' - id 'dagger.hilt.android.plugin' - id 'kotlin-android' -} -Properties properties = new Properties() -properties.load(project.rootProject.file('local.properties').newDataInputStream()) - -android { - - compileSdk 32 - - lintOptions { - abortOnError false - } - - buildFeatures { - compose true - } - - composeOptions { - kotlinCompilerExtensionVersion '1.1.1' - } - - - buildFeatures { - viewBinding = true - dataBinding = true - } - - defaultConfig { - applicationId "com.hous.hous_aos" - minSdk 26 - targetSdk 32 - versionCode 1 - versionName "1.0" - buildConfigField "String", "HOUS_URL", properties["HOUS_URL"] - buildConfigField "String", "DUMMY_ACCESS_TOKEN", properties["DUMMY_ACCESS_TOKEN"] - buildConfigField "String", "ROOM_ID", properties["ROOM_ID"] - testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" - } - - buildTypes { - release { - minifyEnabled false - proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' - } - } - compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 - } - kotlinOptions { - jvmTarget = '1.8' - } -} - -dependencies { - // lottie - implementation 'com.airbnb.android:lottie:5.2.0' - - // intercepter - implementation 'com.squareup.okhttp3:logging-interceptor:4.10.0' - - // Coil - implementation "io.coil-kt:coil:2.1.0" - // compose - implementation 'androidx.activity:activity-compose:1.5.0' - implementation 'androidx.compose.material:material:1.1.1' - implementation 'androidx.compose.animation:animation:1.1.1' - implementation 'androidx.compose.ui:ui-tooling:1.1.1' - implementation 'androidx.lifecycle:lifecycle-viewmodel-compose:2.5.0' - androidTestImplementation 'androidx.compose.ui:ui-test-junit4:1.1.1' - implementation "com.google.android.material:compose-theme-adapter:1.1.14" - implementation "com.google.accompanist:accompanist-appcompat-theme:0.16.0" - // gson - implementation "com.google.code.gson:gson:2.9.0" - - // Retrofit2 - implementation "com.squareup.retrofit2:retrofit:2.9.0" - implementation "com.squareup.retrofit2:converter-gson:2.9.0" - - // timber - implementation "com.jakewharton.timber:timber:5.0.1" - - // glide - implementation 'com.github.bumptech.glide:glide:4.13.2' - kapt 'com.github.bumptech.glide:compiler:4.13.2' - - // ktx - implementation "androidx.activity:activity-ktx:1.5.0" - implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.6.0-alpha01" - implementation "androidx.lifecycle:lifecycle-livedata-ktx:2.6.0-alpha01" - implementation "androidx.lifecycle:lifecycle-runtime-ktx:2.6.0-alpha01" - implementation "androidx.fragment:fragment-ktx:1.5.0" - - // coroutine - implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.1' - - // hilt - implementation "com.google.dagger:hilt-android:2.40" - kapt "com.google.dagger:hilt-android-compiler:2.40" - - implementation 'androidx.core:core-ktx:1.7.0' - implementation 'androidx.appcompat:appcompat:1.4.2' - implementation 'com.google.android.material:material:1.6.1' - implementation 'androidx.constraintlayout:constraintlayout:2.1.4' - testImplementation 'junit:junit:4.13.2' - androidTestImplementation 'androidx.test.ext:junit:1.1.3' - androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0' - // recycler View - implementation "androidx.recyclerview:recyclerview:1.2.1" -} \ No newline at end of file diff --git a/app/build.gradle.kts b/app/build.gradle.kts new file mode 100644 index 00000000..ef25e63d --- /dev/null +++ b/app/build.gradle.kts @@ -0,0 +1,127 @@ +import org.jetbrains.kotlin.konan.properties.Properties + +plugins { + id("com.android.application") + kotlin("android") + kotlin("kapt") + id("dagger.hilt.android.plugin") + id("org.jlleitschuh.gradle.ktlint") version "10.3.0" +} +val properties = Properties() +properties.load(project.rootProject.file("local.properties").inputStream()) + +android { + compileSdk = Constants.compileSdk + + composeOptions { + kotlinCompilerExtensionVersion = Versions.composeVersion + } + + buildFeatures { + viewBinding = true + dataBinding = true + compose = true + } + + defaultConfig { + applicationId = Constants.packageName + minSdk = Constants.minSdk + targetSdk = Constants.targetSdk + versionCode = Constants.versionCode + versionName = Constants.versionName + buildConfigField("String", "HOUS_URL", properties.getProperty("HOUS_URL")) + buildConfigField( + "String", + "DUMMY_ACCESS_TOKEN", + properties.getProperty("DUMMY_ACCESS_TOKEN") + ) + buildConfigField("String", "ROOM_ID", properties.getProperty("ROOM_ID")) + testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" + } + + buildTypes { + getByName("release") { + isMinifyEnabled = false + proguardFiles( + getDefaultProguardFile("proguard-android-optimize.txt"), + "proguard-rules.pro" + ) + } + } + compileOptions { + sourceCompatibility = JavaVersion.VERSION_1_8 + targetCompatibility = JavaVersion.VERSION_1_8 + } + kotlinOptions { + jvmTarget = "1.8" + } +} + +dependencies { + implementation(project(":data")) + + KotlinDependencies.run { + implementation(kotlin) + implementation(coroutine) + } + + KTXDependencies.run { + implementation(coreKTX) + implementation(activityKTX) + implementation(fragmentKTX) + implementation(lifecycleKTX) + } + + AndroidXDependencies.run { + implementation(appCompat) + implementation(constraintLayout) + implementation(hilt) + implementation(recyclerview) + implementation(composeActivity) + implementation(composeAnimation) + implementation(composeUi) + implementation(composeViewModel) + implementation(composeTheme) + } + + KaptDependencies.run { + kapt(hiltKapt) + kapt(glideKapt) + } + + ThirdPartyDependencies.run { + implementation(coil) + implementation(timber) + implementation(interceptor) + implementation(gson) + implementation(retrofit2) + implementation(retrofit2Converter) + implementation(glide) + implementation(lottie) + } + + MaterialDependencies.run { + implementation(material) + implementation(composeMaterial) + implementation(composeAdapter) + } + + TestDependencies.run { + testImplementation(jUnit) + androidTestImplementation(androidTest) + androidTestImplementation(espresso) + androidTestImplementation(composeTest) + } +} + +ktlint { + android.set(true) + coloredOutput.set(true) + verbose.set(true) + outputToConsole.set(true) + disabledRules.set(setOf("max-line-length", "no-wildcard-imports", "import-ordering")) + reporters { + reporter(org.jlleitschuh.gradle.ktlint.reporter.ReporterType.PLAIN) + reporter(org.jlleitschuh.gradle.ktlint.reporter.ReporterType.CHECKSTYLE) + } +} diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro index 481bb434..ff59496d 100644 --- a/app/proguard-rules.pro +++ b/app/proguard-rules.pro @@ -1,6 +1,6 @@ # Add project specific ProGuard rules here. # You can control the set of applied configuration files using the -# proguardFiles setting in build.gradle. +# proguardFiles setting in build.gradle.kts. # # For more details, see # http://developer.android.com/guide/developing/tools/proguard.html diff --git a/app/src/main/java/com/hous/hous_aos/di/RepositoryModule.kt b/app/src/main/java/com/hous/hous_aos/di/RepositoryModule.kt index 814b49cd..d0766f82 100644 --- a/app/src/main/java/com/hous/hous_aos/di/RepositoryModule.kt +++ b/app/src/main/java/com/hous/hous_aos/di/RepositoryModule.kt @@ -1,13 +1,7 @@ package com.hous.hous_aos.di -import com.hous.data.repository.HomeRepository -import com.hous.data.repository.HomeRepositoryImpl -import com.hous.hous_aos.data.repository.NewRulesRepository -import com.hous.hous_aos.data.repository.NewRulesRepositoryImpl -import com.hous.data.repository.ProfileRepository -import com.hous.data.repository.ProfileRepositoryImpl -import com.hous.data.repository.RulesTodayRepository -import com.hous.data.repository.RulesTodayRepositoryImpl +import com.hous.data.repository.NewRulesRepository +import com.hous.data.repository.NewRulesRepositoryImpl import dagger.Module import dagger.Provides import dagger.hilt.InstallIn diff --git a/app/src/main/java/com/hous/hous_aos/ui/newrules/NewRulesScreen.kt b/app/src/main/java/com/hous/hous_aos/ui/newrules/NewRulesScreen.kt index 1fd95da9..65890157 100644 --- a/app/src/main/java/com/hous/hous_aos/ui/newrules/NewRulesScreen.kt +++ b/app/src/main/java/com/hous/hous_aos/ui/newrules/NewRulesScreen.kt @@ -25,7 +25,6 @@ import androidx.compose.ui.text.font.FontStyle import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp import com.hous.hous_aos.R -import com.hous.data.entity.Homie import com.hous.hous_aos.ui.newrules.component.CategoryItem import com.hous.hous_aos.ui.newrules.component.ManagerItem import com.hous.hous_aos.ui.newrules.component.NewRulesAddMangerButton diff --git a/app/src/main/java/com/hous/hous_aos/ui/newrules/NewRulesViewModel.kt b/app/src/main/java/com/hous/hous_aos/ui/newrules/NewRulesViewModel.kt index 683cb9c2..f991128e 100644 --- a/app/src/main/java/com/hous/hous_aos/ui/newrules/NewRulesViewModel.kt +++ b/app/src/main/java/com/hous/hous_aos/ui/newrules/NewRulesViewModel.kt @@ -3,9 +3,7 @@ package com.hous.hous_aos.ui.newrules import android.util.Log import androidx.lifecycle.ViewModel import androidx.lifecycle.viewModelScope -import com.hous.data.entity.Category -import com.hous.data.entity.Homie -import com.hous.hous_aos.data.repository.NewRulesRepository +import com.hous.data.repository.NewRulesRepository import com.hous.hous_aos.ui.newrules.component.State import dagger.hilt.android.lifecycle.HiltViewModel import javax.inject.Inject @@ -19,7 +17,7 @@ import kotlinx.coroutines.launch @HiltViewModel class NewRulesViewModel @Inject constructor( - private val newRulesRepository: NewRulesRepository, + private val newRulesRepository: NewRulesRepository ) : ViewModel() { private val _uiState = MutableStateFlow(NewRulesUiState()) val uiState = _uiState.asStateFlow() @@ -37,7 +35,7 @@ class NewRulesViewModel @Inject constructor( Log.d("NewRulesViewModel", "getNewRuleList success : ${it.message}") _uiState.value = _uiState.value.copy( ruleCategory = it.data!!.ruleCategories, - homies = it.data.homies + homies = it.data!!.homies ) setUserMapping() } @@ -110,7 +108,7 @@ class NewRulesViewModel @Inject constructor( DayData("목", State.UNSELECT), DayData("금", State.UNSELECT), DayData("토", State.UNSELECT), - DayData("일", State.UNSELECT), + DayData("일", State.UNSELECT) ) ) ) @@ -126,7 +124,7 @@ class NewRulesViewModel @Inject constructor( DayData("목", State.BLOCK), DayData("금", State.BLOCK), DayData("토", State.BLOCK), - DayData("일", State.BLOCK), + DayData("일", State.BLOCK) ) ) ) @@ -148,9 +146,10 @@ class NewRulesViewModel @Inject constructor( } fun choiceManager(managerIndex: Int, homie: com.hous.data.entity.Homie) { - if (uiState.value.ManagerList[managerIndex].managerHomie.userName != "담당자 없음") + if (uiState.value.ManagerList[managerIndex].managerHomie.userName != "담당자 없음") { _uiState.value.homieState[uiState.value.ManagerList[managerIndex].managerHomie.userName] = true + } val tempManager = Manager( managerHomie = homie, dayDataList = uiState.value.ManagerList[managerIndex].dayDataList @@ -227,8 +226,9 @@ class NewRulesViewModel @Inject constructor( uiState.value.ManagerList[0].dayDataList.forEach { dayData -> if (dayData.dayState == State.SELECT) isCheck = false } - if (isCheck && uiState.value.ManagerList[0].managerHomie.userName == "담당자 없음") + if (isCheck && uiState.value.ManagerList[0].managerHomie.userName == "담당자 없음") { setCheckBoxState("changeDayState select", State.UNSELECT) + } } } } @@ -249,7 +249,7 @@ data class NewRulesUiState( com.hous.data.entity.Category("1", "청소기"), com.hous.data.entity.Category("2", "분리수거"), com.hous.data.entity.Category("3", "세탁기"), - com.hous.data.entity.Category("4", "물 주기"), + com.hous.data.entity.Category("4", "물 주기") ), val homies: List = listOf( @@ -257,14 +257,14 @@ data class NewRulesUiState( com.hous.data.entity.Homie("2", "이영주", typeColor = "BLUE"), com.hous.data.entity.Homie("3", "이준원", typeColor = "YELLOW"), com.hous.data.entity.Homie("4", "최인영", typeColor = "GREEN"), - com.hous.data.entity.Homie("5", "최소현", typeColor = "PURPLE"), + com.hous.data.entity.Homie("5", "최소현", typeColor = "PURPLE") ), val homieState: HashMap = hashMapOf( "강원용" to true, "이영주" to true, "이준원" to true, "최인영" to true, - "최소현" to true, + "최소현" to true ), val ManagerList: List = listOf(Manager()) ) @@ -281,7 +281,7 @@ data class Manager( DayData("목", State.UNSELECT), DayData("금", State.UNSELECT), DayData("토", State.UNSELECT), - DayData("일", State.UNSELECT), + DayData("일", State.UNSELECT) ) ) diff --git a/build.gradle b/build.gradle deleted file mode 100644 index 64f6e144..00000000 --- a/build.gradle +++ /dev/null @@ -1,17 +0,0 @@ -// Top-level build file where you can add configuration options common to all sub-projects/modules. -buildscript { - dependencies { - classpath 'com.google.dagger:hilt-android-gradle-plugin:2.42' - classpath "com.android.tools.build:gradle:7.0.0" - } -} - -plugins { - id 'com.android.application' version '7.2.0' apply false - id 'com.android.library' version '7.2.0' apply false - id 'org.jetbrains.kotlin.android' version '1.6.10' apply false -} - -task clean(type: Delete) { - delete rootProject.buildDir -} \ No newline at end of file diff --git a/build.gradle.kts b/build.gradle.kts new file mode 100644 index 00000000..906cb524 --- /dev/null +++ b/build.gradle.kts @@ -0,0 +1,19 @@ +// Top-level build file where you can add configuration options common to all sub-projects/modules. +buildscript { + dependencies { + classpath("com.android.tools.build:gradle:${Versions.gradleVersion}") + classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${Versions.kotlinVersion}") + classpath(ClassPathPlugins.hilt) + } +} + +plugins { + id("com.android.application") version "7.2.0" apply false + id("com.android.library") version "7.2.0" apply false + id("org.jetbrains.kotlin.android") version "1.6.10" apply false + id("org.jetbrains.kotlin.jvm") version "1.6.10" apply false +} + +tasks.register("clean", Delete::class) { + delete(rootProject.buildDir) +} diff --git a/data/build.gradle b/data/build.gradle deleted file mode 100644 index 879afb5d..00000000 --- a/data/build.gradle +++ /dev/null @@ -1,40 +0,0 @@ -plugins { - id 'com.android.library' - id 'org.jetbrains.kotlin.android' -} - -android { - compileSdk 32 - - defaultConfig { - minSdk 26 - targetSdk 32 - - testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" - consumerProguardFiles "consumer-rules.pro" - } - - buildTypes { - release { - minifyEnabled false - proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' - } - } - compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 - } - kotlinOptions { - jvmTarget = '1.8' - } -} - -dependencies { - - implementation 'androidx.core:core-ktx:1.7.0' - implementation 'androidx.appcompat:appcompat:1.4.2' - implementation 'com.google.android.material:material:1.6.1' - testImplementation 'junit:junit:4.13.2' - androidTestImplementation 'androidx.test.ext:junit:1.1.3' - androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0' -} \ No newline at end of file diff --git a/data/build.gradle.kts b/data/build.gradle.kts new file mode 100644 index 00000000..e4a9e1b8 --- /dev/null +++ b/data/build.gradle.kts @@ -0,0 +1,79 @@ +import org.jetbrains.kotlin.konan.properties.Properties + +plugins { + id("com.android.library") + kotlin("android") + kotlin("kapt") + id("org.jlleitschuh.gradle.ktlint") version "10.3.0" +} +val properties = Properties() +properties.load(project.rootProject.file("local.properties").inputStream()) + +android { + compileSdk = Constants.compileSdk + + defaultConfig { + minSdk = Constants.minSdk + targetSdk = Constants.targetSdk + + testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" + consumerProguardFiles("consumer-rules.pro") + buildConfigField("String", "HOUS_URL", properties.getProperty("HOUS_URL")) + buildConfigField( + "String", + "DUMMY_ACCESS_TOKEN", + properties.getProperty("DUMMY_ACCESS_TOKEN") + ) + buildConfigField("String", "ROOM_ID", properties.getProperty("ROOM_ID")) + } + + compileOptions { + sourceCompatibility = JavaVersion.VERSION_1_8 + targetCompatibility = JavaVersion.VERSION_1_8 + } + + kotlinOptions { + jvmTarget = "1.8" + } +} + +dependencies { + + KotlinDependencies.run { + implementation(kotlin) + } + + KTXDependencies.run { + implementation(coreKTX) + } + + AndroidXDependencies.run { + implementation(appCompat) + implementation(constraintLayout) + } + + TestDependencies.run { + implementation(jUnit) + implementation(androidTest) + implementation(espresso) + } + + ThirdPartyDependencies.run { + implementation(interceptor) + implementation(gson) + implementation(retrofit2) + implementation(retrofit2Converter) + } +} + +ktlint { + android.set(true) + coloredOutput.set(true) + verbose.set(true) + outputToConsole.set(true) + disabledRules.set(setOf("max-line-length", "no-wildcard-imports", "import-ordering")) + reporters { + reporter(org.jlleitschuh.gradle.ktlint.reporter.ReporterType.PLAIN) + reporter(org.jlleitschuh.gradle.ktlint.reporter.ReporterType.CHECKSTYLE) + } +} diff --git a/data/proguard-rules.pro b/data/proguard-rules.pro index 481bb434..ff59496d 100644 --- a/data/proguard-rules.pro +++ b/data/proguard-rules.pro @@ -1,6 +1,6 @@ # Add project specific ProGuard rules here. # You can control the set of applied configuration files using the -# proguardFiles setting in build.gradle. +# proguardFiles setting in build.gradle.kts. # # For more details, see # http://developer.android.com/guide/developing/tools/proguard.html diff --git a/data/src/main/java/com/hous/data/model/response/NewRulesListResponse.kt b/data/src/main/java/com/hous/data/model/response/NewRulesListResponse.kt index b669111e..c3f96067 100644 --- a/data/src/main/java/com/hous/data/model/response/NewRulesListResponse.kt +++ b/data/src/main/java/com/hous/data/model/response/NewRulesListResponse.kt @@ -1,7 +1,7 @@ package com.hous.data.model.response -import com.hous.hous_aos.data.entity.Category -import com.hous.hous_aos.data.entity.Homie +import com.hous.data.entity.Category +import com.hous.data.entity.Homie data class NewRulesListResponse( val ruleCategories: List = emptyList(), diff --git a/app/src/main/java/com/hous/hous_aos/data/repository/NewRulesRepository.kt b/data/src/main/java/com/hous/data/repository/NewRulesRepository.kt similarity index 70% rename from app/src/main/java/com/hous/hous_aos/data/repository/NewRulesRepository.kt rename to data/src/main/java/com/hous/data/repository/NewRulesRepository.kt index 212c49a1..ea703a3f 100644 --- a/app/src/main/java/com/hous/hous_aos/data/repository/NewRulesRepository.kt +++ b/data/src/main/java/com/hous/data/repository/NewRulesRepository.kt @@ -1,7 +1,5 @@ -package com.hous.hous_aos.data.repository +package com.hous.data.repository -import com.hous.data.model.WrapperClass -import com.hous.data.model.response.NewRulesListResponse import com.hous.hous_aos.ui.newrules.NewRulesUiState interface NewRulesRepository { diff --git a/app/src/main/java/com/hous/hous_aos/data/repository/NewRulesRepositoryImpl.kt b/data/src/main/java/com/hous/data/repository/NewRulesRepositoryImpl.kt similarity index 81% rename from app/src/main/java/com/hous/hous_aos/data/repository/NewRulesRepositoryImpl.kt rename to data/src/main/java/com/hous/data/repository/NewRulesRepositoryImpl.kt index ee5a4dd9..efb6db8d 100644 --- a/app/src/main/java/com/hous/hous_aos/data/repository/NewRulesRepositoryImpl.kt +++ b/data/src/main/java/com/hous/data/repository/NewRulesRepositoryImpl.kt @@ -1,4 +1,4 @@ -package com.hous.hous_aos.data.repository +package com.hous.data.repository import android.util.Log import com.hous.data.model.WrapperClass @@ -12,17 +12,17 @@ import com.hous.hous_aos.ui.newrules.component.State import javax.inject.Inject class NewRulesRepositoryImpl @Inject constructor( - private val remoteNewRulesDataSource: com.hous.data.source.remote.RemoteNewRulesDataSource + private val remoteNewRulesDataSource: RemoteNewRulesDataSource ) : NewRulesRepository { - override suspend fun addNewRule(newRulesUiState: NewRulesUiState): Result> { + override suspend fun addNewRule(newRulesUiState: NewRulesUiState): Result> { val ruleMember = newRulesUiState.ManagerList.map { val dayList = dayToInt(it.dayDataList) - com.hous.data.model.request.Member( + Member( userId = it.managerHomie.id, day = dayList ) } - val newRulesRequest = com.hous.data.model.request.NewRulesRequest( + val newRulesRequest = NewRulesRequest( notificationState = newRulesUiState.notificationState, ruleName = newRulesUiState.ruleName, categoryId = newRulesUiState.categoryId, @@ -33,7 +33,7 @@ class NewRulesRepositoryImpl @Inject constructor( return runCatching { remoteNewRulesDataSource.addNewRule(newRulesRequest) } } - override suspend fun getNewRuleList(roomId: String): Result> = + override suspend fun getNewRuleList(roomId: String): Result> = runCatching { remoteNewRulesDataSource.getNewRuleList(roomId) } private fun dayToInt(dayDataList: List): List { diff --git a/settings.gradle b/settings.gradle.kts similarity index 90% rename from settings.gradle rename to settings.gradle.kts index 3e237be1..e254bb12 100644 --- a/settings.gradle +++ b/settings.gradle.kts @@ -13,5 +13,5 @@ dependencyResolutionManagement { } } rootProject.name = "Hous-Aos" -include ':app' -include ':data' +include(":app") +include(":data") From c5be7496942091711697e66b3e78dd058ba32bfd Mon Sep 17 00:00:00 2001 From: KWY0218 Date: Fri, 5 Aug 2022 10:13:20 +0900 Subject: [PATCH 06/11] =?UTF-8?q?#173=20[chore]=20=EB=B6=88=ED=95=84?= =?UTF-8?q?=EC=9A=94=ED=95=9C=20import=20=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/hous/hous_aos/di/LocalSourceModule.kt | 2 +- .../com/hous/hous_aos/di/NetworkModule.kt | 14 +++------ .../hous/hous_aos/di/RemoteSourceModule.kt | 25 +++++++++------ .../com/hous/hous_aos/di/RepositoryModule.kt | 19 +++++++----- .../hous_aos/ui/home/EventDialogFragment.kt | 4 +-- .../hous/hous_aos/ui/home/EventViewModel.kt | 16 +++++----- .../com/hous/hous_aos/ui/home/HomeFragment.kt | 7 ++--- .../hous/hous_aos/ui/home/RommateViewModel.kt | 8 ++--- .../hous_aos/ui/home/RoommateCardActivity.kt | 1 - .../hous_aos/ui/home/adapter/EventAdapter.kt | 16 +++++++--- .../home/adapter/EventParticipantAdapter.kt | 27 ++++++++++------ .../hous_aos/ui/home/adapter/HomieAdapter.kt | 16 +++++----- .../hous_aos/ui/home/adapter/ToDoAdapter.kt | 10 +++--- .../ui/newrules/component/CategoryDropDown.kt | 2 +- .../ui/newrules/component/CategoryItem.kt | 2 +- .../ui/newrules/component/ManagerAddButton.kt | 2 +- .../ui/newrules/component/ManagerBox.kt | 4 +-- .../ui/newrules/component/ManagerDropDown.kt | 4 +-- .../ui/newrules/component/ManagerItem.kt | 4 +-- .../hous_aos/ui/profile/ProfileViewModel.kt | 4 +-- .../hous_aos/ui/profile/ResultViewModel.kt | 12 +++---- .../hous_aos/ui/profile/TendencyViewModel.kt | 5 ++- .../ui/rules/HomeRulesCategoryAdapter.kt | 10 +++--- .../hous/hous_aos/ui/rules/RulesFragment.kt | 2 +- .../hous/hous_aos/ui/rules/RulesViewModel.kt | 31 ++++++++++--------- .../ui/rules/my_to_do/MyToDoAdapter.kt | 15 +++++---- .../rules/rules_table/GeneralRulesAdapter.kt | 16 +++++----- .../ui/rules/rules_table/KeyRulesAdapter.kt | 10 +++--- .../ui/rules/today_to_do/TodayTodoAdapter.kt | 13 ++++---- .../tem_dialog/TempManagerDialogFragment.kt | 1 - .../tem_dialog/TempMangerAdapter.kt | 14 ++++----- .../com/hous/hous_aos/util/GetColorSet.kt | 14 ++++----- .../hous/data/model/response/EventResponse.kt | 2 +- .../hous/data/model/response/HomeResponse.kt | 6 ++-- .../data/model/response/RulesTableResponse.kt | 2 +- .../response/RulesTodayInfoListResponse.kt | 6 ++-- .../model/response/TempManagerResponse.kt | 2 +- .../model/response/TypeTestListResponse.kt | 2 +- 38 files changed, 181 insertions(+), 169 deletions(-) diff --git a/app/src/main/java/com/hous/hous_aos/di/LocalSourceModule.kt b/app/src/main/java/com/hous/hous_aos/di/LocalSourceModule.kt index fee8e550..95a68a6d 100644 --- a/app/src/main/java/com/hous/hous_aos/di/LocalSourceModule.kt +++ b/app/src/main/java/com/hous/hous_aos/di/LocalSourceModule.kt @@ -13,5 +13,5 @@ import javax.inject.Singleton object LocalSourceModule { @Singleton @Provides - fun providesLocalDataSource(impl: com.hous.data.source.local.LocalDataSourceImpl): com.hous.data.source.local.LocalDataSource = impl + fun providesLocalDataSource(impl: LocalDataSourceImpl): LocalDataSource = impl } diff --git a/app/src/main/java/com/hous/hous_aos/di/NetworkModule.kt b/app/src/main/java/com/hous/hous_aos/di/NetworkModule.kt index 9349aa54..fb9565af 100644 --- a/app/src/main/java/com/hous/hous_aos/di/NetworkModule.kt +++ b/app/src/main/java/com/hous/hous_aos/di/NetworkModule.kt @@ -1,23 +1,19 @@ package com.hous.hous_aos.di import com.google.gson.GsonBuilder -import com.hous.hous_aos.BuildConfig -import com.hous.data.api.HomeApi -import com.hous.data.api.NewRulesApi -import com.hous.data.api.ProfileApi -import com.hous.data.api.RulesApi import com.hous.data.source.local.LocalDataSource +import com.hous.hous_aos.BuildConfig import dagger.Module import dagger.Provides import dagger.hilt.InstallIn import dagger.hilt.components.SingletonComponent +import java.util.concurrent.TimeUnit +import javax.inject.Singleton import okhttp3.Interceptor import okhttp3.OkHttpClient import okhttp3.logging.HttpLoggingInterceptor import retrofit2.Retrofit import retrofit2.converter.gson.GsonConverterFactory -import java.util.concurrent.TimeUnit -import javax.inject.Singleton @Module @InstallIn(SingletonComponent::class) @@ -28,7 +24,7 @@ object NetworkModule { @Provides @Singleton fun providesHousInterceptor( - localDataSource: com.hous.data.source.local.LocalDataSource + localDataSource: LocalDataSource ): Interceptor = Interceptor { chain -> with(chain) { @@ -48,7 +44,7 @@ object NetworkModule { @Provides @Singleton fun providesHousOkHttpClient( - interceptor: Interceptor, + interceptor: Interceptor ): OkHttpClient = OkHttpClient.Builder() .connectTimeout(15, TimeUnit.SECONDS) diff --git a/app/src/main/java/com/hous/hous_aos/di/RemoteSourceModule.kt b/app/src/main/java/com/hous/hous_aos/di/RemoteSourceModule.kt index 5deea800..ed69d3c5 100644 --- a/app/src/main/java/com/hous/hous_aos/di/RemoteSourceModule.kt +++ b/app/src/main/java/com/hous/hous_aos/di/RemoteSourceModule.kt @@ -1,6 +1,13 @@ package com.hous.hous_aos.di -import com.hous.hous_aos.data.source.remote.* +import com.hous.data.source.remote.RemoteHomeDataSource +import com.hous.data.source.remote.RemoteHomeDataSourceImpl +import com.hous.data.source.remote.RemoteNewRulesDataSource +import com.hous.data.source.remote.RemoteNewRulesDataSourceImpl +import com.hous.data.source.remote.RemoteProfileDataSource +import com.hous.data.source.remote.RemoteProfileDataSourceImpl +import com.hous.data.source.remote.RemoteRulesTodayDataSource +import com.hous.data.source.remote.RemoteRulesTodayDataSourceImpl import dagger.Module import dagger.Provides import dagger.hilt.InstallIn @@ -13,24 +20,24 @@ object RemoteSourceModule { @Provides @Singleton fun providesRemoteHomeSource( - impl: com.hous.data.source.remote.RemoteHomeDataSourceImpl - ): com.hous.data.source.remote.RemoteHomeDataSource = impl + impl: RemoteHomeDataSourceImpl + ): RemoteHomeDataSource = impl @Provides @Singleton fun providesRemoteRulesSource( - impl: com.hous.data.source.remote.RemoteRulesTodayDataSourceImpl - ): com.hous.data.source.remote.RemoteRulesTodayDataSource = impl + impl: RemoteRulesTodayDataSourceImpl + ): RemoteRulesTodayDataSource = impl @Provides @Singleton fun providesRemoteProfileSource( - impl: com.hous.data.source.remote.RemoteProfileDataSourceImpl - ): com.hous.data.source.remote.RemoteProfileDataSource = impl + impl: RemoteProfileDataSourceImpl + ): RemoteProfileDataSource = impl @Provides @Singleton fun providesRemoteNewRulesSource( - impl: com.hous.data.source.remote.RemoteNewRulesDataSourceImpl - ): com.hous.data.source.remote.RemoteNewRulesDataSource = impl + impl: RemoteNewRulesDataSourceImpl + ): RemoteNewRulesDataSource = impl } diff --git a/app/src/main/java/com/hous/hous_aos/di/RepositoryModule.kt b/app/src/main/java/com/hous/hous_aos/di/RepositoryModule.kt index d0766f82..11378a7e 100644 --- a/app/src/main/java/com/hous/hous_aos/di/RepositoryModule.kt +++ b/app/src/main/java/com/hous/hous_aos/di/RepositoryModule.kt @@ -1,7 +1,13 @@ package com.hous.hous_aos.di +import com.hous.data.repository.HomeRepository +import com.hous.data.repository.HomeRepositoryImpl import com.hous.data.repository.NewRulesRepository import com.hous.data.repository.NewRulesRepositoryImpl +import com.hous.data.repository.ProfileRepository +import com.hous.data.repository.ProfileRepositoryImpl +import com.hous.data.repository.RulesTodayRepository +import com.hous.data.repository.RulesTodayRepositoryImpl import dagger.Module import dagger.Provides import dagger.hilt.InstallIn @@ -20,19 +26,18 @@ object RepositoryModule { @Provides @Singleton fun providesRulesTodayRepository( - impl: com.hous.data.repository.RulesTodayRepositoryImpl - ): com.hous.data.repository.RulesTodayRepository = impl + impl: RulesTodayRepositoryImpl + ): RulesTodayRepository = impl @Provides @Singleton fun providesProfileRepository( - impl: com.hous.data.repository.ProfileRepositoryImpl - ): com.hous.data.repository.ProfileRepository = impl + impl: ProfileRepositoryImpl + ): ProfileRepository = impl @Provides @Singleton fun providesHomeRepository( - impl: com.hous.data.repository.HomeRepositoryImpl - ): com.hous.data.repository.HomeRepository = impl - + impl: HomeRepositoryImpl + ): HomeRepository = impl } diff --git a/app/src/main/java/com/hous/hous_aos/ui/home/EventDialogFragment.kt b/app/src/main/java/com/hous/hous_aos/ui/home/EventDialogFragment.kt index f5f25150..9b03d52a 100644 --- a/app/src/main/java/com/hous/hous_aos/ui/home/EventDialogFragment.kt +++ b/app/src/main/java/com/hous/hous_aos/ui/home/EventDialogFragment.kt @@ -2,12 +2,10 @@ package com.hous.hous_aos.ui.home import android.app.DatePickerDialog import android.os.Bundle -import android.text.TextUtils.substring import android.util.Log import android.view.LayoutInflater import android.view.View import android.view.ViewGroup -import androidx.core.content.ContentProviderCompat.requireContext import androidx.core.content.ContextCompat import androidx.databinding.DataBindingUtil import androidx.fragment.app.DialogFragment @@ -15,7 +13,7 @@ import androidx.fragment.app.activityViewModels import com.hous.hous_aos.R import com.hous.hous_aos.databinding.FragmentEventDialogBinding import com.hous.hous_aos.ui.home.adapter.EventParticipantAdapter -import java.util.* +import java.util.Calendar class EventDialogFragment : DialogFragment() { diff --git a/app/src/main/java/com/hous/hous_aos/ui/home/EventViewModel.kt b/app/src/main/java/com/hous/hous_aos/ui/home/EventViewModel.kt index 0750cb8f..0ecc53bd 100644 --- a/app/src/main/java/com/hous/hous_aos/ui/home/EventViewModel.kt +++ b/app/src/main/java/com/hous/hous_aos/ui/home/EventViewModel.kt @@ -4,16 +4,11 @@ import android.util.Log import androidx.lifecycle.MutableLiveData import androidx.lifecycle.ViewModel import androidx.lifecycle.viewModelScope -import com.hous.data.entity.Event -import com.hous.data.entity.Homie -import com.hous.data.entity.Rule -import com.hous.data.model.request.EventListRequest -import com.hous.data.repository.HomeRepository import dagger.hilt.android.lifecycle.HiltViewModel -import kotlinx.coroutines.launch import java.time.LocalDateTime import java.time.format.DateTimeFormatter import javax.inject.Inject +import kotlinx.coroutines.launch @HiltViewModel class EventViewModel @Inject constructor( @@ -54,9 +49,11 @@ class EventViewModel @Inject constructor( * Event 조회 * 리사이클러뷰에 postion 받아오기*/ fun getEventDetail(position: Int) { - viewModelScope.launch { - Log.d(TAG, " position: $position , evenList.value: ${eventList.value}") + Log.d( + TAG, + " position: $position , evenList.value: ${eventList.value}" + ) _eventIconPosition.value = position _tmpEventId.value = eventList.value!![position].id homeRepository.getEventList("", tmpEventId.value!!) @@ -139,7 +136,8 @@ class EventViewModel @Inject constructor( } viewModelScope.launch { homeRepository.putEventList( - "", _tmpEventId.value!!, + "", + _tmpEventId.value!!, com.hous.data.model.request.EventListRequest( eventName = eventName.value!!, date = eventDate.value!!, diff --git a/app/src/main/java/com/hous/hous_aos/ui/home/HomeFragment.kt b/app/src/main/java/com/hous/hous_aos/ui/home/HomeFragment.kt index a0038a54..59f52621 100644 --- a/app/src/main/java/com/hous/hous_aos/ui/home/HomeFragment.kt +++ b/app/src/main/java/com/hous/hous_aos/ui/home/HomeFragment.kt @@ -2,7 +2,6 @@ package com.hous.hous_aos.ui.home import android.content.Intent import android.os.Bundle -import android.util.Log import android.view.LayoutInflater import android.view.View import android.view.ViewGroup @@ -85,8 +84,7 @@ class HomeFragment : Fragment() { if (it.isEmpty()) { binding.tvRulesEmpty.visibility = View.VISIBLE binding.rvRules.visibility = View.INVISIBLE - } - else { + } else { binding.tvRulesEmpty.visibility = View.INVISIBLE binding.rvRules.visibility = View.VISIBLE } @@ -103,8 +101,7 @@ class HomeFragment : Fragment() { if (it.isEmpty()) { binding.tvToDoEmpty.visibility = View.VISIBLE binding.rvToDo.visibility = View.INVISIBLE - } - else { + } else { binding.tvToDoEmpty.visibility = View.INVISIBLE binding.rvToDo.visibility = View.VISIBLE } diff --git a/app/src/main/java/com/hous/hous_aos/ui/home/RommateViewModel.kt b/app/src/main/java/com/hous/hous_aos/ui/home/RommateViewModel.kt index 761b241f..756f47b7 100644 --- a/app/src/main/java/com/hous/hous_aos/ui/home/RommateViewModel.kt +++ b/app/src/main/java/com/hous/hous_aos/ui/home/RommateViewModel.kt @@ -7,15 +7,15 @@ import androidx.lifecycle.viewModelScope import com.hous.data.entity.Homie import com.hous.data.repository.HomeRepository import dagger.hilt.android.lifecycle.HiltViewModel -import kotlinx.coroutines.launch import javax.inject.Inject +import kotlinx.coroutines.launch @HiltViewModel class RommateViewModel @Inject constructor( - private val homeRepository: com.hous.data.repository.HomeRepository + private val homeRepository: HomeRepository ) : ViewModel() { - private val _homieData = MutableLiveData( - com.hous.data.entity.Homie( + private val _homieData = MutableLiveData( + Homie( typeScore = listOf(3, 3, 3, 3, 3) ) ) diff --git a/app/src/main/java/com/hous/hous_aos/ui/home/RoommateCardActivity.kt b/app/src/main/java/com/hous/hous_aos/ui/home/RoommateCardActivity.kt index 952c9e73..4740cd23 100644 --- a/app/src/main/java/com/hous/hous_aos/ui/home/RoommateCardActivity.kt +++ b/app/src/main/java/com/hous/hous_aos/ui/home/RoommateCardActivity.kt @@ -2,7 +2,6 @@ package com.hous.hous_aos.ui.home import android.content.Intent import android.os.Bundle -import android.util.Log import android.view.View import androidx.activity.viewModels import androidx.appcompat.app.AppCompatActivity diff --git a/app/src/main/java/com/hous/hous_aos/ui/home/adapter/EventAdapter.kt b/app/src/main/java/com/hous/hous_aos/ui/home/adapter/EventAdapter.kt index 64efe6ae..a055ad05 100644 --- a/app/src/main/java/com/hous/hous_aos/ui/home/adapter/EventAdapter.kt +++ b/app/src/main/java/com/hous/hous_aos/ui/home/adapter/EventAdapter.kt @@ -6,14 +6,14 @@ import android.view.ViewGroup import androidx.recyclerview.widget.DiffUtil import androidx.recyclerview.widget.ListAdapter import androidx.recyclerview.widget.RecyclerView -import com.hous.hous_aos.R import com.hous.data.entity.Event +import com.hous.hous_aos.R import com.hous.hous_aos.databinding.ItemHomeEventBinding class EventAdapter( private val onClickEventIcon: (Int) -> Unit ) : - ListAdapter(eventDiffUtil) { + ListAdapter(eventDiffUtil) { override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): EventViewHolder { val binding = @@ -27,7 +27,7 @@ class EventAdapter( class EventViewHolder( val binding: ItemHomeEventBinding, - private val onClickEventIcon: (Int) -> Unit, + private val onClickEventIcon: (Int) -> Unit ) : RecyclerView.ViewHolder(binding.root) { fun onBind(data: com.hous.data.entity.Event) { @@ -64,10 +64,16 @@ class EventAdapter( companion object { private val eventDiffUtil = object : DiffUtil.ItemCallback() { - override fun areItemsTheSame(oldItem: com.hous.data.entity.Event, newItem: com.hous.data.entity.Event): Boolean = + override fun areItemsTheSame( + oldItem: com.hous.data.entity.Event, + newItem: com.hous.data.entity.Event + ): Boolean = oldItem.id == newItem.id - override fun areContentsTheSame(oldItem: com.hous.data.entity.Event, newItem: com.hous.data.entity.Event): Boolean = + override fun areContentsTheSame( + oldItem: com.hous.data.entity.Event, + newItem: com.hous.data.entity.Event + ): Boolean = oldItem == newItem } private val TAG = "dialod" diff --git a/app/src/main/java/com/hous/hous_aos/ui/home/adapter/EventParticipantAdapter.kt b/app/src/main/java/com/hous/hous_aos/ui/home/adapter/EventParticipantAdapter.kt index 669ad3db..006d5656 100644 --- a/app/src/main/java/com/hous/hous_aos/ui/home/adapter/EventParticipantAdapter.kt +++ b/app/src/main/java/com/hous/hous_aos/ui/home/adapter/EventParticipantAdapter.kt @@ -10,7 +10,7 @@ import com.hous.hous_aos.databinding.ItemHomeParticipantsBinding import com.hous.hous_aos.ui.rules.HomieIconType class EventParticipantAdapter(private val setSelectedEventParticipant: (Int) -> Unit) : - ListAdapter( + ListAdapter( eventParticipantDiffUtil ) { @@ -20,7 +20,7 @@ class EventParticipantAdapter(private val setSelectedEventParticipant: (Int) -> "GREEN" to HomieIconType.GREEN, "YELLOW" to HomieIconType.YELLOW, "GRAY" to HomieIconType.GRAY, - "PURPLE" to HomieIconType.PURPLE, + "PURPLE" to HomieIconType.PURPLE ) override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): EventParticipantViewHolder { @@ -44,7 +44,7 @@ class EventParticipantAdapter(private val setSelectedEventParticipant: (Int) -> private val setSelectedTmpManager: (Int) -> Unit ) : RecyclerView.ViewHolder(binding.root) { - fun onBind(data: com.hous.data.entity.Homie) { + fun onBind(data: Homie) { binding.data = data binding.homieIconType = homieIconHashMap[data.typeColor] binding.ivManagerIcon.setOnClickListener { @@ -56,14 +56,21 @@ class EventParticipantAdapter(private val setSelectedEventParticipant: (Int) -> } companion object { - private val eventParticipantDiffUtil = object : DiffUtil.ItemCallback() { - override fun areItemsTheSame(oldItem: com.hous.data.entity.Homie, newItem: com.hous.data.entity.Homie): Boolean { - return oldItem.id == newItem.id - } + private val eventParticipantDiffUtil = + object : DiffUtil.ItemCallback() { + override fun areItemsTheSame( + oldItem: Homie, + newItem: Homie + ): Boolean { + return oldItem.id == newItem.id + } - override fun areContentsTheSame(oldItem: com.hous.data.entity.Homie, newItem: com.hous.data.entity.Homie): Boolean { - return oldItem == newItem + override fun areContentsTheSame( + oldItem: Homie, + newItem: Homie + ): Boolean { + return oldItem == newItem + } } - } } } diff --git a/app/src/main/java/com/hous/hous_aos/ui/home/adapter/HomieAdapter.kt b/app/src/main/java/com/hous/hous_aos/ui/home/adapter/HomieAdapter.kt index 84ac3eb0..44bd56dc 100644 --- a/app/src/main/java/com/hous/hous_aos/ui/home/adapter/HomieAdapter.kt +++ b/app/src/main/java/com/hous/hous_aos/ui/home/adapter/HomieAdapter.kt @@ -5,16 +5,16 @@ import android.view.ViewGroup import androidx.recyclerview.widget.DiffUtil import androidx.recyclerview.widget.ListAdapter import androidx.recyclerview.widget.RecyclerView -import com.hous.hous_aos.R import com.hous.data.entity.Homie +import com.hous.hous_aos.R import com.hous.hous_aos.databinding.ItemHomeHomieBinding import com.hous.hous_aos.databinding.ItemHomeHomieCopyBinding class HomieAdapter( private val showToast: () -> Unit, - private val onClickHomie: (Int) -> Unit, + private val onClickHomie: (Int) -> Unit ) : - ListAdapter(homieDiffUtil) { + ListAdapter(homieDiffUtil) { private lateinit var itemHomeHomieBinding: ItemHomeHomieBinding private lateinit var itemHomeHomieCopyBinding: ItemHomeHomieCopyBinding @@ -65,7 +65,7 @@ class HomieAdapter( private val onClickHomie: (Int) -> Unit ) : RecyclerView.ViewHolder(binding.root) { - fun onBind(data: com.hous.data.entity.Homie) { + fun onBind(data: Homie) { itemView.setOnClickListener { onClickHomie(absoluteAdapterPosition) } @@ -113,15 +113,15 @@ class HomieAdapter( } companion object { - private val homieDiffUtil = object : DiffUtil.ItemCallback() { - override fun areItemsTheSame(oldItem: com.hous.data.entity.Homie, newItem: com.hous.data.entity.Homie): Boolean = + private val homieDiffUtil = object : DiffUtil.ItemCallback() { + override fun areItemsTheSame(oldItem: Homie, newItem: Homie): Boolean = oldItem.id == newItem.id - override fun areContentsTheSame(oldItem: com.hous.data.entity.Homie, newItem: com.hous.data.entity.Homie): Boolean = + override fun areContentsTheSame(oldItem: Homie, newItem: Homie): Boolean = oldItem == newItem } private const val HOMIE_ITEM = 0 private const val COPY_ITEM = 1 } -} \ No newline at end of file +} diff --git a/app/src/main/java/com/hous/hous_aos/ui/home/adapter/ToDoAdapter.kt b/app/src/main/java/com/hous/hous_aos/ui/home/adapter/ToDoAdapter.kt index 0c36a741..8f10dfeb 100644 --- a/app/src/main/java/com/hous/hous_aos/ui/home/adapter/ToDoAdapter.kt +++ b/app/src/main/java/com/hous/hous_aos/ui/home/adapter/ToDoAdapter.kt @@ -8,7 +8,7 @@ import androidx.recyclerview.widget.RecyclerView import com.hous.data.entity.Rule import com.hous.hous_aos.databinding.ItemHomeToDoBinding -class ToDoAdapter : ListAdapter(toDoDiffUtil) { +class ToDoAdapter : ListAdapter(toDoDiffUtil) { override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ToDoViewHolder { val binding = @@ -22,18 +22,18 @@ class ToDoAdapter : ListAdapter() { - override fun areItemsTheSame(oldItem: com.hous.data.entity.Rule, newItem: com.hous.data.entity.Rule): Boolean = + private val toDoDiffUtil = object : DiffUtil.ItemCallback() { + override fun areItemsTheSame(oldItem: Rule, newItem: Rule): Boolean = oldItem.id == newItem.id - override fun areContentsTheSame(oldItem: com.hous.data.entity.Rule, newItem: com.hous.data.entity.Rule): Boolean = + override fun areContentsTheSame(oldItem: Rule, newItem: Rule): Boolean = oldItem == newItem } } diff --git a/app/src/main/java/com/hous/hous_aos/ui/newrules/component/CategoryDropDown.kt b/app/src/main/java/com/hous/hous_aos/ui/newrules/component/CategoryDropDown.kt index f02e90a7..3892fa3a 100644 --- a/app/src/main/java/com/hous/hous_aos/ui/newrules/component/CategoryDropDown.kt +++ b/app/src/main/java/com/hous/hous_aos/ui/newrules/component/CategoryDropDown.kt @@ -21,7 +21,7 @@ import com.hous.data.entity.Category @Composable fun CategoryDropDownMenu( - ruleCategoryList: List, + ruleCategoryList: List, setCategory: (String, String) -> Unit ) { var isExpanded by remember { mutableStateOf(false) } diff --git a/app/src/main/java/com/hous/hous_aos/ui/newrules/component/CategoryItem.kt b/app/src/main/java/com/hous/hous_aos/ui/newrules/component/CategoryItem.kt index b3583c35..aaf9d695 100644 --- a/app/src/main/java/com/hous/hous_aos/ui/newrules/component/CategoryItem.kt +++ b/app/src/main/java/com/hous/hous_aos/ui/newrules/component/CategoryItem.kt @@ -25,7 +25,7 @@ import com.hous.data.entity.Category fun CategoryItem( radius: Dp, categoryName: String, - ruleCategoryList: List, + ruleCategoryList: List, setCategory: (String, String) -> Unit ) { Box( diff --git a/app/src/main/java/com/hous/hous_aos/ui/newrules/component/ManagerAddButton.kt b/app/src/main/java/com/hous/hous_aos/ui/newrules/component/ManagerAddButton.kt index d8920ffc..df97d91f 100644 --- a/app/src/main/java/com/hous/hous_aos/ui/newrules/component/ManagerAddButton.kt +++ b/app/src/main/java/com/hous/hous_aos/ui/newrules/component/ManagerAddButton.kt @@ -22,7 +22,7 @@ import com.hous.hous_aos.ui.newrules.isAddDay @Composable fun NewRulesAddMangerButton( - homies: List, + homies: List, homieState: HashMap, isShowAddButton: () -> Boolean, addManager: () -> Unit diff --git a/app/src/main/java/com/hous/hous_aos/ui/newrules/component/ManagerBox.kt b/app/src/main/java/com/hous/hous_aos/ui/newrules/component/ManagerBox.kt index e56d58e3..ad223f38 100644 --- a/app/src/main/java/com/hous/hous_aos/ui/newrules/component/ManagerBox.kt +++ b/app/src/main/java/com/hous/hous_aos/ui/newrules/component/ManagerBox.kt @@ -29,10 +29,10 @@ fun ManagerBox( radius: Dp, managerIndex: Int, manager: Manager, - homies: List, + homies: List, homieState: HashMap, checkBoxState: State, - choiceManager: (Int, com.hous.data.entity.Homie) -> Unit + choiceManager: (Int, Homie) -> Unit ) { Box( modifier = Modifier diff --git a/app/src/main/java/com/hous/hous_aos/ui/newrules/component/ManagerDropDown.kt b/app/src/main/java/com/hous/hous_aos/ui/newrules/component/ManagerDropDown.kt index ad4e0df4..3e3e543c 100644 --- a/app/src/main/java/com/hous/hous_aos/ui/newrules/component/ManagerDropDown.kt +++ b/app/src/main/java/com/hous/hous_aos/ui/newrules/component/ManagerDropDown.kt @@ -36,10 +36,10 @@ import com.hous.hous_aos.ui.newrules.isAddDay @Composable fun ManagerDropDownMenu( managerIndex: Int, - homies: List, + homies: List, homieState: HashMap, checkBoxState: State, - choiceManager: (Int, com.hous.data.entity.Homie) -> Unit + choiceManager: (Int, Homie) -> Unit ) { if (checkBoxState != State.SELECT && isAddDay(homies, homieState)) { var isExpanded by remember { mutableStateOf(false) } diff --git a/app/src/main/java/com/hous/hous_aos/ui/newrules/component/ManagerItem.kt b/app/src/main/java/com/hous/hous_aos/ui/newrules/component/ManagerItem.kt index 2458e1ba..2668ef10 100644 --- a/app/src/main/java/com/hous/hous_aos/ui/newrules/component/ManagerItem.kt +++ b/app/src/main/java/com/hous/hous_aos/ui/newrules/component/ManagerItem.kt @@ -17,11 +17,11 @@ fun ManagerItem( manager: Manager, currentIndex: Int, checkBoxState: State, - homies: List, + homies: List, homieState: HashMap, setCheckBoxState: (String, State) -> Unit, deleteManager: (Int) -> Unit, - choiceManager: (Int, com.hous.data.entity.Homie) -> Unit, + choiceManager: (Int, Homie) -> Unit, selectDay: (Int, DayData) -> Unit ) { Column { diff --git a/app/src/main/java/com/hous/hous_aos/ui/profile/ProfileViewModel.kt b/app/src/main/java/com/hous/hous_aos/ui/profile/ProfileViewModel.kt index 06a70310..f066a8b7 100644 --- a/app/src/main/java/com/hous/hous_aos/ui/profile/ProfileViewModel.kt +++ b/app/src/main/java/com/hous/hous_aos/ui/profile/ProfileViewModel.kt @@ -12,9 +12,9 @@ import kotlinx.coroutines.launch @HiltViewModel class ProfileViewModel @Inject constructor( - private val profileRepository: com.hous.data.repository.ProfileRepository + private val profileRepository: ProfileRepository ) : ViewModel() { - private val _profileData = MutableLiveData() + private val _profileData = MutableLiveData() val profileData get() = _profileData init { diff --git a/app/src/main/java/com/hous/hous_aos/ui/profile/ResultViewModel.kt b/app/src/main/java/com/hous/hous_aos/ui/profile/ResultViewModel.kt index e23d3093..9c59e79f 100644 --- a/app/src/main/java/com/hous/hous_aos/ui/profile/ResultViewModel.kt +++ b/app/src/main/java/com/hous/hous_aos/ui/profile/ResultViewModel.kt @@ -8,15 +8,15 @@ import com.hous.data.entity.ResultData import com.hous.data.repository.HomeRepository import com.hous.data.repository.ProfileRepository import dagger.hilt.android.lifecycle.HiltViewModel -import kotlinx.coroutines.launch import javax.inject.Inject +import kotlinx.coroutines.launch @HiltViewModel class ResultViewModel @Inject constructor( - private val profileRepository: com.hous.data.repository.ProfileRepository, - private val homeRepository: com.hous.data.repository.HomeRepository + private val profileRepository: ProfileRepository, + private val homeRepository: HomeRepository ) : ViewModel() { - private val _resultData = MutableLiveData() + private val _resultData = MutableLiveData() val resultData get() = _resultData private val _userId = MutableLiveData() @@ -37,7 +37,7 @@ class ResultViewModel @Inject constructor( fun homieResult() { viewModelScope.launch { - homeRepository.getHomieResult(userId= userId.value!!) + homeRepository.getHomieResult(userId = userId.value!!) .onSuccess { result -> Log.d("HomieResultViewModel", "data : ${result.data}") _resultData.value = result.data!! @@ -47,4 +47,4 @@ class ResultViewModel @Inject constructor( } } } -} \ No newline at end of file +} diff --git a/app/src/main/java/com/hous/hous_aos/ui/profile/TendencyViewModel.kt b/app/src/main/java/com/hous/hous_aos/ui/profile/TendencyViewModel.kt index 21a2ee1a..ae4980d2 100644 --- a/app/src/main/java/com/hous/hous_aos/ui/profile/TendencyViewModel.kt +++ b/app/src/main/java/com/hous/hous_aos/ui/profile/TendencyViewModel.kt @@ -5,7 +5,6 @@ import androidx.lifecycle.LiveData import androidx.lifecycle.MutableLiveData import androidx.lifecycle.ViewModel import androidx.lifecycle.viewModelScope -import com.hous.data.model.request.PutTestResultRequest import com.hous.data.repository.ProfileRepository import dagger.hilt.android.lifecycle.HiltViewModel import javax.inject.Inject @@ -16,7 +15,7 @@ import kotlinx.coroutines.launch @HiltViewModel class TendencyViewModel @Inject constructor( - private val profileRepository: com.hous.data.repository.ProfileRepository + private val profileRepository: ProfileRepository ) : ViewModel() { private val _move = MutableLiveData() val move: LiveData = _move @@ -28,7 +27,7 @@ class TendencyViewModel @Inject constructor( profileRepository.getTypeTestList() .onSuccess { Log.d("TendencyViewModel", "success ${it.data!!.typeTests}") - val tempList = it.data.typeTests.map { typeTest -> + val tempList = it.data!!.typeTests.map { typeTest -> com.hous.data.entity.TypeTest( id = typeTest.id, testNum = typeTest.testNum, diff --git a/app/src/main/java/com/hous/hous_aos/ui/rules/HomeRulesCategoryAdapter.kt b/app/src/main/java/com/hous/hous_aos/ui/rules/HomeRulesCategoryAdapter.kt index d203d51d..0d40198e 100644 --- a/app/src/main/java/com/hous/hous_aos/ui/rules/HomeRulesCategoryAdapter.kt +++ b/app/src/main/java/com/hous/hous_aos/ui/rules/HomeRulesCategoryAdapter.kt @@ -6,17 +6,17 @@ import androidx.annotation.DrawableRes import androidx.recyclerview.widget.DiffUtil import androidx.recyclerview.widget.ListAdapter import androidx.recyclerview.widget.RecyclerView -import com.hous.hous_aos.R import com.hous.data.entity.Category +import com.hous.hous_aos.R import com.hous.hous_aos.databinding.ItemRulesRuleBinding class HomeRulesCategoryAdapter( private val onLongClick: () -> Unit, private val onCategoryClick: () -> Unit, private val onPlusClick: () -> Unit, - private val onChangeIsSelected: (Int) -> Unit, + private val onChangeIsSelected: (Int) -> Unit ) : - ListAdapter( + ListAdapter( CategoryOfRuleDiffUtilCallback ) { private val iconTypeHashMap: HashMap = hashMapOf( @@ -55,7 +55,9 @@ class HomeRulesCategoryAdapter( onCategoryClick, onChangeIsSelected, ItemRulesRuleBinding.inflate( - LayoutInflater.from(parent.context), parent, false + LayoutInflater.from(parent.context), + parent, + false ) ) } diff --git a/app/src/main/java/com/hous/hous_aos/ui/rules/RulesFragment.kt b/app/src/main/java/com/hous/hous_aos/ui/rules/RulesFragment.kt index ce8a27e8..6d489934 100644 --- a/app/src/main/java/com/hous/hous_aos/ui/rules/RulesFragment.kt +++ b/app/src/main/java/com/hous/hous_aos/ui/rules/RulesFragment.kt @@ -49,7 +49,7 @@ class RulesFragment : Fragment() { ::onLongClickCategoryIcon, ::onCategoryClick, onPlusClick = { onClickPlusIcon() }, - onChangeIsSelected = { setCategoryIsSelected(it) }, + onChangeIsSelected = { setCategoryIsSelected(it) } ) binding.rvRules.adapter = homeRulesCategoryAdapter } diff --git a/app/src/main/java/com/hous/hous_aos/ui/rules/RulesViewModel.kt b/app/src/main/java/com/hous/hous_aos/ui/rules/RulesViewModel.kt index 94de891d..a81fedd2 100644 --- a/app/src/main/java/com/hous/hous_aos/ui/rules/RulesViewModel.kt +++ b/app/src/main/java/com/hous/hous_aos/ui/rules/RulesViewModel.kt @@ -8,50 +8,49 @@ import androidx.lifecycle.viewModelScope import com.hous.data.entity.Category import com.hous.data.entity.Homie import com.hous.data.entity.Rule -import com.hous.data.model.request.MyToDoCheckRequest import com.hous.data.model.response.TempManagerRequest import com.hous.data.repository.RulesTodayRepository import dagger.hilt.android.lifecycle.HiltViewModel -import kotlinx.coroutines.launch import javax.inject.Inject +import kotlinx.coroutines.launch @HiltViewModel class RulesViewModel @Inject constructor( - private val rulesTodayRepository: com.hous.data.repository.RulesTodayRepository + private val rulesTodayRepository: RulesTodayRepository ) : ViewModel() { private var _toDoViewType = MutableLiveData(ToDoViewType.TODAY_TO_DO) val toDoViewType: LiveData get() = _toDoViewType - private var _isSelectedCategorySmile = MutableLiveData(true) + private var _isSelectedCategorySmile = MutableLiveData(true) val isSelectedCategorySmile: LiveData get() = _isSelectedCategorySmile private var _categoryOfRuleList = - MutableLiveData>() + MutableLiveData>() val categoryOfRuleList get() = _categoryOfRuleList private var _todayTodoList = - MutableLiveData>() + MutableLiveData>() val todayTodoList get() = _todayTodoList private var _myTodoList = - MutableLiveData>() + MutableLiveData>() val myTodoList get() = _myTodoList private var _keyRulesTableList = - MutableLiveData>() + MutableLiveData>() val keyRulesTableList get() = _keyRulesTableList private var _generalRulesTableList = - MutableLiveData>() + MutableLiveData>() val generalRulesTableList get() = _generalRulesTableList - private var _tmpManagerList = MutableLiveData>() + private var _tmpManagerList = MutableLiveData>() val tmpManagerList get() = _tmpManagerList private var _tmpTodayToDoPosition = MutableLiveData(0) val tmpTodayToDoPosition get() = _tmpTodayToDoPosition - private var _ruleTableSize = MutableLiveData(0) + private var _ruleTableSize = MutableLiveData(0) val ruleTableSize get() = _ruleTableSize private var _categoryName = MutableLiveData("") @@ -65,9 +64,9 @@ class RulesViewModel @Inject constructor( rulesTodayRepository.getTodayTodayInfoList("") .onSuccess { _todayTodoList.value = it.data!!.todayTodoRules - _categoryOfRuleList.value = it.data.homeRuleCategories + _categoryOfRuleList.value = it.data!!.homeRuleCategories _categoryOfRuleList.value = (_categoryOfRuleList.value!!).plus( - com.hous.data.entity.Category( + Category( id = "62d6b94e0e9be86f165d48db", categoryName = "없음", categoryIcon = "CLEAN" @@ -93,7 +92,7 @@ class RulesViewModel @Inject constructor( _tmpManagerList.value?.forEach { if (it.isChecked) clickedTmpManagerList.add(it.id!!) } - val tmp = com.hous.data.model.response.TempManagerRequest(clickedTmpManagerList) + val tmp = TempManagerRequest(clickedTmpManagerList) Log.d( TAG, "Put -- tmp.tmpRuleMembers: ${tmp.tmpRuleMembers} tmp.size : ${tmp.tmpRuleMembers.size}" @@ -185,7 +184,9 @@ class RulesViewModel @Inject constructor( val checked = myTodoList.value!![position].isChecked val id = myTodoList.value!![position].id viewModelScope.launch { - rulesTodayRepository.putMyToDoCheckLust("", id, + rulesTodayRepository.putMyToDoCheckLust( + "", + id, com.hous.data.model.request.MyToDoCheckRequest(checked) ) .onSuccess { diff --git a/app/src/main/java/com/hous/hous_aos/ui/rules/my_to_do/MyToDoAdapter.kt b/app/src/main/java/com/hous/hous_aos/ui/rules/my_to_do/MyToDoAdapter.kt index 7c11daca..4b0ad9be 100644 --- a/app/src/main/java/com/hous/hous_aos/ui/rules/my_to_do/MyToDoAdapter.kt +++ b/app/src/main/java/com/hous/hous_aos/ui/rules/my_to_do/MyToDoAdapter.kt @@ -9,7 +9,7 @@ import com.hous.data.entity.Rule import com.hous.hous_aos.databinding.ItemRulesMyToDoBinding class MyToDoAdapter(private val onClickIcon: (Int) -> Unit) : - ListAdapter( + ListAdapter( MyTodoDiffUtilCallback ) { private val iconTypeHashMap: HashMap = hashMapOf( @@ -28,7 +28,7 @@ class MyToDoAdapter(private val onClickIcon: (Int) -> Unit) : private val iconTypeHashMap: HashMap, private val onClickIcon: (Int) -> Unit ) : RecyclerView.ViewHolder(binding.root) { - fun onBind(data: com.hous.data.entity.Rule) { + fun onBind(data: Rule) { binding.data = data binding.iconType = iconTypeHashMap[data.categoryIcon] binding.clMyToDo.setOnClickListener { @@ -39,7 +39,6 @@ class MyToDoAdapter(private val onClickIcon: (Int) -> Unit) : } override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): MyToDoViewHolder { - val binding = ItemRulesMyToDoBinding.inflate( LayoutInflater.from(parent.context), parent, @@ -56,18 +55,18 @@ class MyToDoAdapter(private val onClickIcon: (Int) -> Unit) : companion object { private val MyTodoDiffUtilCallback = - object : DiffUtil.ItemCallback() { + object : DiffUtil.ItemCallback() { override fun areItemsTheSame( - oldItem: com.hous.data.entity.Rule, - newItem: com.hous.data.entity.Rule + oldItem: Rule, + newItem: Rule ): Boolean { return oldItem.id == newItem.id } override fun areContentsTheSame( - oldItem: com.hous.data.entity.Rule, - newItem: com.hous.data.entity.Rule + oldItem: Rule, + newItem: Rule ): Boolean { return oldItem == newItem } diff --git a/app/src/main/java/com/hous/hous_aos/ui/rules/rules_table/GeneralRulesAdapter.kt b/app/src/main/java/com/hous/hous_aos/ui/rules/rules_table/GeneralRulesAdapter.kt index a398e259..74714ca9 100644 --- a/app/src/main/java/com/hous/hous_aos/ui/rules/rules_table/GeneralRulesAdapter.kt +++ b/app/src/main/java/com/hous/hous_aos/ui/rules/rules_table/GeneralRulesAdapter.kt @@ -11,7 +11,7 @@ import com.hous.hous_aos.databinding.ItemRulesTableGeneralBinding import com.hous.hous_aos.ui.rules.IconColor class GeneralRulesAdapter : - ListAdapter(generalRulesDiffUtil) { + ListAdapter(generalRulesDiffUtil) { private val iconColorHashMap: HashMap = hashMapOf( "RED" to IconColor.RED, @@ -19,7 +19,7 @@ class GeneralRulesAdapter : "GREEN" to IconColor.GREEN, "YELLOW" to IconColor.YELLOW, "GRAY" to IconColor.GRAY, - "PURPLE" to IconColor.PURPLE, + "PURPLE" to IconColor.PURPLE ) override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): GeneralRulesViewHolder { @@ -40,7 +40,7 @@ class GeneralRulesAdapter : private val iconColorHashMap: HashMap ) : RecyclerView.ViewHolder(binding.root) { - fun onBind(data: com.hous.data.entity.Rule) { + fun onBind(data: Rule) { binding.data = data val memberCnt = if (data.membersCnt >= 4) 3 else data.membersCnt Log.d( @@ -73,17 +73,17 @@ class GeneralRulesAdapter : } companion object { - private val generalRulesDiffUtil = object : DiffUtil.ItemCallback() { + private val generalRulesDiffUtil = object : DiffUtil.ItemCallback() { override fun areItemsTheSame( - oldItem: com.hous.data.entity.Rule, - newItem: com.hous.data.entity.Rule + oldItem: Rule, + newItem: Rule ): Boolean { return oldItem.id == newItem.id } override fun areContentsTheSame( - oldItem: com.hous.data.entity.Rule, - newItem: com.hous.data.entity.Rule + oldItem: Rule, + newItem: Rule ): Boolean { return oldItem == newItem } diff --git a/app/src/main/java/com/hous/hous_aos/ui/rules/rules_table/KeyRulesAdapter.kt b/app/src/main/java/com/hous/hous_aos/ui/rules/rules_table/KeyRulesAdapter.kt index de375b74..a8a80a6b 100644 --- a/app/src/main/java/com/hous/hous_aos/ui/rules/rules_table/KeyRulesAdapter.kt +++ b/app/src/main/java/com/hous/hous_aos/ui/rules/rules_table/KeyRulesAdapter.kt @@ -9,7 +9,7 @@ import com.hous.data.entity.Rule import com.hous.hous_aos.databinding.ItemRulesTableKeysBinding class KeyRulesAdapter : - ListAdapter(rulesTableDiffUtil) { + ListAdapter(rulesTableDiffUtil) { override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): KeyRulesViewHolder { val binding = @@ -24,18 +24,18 @@ class KeyRulesAdapter : class KeyRulesViewHolder(private val binding: ItemRulesTableKeysBinding) : RecyclerView.ViewHolder(binding.root) { - fun onBind(data: com.hous.data.entity.Rule) { + fun onBind(data: Rule) { binding.data = data } } companion object { - private val rulesTableDiffUtil = object : DiffUtil.ItemCallback() { - override fun areItemsTheSame(oldItem: com.hous.data.entity.Rule, newItem: com.hous.data.entity.Rule): Boolean { + private val rulesTableDiffUtil = object : DiffUtil.ItemCallback() { + override fun areItemsTheSame(oldItem: Rule, newItem: Rule): Boolean { return oldItem.id == newItem.id } - override fun areContentsTheSame(oldItem: com.hous.data.entity.Rule, newItem: com.hous.data.entity.Rule): Boolean { + override fun areContentsTheSame(oldItem: Rule, newItem: Rule): Boolean { return oldItem == newItem } } diff --git a/app/src/main/java/com/hous/hous_aos/ui/rules/today_to_do/TodayTodoAdapter.kt b/app/src/main/java/com/hous/hous_aos/ui/rules/today_to_do/TodayTodoAdapter.kt index f227dcce..e3d46fd6 100644 --- a/app/src/main/java/com/hous/hous_aos/ui/rules/today_to_do/TodayTodoAdapter.kt +++ b/app/src/main/java/com/hous/hous_aos/ui/rules/today_to_do/TodayTodoAdapter.kt @@ -6,7 +6,6 @@ import android.view.ViewGroup import androidx.recyclerview.widget.DiffUtil import androidx.recyclerview.widget.ListAdapter import androidx.recyclerview.widget.RecyclerView -import com.hous.data.entity.Homie import com.hous.data.entity.Rule import com.hous.hous_aos.databinding.ItemRulesTodayToDoItemMultiBinding import com.hous.hous_aos.databinding.ItemRulesTodayToDoItemNoneBinding @@ -18,7 +17,7 @@ class TodayTodoAdapter( private val onClickIcon: () -> Unit, private val fetchToTmpManagerList: (Int) -> Unit ) : - ListAdapter( + ListAdapter( TodayTodoDiffUtilCallback ) { @@ -203,18 +202,18 @@ class TodayTodoAdapter( companion object { private val TodayTodoDiffUtilCallback = - object : DiffUtil.ItemCallback() { + object : DiffUtil.ItemCallback() { override fun areItemsTheSame( - oldItem: com.hous.data.entity.Rule, - newItem: com.hous.data.entity.Rule + oldItem: Rule, + newItem: Rule ): Boolean { return oldItem.id == newItem.id } override fun areContentsTheSame( - oldItem: com.hous.data.entity.Rule, - newItem: com.hous.data.entity.Rule + oldItem: Rule, + newItem: Rule ): Boolean { return oldItem == newItem } diff --git a/app/src/main/java/com/hous/hous_aos/ui/rules/today_to_do/tem_dialog/TempManagerDialogFragment.kt b/app/src/main/java/com/hous/hous_aos/ui/rules/today_to_do/tem_dialog/TempManagerDialogFragment.kt index 7c365d43..5754530c 100644 --- a/app/src/main/java/com/hous/hous_aos/ui/rules/today_to_do/tem_dialog/TempManagerDialogFragment.kt +++ b/app/src/main/java/com/hous/hous_aos/ui/rules/today_to_do/tem_dialog/TempManagerDialogFragment.kt @@ -11,7 +11,6 @@ import androidx.fragment.app.activityViewModels import com.hous.hous_aos.R import com.hous.hous_aos.databinding.FragmentTempManagerBinding import com.hous.hous_aos.ui.rules.RulesViewModel -import com.hous.hous_aos.util.showToast class TempManagerFragment : DialogFragment() { private var _binding: FragmentTempManagerBinding? = null diff --git a/app/src/main/java/com/hous/hous_aos/ui/rules/today_to_do/tem_dialog/TempMangerAdapter.kt b/app/src/main/java/com/hous/hous_aos/ui/rules/today_to_do/tem_dialog/TempMangerAdapter.kt index 19701e6a..32afb355 100644 --- a/app/src/main/java/com/hous/hous_aos/ui/rules/today_to_do/tem_dialog/TempMangerAdapter.kt +++ b/app/src/main/java/com/hous/hous_aos/ui/rules/today_to_do/tem_dialog/TempMangerAdapter.kt @@ -10,7 +10,7 @@ import com.hous.hous_aos.databinding.ItemRulesTmpManagersBinding import com.hous.hous_aos.ui.rules.HomieIconType class TempMangerAdapter(private val setSelectedTmpManager: (Int) -> Unit) : - ListAdapter(tempManagerDiffUtil) { + ListAdapter(tempManagerDiffUtil) { private val homieIconHashMap: HashMap = hashMapOf( "RED" to HomieIconType.RED, "BLUE" to HomieIconType.BLUE, @@ -37,7 +37,7 @@ class TempMangerAdapter(private val setSelectedTmpManager: (Int) -> Unit) : private val setSelectedTmpManager: (Int) -> Unit ) : RecyclerView.ViewHolder(binding.root) { - fun onBind(data: com.hous.data.entity.Homie) { + fun onBind(data: Homie) { binding.data = data binding.homieIconType = homieIconHashMap[data.typeColor] binding.ivManagerIcon.setOnClickListener { @@ -48,17 +48,17 @@ class TempMangerAdapter(private val setSelectedTmpManager: (Int) -> Unit) : } companion object { - private val tempManagerDiffUtil = object : DiffUtil.ItemCallback() { + private val tempManagerDiffUtil = object : DiffUtil.ItemCallback() { override fun areItemsTheSame( - oldItem: com.hous.data.entity.Homie, - newItem: com.hous.data.entity.Homie + oldItem: Homie, + newItem: Homie ): Boolean { return oldItem.id == newItem.id } override fun areContentsTheSame( - oldItem: com.hous.data.entity.Homie, - newItem: com.hous.data.entity.Homie + oldItem: Homie, + newItem: Homie ): Boolean { return oldItem == newItem } diff --git a/app/src/main/java/com/hous/hous_aos/util/GetColorSet.kt b/app/src/main/java/com/hous/hous_aos/util/GetColorSet.kt index eaafc202..fdd91064 100644 --- a/app/src/main/java/com/hous/hous_aos/util/GetColorSet.kt +++ b/app/src/main/java/com/hous/hous_aos/util/GetColorSet.kt @@ -1,31 +1,31 @@ package com.hous.hous_aos.util -import com.hous.hous_aos.R import com.hous.data.entity.ColorSet +import com.hous.hous_aos.R -fun String.getColorSet(colorType: String): com.hous.data.entity.ColorSet { +fun String.getColorSet(colorType: String): ColorSet { return when (colorType) { - "PURPLE", "하이레벨 오돌이" -> com.hous.data.entity.ColorSet( + "PURPLE", "하이레벨 오돌이" -> ColorSet( colorBg = R.color.hous_purple_bg, colorBg2 = R.color.hous_purple_bg_2, colorPrimary = R.color.hous_purple ) - "GREEN", "룰 세터 육각이" -> com.hous.data.entity.ColorSet( + "GREEN", "룰 세터 육각이" -> ColorSet( colorBg = R.color.hous_green_bg, colorBg2 = R.color.hous_green_bg_2, colorPrimary = R.color.hous_green ) - "YELLOW", "늘 행복한 동글이" -> com.hous.data.entity.ColorSet( + "YELLOW", "늘 행복한 동글이" -> ColorSet( colorBg = R.color.hous_yellow_bg, colorBg2 = R.color.hous_yellow_bg_2, colorPrimary = R.color.hous_yellow ) - "BLUE", "룸메 맞춤형 네각이" -> com.hous.data.entity.ColorSet( + "BLUE", "룸메 맞춤형 네각이" -> ColorSet( colorBg = R.color.hous_blue_bg, colorBg2 = R.color.hous_blue_bg_2, colorPrimary = R.color.hous_blue ) - else -> com.hous.data.entity.ColorSet( + else -> ColorSet( colorBg = R.color.hous_red_bg, colorBg2 = R.color.hous_red_bg_2, colorPrimary = R.color.hous_red diff --git a/data/src/main/java/com/hous/data/model/response/EventResponse.kt b/data/src/main/java/com/hous/data/model/response/EventResponse.kt index f2d7a582..36b36ee9 100644 --- a/data/src/main/java/com/hous/data/model/response/EventResponse.kt +++ b/data/src/main/java/com/hous/data/model/response/EventResponse.kt @@ -1,7 +1,7 @@ package com.hous.data.model.response import com.google.gson.annotations.SerializedName -import com.hous.hous_aos.data.entity.Homie +import com.hous.data.entity.Homie data class EventResponse( @SerializedName("_id") val id: String, diff --git a/data/src/main/java/com/hous/data/model/response/HomeResponse.kt b/data/src/main/java/com/hous/data/model/response/HomeResponse.kt index 03533680..18cf9468 100644 --- a/data/src/main/java/com/hous/data/model/response/HomeResponse.kt +++ b/data/src/main/java/com/hous/data/model/response/HomeResponse.kt @@ -1,8 +1,8 @@ package com.hous.data.model.response -import com.hous.hous_aos.data.entity.Event -import com.hous.hous_aos.data.entity.Homie -import com.hous.hous_aos.data.entity.Rule +import com.hous.data.entity.Event +import com.hous.data.entity.Homie +import com.hous.data.entity.Rule data class HomeResponse( val eventList: List, diff --git a/data/src/main/java/com/hous/data/model/response/RulesTableResponse.kt b/data/src/main/java/com/hous/data/model/response/RulesTableResponse.kt index dc78b3f3..52b8b67d 100644 --- a/data/src/main/java/com/hous/data/model/response/RulesTableResponse.kt +++ b/data/src/main/java/com/hous/data/model/response/RulesTableResponse.kt @@ -1,6 +1,6 @@ package com.hous.data.model.response -import com.hous.hous_aos.data.entity.Rule +import com.hous.data.entity.Rule data class RulesTableResponse( val keyRules: List, diff --git a/data/src/main/java/com/hous/data/model/response/RulesTodayInfoListResponse.kt b/data/src/main/java/com/hous/data/model/response/RulesTodayInfoListResponse.kt index 634a4093..52fb05b4 100644 --- a/data/src/main/java/com/hous/data/model/response/RulesTodayInfoListResponse.kt +++ b/data/src/main/java/com/hous/data/model/response/RulesTodayInfoListResponse.kt @@ -1,9 +1,9 @@ package com.hous.data.model.response -import com.hous.hous_aos.data.entity.Category -import com.hous.hous_aos.data.entity.Rule +import com.hous.data.entity.Category +import com.hous.data.entity.Rule data class RulesTodayInfoListResponse( val homeRuleCategories: List = emptyList(), val todayTodoRules: List = emptyList() -) \ No newline at end of file +) diff --git a/data/src/main/java/com/hous/data/model/response/TempManagerResponse.kt b/data/src/main/java/com/hous/data/model/response/TempManagerResponse.kt index 271dabc0..9b51706e 100644 --- a/data/src/main/java/com/hous/data/model/response/TempManagerResponse.kt +++ b/data/src/main/java/com/hous/data/model/response/TempManagerResponse.kt @@ -1,7 +1,7 @@ package com.hous.data.model.response import com.google.gson.annotations.SerializedName -import com.hous.hous_aos.data.entity.Homie +import com.hous.data.entity.Homie data class TempManagerResponse( @SerializedName("_id") diff --git a/data/src/main/java/com/hous/data/model/response/TypeTestListResponse.kt b/data/src/main/java/com/hous/data/model/response/TypeTestListResponse.kt index d852623a..a3b388cf 100644 --- a/data/src/main/java/com/hous/data/model/response/TypeTestListResponse.kt +++ b/data/src/main/java/com/hous/data/model/response/TypeTestListResponse.kt @@ -1,6 +1,6 @@ package com.hous.data.model.response -import com.hous.hous_aos.ui.profile.TypeTest +import com.hous.data.entity.TypeTest data class TypeTestResponse( val typeTests: List From 3082abb0a35efec932e68ad497d186af5a533f40 Mon Sep 17 00:00:00 2001 From: KWY0218 Date: Fri, 5 Aug 2022 10:18:20 +0900 Subject: [PATCH 07/11] =?UTF-8?q?#173=20[refact]=20new=20rules=20data=20cl?= =?UTF-8?q?ass=20=EB=8D=B0=EC=9D=B4=ED=84=B0=20=EB=AA=A8=EB=93=88=EB=A1=9C?= =?UTF-8?q?=20=EC=9D=B4=EB=8F=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../hous_aos/ui/newrules/NewRulesViewModel.kt | 25 +++---------------- .../ui/newrules/component/CheckBox.kt | 1 + .../hous_aos/ui/newrules/component/Day.kt | 1 + .../ui/newrules/component/DeleteButton.kt | 1 + .../ui/newrules/component/ManagerBox.kt | 1 + .../ui/newrules/component/ManagerDropDown.kt | 1 + .../ui/newrules/component/ManagerItem.kt | 1 + .../ui/newrules/component/NewRuleToolBar.kt | 1 + .../main/java/com/hous/data/entity/DayData.kt | 6 +++++ .../main/java/com/hous/data/entity/Manager.kt | 17 +++++++++++++ .../main/java/com/hous/data/entity}/State.kt | 2 +- .../data/repository/NewRulesRepository.kt | 5 ++-- .../data/repository/ProfileRepositoryImpl.kt | 3 ++- .../repository/RulesTodayRepositoryImpl.kt | 3 ++- 14 files changed, 41 insertions(+), 27 deletions(-) create mode 100644 data/src/main/java/com/hous/data/entity/DayData.kt create mode 100644 data/src/main/java/com/hous/data/entity/Manager.kt rename {app/src/main/java/com/hous/hous_aos/ui/newrules/component => data/src/main/java/com/hous/data/entity}/State.kt (51%) diff --git a/app/src/main/java/com/hous/hous_aos/ui/newrules/NewRulesViewModel.kt b/app/src/main/java/com/hous/hous_aos/ui/newrules/NewRulesViewModel.kt index f991128e..b744fea6 100644 --- a/app/src/main/java/com/hous/hous_aos/ui/newrules/NewRulesViewModel.kt +++ b/app/src/main/java/com/hous/hous_aos/ui/newrules/NewRulesViewModel.kt @@ -3,8 +3,10 @@ package com.hous.hous_aos.ui.newrules import android.util.Log import androidx.lifecycle.ViewModel import androidx.lifecycle.viewModelScope +import com.hous.data.entity.DayData +import com.hous.data.entity.Manager import com.hous.data.repository.NewRulesRepository -import com.hous.hous_aos.ui.newrules.component.State +import com.hous.data.entity.State import dagger.hilt.android.lifecycle.HiltViewModel import javax.inject.Inject import kotlinx.coroutines.flow.MutableStateFlow @@ -268,24 +270,3 @@ data class NewRulesUiState( ), val ManagerList: List = listOf(Manager()) ) - -data class Manager( - val managerHomie: com.hous.data.entity.Homie = com.hous.data.entity.Homie( - userName = "담당자 없음", - typeColor = "NULL" - ), - val dayDataList: List = listOf( - DayData("월", State.UNSELECT), - DayData("화", State.UNSELECT), - DayData("수", State.UNSELECT), - DayData("목", State.UNSELECT), - DayData("금", State.UNSELECT), - DayData("토", State.UNSELECT), - DayData("일", State.UNSELECT) - ) -) - -data class DayData( - val day: String, - val dayState: State -) diff --git a/app/src/main/java/com/hous/hous_aos/ui/newrules/component/CheckBox.kt b/app/src/main/java/com/hous/hous_aos/ui/newrules/component/CheckBox.kt index a91620ba..be2243e0 100644 --- a/app/src/main/java/com/hous/hous_aos/ui/newrules/component/CheckBox.kt +++ b/app/src/main/java/com/hous/hous_aos/ui/newrules/component/CheckBox.kt @@ -22,6 +22,7 @@ import androidx.compose.ui.text.font.Font import androidx.compose.ui.text.font.FontFamily import androidx.compose.ui.text.font.FontStyle import androidx.compose.ui.unit.dp +import com.hous.data.entity.State import com.hous.hous_aos.R @Composable diff --git a/app/src/main/java/com/hous/hous_aos/ui/newrules/component/Day.kt b/app/src/main/java/com/hous/hous_aos/ui/newrules/component/Day.kt index 97185fa1..a50c05ac 100644 --- a/app/src/main/java/com/hous/hous_aos/ui/newrules/component/Day.kt +++ b/app/src/main/java/com/hous/hous_aos/ui/newrules/component/Day.kt @@ -17,6 +17,7 @@ import androidx.compose.ui.text.font.Font import androidx.compose.ui.text.font.FontFamily import androidx.compose.ui.text.font.FontStyle import androidx.compose.ui.unit.dp +import com.hous.data.entity.State import com.hous.hous_aos.R import com.hous.hous_aos.ui.newrules.DayData diff --git a/app/src/main/java/com/hous/hous_aos/ui/newrules/component/DeleteButton.kt b/app/src/main/java/com/hous/hous_aos/ui/newrules/component/DeleteButton.kt index b6a8ceff..c2184fe1 100644 --- a/app/src/main/java/com/hous/hous_aos/ui/newrules/component/DeleteButton.kt +++ b/app/src/main/java/com/hous/hous_aos/ui/newrules/component/DeleteButton.kt @@ -5,6 +5,7 @@ import androidx.compose.foundation.clickable import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier import androidx.compose.ui.res.painterResource +import com.hous.data.entity.State import com.hous.hous_aos.R @Composable diff --git a/app/src/main/java/com/hous/hous_aos/ui/newrules/component/ManagerBox.kt b/app/src/main/java/com/hous/hous_aos/ui/newrules/component/ManagerBox.kt index ad223f38..41c53f6b 100644 --- a/app/src/main/java/com/hous/hous_aos/ui/newrules/component/ManagerBox.kt +++ b/app/src/main/java/com/hous/hous_aos/ui/newrules/component/ManagerBox.kt @@ -22,6 +22,7 @@ import androidx.compose.ui.unit.Dp import androidx.compose.ui.unit.dp import com.hous.hous_aos.R import com.hous.data.entity.Homie +import com.hous.data.entity.State import com.hous.hous_aos.ui.newrules.Manager @Composable diff --git a/app/src/main/java/com/hous/hous_aos/ui/newrules/component/ManagerDropDown.kt b/app/src/main/java/com/hous/hous_aos/ui/newrules/component/ManagerDropDown.kt index 3e3e543c..ed897eee 100644 --- a/app/src/main/java/com/hous/hous_aos/ui/newrules/component/ManagerDropDown.kt +++ b/app/src/main/java/com/hous/hous_aos/ui/newrules/component/ManagerDropDown.kt @@ -31,6 +31,7 @@ import androidx.compose.ui.text.font.FontStyle import androidx.compose.ui.unit.dp import com.hous.hous_aos.R import com.hous.data.entity.Homie +import com.hous.data.entity.State import com.hous.hous_aos.ui.newrules.isAddDay @Composable diff --git a/app/src/main/java/com/hous/hous_aos/ui/newrules/component/ManagerItem.kt b/app/src/main/java/com/hous/hous_aos/ui/newrules/component/ManagerItem.kt index 2668ef10..febfe3f7 100644 --- a/app/src/main/java/com/hous/hous_aos/ui/newrules/component/ManagerItem.kt +++ b/app/src/main/java/com/hous/hous_aos/ui/newrules/component/ManagerItem.kt @@ -9,6 +9,7 @@ import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.unit.dp import com.hous.data.entity.Homie +import com.hous.data.entity.State import com.hous.hous_aos.ui.newrules.DayData import com.hous.hous_aos.ui.newrules.Manager diff --git a/app/src/main/java/com/hous/hous_aos/ui/newrules/component/NewRuleToolBar.kt b/app/src/main/java/com/hous/hous_aos/ui/newrules/component/NewRuleToolBar.kt index 27181202..8bf2a7c4 100644 --- a/app/src/main/java/com/hous/hous_aos/ui/newrules/component/NewRuleToolBar.kt +++ b/app/src/main/java/com/hous/hous_aos/ui/newrules/component/NewRuleToolBar.kt @@ -14,6 +14,7 @@ import androidx.compose.ui.res.stringResource import androidx.compose.ui.text.font.Font import androidx.compose.ui.text.font.FontFamily import androidx.compose.ui.text.font.FontStyle +import com.hous.data.entity.State import com.hous.hous_aos.R @Composable diff --git a/data/src/main/java/com/hous/data/entity/DayData.kt b/data/src/main/java/com/hous/data/entity/DayData.kt new file mode 100644 index 00000000..ae3d9dab --- /dev/null +++ b/data/src/main/java/com/hous/data/entity/DayData.kt @@ -0,0 +1,6 @@ +package com.hous.data.entity + +data class DayData( + val day: String, + val dayState: State +) diff --git a/data/src/main/java/com/hous/data/entity/Manager.kt b/data/src/main/java/com/hous/data/entity/Manager.kt new file mode 100644 index 00000000..599abaf0 --- /dev/null +++ b/data/src/main/java/com/hous/data/entity/Manager.kt @@ -0,0 +1,17 @@ +package com.hous.data.entity + +data class Manager( + val managerHomie: Homie = Homie( + userName = "담당자 없음", + typeColor = "NULL" + ), + val dayDataList: List = listOf( + DayData("월", State.UNSELECT), + DayData("화", State.UNSELECT), + DayData("수", State.UNSELECT), + DayData("목", State.UNSELECT), + DayData("금", State.UNSELECT), + DayData("토", State.UNSELECT), + DayData("일", State.UNSELECT) + ) +) diff --git a/app/src/main/java/com/hous/hous_aos/ui/newrules/component/State.kt b/data/src/main/java/com/hous/data/entity/State.kt similarity index 51% rename from app/src/main/java/com/hous/hous_aos/ui/newrules/component/State.kt rename to data/src/main/java/com/hous/data/entity/State.kt index d7f98c76..036e4bcd 100644 --- a/app/src/main/java/com/hous/hous_aos/ui/newrules/component/State.kt +++ b/data/src/main/java/com/hous/data/entity/State.kt @@ -1,4 +1,4 @@ -package com.hous.hous_aos.ui.newrules.component +package com.hous.data.entity enum class State { UNSELECT, SELECT, BLOCK diff --git a/data/src/main/java/com/hous/data/repository/NewRulesRepository.kt b/data/src/main/java/com/hous/data/repository/NewRulesRepository.kt index ea703a3f..4eacd103 100644 --- a/data/src/main/java/com/hous/data/repository/NewRulesRepository.kt +++ b/data/src/main/java/com/hous/data/repository/NewRulesRepository.kt @@ -1,8 +1,9 @@ package com.hous.data.repository +import com.hous.data.model.WrapperClass import com.hous.hous_aos.ui.newrules.NewRulesUiState interface NewRulesRepository { - suspend fun addNewRule(newRulesUiState: NewRulesUiState): Result> - suspend fun getNewRuleList(roomId: String): Result> + suspend fun addNewRule(newRulesUiState: NewRulesUiState): Result> + suspend fun getNewRuleList(roomId: String): Result> } diff --git a/data/src/main/java/com/hous/data/repository/ProfileRepositoryImpl.kt b/data/src/main/java/com/hous/data/repository/ProfileRepositoryImpl.kt index 17a318b6..d2adadab 100644 --- a/data/src/main/java/com/hous/data/repository/ProfileRepositoryImpl.kt +++ b/data/src/main/java/com/hous/data/repository/ProfileRepositoryImpl.kt @@ -5,10 +5,11 @@ import com.hous.data.entity.ResultData import com.hous.data.model.WrapperClass import com.hous.data.model.request.PutTestResultRequest import com.hous.data.model.response.TypeTestResponse +import com.hous.data.source.remote.RemoteProfileDataSource import javax.inject.Inject class ProfileRepositoryImpl @Inject constructor( - private val profileDataSource: com.hous.data.source.remote.RemoteProfileDataSource + private val profileDataSource: RemoteProfileDataSource ) : ProfileRepository { override suspend fun getUserProfile(): Result> = runCatching { profileDataSource.getUserProfile() } diff --git a/data/src/main/java/com/hous/data/repository/RulesTodayRepositoryImpl.kt b/data/src/main/java/com/hous/data/repository/RulesTodayRepositoryImpl.kt index 5dea7b3e..bbf4f730 100644 --- a/data/src/main/java/com/hous/data/repository/RulesTodayRepositoryImpl.kt +++ b/data/src/main/java/com/hous/data/repository/RulesTodayRepositoryImpl.kt @@ -7,10 +7,11 @@ import com.hous.data.model.response.RulesTableResponse import com.hous.data.model.response.RulesTodayInfoListResponse import com.hous.data.model.response.TempManagerRequest import com.hous.data.model.response.TempManagerResponse +import com.hous.data.source.remote.RemoteRulesTodayDataSource import javax.inject.Inject class RulesTodayRepositoryImpl @Inject constructor( - private val remoteRulesTodayDataSource: com.hous.data.source.remote.RemoteRulesTodayDataSource + private val remoteRulesTodayDataSource: RemoteRulesTodayDataSource ) : RulesTodayRepository { override suspend fun getTodayTodayInfoList(roomId: String): Result> { return runCatching { remoteRulesTodayDataSource.getTodayTodayInfoList(roomId) } From 8f75ebe3a1fb06439a2f902e03584fe02df21e83 Mon Sep 17 00:00:00 2001 From: KWY0218 Date: Fri, 5 Aug 2022 11:07:26 +0900 Subject: [PATCH 08/11] =?UTF-8?q?#173=20[chore]=20ktlint=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../hous/hous_aos/ExampleInstrumentedTest.kt | 8 +++--- .../hous_aos/ui/home/adapter/RulesAdapter.kt | 2 +- .../hous_aos/ui/newrules/NewRulesViewModel.kt | 10 +++++-- .../hous_aos/ui/newrules/component/Day.kt | 4 +-- .../hous_aos/ui/newrules/component/DayList.kt | 4 +-- .../ui/newrules/component/ManagerBox.kt | 4 +-- .../ui/newrules/component/ManagerItem.kt | 4 +-- .../hous_aos/ui/profile/TendencyAdapter.kt | 20 +++++++++----- .../ui/profile/TendencyResultActivity.kt | 17 +++++++----- .../ui/profile/TendencyTestActivity.kt | 2 +- .../hous_aos/ui/profile/TestInfoActivity.kt | 6 ++--- .../rules/{HomieIcon.kt => HomieIconType.kt} | 0 .../tem_dialog/TempManagerDialogFragment.kt | 2 +- .../java/com/hous/hous_aos/ExampleUnitTest.kt | 5 ++-- .../main/java/com/hous/data/api/ProfileApi.kt | 7 +---- .../model/response/TypeTestListResponse.kt | 2 +- .../data/repository/NewRulesRepository.kt | 12 +++++++-- .../data/repository/NewRulesRepositoryImpl.kt | 26 ++++++++++++------- .../hous/data/repository/ProfileRepository.kt | 4 +-- .../data/repository/ProfileRepositoryImpl.kt | 4 +-- .../source/remote/RemoteHomeDataSourceImpl.kt | 2 +- .../remote/RemoteNewRulesDataSourceImpl.kt | 2 +- .../source/remote/RemoteProfileDataSource.kt | 4 +-- .../remote/RemoteProfileDataSourceImpl.kt | 6 ++--- .../remote/RemoteRulesTodayDataSourceImpl.kt | 2 +- 25 files changed, 92 insertions(+), 67 deletions(-) rename app/src/main/java/com/hous/hous_aos/ui/rules/{HomieIcon.kt => HomieIconType.kt} (100%) diff --git a/app/src/androidTest/java/com/hous/hous_aos/ExampleInstrumentedTest.kt b/app/src/androidTest/java/com/hous/hous_aos/ExampleInstrumentedTest.kt index 309cc853..9cc9fab5 100644 --- a/app/src/androidTest/java/com/hous/hous_aos/ExampleInstrumentedTest.kt +++ b/app/src/androidTest/java/com/hous/hous_aos/ExampleInstrumentedTest.kt @@ -1,13 +1,11 @@ package com.hous.hous_aos -import androidx.test.platform.app.InstrumentationRegistry import androidx.test.ext.junit.runners.AndroidJUnit4 - +import androidx.test.platform.app.InstrumentationRegistry +import org.junit.Assert.assertEquals import org.junit.Test import org.junit.runner.RunWith -import org.junit.Assert.* - /** * Instrumented test, which will execute on an Android device. * @@ -21,4 +19,4 @@ class ExampleInstrumentedTest { val appContext = InstrumentationRegistry.getInstrumentation().targetContext assertEquals("com.hous.hous_aos", appContext.packageName) } -} \ No newline at end of file +} diff --git a/app/src/main/java/com/hous/hous_aos/ui/home/adapter/RulesAdapter.kt b/app/src/main/java/com/hous/hous_aos/ui/home/adapter/RulesAdapter.kt index 3c71c547..f4362dff 100644 --- a/app/src/main/java/com/hous/hous_aos/ui/home/adapter/RulesAdapter.kt +++ b/app/src/main/java/com/hous/hous_aos/ui/home/adapter/RulesAdapter.kt @@ -31,4 +31,4 @@ class RulesAdapter : RecyclerView.Adapter() { binding.rules = data } } -} \ No newline at end of file +} diff --git a/app/src/main/java/com/hous/hous_aos/ui/newrules/NewRulesViewModel.kt b/app/src/main/java/com/hous/hous_aos/ui/newrules/NewRulesViewModel.kt index b744fea6..b7dfe453 100644 --- a/app/src/main/java/com/hous/hous_aos/ui/newrules/NewRulesViewModel.kt +++ b/app/src/main/java/com/hous/hous_aos/ui/newrules/NewRulesViewModel.kt @@ -5,8 +5,8 @@ import androidx.lifecycle.ViewModel import androidx.lifecycle.viewModelScope import com.hous.data.entity.DayData import com.hous.data.entity.Manager -import com.hous.data.repository.NewRulesRepository import com.hous.data.entity.State +import com.hous.data.repository.NewRulesRepository import dagger.hilt.android.lifecycle.HiltViewModel import javax.inject.Inject import kotlinx.coroutines.flow.MutableStateFlow @@ -190,7 +190,13 @@ class NewRulesViewModel @Inject constructor( fun addNewRule() { Log.d("NewRulesViewModel", "data : ${uiState.value}") viewModelScope.launch { - newRulesRepository.addNewRule(uiState.value) + newRulesRepository.addNewRule( + ruleName = uiState.value.ruleName, + categoryId = uiState.value.categoryId, + notificationState = uiState.value.notificationState, + checkBoxState = uiState.value.checkBoxState, + managerList = uiState.value.ManagerList + ) .onSuccess { Log.d("NewRulesViewModel", "addNewRule success : ${it.message}") } .onFailure { Log.d("NewRulesViewModel", "addNewRule fail : ${it.message}") } } diff --git a/app/src/main/java/com/hous/hous_aos/ui/newrules/component/Day.kt b/app/src/main/java/com/hous/hous_aos/ui/newrules/component/Day.kt index a50c05ac..32d69a50 100644 --- a/app/src/main/java/com/hous/hous_aos/ui/newrules/component/Day.kt +++ b/app/src/main/java/com/hous/hous_aos/ui/newrules/component/Day.kt @@ -17,9 +17,9 @@ import androidx.compose.ui.text.font.Font import androidx.compose.ui.text.font.FontFamily import androidx.compose.ui.text.font.FontStyle import androidx.compose.ui.unit.dp +import com.hous.data.entity.DayData import com.hous.data.entity.State import com.hous.hous_aos.R -import com.hous.hous_aos.ui.newrules.DayData @Composable fun NewRulesDay( @@ -58,7 +58,7 @@ fun NewRulesDay( resId = R.font.spoqa_han_sans_neo_medium, style = FontStyle(R.style.B3) ) - ), + ) ) } } diff --git a/app/src/main/java/com/hous/hous_aos/ui/newrules/component/DayList.kt b/app/src/main/java/com/hous/hous_aos/ui/newrules/component/DayList.kt index 6401fa5a..8aba09be 100644 --- a/app/src/main/java/com/hous/hous_aos/ui/newrules/component/DayList.kt +++ b/app/src/main/java/com/hous/hous_aos/ui/newrules/component/DayList.kt @@ -5,8 +5,8 @@ import androidx.compose.foundation.lazy.LazyRow import androidx.compose.foundation.lazy.itemsIndexed import androidx.compose.runtime.Composable import androidx.compose.ui.unit.dp -import com.hous.hous_aos.ui.newrules.DayData -import com.hous.hous_aos.ui.newrules.Manager +import com.hous.data.entity.DayData +import com.hous.data.entity.Manager @Composable fun NewRulesDayList( diff --git a/app/src/main/java/com/hous/hous_aos/ui/newrules/component/ManagerBox.kt b/app/src/main/java/com/hous/hous_aos/ui/newrules/component/ManagerBox.kt index 41c53f6b..258d63a4 100644 --- a/app/src/main/java/com/hous/hous_aos/ui/newrules/component/ManagerBox.kt +++ b/app/src/main/java/com/hous/hous_aos/ui/newrules/component/ManagerBox.kt @@ -20,10 +20,10 @@ import androidx.compose.ui.text.font.FontFamily import androidx.compose.ui.text.font.FontStyle import androidx.compose.ui.unit.Dp import androidx.compose.ui.unit.dp -import com.hous.hous_aos.R import com.hous.data.entity.Homie +import com.hous.data.entity.Manager import com.hous.data.entity.State -import com.hous.hous_aos.ui.newrules.Manager +import com.hous.hous_aos.R @Composable fun ManagerBox( diff --git a/app/src/main/java/com/hous/hous_aos/ui/newrules/component/ManagerItem.kt b/app/src/main/java/com/hous/hous_aos/ui/newrules/component/ManagerItem.kt index febfe3f7..15ff07a6 100644 --- a/app/src/main/java/com/hous/hous_aos/ui/newrules/component/ManagerItem.kt +++ b/app/src/main/java/com/hous/hous_aos/ui/newrules/component/ManagerItem.kt @@ -8,10 +8,10 @@ import androidx.compose.runtime.Composable import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.unit.dp +import com.hous.data.entity.DayData import com.hous.data.entity.Homie +import com.hous.data.entity.Manager import com.hous.data.entity.State -import com.hous.hous_aos.ui.newrules.DayData -import com.hous.hous_aos.ui.newrules.Manager @Composable fun ManagerItem( diff --git a/app/src/main/java/com/hous/hous_aos/ui/profile/TendencyAdapter.kt b/app/src/main/java/com/hous/hous_aos/ui/profile/TendencyAdapter.kt index 539e37aa..a49e4378 100644 --- a/app/src/main/java/com/hous/hous_aos/ui/profile/TendencyAdapter.kt +++ b/app/src/main/java/com/hous/hous_aos/ui/profile/TendencyAdapter.kt @@ -5,6 +5,7 @@ import android.view.ViewGroup import androidx.recyclerview.widget.DiffUtil import androidx.recyclerview.widget.ListAdapter import androidx.recyclerview.widget.RecyclerView +import com.hous.data.entity.TypeTest import com.hous.hous_aos.databinding.ItemTendencyTestBinding class TendencyAdapter( @@ -70,12 +71,19 @@ class TendencyAdapter( } companion object { - private val tendencyDiffUtil = object : DiffUtil.ItemCallback() { - override fun areItemsTheSame(oldItem: com.hous.data.entity.TypeTest, newItem: com.hous.data.entity.TypeTest): Boolean = - oldItem.id == newItem.id + private val tendencyDiffUtil = + object : DiffUtil.ItemCallback() { + override fun areItemsTheSame( + oldItem: TypeTest, + newItem: TypeTest + ): Boolean = + oldItem.id == newItem.id - override fun areContentsTheSame(oldItem: com.hous.data.entity.TypeTest, newItem: com.hous.data.entity.TypeTest): Boolean = - oldItem == newItem - } + override fun areContentsTheSame( + oldItem: TypeTest, + newItem: TypeTest + ): Boolean = + oldItem == newItem + } } } diff --git a/app/src/main/java/com/hous/hous_aos/ui/profile/TendencyResultActivity.kt b/app/src/main/java/com/hous/hous_aos/ui/profile/TendencyResultActivity.kt index ab6c0d11..454f73e0 100644 --- a/app/src/main/java/com/hous/hous_aos/ui/profile/TendencyResultActivity.kt +++ b/app/src/main/java/com/hous/hous_aos/ui/profile/TendencyResultActivity.kt @@ -155,7 +155,8 @@ class TendencyResultActivity : AppCompatActivity() { binding.tvBad.setTextColor(ContextCompat.getColor(this, R.color.hous_red)) } "늘 행복한 동글이" -> { - binding.clBad.backgroundTintList = this.getColorStateList(R.color.hous_yellow_bg) + binding.clBad.backgroundTintList = + this.getColorStateList(R.color.hous_yellow_bg) binding.tvBad.setTextColor(ContextCompat.getColor(this, R.color.hous_yellow)) } "룸메 맞춤형 네각이" -> { @@ -163,7 +164,8 @@ class TendencyResultActivity : AppCompatActivity() { binding.tvBad.setTextColor(ContextCompat.getColor(this, R.color.hous_blue)) } "하이 레벨 오각이" -> { - binding.clBad.backgroundTintList = this.getColorStateList(R.color.hous_purple_bg) + binding.clBad.backgroundTintList = + this.getColorStateList(R.color.hous_purple_bg) binding.tvBad.setTextColor(ContextCompat.getColor(this, R.color.hous_purple)) } "룰 세터 육각이" -> { @@ -177,7 +179,8 @@ class TendencyResultActivity : AppCompatActivity() { binding.tvGood.setTextColor(ContextCompat.getColor(this, R.color.hous_red)) } "늘 행복한 동글이" -> { - binding.clGood.backgroundTintList = this.getColorStateList(R.color.hous_yellow_bg) + binding.clGood.backgroundTintList = + this.getColorStateList(R.color.hous_yellow_bg) binding.tvGood.setTextColor(ContextCompat.getColor(this, R.color.hous_yellow)) } "룸메 맞춤형 네각이" -> { @@ -185,14 +188,16 @@ class TendencyResultActivity : AppCompatActivity() { binding.tvGood.setTextColor(ContextCompat.getColor(this, R.color.hous_blue)) } "하이 레벨 오각이" -> { - binding.clGood.backgroundTintList = this.getColorStateList(R.color.hous_purple_bg) + binding.clGood.backgroundTintList = + this.getColorStateList(R.color.hous_purple_bg) binding.tvGood.setTextColor(ContextCompat.getColor(this, R.color.hous_purple)) } "룰 세터 육각이" -> { - binding.clGood.backgroundTintList = this.getColorStateList(R.color.hous_green_bg) + binding.clGood.backgroundTintList = + this.getColorStateList(R.color.hous_green_bg) binding.tvGood.setTextColor(ContextCompat.getColor(this, R.color.hous_green)) } } } } -} \ No newline at end of file +} diff --git a/app/src/main/java/com/hous/hous_aos/ui/profile/TendencyTestActivity.kt b/app/src/main/java/com/hous/hous_aos/ui/profile/TendencyTestActivity.kt index c5bfb261..83f4fa22 100644 --- a/app/src/main/java/com/hous/hous_aos/ui/profile/TendencyTestActivity.kt +++ b/app/src/main/java/com/hous/hous_aos/ui/profile/TendencyTestActivity.kt @@ -52,7 +52,7 @@ class TendencyTestActivity : AppCompatActivity() { viewModel.move.observe(this) { move -> if (move) { - if(binding.vpTendency.currentItem == 14){ + if (binding.vpTendency.currentItem == 14) { val intent = Intent(this, TendencyResultActivity::class.java) intent.putExtra("data", "end") // "back"면 백버튼, "end"면 완료버튼 startActivity(intent) diff --git a/app/src/main/java/com/hous/hous_aos/ui/profile/TestInfoActivity.kt b/app/src/main/java/com/hous/hous_aos/ui/profile/TestInfoActivity.kt index 76100e25..d8fe0131 100644 --- a/app/src/main/java/com/hous/hous_aos/ui/profile/TestInfoActivity.kt +++ b/app/src/main/java/com/hous/hous_aos/ui/profile/TestInfoActivity.kt @@ -14,11 +14,11 @@ class TestInfoActivity : AppCompatActivity() { init() } - private fun init(){ - binding.btnStart.setOnClickListener{ + private fun init() { + binding.btnStart.setOnClickListener { val intent = Intent(this, TendencyTestActivity::class.java) startActivity(intent) finish() } } -} \ No newline at end of file +} diff --git a/app/src/main/java/com/hous/hous_aos/ui/rules/HomieIcon.kt b/app/src/main/java/com/hous/hous_aos/ui/rules/HomieIconType.kt similarity index 100% rename from app/src/main/java/com/hous/hous_aos/ui/rules/HomieIcon.kt rename to app/src/main/java/com/hous/hous_aos/ui/rules/HomieIconType.kt diff --git a/app/src/main/java/com/hous/hous_aos/ui/rules/today_to_do/tem_dialog/TempManagerDialogFragment.kt b/app/src/main/java/com/hous/hous_aos/ui/rules/today_to_do/tem_dialog/TempManagerDialogFragment.kt index 5754530c..eda09214 100644 --- a/app/src/main/java/com/hous/hous_aos/ui/rules/today_to_do/tem_dialog/TempManagerDialogFragment.kt +++ b/app/src/main/java/com/hous/hous_aos/ui/rules/today_to_do/tem_dialog/TempManagerDialogFragment.kt @@ -12,7 +12,7 @@ import com.hous.hous_aos.R import com.hous.hous_aos.databinding.FragmentTempManagerBinding import com.hous.hous_aos.ui.rules.RulesViewModel -class TempManagerFragment : DialogFragment() { +class TempManagerDialogFragment : DialogFragment() { private var _binding: FragmentTempManagerBinding? = null private val binding get() = _binding ?: error("binding에 null 들어감") private val viewModel: RulesViewModel by activityViewModels() diff --git a/app/src/test/java/com/hous/hous_aos/ExampleUnitTest.kt b/app/src/test/java/com/hous/hous_aos/ExampleUnitTest.kt index 4949de16..1a64f177 100644 --- a/app/src/test/java/com/hous/hous_aos/ExampleUnitTest.kt +++ b/app/src/test/java/com/hous/hous_aos/ExampleUnitTest.kt @@ -1,9 +1,8 @@ package com.hous.hous_aos +import org.junit.Assert.assertEquals import org.junit.Test -import org.junit.Assert.* - /** * Example local unit test, which will execute on the development machine (host). * @@ -14,4 +13,4 @@ class ExampleUnitTest { fun addition_isCorrect() { assertEquals(4, 2 + 2) } -} \ No newline at end of file +} diff --git a/data/src/main/java/com/hous/data/api/ProfileApi.kt b/data/src/main/java/com/hous/data/api/ProfileApi.kt index 4d2e0ea1..a3805210 100644 --- a/data/src/main/java/com/hous/data/api/ProfileApi.kt +++ b/data/src/main/java/com/hous/data/api/ProfileApi.kt @@ -1,10 +1,5 @@ package com.hous.data.api -import com.hous.data.entity.Homie -import com.hous.data.model.WrapperClass -import com.hous.data.model.request.PutTestResultRequest -import com.hous.data.model.response.TypeTestResponse -import com.hous.data.entity.ResultData import retrofit2.http.Body import retrofit2.http.GET import retrofit2.http.PUT @@ -19,7 +14,7 @@ interface ProfileApi { ): com.hous.data.model.WrapperClass @GET("type/test") - suspend fun getTypeTestList(): com.hous.data.model.WrapperClass + suspend fun getTypeTestList(): com.hous.data.model.WrapperClass @GET("user/me/type") suspend fun getMyResult(): com.hous.data.model.WrapperClass diff --git a/data/src/main/java/com/hous/data/model/response/TypeTestListResponse.kt b/data/src/main/java/com/hous/data/model/response/TypeTestListResponse.kt index a3b388cf..3cba47bb 100644 --- a/data/src/main/java/com/hous/data/model/response/TypeTestListResponse.kt +++ b/data/src/main/java/com/hous/data/model/response/TypeTestListResponse.kt @@ -2,6 +2,6 @@ package com.hous.data.model.response import com.hous.data.entity.TypeTest -data class TypeTestResponse( +data class TypeTestListResponse( val typeTests: List ) diff --git a/data/src/main/java/com/hous/data/repository/NewRulesRepository.kt b/data/src/main/java/com/hous/data/repository/NewRulesRepository.kt index 4eacd103..28294172 100644 --- a/data/src/main/java/com/hous/data/repository/NewRulesRepository.kt +++ b/data/src/main/java/com/hous/data/repository/NewRulesRepository.kt @@ -1,9 +1,17 @@ package com.hous.data.repository +import com.hous.data.entity.Manager +import com.hous.data.entity.State import com.hous.data.model.WrapperClass -import com.hous.hous_aos.ui.newrules.NewRulesUiState interface NewRulesRepository { - suspend fun addNewRule(newRulesUiState: NewRulesUiState): Result> + suspend fun addNewRule( + ruleName: String, + categoryId: String, + notificationState: Boolean, + checkBoxState: State, + managerList: List + ): Result> + suspend fun getNewRuleList(roomId: String): Result> } diff --git a/data/src/main/java/com/hous/data/repository/NewRulesRepositoryImpl.kt b/data/src/main/java/com/hous/data/repository/NewRulesRepositoryImpl.kt index efb6db8d..4868b6ce 100644 --- a/data/src/main/java/com/hous/data/repository/NewRulesRepositoryImpl.kt +++ b/data/src/main/java/com/hous/data/repository/NewRulesRepositoryImpl.kt @@ -1,21 +1,27 @@ package com.hous.data.repository import android.util.Log +import com.hous.data.entity.DayData +import com.hous.data.entity.Manager +import com.hous.data.entity.State import com.hous.data.model.WrapperClass import com.hous.data.model.request.Member import com.hous.data.model.request.NewRulesRequest import com.hous.data.model.response.NewRulesListResponse import com.hous.data.source.remote.RemoteNewRulesDataSource -import com.hous.hous_aos.ui.newrules.DayData -import com.hous.hous_aos.ui.newrules.NewRulesUiState -import com.hous.hous_aos.ui.newrules.component.State import javax.inject.Inject class NewRulesRepositoryImpl @Inject constructor( private val remoteNewRulesDataSource: RemoteNewRulesDataSource ) : NewRulesRepository { - override suspend fun addNewRule(newRulesUiState: NewRulesUiState): Result> { - val ruleMember = newRulesUiState.ManagerList.map { + override suspend fun addNewRule( + ruleName: String, + categoryId: String, + notificationState: Boolean, + checkBoxState: State, + managerList: List + ): Result> { + val ruleMember = managerList.map { val dayList = dayToInt(it.dayDataList) Member( userId = it.managerHomie.id, @@ -23,11 +29,11 @@ class NewRulesRepositoryImpl @Inject constructor( ) } val newRulesRequest = NewRulesRequest( - notificationState = newRulesUiState.notificationState, - ruleName = newRulesUiState.ruleName, - categoryId = newRulesUiState.categoryId, - isKeyRules = newRulesUiState.checkBoxState == State.SELECT, - ruleMembers = if (newRulesUiState.checkBoxState != State.SELECT) ruleMember else emptyList() + notificationState = notificationState, + ruleName = ruleName, + categoryId = categoryId, + isKeyRules = checkBoxState == State.SELECT, + ruleMembers = if (checkBoxState != State.SELECT) ruleMember else emptyList() ) Log.d("NewRulesViewModel", "repository rules data: $newRulesRequest") return runCatching { remoteNewRulesDataSource.addNewRule(newRulesRequest) } diff --git a/data/src/main/java/com/hous/data/repository/ProfileRepository.kt b/data/src/main/java/com/hous/data/repository/ProfileRepository.kt index cd001ed7..403a39ad 100644 --- a/data/src/main/java/com/hous/data/repository/ProfileRepository.kt +++ b/data/src/main/java/com/hous/data/repository/ProfileRepository.kt @@ -4,11 +4,11 @@ import com.hous.data.entity.Homie import com.hous.data.entity.ResultData import com.hous.data.model.WrapperClass import com.hous.data.model.request.PutTestResultRequest -import com.hous.data.model.response.TypeTestResponse +import com.hous.data.model.response.TypeTestListResponse interface ProfileRepository { suspend fun getUserProfile(): Result> suspend fun putTestResult(typeScore: PutTestResultRequest): Result> - suspend fun getTypeTestList(): Result> + suspend fun getTypeTestList(): Result> suspend fun getMyResult(): Result> } diff --git a/data/src/main/java/com/hous/data/repository/ProfileRepositoryImpl.kt b/data/src/main/java/com/hous/data/repository/ProfileRepositoryImpl.kt index d2adadab..98224dc7 100644 --- a/data/src/main/java/com/hous/data/repository/ProfileRepositoryImpl.kt +++ b/data/src/main/java/com/hous/data/repository/ProfileRepositoryImpl.kt @@ -4,7 +4,7 @@ import com.hous.data.entity.Homie import com.hous.data.entity.ResultData import com.hous.data.model.WrapperClass import com.hous.data.model.request.PutTestResultRequest -import com.hous.data.model.response.TypeTestResponse +import com.hous.data.model.response.TypeTestListResponse import com.hous.data.source.remote.RemoteProfileDataSource import javax.inject.Inject @@ -17,7 +17,7 @@ class ProfileRepositoryImpl @Inject constructor( override suspend fun putTestResult(typeScore: PutTestResultRequest): Result> = runCatching { profileDataSource.putTestResult(typeScore) } - override suspend fun getTypeTestList(): Result> = + override suspend fun getTypeTestList(): Result> = runCatching { profileDataSource.getTypeTestList() } override suspend fun getMyResult(): Result> = diff --git a/data/src/main/java/com/hous/data/source/remote/RemoteHomeDataSourceImpl.kt b/data/src/main/java/com/hous/data/source/remote/RemoteHomeDataSourceImpl.kt index d313cb69..6b487eb1 100644 --- a/data/src/main/java/com/hous/data/source/remote/RemoteHomeDataSourceImpl.kt +++ b/data/src/main/java/com/hous/data/source/remote/RemoteHomeDataSourceImpl.kt @@ -1,5 +1,6 @@ package com.hous.data.source.remote +import com.hous.data.BuildConfig import com.hous.data.api.HomeApi import com.hous.data.entity.Event import com.hous.data.entity.Homie @@ -7,7 +8,6 @@ import com.hous.data.entity.ResultData import com.hous.data.model.WrapperClass import com.hous.data.model.request.EventListRequest import com.hous.data.model.response.HomeResponse -import com.hous.hous_aos.BuildConfig import javax.inject.Inject class RemoteHomeDataSourceImpl @Inject constructor( diff --git a/data/src/main/java/com/hous/data/source/remote/RemoteNewRulesDataSourceImpl.kt b/data/src/main/java/com/hous/data/source/remote/RemoteNewRulesDataSourceImpl.kt index c0a519be..22482453 100644 --- a/data/src/main/java/com/hous/data/source/remote/RemoteNewRulesDataSourceImpl.kt +++ b/data/src/main/java/com/hous/data/source/remote/RemoteNewRulesDataSourceImpl.kt @@ -1,10 +1,10 @@ package com.hous.data.source.remote +import com.hous.data.BuildConfig import com.hous.data.api.NewRulesApi import com.hous.data.model.WrapperClass import com.hous.data.model.request.NewRulesRequest import com.hous.data.model.response.NewRulesListResponse -import com.hous.hous_aos.BuildConfig import javax.inject.Inject class RemoteNewRulesDataSourceImpl @Inject constructor( diff --git a/data/src/main/java/com/hous/data/source/remote/RemoteProfileDataSource.kt b/data/src/main/java/com/hous/data/source/remote/RemoteProfileDataSource.kt index b0195048..8779d51a 100644 --- a/data/src/main/java/com/hous/data/source/remote/RemoteProfileDataSource.kt +++ b/data/src/main/java/com/hous/data/source/remote/RemoteProfileDataSource.kt @@ -4,11 +4,11 @@ import com.hous.data.entity.Homie import com.hous.data.entity.ResultData import com.hous.data.model.WrapperClass import com.hous.data.model.request.PutTestResultRequest -import com.hous.data.model.response.TypeTestResponse +import com.hous.data.model.response.TypeTestListResponse interface RemoteProfileDataSource { suspend fun getUserProfile(): WrapperClass suspend fun putTestResult(typeScore: PutTestResultRequest): WrapperClass - suspend fun getTypeTestList(): WrapperClass + suspend fun getTypeTestList(): WrapperClass suspend fun getMyResult(): WrapperClass } diff --git a/data/src/main/java/com/hous/data/source/remote/RemoteProfileDataSourceImpl.kt b/data/src/main/java/com/hous/data/source/remote/RemoteProfileDataSourceImpl.kt index 9d29f5ca..0b99e418 100644 --- a/data/src/main/java/com/hous/data/source/remote/RemoteProfileDataSourceImpl.kt +++ b/data/src/main/java/com/hous/data/source/remote/RemoteProfileDataSourceImpl.kt @@ -1,12 +1,12 @@ package com.hous.data.source.remote +import com.hous.data.BuildConfig import com.hous.data.api.ProfileApi import com.hous.data.entity.Homie import com.hous.data.entity.ResultData import com.hous.data.model.WrapperClass import com.hous.data.model.request.PutTestResultRequest -import com.hous.data.model.response.TypeTestResponse -import com.hous.hous_aos.BuildConfig +import com.hous.data.model.response.TypeTestListResponse import javax.inject.Inject class RemoteProfileDataSourceImpl @Inject constructor( @@ -18,7 +18,7 @@ class RemoteProfileDataSourceImpl @Inject constructor( override suspend fun putTestResult(typeScore: PutTestResultRequest): WrapperClass = profileApi.putTestResult(typeScore) - override suspend fun getTypeTestList(): WrapperClass = + override suspend fun getTypeTestList(): WrapperClass = profileApi.getTypeTestList() override suspend fun getMyResult(): WrapperClass = diff --git a/data/src/main/java/com/hous/data/source/remote/RemoteRulesTodayDataSourceImpl.kt b/data/src/main/java/com/hous/data/source/remote/RemoteRulesTodayDataSourceImpl.kt index e6c3010d..64db47b4 100644 --- a/data/src/main/java/com/hous/data/source/remote/RemoteRulesTodayDataSourceImpl.kt +++ b/data/src/main/java/com/hous/data/source/remote/RemoteRulesTodayDataSourceImpl.kt @@ -1,5 +1,6 @@ package com.hous.data.source.remote +import com.hous.data.BuildConfig import com.hous.data.api.RulesApi import com.hous.data.entity.Rule import com.hous.data.model.WrapperClass @@ -8,7 +9,6 @@ import com.hous.data.model.response.RulesTableResponse import com.hous.data.model.response.RulesTodayInfoListResponse import com.hous.data.model.response.TempManagerRequest import com.hous.data.model.response.TempManagerResponse -import com.hous.hous_aos.BuildConfig import javax.inject.Inject class RemoteRulesTodayDataSourceImpl @Inject constructor( From 5355d9aab608b5dbc6c1d97b9768bd337c023326 Mon Sep 17 00:00:00 2001 From: KWY0218 Date: Fri, 5 Aug 2022 11:07:47 +0900 Subject: [PATCH 09/11] =?UTF-8?q?#173=20[chore]=20ktlint=20=EC=84=A4?= =?UTF-8?q?=EC=A0=95=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .idea/ktlint.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/.idea/ktlint.xml b/.idea/ktlint.xml index 54c933ed..3938edfe 100644 --- a/.idea/ktlint.xml +++ b/.idea/ktlint.xml @@ -4,6 +4,7 @@ From 61ccd08adc51aca715b8a0cf91a3132a5d5c5cb2 Mon Sep 17 00:00:00 2001 From: KWY0218 Date: Fri, 5 Aug 2022 11:09:52 +0900 Subject: [PATCH 10/11] =?UTF-8?q?#173=20[chore]=20class=20=EB=AA=85=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../hous_aos/ui/rules/today_to_do/TodayToDoFragment.kt | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/com/hous/hous_aos/ui/rules/today_to_do/TodayToDoFragment.kt b/app/src/main/java/com/hous/hous_aos/ui/rules/today_to_do/TodayToDoFragment.kt index 82dcc68e..18385389 100644 --- a/app/src/main/java/com/hous/hous_aos/ui/rules/today_to_do/TodayToDoFragment.kt +++ b/app/src/main/java/com/hous/hous_aos/ui/rules/today_to_do/TodayToDoFragment.kt @@ -15,7 +15,7 @@ import com.hous.hous_aos.ui.rules.RulesViewModel import com.hous.hous_aos.ui.rules.ToDoViewType import com.hous.hous_aos.ui.rules.adapter.TodayTodoAdapter import com.hous.hous_aos.ui.rules.my_to_do.MyToDoFragment -import com.hous.hous_aos.ui.rules.today_to_do.tem_dialog.TempManagerFragment +import com.hous.hous_aos.ui.rules.today_to_do.tem_dialog.TempManagerDialogFragment import dagger.hilt.android.AndroidEntryPoint @AndroidEntryPoint @@ -51,12 +51,13 @@ class TodayToDoFragment : Fragment() { } private fun onClickTmpManagerDialog() { - val dialog = TempManagerFragment() + val dialog = TempManagerDialogFragment() dialog.show(childFragmentManager, TEMP_MANAGER_DIALOG_TAG) } private fun initAdapter() { - todayTodDoAdapter = TodayTodoAdapter(::onClickTmpManagerDialog, viewModel::fetchToTmpManagerList) + todayTodDoAdapter = + TodayTodoAdapter(::onClickTmpManagerDialog, viewModel::fetchToTmpManagerList) binding.rvToDo.adapter = todayTodDoAdapter } From 78f80348259cb68e6e32c7cea73e4b8b2e55031f Mon Sep 17 00:00:00 2001 From: KWY0218 Date: Fri, 5 Aug 2022 13:15:27 +0900 Subject: [PATCH 11/11] =?UTF-8?q?#173=20[add]=20lint=20=EA=B2=BD=EA=B3=A0?= =?UTF-8?q?=20=EB=AC=B4=EC=8B=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/build.gradle.kts | 4 + app/lint-baseline.xml | 1913 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 1917 insertions(+) create mode 100644 app/lint-baseline.xml diff --git a/app/build.gradle.kts b/app/build.gradle.kts index ef25e63d..b71a680b 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -17,6 +17,10 @@ android { kotlinCompilerExtensionVersion = Versions.composeVersion } + lint { + baseline = file("lint-baseline.xml") + } + buildFeatures { viewBinding = true dataBinding = true diff --git a/app/lint-baseline.xml b/app/lint-baseline.xml new file mode 100644 index 00000000..d561283d --- /dev/null +++ b/app/lint-baseline.xml @@ -0,0 +1,1913 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +