Bugfix/crashes (#855)
* crashes * minor code refactoring * merge conflict
This commit is contained in:
committed by
GitHub Enterprise
parent
1c7bf3ac6b
commit
36b2280e51
@@ -228,15 +228,22 @@ abstract class BaseActivity : AppCompatActivity(), Toolbar.OnMenuItemClickListen
|
||||
|
||||
fun showLoader() {
|
||||
NaviAnalytics.naviAnalytics.NaviLoader().onLoaderShown()
|
||||
val fragmentTransaction = supportFragmentManager.beginTransaction()
|
||||
val prev = supportFragmentManager.findFragmentByTag(screenName)
|
||||
if (prev != null) {
|
||||
fragmentTransaction.remove(prev)
|
||||
try {
|
||||
val ft = supportFragmentManager.beginTransaction()
|
||||
val prev = supportFragmentManager.findFragmentByTag(screenName)
|
||||
if (prev != null) {
|
||||
ft.remove(prev)
|
||||
}
|
||||
ft.addToBackStack(null)
|
||||
loader = NaviLoader.getInstance()
|
||||
loader?.isCancelable = false
|
||||
loader?.apply {
|
||||
ft.add(this, screenName)
|
||||
ft.commitAllowingStateLoss()
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
e.log()
|
||||
}
|
||||
fragmentTransaction.addToBackStack(null)
|
||||
loader = NaviLoader()
|
||||
loader?.isCancelable = false
|
||||
loader?.show(fragmentTransaction, screenName)
|
||||
}
|
||||
|
||||
fun hideLoader() {
|
||||
|
||||
@@ -189,15 +189,14 @@ class GetLoanActivity : BaseActivity(), FragmentInteractionListener,
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
if (isDead()) return
|
||||
val tag = getTag(screen)
|
||||
val fragment = supportFragmentManager.findFragmentByTag(tag) ?: getFragment(screen)
|
||||
fragment.arguments = bundle
|
||||
|
||||
supportFragmentManager.beginTransaction().run {
|
||||
updateCurrentScreen(screen)
|
||||
replace(R.id.get_loan_container, fragment, tag)
|
||||
commit()
|
||||
commitAllowingStateLoss()
|
||||
}
|
||||
|
||||
bundle?.let {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.naviapp.getloan.common
|
||||
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
import android.view.ViewStub
|
||||
import androidx.databinding.DataBindingUtil
|
||||
@@ -52,26 +53,29 @@ class CustomerSupportFragment : BaseBottomSheet(), View.OnClickListener {
|
||||
when (v?.id) {
|
||||
R.id.send_email_ibv -> {
|
||||
showLoader()
|
||||
eventTracker.onSendEmailTap(SCREEN_NAME)
|
||||
eventTracker.onSendEmailTap(arguments?.getString(CUST_SCREEN_NAME).orEmpty())
|
||||
viewModel.fetchUserProfileData()
|
||||
}
|
||||
R.id.call_ibv -> {
|
||||
eventTracker.onCallTap(SCREEN_NAME)
|
||||
eventTracker.onCallTap(arguments?.getString(CUST_SCREEN_NAME).orEmpty())
|
||||
context?.let { openCallDialScreen(it) }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override val screenName: String
|
||||
get() = "help_${SCREEN_NAME}_screen"
|
||||
get() = "help_${arguments?.getString(CUST_SCREEN_NAME).orEmpty()}_screen"
|
||||
|
||||
companion object {
|
||||
private lateinit var SCREEN_NAME: String
|
||||
private val CUST_SCREEN_NAME = "SCREEN_NAME"
|
||||
const val TAG = "CUSTOMER_SUPPORT_FRAGMENT"
|
||||
|
||||
fun newInstance(screenName: String): CustomerSupportFragment {
|
||||
SCREEN_NAME = screenName
|
||||
return CustomerSupportFragment()
|
||||
return CustomerSupportFragment().apply {
|
||||
arguments = Bundle().apply {
|
||||
putString(CUST_SCREEN_NAME, screenName)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -52,14 +52,9 @@ import com.naviapp.models.request.KycRequest
|
||||
import com.naviapp.network.ApiConstants
|
||||
import com.naviapp.network.ApiErrorTagType
|
||||
import com.naviapp.network.models.GenericErrorResponse
|
||||
import com.naviapp.utils.Constants
|
||||
import com.naviapp.utils.*
|
||||
import com.naviapp.utils.Constants.MIN_ADDRESS_SIZE
|
||||
import com.naviapp.utils.Constants.SHOULD_SET_PROGRESS
|
||||
import com.naviapp.utils.isDead
|
||||
import com.naviapp.utils.observeNonNull
|
||||
import com.naviapp.utils.observeNullable
|
||||
import com.naviapp.utils.orFalse
|
||||
import com.naviapp.utils.orTrue
|
||||
import kotlinx.android.synthetic.main.kyc_address_layout.view.no_rb
|
||||
import kotlinx.android.synthetic.main.kyc_address_layout.view.yes_rb
|
||||
import timber.log.Timber
|
||||
@@ -566,8 +561,12 @@ class KycFragment : BaseFragment(), RadioGroup.OnCheckedChangeListener, View.OnC
|
||||
|
||||
private fun openSelfieScreen() {
|
||||
analyticsEventTracker.onSelfieButtonTap()
|
||||
val intent = Intent(activity, SelfieCaptureActivity::class.java)
|
||||
startActivityForResult(intent, SELFIE_REQUEST_CODE)
|
||||
try {
|
||||
val intent = Intent(activity, SelfieCaptureActivity::class.java)
|
||||
startActivityForResult(intent, SELFIE_REQUEST_CODE)
|
||||
} catch (e: Exception) {
|
||||
e.log()
|
||||
}
|
||||
}
|
||||
|
||||
override fun onCheckedChanged(group: RadioGroup?, checkedId: Int) {
|
||||
|
||||
@@ -35,19 +35,9 @@ import com.naviapp.models.Tenure
|
||||
import com.naviapp.network.ApiErrorTagType
|
||||
import com.naviapp.sharedpref.PreferenceManager
|
||||
import com.naviapp.useridentification.activities.LoanEligibilityLoaderActivity.Companion.OFFER
|
||||
import com.naviapp.utils.*
|
||||
import com.naviapp.utils.Constants.SET_MAX_PROGRESS_ONLY
|
||||
import com.naviapp.utils.Constants.SHOULD_SET_PROGRESS
|
||||
import com.naviapp.utils.EmiCalculator
|
||||
import com.naviapp.utils.LOAN_AMOUNT
|
||||
import com.naviapp.utils.OFFER_ID
|
||||
import com.naviapp.utils.PRODUCT_CODE
|
||||
import com.naviapp.utils.SPACE
|
||||
import com.naviapp.utils.formatCurrency
|
||||
import com.naviapp.utils.isDead
|
||||
import com.naviapp.utils.observeNonNull
|
||||
import com.naviapp.utils.observeNullable
|
||||
import com.naviapp.utils.orFalse
|
||||
import com.naviapp.utils.orTrue
|
||||
import org.joda.money.BigMoney
|
||||
import org.joda.money.CurrencyUnit
|
||||
import java.math.BigDecimal
|
||||
@@ -378,15 +368,24 @@ class LoanDetailsFragment : BaseFragment(), View.OnClickListener, LoanDetailsLis
|
||||
Handler().postDelayed(
|
||||
{
|
||||
if (!isAdded || isDead(activity)) return@postDelayed
|
||||
MoratoriumConsentFragment.newInstance(offer).show(
|
||||
childFragmentManager,
|
||||
MoratoriumConsentFragment.TAG
|
||||
)
|
||||
openMoratoriumScreen(offer)
|
||||
},
|
||||
MORATORIUM_CONSENT_DELAY
|
||||
)
|
||||
}
|
||||
|
||||
private fun openMoratoriumScreen(offer: Offer) {
|
||||
try {
|
||||
val moratoriumDialog =
|
||||
MoratoriumConsentFragment.newInstance(offer)
|
||||
val ft = this.childFragmentManager.beginTransaction()
|
||||
ft.add(moratoriumDialog, MoratoriumConsentFragment.TAG)
|
||||
ft.commitAllowingStateLoss()
|
||||
} catch (e: Exception) {
|
||||
e.log()
|
||||
}
|
||||
}
|
||||
|
||||
private fun initSlider(
|
||||
view: FormSliderView,
|
||||
title: Int,
|
||||
|
||||
@@ -23,4 +23,10 @@ class NaviLoader :
|
||||
|
||||
override fun onClick(v: View?) {
|
||||
}
|
||||
|
||||
companion object {
|
||||
fun getInstance(): NaviLoader {
|
||||
return NaviLoader()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -189,7 +189,11 @@ class UserIdentificationActivity : BaseActivity(), FragmentInterchangeListener,
|
||||
binding.formViewPager.attachFormProgressBar(binding.formProgressBar)
|
||||
binding.formViewPager.offscreenPageLimit = NUMBER_OF_PAGES
|
||||
loanEligibilityAdapter = LoanEligibilityAdapter(supportFragmentManager).apply {
|
||||
setFragments(ProfileFragment(), WorkFragment(), PanFragment())
|
||||
setFragments(
|
||||
ProfileFragment.getInstance(),
|
||||
WorkFragment.getInstance(),
|
||||
PanFragment.getInstance()
|
||||
)
|
||||
binding.formViewPager.adapter = this
|
||||
}
|
||||
|
||||
|
||||
@@ -285,5 +285,9 @@ class PanFragment : BaseFragment(), View.OnClickListener {
|
||||
|
||||
companion object {
|
||||
const val TAG = "PAN_FRAGMENT"
|
||||
|
||||
fun getInstance(): PanFragment {
|
||||
return PanFragment()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -471,5 +471,9 @@ class ProfileFragment : BaseFragment(), View.OnClickListener,
|
||||
private const val OTHER = "OTHER"
|
||||
private const val MARRIED = "MARRIED"
|
||||
private const val SINGLE = "SINGLE"
|
||||
|
||||
fun getInstance(): ProfileFragment {
|
||||
return ProfileFragment()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -431,5 +431,9 @@ class WorkFragment : BaseFragment(), View.OnClickListener, View.OnKeyListener,
|
||||
const val COMPANY_NAME_SELECTED = "COMPANY_NAME_SELECTED"
|
||||
private const val GOOD_INCOME = 40000
|
||||
private const val SALARIED = "salaried"
|
||||
|
||||
fun getInstance(): WorkFragment {
|
||||
return WorkFragment()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -199,7 +199,7 @@ fun hideRatingWidget(view: View, activity: Activity?) {
|
||||
}
|
||||
|
||||
fun openPlayStore(activity: Activity) {
|
||||
val pkgName = NaviApplication.instance.applicationContext.packageName
|
||||
val pkgName = getPackgName()
|
||||
try {
|
||||
activity.startActivityForResult(
|
||||
Intent(
|
||||
@@ -216,4 +216,12 @@ fun openPlayStore(activity: Activity) {
|
||||
)
|
||||
} finally {
|
||||
}
|
||||
}
|
||||
|
||||
private fun getPackgName(): String {
|
||||
try {
|
||||
return NaviApplication.instance.applicationContext.packageName
|
||||
} catch (e: Exception) {
|
||||
return "com.naviapp"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user