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 @@ 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..b71a680b --- /dev/null +++ b/app/build.gradle.kts @@ -0,0 +1,131 @@ +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 + } + + lint { + baseline = file("lint-baseline.xml") + } + + 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/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 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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/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/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/model/response/NewRulesListResponse.kt b/app/src/main/java/com/hous/hous_aos/data/model/response/NewRulesListResponse.kt deleted file mode 100644 index 91a7c376..00000000 --- a/app/src/main/java/com/hous/hous_aos/data/model/response/NewRulesListResponse.kt +++ /dev/null @@ -1,9 +0,0 @@ -package com.hous.hous_aos.data.model.response - -import com.hous.hous_aos.data.entity.Category -import com.hous.hous_aos.data.entity.Homie - -data class NewRulesListResponse( - val ruleCategories: List = emptyList(), - val homies: List = emptyList() -) diff --git a/app/src/main/java/com/hous/hous_aos/data/model/response/TypeTestListResponse.kt b/app/src/main/java/com/hous/hous_aos/data/model/response/TypeTestListResponse.kt deleted file mode 100644 index 288bb3c8..00000000 --- a/app/src/main/java/com/hous/hous_aos/data/model/response/TypeTestListResponse.kt +++ /dev/null @@ -1,7 +0,0 @@ -package com.hous.hous_aos.data.model.response - -import com.hous.hous_aos.ui.profile.TypeTest - -data class TypeTestResponse( - val typeTests: 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 deleted file mode 100644 index b637728d..00000000 --- a/app/src/main/java/com/hous/hous_aos/data/repository/NewRulesRepository.kt +++ /dev/null @@ -1,10 +0,0 @@ -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.hous_aos.ui.newrules.NewRulesUiState - -interface NewRulesRepository { - 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/ProfileRepository.kt b/app/src/main/java/com/hous/hous_aos/data/repository/ProfileRepository.kt deleted file mode 100644 index 5f767ebb..00000000 --- a/app/src/main/java/com/hous/hous_aos/data/repository/ProfileRepository.kt +++ /dev/null @@ -1,14 +0,0 @@ -package com.hous.hous_aos.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 - -interface ProfileRepository { - suspend fun getUserProfile(): Result> - suspend fun putTestResult(typeScore: PutTestResultRequest): Result> - suspend fun getTypeTestList(): Result> - suspend fun getMyResult(): Result> -} 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..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 @@ -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 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..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.data.source.local.LocalDataSource 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 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) @@ -48,7 +44,7 @@ object NetworkModule { @Provides @Singleton fun providesHousOkHttpClient( - interceptor: Interceptor, + interceptor: Interceptor ): OkHttpClient = OkHttpClient.Builder() .connectTimeout(15, TimeUnit.SECONDS) @@ -78,21 +74,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..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 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..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,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.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.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 @@ -40,5 +40,4 @@ object RepositoryModule { fun providesHomeRepository( 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 38b166e8..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,20 +4,15 @@ 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 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( - private val homeRepository: HomeRepository + private val homeRepository: com.hous.data.repository.HomeRepository ) : ViewModel() { private var _tmpEventId = MutableLiveData("") val tmpEventId get() = _tmpEventId @@ -28,7 +23,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 +32,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 // 받아올 때 @@ -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,8 +136,9 @@ class EventViewModel @Inject constructor( } viewModelScope.launch { homeRepository.putEventList( - "", _tmpEventId.value!!, - EventListRequest( + "", + _tmpEventId.value!!, + com.hous.data.model.request.EventListRequest( eventName = eventName.value!!, date = eventDate.value!!, participants = clickedTmpManagerList, @@ -158,16 +156,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 +176,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 +200,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 +229,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/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 aff6a907..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 @@ -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 +import kotlinx.coroutines.launch @HiltViewModel class RommateViewModel @Inject constructor( private val homeRepository: HomeRepository ) : ViewModel() { - private val _homieData = MutableLiveData(Homie(typeScore = listOf(3, 3, 3, 3, 3))) + private val _homieData = MutableLiveData( + 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/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 5ae1c85e..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,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.data.entity.Event import com.hous.hous_aos.R -import com.hous.hous_aos.data.entity.Event import com.hous.hous_aos.databinding.ItemHomeEventBinding class EventAdapter( @@ -27,10 +27,10 @@ class EventAdapter( class EventViewHolder( val binding: ItemHomeEventBinding, - private val onClickEventIcon: (Int) -> Unit, + 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,17 @@ 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..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 @@ -5,7 +5,7 @@ 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 @@ -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 { @@ -56,14 +56,21 @@ class EventParticipantAdapter(private val setSelectedEventParticipant: (Int) -> } companion object { - private val eventParticipantDiffUtil = object : DiffUtil.ItemCallback() { - override fun areItemsTheSame(oldItem: Homie, newItem: 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: Homie, newItem: 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 c06ebf12..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 @@ -1,19 +1,18 @@ 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.data.entity.Homie import com.hous.hous_aos.R -import com.hous.hous_aos.data.entity.Homie 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) { @@ -125,4 +124,4 @@ class HomieAdapter( 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/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/home/adapter/ToDoAdapter.kt b/app/src/main/java/com/hous/hous_aos/ui/home/adapter/ToDoAdapter.kt index 233337d7..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 @@ -5,7 +5,7 @@ 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) { 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..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.hous_aos.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 +176,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..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 @@ -3,10 +3,10 @@ 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.hous_aos.data.repository.NewRulesRepository -import com.hous.hous_aos.ui.newrules.component.State +import com.hous.data.entity.DayData +import com.hous.data.entity.Manager +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 @@ -19,7 +19,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 +37,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 +110,7 @@ class NewRulesViewModel @Inject constructor( DayData("목", State.UNSELECT), DayData("금", State.UNSELECT), DayData("토", State.UNSELECT), - DayData("일", State.UNSELECT), + DayData("일", State.UNSELECT) ) ) ) @@ -126,7 +126,7 @@ class NewRulesViewModel @Inject constructor( DayData("목", State.BLOCK), DayData("금", State.BLOCK), DayData("토", State.BLOCK), - DayData("일", State.BLOCK), + DayData("일", State.BLOCK) ) ) ) @@ -147,10 +147,11 @@ class NewRulesViewModel @Inject constructor( } } - fun choiceManager(managerIndex: Int, homie: Homie) { - if (uiState.value.ManagerList[managerIndex].managerHomie.userName != "담당자 없음") + 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 + } val tempManager = Manager( managerHomie = homie, dayDataList = uiState.value.ManagerList[managerIndex].dayDataList @@ -189,17 +190,27 @@ 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}") } } } - 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 } @@ -223,8 +234,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) + } } } } @@ -240,45 +252,27 @@ 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, "이영주" to true, "이준원" to true, "최인영" to true, - "최소현" to true, + "최소현" to true ), val ManagerList: List = listOf(Manager()) ) - -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), - ) -) - -data class DayData( - val day: String, - val dayState: State -) 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..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 @@ -17,7 +17,7 @@ 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( 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..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 @@ -19,7 +19,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.Category +import com.hous.data.entity.Category @Composable fun CategoryItem( 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..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,8 +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( @@ -57,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/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/ManagerAddButton.kt b/app/src/main/java/com/hous/hous_aos/ui/newrules/component/ManagerAddButton.kt index d37789ee..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 @@ -17,7 +17,7 @@ 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 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..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,9 +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.data.entity.Homie +import com.hous.data.entity.Manager +import com.hous.data.entity.State import com.hous.hous_aos.R -import com.hous.hous_aos.data.entity.Homie -import com.hous.hous_aos.ui.newrules.Manager @Composable fun ManagerBox( 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..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 @@ -30,7 +30,8 @@ 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.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 7ba300ed..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,9 +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.hous_aos.data.entity.Homie -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.Homie +import com.hous.data.entity.Manager +import com.hous.data.entity.State @Composable fun ManagerItem( 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/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..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 @@ -4,8 +4,8 @@ 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 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..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 @@ -4,12 +4,12 @@ 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 +import kotlinx.coroutines.launch @HiltViewModel class ResultViewModel @Inject constructor( @@ -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/TendencyAdapter.kt b/app/src/main/java/com/hous/hous_aos/ui/profile/TendencyAdapter.kt index 8646bc4b..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,16 +5,17 @@ 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( - 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 +29,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 +61,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,12 +71,19 @@ class TendencyAdapter( } companion object { - private val tendencyDiffUtil = object : DiffUtil.ItemCallback() { - override fun areItemsTheSame(oldItem: TypeTest, newItem: 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: TypeTest, newItem: 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/TendencyViewModel.kt b/app/src/main/java/com/hous/hous_aos/ui/profile/TendencyViewModel.kt index c6a89b01..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,8 +5,7 @@ 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.repository.ProfileRepository import dagger.hilt.android.lifecycle.HiltViewModel import javax.inject.Inject import kotlinx.coroutines.delay @@ -28,15 +27,15 @@ class TendencyViewModel @Inject constructor( profileRepository.getTypeTestList() .onSuccess { Log.d("TendencyViewModel", "success ${it.data!!.typeTests}") - val tempList = it.data.typeTests.map { typeTest -> - TypeTest( + val tempList = it.data!!.typeTests.map { 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 +46,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 +77,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 +91,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/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/HomeRulesCategoryAdapter.kt b/app/src/main/java/com/hous/hous_aos/ui/rules/HomeRulesCategoryAdapter.kt index 7e21d704..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,15 +6,15 @@ import androidx.annotation.DrawableRes import androidx.recyclerview.widget.DiffUtil import androidx.recyclerview.widget.ListAdapter import androidx.recyclerview.widget.RecyclerView +import com.hous.data.entity.Category import com.hous.hous_aos.R -import com.hous.hous_aos.data.entity.Category 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( CategoryOfRuleDiffUtilCallback @@ -55,7 +55,9 @@ class HomeRulesCategoryAdapter( onCategoryClick, onChangeIsSelected, ItemRulesRuleBinding.inflate( - LayoutInflater.from(parent.context), parent, false + LayoutInflater.from(parent.context), + parent, + false ) ) } @@ -77,7 +79,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 +100,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 +112,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/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/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 5b681961..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 @@ -5,15 +5,14 @@ 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.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( @@ -22,7 +21,7 @@ class RulesViewModel @Inject constructor( 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 = @@ -51,7 +50,7 @@ class RulesViewModel @Inject constructor( 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,7 +64,7 @@ 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( Category( id = "62d6b94e0e9be86f165d48db", @@ -185,7 +184,11 @@ 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..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 @@ -5,7 +5,7 @@ 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) : @@ -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, 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..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 @@ -6,7 +6,7 @@ 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 @@ -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 { 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..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 @@ -5,7 +5,7 @@ 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 : 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 } 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..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,8 +6,7 @@ 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.Rule import com.hous.hous_aos.databinding.ItemRulesTodayToDoItemMultiBinding import com.hous.hous_aos.databinding.ItemRulesTodayToDoItemNoneBinding import com.hous.hous_aos.databinding.ItemRulesTodayToDoItemOneBinding @@ -82,7 +81,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 +96,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 +109,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 +132,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 +167,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) { 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..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 @@ -11,9 +11,8 @@ 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() { +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/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..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 @@ -5,7 +5,7 @@ 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 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..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,7 +1,7 @@ package com.hous.hous_aos.util +import com.hous.data.entity.ColorSet import com.hous.hous_aos.R -import com.hous.hous_aos.data.entity.ColorSet fun String.getColorSet(colorType: String): ColorSet { return when (colorType) { 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" /> + + + \ No newline at end of file diff --git a/app/src/main/java/com/hous/hous_aos/data/api/HomeApi.kt b/data/src/main/java/com/hous/data/api/HomeApi.kt similarity index 52% rename from app/src/main/java/com/hous/hous_aos/data/api/HomeApi.kt rename to data/src/main/java/com/hous/data/api/HomeApi.kt index d0cb7e90..7850477b 100644 --- a/app/src/main/java/com/hous/hous_aos/data/api/HomeApi.kt +++ b/data/src/main/java/com/hous/data/api/HomeApi.kt @@ -1,51 +1,51 @@ -package com.hous.hous_aos.data.api - -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 +package com.hous.data.api + +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 retrofit2.http.* interface HomeApi { @GET("room/{roomId}/home") suspend fun getHomeList( @Path("roomId") roomId: String - ): WrapperClass + ): 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..a3805210 --- /dev/null +++ b/data/src/main/java/com/hous/data/api/ProfileApi.kt @@ -0,0 +1,21 @@ +package com.hous.data.api + +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/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/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/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/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/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/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 72% 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..36b36ee9 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,7 +1,7 @@ -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 +import com.hous.data.entity.Homie data class EventResponse( @SerializedName("_id") val id: String, 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 52% 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..18cf9468 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,8 +1,8 @@ -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 -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/NewRulesListResponse.kt b/data/src/main/java/com/hous/data/model/response/NewRulesListResponse.kt new file mode 100644 index 00000000..c3f96067 --- /dev/null +++ b/data/src/main/java/com/hous/data/model/response/NewRulesListResponse.kt @@ -0,0 +1,9 @@ +package com.hous.data.model.response + +import com.hous.data.entity.Category +import com.hous.data.entity.Homie + +data class NewRulesListResponse( + val ruleCategories: List = emptyList(), + val homies: List = emptyList() +) 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 50% 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..52b8b67d 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,6 +1,6 @@ -package com.hous.hous_aos.data.model.response +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/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 52% 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..52fb05b4 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,9 +1,9 @@ -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 +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/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 66% 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..9b51706e 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,7 +1,7 @@ -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 +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 new file mode 100644 index 00000000..3cba47bb --- /dev/null +++ b/data/src/main/java/com/hous/data/model/response/TypeTestListResponse.kt @@ -0,0 +1,7 @@ +package com.hous.data.model.response + +import com.hous.data.entity.TypeTest + +data class TypeTestListResponse( + val typeTests: List +) 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/data/src/main/java/com/hous/data/repository/NewRulesRepository.kt b/data/src/main/java/com/hous/data/repository/NewRulesRepository.kt new file mode 100644 index 00000000..28294172 --- /dev/null +++ b/data/src/main/java/com/hous/data/repository/NewRulesRepository.kt @@ -0,0 +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 + +interface NewRulesRepository { + suspend fun addNewRule( + ruleName: String, + categoryId: String, + notificationState: Boolean, + checkBoxState: State, + managerList: List + ): Result> + + suspend fun getNewRuleList(roomId: String): Result> +} 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 51% 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 fbd01439..4868b6ce 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,21 +1,27 @@ -package com.hous.hous_aos.data.repository +package com.hous.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.hous_aos.ui.newrules.DayData -import com.hous.hous_aos.ui.newrules.NewRulesUiState -import com.hous.hous_aos.ui.newrules.component.State +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 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 new file mode 100644 index 00000000..403a39ad --- /dev/null +++ b/data/src/main/java/com/hous/data/repository/ProfileRepository.kt @@ -0,0 +1,14 @@ +package com.hous.data.repository + +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.TypeTestListResponse + +interface ProfileRepository { + suspend fun getUserProfile(): Result> + suspend fun putTestResult(typeScore: PutTestResultRequest): Result> + suspend fun getTypeTestList(): Result> + suspend fun getMyResult(): 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 64% 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..98224dc7 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,11 +1,11 @@ -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.TypeTestListResponse +import com.hous.data.source.remote.RemoteProfileDataSource import javax.inject.Inject class ProfileRepositoryImpl @Inject constructor( @@ -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/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 77% 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..bbf4f730 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,19 @@ -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 com.hous.data.source.remote.RemoteRulesTodayDataSource import javax.inject.Inject class RulesTodayRepositoryImpl @Inject constructor( private val remoteRulesTodayDataSource: 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 73% 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..6b487eb1 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 - -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 +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 +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 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 61% 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..22482453 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.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 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 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..8779d51a --- /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.TypeTestListResponse + +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 60% 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..0b99e418 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.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 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.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/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 65% 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..64db47b4 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 - -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 +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 +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 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) } 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.kts similarity index 90% rename from settings.gradle rename to settings.gradle.kts index f76033e6..e254bb12 100644 --- a/settings.gradle +++ b/settings.gradle.kts @@ -13,4 +13,5 @@ dependencyResolutionManagement { } } rootProject.name = "Hous-Aos" -include ':app' +include(":app") +include(":data")