Skip to content

Commit

Permalink
Revert " fix #1587 : migrated KycLevel1 to compose"
Browse files Browse the repository at this point in the history
This reverts commit d45719c.
  • Loading branch information
AdityaKumdale authored and therajanmaurya committed Mar 26, 2024
1 parent 2365672 commit 51b01f9
Show file tree
Hide file tree
Showing 8 changed files with 124 additions and 353 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,10 @@ data class AnalyticsEvent(
val extras: List<Param> = emptyList(),
) {
// Standard analytics types.
object Types {
const val SCREEN_VIEW = "screen_view" // (extras: SCREEN_NAME)
class Types {
companion object {
const val SCREEN_VIEW = "screen_view" // (extras: SCREEN_NAME)
}
}

/**
Expand All @@ -32,7 +34,9 @@ data class AnalyticsEvent(
data class Param(val key: String, val value: String)

// Standard parameter keys.
object ParamKeys {
const val SCREEN_NAME = "screen_name"
class ParamKeys {
companion object {
const val SCREEN_NAME = "screen_name"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,7 @@ internal class TimeZoneBroadcastMonitor @Inject constructor(
}
}

/* If there isn't a zoneId in the intent, fallback to the systemDefault,
which should also reflect the change */
// If there isn't a zoneId in the intent, fallback to the systemDefault, which should also reflect the change
trySend(zoneIdFromIntent ?: TimeZone.currentSystemDefault())
}
}
Expand Down
4 changes: 1 addition & 3 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ androidxTracing = "1.3.0-alpha02"
coil = "2.6.0"
androidxMetrics = "1.0.0-beta01"
androidxBrowser = "1.8.0"
sheets_compose_dialogs_core = "1.3.0"

[libraries]
androidx-activity-ktx = { module = "androidx.activity:activity-ktx", version.ref = "activityVersion" }
Expand Down Expand Up @@ -140,8 +139,7 @@ coil-kt-compose = { group = "io.coil-kt", name = "coil-compose", version.ref = "
coil-kt-svg = { group = "io.coil-kt", name = "coil-svg", version.ref = "coil" }
androidx-metrics = { group = "androidx.metrics", name = "metrics-performance", version.ref = "androidxMetrics" }
androidx-browser = { group = "androidx.browser", name = "browser", version.ref = "androidxBrowser" }
sheets-compose-dialogs-core = { group = "com.maxkeppeler.sheets-compose-dialogs",name = "core",version.ref = "sheets_compose_dialogs_core"}
sheets-compose-dialogs-calender = { group = "com.maxkeppeler.sheets-compose-dialogs",name = "calendar",version.ref = "sheets_compose_dialogs_core"}


# Dependencies of the included build-logic
android-gradlePlugin = { group = "com.android.tools.build", name = "gradle", version.ref = "androidGradlePlugin" }
Expand Down
3 changes: 0 additions & 3 deletions mifospay/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,6 @@ dependencies {
implementation("androidx.compose.material:material:1.6.0")
implementation(libs.compose.country.code.picker) // remove after moving auth code to module

//calender for date picking
implementation(libs.sheets.compose.dialogs.core)
implementation(libs.sheets.compose.dialogs.calender)

// ViewModel
implementation(libs.androidx.lifecycle.ktx)
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,43 +1,142 @@
package org.mifos.mobilewallet.mifospay.kyc.ui

import android.app.DatePickerDialog
import android.app.DatePickerDialog.OnDateSetListener
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.compose.ui.platform.ComposeView
import androidx.compose.ui.platform.ViewCompositionStrategy
import android.widget.Button
import android.widget.EditText
import butterknife.BindView
import butterknife.ButterKnife
import butterknife.OnClick
import com.hbb20.CountryCodePicker
import dagger.hilt.android.AndroidEntryPoint
import org.mifos.mobilewallet.mifospay.R
import org.mifos.mobilewallet.mifospay.base.BaseFragment
import org.mifos.mobilewallet.mifospay.theme.MifosTheme
import org.mifos.mobilewallet.mifospay.kyc.KYCContract
import org.mifos.mobilewallet.mifospay.kyc.KYCContract.KYCLevel1View
import org.mifos.mobilewallet.mifospay.kyc.presenter.KYCLevel1Presenter
import org.mifos.mobilewallet.mifospay.common.Constants
import org.mifos.mobilewallet.mifospay.utils.Toaster
import org.mifos.mobilewallet.mifospay.utils.Utils.hideSoftKeyboard
import java.text.SimpleDateFormat
import java.util.Calendar
import javax.inject.Inject

/**
* Created by ankur on 17/May/2018
*/
@AndroidEntryPoint
class KYCLevel1Fragment : BaseFragment() {
class KYCLevel1Fragment : BaseFragment(), KYCLevel1View {
@JvmField
@Inject
var mPresenter: KYCLevel1Presenter? = null
var mKYCLevel1Presenter: KYCContract.KYCLevel1Presenter? = null

@JvmField
@BindView(R.id.et_fname)
var etFname: EditText? = null

@JvmField
@BindView(R.id.et_lname)
var etLname: EditText? = null

@JvmField
@BindView(R.id.et_address1)
var etAddress1: EditText? = null

@JvmField
@BindView(R.id.et_address2)
var etAddress2: EditText? = null

@JvmField
@BindView(R.id.ccp_code)
var ccpPhonecode: CountryCodePicker? = null

@JvmField
@BindView(R.id.et_mobile_number)
var etMobileNumber: EditText? = null

@JvmField
@BindView(R.id.et_dob)
var etDOB: EditText? = null

@JvmField
@BindView(R.id.btn_submit)
var btnSubmit: Button? = null
var date: OnDateSetListener? = null
private lateinit var myCalendar: Calendar

override fun onCreateView(
inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?
): View {
return ComposeView(requireContext()).apply {
setViewCompositionStrategy(ViewCompositionStrategy.DisposeOnViewTreeLifecycleDestroyed)
setContent {
MifosTheme {
KYCLevel1Screen(
navigateBack = { goBack() }
)
}
}
): View? {
val rootView = inflater.inflate(R.layout.fragment_kyc_lvl1, container, false)
ButterKnife.bind(this, rootView)
mPresenter!!.attachView(this)
//setToolbarTitle(Constants.KYC_REGISTRATION_LEVEL_1);
myCalendar = Calendar.getInstance()
date = OnDateSetListener { view, year, monthOfYear, dayOfMonth ->
myCalendar.set(Calendar.YEAR, year)
myCalendar.set(Calendar.MONTH, monthOfYear)
myCalendar.set(Calendar.DAY_OF_MONTH, dayOfMonth)
val myFormat = Constants.DD_MM_YY
val sdf = SimpleDateFormat(myFormat)
etDOB!!.setText(sdf.format(myCalendar.getTime()))
}
ccpPhonecode!!.registerCarrierNumberEditText(etMobileNumber)
ccpPhonecode!!.setCustomMasterCountries(null)
return rootView
}

@OnClick(R.id.et_dob)
fun onClickDOB() {
myCalendar
?.get(Calendar.YEAR)?.let {
DatePickerDialog(
requireContext(), date, it, myCalendar!![Calendar.MONTH],
myCalendar!![Calendar.DAY_OF_MONTH]
).show()
}
}

@OnClick(R.id.btn_submit)
fun onClickSubmit() {
showProgressDialog(Constants.PLEASE_WAIT)
val fname = etFname!!.text.toString().trim { it <= ' ' }
val lname = etLname!!.text.toString().trim { it <= ' ' }
val address1 = etAddress1!!.text.toString().trim { it <= ' ' }
val address2 = etAddress2!!.text.toString().trim { it <= ' ' }
val phoneno = ccpPhonecode!!.fullNumber
val dob = etDOB!!.text.toString().trim { it <= ' ' }
mKYCLevel1Presenter!!.submitData(fname, lname, address1, address2, phoneno, dob)
hideSoftKeyboard(requireActivity())
}

fun goBack() {
override fun showToast(s: String?) {
Toaster.show(view, s)
}

public override fun showProgressDialog(message: String?) {
super.showProgressDialog(message)
}

override fun hideProgressDialog() {
super.hideProgressDialog()
}

override fun goBack() {
val intent = requireActivity().intent
requireActivity().finish()
startActivity(intent)
}

override fun setPresenter(presenter: KYCContract.KYCLevel1Presenter?) {
mKYCLevel1Presenter = presenter
}

companion object {
@JvmStatic
fun newInstance(): KYCLevel1Fragment {
Expand Down
Loading

0 comments on commit 51b01f9

Please sign in to comment.