Merge branch 'epoch-id' into 'dev'

add epoch based id

See merge request sminnovations/hpos-registration-app!2
This commit is contained in:
Pritimay Sarkar
2024-01-08 17:47:02 +00:00

View File

@@ -19,6 +19,7 @@ import com.journeyapps.barcodescanner.ScanIntentResult
import dagger.hilt.android.AndroidEntryPoint
import `in`.sminnovations.hposregistration.databinding.FragmentAbhaRegistrationBinding
import org.json.JSONObject
import java.time.Instant
@AndroidEntryPoint
class AbhaRegistrationFragment : BaseFragment() {
@@ -78,6 +79,7 @@ class AbhaRegistrationFragment : BaseFragment() {
val userName = binding.etName.text.toString()
val aadharIdInput = binding.aadharID.text.toString()
val centerName = binding.centerName.text.toString()
val currentUnixTime = Instant.now().epochSecond
if (validateInputs(abhaIdInput, aadharIdInput, userName, centerName)) {
userData.apply {
@@ -85,7 +87,8 @@ class AbhaRegistrationFragment : BaseFragment() {
aadharId = aadharIdInput
abhaId = abhaIdInput
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)