From b7e051bd5f55dd9c0ef133e2bb14b8f03fa2d943 Mon Sep 17 00:00:00 2001 From: b1urrrr Date: Fri, 13 Jan 2023 19:30:02 +0900 Subject: [PATCH 1/4] =?UTF-8?q?[FEAT/#46]=20ocr=20post=20user=20check=20?= =?UTF-8?q?=EC=84=9C=EB=B2=84=ED=86=B5=EC=8B=A0=20=EB=A1=9C=EC=A7=81=20?= =?UTF-8?q?=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/build.gradle | 4 + .../request/RequestPostStudentUserCheckDto.kt | 16 +++ .../request/RequestPostYouthUserCheckDto.kt | 16 +++ .../response/ResponsePostUserCheckDto.kt | 46 +++++++ .../keyneez/data/repository/UserRepository.kt | 8 ++ .../data/repository/UserRepositoryImpl.kt | 10 ++ .../com/keyneez/data/service/UserService.kt | 12 ++ .../com/keyneez/data/source/UserDataSource.kt | 10 ++ .../keyneez/presentation/ocr/OcrActivity.kt | 21 +++- .../keyneez/presentation/ocr/OcrViewModel.kt | 4 + .../ocr/dialog/OcrResultFragment.kt | 39 +++++- .../ocr/dialog/OcrResultViewModel.kt | 115 ++++++++++++++++++ build.gradle | 5 + 13 files changed, 298 insertions(+), 8 deletions(-) create mode 100644 app/src/main/java/com/keyneez/data/model/request/RequestPostStudentUserCheckDto.kt create mode 100644 app/src/main/java/com/keyneez/data/model/request/RequestPostYouthUserCheckDto.kt create mode 100644 app/src/main/java/com/keyneez/data/model/response/ResponsePostUserCheckDto.kt create mode 100644 app/src/main/java/com/keyneez/presentation/ocr/dialog/OcrResultViewModel.kt diff --git a/app/build.gradle b/app/build.gradle index eaaa262..500995f 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -119,6 +119,10 @@ dependencies { // shared preference implementation 'androidx.security:security-crypto-ktx:1.1.0-alpha04' + // firebase + implementation platform('com.google.firebase:firebase-bom:31.1.1') + implementation 'com.google.firebase:firebase-analytics-ktx' + // firebase storage implementation 'com.google.firebase:firebase-core:21.1.1' implementation 'com.google.firebase:firebase-storage:20.1.0' diff --git a/app/src/main/java/com/keyneez/data/model/request/RequestPostStudentUserCheckDto.kt b/app/src/main/java/com/keyneez/data/model/request/RequestPostStudentUserCheckDto.kt new file mode 100644 index 0000000..84a1a80 --- /dev/null +++ b/app/src/main/java/com/keyneez/data/model/request/RequestPostStudentUserCheckDto.kt @@ -0,0 +1,16 @@ +package com.keyneez.data.model.request + +import kotlinx.serialization.SerialName +import kotlinx.serialization.Serializable + +@Serializable +data class RequestPostStudentUserCheckDto( + @SerialName("user_school") + val school: String, + @SerialName("user_name") + val name: String, + @SerialName("user_ocr") + val ocrImg: String, + @SerialName("ocr_dir") + val ocrDir: Boolean +) \ No newline at end of file diff --git a/app/src/main/java/com/keyneez/data/model/request/RequestPostYouthUserCheckDto.kt b/app/src/main/java/com/keyneez/data/model/request/RequestPostYouthUserCheckDto.kt new file mode 100644 index 0000000..9ed65bd --- /dev/null +++ b/app/src/main/java/com/keyneez/data/model/request/RequestPostYouthUserCheckDto.kt @@ -0,0 +1,16 @@ +package com.keyneez.data.model.request + +import kotlinx.serialization.SerialName +import kotlinx.serialization.Serializable + +@Serializable +data class RequestPostYouthUserCheckDto( + @SerialName("user_name") + val name : String, + @SerialName("user_birth") + val birth : String, + @SerialName("user_ocr") + val ocrImg: String, + @SerialName("ocr_dir") + val ocrDir: Boolean +) \ No newline at end of file diff --git a/app/src/main/java/com/keyneez/data/model/response/ResponsePostUserCheckDto.kt b/app/src/main/java/com/keyneez/data/model/response/ResponsePostUserCheckDto.kt new file mode 100644 index 0000000..5743d4a --- /dev/null +++ b/app/src/main/java/com/keyneez/data/model/response/ResponsePostUserCheckDto.kt @@ -0,0 +1,46 @@ +package com.keyneez.data.model.response + +import kotlinx.serialization.SerialName +import kotlinx.serialization.Serializable + +@Serializable +data class ResponsePostUserCheckDto( + @SerialName("user_key") + val key: Int, + @SerialName("user_name") + val name: String, + @SerialName("user_age") + val age: String?, + @SerialName("user_gender") + val gender: String?, + @SerialName("user_birth") + val birthDate: String?, + @SerialName("user_school") + val school: String?, + @SerialName("user_character") + val character: Int?, + @SerialName("user_password") + val password: String?, + @SerialName("user_ocr") + val ocrImg: String?, + @SerialName("ocr_dir") + val ocrDir: Boolean?, + @SerialName("user_benefit") + val benefit: Boolean?, + val Characters: Character? +) { + @Serializable + data class Character( + @SerialName("character_key") + val key: Int, + val inter: String?, + val dispo: String?, + val character: String?, + @SerialName("character_img") + val img: String?, + @SerialName("character_desc") + val description: String?, + @SerialName("test_img") + val testImg: String? + ) +} \ No newline at end of file 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 17d0908..b7a11bf 100644 --- a/app/src/main/java/com/keyneez/data/repository/UserRepository.kt +++ b/app/src/main/java/com/keyneez/data/repository/UserRepository.kt @@ -33,4 +33,12 @@ interface UserRepository { suspend fun postPwdCheck( requestPostPwdCheckDto: RequestPostPwdCheckDto ): Result + + suspend fun postStudentUserCheck( + requestPostStudentUserCheckDto: RequestPostStudentUserCheckDto + ): Result> + + suspend fun postYouthUserCheck( + requestPostYouthUserCheckDto: RequestPostYouthUserCheckDto + ): Result> } 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 1655da7..560f277 100644 --- a/app/src/main/java/com/keyneez/data/repository/UserRepositoryImpl.kt +++ b/app/src/main/java/com/keyneez/data/repository/UserRepositoryImpl.kt @@ -50,4 +50,14 @@ class UserRepositoryImpl @Inject constructor( requestPostPwdCheckDto: RequestPostPwdCheckDto ): Result = kotlin.runCatching { userDataSource.postPwdCheck(requestPostPwdCheckDto) } + + override suspend fun postStudentUserCheck( + requestPostStudentUserCheckDto: RequestPostStudentUserCheckDto + ): Result> = + kotlin.runCatching { userDataSource.postStudentUserCheck(requestPostStudentUserCheckDto) } + + override suspend fun postYouthUserCheck( + requestPostYouthUserCheckDto: RequestPostYouthUserCheckDto + ): Result> = + kotlin.runCatching { userDataSource.postYouthUserCheck(requestPostYouthUserCheckDto) } } 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 b0d89b1..69b25b1 100644 --- a/app/src/main/java/com/keyneez/data/service/UserService.kt +++ b/app/src/main/java/com/keyneez/data/service/UserService.kt @@ -41,4 +41,16 @@ interface UserService { suspend fun postUserLogIn( @Body request: RequestPostUserLogInDto ): BaseResponse + + // 학생증 유저 대조 (다날*학생) + @POST("user/check") + suspend fun postCheckStudentUser( + @Body request: RequestPostStudentUserCheckDto + ): BaseResponse + + // 청소년증 유저 대조 (다날*학생) + @POST("user/check") + suspend fun postCheckYouthUser( + @Body request: RequestPostYouthUserCheckDto + ): 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 4b212a8..40f402c 100644 --- a/app/src/main/java/com/keyneez/data/source/UserDataSource.kt +++ b/app/src/main/java/com/keyneez/data/source/UserDataSource.kt @@ -34,4 +34,14 @@ class UserDataSource @Inject constructor( suspend fun postPwdCheck( requestPostPwdCheckDto: RequestPostPwdCheckDto ): Unit = userService.postPwdCheck(requestPostPwdCheckDto) + + suspend fun postStudentUserCheck( + requestPostStudentUserCheckDto: RequestPostStudentUserCheckDto + ): BaseResponse = + userService.postCheckStudentUser(requestPostStudentUserCheckDto) + + suspend fun postYouthUserCheck( + requestPostYouthUserCheckDto: RequestPostYouthUserCheckDto + ): BaseResponse = + userService.postCheckYouthUser(requestPostYouthUserCheckDto) } diff --git a/app/src/main/java/com/keyneez/presentation/ocr/OcrActivity.kt b/app/src/main/java/com/keyneez/presentation/ocr/OcrActivity.kt index 89de4f0..7dba0eb 100644 --- a/app/src/main/java/com/keyneez/presentation/ocr/OcrActivity.kt +++ b/app/src/main/java/com/keyneez/presentation/ocr/OcrActivity.kt @@ -162,10 +162,23 @@ class OcrActivity : BindingActivity(R.layout.activity_ocr) { isSuccess = true } else -> { - if (isSuccess && viewModel.idName.value == "" && word.length == 3) viewModel.setIdName(word) - if (isSuccess && viewModel.idName.value == "" && word.startsWith("명:")) viewModel.setIdName(word.substring(2, 5)) - if (isSuccess && viewModel.isStudentId.value == true && viewModel.idSubEntry.value == "" && word.endsWith("학교")) viewModel.setIdSchool(word) - if (isSuccess && viewModel.isStudentId.value == false && viewModel.idSubEntry.value == "" && word.length == 14 && word.contains('-')) viewModel.setBirthDate(word) + if (isSuccess && viewModel.idName.value == "" && word.length == 3) viewModel.setIdName( + word + ) + if (isSuccess && viewModel.idName.value == "" && word.startsWith("명:")) viewModel.setIdName( + word.substring(2, 5) + ) + if (isSuccess && viewModel.idName.value == "" && word.startsWith(":") && word.length == 4) viewModel.setIdName( + word.substring(1, 4) + ) + if (isSuccess && viewModel.isStudentId.value == true && viewModel.idSubEntry.value == "" && word.endsWith( + "학교" + ) + ) viewModel.setIdSchool(word) + if (isSuccess && viewModel.isStudentId.value == false && viewModel.idSubEntry.value == "" && word.length == 14 && word.contains( + '-' + ) + ) viewModel.setBirthDate(word) } } } diff --git a/app/src/main/java/com/keyneez/presentation/ocr/OcrViewModel.kt b/app/src/main/java/com/keyneez/presentation/ocr/OcrViewModel.kt index 2655b02..1ad0f4f 100644 --- a/app/src/main/java/com/keyneez/presentation/ocr/OcrViewModel.kt +++ b/app/src/main/java/com/keyneez/presentation/ocr/OcrViewModel.kt @@ -28,6 +28,10 @@ class OcrViewModel @Inject constructor() : ViewModel() { val isStudentId: LiveData get() = _isStudentId + private val _imgUrl = MutableLiveData() + val imgUrl: LiveData + get() = _imgUrl + init { _isVertical.value = false _isPassive.value = false diff --git a/app/src/main/java/com/keyneez/presentation/ocr/dialog/OcrResultFragment.kt b/app/src/main/java/com/keyneez/presentation/ocr/dialog/OcrResultFragment.kt index 91c2c90..0a8cf86 100644 --- a/app/src/main/java/com/keyneez/presentation/ocr/dialog/OcrResultFragment.kt +++ b/app/src/main/java/com/keyneez/presentation/ocr/dialog/OcrResultFragment.kt @@ -1,19 +1,24 @@ package com.keyneez.presentation.ocr.dialog -import android.app.Activity.RESULT_OK +import android.app.Activity import android.content.Intent import android.os.Bundle import android.view.View +import androidx.fragment.app.viewModels import com.keyneez.presentation.ocr.OcrActivity import com.keyneez.presentation.ocr.guide.OcrGuideActivity +import com.keyneez.util.UiState import com.keyneez.util.binding.BindingBottomSheetDialog import com.keyneez.util.extension.hideKeyboard import com.keyneez.util.extension.setOnSingleClickListener +import com.keyneez.util.extension.showSnackbar import com.lab.keyneez.R import com.lab.keyneez.databinding.BotSheetOcrResultBinding class OcrResultFragment : BindingBottomSheetDialog(R.layout.bot_sheet_ocr_result) { + private val viewModel by viewModels() + override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) binding.vm = (activity as OcrActivity).viewModel @@ -21,6 +26,7 @@ class OcrResultFragment : initHideKeyboard() initReshootBtnClickListener() initConfirmBtnClickListener() + setupCheckUserState() } private fun initHideKeyboard() { @@ -37,10 +43,35 @@ class OcrResultFragment : private fun initConfirmBtnClickListener() { binding.btnOcrResultConfirm.setOnSingleClickListener { - val intent = Intent(activity, OcrGuideActivity::class.java).apply { - requireActivity().setResult(RESULT_OK, this) + val avm = (activity as OcrActivity).viewModel + val isStudent = avm.isStudentId.value ?: true + val name = avm.idName.value.toString() + val subEntry = avm.idSubEntry.value.toString() + val img = avm.imgUrl.value.toString() + val isVertical = avm.isVertical.value ?: false + + viewModel.postUserCheck(isStudent, name, subEntry, img, isVertical) + } + } + + private fun setupCheckUserState() { + viewModel.stateMessage.observe(viewLifecycleOwner) { + when (it) { + is UiState.Success -> { + val intent = Intent(activity, OcrGuideActivity::class.java).apply { + requireActivity().setResult(Activity.RESULT_OK, this) + } + requireActivity().finish() + } + is UiState.Failure -> requireContext().showSnackbar( + binding.root, + getString(R.string.msg_error) + ) + is UiState.Error -> requireContext().showSnackbar( + binding.root, + getString(R.string.msg_error) + ) } - requireActivity().finish() } } diff --git a/app/src/main/java/com/keyneez/presentation/ocr/dialog/OcrResultViewModel.kt b/app/src/main/java/com/keyneez/presentation/ocr/dialog/OcrResultViewModel.kt new file mode 100644 index 0000000..ed654f7 --- /dev/null +++ b/app/src/main/java/com/keyneez/presentation/ocr/dialog/OcrResultViewModel.kt @@ -0,0 +1,115 @@ +package com.keyneez.presentation.ocr.dialog + +import androidx.lifecycle.LiveData +import androidx.lifecycle.MutableLiveData +import androidx.lifecycle.ViewModel +import androidx.lifecycle.viewModelScope +import com.keyneez.data.model.request.RequestPostStudentUserCheckDto +import com.keyneez.data.model.request.RequestPostYouthUserCheckDto +import com.keyneez.data.repository.UserRepository +import com.keyneez.util.UiState +import dagger.hilt.android.lifecycle.HiltViewModel +import kotlinx.coroutines.launch +import retrofit2.HttpException +import timber.log.Timber +import javax.inject.Inject + +@HiltViewModel +class OcrResultViewModel @Inject constructor( + private val userRepository: UserRepository +) : ViewModel() { + private val _stateMessage = MutableLiveData() + val stateMessage: LiveData + get() = _stateMessage + + fun postUserCheck( + isStudent: Boolean, + name: String, + subEntry: String, + img: String, + isVertical: Boolean + ) { + // 학생증인 경우 + if (isStudent) { + viewModelScope.launch { + userRepository.postStudentUserCheck( + RequestPostStudentUserCheckDto( + subEntry, + name, + img, + isVertical + ) + ) + .onSuccess { response -> + Timber.tag(successTag).d("response : $response") + + if (response.data == null) { + _stateMessage.value = UiState.Failure(RESPONSE_NULL_CODE) + return@onSuccess + } + + _stateMessage.value = UiState.Success + } + .onFailure { + Timber.tag(failTag).e("throwable: $it") + if (it is HttpException) { + Timber.tag(failTag).e("code : ${it.code()}") + Timber.tag(failTag).e("message : ${it.message()}") + + when (it.code()) { + INVALID_TOKEN_CODE -> _stateMessage.value = UiState.Failure( + INVALID_TOKEN_CODE + ) + CHECK_FAIL_CODE -> _stateMessage.value = UiState.Failure( + CHECK_FAIL_CODE + ) + else -> _stateMessage.value = UiState.Error + } + } else _stateMessage.value = UiState.Error + } + } + } + // 청소년증인 경우 + else { + viewModelScope.launch { + userRepository.postYouthUserCheck(RequestPostYouthUserCheckDto(name, subEntry, img, isVertical)) + .onSuccess { response -> + Timber.tag(successTag).d("response : $response") + + if (response.data == null) { + _stateMessage.value = UiState.Failure(RESPONSE_NULL_CODE) + return@onSuccess + } + + _stateMessage.value = UiState.Success + } + .onFailure { + Timber.tag(failTag).e("throwable: $it") + if (it is HttpException) { + Timber.tag(failTag).e("code : ${it.code()}") + Timber.tag(failTag).e("message : ${it.message()}") + + when (it.code()) { + INVALID_TOKEN_CODE -> _stateMessage.value = UiState.Failure( + INVALID_TOKEN_CODE + ) + CHECK_FAIL_CODE -> _stateMessage.value = UiState.Failure( + CHECK_FAIL_CODE + ) + else -> _stateMessage.value = UiState.Error + } + } else _stateMessage.value = UiState.Error + } + } + } + } + + companion object { + const val RESPONSE_NULL_CODE = 100 + const val INVALID_TOKEN_CODE = 401 + const val CHECK_FAIL_CODE = 400 + + private const val successTag = "POST_CHECK_USER_SUCCESS" + private const val failTag = "POST_CHECK_USER_FAIL" + } +} diff --git a/build.gradle b/build.gradle index b63dcce..d1009cb 100644 --- a/build.gradle +++ b/build.gradle @@ -1,4 +1,9 @@ buildscript { + repositories { + google() + mavenCentral() + } + dependencies { classpath 'com.google.gms:google-services:4.3.13' } From ac8999c0c49df4ac239f3696c99c9571dc92b8fb Mon Sep 17 00:00:00 2001 From: b1urrrr Date: Fri, 13 Jan 2023 21:05:25 +0900 Subject: [PATCH 2/4] =?UTF-8?q?[FIX/#46]=20bottom=20navigation=20=ED=81=B4?= =?UTF-8?q?=EB=A6=AD=20=EC=9D=B4=EC=8A=88=20=ED=95=B4=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../keyneez/presentation/main/MainActivity.kt | 50 ++----------------- .../presentation/main/MainViewModel.kt | 1 + 2 files changed, 5 insertions(+), 46 deletions(-) diff --git a/app/src/main/java/com/keyneez/presentation/main/MainActivity.kt b/app/src/main/java/com/keyneez/presentation/main/MainActivity.kt index c81d8c3..3dc9f3f 100644 --- a/app/src/main/java/com/keyneez/presentation/main/MainActivity.kt +++ b/app/src/main/java/com/keyneez/presentation/main/MainActivity.kt @@ -1,7 +1,6 @@ package com.keyneez.presentation.main import android.os.Bundle -import android.widget.ImageView import androidx.activity.viewModels import androidx.fragment.app.Fragment import androidx.fragment.app.commit @@ -11,10 +10,8 @@ import com.keyneez.presentation.main.home.HomeFragment import com.keyneez.presentation.main.id.IdFragment import com.keyneez.presentation.main.like.LikeFragment import com.keyneez.presentation.main.setting.SettingFragment -import com.keyneez.util.UiState import com.keyneez.util.binding.BindingActivity import com.keyneez.util.extension.setOnSingleClickListener -import com.keyneez.util.extension.showSnackbar import com.lab.keyneez.R import com.lab.keyneez.databinding.ActivityMainBinding import dagger.hilt.android.AndroidEntryPoint @@ -22,13 +19,15 @@ import dagger.hilt.android.AndroidEntryPoint @AndroidEntryPoint class MainActivity : BindingActivity(R.layout.activity_main) { private val viewModel by viewModels() + override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) binding.vm = viewModel + initBottomNavigationBar() - observeIdStateMessage() initCardBackGround() } + private fun initBottomNavigationBar() { // 초기 프래그먼트 설정 val currentFragment = supportFragmentManager.findFragmentById(R.id.container_main) @@ -42,51 +41,13 @@ class MainActivity : BindingActivity(R.layout.activity_main R.id.menu_character -> navigateTo() R.id.menu_setting -> navigateTo() } - false - } - } - - private fun observeIdStateMessage() { - viewModel.stateMessage.observe(this) { - when (it) { - is UiState.Success -> return@observe - is UiState.Failure -> showSnackbar( - binding.root, - getString(R.string.msg_id_null) - ) - is UiState.Error -> showSnackbar( - binding.root, - getString(R.string.msg_server_error) - ) - } + true } } private fun initCardBackGround() { binding.btnMainCard.setOnSingleClickListener { navigateTo() - when (viewModel.userData.value?.userCharacter?.rem(5)) { - // 문화인-파란색 - 1 -> { - binding.btnMainCard.setImageDrawable(R.drawable.img_id_navi_blue) - } - // 진로탐색러-초록색 - 2 -> { - binding.btnMainCard.setImageDrawable(R.drawable.img_id_navi_green) - } - // 탐험가-핑크색 - 3 -> { - binding.btnMainCard.setImageDrawable(R.drawable.img_id_navi_pink) - } - // 경제인-빨간색 - 4 -> { - binding.btnMainCard.setImageDrawable(R.drawable.img_id_navi_red) - } - // 봉사자-보라색 - else -> { - binding.btnMainCard.setImageDrawable(R.drawable.img_id_navi_purple) - } - } } } @@ -95,7 +56,4 @@ class MainActivity : BindingActivity(R.layout.activity_main replace(R.id.container_main, T::class.java.canonicalName) } } - - private fun ImageView.setImageDrawable(imgLikeBackground: Int) { - } } diff --git a/app/src/main/java/com/keyneez/presentation/main/MainViewModel.kt b/app/src/main/java/com/keyneez/presentation/main/MainViewModel.kt index b5cc61c..30413ab 100644 --- a/app/src/main/java/com/keyneez/presentation/main/MainViewModel.kt +++ b/app/src/main/java/com/keyneez/presentation/main/MainViewModel.kt @@ -20,6 +20,7 @@ class MainViewModel @Inject constructor( private val _userData = MutableLiveData() val userData: LiveData get() = _userData + private val _stateMessage = MutableLiveData() val stateMessage: LiveData get() = _stateMessage From dec9550160b969f77b861d0e2cbab69b704ef5dd Mon Sep 17 00:00:00 2001 From: b1urrrr Date: Fri, 13 Jan 2023 21:06:39 +0900 Subject: [PATCH 3/4] =?UTF-8?q?[ADD/#46]=20=EC=9D=B4=EB=A6=84=20=EC=9D=B8?= =?UTF-8?q?=EC=8B=9D=20=EB=A1=9C=EC=A7=81=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/java/com/keyneez/presentation/ocr/OcrActivity.kt | 4 +++- .../com/keyneez/presentation/ocr/dialog/OcrResultFragment.kt | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/com/keyneez/presentation/ocr/OcrActivity.kt b/app/src/main/java/com/keyneez/presentation/ocr/OcrActivity.kt index 7dba0eb..ebc3598 100644 --- a/app/src/main/java/com/keyneez/presentation/ocr/OcrActivity.kt +++ b/app/src/main/java/com/keyneez/presentation/ocr/OcrActivity.kt @@ -19,11 +19,13 @@ import com.keyneez.util.extension.setOnSingleClickListener import com.keyneez.util.extension.showSnackbar import com.lab.keyneez.R import com.lab.keyneez.databinding.ActivityOcrBinding +import dagger.hilt.android.AndroidEntryPoint import timber.log.Timber import java.nio.ByteBuffer import java.util.concurrent.ExecutorService import java.util.concurrent.Executors +@AndroidEntryPoint class OcrActivity : BindingActivity(R.layout.activity_ocr) { val viewModel by viewModels() @@ -165,7 +167,7 @@ class OcrActivity : BindingActivity(R.layout.activity_ocr) { if (isSuccess && viewModel.idName.value == "" && word.length == 3) viewModel.setIdName( word ) - if (isSuccess && viewModel.idName.value == "" && word.startsWith("명:")) viewModel.setIdName( + if (isSuccess && viewModel.idName.value == "" && word.startsWith("명:") && word.length == 5) viewModel.setIdName( word.substring(2, 5) ) if (isSuccess && viewModel.idName.value == "" && word.startsWith(":") && word.length == 4) viewModel.setIdName( diff --git a/app/src/main/java/com/keyneez/presentation/ocr/dialog/OcrResultFragment.kt b/app/src/main/java/com/keyneez/presentation/ocr/dialog/OcrResultFragment.kt index 0a8cf86..23173cd 100644 --- a/app/src/main/java/com/keyneez/presentation/ocr/dialog/OcrResultFragment.kt +++ b/app/src/main/java/com/keyneez/presentation/ocr/dialog/OcrResultFragment.kt @@ -14,7 +14,9 @@ import com.keyneez.util.extension.setOnSingleClickListener import com.keyneez.util.extension.showSnackbar import com.lab.keyneez.R import com.lab.keyneez.databinding.BotSheetOcrResultBinding +import dagger.hilt.android.AndroidEntryPoint +@AndroidEntryPoint class OcrResultFragment : BindingBottomSheetDialog(R.layout.bot_sheet_ocr_result) { private val viewModel by viewModels() From cd55655dac46f16d695acd5a668ee74fc99de8ad Mon Sep 17 00:00:00 2001 From: b1urrrr Date: Fri, 13 Jan 2023 21:12:31 +0900 Subject: [PATCH 4/4] =?UTF-8?q?[FIX/#46]=20ktlint=20=EB=AC=B8=EB=B2=95=20?= =?UTF-8?q?=EC=A4=80=EC=88=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../data/model/request/RequestPostStudentUserCheckDto.kt | 2 +- .../data/model/request/RequestPostYouthUserCheckDto.kt | 6 +++--- .../keyneez/data/model/response/ResponsePostUserCheckDto.kt | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/com/keyneez/data/model/request/RequestPostStudentUserCheckDto.kt b/app/src/main/java/com/keyneez/data/model/request/RequestPostStudentUserCheckDto.kt index 84a1a80..aac51b5 100644 --- a/app/src/main/java/com/keyneez/data/model/request/RequestPostStudentUserCheckDto.kt +++ b/app/src/main/java/com/keyneez/data/model/request/RequestPostStudentUserCheckDto.kt @@ -13,4 +13,4 @@ data class RequestPostStudentUserCheckDto( val ocrImg: String, @SerialName("ocr_dir") val ocrDir: Boolean -) \ No newline at end of file +) diff --git a/app/src/main/java/com/keyneez/data/model/request/RequestPostYouthUserCheckDto.kt b/app/src/main/java/com/keyneez/data/model/request/RequestPostYouthUserCheckDto.kt index 9ed65bd..f0773f7 100644 --- a/app/src/main/java/com/keyneez/data/model/request/RequestPostYouthUserCheckDto.kt +++ b/app/src/main/java/com/keyneez/data/model/request/RequestPostYouthUserCheckDto.kt @@ -6,11 +6,11 @@ import kotlinx.serialization.Serializable @Serializable data class RequestPostYouthUserCheckDto( @SerialName("user_name") - val name : String, + val name: String, @SerialName("user_birth") - val birth : String, + val birth: String, @SerialName("user_ocr") val ocrImg: String, @SerialName("ocr_dir") val ocrDir: Boolean -) \ No newline at end of file +) diff --git a/app/src/main/java/com/keyneez/data/model/response/ResponsePostUserCheckDto.kt b/app/src/main/java/com/keyneez/data/model/response/ResponsePostUserCheckDto.kt index 5743d4a..bd1a2b0 100644 --- a/app/src/main/java/com/keyneez/data/model/response/ResponsePostUserCheckDto.kt +++ b/app/src/main/java/com/keyneez/data/model/response/ResponsePostUserCheckDto.kt @@ -43,4 +43,4 @@ data class ResponsePostUserCheckDto( @SerialName("test_img") val testImg: String? ) -} \ No newline at end of file +}