|
|
@ -3,7 +3,6 @@ package com.nivesh.production.bajajfd.ui.activity |
|
|
|
import android.graphics.drawable.Drawable |
|
|
|
import android.os.Bundle |
|
|
|
import android.util.Log |
|
|
|
import androidx.appcompat.app.AppCompatActivity |
|
|
|
import androidx.fragment.app.Fragment |
|
|
|
import androidx.lifecycle.ViewModelProvider |
|
|
|
import androidx.viewpager.widget.ViewPager |
|
|
@ -26,7 +25,7 @@ import com.nivesh.production.bajajfd.util.Resource |
|
|
|
import com.nivesh.production.bajajfd.viewModel.* |
|
|
|
|
|
|
|
|
|
|
|
class BajajFdMainActivity : AppCompatActivity(), BajajFDInterface { |
|
|
|
class BajajFdMainActivity : BaseActivity(), BajajFDInterface { |
|
|
|
lateinit var binding: ActivityBajajFdBinding |
|
|
|
private lateinit var viewModel: BajajFDViewModel |
|
|
|
|
|
|
@ -385,13 +384,13 @@ class BajajFdMainActivity : AppCompatActivity(), BajajFDInterface { |
|
|
|
// step 2 response |
|
|
|
override fun stepTwoApi(data: CreateFDRequest) { |
|
|
|
Log.e("stepTwoApi", " response ---> $data") |
|
|
|
if (stepCount == 4) { |
|
|
|
// if (stepCount == 4) { |
|
|
|
// go to step 3 image Upload |
|
|
|
binding.viewPager.currentItem = 2 |
|
|
|
} else { |
|
|
|
// binding.viewPager.currentItem = 2 |
|
|
|
// } else { |
|
|
|
// call create fd api bypass step 3 |
|
|
|
createFDApi(data, 2) |
|
|
|
} |
|
|
|
createFDApi(data, 2, "2") |
|
|
|
// } |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -399,7 +398,7 @@ class BajajFdMainActivity : AppCompatActivity(), BajajFDInterface { |
|
|
|
override fun stepThreeApi(data: CreateFDRequest) { |
|
|
|
Log.e("stepThreeApi", " response ---> $data") |
|
|
|
// call create fd api |
|
|
|
createFDApi(data, 3) |
|
|
|
createFDApi(data, 3, "3") |
|
|
|
} |
|
|
|
|
|
|
|
// step 4 response |
|
|
@ -408,7 +407,7 @@ class BajajFdMainActivity : AppCompatActivity(), BajajFDInterface { |
|
|
|
binding.viewPager.currentItem = 4 |
|
|
|
} |
|
|
|
|
|
|
|
private fun createFDApi(data: CreateFDRequest, currentItem: Int) { |
|
|
|
private fun createFDApi(data: CreateFDRequest, currentItem: Int, step: String) { |
|
|
|
if (Common.isNetworkAvailable(this@BajajFdMainActivity)) { |
|
|
|
|
|
|
|
viewModel.createFDApi(data, token) |
|
|
@ -425,10 +424,16 @@ class BajajFdMainActivity : AppCompatActivity(), BajajFDInterface { |
|
|
|
when (code) { |
|
|
|
200 -> { |
|
|
|
binding.viewPager.currentItem = currentItem |
|
|
|
StepFourBajajFDFragment.getInstance(this).displayReceivedData(createFDApplicationResponse) |
|
|
|
if (step == "2"){ |
|
|
|
val stepThreeBajajFDFragment: StepThreeBajajFDFragment = |
|
|
|
sectionsPagerAdapter.getRegisteredFragment(stepCount - 1) as StepThreeBajajFDFragment |
|
|
|
stepThreeBajajFDFragment.displayReceivedData(createFDApplicationResponse) |
|
|
|
} |
|
|
|
else{ |
|
|
|
val stepFourFDFragment: StepFourBajajFDFragment = |
|
|
|
sectionsPagerAdapter.getRegisteredFragment(stepCount - 1) as StepFourBajajFDFragment |
|
|
|
stepFourFDFragment.displayReceivedData(createFDApplicationResponse) |
|
|
|
} |
|
|
|
} |
|
|
|
// 650 -> refreshToken() |
|
|
|
else -> { |
|
|
|