Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HAPP-1597: Rewrites lab test details in compose #529

Open
wants to merge 38 commits into
base: feature/Android-UI-2.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
a1e3b8d
HAPP-1534
PINAKIN-KANSARA-EY Jun 23, 2023
cc3afce
HAPP-1535
PINAKIN-KANSARA-EY Jun 26, 2023
7f15b52
HAPP-1536: Immz schedule UI
bsavoini-ey Jul 5, 2023
c51b826
Fix merge issues
bsavoini-ey Jul 5, 2023
6330fbf
HAPP-1535: PR comments
bsavoini-ey Jul 5, 2023
8a38d18
HAPP-1536: Use launched effect
bsavoini-ey Jul 6, 2023
df1654e
HAPP-1539: Create Tile list UI
bsavoini-ey Jul 7, 2023
472f716
HAPP-1539: Rename isManagementEnabled field
bsavoini-ey Jul 10, 2023
d888928
HAPP-1539: Update data models
bsavoini-ey Jul 11, 2023
52be3cc
HAPP-1539: Remove QuickAccessTileEntity
bsavoini-ey Jul 11, 2023
4287979
HAPP-1539: Display manageable tiles from db
bsavoini-ey Jul 12, 2023
6b5e8b5
HAPP-1539: Update QuickAccess flag
bsavoini-ey Jul 12, 2023
4282bd8
HAPP-1539: Update QuickAccess icons
bsavoini-ey Jul 12, 2023
a83c494
HAPP-1539: Redirect user to TileManagement
bsavoini-ey Jul 12, 2023
3a24567
Apply spotless changes
bsavoini-ey Jul 12, 2023
82b81c1
HAPP-1539: Fix toolbar elevation
bsavoini-ey Jul 13, 2023
10aadf6
HAPP-1539: Lift loading state
bsavoini-ey Jul 13, 2023
fc22092
HAPP-1540: Redirect user to filtered records
bsavoini-ey Jul 13, 2023
652bde2
Version 2.0.0-201
bsavoini-ey Jul 14, 2023
fdcc436
HAPP-1535
PINAKIN-KANSARA-EY Jun 26, 2023
05d7d61
HAPP-1537
PINAKIN-KANSARA-EY Jul 6, 2023
2b0039b
HAPP-1535
PINAKIN-KANSARA-EY Jun 26, 2023
edcf9de
HAPP-1614
PINAKIN-KANSARA-EY Jul 26, 2023
0af34e5
HAPP-1248 : Recommendation Immunization screen UI
PINAKIN-KANSARA-EY Aug 9, 2023
caeaab2
HAPP-1534
PINAKIN-KANSARA-EY Jun 23, 2023
9ad6595
HAPP-1538: Remove Tile
PINAKIN-KANSARA-EY Jul 26, 2023
4c25915
HAPP-1250: Display recommendation for primary & dependent user
PINAKIN-KANSARA-EY Aug 15, 2023
43da9e6
HAPP-1645,1646,1647: Recommendations Fixes
PINAKIN-KANSARA-EY Aug 16, 2023
de55f6e
HAPP-1647: ui issues fixes
PINAKIN-KANSARA-EY Aug 17, 2023
58164cd
HAPP-1644,1538
PINAKIN-KANSARA-EY Aug 23, 2023
d4cf4f9
Merge conflict issue
PINAKIN-KANSARA-EY Sep 5, 2023
e482bb1
HAPP-1597: Display LabResults in Compose
bsavoini-ey Sep 12, 2023
72bd7af
Version 2.0.0-210
bsavoini-ey Sep 13, 2023
de403ca
PR review: Create LabTestUI file
bsavoini-ey Sep 14, 2023
dfa56bd
PR review: Move uiState to Composable file
bsavoini-ey Sep 15, 2023
06f992c
PR review: Implement collectAsStateWithLifecycle
bsavoini-ey Sep 15, 2023
b0a95e0
PR review: Move PDF state to Composable file
bsavoini-ey Sep 15, 2023
9762b3e
PR review: Move Comments handling state to Composable file
bsavoini-ey Sep 18, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ android {
task getApkVersion {
println defaultConfig.versionName + "-" + defaultConfig.versionCode
}
namespace 'ca.bc.gov.bchealth'
}

dependencies {
Expand All @@ -113,18 +114,19 @@ dependencies {
implementation composeBom
implementation 'androidx.compose.material:material'
implementation 'androidx.compose.ui:ui-tooling-preview'
implementation 'androidx.compose.runtime:runtime-livedata'
implementation "androidx.constraintlayout:constraintlayout-compose:$versions.constraint_compose"

debugImplementation 'androidx.compose.ui:ui-tooling'


//Navigation
implementation "androidx.navigation:navigation-fragment-ktx:$versions.navigation"
implementation "androidx.navigation:navigation-ui-ktx:$versions.navigation"
implementation "androidx.navigation:navigation-runtime-ktx:$versions.navigation"

//JetPack LiveData ViewModel
implementation "androidx.lifecycle:lifecycle-viewmodel-compose:$versions.lifecycle"
implementation "androidx.lifecycle:lifecycle-runtime-compose:$versions.lifecycle"
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$versions.lifecycle"
implementation "androidx.lifecycle:lifecycle-livedata-ktx:$versions.lifecycle"
implementation "androidx.lifecycle:lifecycle-runtime-ktx:$versions.lifecycle"
Expand Down
3 changes: 1 addition & 2 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="ca.bc.gov.bchealth">
xmlns:tools="http://schemas.android.com/tools">

<uses-feature android:name="android.hardware.camera" />

Expand Down
6 changes: 3 additions & 3 deletions app/src/main/java/ca/bc/gov/bchealth/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ class MainActivity : AppCompatActivity() {
false
)
if (started) {
binding.navHostFragment.showErrorSnackbar(getString(R.string.notification_title_while_fetching_data))
binding.navHostFragment.showErrorSnackbar(getString(R.string.notification_title_while_fetching_data), binding.bottomNav)
}
}

Expand All @@ -154,7 +154,7 @@ class MainActivity : AppCompatActivity() {
WorkInfo.State.SUCCEEDED -> {
if (isWorkerStarted) {
inAppUpdate.checkForUpdate(AppUpdateType.FLEXIBLE)
binding.navHostFragment.showErrorSnackbar(getString(R.string.notification_title_on_success))
binding.navHostFragment.showErrorSnackbar(getString(R.string.notification_title_on_success), binding.bottomNav)
}
}

Expand Down Expand Up @@ -190,7 +190,7 @@ class MainActivity : AppCompatActivity() {
false
)
if (isRecordFetchFailed) {
binding.navHostFragment.showErrorSnackbar(getString(R.string.notification_title_on_failed))
binding.navHostFragment.showErrorSnackbar(getString(R.string.notification_title_on_failed), binding.bottomNav)
}
}
}
Expand Down
135 changes: 134 additions & 1 deletion app/src/main/java/ca/bc/gov/bchealth/SplashViewModel.kt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,13 @@ 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
Expand All @@ -18,7 +24,9 @@ private const val MAX_SPLASH_DELAY = 2000L
@HiltViewModel
class SplashViewModel @Inject constructor(
private val mobileConfigRepository: MobileConfigRepository,
onBoardingRepository: OnBoardingRepository
onBoardingRepository: OnBoardingRepository,
private val appFeatureRepository: AppFeatureRepository,
private val quickAccessTileRepository: QuickAccessTileRepository
) : ViewModel() {

private val _updateType: MutableLiveData<UpdateType> = MutableLiveData()
Expand All @@ -27,6 +35,7 @@ class SplashViewModel @Inject constructor(

init {
onBoardingRepository.checkIfReOnBoardingRequired(BuildConfig.VERSION_CODE)
initializeAppData()
}

fun checkAppVersion() {
Expand All @@ -50,6 +59,130 @@ 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 serviceQuickLinkTilesItem(id: Long): List<QuickAccessTileDto> {
return listOf(
QuickAccessTileDto(
featureId = id,
tileName = QuickAccessLinkName.ORGAN_DONOR,
tilePayload = "Organ Donor",
showAsQuickAccess = false
)
)
}

private fun timelineQuickLinkTiles(id: Long): List<QuickAccessTileDto> {
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
)
)
}

enum class UpdateType {
FORCE_UPDATE, CHECK_SOFT_UPDATE
}
Expand Down
23 changes: 7 additions & 16 deletions app/src/main/java/ca/bc/gov/bchealth/compose/Styles.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package ca.bc.gov.bchealth.compose
import androidx.compose.material.MaterialTheme
import androidx.compose.material.Typography
import androidx.compose.runtime.Composable
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.text.font.Font
import androidx.compose.ui.text.font.FontFamily
Expand All @@ -12,6 +11,10 @@ import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import ca.bc.gov.bchealth.R
import ca.bc.gov.bchealth.compose.theme.darkText
import ca.bc.gov.bchealth.compose.theme.descriptionGrey
import ca.bc.gov.bchealth.compose.theme.primaryBlue
import ca.bc.gov.bchealth.compose.theme.white

// Consider making touch targets at least 48x48dp. https://support.google.com/accessibility/android/answer/7101858?hl=en
val minButtonSize = 48.dp
Expand All @@ -23,20 +26,6 @@ val fonts = FontFamily(
Font(R.font.bc_sans_bold_italic, weight = FontWeight.Bold, style = FontStyle.Italic),
)

val darkText = Color(0xFF313132)

val black = Color(0xFF000000)
val white = Color(0xFFFFFFFF)
val blue = Color(0xFF1A5A96)
val primaryBlue = Color(0xFF003366)
val lightBlue = Color(0xFFB2C1CF)
val statusBlue30 = Color(0x4D38598A)
val descriptionGrey = Color(0xFF6D757D)
val grey = Color(0xFF606060)
val greyBg = Color(0xFFF2F2F2)
val green = Color(0xFF2E8540)
val red = Color(0xFFD8292F)

val Typography.largeButton: TextStyle
@Composable
get() {
Expand Down Expand Up @@ -127,16 +116,18 @@ fun TextStyle.bold() = this.copy(fontWeight = FontWeight.Bold)

fun TextStyle.italic() = this.copy(fontStyle = FontStyle.Italic)

@Deprecated("Replace with HealthGatewayTheme", replaceWith = ReplaceWith("HealthGatewayTheme"), DeprecationLevel.WARNING)
@Composable
fun MyHealthTheme(content: @Composable () -> Unit) = MaterialTheme(
colors = MaterialTheme.colors.copy(
primary = primaryBlue,
primaryVariant = white,
onPrimary = white,
background = white,
surface = white,
secondary = primaryBlue,
secondaryVariant = primaryBlue,
onBackground = primaryBlue
onBackground = primaryBlue,
),
typography = MyHealthTypography,
shapes = MaterialTheme.shapes,
Expand Down
Loading