From d7560affb6411710a5b8d9d3f2a6afe550cd5367 Mon Sep 17 00:00:00 2001 From: 0zlrlo <99941493+0zlrlo@users.noreply.github.com> Date: Fri, 13 Jan 2023 04:30:51 +0900 Subject: [PATCH 1/3] =?UTF-8?q?[ADD/#49]=20=EC=84=9C=EB=B2=84=ED=86=B5?= =?UTF-8?q?=EC=8B=A0=20=EA=B8=B0=EB=B3=B8=20=EC=84=B8=ED=8C=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../model/request/RequestPostUserLogInDto.kt | 11 +++++++++++ .../model/response/ResponsePostUserLogInDto.kt | 6 ++++++ .../keyneez/data/repository/UserRepository.kt | 14 ++++++-------- .../data/repository/UserRepositoryImpl.kt | 15 +++++++-------- .../java/com/keyneez/data/service/UserService.kt | 16 ++++++++-------- .../com/keyneez/data/source/UserDataSource.kt | 15 +++++++-------- app/src/main/res/layout/bot_sheet_id_profile.xml | 3 +-- app/src/main/res/layout/fragment_id.xml | 2 +- 8 files changed, 47 insertions(+), 35 deletions(-) create mode 100644 app/src/main/java/com/keyneez/data/model/request/RequestPostUserLogInDto.kt create mode 100644 app/src/main/java/com/keyneez/data/model/response/ResponsePostUserLogInDto.kt diff --git a/app/src/main/java/com/keyneez/data/model/request/RequestPostUserLogInDto.kt b/app/src/main/java/com/keyneez/data/model/request/RequestPostUserLogInDto.kt new file mode 100644 index 0000000..9d3dac2 --- /dev/null +++ b/app/src/main/java/com/keyneez/data/model/request/RequestPostUserLogInDto.kt @@ -0,0 +1,11 @@ +package com.keyneez.data.model.request + +import kotlinx.serialization.SerialName + +@kotlinx.serialization.Serializable +data class RequestPostUserLogInDto( + @SerialName("user_phone") + val phone: String, + @SerialName("user_password") + val password: String +) diff --git a/app/src/main/java/com/keyneez/data/model/response/ResponsePostUserLogInDto.kt b/app/src/main/java/com/keyneez/data/model/response/ResponsePostUserLogInDto.kt new file mode 100644 index 0000000..3fcbba9 --- /dev/null +++ b/app/src/main/java/com/keyneez/data/model/response/ResponsePostUserLogInDto.kt @@ -0,0 +1,6 @@ +package com.keyneez.data.model.response + +@kotlinx.serialization.Serializable +data class ResponsePostUserLogInDto( + val accessToken: String +) diff --git a/app/src/main/java/com/keyneez/data/repository/UserRepository.kt b/app/src/main/java/com/keyneez/data/repository/UserRepository.kt index 62fe346..17d0908 100644 --- a/app/src/main/java/com/keyneez/data/repository/UserRepository.kt +++ b/app/src/main/java/com/keyneez/data/repository/UserRepository.kt @@ -1,13 +1,7 @@ package com.keyneez.data.repository -import com.keyneez.data.model.request.RequestPatchPwdSignupDto -import com.keyneez.data.model.request.RequestPatchUserTypeDto -import com.keyneez.data.model.request.RequestPostDanalSignupDto -import com.keyneez.data.model.request.RequestPostPwdCheckDto -import com.keyneez.data.model.response.ResponseIdDto -import com.keyneez.data.model.response.ResponsePatchPwdSignupDto -import com.keyneez.data.model.response.ResponsePatchUserTypeDto -import com.keyneez.data.model.response.ResponsePostDanalSignupDto +import com.keyneez.data.model.request.* +import com.keyneez.data.model.response.* import com.keyneez.data.model.response.wrapper.BaseResponse interface UserRepository { @@ -22,6 +16,10 @@ interface UserRepository { requestPostDanalSignupDto: RequestPostDanalSignupDto ): Result> + suspend fun postUserLogIn( + requestPostUserLogInDto: RequestPostUserLogInDto + ): Result> + suspend fun getId(): Result> suspend fun patchUserTypeSignup( diff --git a/app/src/main/java/com/keyneez/data/repository/UserRepositoryImpl.kt b/app/src/main/java/com/keyneez/data/repository/UserRepositoryImpl.kt index e0a4370..1158c48 100644 --- a/app/src/main/java/com/keyneez/data/repository/UserRepositoryImpl.kt +++ b/app/src/main/java/com/keyneez/data/repository/UserRepositoryImpl.kt @@ -1,13 +1,7 @@ package com.keyneez.data.repository -import com.keyneez.data.model.request.RequestPatchPwdSignupDto -import com.keyneez.data.model.request.RequestPatchUserTypeDto -import com.keyneez.data.model.request.RequestPostDanalSignupDto -import com.keyneez.data.model.request.RequestPostPwdCheckDto -import com.keyneez.data.model.response.ResponseIdDto -import com.keyneez.data.model.response.ResponsePatchPwdSignupDto -import com.keyneez.data.model.response.ResponsePatchUserTypeDto -import com.keyneez.data.model.response.ResponsePostDanalSignupDto +import com.keyneez.data.model.request.* +import com.keyneez.data.model.response.* import com.keyneez.data.model.response.wrapper.BaseResponse import com.keyneez.data.source.LocalPrefDataSource import com.keyneez.data.source.UserDataSource @@ -37,6 +31,11 @@ class UserRepositoryImpl @Inject constructor( override suspend fun getId(): Result> = kotlin.runCatching { userDataSource.getId() } + override suspend fun postUserLogIn( + requestPostUserLogInDto: RequestPostUserLogInDto + ): Result> = + kotlin.runCatching { userDataSource.postUserLogIn(requestPostUserLogInDto)} + override suspend fun patchUserTypeSignup( requestPatchUserTypeDto: RequestPatchUserTypeDto ): Result> = diff --git a/app/src/main/java/com/keyneez/data/service/UserService.kt b/app/src/main/java/com/keyneez/data/service/UserService.kt index 012899d..b0d89b1 100644 --- a/app/src/main/java/com/keyneez/data/service/UserService.kt +++ b/app/src/main/java/com/keyneez/data/service/UserService.kt @@ -1,13 +1,7 @@ package com.keyneez.data.service -import com.keyneez.data.model.request.RequestPatchPwdSignupDto -import com.keyneez.data.model.request.RequestPatchUserTypeDto -import com.keyneez.data.model.request.RequestPostDanalSignupDto -import com.keyneez.data.model.request.RequestPostPwdCheckDto -import com.keyneez.data.model.response.ResponseIdDto -import com.keyneez.data.model.response.ResponsePatchPwdSignupDto -import com.keyneez.data.model.response.ResponsePatchUserTypeDto -import com.keyneez.data.model.response.ResponsePostDanalSignupDto +import com.keyneez.data.model.request.* +import com.keyneez.data.model.response.* import com.keyneez.data.model.response.wrapper.BaseResponse import retrofit2.http.Body import retrofit2.http.GET @@ -41,4 +35,10 @@ interface UserService { suspend fun postPwdCheck( @Body request: RequestPostPwdCheckDto ) + + // 로그인 + @POST("user/signin") + suspend fun postUserLogIn( + @Body request: RequestPostUserLogInDto + ): BaseResponse } diff --git a/app/src/main/java/com/keyneez/data/source/UserDataSource.kt b/app/src/main/java/com/keyneez/data/source/UserDataSource.kt index 25c1f1b..4b212a8 100644 --- a/app/src/main/java/com/keyneez/data/source/UserDataSource.kt +++ b/app/src/main/java/com/keyneez/data/source/UserDataSource.kt @@ -1,13 +1,7 @@ package com.keyneez.data.source -import com.keyneez.data.model.request.RequestPatchPwdSignupDto -import com.keyneez.data.model.request.RequestPatchUserTypeDto -import com.keyneez.data.model.request.RequestPostDanalSignupDto -import com.keyneez.data.model.request.RequestPostPwdCheckDto -import com.keyneez.data.model.response.ResponseIdDto -import com.keyneez.data.model.response.ResponsePatchPwdSignupDto -import com.keyneez.data.model.response.ResponsePatchUserTypeDto -import com.keyneez.data.model.response.ResponsePostDanalSignupDto +import com.keyneez.data.model.request.* +import com.keyneez.data.model.response.* import com.keyneez.data.model.response.wrapper.BaseResponse import com.keyneez.data.service.UserService import javax.inject.Inject @@ -20,6 +14,11 @@ class UserDataSource @Inject constructor( ): BaseResponse = userService.postDanalSignup(requestPostDanalSignupDto) + suspend fun postUserLogIn( + requestPostUserLogInDto: RequestPostUserLogInDto + ): BaseResponse = + userService.postUserLogIn(requestPostUserLogInDto) + suspend fun getId(): BaseResponse = userService.getId() suspend fun patchUserTypeSignup( diff --git a/app/src/main/res/layout/bot_sheet_id_profile.xml b/app/src/main/res/layout/bot_sheet_id_profile.xml index 9f4b7e5..c98bce5 100644 --- a/app/src/main/res/layout/bot_sheet_id_profile.xml +++ b/app/src/main/res/layout/bot_sheet_id_profile.xml @@ -84,8 +84,7 @@ android:textColor="@color/gray900" putBirth="@{vm.userData.birth}" app:layout_constraintStart_toStartOf="parent" - app:layout_constraintTop_toBottomOf="@id/tv_id_profile_school" - tools:text="@{vm.userData.birth}" /> + app:layout_constraintTop_toBottomOf="@id/tv_id_profile_school" /> From 7cd6d6a2a1f7e5dd67f53c50778898a232970686 Mon Sep 17 00:00:00 2001 From: 0zlrlo <99941493+0zlrlo@users.noreply.github.com> Date: Fri, 13 Jan 2023 04:38:55 +0900 Subject: [PATCH 2/3] =?UTF-8?q?[ADD/#49]=20=EC=BD=94=EB=93=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/keyneez/presentation/login/phone/PhoneViewModel.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/com/keyneez/presentation/login/phone/PhoneViewModel.kt b/app/src/main/java/com/keyneez/presentation/login/phone/PhoneViewModel.kt index 3790b4b..38c0219 100644 --- a/app/src/main/java/com/keyneez/presentation/login/phone/PhoneViewModel.kt +++ b/app/src/main/java/com/keyneez/presentation/login/phone/PhoneViewModel.kt @@ -2,10 +2,11 @@ package com.keyneez.presentation.login.phone import androidx.lifecycle.MutableLiveData import androidx.lifecycle.ViewModel +import com.keyneez.data.repository.UserRepository import dagger.hilt.android.lifecycle.HiltViewModel import javax.inject.Inject @HiltViewModel -class PhoneViewModel @Inject constructor() : ViewModel() { +class PhoneViewModel @Inject constructor(private val userRepository: UserRepository) : ViewModel() { val phoneNumber = MutableLiveData("") } From 1d847d657ff9083d67c35d77b9f2f3e423d39435 Mon Sep 17 00:00:00 2001 From: 0zlrlo <99941493+0zlrlo@users.noreply.github.com> Date: Fri, 13 Jan 2023 04:43:16 +0900 Subject: [PATCH 3/3] =?UTF-8?q?[ADD/#49]=20=EC=84=9C=EB=B2=84=ED=86=B5?= =?UTF-8?q?=EC=8B=A0=20=EA=B8=B0=EB=B3=B8=20=EC=84=B8=ED=8C=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/keyneez/data/repository/UserRepositoryImpl.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/java/com/keyneez/data/repository/UserRepositoryImpl.kt b/app/src/main/java/com/keyneez/data/repository/UserRepositoryImpl.kt index 1158c48..1655da7 100644 --- a/app/src/main/java/com/keyneez/data/repository/UserRepositoryImpl.kt +++ b/app/src/main/java/com/keyneez/data/repository/UserRepositoryImpl.kt @@ -34,7 +34,7 @@ class UserRepositoryImpl @Inject constructor( override suspend fun postUserLogIn( requestPostUserLogInDto: RequestPostUserLogInDto ): Result> = - kotlin.runCatching { userDataSource.postUserLogIn(requestPostUserLogInDto)} + kotlin.runCatching { userDataSource.postUserLogIn(requestPostUserLogInDto) } override suspend fun patchUserTypeSignup( requestPatchUserTypeDto: RequestPatchUserTypeDto