Skip to content

Commit

Permalink
refactor #1452: registration from java to kotlin
Browse files Browse the repository at this point in the history
  • Loading branch information
PratyushSingh07 authored and therajanmaurya committed Jan 12, 2024
1 parent 0a0347a commit 3c2e286
Show file tree
Hide file tree
Showing 12 changed files with 916 additions and 983 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
package org.mifos.mobilewallet.mifospay.registration

import org.mifos.mobilewallet.mifospay.base.BasePresenter
import org.mifos.mobilewallet.mifospay.base.BaseView

/**
* Created by ankur on 21/June/2018
*/
interface RegistrationContract {
interface MobileVerificationView : BaseView<MobileVerificationPresenter?> {
fun onRequestOtpSuccess()
fun onOtpVerificationSuccess()
fun showToast(s: String?)
fun hideProgressDialog()
fun onRequestOtpFailed(s: String?)
fun onOtpVerificationFailed(s: String?)
}

interface MobileVerificationPresenter : BasePresenter {
fun requestOTPfromServer(fullNumber: String?, s: String?)
fun verifyOTP(otp: String?)
}

interface SignupView : BaseView<SignupPresenter?> {
fun showToast(s: String?)
fun hideProgressDialog()
fun loginSuccess()
fun onRegisterFailed(message: String?)
fun onRegisterSuccess(s: String?)
fun updatePasswordStrength(stringRes: Int, colorRes: Int, value: Int)
}

interface SignupPresenter : BasePresenter {
fun checkPasswordStrength(password: String?)
fun registerUser(
firstName: String?, lastName: String?, mobileNumber: String?, email: String?,
businessName: String?, addressline1: String?, addressline2: String?, pincode: String?,
city: String?, countryName: String?, username: String?, password: String?,
stateId: String?, countryId: String?, mifosSavingProductId: Int
)
}
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
package org.mifos.mobilewallet.mifospay.registration.presenter

import org.mifos.mobilewallet.core.base.UseCase.UseCaseCallback
import org.mifos.mobilewallet.core.base.UseCaseHandler
import org.mifos.mobilewallet.core.domain.usecase.client.SearchClient
import org.mifos.mobilewallet.mifospay.base.BaseView
import org.mifos.mobilewallet.mifospay.registration.RegistrationContract
import org.mifos.mobilewallet.mifospay.registration.RegistrationContract.MobileVerificationView
import javax.inject.Inject

/**
* Created by ankur on 21/June/2018
*/
class MobileVerificationPresenter @Inject constructor(private val mUseCaseHandler: UseCaseHandler) :
RegistrationContract.MobileVerificationPresenter {
var mMobileVerificationView: MobileVerificationView? = null

@JvmField
@Inject
var searchClientUseCase: SearchClient? = null
override fun attachView(baseView: BaseView<*>?) {
mMobileVerificationView = baseView as MobileVerificationView?
mMobileVerificationView!!.setPresenter(this)
}

override fun requestOTPfromServer(fullNumber: String?, mobileNo: String?) {
mUseCaseHandler.execute(searchClientUseCase, SearchClient.RequestValues(mobileNo),
object : UseCaseCallback<SearchClient.ResponseValue?> {
override fun onSuccess(response: SearchClient.ResponseValue?) {
mMobileVerificationView!!.onRequestOtpFailed("Mobile number already exists.")
}

override fun onError(message: String) {
// TODO:: request OTP
mMobileVerificationView!!.onRequestOtpSuccess()
}
})
}

override fun verifyOTP(otp: String?) {
// TODO:: verify OTP
mMobileVerificationView!!.onOtpVerificationSuccess()

// TODO::

// if (false) { // on error
// mMobileVerificationView.onOtpVerificationFailed("OTP Verification Failed.");
// }
}
}
Loading

0 comments on commit 3c2e286

Please sign in to comment.