From 46033a9e125a0e37440b40cfd00e1d4ba7e0b3ba Mon Sep 17 00:00:00 2001 From: Pinakin Date: Tue, 9 Jul 2024 10:50:11 -0700 Subject: [PATCH 1/2] HAPP-1904 - updated login error text - updated target SDK version to 34 - updated play core SDK version to support android 34 - fixed issue of quick link tile after deleting all data from app. --- .../ca/bc/gov/bchealth/SplashViewModel.kt | 160 +----------------- .../onboarding/OnBoardingSliderViewModel.kt | 11 +- app/src/main/res/values/strings.xml | 2 +- .../gov/repository/di/RepositoriesModule.kt | 5 +- .../settings/AppFeatureRepository.kt | 151 ++++++++++++++++- scripts/versions.gradle | 10 +- 6 files changed, 174 insertions(+), 165 deletions(-) diff --git a/app/src/main/java/ca/bc/gov/bchealth/SplashViewModel.kt b/app/src/main/java/ca/bc/gov/bchealth/SplashViewModel.kt index a00ed87ab..b840c364e 100644 --- a/app/src/main/java/ca/bc/gov/bchealth/SplashViewModel.kt +++ b/app/src/main/java/ca/bc/gov/bchealth/SplashViewModel.kt @@ -5,13 +5,8 @@ import androidx.lifecycle.MutableLiveData import androidx.lifecycle.ViewModel import androidx.lifecycle.viewModelScope import ca.bc.gov.common.BuildConfig.LOCAL_API_VERSION -import ca.bc.gov.common.model.AppFeatureName -import ca.bc.gov.common.model.QuickAccessLinkName -import ca.bc.gov.common.model.settings.AppFeatureDto -import ca.bc.gov.common.model.settings.QuickAccessTileDto import ca.bc.gov.repository.OnBoardingRepository import ca.bc.gov.repository.settings.AppFeatureRepository -import ca.bc.gov.repository.settings.QuickAccessTileRepository import ca.bc.gov.repository.worker.MobileConfigRepository import dagger.hilt.android.lifecycle.HiltViewModel import kotlinx.coroutines.async @@ -25,8 +20,7 @@ private const val MAX_SPLASH_DELAY = 2000L class SplashViewModel @Inject constructor( private val mobileConfigRepository: MobileConfigRepository, onBoardingRepository: OnBoardingRepository, - private val appFeatureRepository: AppFeatureRepository, - private val quickAccessTileRepository: QuickAccessTileRepository + private val appFeatureRepository: AppFeatureRepository ) : ViewModel() { private val _updateType: MutableLiveData = MutableLiveData() @@ -35,8 +29,10 @@ class SplashViewModel @Inject constructor( init { onBoardingRepository.checkIfReOnBoardingRequired(BuildConfig.VERSION_CODE) - initializeAppData() - addBCCancerQuickLink() + viewModelScope.launch { + appFeatureRepository.initializeAppData() + appFeatureRepository.addBCCancerQuickLink() + } } fun checkAppVersion() { @@ -60,152 +56,6 @@ class SplashViewModel @Inject constructor( } } - private fun initializeAppData() = viewModelScope.launch { - val healthRecord = AppFeatureDto( - name = AppFeatureName.HEALTH_RECORDS, - hasManageableQuickAccessLinks = true, - showAsQuickAccess = true - ) - val id = appFeatureRepository.insert(healthRecord) - - if (id > 0) { - - val tiles = timelineQuickLinkTiles(id) - quickAccessTileRepository.insertAll(tiles) - } - - val immunizationSchedule = AppFeatureDto( - name = AppFeatureName.IMMUNIZATION_SCHEDULES, - hasManageableQuickAccessLinks = false, - showAsQuickAccess = true - ) - appFeatureRepository.insert(immunizationSchedule) - - val recommendations = AppFeatureDto( - name = AppFeatureName.RECOMMENDED_IMMUNIZATIONS, - hasManageableQuickAccessLinks = false, - showAsQuickAccess = true - ) - appFeatureRepository.insert(recommendations) - - val healthResources = AppFeatureDto( - name = AppFeatureName.HEALTH_RESOURCES, - hasManageableQuickAccessLinks = false, - showAsQuickAccess = true - ) - appFeatureRepository.insert(healthResources) - - val proofOfVaccine = AppFeatureDto( - name = AppFeatureName.PROOF_OF_VACCINE, - hasManageableQuickAccessLinks = false, - showAsQuickAccess = true - ) - appFeatureRepository.insert(proofOfVaccine) - - val services = AppFeatureDto( - name = AppFeatureName.SERVICES, - hasManageableQuickAccessLinks = true, - showAsQuickAccess = false - ) - - val serviceId = appFeatureRepository.insert(services) - if (serviceId > 0) { - quickAccessTileRepository.insertAll(serviceQuickLinkTilesItem(serviceId)) - } - } - - private fun addBCCancerQuickLink() = viewModelScope.launch { - try { - val appFeature = appFeatureRepository.getAppFeature(AppFeatureName.HEALTH_RECORDS) - val tile = QuickAccessTileDto( - featureId = appFeature.id, - tileName = QuickAccessLinkName.BC_CANCER_SCREENING, - tilePayload = "CancerScreening", - showAsQuickAccess = false - ) - quickAccessTileRepository.insert(tile) - } catch (e: Exception) { - e.printStackTrace() - } - } - - private fun serviceQuickLinkTilesItem(id: Long): List { - return listOf( - QuickAccessTileDto( - featureId = id, - tileName = QuickAccessLinkName.ORGAN_DONOR, - tilePayload = "Organ Donor", - showAsQuickAccess = false - ) - ) - } - - private fun timelineQuickLinkTiles(id: Long): List { - return listOf( - QuickAccessTileDto( - featureId = id, - tileName = QuickAccessLinkName.IMMUNIZATIONS, - tilePayload = "Immunization", - showAsQuickAccess = false - ), - QuickAccessTileDto( - featureId = id, - tileName = QuickAccessLinkName.MEDICATIONS, - tilePayload = "Medications", - showAsQuickAccess = false - ), - QuickAccessTileDto( - featureId = id, - tileName = QuickAccessLinkName.LAB_RESULTS, - tilePayload = "Laboratory", - showAsQuickAccess = false - ), - QuickAccessTileDto( - featureId = id, - tileName = QuickAccessLinkName.COVID_19_TESTS, - tilePayload = "COVID19Laboratory", - showAsQuickAccess = false - ), - QuickAccessTileDto( - featureId = id, - tileName = QuickAccessLinkName.HEALTH_VISITS, - tilePayload = "HealthVisit", - showAsQuickAccess = false - ), - QuickAccessTileDto( - featureId = id, - tileName = QuickAccessLinkName.SPECIAL_AUTHORITY, - tilePayload = "SpecialAuthority", - showAsQuickAccess = false - ), - QuickAccessTileDto( - featureId = id, - tileName = QuickAccessLinkName.HOSPITAL_VISITS, - tilePayload = "HospitalVisit", - showAsQuickAccess = false - ), - QuickAccessTileDto( - featureId = id, - tileName = QuickAccessLinkName.CLINICAL_DOCUMENTS, - tilePayload = "ClinicalDocument", - showAsQuickAccess = false - ), - QuickAccessTileDto( - featureId = id, - tileName = QuickAccessLinkName.IMAGING_REPORTS, - tilePayload = "ImagingReports", - showAsQuickAccess = false - ), - QuickAccessTileDto( - featureId = id, - tileName = QuickAccessLinkName.BC_CANCER_SCREENING, - tilePayload = "CancerScreening", - showAsQuickAccess = false - ) - - ) - } - enum class UpdateType { FORCE_UPDATE, CHECK_SOFT_UPDATE } diff --git a/app/src/main/java/ca/bc/gov/bchealth/ui/onboarding/OnBoardingSliderViewModel.kt b/app/src/main/java/ca/bc/gov/bchealth/ui/onboarding/OnBoardingSliderViewModel.kt index 1b4ac469c..3d518d308 100644 --- a/app/src/main/java/ca/bc/gov/bchealth/ui/onboarding/OnBoardingSliderViewModel.kt +++ b/app/src/main/java/ca/bc/gov/bchealth/ui/onboarding/OnBoardingSliderViewModel.kt @@ -4,6 +4,7 @@ import androidx.lifecycle.ViewModel import androidx.lifecycle.viewModelScope import ca.bc.gov.common.BuildConfig import ca.bc.gov.repository.OnBoardingRepository +import ca.bc.gov.repository.settings.AppFeatureRepository import dagger.hilt.android.lifecycle.HiltViewModel import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.launch @@ -15,11 +16,19 @@ import javax.inject.Inject */ @HiltViewModel class OnBoardingSliderViewModel @Inject constructor( - private val onBoardingRepository: OnBoardingRepository + private val onBoardingRepository: OnBoardingRepository, + private val appFeatureRepository: AppFeatureRepository, ) : ViewModel() { val isReOnBoardingRequired = onBoardingRepository.isReOnBoardingRequired + init { + viewModelScope.launch { + appFeatureRepository.initializeAppData() + appFeatureRepository.addBCCancerQuickLink() + } + } + fun setOnBoardingRequired(isRequired: Boolean) = viewModelScope.launch { withContext(Dispatchers.IO) { onBoardingRepository.onBoardingRequired = isRequired diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 5f827675d..6bd36b5ab 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -429,7 +429,7 @@ Problem with log in - We are unable to retrive your health record at this moment because of problem with BC Service Card log in, please contact Health Gateway team: healthgateway@gov.bc.ca for more information + We are unable to retrieve your health record at this moment because of a problem with the BC Services Card login. Please contact the Health Gateway team at healthgateway@gov.bc.ca for more information. healthgateway@gov.bc.ca Email us diff --git a/repository/src/main/java/ca/bc/gov/repository/di/RepositoriesModule.kt b/repository/src/main/java/ca/bc/gov/repository/di/RepositoriesModule.kt index 7093cacaa..6c5e71f65 100644 --- a/repository/src/main/java/ca/bc/gov/repository/di/RepositoriesModule.kt +++ b/repository/src/main/java/ca/bc/gov/repository/di/RepositoriesModule.kt @@ -360,8 +360,9 @@ class RepositoriesModule { @Provides @Singleton fun provideAppFeatureRepository( - appFeatureLocalDataSource: AppFeatureLocalDataSource - ): AppFeatureRepository = AppFeatureRepository(appFeatureLocalDataSource) + appFeatureLocalDataSource: AppFeatureLocalDataSource, + quickAccessTileRepository: QuickAccessTileRepository + ): AppFeatureRepository = AppFeatureRepository(appFeatureLocalDataSource, quickAccessTileRepository) @Provides @Singleton diff --git a/repository/src/main/java/ca/bc/gov/repository/settings/AppFeatureRepository.kt b/repository/src/main/java/ca/bc/gov/repository/settings/AppFeatureRepository.kt index 1b7743275..1c7b676fb 100644 --- a/repository/src/main/java/ca/bc/gov/repository/settings/AppFeatureRepository.kt +++ b/repository/src/main/java/ca/bc/gov/repository/settings/AppFeatureRepository.kt @@ -3,13 +3,16 @@ package ca.bc.gov.repository.settings import ca.bc.gov.common.const.DATABASE_ERROR import ca.bc.gov.common.exceptions.MyHealthException import ca.bc.gov.common.model.AppFeatureName +import ca.bc.gov.common.model.QuickAccessLinkName import ca.bc.gov.common.model.settings.AppFeatureDto +import ca.bc.gov.common.model.settings.QuickAccessTileDto import ca.bc.gov.data.datasource.local.AppFeatureLocalDataSource import ca.bc.gov.data.model.mapper.toDto import javax.inject.Inject class AppFeatureRepository @Inject constructor( - private val appFeatureLocalDataSource: AppFeatureLocalDataSource + private val appFeatureLocalDataSource: AppFeatureLocalDataSource, + private val quickAccessTileRepository: QuickAccessTileRepository ) { suspend fun insert(appFeatureDto: AppFeatureDto): Long { @@ -21,4 +24,150 @@ class AppFeatureRepository @Inject constructor( suspend fun getAppFeature(name: AppFeatureName): AppFeatureDto = appFeatureLocalDataSource.getAppFeature(name)?.toDto() ?: throw MyHealthException( DATABASE_ERROR, message = "app feature not found" ) + + suspend fun initializeAppData() { + val healthRecord = AppFeatureDto( + name = AppFeatureName.HEALTH_RECORDS, + hasManageableQuickAccessLinks = true, + showAsQuickAccess = true + ) + val id = insert(healthRecord) + + if (id > 0) { + + val tiles = timelineQuickLinkTiles(id) + quickAccessTileRepository.insertAll(tiles) + } + + val immunizationSchedule = AppFeatureDto( + name = AppFeatureName.IMMUNIZATION_SCHEDULES, + hasManageableQuickAccessLinks = false, + showAsQuickAccess = true + ) + insert(immunizationSchedule) + + val recommendations = AppFeatureDto( + name = AppFeatureName.RECOMMENDED_IMMUNIZATIONS, + hasManageableQuickAccessLinks = false, + showAsQuickAccess = true + ) + insert(recommendations) + + val healthResources = AppFeatureDto( + name = AppFeatureName.HEALTH_RESOURCES, + hasManageableQuickAccessLinks = false, + showAsQuickAccess = true + ) + insert(healthResources) + + val proofOfVaccine = AppFeatureDto( + name = AppFeatureName.PROOF_OF_VACCINE, + hasManageableQuickAccessLinks = false, + showAsQuickAccess = true + ) + insert(proofOfVaccine) + + val services = AppFeatureDto( + name = AppFeatureName.SERVICES, + hasManageableQuickAccessLinks = true, + showAsQuickAccess = false + ) + + val serviceId = insert(services) + if (serviceId > 0) { + quickAccessTileRepository.insertAll(serviceQuickLinkTilesItem(serviceId)) + } + } + + suspend fun addBCCancerQuickLink() { + try { + val appFeature = getAppFeature(AppFeatureName.HEALTH_RECORDS) + val tile = QuickAccessTileDto( + featureId = appFeature.id, + tileName = QuickAccessLinkName.BC_CANCER_SCREENING, + tilePayload = "CancerScreening", + showAsQuickAccess = false + ) + quickAccessTileRepository.insert(tile) + } catch (e: Exception) { + e.printStackTrace() + } + } + + private fun serviceQuickLinkTilesItem(id: Long): List { + return listOf( + QuickAccessTileDto( + featureId = id, + tileName = QuickAccessLinkName.ORGAN_DONOR, + tilePayload = "Organ Donor", + showAsQuickAccess = false + ) + ) + } + + private fun timelineQuickLinkTiles(id: Long): List { + return listOf( + QuickAccessTileDto( + featureId = id, + tileName = QuickAccessLinkName.IMMUNIZATIONS, + tilePayload = "Immunization", + showAsQuickAccess = false + ), + QuickAccessTileDto( + featureId = id, + tileName = QuickAccessLinkName.MEDICATIONS, + tilePayload = "Medications", + showAsQuickAccess = false + ), + QuickAccessTileDto( + featureId = id, + tileName = QuickAccessLinkName.LAB_RESULTS, + tilePayload = "Laboratory", + showAsQuickAccess = false + ), + QuickAccessTileDto( + featureId = id, + tileName = QuickAccessLinkName.COVID_19_TESTS, + tilePayload = "COVID19Laboratory", + showAsQuickAccess = false + ), + QuickAccessTileDto( + featureId = id, + tileName = QuickAccessLinkName.HEALTH_VISITS, + tilePayload = "HealthVisit", + showAsQuickAccess = false + ), + QuickAccessTileDto( + featureId = id, + tileName = QuickAccessLinkName.SPECIAL_AUTHORITY, + tilePayload = "SpecialAuthority", + showAsQuickAccess = false + ), + QuickAccessTileDto( + featureId = id, + tileName = QuickAccessLinkName.HOSPITAL_VISITS, + tilePayload = "HospitalVisit", + showAsQuickAccess = false + ), + QuickAccessTileDto( + featureId = id, + tileName = QuickAccessLinkName.CLINICAL_DOCUMENTS, + tilePayload = "ClinicalDocument", + showAsQuickAccess = false + ), + QuickAccessTileDto( + featureId = id, + tileName = QuickAccessLinkName.IMAGING_REPORTS, + tilePayload = "ImagingReports", + showAsQuickAccess = false + ), + QuickAccessTileDto( + featureId = id, + tileName = QuickAccessLinkName.BC_CANCER_SCREENING, + tilePayload = "CancerScreening", + showAsQuickAccess = false + ) + + ) + } } diff --git a/scripts/versions.gradle b/scripts/versions.gradle index a887e3a64..02c9765c8 100644 --- a/scripts/versions.gradle +++ b/scripts/versions.gradle @@ -2,8 +2,8 @@ def versions = [:] //Android versions.minSdkVersion = 27 -versions.targetSdkVersion = 33 -versions.compileSdkVersion = 33 +versions.targetSdkVersion = 34 +versions.compileSdkVersion = 34 //App versions.versionName = '2.2.1' @@ -16,7 +16,7 @@ versions.gradle = '8.1.0' versions.annotation = '1.6.0' versions.appcompat = '1.6.1' -versions.core_ktx = "1.10.1" +versions.core_ktx = "1.13.1" versions.constraint_layout = "2.1.4" versions.constraint_compose = "1.0.1" versions.coroutines = "1.6.4" @@ -45,9 +45,9 @@ versions.gson = "2.9.0" versions.jjwt = "0.11.1" versions.bouncycastle = "1.69" -versions.browser = "1.5.0" +versions.browser = "1.8.0" -versions.app_update = "2.0.1" +versions.app_update = "2.1.0" versions.queue_it = "2.0.34" versions.datastore = "1.0.0" From 06e81029e90b8c3cdcf84d3e5d6a1345516b5c5b Mon Sep 17 00:00:00 2001 From: Pinakin Date: Tue, 9 Jul 2024 10:50:11 -0700 Subject: [PATCH 2/2] HAPP-1904 - updated login error text - updated target SDK version to 34 - updated play core SDK version to support android 34 - fixed issue of quick link tile after deleting all data from app. - fixed enter vaccination information screen navigation. - fixed dependent comment navigation issue. --- app/src/main/res/navigation/dependents.xml | 12 ++++++++++ app/src/main/res/navigation/health_pass.xml | 21 +++++++++++++++++- .../main/res/navigation/health_records.xml | 22 +------------------ 3 files changed, 33 insertions(+), 22 deletions(-) diff --git a/app/src/main/res/navigation/dependents.xml b/app/src/main/res/navigation/dependents.xml index 469ca3c18..d25300bd1 100644 --- a/app/src/main/res/navigation/dependents.xml +++ b/app/src/main/res/navigation/dependents.xml @@ -212,4 +212,16 @@ app:nullable="true" /> + + + + \ No newline at end of file diff --git a/app/src/main/res/navigation/health_pass.xml b/app/src/main/res/navigation/health_pass.xml index d652b75e1..4cca20d27 100644 --- a/app/src/main/res/navigation/health_pass.xml +++ b/app/src/main/res/navigation/health_pass.xml @@ -57,10 +57,29 @@ - + + + + + + + - + @@ -53,24 +51,6 @@ android:label="AddHealthRecordsFragment" tools:layout="@layout/scene_health_records_add" /> - - - - - - -