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

Conversation

bsavoini-ey
Copy link
Collaborator

No description provided.

PINAKIN-KANSARA-EY and others added 30 commits September 5, 2023 14:32
- fixed bottom navigation bar icon, color & typography
- moved colors to Colors.kt
- added home screen redesign 2.0 for non authenticated users.
- Uses Card component
- Receives modifier
- Uses Arrangement spacedBy
- added home screen redesign 2.0 for non authenticated users

HAPP-1535
- added new home screen 2.0 UI design for non authenticated user.
- added handling for authenticated user home screen UI 2.0
- added home screen redesign 2.0 for non authenticated users.
- fixed home screen recommended immunization icon based on user login status & response from API.
- updated recommendation screen UI
- fixed bottom navigation bar icon, color & typography
- moved colors to Colors.kt
- upgraded gradle version to 8.1
- upgraded java version 17
- removed popBackstack from BaseFragment and also removed its reference usage.
- removed composeEmail from BaseFragment to FragmentExtensions.kt
- updated HomeScreen floe handling to lifecycle aware.
- updated UI to handle remove action click
- updated authentication status observation
- added ability to see recommendations for primary and dependent user.
- fixed click to expand issue
- fixed color of the count issue
- fixed ordering issue
- fixed title center issue on tool bar.
- removed icon from the title
- fixed issue with order by date
- added feature to remove tile from the home screen
- added ability to manage tiles from manage tile option
- added local tile management feature

override fun getCommentEntryTypeCode() = CommentEntryTypeCode.LAB_RESULTS
val uiState = viewModel.uiState.collectAsState().value
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use collectAsStateWithLifecycle instead of collectAsState.
Reference: https://medium.com/androiddevelopers/consuming-flows-safely-in-jetpack-compose-cde014d0d5a3

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

override fun getCommentView(): AddCommentLayout = binding.comment
override fun onResume() {
super.onResume()
viewModel.getLabTestDetails(args.labOrderId)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be called from LabTestScreen.

navigationAction = { findNavController().popBackStack() }
) {
LabTestScreen(
uiState = uiState,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should pass viewModel inside LabTestScreen instead of UiState.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

if (state.onError) {
showError()
viewModel.resetUiState()
observeWork(SYNC_COMMENTS) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should start observing worker from composable scree.
This will help to reduce usage of fragment and migration to compose easier.


handleNoInternetConnection(state)
getComments(state.parentEntryId)
private fun onSubmitComment(content: String) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be called from compose screen

}
}

private fun getTestResult(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be done in viewModel.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

}

@Composable
private fun LabTestResultItemUi(labTestDetail: LabTestDetail) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would suggest to have this in its own separate file with its own preview.
It should stay in the same package. if we find a use case of reuse we will take this to the component package

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

}

@Composable
private fun LabTestItemUi(title: Int?, body: String?) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would suggest to have this in its own separate file with its own preview.
It should stay in the same package. if we find a use case of reuse we will take this to the component package

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

}

body?.let {
MyHealthClickableText(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would recommend usage of HGTextButton

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not a button, it's a long Text that contains a clickable link, like Spannable on TextViews

@@ -7,5 +7,8 @@ import androidx.core.text.HtmlCompat
fun String?.orPlaceholder(placeholder: String = "--"): String =
this ?: placeholder

fun String?.orPlaceholderIfNullOrBlank(placeholder: String = "--"): String =
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is duplicate of the above method declared String?.orPlaceholder
and also has un-nacessary if condition check.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They are actually different: orPlaceholder will use placeholder only if the content is null, orPlaceholderIfNullOrBlank will also return the placeholder if the content is blank

@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 1 Code Smell

No Coverage information No Coverage information
0.0% 0.0% Duplication

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants