Merge branch 'epoch-id' into 'dev'
add epoch based id See merge request sminnovations/hpos-registration-app!2
This commit is contained in:
@@ -19,6 +19,7 @@ import com.journeyapps.barcodescanner.ScanIntentResult
|
|||||||
import dagger.hilt.android.AndroidEntryPoint
|
import dagger.hilt.android.AndroidEntryPoint
|
||||||
import `in`.sminnovations.hposregistration.databinding.FragmentAbhaRegistrationBinding
|
import `in`.sminnovations.hposregistration.databinding.FragmentAbhaRegistrationBinding
|
||||||
import org.json.JSONObject
|
import org.json.JSONObject
|
||||||
|
import java.time.Instant
|
||||||
|
|
||||||
@AndroidEntryPoint
|
@AndroidEntryPoint
|
||||||
class AbhaRegistrationFragment : BaseFragment() {
|
class AbhaRegistrationFragment : BaseFragment() {
|
||||||
@@ -78,6 +79,7 @@ class AbhaRegistrationFragment : BaseFragment() {
|
|||||||
val userName = binding.etName.text.toString()
|
val userName = binding.etName.text.toString()
|
||||||
val aadharIdInput = binding.aadharID.text.toString()
|
val aadharIdInput = binding.aadharID.text.toString()
|
||||||
val centerName = binding.centerName.text.toString()
|
val centerName = binding.centerName.text.toString()
|
||||||
|
val currentUnixTime = Instant.now().epochSecond
|
||||||
|
|
||||||
if (validateInputs(abhaIdInput, aadharIdInput, userName, centerName)) {
|
if (validateInputs(abhaIdInput, aadharIdInput, userName, centerName)) {
|
||||||
userData.apply {
|
userData.apply {
|
||||||
@@ -85,7 +87,8 @@ class AbhaRegistrationFragment : BaseFragment() {
|
|||||||
aadharId = aadharIdInput
|
aadharId = aadharIdInput
|
||||||
abhaId = abhaIdInput
|
abhaId = abhaIdInput
|
||||||
registrationCenterName = centerName
|
registrationCenterName = centerName
|
||||||
_id = aadharId + userName.substring(0, 3).uppercase() + centerName.substring(0, 3).uppercase()
|
_id = centerName.substring(0, 3).uppercase() + currentUnixTime.toString()
|
||||||
|
// _id = aadharId + userName.substring(0, 3).uppercase() + centerName.substring(0, 3).uppercase()
|
||||||
}
|
}
|
||||||
|
|
||||||
viewModel.insert(userData)
|
viewModel.insert(userData)
|
||||||
|
|||||||
Reference in New Issue
Block a user