Merge branch 'Label_structure_changes_in_exporting_csv_and_images' into 'Export_registration_data_to_CSV_and_Save_IMAGE_LOCALLY'

lablel format changes added, when data stored locally

See merge request sminnovations/hpos-registration-app!3
This commit is contained in:
Pritimay Sarkar
2024-01-21 13:28:46 +00:00
4 changed files with 10 additions and 17 deletions

View File

@@ -16,8 +16,8 @@ android {
applicationId "in.sminnovations.hposregistration"
minSdk 26
targetSdk 34
versionCode 12
versionName "1.0.12"
versionCode 13
versionName "1.0.13"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}

View File

@@ -71,7 +71,7 @@ class LocalFileDataSource {
"userImageURL"
)
csvWriter.writeNext(header)
val imagesFolder = File(getExternalStorageDirectory(), "Images${getCurrentDateTime()}")
val imagesFolder = File(getExternalStorageDirectory(), "images${getCurrentDateTime()}")
// val imagesFolder = File(getExternalStorageDirectory(), "Images")
if (!imagesFolder.exists()) {
if (!imagesFolder.mkdirs()) {
@@ -149,7 +149,7 @@ class LocalFileDataSource {
}
private fun getExternalStorageDirectory(): File {
val folder = File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS), "HposRegister")
val folder = File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS), "HposRegistration")
if (!folder.exists()) {
folder.mkdirs()
@@ -158,7 +158,7 @@ class LocalFileDataSource {
return folder
}
private fun getCurrentDateTime(): String {
val dateFormat = SimpleDateFormat("dd-MM-yy", Locale.getDefault())
val dateFormat = SimpleDateFormat("dd_MM_yy", Locale.getDefault())
val currentDateTime = Date()
return dateFormat.format(currentDateTime)
}

View File

@@ -84,8 +84,8 @@ class RegistrationViewModel @Inject constructor(
fun createCSV(userData: List<UserData>, context: Context) =
viewModelScope.launch {
val fileName = "HPOS${getCurrentDate()}.csv"
if (localFileDataSource.exportDataToCSV(fileName, userData,context)) {
val fileName = "hpos${getCurrentDate()}.csv"
if (localFileDataSource.exportDataToCSV(fileName, userData)) {
userData.forEach { data ->
data.localFlag = true
mainRepository.updateCSVFieldById(
@@ -97,15 +97,8 @@ class RegistrationViewModel @Inject constructor(
}
}
private fun getCurrentDateTime(): String {
val dateFormat = SimpleDateFormat("dd-MM-yy", Locale.getDefault())
val currentDateTime = Date()
return dateFormat.format(currentDateTime)
}
private fun getCurrentDate(): String {
val dateFormat = SimpleDateFormat("dd-MM-yy", Locale.getDefault())
val dateFormat = SimpleDateFormat("dd_MM_yy", Locale.getDefault())
val currentDate = Date()
return dateFormat.format(currentDate)
}

View File

@@ -148,8 +148,8 @@
<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="download_db_registration_title">Download DB Registartion Data</string>
<string name="download_db_registration_message">Do you want to download the local DB Registrations in CSV format?</string>
<string name="upload_success_message">Upload done successfully</string>
<string-array name="category">
<item>NT-A</item>