|
|
@ -4,10 +4,10 @@ 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 |
|
|
|
import com.google.gson.Gson |
|
|
|
import com.nivesh.production.bajajfd.R |
|
|
|
import com.nivesh.production.bajajfd.adapter.SectionsPagerAdapter |
|
|
|
import com.nivesh.production.bajajfd.api.ApiClient |
|
|
|
import com.nivesh.production.bajajfd.databinding.ActivityBajajFdBinding |
|
|
@ -25,6 +25,7 @@ import com.nivesh.production.bajajfd.util.Constants.Companion.token |
|
|
|
import com.nivesh.production.bajajfd.util.Resource |
|
|
|
import com.nivesh.production.bajajfd.viewModel.* |
|
|
|
|
|
|
|
|
|
|
|
class BajajFdMainActivity : AppCompatActivity(), BajajFDInterface { |
|
|
|
lateinit var binding: ActivityBajajFdBinding |
|
|
|
private lateinit var viewModel: BajajFDViewModel |
|
|
@ -46,6 +47,8 @@ class BajajFdMainActivity : AppCompatActivity(), BajajFDInterface { |
|
|
|
var getClientDetailsResponse: getClientDetailsResponse |
|
|
|
|
|
|
|
private var stepCount: Int = 0 |
|
|
|
lateinit var sectionsPagerAdapter : SectionsPagerAdapter |
|
|
|
lateinit var fragments: Array<Fragment> |
|
|
|
|
|
|
|
override fun onCreate(savedInstanceState: Bundle?) { |
|
|
|
super.onCreate(savedInstanceState) |
|
|
@ -107,7 +110,7 @@ class BajajFdMainActivity : AppCompatActivity(), BajajFDInterface { |
|
|
|
|
|
|
|
private fun getStepsCountApi() { |
|
|
|
val fdStepsCount = FDStepsCountRequest() |
|
|
|
fdStepsCount.FDProvider = getString(R.string.bajaj) |
|
|
|
fdStepsCount.FDProvider = getString(com.nivesh.production.bajajfd.R.string.bajaj) |
|
|
|
fdStepsCount.NiveshClientCode = "8872" |
|
|
|
viewModel.getStepsCount(fdStepsCount, token) |
|
|
|
viewModel.getStepsCountMutableData.observe(this) { response -> |
|
|
@ -155,20 +158,20 @@ class BajajFdMainActivity : AppCompatActivity(), BajajFDInterface { |
|
|
|
if (Common.isNetworkAvailable(this@BajajFdMainActivity)) { |
|
|
|
val getClientDetailsRequest = getClientDetailsRequest() |
|
|
|
getClientDetailsRequest.client_code = "8872" |
|
|
|
getClientDetailsRequest.AppOrWeb = getString(R.string.app) |
|
|
|
getClientDetailsRequest.AppOrWeb = getString(com.nivesh.production.bajajfd.R.string.app) |
|
|
|
getClientDetailsRequest.sub_broker_code = "1038" |
|
|
|
|
|
|
|
val userRequest = UserRequest() |
|
|
|
userRequest.UID = 19060 |
|
|
|
userRequest.IPAddress = "" |
|
|
|
userRequest.Source = getString(R.string.source) |
|
|
|
userRequest.AppOrWeb = getString(R.string.app) |
|
|
|
userRequest.Source = getString(com.nivesh.production.bajajfd.R.string.source) |
|
|
|
userRequest.AppOrWeb = getString(com.nivesh.production.bajajfd.R.string.app) |
|
|
|
userRequest.LoggedInRoleId = 5 |
|
|
|
|
|
|
|
val deviceInfo = DeviceInfo() |
|
|
|
deviceInfo.device_id = "" |
|
|
|
deviceInfo.device_id_for_UMSId = "" |
|
|
|
deviceInfo.device_type = getString(R.string.app) |
|
|
|
deviceInfo.device_type = getString(com.nivesh.production.bajajfd.R.string.app) |
|
|
|
deviceInfo.device_model = "" |
|
|
|
deviceInfo.device_token = "" |
|
|
|
deviceInfo.device_name = "" |
|
|
@ -219,17 +222,28 @@ class BajajFdMainActivity : AppCompatActivity(), BajajFDInterface { |
|
|
|
// steps setting |
|
|
|
setBackground(selectedShape(), defaultShape(), defaultShape(), defaultShape()) |
|
|
|
|
|
|
|
if (stepCount == 3) { |
|
|
|
fragments = arrayOf( |
|
|
|
StepOneBajajFDFragment.getInstance(this), |
|
|
|
StepTwoBajajFDFragment.getInstance(this), |
|
|
|
StepFourBajajFDFragment.getInstance(this), |
|
|
|
StepFiveBajajFDFragment.getInstance(this) |
|
|
|
) |
|
|
|
} else if (stepCount == 4) { |
|
|
|
fragments = arrayOf( |
|
|
|
StepOneBajajFDFragment.getInstance(this), |
|
|
|
StepTwoBajajFDFragment.getInstance(this), |
|
|
|
StepThreeBajajFDFragment.getInstance(this), |
|
|
|
StepFourBajajFDFragment.getInstance(this), |
|
|
|
StepFiveBajajFDFragment.getInstance(this) |
|
|
|
) |
|
|
|
} |
|
|
|
|
|
|
|
// set viewPager |
|
|
|
val sectionsPagerAdapter = |
|
|
|
SectionsPagerAdapter(this@BajajFdMainActivity, supportFragmentManager) |
|
|
|
sectionsPagerAdapter = |
|
|
|
SectionsPagerAdapter(supportFragmentManager, fragments, stepsCount) |
|
|
|
val viewPager: ViewPager = binding.viewPager |
|
|
|
sectionsPagerAdapter.addFragment(StepOneBajajFDFragment.getInstance(this@BajajFdMainActivity)) |
|
|
|
sectionsPagerAdapter.addFragment(StepTwoBajajFDFragment.getInstance(this@BajajFdMainActivity)) |
|
|
|
if (stepsCount == 4) { |
|
|
|
sectionsPagerAdapter.addFragment(StepThreeBajajFDFragment.getInstance(this@BajajFdMainActivity)) |
|
|
|
} |
|
|
|
sectionsPagerAdapter.addFragment(StepFourBajajFDFragment.getInstance(this@BajajFdMainActivity)) |
|
|
|
sectionsPagerAdapter.addFragment(StepFiveBajajFDFragment.getInstance(this@BajajFdMainActivity)) |
|
|
|
|
|
|
|
viewPager.adapter = sectionsPagerAdapter |
|
|
|
|
|
|
|
viewPager.addOnPageChangeListener(object : ViewPager.OnPageChangeListener { |
|
|
@ -306,7 +320,7 @@ class BajajFdMainActivity : AppCompatActivity(), BajajFDInterface { |
|
|
|
getClientDetailsResponse.ObjectResponse?.clientDetails?.clientMasterMFD?.CLIENT_PAN |
|
|
|
checkFDKYCRequest.NiveshClientCode = |
|
|
|
getClientDetailsResponse.ObjectResponse?.clientDetails?.clientMasterMFD?.CLIENT_CODE.toString() |
|
|
|
stepOneBajajFDViewModel.checkFDKYC( checkFDKYCRequest, token) |
|
|
|
stepOneBajajFDViewModel.checkFDKYC(checkFDKYCRequest, token) |
|
|
|
stepOneBajajFDViewModel.getFDKYCMutableData.observe(this) { response -> |
|
|
|
when (response) { |
|
|
|
is Resource.Success -> { |
|
|
@ -411,8 +425,10 @@ class BajajFdMainActivity : AppCompatActivity(), BajajFDInterface { |
|
|
|
when (code) { |
|
|
|
200 -> { |
|
|
|
binding.viewPager.currentItem = currentItem |
|
|
|
StepFourBajajFDFragment.getInstance(this) |
|
|
|
.getFDData(createFDApplicationResponse ,this) |
|
|
|
StepFourBajajFDFragment.getInstance(this).displayReceivedData(createFDApplicationResponse) |
|
|
|
val stepFourFDFragment: StepFourBajajFDFragment = |
|
|
|
sectionsPagerAdapter.getRegisteredFragment(stepCount - 1) as StepFourBajajFDFragment |
|
|
|
stepFourFDFragment.displayReceivedData(createFDApplicationResponse) |
|
|
|
} |
|
|
|
// 650 -> refreshToken() |
|
|
|
else -> { |
|
|
@ -435,10 +451,6 @@ class BajajFdMainActivity : AppCompatActivity(), BajajFDInterface { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |