Skip to content

Commit

Permalink
[MERGE/#46] merge develop into ocr-feat-text-recognition
Browse files Browse the repository at this point in the history
  • Loading branch information
b1urrrr committed Jan 12, 2023
2 parents b76028e + 845e8c0 commit 3c1a5f8
Show file tree
Hide file tree
Showing 9 changed files with 49 additions and 36 deletions.
Original file line number Diff line number Diff line change
@@ -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
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package com.keyneez.data.model.response

@kotlinx.serialization.Serializable
data class ResponsePostUserLogInDto(
val accessToken: String
)
14 changes: 6 additions & 8 deletions app/src/main/java/com/keyneez/data/repository/UserRepository.kt
Original file line number Diff line number Diff line change
@@ -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 {
Expand All @@ -22,6 +16,10 @@ interface UserRepository {
requestPostDanalSignupDto: RequestPostDanalSignupDto
): Result<BaseResponse<ResponsePostDanalSignupDto>>

suspend fun postUserLogIn(
requestPostUserLogInDto: RequestPostUserLogInDto
): Result<BaseResponse<ResponsePostUserLogInDto>>

suspend fun getId(): Result<BaseResponse<ResponseIdDto>>

suspend fun patchUserTypeSignup(
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -37,6 +31,11 @@ class UserRepositoryImpl @Inject constructor(
override suspend fun getId(): Result<BaseResponse<ResponseIdDto>> =
kotlin.runCatching { userDataSource.getId() }

override suspend fun postUserLogIn(
requestPostUserLogInDto: RequestPostUserLogInDto
): Result<BaseResponse<ResponsePostUserLogInDto>> =
kotlin.runCatching { userDataSource.postUserLogIn(requestPostUserLogInDto) }

override suspend fun patchUserTypeSignup(
requestPatchUserTypeDto: RequestPatchUserTypeDto
): Result<BaseResponse<ResponsePatchUserTypeDto>> =
Expand Down
16 changes: 8 additions & 8 deletions app/src/main/java/com/keyneez/data/service/UserService.kt
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -41,4 +35,10 @@ interface UserService {
suspend fun postPwdCheck(
@Body request: RequestPostPwdCheckDto
)

// ๋กœ๊ทธ์ธ
@POST("user/signin")
suspend fun postUserLogIn(
@Body request: RequestPostUserLogInDto
): BaseResponse<ResponsePostUserLogInDto>
}
15 changes: 7 additions & 8 deletions app/src/main/java/com/keyneez/data/source/UserDataSource.kt
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -20,6 +14,11 @@ class UserDataSource @Inject constructor(
): BaseResponse<ResponsePostDanalSignupDto> =
userService.postDanalSignup(requestPostDanalSignupDto)

suspend fun postUserLogIn(
requestPostUserLogInDto: RequestPostUserLogInDto
): BaseResponse<ResponsePostUserLogInDto> =
userService.postUserLogIn(requestPostUserLogInDto)

suspend fun getId(): BaseResponse<ResponseIdDto> = userService.getId()

suspend fun patchUserTypeSignup(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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("")
}
3 changes: 1 addition & 2 deletions app/src/main/res/layout/bot_sheet_id_profile.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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" />

<TextView
android:id="@+id/btn_id_profile_photo"
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/layout/fragment_id.xml
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="101dp"
tools:src="@drawable/img_id_main_background"
android:src="@drawable/img_id_main_background"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
Expand Down

0 comments on commit 3c1a5f8

Please sign in to comment.