Compare commits
2 Commits
preprod-ba
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fe1f6f5a16 | ||
|
|
3daec52ee8 |
5
.idea/gradle.xml
generated
5
.idea/gradle.xml
generated
@@ -4,17 +4,16 @@
|
|||||||
<component name="GradleSettings">
|
<component name="GradleSettings">
|
||||||
<option name="linkedExternalProjectsSettings">
|
<option name="linkedExternalProjectsSettings">
|
||||||
<GradleProjectSettings>
|
<GradleProjectSettings>
|
||||||
<option name="testRunner" value="GRADLE" />
|
|
||||||
<option name="distributionType" value="DEFAULT_WRAPPED" />
|
|
||||||
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
||||||
<option name="gradleHome" value="$USER_HOME$/andriod studio gradle/gradle-7.3" />
|
<option name="gradleHome" value="$USER_HOME$/andriod studio gradle/gradle-7.3" />
|
||||||
<option name="gradleJvm" value="jbr-17" />
|
<option name="gradleJvm" value="#GRADLE_LOCAL_JAVA_HOME" />
|
||||||
<option name="modules">
|
<option name="modules">
|
||||||
<set>
|
<set>
|
||||||
<option value="$PROJECT_DIR$" />
|
<option value="$PROJECT_DIR$" />
|
||||||
<option value="$PROJECT_DIR$/app" />
|
<option value="$PROJECT_DIR$/app" />
|
||||||
</set>
|
</set>
|
||||||
</option>
|
</option>
|
||||||
|
<option name="resolveExternalAnnotations" value="false" />
|
||||||
</GradleProjectSettings>
|
</GradleProjectSettings>
|
||||||
</option>
|
</option>
|
||||||
</component>
|
</component>
|
||||||
|
|||||||
@@ -13,11 +13,11 @@ android {
|
|||||||
compileSdk 34
|
compileSdk 34
|
||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
applicationId "in.sminnovations.hposregistration"
|
applicationId "in.sminnovations.hposregistration.quality"
|
||||||
minSdk 26
|
minSdk 26
|
||||||
targetSdk 34
|
targetSdk 34
|
||||||
versionCode 6
|
versionCode 13
|
||||||
versionName "1.0.6"
|
versionName "1.0.13"
|
||||||
|
|
||||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||||
}
|
}
|
||||||
@@ -42,9 +42,9 @@ android {
|
|||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
|
|
||||||
implementation 'androidx.core:core-ktx:1.12.0'
|
implementation 'androidx.core:core-ktx:1.10.1'
|
||||||
implementation 'androidx.appcompat:appcompat:1.6.1'
|
implementation 'androidx.appcompat:appcompat:1.6.1'
|
||||||
implementation 'com.google.android.material:material:1.10.0'
|
implementation 'com.google.android.material:material:1.9.0'
|
||||||
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
|
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
|
||||||
testImplementation 'junit:junit:4.13.2'
|
testImplementation 'junit:junit:4.13.2'
|
||||||
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
|
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
|
||||||
@@ -58,26 +58,24 @@ dependencies {
|
|||||||
implementation 'com.google.firebase:firebase-auth-ktx'
|
implementation 'com.google.firebase:firebase-auth-ktx'
|
||||||
implementation 'com.google.firebase:firebase-storage-ktx'
|
implementation 'com.google.firebase:firebase-storage-ktx'
|
||||||
implementation 'com.firebaseui:firebase-ui-firestore:8.0.2'
|
implementation 'com.firebaseui:firebase-ui-firestore:8.0.2'
|
||||||
implementation 'com.google.android.gms:play-services-auth:20.7.0'
|
implementation 'com.google.android.gms:play-services-auth:20.6.0'
|
||||||
implementation 'com.google.firebase:firebase-appdistribution:16.0.0-beta11'
|
|
||||||
implementation("com.google.firebase:firebase-appdistribution-api-ktx:16.0.0-beta11")
|
|
||||||
|
|
||||||
// Coroutines
|
// Coroutines
|
||||||
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.1'
|
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.1'
|
||||||
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.1'
|
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.1'
|
||||||
|
|
||||||
// Coroutine Lifecycle Scopes
|
// Coroutine Lifecycle Scopes
|
||||||
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.6.2"
|
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.6.1"
|
||||||
implementation "androidx.lifecycle:lifecycle-runtime-ktx:2.6.2"
|
implementation "androidx.lifecycle:lifecycle-runtime-ktx:2.6.1"
|
||||||
|
|
||||||
//Dagger - Hilt
|
//Dagger - Hilt
|
||||||
implementation "com.google.dagger:hilt-android:2.46"
|
implementation "com.google.dagger:hilt-android:2.46"
|
||||||
kapt "com.google.dagger:hilt-android-compiler:2.46"
|
kapt "com.google.dagger:hilt-android-compiler:2.46"
|
||||||
kapt "androidx.hilt:hilt-compiler:1.1.0"
|
kapt "androidx.hilt:hilt-compiler:1.0.0"
|
||||||
|
|
||||||
// Navigation Component
|
// Navigation Component
|
||||||
implementation "androidx.navigation:navigation-fragment-ktx:2.7.5"
|
implementation "androidx.navigation:navigation-fragment-ktx:2.7.0"
|
||||||
implementation "androidx.navigation:navigation-ui-ktx:2.7.5"
|
implementation "androidx.navigation:navigation-ui-ktx:2.7.0"
|
||||||
|
|
||||||
// Retrofit + GSON
|
// Retrofit + GSON
|
||||||
implementation "com.squareup.retrofit2:retrofit:2.9.0"
|
implementation "com.squareup.retrofit2:retrofit:2.9.0"
|
||||||
@@ -87,16 +85,16 @@ dependencies {
|
|||||||
implementation 'com.jakewharton.timber:timber:4.7.1'
|
implementation 'com.jakewharton.timber:timber:4.7.1'
|
||||||
|
|
||||||
// Activity KTX for viewModels()
|
// Activity KTX for viewModels()
|
||||||
implementation "androidx.activity:activity-ktx:1.8.1"
|
implementation "androidx.activity:activity-ktx:1.7.2"
|
||||||
|
|
||||||
//image
|
//image
|
||||||
implementation 'com.github.bumptech.glide:glide:4.13.2'
|
implementation 'com.github.bumptech.glide:glide:4.13.2'
|
||||||
annotationProcessor 'com.github.bumptech.glide:compiler:4.13.2'
|
annotationProcessor 'com.github.bumptech.glide:compiler:4.13.2'
|
||||||
|
|
||||||
//Room
|
//Room
|
||||||
implementation "androidx.room:room-ktx:2.6.1"
|
implementation "androidx.room:room-ktx:2.6.0-alpha03"
|
||||||
implementation "androidx.room:room-runtime:2.6.1"
|
implementation "androidx.room:room-runtime:2.6.0-alpha03"
|
||||||
kapt ("androidx.room:room-compiler:2.6.1")
|
kapt ("androidx.room:room-compiler:2.6.0-alpha03")
|
||||||
|
|
||||||
// Barcode scanner
|
// Barcode scanner
|
||||||
implementation 'com.journeyapps:zxing-android-embedded:4.3.0'
|
implementation 'com.journeyapps:zxing-android-embedded:4.3.0'
|
||||||
|
|||||||
@@ -1,36 +1,11 @@
|
|||||||
package com.example.hposregistration.dao
|
package com.example.hposregistration.dao
|
||||||
|
|
||||||
import android.content.Context
|
|
||||||
import androidx.room.Database
|
import androidx.room.Database
|
||||||
import androidx.room.Room
|
|
||||||
import androidx.room.RoomDatabase
|
import androidx.room.RoomDatabase
|
||||||
import androidx.room.TypeConverters
|
import androidx.room.TypeConverters
|
||||||
import androidx.room.migration.Migration
|
|
||||||
import androidx.sqlite.db.SupportSQLiteDatabase
|
|
||||||
import com.example.hposregistration.data.user.UserData
|
import com.example.hposregistration.data.user.UserData
|
||||||
|
|
||||||
@Database(entities = [UserData::class], version = 3, exportSchema = false)
|
@Database(entities = [UserData::class], version = 1, exportSchema = false)
|
||||||
abstract class MyDatabase : RoomDatabase() {
|
abstract class MyDatabase : RoomDatabase() {
|
||||||
|
|
||||||
abstract fun userDao(): UserDao
|
abstract fun userDao(): UserDao
|
||||||
|
}
|
||||||
companion object {
|
|
||||||
val MIGRATION_2_3: Migration = object : Migration(2, 3) {
|
|
||||||
override fun migrate(database: SupportSQLiteDatabase) {
|
|
||||||
// Define the necessary SQL statements for migration from version 2 to 3
|
|
||||||
// For example, you can alter tables or create new ones
|
|
||||||
database.execSQL("ALTER TABLE user_table ADD COLUMN aadharIdSearch TEXT")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fun getInstance(context: Context): MyDatabase {
|
|
||||||
return Room.databaseBuilder(
|
|
||||||
context.applicationContext,
|
|
||||||
MyDatabase::class.java,
|
|
||||||
"my_database"
|
|
||||||
)
|
|
||||||
.addMigrations(MIGRATION_2_3)
|
|
||||||
.build()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -34,10 +34,7 @@ data class UserData(
|
|||||||
var registeredBy: String? = "",
|
var registeredBy: String? = "",
|
||||||
var createdAt: String? = "",
|
var createdAt: String? = "",
|
||||||
var registrationCenterName: String? = "",
|
var registrationCenterName: String? = "",
|
||||||
var testStatus: Boolean = false,
|
var testStatus: Boolean = false
|
||||||
var userAbhaRegistrationLog:String = "",
|
|
||||||
var userDetailsLog: String = "",
|
|
||||||
var appVersion: String = "",
|
|
||||||
){
|
){
|
||||||
enum class Gender {
|
enum class Gender {
|
||||||
MALE,
|
MALE,
|
||||||
|
|||||||
@@ -27,7 +27,4 @@ class UserDao {
|
|||||||
// suspend fun getPatientList(): List<UserData> {
|
// suspend fun getPatientList(): List<UserData> {
|
||||||
// return patientCollection.get().await().toObjects(UserData::class.java)
|
// return patientCollection.get().await().toObjects(UserData::class.java)
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1,15 +1,10 @@
|
|||||||
package com.example.hposregistration.ui.fragments.registration
|
package com.example.hposregistration.ui.fragments.registration
|
||||||
|
|
||||||
import android.annotation.SuppressLint
|
|
||||||
import android.content.Context
|
|
||||||
import android.content.SharedPreferences
|
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.util.Log
|
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import android.widget.Toast
|
import android.widget.Toast
|
||||||
import androidx.core.content.edit
|
|
||||||
import androidx.fragment.app.viewModels
|
import androidx.fragment.app.viewModels
|
||||||
import androidx.navigation.fragment.findNavController
|
import androidx.navigation.fragment.findNavController
|
||||||
import androidx.navigation.fragment.navArgs
|
import androidx.navigation.fragment.navArgs
|
||||||
@@ -34,7 +29,6 @@ class AbhaRegistrationFragment : BaseFragment() {
|
|||||||
private val viewModel by viewModels<RegistrationViewModel>()
|
private val viewModel by viewModels<RegistrationViewModel>()
|
||||||
private val args: AbhaRegistrationFragmentArgs by navArgs()
|
private val args: AbhaRegistrationFragmentArgs by navArgs()
|
||||||
private var userData = UserData()
|
private var userData = UserData()
|
||||||
private lateinit var sharedPreference:SharedPreferences
|
|
||||||
|
|
||||||
private val barcodeLauncher =
|
private val barcodeLauncher =
|
||||||
registerForActivityResult(ScanContract()) { result: ScanIntentResult ->
|
registerForActivityResult(ScanContract()) { result: ScanIntentResult ->
|
||||||
@@ -51,11 +45,7 @@ class AbhaRegistrationFragment : BaseFragment() {
|
|||||||
inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?
|
inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?
|
||||||
): View {
|
): View {
|
||||||
_binding = FragmentAbhaRegistrationBinding.inflate(inflater, container, false)
|
_binding = FragmentAbhaRegistrationBinding.inflate(inflater, container, false)
|
||||||
sharedPreference =
|
|
||||||
requireContext().getSharedPreferences("PREFERENCE_NAME", Context.MODE_PRIVATE)
|
|
||||||
return binding.root
|
return binding.root
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||||
@@ -63,7 +53,6 @@ class AbhaRegistrationFragment : BaseFragment() {
|
|||||||
init()
|
init()
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressLint("LogNotTimber", "CommitPrefEdits")
|
|
||||||
private fun init() {
|
private fun init() {
|
||||||
binding.btnScanNow.setOnClickListener {
|
binding.btnScanNow.setOnClickListener {
|
||||||
barcodeLauncher.launch(scanQR("Please Scan the Abha ID/Aadhar ID"))
|
barcodeLauncher.launch(scanQR("Please Scan the Abha ID/Aadhar ID"))
|
||||||
@@ -89,28 +78,17 @@ 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()
|
||||||
|
|
||||||
if (validateInputs(abhaIdInput, aadharIdInput, userName, centerName)) {
|
if (validateInputs(abhaIdInput, aadharIdInput, userName, centerName)) {
|
||||||
userData.apply {
|
userData.apply {
|
||||||
name = userName
|
name = userName
|
||||||
aadharId = aadharIdInput
|
aadharId = aadharIdInput
|
||||||
abhaId = abhaIdInput
|
abhaId = abhaIdInput
|
||||||
registrationCenterName = centerName
|
registrationCenterName = centerName
|
||||||
_id = aadharId + userName.substring(0, 3).uppercase() + centerName.substring(0, 3)
|
_id = aadharId + userName.substring(0, 3).uppercase() + centerName.substring(0, 3).uppercase()
|
||||||
.uppercase()
|
|
||||||
userData.userAbhaRegistrationLog = "${userData.abhaId}," + "${userData.name}," +"${userData.aadharId}," + "${userData.registrationCenterName}"
|
|
||||||
Log.e(
|
|
||||||
"userAbhaRegistrationLog",
|
|
||||||
"Assigned userAbhaRegistrationLog: ${userData.userAbhaRegistrationLog}"
|
|
||||||
)
|
|
||||||
|
|
||||||
sharedPreference.edit()
|
|
||||||
.putString("userAbhaRegistrationLog", userData.userAbhaRegistrationLog)
|
|
||||||
.apply()
|
|
||||||
|
|
||||||
Log.e("userAbhaRegistrationLog", sharedPreference.getString("userAbhaRegistrationLog","").toString())
|
|
||||||
}
|
}
|
||||||
viewModel.insert(userData)
|
|
||||||
// Make sure this provides a meaningful string representation of userData
|
viewModel.insert(userData)
|
||||||
|
|
||||||
navigateToUserDetailsFragment(userData._id)
|
navigateToUserDetailsFragment(userData._id)
|
||||||
}
|
}
|
||||||
@@ -131,7 +109,6 @@ class AbhaRegistrationFragment : BaseFragment() {
|
|||||||
state = obj.getString("state name")
|
state = obj.getString("state name")
|
||||||
district = obj.getString("district_name")
|
district = obj.getString("district_name")
|
||||||
house = obj.getString("address")
|
house = obj.getString("address")
|
||||||
userAbhaRegistrationLog = obj.getString("userAbhaRegistrationLog")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (userData.abhaId.isNotEmpty()) {
|
if (userData.abhaId.isNotEmpty()) {
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ import android.content.Context
|
|||||||
import android.content.SharedPreferences
|
import android.content.SharedPreferences
|
||||||
import android.net.Uri
|
import android.net.Uri
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.util.Log
|
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
@@ -48,15 +47,12 @@ class ReviewDetailsRegistrationFragment : BaseFragment() {
|
|||||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||||
super.onViewCreated(view, savedInstanceState)
|
super.onViewCreated(view, savedInstanceState)
|
||||||
init()
|
init()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun init() {
|
private fun init() {
|
||||||
viewModel.getUserByID(args.userId)
|
viewModel.getUserByID(args.userId)
|
||||||
viewModel.userData.observe(viewLifecycleOwner) { user ->
|
viewModel.userData.observe(viewLifecycleOwner) { user ->
|
||||||
userData = user
|
userData = user
|
||||||
userData.userAbhaRegistrationLog = sharedPreference.getString("userAbhaRegistrationLog", "").toString()
|
|
||||||
userData.userDetailsLog = sharedPreference.getString("userDetailslog", "").toString()
|
|
||||||
setUserData(user)
|
setUserData(user)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -174,18 +170,6 @@ class ReviewDetailsRegistrationFragment : BaseFragment() {
|
|||||||
R.string.sickle_cell_family_history, userData.sickleCellHistory
|
R.string.sickle_cell_family_history, userData.sickleCellHistory
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
val pInfo = requireActivity().packageManager.getPackageInfo(
|
|
||||||
requireActivity().packageName, 0
|
|
||||||
)
|
|
||||||
val version = pInfo.versionName
|
|
||||||
userData.appVersion = version
|
|
||||||
userData.userAbhaRegistrationLog = "${userData.abhaId}," + "${userData.name}," +"${userData.aadharId}," + "${userData.registrationCenterName}"
|
|
||||||
userData.userAbhaRegistrationLog = sharedPreference.getString("userAbhaRegistrationLog", "").toString()
|
|
||||||
userData.userDetailsLog = sharedPreference.getString("userDetailslog", "").toString()
|
|
||||||
Log.e("userAbhaRegistrationLog",userData.userAbhaRegistrationLog)
|
|
||||||
Log.e("userAbhaRegistrationLog",userData.userDetailsLog)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,6 @@
|
|||||||
package com.example.hposregistration.ui.fragments.registration
|
package com.example.hposregistration.ui.fragments.registration
|
||||||
|
|
||||||
import android.annotation.SuppressLint
|
|
||||||
import android.content.Context
|
|
||||||
import android.content.SharedPreferences
|
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.util.Log
|
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
@@ -28,7 +24,6 @@ class UserDetailsRegistrationFragment : Fragment() {
|
|||||||
private val viewModel by viewModels<RegistrationViewModel>()
|
private val viewModel by viewModels<RegistrationViewModel>()
|
||||||
|
|
||||||
private lateinit var userData: UserData
|
private lateinit var userData: UserData
|
||||||
private lateinit var sharedPreference: SharedPreferences
|
|
||||||
|
|
||||||
private val args: UserDetailsRegistrationFragmentArgs by navArgs()
|
private val args: UserDetailsRegistrationFragmentArgs by navArgs()
|
||||||
|
|
||||||
@@ -36,9 +31,6 @@ class UserDetailsRegistrationFragment : Fragment() {
|
|||||||
inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?
|
inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?
|
||||||
): View {
|
): View {
|
||||||
_binding = FragmentUserDetailsRegistrationBinding.inflate(inflater, container, false)
|
_binding = FragmentUserDetailsRegistrationBinding.inflate(inflater, container, false)
|
||||||
sharedPreference =
|
|
||||||
requireContext().getSharedPreferences("PREFERENCE_NAME", Context.MODE_PRIVATE)
|
|
||||||
|
|
||||||
return binding.root
|
return binding.root
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -119,43 +111,16 @@ class UserDetailsRegistrationFragment : Fragment() {
|
|||||||
binding.tilFamilyHistory.visibility =
|
binding.tilFamilyHistory.visibility =
|
||||||
if (binding.no1history.isChecked) View.GONE else View.VISIBLE
|
if (binding.no1history.isChecked) View.GONE else View.VISIBLE
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressLint("LogNotTimber")
|
|
||||||
private fun setupSubmitButton() {
|
private fun setupSubmitButton() {
|
||||||
binding.btnSubmit.setOnClickListener {
|
binding.btnSubmit.setOnClickListener {
|
||||||
if (verifyUserDetails()) {
|
if (verifyUserDetails()) {
|
||||||
userData._id = args.userId
|
userData._id = args.userId
|
||||||
viewModel.insert(userData)
|
viewModel.insert(userData)
|
||||||
userData.userDetailsLog = "${userData.birthYear}," +
|
|
||||||
"${userData.gender}," +
|
|
||||||
"${userData.phoneNumber}," +
|
|
||||||
"${userData.careOf}," +
|
|
||||||
"${userData.maritalStatus}," +
|
|
||||||
"${userData.category}," +
|
|
||||||
"${userData.caste}," +
|
|
||||||
"${userData.subCaste ?: ""}," + // Using Elvis operator for nullable fields
|
|
||||||
"${userData.appVersion}," +
|
|
||||||
"${userData.house}," +
|
|
||||||
"${userData.city}," +
|
|
||||||
"${userData.district}," +
|
|
||||||
"${userData.state}," +
|
|
||||||
"${userData.pinCode}," +
|
|
||||||
"${userData.bloodGroup}," +
|
|
||||||
"${userData.isUnderMedication ?: false}," + // Converting null to false
|
|
||||||
"${userData.isUnderTransfusion ?: false}," +
|
|
||||||
"${userData.sickleCellHistory ?: ""}," +
|
|
||||||
"${userData.userImageURL}," +
|
|
||||||
"${userData.registeredBy ?: ""}," +
|
|
||||||
"${userData.createdAt ?: ""}," +
|
|
||||||
"${userData.registrationCenterName ?: ""}," +
|
|
||||||
"${userData.testStatus},"
|
|
||||||
val userDataString = userData.userDetailsLog// Make sure this provides a meaningful string representation of userData
|
|
||||||
sharedPreference.edit()
|
|
||||||
.putString("userDetailslog", userData.userDetailsLog)
|
|
||||||
.apply()
|
|
||||||
Log.e("userAbhaRegistrationLog",userData.userDetailsLog)
|
|
||||||
navigateToCaptureUserImageFragment()
|
navigateToCaptureUserImageFragment()
|
||||||
} else {
|
} else {
|
||||||
showToast("Please enter all the details properly")
|
showToast("Please enter all the details properly")
|
||||||
|
|||||||
@@ -1,9 +1,7 @@
|
|||||||
package com.example.hposregistration.ui.viewmodels
|
package com.example.hposregistration.ui.viewmodels
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.content.SharedPreferences
|
|
||||||
import android.net.Uri
|
import android.net.Uri
|
||||||
import androidx.core.content.ContentProviderCompat.requireContext
|
|
||||||
import androidx.lifecycle.LiveData
|
import androidx.lifecycle.LiveData
|
||||||
import androidx.lifecycle.MutableLiveData
|
import androidx.lifecycle.MutableLiveData
|
||||||
import androidx.lifecycle.ViewModel
|
import androidx.lifecycle.ViewModel
|
||||||
@@ -32,11 +30,8 @@ class RegistrationViewModel @Inject constructor(
|
|||||||
val allUserData = mainRepository.allUsers
|
val allUserData = mainRepository.allUsers
|
||||||
|
|
||||||
val fireBaseUpload = MutableLiveData<String>()
|
val fireBaseUpload = MutableLiveData<String>()
|
||||||
private val sharedPreference =
|
|
||||||
context.getSharedPreferences("PREFERENCE_NAME", Context.MODE_PRIVATE)
|
|
||||||
fun addUserToDatabase(userData: UserData) = viewModelScope.launch {
|
fun addUserToDatabase(userData: UserData) = viewModelScope.launch {
|
||||||
userData.userAbhaRegistrationLog = sharedPreference.getString("userAbhaRegistrationLog", "").toString()
|
|
||||||
userData.userDetailsLog = sharedPreference.getString("userDetailslog", "").toString()
|
|
||||||
val file = Uri.parse(userData.userImageURL)
|
val file = Uri.parse(userData.userImageURL)
|
||||||
val storageRef = FirebaseStorage.getInstance().reference
|
val storageRef = FirebaseStorage.getInstance().reference
|
||||||
val imageRef = storageRef.child("${userData._id}/${file.lastPathSegment}")
|
val imageRef = storageRef.child("${userData._id}/${file.lastPathSegment}")
|
||||||
@@ -71,8 +66,6 @@ class RegistrationViewModel @Inject constructor(
|
|||||||
val networkStatusLiveData: LiveData<Boolean>
|
val networkStatusLiveData: LiveData<Boolean>
|
||||||
get() = _networkStatusLiveData
|
get() = _networkStatusLiveData
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
fun insert(userData: UserData) = viewModelScope.launch {
|
fun insert(userData: UserData) = viewModelScope.launch {
|
||||||
val currentDate = Date()
|
val currentDate = Date()
|
||||||
val dateFormat = SimpleDateFormat("yyyyMMdd")
|
val dateFormat = SimpleDateFormat("yyyyMMdd")
|
||||||
@@ -83,16 +76,6 @@ class RegistrationViewModel @Inject constructor(
|
|||||||
userData.createdAt = SimpleDateFormat(
|
userData.createdAt = SimpleDateFormat(
|
||||||
"yyyy-MM-dd HH:mm:ss", Locale.getDefault()
|
"yyyy-MM-dd HH:mm:ss", Locale.getDefault()
|
||||||
).format(Calendar.getInstance().time)
|
).format(Calendar.getInstance().time)
|
||||||
|
|
||||||
|
|
||||||
val useAbhaRegistrationLog = sharedPreference.getString("userAbhaRegistrationLog", "").toString()
|
|
||||||
val userDetailsLog = sharedPreference.getString("userDetailslog", "").toString()
|
|
||||||
userData.userAbhaRegistrationLog = sharedPreference.getString("userAbhaRegistrationLog", "").toString()
|
|
||||||
userData.userDetailsLog = sharedPreference.getString("userDetailslog", "").toString()
|
|
||||||
|
|
||||||
|
|
||||||
userData.userAbhaRegistrationLog= useAbhaRegistrationLog
|
|
||||||
userData.userDetailsLog = userDetailsLog
|
|
||||||
mainRepository.insert(userData)
|
mainRepository.insert(userData)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user