From 164ecca4515aa5739ddb46dfdac401dfcfc6b212 Mon Sep 17 00:00:00 2001 From: Mysterious Date: Mon, 29 Jul 2019 11:13:44 +0430 Subject: [PATCH] Review the code and set TODOs --- .../codeverification/CodeVerificationFragment.kt | 3 ++- .../codeverification/CodeVerificationViewModel.kt | 9 +++++---- app/src/main/res/layout/fragment_codeverification.xml | 1 + 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/de/netalic/peacock/ui/registeration/codeverification/CodeVerificationFragment.kt b/app/src/main/java/de/netalic/peacock/ui/registeration/codeverification/CodeVerificationFragment.kt index 0f55191..b5c0017 100644 --- a/app/src/main/java/de/netalic/peacock/ui/registeration/codeverification/CodeVerificationFragment.kt +++ b/app/src/main/java/de/netalic/peacock/ui/registeration/codeverification/CodeVerificationFragment.kt @@ -51,7 +51,7 @@ class CodeVerificationFragment : BaseFragment() { disableButton() } - + // TODO-Milad separate the codes in multiple functions override fun initUiListener() { mButton.setOnClickListener { bind() } @@ -92,6 +92,7 @@ class CodeVerificationFragment : BaseFragment() { override fun initUiComponent() { + //TODO-Milad Add initObservers observeViewModel() } diff --git a/app/src/main/java/de/netalic/peacock/ui/registeration/codeverification/CodeVerificationViewModel.kt b/app/src/main/java/de/netalic/peacock/ui/registeration/codeverification/CodeVerificationViewModel.kt index 181f9e7..dee565c 100644 --- a/app/src/main/java/de/netalic/peacock/ui/registeration/codeverification/CodeVerificationViewModel.kt +++ b/app/src/main/java/de/netalic/peacock/ui/registeration/codeverification/CodeVerificationViewModel.kt @@ -16,6 +16,7 @@ import okhttp3.ResponseBody class CodeVerificationViewModel(private val userRepository: UserRepository) : BaseViewModel() { + // TODO-Milad put timer here and write tests private val mBindResponseLiveData = MutableLiveData>() @@ -38,16 +39,16 @@ class CodeVerificationViewModel(private val userRepository: UserRepository) : Ba mBindResponseLiveData.value = MyResponse.success(it.body()!!) } 400 -> { - mBindResponseLiveData.value = MyResponse.failed(BadRequestException()) + mBindResponseLiveData.value = MyResponse.failed(BadRequestException()) } 710 -> { - mBindResponseLiveData.value = MyResponse.failed(InvalidUdidOrPhone()) + mBindResponseLiveData.value = MyResponse.failed(InvalidUdidOrPhone()) } 711 -> { - mBindResponseLiveData.value = MyResponse.failed(ActivationCodeIsNotValid()) + mBindResponseLiveData.value = MyResponse.failed(ActivationCodeIsNotValid()) } 716 -> { - mBindResponseLiveData.value = MyResponse.failed(InvalidDeviceName()) + mBindResponseLiveData.value = MyResponse.failed(InvalidDeviceName()) } } diff --git a/app/src/main/res/layout/fragment_codeverification.xml b/app/src/main/res/layout/fragment_codeverification.xml index a85db95..77ec80b 100644 --- a/app/src/main/res/layout/fragment_codeverification.xml +++ b/app/src/main/res/layout/fragment_codeverification.xml @@ -1,4 +1,5 @@ +