diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index b149776..afc6b13 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -20,6 +20,7 @@ = HashMap() + private val requestPermission = registerForActivityResult( ActivityResultContracts.RequestPermission() ) { isGranted: Boolean -> @@ -116,11 +119,40 @@ class StepThreeBajajFDFragment : BaseFragment() { binding.btnNext.setOnClickListener { if (validate()) { - uploadDocApi( - "PAN", - "data:image/".plus(panFileExt).plus(";base64, ").plus(panString), - 1 - ) + +// private var panString: String = "" +// private var photoString: String = "" +// private var docString: String = "" +// private var docString2: String = "" + + if(panString.isNotEmpty()){ + mapImage["PAN"] = "data:image/".plus(panFileExt) + .plus(";base64, ").plus(panString) + } + if(photoString.isNotEmpty()){ + mapImage["Photograph"] = "data:image/".plus(photoFileExt) + .plus(";base64, ").plus(photoString) + } + if(docString.isNotEmpty()){ + mapImage["docValue"] = "data:image/".plus(doc1FileExt) + .plus(";base64, ").plus(docString) + } + if(docString2.isNotEmpty()){ + mapImage["Aadhar"] = "data:image/".plus(doc2fileExt) + .plus(";base64, ").plus(docString2) + } + + var uploadPosition = 0 + for (entry in mapImage.iterator()) { + uploadPosition++ + uploadDocApi(entry.key, entry.value, uploadPosition) + } + +// uploadDocApi( +// "PAN", +// "data:image/".plus(panFileExt).plus(";base64, ").plus(panString), +// 1 +// ) } } binding.btnBack.setOnClickListener { @@ -398,34 +430,41 @@ class StepThreeBajajFDFragment : BaseFragment() { when (code) { 200 -> { Log.e("check_upload_res", response.message.toString()) - if (uploadPosition == 1) { - uploadDocApi( - "Photograph", - "data:image/".plus(photoFileExt).plus(";base64, ") - .plus(photoString), - 2 - ) - } else if (uploadPosition == 2) { - uploadDocApi( - docValue, - "data:image/".plus(doc1FileExt).plus(";base64, ") - .plus(docString), - 3 - ) - } else if (uploadPosition == 3) { - if (docValue == "Aadhar") { - uploadDocApi( - docValue, - "data:image/".plus(doc2fileExt).plus(";base64, ") - .plus(docString2), - 4 - ) - } else { - createFDApi((activity as BajajFdMainActivity).createFDRequest) - } - } else if (uploadPosition == 4) { + if(uploadPosition == mapImage.size){ +// Common.showDialogValidation( +// activity as BajajFdMainActivity, +// "Documents Uploaded Successfully") + Toast.makeText(requireActivity(),"Documents Uploaded Successfully",Toast.LENGTH_SHORT).show() createFDApi((activity as BajajFdMainActivity).createFDRequest) } +// if (uploadPosition == 1) { +// uploadDocApi( +// "Photograph", +// "data:image/".plus(photoFileExt).plus(";base64, ") +// .plus(photoString), +// 2 +// ) +// } else if (uploadPosition == 2) { +// uploadDocApi( +// docValue, +// "data:image/".plus(doc1FileExt).plus(";base64, ") +// .plus(docString), +// 3 +// ) +// } else if (uploadPosition == 3) { +// if (docValue == "Aadhar") { +// uploadDocApi( +// docValue, +// "data:image/".plus(doc2fileExt).plus(";base64, ") +// .plus(docString2), +// 4 +// ) +// } else { +// createFDApi((activity as BajajFdMainActivity).createFDRequest) +// } +// } else if (uploadPosition == 4) { +// createFDApi((activity as BajajFdMainActivity).createFDRequest) +// } } // 650 -> refreshToken()