8 Commits

Author SHA1 Message Date
Mariya
fe1f6f5a16 Merge branch 'master' of https://gitlab.com/sminnovations/hpos-registration-app
# Conflicts:
#	app/build.gradle
2024-04-01 14:22:08 +05:30
Mariya
3daec52ee8 BackLog file added for nagpur consignment for Online Registration code added, fixed all issues 2024-04-01 14:21:35 +05:30
Pritimay Sarkar
ccc50108d3 add app distribution auto update 2023-10-29 07:33:12 +05:30
Pritimay Sarkar
2bd6495612 remove key files 2023-10-24 14:09:53 +05:30
Pritimay Sarkar
143d90b028 fix empty list messages display 2023-10-24 14:07:08 +05:30
Pritimay Sarkar
3bda3f0d51 display app version 2023-10-24 14:05:07 +05:30
Pritimay Sarkar
b6a03e2ebf add search fields based on date partition
- optimize search based on current date partition
	- fix createdAt empty string in case of offline upload
2023-10-23 02:23:28 +05:30
Pritimay Sarkar
eec8867ddc show only current day registrations
- reduce database reads by fetching only current day registrations
	- sort users list in latest first order
2023-10-23 02:20:39 +05:30
12 changed files with 125 additions and 266 deletions

5
.idea/gradle.xml generated
View File

@@ -4,17 +4,16 @@
<component name="GradleSettings">
<option name="linkedExternalProjectsSettings">
<GradleProjectSettings>
<option name="testRunner" value="GRADLE" />
<option name="distributionType" value="DEFAULT_WRAPPED" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<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">
<set>
<option value="$PROJECT_DIR$" />
<option value="$PROJECT_DIR$/app" />
</set>
</option>
<option name="resolveExternalAnnotations" value="false" />
</GradleProjectSettings>
</option>
</component>

3
app/.gitignore vendored
View File

@@ -1 +1,2 @@
/build
/build
/google-services*

View File

@@ -13,11 +13,11 @@ android {
compileSdk 34
defaultConfig {
applicationId "in.sminnovations.hposregistration"
applicationId "in.sminnovations.hposregistration.quality"
minSdk 26
targetSdk 34
versionCode 1
versionName "1.0"
versionCode 13
versionName "1.0.13"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}

View File

@@ -1,113 +0,0 @@
{
"project_info": {
"project_number": "650071678820",
"project_id": "hpos-af3cc",
"storage_bucket": "hpos-af3cc.appspot.com"
},
"client": [
{
"client_info": {
"mobilesdk_app_id": "1:650071678820:android:f1435a1c07f710036c6471",
"android_client_info": {
"package_name": "com.example.hposconsentform"
}
},
"oauth_client": [
{
"client_id": "650071678820-to41afi9f0gi5r3k6v7pe1e5p96nupcs.apps.googleusercontent.com",
"client_type": 3
}
],
"api_key": [
{
"current_key": "AIzaSyAVdNGCev_AFX0qmuZJF6kxzRzXUTeAW5I"
}
],
"services": {
"appinvite_service": {
"other_platform_oauth_client": [
{
"client_id": "650071678820-to41afi9f0gi5r3k6v7pe1e5p96nupcs.apps.googleusercontent.com",
"client_type": 3
}
]
}
}
},
{
"client_info": {
"mobilesdk_app_id": "1:650071678820:android:7569c1cad4fc99916c6471",
"android_client_info": {
"package_name": "in.sminnovations.hposregistration"
}
},
"oauth_client": [
{
"client_id": "650071678820-70kp5jvjda4r5diqch2kn4lc40p4f42g.apps.googleusercontent.com",
"client_type": 1,
"android_info": {
"package_name": "in.sminnovations.hposregistration",
"certificate_hash": "7714b9268a81d0cf0fb178b0af8dbb630f8fc70a"
}
},
{
"client_id": "650071678820-to41afi9f0gi5r3k6v7pe1e5p96nupcs.apps.googleusercontent.com",
"client_type": 3
}
],
"api_key": [
{
"current_key": "AIzaSyAVdNGCev_AFX0qmuZJF6kxzRzXUTeAW5I"
}
],
"services": {
"appinvite_service": {
"other_platform_oauth_client": [
{
"client_id": "650071678820-to41afi9f0gi5r3k6v7pe1e5p96nupcs.apps.googleusercontent.com",
"client_type": 3
}
]
}
}
},
{
"client_info": {
"mobilesdk_app_id": "1:650071678820:android:f96be19e5d43102b6c6471",
"android_client_info": {
"package_name": "in.sminnovations.hpostesting"
}
},
"oauth_client": [
{
"client_id": "650071678820-l87dnr0bdj95get0khgnvfv2an1k6ogq.apps.googleusercontent.com",
"client_type": 1,
"android_info": {
"package_name": "in.sminnovations.hpostesting",
"certificate_hash": "7714b9268a81d0cf0fb178b0af8dbb630f8fc70a"
}
},
{
"client_id": "650071678820-to41afi9f0gi5r3k6v7pe1e5p96nupcs.apps.googleusercontent.com",
"client_type": 3
}
],
"api_key": [
{
"current_key": "AIzaSyAVdNGCev_AFX0qmuZJF6kxzRzXUTeAW5I"
}
],
"services": {
"appinvite_service": {
"other_platform_oauth_client": [
{
"client_id": "650071678820-to41afi9f0gi5r3k6v7pe1e5p96nupcs.apps.googleusercontent.com",
"client_type": 3
}
]
}
}
}
],
"configuration_version": "1"
}

View File

@@ -7,8 +7,11 @@ import androidx.room.PrimaryKey
data class UserData(
@PrimaryKey
var _id: String = "",
var _idSearch: String = "",
var abhaId: String = "",
var abhaIdSearch: String = "",
var aadharId: String = "",
var aadharIdSearch: String = "",
var name: String = "",
var birthYear: String = "",
var gender: String = "",

View File

@@ -2,6 +2,10 @@ package com.example.hposregistration.ui.activities
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.widget.Toast
import com.google.firebase.appdistribution.FirebaseAppDistribution
import com.google.firebase.appdistribution.FirebaseAppDistributionException
import com.google.firebase.crashlytics.FirebaseCrashlytics
import dagger.hilt.android.AndroidEntryPoint
import `in`.sminnovations.hposregistration.databinding.ActivityMainBinding
@@ -16,4 +20,44 @@ class MainActivity : AppCompatActivity() {
setContentView(binding.root)
}
override fun onResume() {
super.onResume()
val firebaseAppDistribution = FirebaseAppDistribution.getInstance()
firebaseAppDistribution.updateIfNewReleaseAvailable()
.addOnProgressListener { updateProgress ->
if (updateProgress.apkBytesDownloaded > 0) {
Toast.makeText(
this,
"${updateProgress.updateStatus}. ${updateProgress.apkBytesDownloaded / 1048576} /${updateProgress.apkFileTotalBytes / 1048576} MB",
Toast.LENGTH_SHORT
).show()
}
}
.addOnFailureListener { e ->
// (Optional) Handle errors.
if (e is FirebaseAppDistributionException) {
when (e.errorCode) {
FirebaseAppDistributionException.Status.NOT_IMPLEMENTED -> {
// SDK did nothing. This is expected when building for Play.
}
else -> {
// Handle other errors.
Toast.makeText(
this,
"AppDistribution error, status: ${e.errorCode}",
Toast.LENGTH_SHORT
).show()
}
}
FirebaseCrashlytics.getInstance().recordException(e)
}
}
.addOnSuccessListener {
// Toast.makeText(this, "App Update: Success!", Toast.LENGTH_SHORT).show()
}
}
}

View File

@@ -8,7 +8,6 @@ import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.Button
import android.widget.Toast
import androidx.fragment.app.viewModels
import androidx.navigation.fragment.findNavController
@@ -18,11 +17,14 @@ import com.example.hposregistration.data.Constant
import com.example.hposregistration.data.user.UserData
import com.example.hposregistration.ui.viewmodels.RegistrationViewModel
import com.firebase.ui.firestore.FirestoreRecyclerOptions
import com.google.firebase.firestore.Query
import com.google.firebase.firestore.ktx.firestore
import com.google.firebase.ktx.Firebase
import dagger.hilt.android.AndroidEntryPoint
import `in`.sminnovations.hposregistration.R
import `in`.sminnovations.hposregistration.databinding.FragmentUserListBinding
import java.text.SimpleDateFormat
import java.util.Date
@AndroidEntryPoint
class UserListFragment : BaseFragment() {
@@ -56,6 +58,11 @@ class UserListFragment : BaseFragment() {
}
private fun setupViews() {
val pInfo = requireActivity().packageManager.getPackageInfo(
requireActivity().packageName, 0
)
val version = pInfo.versionName
binding.appVersion.text = version
binding.btnRegisterUser.setOnClickListener {
findNavController().navigate(R.id.action_userListFragment_to_registrationFragment)
}
@@ -160,7 +167,17 @@ class UserListFragment : BaseFragment() {
private fun fetchFromServer() {
binding.noList.visibility = View.GONE
binding.rvOrder.visibility = View.VISIBLE
val dateFormat = SimpleDateFormat("yyyy-MM-dd")
val currentDate = Date()
val today = dateFormat.format(currentDate)
val query = Firebase.firestore.collection("patientData")
.whereGreaterThanOrEqualTo("createdAt", today)
.orderBy("createdAt", Query.Direction.DESCENDING)
query.get().addOnSuccessListener {
if (it.documents.isEmpty() && isOnline) {
binding.emptyRegistrations.visibility = View.VISIBLE
}
}
val recyclerViewOptions =
FirestoreRecyclerOptions.Builder<UserData>().setQuery(query, UserData::class.java)
.build()
@@ -176,6 +193,7 @@ class UserListFragment : BaseFragment() {
binding.noList.visibility = View.GONE
binding.rvOrder.visibility = View.VISIBLE
} else {
binding.emptyRegistrations.visibility = View.GONE
if (userDataList.isEmpty()) {
binding.noList.visibility = View.VISIBLE
binding.rvOrder.visibility = View.GONE

View File

@@ -5,7 +5,6 @@ import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.Toast
import androidx.core.view.isVisible
import androidx.fragment.app.Fragment
import androidx.fragment.app.viewModels
import androidx.navigation.fragment.findNavController
@@ -43,25 +42,6 @@ class UserDetailsRegistrationFragment : Fragment() {
private fun init() {
setupViewModel()
setupSubmitButton()
binding.etCategory.setOnItemClickListener { parent, view, position, id ->
if (parent.getItemAtPosition(position).toString().equals("OTHER", ignoreCase = true)) {
binding.tilOther.visibility = View.VISIBLE
} else {
binding.tilOther.visibility = View.GONE
}
}
binding.etCaste.setOnItemClickListener { parent, view, position, id ->
if (parent.getItemAtPosition(position).toString().equals("OTHER", ignoreCase = true)) {
binding.tilOthercaste.visibility = View.VISIBLE
} else {
binding.tilOthercaste.visibility = View.GONE
}
}
}
private fun setupViewModel() {
@@ -79,21 +59,20 @@ class UserDetailsRegistrationFragment : Fragment() {
when (it) {
"Male" -> {
male.isChecked = true
binding.tilOthergender.visibility = View.GONE
}
"Female" -> {
female.isChecked = true
binding.tilOthergender.visibility = View.GONE
}
else -> {
other.isChecked = true
binding.tilOthergender.visibility = View.VISIBLE
}
}
}
user.phoneNumber.let { etMobile.setText(it) }
user.careOf.let { etCareof.setText(it) }
user.maritalStatus.let { etIsMarried.setText(it, false) }
user.caste.let { etCaste.setText(it, false) }
user.category.let { etCategory.setText(it, false) }
user.subCaste.let { etSubCaste.setText(it) }
user.house.let { etHouse.setText(it) }
user.city.let { etCity.setText(it) }
@@ -115,12 +94,6 @@ class UserDetailsRegistrationFragment : Fragment() {
yes1history.isChecked = true
}
}
user.category.let {
etCategory.setText(it, false)
}
user.caste.let {
etCaste.setText(it, false)
}
if (yes1history.isChecked) {
if (binding.yes1history.isChecked) View.VISIBLE else View.GONE
@@ -139,35 +112,6 @@ class UserDetailsRegistrationFragment : Fragment() {
if (binding.no1history.isChecked) View.GONE else View.VISIBLE
}
if(other.isChecked){
user.gender.let { etOthergender.setText(it) }
}
binding.male.setOnClickListener {
binding.tilOthergender.visibility = View.GONE
}
binding.female.setOnClickListener {
binding.tilOthergender.visibility = View.GONE
}
binding.other.setOnClickListener {
binding.tilOthergender.visibility = View.VISIBLE
}
if (binding.etCategory.text.toString().equals("OTHER", ignoreCase = true)) {
binding.tilOther.visibility = View.VISIBLE
binding.etOther.visibility = View.VISIBLE
} else {
binding.tilOther.visibility = View.GONE
}
if (binding.etCaste.text.toString().equals("OTHER", ignoreCase = true)) {
binding.tilOthercaste.visibility = View.VISIBLE
binding.etOthercaste.visibility = View.VISIBLE
} else {
binding.tilOthercaste.visibility = View.GONE
}
}
}
@@ -201,19 +145,11 @@ class UserDetailsRegistrationFragment : Fragment() {
}
if (male.isChecked) {
binding.tilOthergender.visibility = View.GONE
userData.gender = "Male"
} else if (female.isChecked) {
binding.tilOthergender.visibility = View.GONE
userData.gender = "Female"
} else if(other.isChecked) {
binding.tilOthergender.visibility = View.VISIBLE
val genderother= binding.etOthergender.text.toString()
userData.gender = genderother
if (genderother.isEmpty()) {
etOthergender.error = "Please fill the field"
return false
}
} else {
userData.gender = "Other"
}
val mobile = etMobile.text.toString()
@@ -241,28 +177,21 @@ class UserDetailsRegistrationFragment : Fragment() {
}
val category = etCategory.text.toString()
val other = etOther.text.toString()
if (category.isEmpty()) {
etCategory.error = "Please enter your category"
return false
} else if (category == "OTHER" && tilOther.isVisible) {
userData.category = other
} else {
userData.category = category
}
val caste = etCaste.text.toString()
val othercaste = etOthercaste.text.toString()
if (caste.isEmpty()) {
etCaste.error = "Please enter your caste"
return false
} else if (caste == "OTHER" && tilOthercaste.isVisible) {
userData.caste = othercaste
} else {
userData.caste = caste
}
val subCaste = etSubCaste.text.toString()
if (subCaste.isNotEmpty()) {
userData.subCaste = subCaste
@@ -328,8 +257,6 @@ class UserDetailsRegistrationFragment : Fragment() {
return true
}
}

View File

@@ -13,6 +13,10 @@ import com.example.hposregistration.data.user.UserData
import com.google.firebase.storage.FirebaseStorage
import dagger.hilt.android.lifecycle.HiltViewModel
import kotlinx.coroutines.launch
import java.text.SimpleDateFormat
import java.util.Calendar
import java.util.Date
import java.util.Locale
import javax.inject.Inject
@HiltViewModel
@@ -63,6 +67,15 @@ class RegistrationViewModel @Inject constructor(
get() = _networkStatusLiveData
fun insert(userData: UserData) = viewModelScope.launch {
val currentDate = Date()
val dateFormat = SimpleDateFormat("yyyyMMdd")
val partition = dateFormat.format(currentDate)
userData._idSearch = partition + userData._id
userData.abhaIdSearch = partition + userData.abhaId
userData.aadharIdSearch = partition + userData.aadharId
userData.createdAt = SimpleDateFormat(
"yyyy-MM-dd HH:mm:ss", Locale.getDefault()
).format(Calendar.getInstance().time)
mainRepository.insert(userData)
}

View File

@@ -63,6 +63,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="10dp"
android:checked="true"
android:text="@string/male"
android:textSize="16sp" />
@@ -81,29 +82,6 @@
android:textSize="16sp" />
</RadioGroup>
<com.google.android.material.textfield.TextInputLayout
android:visibility="gone"
android:id="@+id/til_othergender"
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginHorizontal="24dp"
android:layout_marginTop="20dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/gender">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/et_othergender"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Enter Other"
android:inputType="text"
android:maxLength="10" />
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/til_mobile"
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
@@ -113,7 +91,7 @@
android:layout_marginTop="20dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/til_othergender">
app:layout_constraintTop_toBottomOf="@id/gender">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/et_mobile"
@@ -182,32 +160,12 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/category"
android:inputType="text"
android:inputType="none"
android:labelFor="@id/til_is_married"
app:simpleItems="@array/category" />
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
android:visibility="gone"
android:id="@+id/til_other"
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginHorizontal="24dp"
android:layout_marginTop="20dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/til_category">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/et_other"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Enter Other Category"
android:inputType="text"
android:maxLength="10" />
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/til_caste"
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.ExposedDropdownMenu"
@@ -217,39 +175,19 @@
android:layout_marginTop="20dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/til_other">
app:layout_constraintTop_toBottomOf="@id/til_category">
<AutoCompleteTextView
android:id="@+id/et_Caste"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/caste"
android:inputType="text"
android:inputType="none"
android:labelFor="@id/til_is_married"
app:simpleItems="@array/caste" />
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
android:visibility="gone"
android:id="@+id/til_othercaste"
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginHorizontal="24dp"
android:layout_marginTop="20dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/til_caste">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/et_othercaste"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="Enter Other Caste"
android:inputType="text"
android:maxLength="10" />
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/til_subCaste"
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox"
@@ -259,7 +197,7 @@
android:layout_marginTop="16dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/til_othercaste">
app:layout_constraintTop_toBottomOf="@id/til_caste">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/et_subCaste"

View File

@@ -16,6 +16,20 @@
android:layout_height="match_parent"
android:orientation="vertical">
</LinearLayout>
<TextView
android:id="@+id/app_version"
style="@style/title2"
android:layout_width="57dp"
android:layout_height="15dp"
android:layout_marginTop="4dp"
android:gravity="center"
android:text="1.0.4"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.017"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/tv_title"
style="@style/title1"
@@ -26,6 +40,20 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/emptyRegistrations"
style="@style/title1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:text="@string/empty_registrations"
android:textColor="@color/black"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/noList"
style="@style/title1"

View File

@@ -55,6 +55,7 @@
<string name="edit">Edit</string>
<string name="user_details">User Details</string>
<string name="internet_is_not_available_and_there_is_no_data_available_in_local_db">Internet is not available and there is no Data available in Local DB</string>
<string name="empty_registrations">No registrations are available for display</string>
<string name="user_id">User ID: %1$s</string>
<string name="abha_number">Abha Number: %1$s</string>
<string name="aadhar_number_details">Aadhar Number: %1$s</string>