2 Commits

Author SHA1 Message Date
Pritimay Sarkar
b10350f993 Merge branch 'LanguageTranslation' into 'main'
Merge multi-lingual support in app

See merge request sminnovations/hpos-registration-app!1
2023-11-30 09:04:42 +00:00
Shanmukha Innovations
8df17e8e19 Initial commit 2023-06-19 10:50:24 +00:00
43 changed files with 277 additions and 2655 deletions

3
.idea/.gitignore generated vendored
View File

@@ -1,3 +0,0 @@
# Default ignored files
/shelf/
/workspace.xml

View File

@@ -1,4 +0,0 @@
<changelist name="Changes" date="1696578975861" recycled="false">
<option name="PATH" value="$PROJECT_DIR$/.idea/shelf/Changes/shelved.patch" />
<option name="DESCRIPTION" value="Changes" />
</changelist>

File diff suppressed because one or more lines are too long

View File

@@ -1,4 +0,0 @@
<changelist name="Changes1" date="1701673804446" recycled="false">
<option name="PATH" value="$PROJECT_DIR$/.idea/shelf/Changes1/shelved.patch" />
<option name="DESCRIPTION" value="Changes" />
</changelist>

File diff suppressed because one or more lines are too long

View File

@@ -1,4 +0,0 @@
<changelist name="Changes2" date="1701681731623" recycled="false">
<option name="PATH" value="$PROJECT_DIR$/.idea/shelf/Changes2/shelved.patch" />
<option name="DESCRIPTION" value="Changes" />
</changelist>

View File

@@ -1,21 +0,0 @@
Index: app/src/main/java/com/example/hposregistration/adapters/UserListOnlineAdapter.kt
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.BaseRevisionTextPatchEP
<+>package com.example.hposregistration.adapters\r\n\r\nimport android.annotation.SuppressLint\r\nimport android.view.LayoutInflater\r\nimport android.view.View\r\nimport android.view.ViewGroup\r\nimport androidx.recyclerview.widget.RecyclerView\r\nimport com.bumptech.glide.Glide\r\nimport com.example.hposregistration.data.user.UserData\r\nimport com.firebase.ui.firestore.FirestoreRecyclerAdapter\r\nimport com.firebase.ui.firestore.FirestoreRecyclerOptions\r\nimport `in`.sminnovations.hposregistration.R\r\nimport `in`.sminnovations.hposregistration.databinding.UserItemViewBinding\r\n\r\nclass UserListOnlineAdapter(options: FirestoreRecyclerOptions<UserData>, private val view: View) :\r\n FirestoreRecyclerAdapter<UserData, UserListOnlineAdapter.OrderItemViewHolder>(options) {\r\n\r\n class OrderItemViewHolder(val binding: UserItemViewBinding) :\r\n RecyclerView.ViewHolder(binding.root)\r\n\r\n override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): OrderItemViewHolder {\r\n return OrderItemViewHolder(\r\n UserItemViewBinding\r\n .inflate(LayoutInflater.from(parent.context), parent, false)\r\n )\r\n }\r\n\r\n @SuppressLint(\"SetTextI18n\")\r\n override fun onBindViewHolder(holder: OrderItemViewHolder, position: Int, model: UserData) {\r\n holder.binding.apply {\r\n userName.text = view.context.getString(R.string.name) + \": ${model.name}\"\r\n userId.text = view.context.getString(R.string.userid) + \": ${model._id}\"\r\n Glide.with(view).load(model.userImageURL).into(userImage)\r\n }\r\n }\r\n}
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/app/src/main/java/com/example/hposregistration/adapters/UserListOnlineAdapter.kt b/app/src/main/java/com/example/hposregistration/adapters/UserListOnlineAdapter.kt
--- a/app/src/main/java/com/example/hposregistration/adapters/UserListOnlineAdapter.kt (revision 610e206f27d8ce39c57e9e76b95bfdb7b6047307)
+++ b/app/src/main/java/com/example/hposregistration/adapters/UserListOnlineAdapter.kt (date 1701681731375)
@@ -28,8 +28,8 @@
@SuppressLint("SetTextI18n")
override fun onBindViewHolder(holder: OrderItemViewHolder, position: Int, model: UserData) {
holder.binding.apply {
- userName.text = view.context.getString(R.string.name) + ": ${model.name}"
- userId.text = view.context.getString(R.string.userid) + ": ${model._id}"
+ userName.text = view.context.getString(R.string.name) + " : ${model.name}"
+ userId.text = view.context.getString(R.string.userid) + " : ${model._id}"
Glide.with(view).load(model.userImageURL).into(userImage)
}
}

View File

@@ -1,4 +0,0 @@
<changelist name="Changes3" date="1701681803133" recycled="false">
<option name="PATH" value="$PROJECT_DIR$/.idea/shelf/Changes3/shelved.patch" />
<option name="DESCRIPTION" value="Changes" />
</changelist>

View File

View File

@@ -1,4 +0,0 @@
<changelist name="Uncommitted_changes_before_Checkout_at_04-12-2023_01_16_pm_[Changes]" date="1701676341703" recycled="true">
<option name="PATH" value="$PROJECT_DIR$/.idea/shelf/Uncommitted_changes_before_Checkout_at_04-12-2023_01_16_pm_[Changes]/shelved.patch" />
<option name="DESCRIPTION" value="Uncommitted changes before Checkout at 04-12-2023 01:16 pm [Changes]" />
</changelist>

File diff suppressed because one or more lines are too long

View File

@@ -1,4 +0,0 @@
<changelist name="Uncommitted_changes_before_Checkout_at_04-12-2023_01_38_pm_[Changes]" date="1701677677817" recycled="true">
<option name="PATH" value="$PROJECT_DIR$/.idea/shelf/Uncommitted_changes_before_Checkout_at_04-12-2023_01_38_pm_[Changes]/shelved.patch" />
<option name="DESCRIPTION" value="Uncommitted changes before Checkout at 04-12-2023 01:38 pm [Changes]" />
</changelist>

92
README.md Normal file
View File

@@ -0,0 +1,92 @@
# HPOS-Registration-App
## Getting started
To make it easy for you to get started with GitLab, here's a list of recommended next steps.
Already a pro? Just edit this README.md and make it your own. Want to make it easy? [Use the template at the bottom](#editing-this-readme)!
## Add your files
- [ ] [Create](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#create-a-file) or [upload](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#upload-a-file) files
- [ ] [Add files using the command line](https://docs.gitlab.com/ee/gitlab-basics/add-file.html#add-a-file-using-the-command-line) or push an existing Git repository with the following command:
```
cd existing_repo
git remote add origin https://gitlab.com/sminnovations/hpos-registration-app.git
git branch -M main
git push -uf origin main
```
## Integrate with your tools
- [ ] [Set up project integrations](https://gitlab.com/sminnovations/hpos-registration-app/-/settings/integrations)
## Collaborate with your team
- [ ] [Invite team members and collaborators](https://docs.gitlab.com/ee/user/project/members/)
- [ ] [Create a new merge request](https://docs.gitlab.com/ee/user/project/merge_requests/creating_merge_requests.html)
- [ ] [Automatically close issues from merge requests](https://docs.gitlab.com/ee/user/project/issues/managing_issues.html#closing-issues-automatically)
- [ ] [Enable merge request approvals](https://docs.gitlab.com/ee/user/project/merge_requests/approvals/)
- [ ] [Set auto-merge](https://docs.gitlab.com/ee/user/project/merge_requests/merge_when_pipeline_succeeds.html)
## Test and Deploy
Use the built-in continuous integration in GitLab.
- [ ] [Get started with GitLab CI/CD](https://docs.gitlab.com/ee/ci/quick_start/index.html)
- [ ] [Analyze your code for known vulnerabilities with Static Application Security Testing(SAST)](https://docs.gitlab.com/ee/user/application_security/sast/)
- [ ] [Deploy to Kubernetes, Amazon EC2, or Amazon ECS using Auto Deploy](https://docs.gitlab.com/ee/topics/autodevops/requirements.html)
- [ ] [Use pull-based deployments for improved Kubernetes management](https://docs.gitlab.com/ee/user/clusters/agent/)
- [ ] [Set up protected environments](https://docs.gitlab.com/ee/ci/environments/protected_environments.html)
***
# Editing this README
When you're ready to make this README your own, just edit this file and use the handy template below (or feel free to structure it however you want - this is just a starting point!). Thank you to [makeareadme.com](https://www.makeareadme.com/) for this template.
## Suggestions for a good README
Every project is different, so consider which of these sections apply to yours. The sections used in the template are suggestions for most open source projects. Also keep in mind that while a README can be too long and detailed, too long is better than too short. If you think your README is too long, consider utilizing another form of documentation rather than cutting out information.
## Name
Choose a self-explaining name for your project.
## Description
Let people know what your project can do specifically. Provide context and add a link to any reference visitors might be unfamiliar with. A list of Features or a Background subsection can also be added here. If there are alternatives to your project, this is a good place to list differentiating factors.
## Badges
On some READMEs, you may see small images that convey metadata, such as whether or not all the tests are passing for the project. You can use Shields to add some to your README. Many services also have instructions for adding a badge.
## Visuals
Depending on what you are making, it can be a good idea to include screenshots or even a video (you'll frequently see GIFs rather than actual videos). Tools like ttygif can help, but check out Asciinema for a more sophisticated method.
## Installation
Within a particular ecosystem, there may be a common way of installing things, such as using Yarn, NuGet, or Homebrew. However, consider the possibility that whoever is reading your README is a novice and would like more guidance. Listing specific steps helps remove ambiguity and gets people to using your project as quickly as possible. If it only runs in a specific context like a particular programming language version or operating system or has dependencies that have to be installed manually, also add a Requirements subsection.
## Usage
Use examples liberally, and show the expected output if you can. It's helpful to have inline the smallest example of usage that you can demonstrate, while providing links to more sophisticated examples if they are too long to reasonably include in the README.
## Support
Tell people where they can go to for help. It can be any combination of an issue tracker, a chat room, an email address, etc.
## Roadmap
If you have ideas for releases in the future, it is a good idea to list them in the README.
## Contributing
State if you are open to contributions and what your requirements are for accepting them.
For people who want to make changes to your project, it's helpful to have some documentation on how to get started. Perhaps there is a script that they should run or some environment variables that they need to set. Make these steps explicit. These instructions could also be useful to your future self.
You can also document commands to lint the code or run tests. These steps help to ensure high code quality and reduce the likelihood that the changes inadvertently break something. Having instructions for running tests is especially helpful if it requires external setup, such as starting a Selenium server for testing in a browser.
## Authors and acknowledgment
Show your appreciation to those who have contributed to the project.
## License
For open source projects, say how it is licensed.
## Project status
If you have run out of energy or time for your project, put a note at the top of the README saying that development has slowed down or stopped completely. Someone may choose to fork your project or volunteer to step in as a maintainer or owner, allowing your project to keep going. You can also make an explicit request for maintainers.

3
app/.gitignore vendored
View File

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

View File

@@ -16,8 +16,8 @@ android {
applicationId "in.sminnovations.hposregistration"
minSdk 26
targetSdk 34
versionCode 8
versionName "1.0.8"
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
@@ -42,11 +42,10 @@ android {
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 '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.preference:preference-ktx:1.2.1'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
@@ -59,26 +58,24 @@ dependencies {
implementation 'com.google.firebase:firebase-auth-ktx'
implementation 'com.google.firebase:firebase-storage-ktx'
implementation 'com.firebaseui:firebase-ui-firestore:8.0.2'
implementation 'com.google.android.gms:play-services-auth:20.7.0'
implementation 'com.google.firebase:firebase-appdistribution:16.0.0-beta11'
implementation("com.google.firebase:firebase-appdistribution-api-ktx:16.0.0-beta11")
implementation 'com.google.android.gms:play-services-auth:20.6.0'
// Coroutines
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.1'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.7.1'
// Coroutine Lifecycle Scopes
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.6.2"
implementation "androidx.lifecycle:lifecycle-runtime-ktx:2.6.2"
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:2.6.1"
implementation "androidx.lifecycle:lifecycle-runtime-ktx:2.6.1"
//Dagger - Hilt
implementation "com.google.dagger:hilt-android: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
implementation "androidx.navigation:navigation-fragment-ktx:2.7.5"
implementation "androidx.navigation:navigation-ui-ktx:2.7.5"
implementation "androidx.navigation:navigation-fragment-ktx:2.7.0"
implementation "androidx.navigation:navigation-ui-ktx:2.7.0"
// Retrofit + GSON
implementation "com.squareup.retrofit2:retrofit:2.9.0"
@@ -88,18 +85,16 @@ dependencies {
implementation 'com.jakewharton.timber:timber:4.7.1'
// Activity KTX for viewModels()
implementation "androidx.activity:activity-ktx:1.8.1"
implementation "androidx.activity:activity-ktx:1.7.2"
//image
implementation 'com.github.bumptech.glide:glide:4.13.2'
annotationProcessor 'com.github.bumptech.glide:compiler:4.13.2'
implementation 'com.opencsv:opencsv:5.5'
//Room
implementation "androidx.room:room-ktx:2.6.1"
implementation "androidx.room:room-runtime:2.6.1"
kapt ("androidx.room:room-compiler:2.6.1")
implementation "androidx.room:room-ktx:2.6.0-alpha03"
implementation "androidx.room:room-runtime:2.6.0-alpha03"
kapt ("androidx.room:room-compiler:2.6.0-alpha03")
// Barcode scanner
implementation 'com.journeyapps:zxing-android-embedded:4.3.0'

113
app/google-services.json Normal file
View File

@@ -0,0 +1,113 @@
{
"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,9 +7,7 @@
android:required="false" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
@@ -45,7 +43,7 @@
</activity>
<activity
android:name="com.journeyapps.barcodescanner.CaptureActivity"
android:screenOrientation="fullSensor"
android:screenOrientation="portrait"
android:stateNotNeeded="true"
tools:replace="android:screenOrientation" />
</application>

View File

@@ -9,7 +9,6 @@ import com.bumptech.glide.Glide
import com.example.hposregistration.data.user.UserData
import com.firebase.ui.firestore.FirestoreRecyclerAdapter
import com.firebase.ui.firestore.FirestoreRecyclerOptions
import `in`.sminnovations.hposregistration.R
import `in`.sminnovations.hposregistration.databinding.UserItemViewBinding
class UserListOnlineAdapter(options: FirestoreRecyclerOptions<UserData>, private val view: View) :
@@ -28,8 +27,8 @@ class UserListOnlineAdapter(options: FirestoreRecyclerOptions<UserData>, private
@SuppressLint("SetTextI18n")
override fun onBindViewHolder(holder: OrderItemViewHolder, position: Int, model: UserData) {
holder.binding.apply {
userName.text = view.context.getString(R.string.name) + " : ${model.name}"
userId.text = view.context.getString(R.string.userid) + " : ${model._id}"
userName.text = "Name: ${model.name}"
userId.text = "User ID: ${model._id}"
Glide.with(view).load(model.userImageURL).into(userImage)
}
}

View File

@@ -1,36 +1,11 @@
package com.example.hposregistration.dao
import android.content.Context
import androidx.room.Database
import androidx.room.Room
import androidx.room.RoomDatabase
import androidx.room.TypeConverters
import androidx.room.migration.Migration
import androidx.sqlite.db.SupportSQLiteDatabase
import com.example.hposregistration.data.user.UserData
@Database(entities = [UserData::class], version = 4, exportSchema = false)
@Database(entities = [UserData::class], version = 1, exportSchema = false)
abstract class MyDatabase : RoomDatabase() {
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()
}
}
}
}

View File

@@ -5,7 +5,6 @@ import androidx.room.Dao
import androidx.room.Insert
import androidx.room.OnConflictStrategy
import androidx.room.Query
import androidx.room.Update
import com.example.hposregistration.data.user.UserData
@Dao
@@ -21,11 +20,4 @@ interface UserDao {
@Query("DELETE FROM user_table WHERE _id = :id")
suspend fun deleteById(id: String)
@Query("UPDATE user_table SET isCSVCreated = :newValue WHERE _id = :id")
suspend fun updateCSVFieldById(id: String, newValue: Boolean)
@Update
suspend fun updateUserData(userData: List<UserData>)
}

View File

@@ -1,30 +0,0 @@
package com.example.hposregistration.data
import android.content.Context
import android.content.SharedPreferences
import java.util.Locale
object LanguageManager {
private const val LANGUAGE_PREF_KEY = "language_pref"
fun setLocale(context: Context, languageCode: String) {
val locale = Locale(languageCode)
Locale.setDefault(locale)
val resources = context.resources
val configuration = resources.configuration
configuration.setLocale(locale)
context.createConfigurationContext(configuration)
}
fun persistLanguagePreference(context: Context, languageCode: String) {
val prefs: SharedPreferences = context.getSharedPreferences("AppPrefs", Context.MODE_PRIVATE)
prefs.edit().putString(LANGUAGE_PREF_KEY, languageCode).apply()
}
fun getSavedLanguage(context: Context): String {
val prefs: SharedPreferences = context.getSharedPreferences("AppPrefs", Context.MODE_PRIVATE)
return prefs.getString(LANGUAGE_PREF_KEY, "en") ?: "en"
}
}

View File

@@ -3,8 +3,6 @@ package com.example.hposregistration.data
import androidx.lifecycle.LiveData
import com.example.hposregistration.dao.UserDao
import com.example.hposregistration.data.user.UserData
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.withContext
import javax.inject.Inject
import javax.inject.Singleton
@@ -32,10 +30,4 @@ class MainRepository @Inject constructor(
return userFireBaseDao.addUserToDatabase(userData)
}
suspend fun updateCSVFieldById(id: String, isCSVCreated: Boolean) {
userDao.updateCSVFieldById(id, isCSVCreated)
}
}

View File

@@ -1,130 +0,0 @@
package com.example.hpostesting.data.datasource
import android.os.Environment
import android.util.Log
import com.example.hposregistration.data.user.UserData
import com.opencsv.CSVWriter
import java.io.File
import java.io.FileWriter
import java.io.IOException
class LocalFileDataSource {
fun saveCsvToDisk(filepath: String, contents: ArrayList<Array<String>>){
val writer = CSVWriter(FileWriter(filepath))
writer.writeAll(contents) // data is adding to csv
writer.close()
}
fun saveTextToDisk(filepath: String, contents: String){
val writer = FileWriter(File(filepath))
writer.append(contents)
writer.flush()
writer.close()
}
fun exportDataToCSV(
fileName: String, dataList: List<UserData>
): Boolean {
try {
val formattedFileName = fileName.replace(Regex("[^a-zA-Z0-9.-]"), "_")
val filePath = File(getExternalStorageDirectory(), formattedFileName)
val writer = FileWriter(filePath)
val csvWriter = CSVWriter(writer)
// Write CSV header
val header = arrayOf(
"_id",
"name",
"bloodGroup",
"birthYear",
"state",
"abhaId",
"userImageURL",
"testStatus", // Assuming testStatus is a boolean field
"gender",
"appVersion",
"phoneNumber",
"careOf",
"maritalStatus",
"category",
"caste",
"subCaste",
"house",
"city",
"district",
"state",
"pinCode",
"isUnderMedication",
"isUnderTransfusion",
"sickleCellHistory",
"registeredBy",
"createdAt",
"registrationCenterName",
"userImageURL"
)
csvWriter.writeNext(header)
// Write data rows
for (data in dataList) {
val row = arrayOf(
data._id,
data.name,
data.bloodGroup,
data.birthYear,
data.state,
data.abhaId,
data.userImageURL,
data.testStatus?.toString() ?: "",
data.gender,
data.appVersion ?: "",
data.phoneNumber,
data.careOf,
data.maritalStatus,
data.category,
data.caste,
data.subCaste ?: "",
data.house,
data.city,
data.district,
data.state,
data.pinCode,
data.isUnderMedication?.toString() ?: "",
data.isUnderTransfusion?.toString() ?: "",
data.sickleCellHistory ?: "",
data.registeredBy ?: "",
data.createdAt ?: "",
data.registrationCenterName ?: "",
data.userImageURL
)
csvWriter.writeNext(row)
}
writer.close()
return true
} catch (e: IOException) {
e.printStackTrace()
Log.e("CSVExport", "Error exporting data to CSV: ${e.message}")
return false
}
}
private fun getExternalStorageDirectory(): File {
val directory = File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOCUMENTS), "HPOSRegistration")
if (!directory.exists()) {
if (!directory.mkdirs()) {
Log.e("CSVExport", "Error creating directory: ${directory.absolutePath}")
}
}
return directory
}
}

View File

@@ -7,11 +7,8 @@ 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 = "",
@@ -35,9 +32,7 @@ data class UserData(
var registeredBy: String? = "",
var createdAt: String? = "",
var registrationCenterName: String? = "",
var testStatus: Boolean = false,
var isCSVCreated: Boolean = false,
var localFlag: Boolean = false,
var testStatus: Boolean = false
){
enum class Gender {
MALE,

View File

@@ -5,7 +5,6 @@ import android.content.Context
import androidx.room.Room
import com.example.hposregistration.dao.MyDatabase
import com.example.hposregistration.dao.UserDao
import com.example.hpostesting.data.datasource.LocalFileDataSource
import dagger.Module
import dagger.Provides
import dagger.hilt.InstallIn
@@ -42,10 +41,4 @@ object AppModule {
fun provideContext(application: Application): Context {
return application.applicationContext
}
@Provides
@Singleton
fun provideLocalFileDataSource(): LocalFileDataSource {
return LocalFileDataSource()
}
}

View File

@@ -1,6 +1,5 @@
package com.example.hposregistration.network
import androidx.room.Query
import com.example.hposregistration.data.Response
import com.example.hposregistration.data.user.UserData
import com.google.firebase.firestore.FirebaseFirestore
@@ -25,12 +24,7 @@ class UserDao {
}
}
// suspend fun getPatientList(): List<UserData> {
// return patientCollection.get().await().toObjects(UserData::class.java)
// }
}

View File

@@ -1,13 +1,7 @@
package com.example.hposregistration.ui.activities
import android.content.Context
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.widget.Toast
import com.example.hposregistration.data.LanguageManager
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,57 +10,10 @@ class MainActivity : AppCompatActivity() {
private lateinit var binding: ActivityMainBinding
override fun attachBaseContext(newBase: Context?) {
val languageCode = LanguageManager.getSavedLanguage(newBase!!)
LanguageManager.setLocale(newBase, languageCode)
super.attachBaseContext(newBase)
}
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
binding = ActivityMainBinding.inflate(layoutInflater)
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

@@ -1,65 +0,0 @@
package com.example.hposregistration.ui.fragments
import android.content.Context
import android.content.pm.PackageManager
import android.os.Bundle
import androidx.preference.Preference
import androidx.preference.PreferenceFragmentCompat
import android.widget.Toast
import com.example.hposregistration.data.LanguageManager
import `in`.sminnovations.hposregistration.R
private var isLanguageChanged = false
class LanguageSettingsFragment : PreferenceFragmentCompat() {
override fun onCreatePreferences(savedInstanceState: Bundle?, rootKey: String?) {
val preferenceScreen = preferenceManager.createPreferenceScreen(requireContext())
val languagePreference = androidx.preference.ListPreference(requireContext())
languagePreference.key = "language_preference"
languagePreference.title = getString(R.string.app_language)
languagePreference.summary = getString(R.string.select_language)
languagePreference.entries = arrayOf("English", "Kannada", "Hindi")
languagePreference.entryValues = arrayOf("en", "kn", "hi")
languagePreference.setDefaultValue("en")
languagePreference.onPreferenceChangeListener =
Preference.OnPreferenceChangeListener { _, newValue ->
val languageCode = newValue as String
updateLanguage(requireContext(), languageCode)
true
}
preferenceScreen.addPreference(languagePreference)
setPreferenceScreen(preferenceScreen)
// App Version Preference
val appVersionPreference = Preference(requireContext())
appVersionPreference.title = "App Version"
appVersionPreference.summary = getAppVersion(requireContext())
preferenceScreen.addPreference(languagePreference)
preferenceScreen.addPreference(appVersionPreference)
setPreferenceScreen(preferenceScreen)
if (isLanguageChanged) {
Toast.makeText(requireContext(), R.string.language_update, Toast.LENGTH_SHORT).show()
}
}
private fun updateLanguage(context: Context, languageCode: String) {
LanguageManager.persistLanguagePreference(context, languageCode)
LanguageManager.setLocale(context, languageCode)
requireActivity().recreate() // Recreate activity to apply language changes
isLanguageChanged = true
}
private fun getAppVersion(context: Context): String {
return try {
val pInfo = context.packageManager.getPackageInfo(context.packageName, 0)
pInfo.versionName
} catch (e: PackageManager.NameNotFoundException) {
"N/A"
}
}
}

View File

@@ -47,10 +47,10 @@ class LoginFragment : Fragment() {
performLogin(loginId, password)
} else {
if (loginId.isBlank()) {
binding.loginId.error = getString(R.string.enter_proper_login_id)
binding.loginId.error = R.string.enter_proper_login_id.toString()
}
if (password.isBlank()) {
binding.password.error = getString(R.string.enter_proper_password)
binding.password.error = R.string.enter_proper_password.toString()
}
}
}

View File

@@ -5,13 +5,11 @@ import android.content.Context
import android.content.DialogInterface
import android.content.SharedPreferences
import android.os.Bundle
import android.util.Log
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.Button
import android.widget.Toast
import androidx.fragment.app.activityViewModels
import androidx.fragment.app.viewModels
import androidx.navigation.fragment.findNavController
import com.example.hposregistration.adapters.UserListOfflineAdapter
@@ -20,14 +18,11 @@ 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() {
@@ -35,7 +30,7 @@ class UserListFragment : BaseFragment() {
private var _binding: FragmentUserListBinding? = null
private val binding get() = _binding!!
private val viewModel:RegistrationViewModel by activityViewModels()
private val viewModel by viewModels<RegistrationViewModel>()
private var isOnline = false
@@ -73,9 +68,8 @@ class UserListFragment : BaseFragment() {
viewModel.networkStatusLiveData.observe(viewLifecycleOwner) { isNetworkAvailable ->
if (isNetworkAvailable) {
isOnline = isNetworkAvailable
fetchFromLocalDB()
// fetchFromServer()
// checkForLocalDBData()
fetchFromServer()
checkForLocalDBData()
} else {
isOnline = isNetworkAvailable
fetchFromLocalDB()
@@ -86,32 +80,6 @@ class UserListFragment : BaseFragment() {
showUploadDialog(requireContext())
}
viewModel.allUserData.observe(viewLifecycleOwner) { userData ->
val btnSaveLocalVisibility =
if (userData.isNotEmpty()) View.VISIBLE else View.GONE
binding.btnSaveLocal.visibility = btnSaveLocalVisibility
binding.btnSaveLocal.setOnClickListener {
if (btnSaveLocalVisibility == View.VISIBLE) {
// Execute the action when the button is visible (testStatus is true for at least one user)
showDownloadDialog(requireContext())
} else {
// Handle the case when the button is not visible
Toast.makeText(
requireContext(),
"No test details stored locally",
Toast.LENGTH_SHORT
).show()
}
}
}
binding.btnsettings.setOnClickListener{
findNavController().navigate(R.id.action_userListFragment_to_languageSettingsFragment)
}
viewModel.allUserData.observe(viewLifecycleOwner) { userDataList ->
deteleIncompleteRegistration(userDataList)
}
@@ -123,14 +91,14 @@ class UserListFragment : BaseFragment() {
builder.setMessage(R.string.do_log_out)
// Positive button
builder.setPositiveButton(R.string.yes) { dialog, _ ->
builder.setPositiveButton("Yes") { dialog, _ ->
saveUserId()
findNavController().navigate(R.id.action_userListFragment_to_loginFragment)
dialog.dismiss()
}
// Negative button
builder.setNegativeButton(R.string.no) { dialog, _ ->
builder.setNegativeButton("No") { dialog, _ ->
dialog.dismiss()
}
@@ -192,17 +160,7 @@ 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()
@@ -211,32 +169,13 @@ class UserListFragment : BaseFragment() {
adapter.startListening()
}
private fun showDownloadDialog(context: Context) {
val builder = AlertDialog.Builder(context)
builder.setTitle(R.string.download_db_registration_title)
builder.setMessage(R.string.download_db_registration_message)
builder.setPositiveButton(R.string.downloadcsv) { dialog, _ ->
downloadLocalDBData(dialog)
}
builder.setNegativeButton(R.string.cancel) { dialog, _ ->
dialog.dismiss()
}
val dialog = builder.create()
dialog.show()
}
private fun fetchFromLocalDB() {
binding.uploadData.visibility = View.GONE
viewModel.allUserData.observe(viewLifecycleOwner) { userDataList ->
// if (isOnline) {
// binding.noList.visibility = View.GONE
// binding.rvOrder.visibility = View.VISIBLE
// } else {
if (isOnline) {
binding.noList.visibility = View.GONE
binding.rvOrder.visibility = View.VISIBLE
} else {
if (userDataList.isEmpty()) {
binding.noList.visibility = View.VISIBLE
binding.rvOrder.visibility = View.GONE
@@ -248,57 +187,10 @@ class UserListFragment : BaseFragment() {
adapter.differ.submitList(userDataList)
binding.rvOrder.adapter = adapter
}
}
}
private fun downloadLocalDBData(dialog: DialogInterface) {
var csvDownloaded = false
viewModel.allUserData.observe(viewLifecycleOwner) { userDataList ->
try {
if (!csvDownloaded) {
val downloadList = mutableListOf<UserData>()
userDataList.forEach { userData ->
Log.d(
"DownloadDebug",
"userData: $userData, isCSVCreated: ${userData.isCSVCreated}"
)
// if (!userData.isCSVCreated) {
// userData.isCSVCreated = false
downloadList.add(userData)
// }
}
// Log the size of downloadList for debugging
Log.d("DownloadDebug", "downloadList size: ${downloadList.size}")
if (downloadList.isNotEmpty()) {
// Call ViewModel function to create CSV with filtered data
viewModel.createCSV(downloadList, requireContext())
csvDownloaded = true
Toast.makeText(
requireContext(),
"CSV file downloaded successfully",
Toast.LENGTH_SHORT
).show()
} else {
Toast.makeText(requireContext(), "No data to download", Toast.LENGTH_SHORT)
.show()
}
}
} catch (e: Exception) {
e.printStackTrace()
Toast.makeText(requireContext(), "Error downloading CSV file", Toast.LENGTH_SHORT).show()
} finally {
dialog.dismiss()
}
}
}
private fun deteleIncompleteRegistration(userDataList: List<UserData>) {
userDataList.forEach {
if (it.userImageURL.isEmpty()) {

View File

@@ -20,9 +20,6 @@ import dagger.hilt.android.AndroidEntryPoint
import `in`.sminnovations.hposregistration.R
import `in`.sminnovations.hposregistration.databinding.FragmentAbhaRegistrationBinding
import org.json.JSONObject
import java.text.SimpleDateFormat
import java.util.Calendar
import java.util.Locale
@AndroidEntryPoint
class AbhaRegistrationFragment : BaseFragment() {
@@ -96,7 +93,6 @@ class AbhaRegistrationFragment : BaseFragment() {
navigateToUserDetailsFragment(userData._id)
}
}
}
@@ -148,7 +144,7 @@ class AbhaRegistrationFragment : BaseFragment() {
private fun saveUserDataAsPerAbhaId() {
with(binding) {
tvScanMessage.visibility = View.VISIBLE
tvScanMessage.text = getString(R.string.enter_aadhar_manually)
tvScanMessage.text = R.string.enter_aadhar_manually.toString()
etAbhaId.setText(userData.abhaId)
etName.setText(userData.name)
}
@@ -160,7 +156,7 @@ class AbhaRegistrationFragment : BaseFragment() {
private fun saveUserDataAsPerAadharId() {
with(binding) {
tvScanMessage.text =
getString(R.string.scanned_aadhar_id)
R.string.scanned_aadhar_id.toString()
etName.setText(userData.name)
}
Toast.makeText(
@@ -173,19 +169,19 @@ class AbhaRegistrationFragment : BaseFragment() {
): Boolean {
with(binding) {
if (!checkAbhaIDNumber(abhaId)) {
etAbhaId.error = getString(R.string.invalid_abha_id)
etAbhaId.error = R.string.invalid_abha_id.toString()
return false
}
if (!checkAadharIDNumber(aadharId)) {
aadharID.error = getString(R.string.invalid_aadhar_id)
aadharID.error = R.string.invalid_aadhar_id.toString()
return false
}
if (!checkUserName(userName)) {
etName.error = getString(R.string.name_field_error)
etName.error = R.string.name_field_error.toString()
return false
}
if (!checkCenterName(centerName)) {
etCenterName.error = getString(R.string.center_name_error)
etCenterName.error = R.string.center_name_error.toString()
return false
}
}

View File

@@ -62,18 +62,12 @@ class ReviewDetailsRegistrationFragment : BaseFragment() {
binding.btnSubmit.setOnClickListener {
if (isOnline) {
// showProgressBar(binding.progressBarCL)
// addDataToFirebase()
Toast.makeText(
requireContext(),
R.string.local,
Toast.LENGTH_SHORT
).show()
navigateToUserListFragment()
showProgressBar(binding.progressBarCL)
addDataToFirebase()
} else {
Toast.makeText(
requireContext(),
R.string.local,
R.string.internt_not_local,
Toast.LENGTH_SHORT
).show()
navigateToUserListFragment()
@@ -183,11 +177,6 @@ class ReviewDetailsRegistrationFragment : BaseFragment() {
val version = pInfo.versionName
userData.appVersion = version
userData.createdAt = SimpleDateFormat(
"yyyy-MM-dd HH:mm:ss", Locale.getDefault()
).format(Calendar.getInstance().time)
}
}

View File

@@ -15,9 +15,6 @@ import com.example.hposregistration.ui.viewmodels.RegistrationViewModel
import dagger.hilt.android.AndroidEntryPoint
import `in`.sminnovations.hposregistration.R
import `in`.sminnovations.hposregistration.databinding.FragmentUserDetailsRegistrationBinding
import java.text.SimpleDateFormat
import java.util.Calendar
import java.util.Locale
@AndroidEntryPoint
@@ -182,7 +179,7 @@ class UserDetailsRegistrationFragment : Fragment() {
viewModel.insert(userData)
navigateToCaptureUserImageFragment()
} else {
showToast(getString(R.string.enter_details_properly))
showToast(R.string.enter_details_properly.toString())
}
}
}
@@ -197,7 +194,7 @@ class UserDetailsRegistrationFragment : Fragment() {
with(binding) {
val yob = etYob.text.toString()
if (yob.isEmpty() || yob.toInt() <= 1900 || yob.toInt() > 2023) {
etYob.error = getString(R.string.enter_valid_birth_year)
etYob.error = R.string.enter_valid_birth_year.toString()
return false
} else {
userData.birthYear = yob
@@ -214,7 +211,7 @@ class UserDetailsRegistrationFragment : Fragment() {
val genderother= binding.etOthergender.text.toString()
userData.gender = genderother
if (genderother.isEmpty()) {
etOthergender.error = getString(R.string.fill_field)
etOthergender.error = R.string.fill_field.toString()
return false
}
}
@@ -228,7 +225,7 @@ class UserDetailsRegistrationFragment : Fragment() {
val mobile = etMobile.text.toString()
if (mobile.isEmpty() || mobile.length != 10) {
etMobile.error = getString(R.string.valid_mobile_number)
etMobile.error = R.string.valid_mobile_number.toString()
return false
} else {
userData.phoneNumber = mobile
@@ -236,7 +233,7 @@ class UserDetailsRegistrationFragment : Fragment() {
val careOf = etCareof.text.toString()
if (careOf.isEmpty()) {
etCareof.error = getString(R.string.enter_father_husband_name)
etCareof.error = R.string.enter_father_husband_name.toString()
return false
} else {
userData.careOf = careOf
@@ -244,7 +241,7 @@ class UserDetailsRegistrationFragment : Fragment() {
val maritalStatus = etIsMarried.text.toString()
if (maritalStatus.isEmpty()) {
etIsMarried.error = getString(R.string.enter_marital_status)
etIsMarried.error = R.string.enter_marital_status.toString()
return false
} else {
userData.maritalStatus = maritalStatus
@@ -253,7 +250,7 @@ class UserDetailsRegistrationFragment : Fragment() {
val category = etCategory.text.toString()
val other = etOther.text.toString()
if (category.isEmpty()) {
etCategory.error = getString(R.string.enter_category)
etCategory.error = R.string.enter_category.toString()
return false
} else if (category == "OTHER" && tilOther.isVisible) {
userData.category = other
@@ -264,7 +261,7 @@ class UserDetailsRegistrationFragment : Fragment() {
val caste = etCaste.text.toString()
val othercaste = etOthercaste.text.toString()
if (caste.isEmpty()) {
etCaste.error = getString(R.string.enter_caste)
etCaste.error = R.string.enter_caste.toString()
return false
} else if (caste == "OTHER" && tilOthercaste.isVisible) {
userData.caste = othercaste
@@ -280,7 +277,7 @@ class UserDetailsRegistrationFragment : Fragment() {
val house = etHouse.text.toString()
if (house.isEmpty()) {
etHouse.error = getString(R.string.enter_house_address)
etHouse.error = R.string.enter_house_address.toString()
return false
} else {
userData.house = house
@@ -288,7 +285,7 @@ class UserDetailsRegistrationFragment : Fragment() {
val city = etCity.text.toString()
if (city.isEmpty()) {
etCity.error = getString(R.string.enter_city)
etCity.error = R.string.enter_city.toString()
return false
} else {
userData.city = city
@@ -296,7 +293,7 @@ class UserDetailsRegistrationFragment : Fragment() {
val district = etDistrict.text.toString()
if (district.isEmpty()) {
etDistrict.error = getString(R.string.enter_district)
etDistrict.error = R.string.enter_district.toString()
return false
} else {
userData.district = district
@@ -304,7 +301,7 @@ class UserDetailsRegistrationFragment : Fragment() {
val state = etState.text.toString()
if (state.isEmpty()) {
etState.error = getString(R.string.enter_state)
etState.error = R.string.enter_state.toString()
return false
} else {
userData.state = state
@@ -312,7 +309,7 @@ class UserDetailsRegistrationFragment : Fragment() {
val pincode = etPincode.text.toString()
if (pincode.isEmpty() || pincode.length != 6) {
etPincode.error = getString(R.string.enter_pincode)
etPincode.error = R.string.enter_pincode.toString()
return false
} else {
userData.pinCode = pincode
@@ -325,7 +322,7 @@ class UserDetailsRegistrationFragment : Fragment() {
if (yes1history.isChecked) {
val familyHistory = etFamilyHistory.text.toString()
if (familyHistory.isEmpty()) {
etFamilyHistory.error = getString(R.string.enter_family_history)
etFamilyHistory.error = R.string.enter_family_history.toString()
return false
}
@@ -336,12 +333,10 @@ class UserDetailsRegistrationFragment : Fragment() {
}
userData.createdAt = SimpleDateFormat(
"yyyy-MM-dd HH:mm:ss", Locale.getDefault()
).format(Calendar.getInstance().time)
return true
}
}

View File

@@ -2,7 +2,6 @@ package com.example.hposregistration.ui.viewmodels
import android.content.Context
import android.net.Uri
import android.util.Log
import androidx.lifecycle.LiveData
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel
@@ -11,27 +10,20 @@ import com.example.hposregistration.data.MainRepository
import com.example.hposregistration.data.NetworkStatusLiveData
import com.example.hposregistration.data.Response
import com.example.hposregistration.data.user.UserData
import com.example.hposregistration.dao.UserDao
import com.example.hpostesting.data.datasource.LocalFileDataSource
import com.google.firebase.storage.FirebaseStorage
import dagger.hilt.android.lifecycle.HiltViewModel
import kotlinx.coroutines.launch
import java.text.SimpleDateFormat
import java.util.Date
import java.util.Locale
import javax.inject.Inject
@HiltViewModel
class RegistrationViewModel @Inject constructor(
private val mainRepository: MainRepository,
private val userdao: UserDao,
private val localFileDataSource: LocalFileDataSource,
context: Context
) : ViewModel() {
val userData = MutableLiveData<UserData>()
val allUserData = userdao.getAll()
val allUserData = mainRepository.allUsers
val fireBaseUpload = MutableLiveData<String>()
@@ -81,26 +73,4 @@ class RegistrationViewModel @Inject constructor(
fun deleteById(userId: String) = viewModelScope.launch {
mainRepository.deleteById(id = userId)
}
fun createCSV(userData: List<UserData>, appContext: Context) =
viewModelScope.launch {
val fileName = "${getCurrentDateTime()}.csv"
if (localFileDataSource.exportDataToCSV(fileName, userData)) {
userData.forEach { data ->
data.localFlag = true
mainRepository.updateCSVFieldById(
data._id,
true)
// data.isCSVCreated = false
Log.d("DownloadDebugcsv", "Setting isCSVCreated to false for ${data._id}")
}
}
}
private fun getCurrentDateTime(): String {
val dateFormat = SimpleDateFormat("dd-MM-yy", Locale.getDefault())
val currentDateTime = Date()
return dateFormat.format(currentDateTime)
}
}

View File

@@ -1,5 +0,0 @@
<vector android:height="24dp" android:tint="#000000"
android:viewportHeight="24" android:viewportWidth="24"
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="@android:color/white" android:pathData="M19.14,12.94c0.04,-0.3 0.06,-0.61 0.06,-0.94c0,-0.32 -0.02,-0.64 -0.07,-0.94l2.03,-1.58c0.18,-0.14 0.23,-0.41 0.12,-0.61l-1.92,-3.32c-0.12,-0.22 -0.37,-0.29 -0.59,-0.22l-2.39,0.96c-0.5,-0.38 -1.03,-0.7 -1.62,-0.94L14.4,2.81c-0.04,-0.24 -0.24,-0.41 -0.48,-0.41h-3.84c-0.24,0 -0.43,0.17 -0.47,0.41L9.25,5.35C8.66,5.59 8.12,5.92 7.63,6.29L5.24,5.33c-0.22,-0.08 -0.47,0 -0.59,0.22L2.74,8.87C2.62,9.08 2.66,9.34 2.86,9.48l2.03,1.58C4.84,11.36 4.8,11.69 4.8,12s0.02,0.64 0.07,0.94l-2.03,1.58c-0.18,0.14 -0.23,0.41 -0.12,0.61l1.92,3.32c0.12,0.22 0.37,0.29 0.59,0.22l2.39,-0.96c0.5,0.38 1.03,0.7 1.62,0.94l0.36,2.54c0.05,0.24 0.24,0.41 0.48,0.41h3.84c0.24,0 0.44,-0.17 0.47,-0.41l0.36,-2.54c0.59,-0.24 1.13,-0.56 1.62,-0.94l2.39,0.96c0.22,0.08 0.47,0 0.59,-0.22l1.92,-3.32c0.12,-0.22 0.07,-0.47 -0.12,-0.61L19.14,12.94zM12,15.6c-1.98,0 -3.6,-1.62 -3.6,-3.6s1.62,-3.6 3.6,-3.6s3.6,1.62 3.6,3.6S13.98,15.6 12,15.6z"/>
</vector>

View File

@@ -1,5 +0,0 @@
<vector android:height="24dp" android:tint="@color/primary"
android:viewportHeight="24" android:viewportWidth="24"
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="@color/primary" android:pathData="M19,9h-4V3H9v6H5l7,7 7,-7zM5,18v2h14v-2H5z"/>
</vector>

View File

@@ -1,13 +0,0 @@
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.example.hposregistration.ui.fragments.LanguageSettingsFragment">
<!-- TODO: Update blank fragment layout -->
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="@string/hello_blank_fragment" />
</FrameLayout>

View File

@@ -16,14 +16,6 @@
android:layout_height="match_parent"
android:orientation="vertical">
</LinearLayout>
<ImageView
android:id="@+id/btnsettings"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_marginEnd="10dp"
android:src="@drawable/baseline_settings_24"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="@+id/tv_title" />
<TextView
android:id="@+id/tv_title"
style="@style/title1"
@@ -34,8 +26,6 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/noList"
style="@style/title1"
@@ -82,16 +72,6 @@
app:layout_constraintTop_toBottomOf="@+id/tv_title"
tools:listitem="@layout/user_item_view" />
<ImageView
android:id="@+id/btnSaveLocal"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_marginEnd="10dp"
android:src="@drawable/downloads"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="@+id/rv_order"
app:layout_constraintStart_toStartOf="parent" />
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/btnRegisterUser"
android:layout_width="wrap_content"

View File

@@ -31,9 +31,6 @@
app:destination="@id/loginFragment"
app:popUpTo="@id/main_nav_graph"
app:popUpToInclusive="true"/>
<action
android:id="@+id/action_userListFragment_to_languageSettingsFragment"
app:destination="@id/languageSettingsFragment" />
</fragment>
<fragment
android:id="@+id/profileFragment"
@@ -96,16 +93,4 @@
app:popUpTo="@id/main_nav_graph"
app:popUpToInclusive="true"/>
</fragment>
<fragment
android:id="@+id/languageSettingsFragment"
android:name="com.example.hposregistration.ui.fragments.LanguageSettingsFragment"
android:label="fragment_language_settings"
tools:layout="@layout/fragment_language_settings">
<action
android:id="@+id/action_userListFragment_to_languageSettingsFragment"
app:destination="@id/languageSettingsFragment"
app:popUpTo="@id/main_nav_graph"
app:popUpToInclusive="true"/>
</fragment>
</navigation>

View File

@@ -115,14 +115,12 @@
<string name="enter_father_husband_name">पिता / पति का नाम दर्ज करें</string>
<string name="do_log_out">क्या आप ऐप्लिकेशन से लॉग आउट करना चाहते हैं?</string>
<string name="log_out">लॉग आउट</string>
<string name="local">साक्षात्कार विवरण स्थानीय रूप से सहेजे गए हैं</string>
<string name="no_data_available">स्थानीय डेटाबेस में कोई डेटा उपलब्ध नहीं है</string>
<string name="upload_db_registration">डीबी पंजीकरण अपलोड करें</string>
<string name="upload_local_db_to_cloud">क्या आप स्थानीय डीबी को क्लाउड पर अपलोड करना चाहते हैं?</string>
<string name="upload">अपलोड</string>
<string name="upload_done_successfully">अपलोड सफलतापूर्वक हुआ</string>
<string name="empty_registrations">प्रदर्शन के लिए कोई पंजीकरण उपलब्ध नहीं है</string>
<string name="enter_proper_login_id">कृपया सही लॉगिन आईडी दर्ज करें</string>
<string name="enter_proper_password">कृपया सही पासवर्ड दर्ज करें</string>
<string name="wrong_password">गलत पासवर्ड</string>
@@ -130,16 +128,7 @@
<string name="scanned_aadhar_id">आपने आधार आईडी स्कैन की है, कृपया आधार आईडी नंबर और अभा आईडी को मैन्युअली दर्ज करें</string>
<string name="scanned_abha_id">आपने आभा आईडी स्कैन की है</string>
<string name="scanned_aadharid">आपने आधार आईडी स्कैन की है</string>
<string name="language_update">भाषा सफलतापूर्वक अपडेट की गई है</string>
<string name="select_language">अपनी पसंदीदा भाषा का चयन करें</string>
<string name="app_language">ऐप भाषा</string>
<string name="add_blood_group">रक्त समूह जोड़ें</string>
<string name="ok">ठीक है</string>
<string name="userid">उपयोगकर्ता आईडी</string>
<string name="yes">हाँ</string>
<string name="no">नहीं</string>
<string name="name">नाम</string>
<string-array name="category">
<item>NT-A</item>
<item>NT-B</item>

View File

@@ -6,16 +6,15 @@
<string name="retry">ಮರುಪ್ರಯಾಸ</string>
<string name="failed_to_connect">ಸಂಪರ್ಕ ಸಾಧಿಸಲಾಗಿಲ್ಲ</string>
<string name="cancel">ರದ್ದು ಮಾಡಿ</string>
<string name="local">ಟೆಸ್ಟ್ ವಿವರಗಳನ್ನು ಸ್ಥಳೀಯವಾಗಿ ಉಳಿಸಲಾಗಿದೆ</string>
//Registration Screens
<string name="scan_person_abha_id_card">ವ್ಯಕ್ತಿಯ ಏಬಿಎ ಐಡಿ / ಆಧಾರ್ ಐಡಿ ಕಾರ್ಡ್ ಸ್ಕ್ಯಾನ್ ಮಾಡಿ</string>
<string name="scan_now">ಈಗ ಸ್ಕ್ಯಾನ್ ಮಾಡಿ</string>
<string name="or">ಅಥವಾ</string>
<string name="enter_abha_number_manualy">ಅಭಾ ಮತ್ತು ಆಧಾರ್ ಸಂಖ್ಯೆನ್ನು ನಮೂದಿಸಿ</string>
<string name="abha_id">ಅಭಾ ಸಂಖ್ಯೆ</string>
<string name="create_abha_id_card">ಅಭಾ ಐಡಿ ಕಾರ್ಡ್ ರಚಿಸಿ</string>
<string name="enter_abha_number_manualy">ಏಬಿಎ ಮತ್ತು ಆಧಾರ್ ಸಂಖ್ಯೆಗಳನ್ನು ಕೈಮಾಡಿ</string>
<string name="abha_id">ಏಬಿಎ ಸಂಖ್ಯೆ</string>
<string name="create_abha_id_card">ಏಬಿಎ ಐಡಿ ಕಾರ್ಡ್ ರಚಿಸಿ</string>
<string name="click_here">ಇಲ್ಲಿ ಕ್ಲಿಕ್ ಮಾಡಿ</string>
<string name="scan_person_s_aadhaar_card">ವ್ಯಕ್ತಿಯ ಆಧಾರ್ ಕಾರ್ಡ್ ಸ್ಕ್ಯಾನ್ ಮಾಡಿ</string>
<string name="proceed">ಮುಂದುವರಿಸಿ</string>
@@ -58,7 +57,7 @@
<string name="user_details">ಬಳಕೆದಾರ ವಿವರಗಳು</string>
<string name="internet_is_not_available_and_there_is_no_data_available_in_local_db">ಇಂಟರ್ನೆಟ್ ಲಭ್ಯವಿಲ್ಲ ಮತ್ತು ಸ್ಥಳಿಯ ಡಿಬಿಯಲ್ಲಿ ಯಾವುದೇ ಡೇಟಾ ಲಭ್ಯವಿಲ್ಲ</string>
<string name="user_id">ಬಳಕೆದಾರ ಐಡಿ: %1$s</string>
<string name="abha_number">ಭಾ ಸಂಖ್ಯೆ: %1$s</string>
<string name="abha_number">ಭಾ ಸಂಖ್ಯೆ: %1$s</string>
<string name="aadhar_number_details">ಆಧಾರ ಸಂಖ್ಯೆ: %1$s</string>
<string name="user_name">ವ್ಯಕ್ತಿಯ ಹೆಸರು: %1$s</string>
<string name="birth_year_details">ಹುಟ್ಟಿದ ವರ್ಷ: %1$s</string>
@@ -93,10 +92,10 @@
<string name="cancelled_unable_scan">ರದ್ದು ಮಾಡಲಾಗಿದೆ: ಸ್ಕ್ಯಾನ್ ಮಾಡಲು ಸಾಧ್ಯವಿಲ್ಲ, ಮತ್ತೊಮ್ಮೆ ಪ್ರಯಾಸಿಸಿ!!</string>
<string name="scan_abha_card">ದಯವಿಟ್ಟು ಭಾ ಐಡಿ/ಆಧಾರ್ ಐಡಿಯನ್ನು ಸ್ಕ್ಯಾನ್ ಮಾಡಿ</string>
<string name="scan_abha_card">ದಯವಿಟ್ಟು ಭಾ ಐಡಿ / ಆಧಾರ್ ಐಡಿ ಸ್ಕ್ಯಾನ್ ಮಾಡಿ</string>
<string name="invalid_qr_code">ನೀವು ಸ್ಕ್ಯಾನ್ ಮಾಡಿದ QR ಕೋಡ್ ಮಾನ್ಯವಿಲ್ಲ, ದಯವಿಟ್ಟು ಮಾಹಿತಿಯನ್ನು ಕೈಮಾಡಿ ನಮೂದಿಸಿ</string>
<string name="enter_aadhar_manually">ನೀವು ಅಬ ಹಾ ಐಡಿ ಸ್ಕ್ಯಾನ್ ಮಾಡಿದ್ದೀರಿ, ಆಧಾರ್ ಐಡಿ ಅನ್ನು ಕೈಮಾತ್ರ ನಮೂದಿಸಿ</string>
<string name="invalid_abha_id">ಅಮಾನ್ಯ ಅಭಾ ಐಡಿ</string>
<string name="invalid_abha_id">ಅಮಾನ್ಯವಾದ ಅಬ ಹಾ ಐಡಿ</string>
<string name="invalid_aadhar_id">ಅಮಾನ್ಯವಾದ ಆಧಾರ್ ಐಡಿ</string>
<string name="name_field_error">ಹೆಸರು ಕ್ಷೇತ್ರವು ಖಾಲಿ ಇರಲಾರದು ಅಥವಾ 3 ಅಕ್ಷರಗಳಿಂದ ಕಡಿಮೆ ಇರಲಾರದು</string>
<string name="center_name_error">ಕೇಂದ್ರದ ಹೆಸರು ಖಾಲಿ ಇರಲಾರದು ಅಥವಾ 3 ಅಕ್ಷರಗಳಿಂದ ಕಡಿಮೆ ಇರಲಾರದು</string>
@@ -120,7 +119,6 @@
<string name="enter_father_husband_name">ದಯವಿಟ್ಟು ನಿಮ್ಮ ತಂದೆ / ಗಂಡನ ಹೆಸರನ್ನು ನಮೂದಿಸಿ</string>
<string name="do_log_out">ನೀವು ಅಪ್ಲಿಕೇಶನ್ ನಿಂದ ಲಾಗೌಟ್ ಮಾಡಲು ಇಚ್ಛಿಸುತ್ತೀರಾ?</string>
<string name="log_out">ಲಾಗೌಟ್</string>
<string name="no_data_available">ಸ್ಥಾನಿಕ ಡೇಟಾಬೇಸ್‌ನಲ್ಲಿ ಯಾವುದೇ ಡೇಟಾ ಲಭ್ಯವಿಲ್ಲ</string>
<string name="upload_db_registration">ಡಿಬಿ ನೋಂದಾಯಿಸುವ ಕೊರಕು</string>
<string name="upload_local_db_to_cloud">ನೀವು ಲೋಕಲ್ ಡಿಬಿ ನೋಂದಾಯಿಸನ್ನು ಮೇಘಮಾರ್ಗಕ್ಕೆ ಅಪ್ಲೋಡ್ ಮಾಡಲು ಇಚ್ಛಿಸುವಿರಾ?</string>
@@ -131,19 +129,11 @@
<string name="wrong_password">ತಪ್ಪಾದ ಪಾಸ್‌ವರ್ಡ್</string>
<string name="wrong_user_id">ತಪ್ಪಾದ ಬಳಕೆದಾರ ಐಡಿ</string>
<string name="scanned_aadhar_id">ನೀವು ಆಧಾರ್ ಐಡನ್ನು ಸ್ಕ್ಯಾನ್ ಮಾಡಿದ್ದೀರಿ, ದಯವಿಟ್ಟು ಆಧಾರ್ ಐಡನ್ನು ನೀವು ಸ್ಕ್ಯಾನ್ ಮಾಡಿದ ಮತ್ತು ಅಭಾ ಐಡನ್ನು ಕೈಯಾರೆ ನಮೂದಿಸಿ</string>
<string name="empty_registrations">ಪ್ರದರ್ಶಿಸಲಿರುವ ಯಾವ ನೋಂದಾಯಿಗಳೂ ಲಭ್ಯವಿಲ್ಲ</string>
<string name="scanned_abha_id">ನೀವು ಅಭಾ ಐಡಿಯನ್ನು ಸ್ಕ್ಯಾನ್ ಮಾಡಿದ್ದೀರಿ</string>
<string name="scanned_abha_id">ನೀವು ಅಭಾ ಐಡನ್ನು ಸ್ಕ್ಯಾನ್ ಮಾಡಿದಿರಿ</string>
<string name="scanned_aadharid">ನೀವು ಆಧಾರ್ ಐಡನ್ನು ಸ್ಕ್ಯಾನ್ ಮಾಡಿದಿರಿ</string>
<string name="language_update">ಭಾಷೆ ಯಶಸ್ವಿಯಾಗಿ ನವೀಕರಿಸಲಾಗಿದೆ</string>
<string name="select_language">ನಿಮ್ಮ ಆದರಿತ ಭಾಷೆಯನ್ನು ಆಯ್ಕೆ ಮಾಡಿ</string>
<string name="app_language">ಅಪ್ಲಿಕೇಶನ್ ಭಾಷೆ</string>
<string name="add_blood_group">ರಕ್ತ ಗುಂಡನ್ನು ಸೇರಿಸಿ</string>
<string name="userid">ಬಳಕೆದಾರ ಐಡಿ</string>
<string name="ok">ಸರಿ</string>
<string name="yes">ಹೌದು</string>
<string name="no">ಇಲ್ಲ</string>
<string name="name">ಹೆಸರು</string>
<string-array name="yes_no">
<item>ಹೌದು</item>
<item>ಇಲ್ಲ</item>

View File

@@ -7,8 +7,7 @@
<string name="retry">Retry</string>
<string name="failed_to_connect">Failed to connect</string>
<string name="cancel">Cancel</string>
<string name="yes">Yes</string>
<string name="no">No</string>
<string-array name="yes_no">
<item>Yes</item>
<item>No</item>
@@ -60,7 +59,7 @@
<string name="mobile_number">Mobile Number</string>
<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">there is no Data available in Local DB</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="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>
@@ -104,9 +103,6 @@
<string name="center_name_error">Center name can\'t be empty or less than 3 characters</string>
<string name="registration_success">Registration Done Successfully</string>
<string name="internt_not_local">Internet not available, test details stored locally</string>
<string name="local">test details stored locally</string>
<string name="no_data_available">No data available in the local database</string>
<string name="enter_details_properly">Please enter all the details properly</string>
<string name="enter_valid_birth_year">Please enter a valid birth year between 1900 and 2023</string>
<string name="fill_field">Please fill the field</string>
@@ -129,28 +125,16 @@
<string name="upload_local_db_to_cloud">Do you want to upload the local DB Registration to the cloud?</string>
<string name="upload">Upload</string>
<string name="upload_done_successfully">Upload done successfully</string>
<string name="language_update">Language updated successfully</string>
<string name="select_language">Select your preferred language</string>
<string name="app_language">App Language</string>
<string name="enter_proper_login_id">Please enter a proper Login ID</string>
<string name="enter_proper_password">Please enter a proper password</string>
<string name="wrong_password">Wrong Password</string>
<string name="wrong_user_id">Wrong UserID</string>
<string name="userid">User Id</string>
<string name="name">Name</string>
<string name="ok">OK</string>
<string name="empty_registrations">No registrations available for display</string>
<string name="add_blood_group">Add Blood Group</string>
<string name="scanned_aadhar_id">You have scanned the Aadhar ID, need to enter Aadhar ID number you have scanned and Abha ID manually</string>
<string name="scanned_abha_id">You have scanned the Abha ID</string>
<string name="scanned_aadharid">You have scanned the Aadhar ID</string>
<string name="downloadcsv">Download CSV</string>
<string name="download_db_registration_title">Download DB Tests</string>
<string name="download_db_registration_message">Do you want to download the local DB tests in CSV format?</string>
<string name="upload_success_message">Upload done successfully</string>
<string-array name="category">
<item>NT-A</item>
<item>NT-B</item>