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

Load icons / Image Enhancement #3242

Merged
merged 21 commits into from
May 17, 2024
Merged

Load icons / Image Enhancement #3242

merged 21 commits into from
May 17, 2024

Conversation

Lentumunai-Mark
Copy link
Contributor

IMPORTANT: Where possible all PRs must be linked to a Github issue

Fixes [link to issue]

Engineer Checklist

  • I have written Unit tests for any new feature(s) and edge cases for bug fixes
  • I have added any strings visible on UI components to the strings.xml file
  • I have updated the CHANGELOG.md file for any notable changes to the codebase
  • I have run ./gradlew spotlessApply and ./gradlew spotlessCheck to check my code follows the project's style guide
  • I have built and run the FHIRCore app to verify my change fixes the issue and/or does not break the app
  • I have checked that this PR does NOT introduce breaking changes that require an update to Content and/or Configs? If it does add a sample here or a link to exactly what changes need to be made to the content.

Code Reviewer Checklist

  • I have verified Unit tests have been written for any new feature(s) and edge cases
  • I have verified any strings visible on UI components are in the strings.xml file
  • I have verifed the CHANGELOG.md file has any notable changes to the codebase
  • I have verified the solution has been implemented in a configurable and generic way for reuseable components
  • I have built and run the FHIRCore app to verify the change fixes the issue and/or does not break the app

Copy link
Collaborator

@ellykits ellykits left a comment

Choose a reason for hiding this comment

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

Looks Good. I've left a few comments.

Comment on lines 185 to 186
alpha = 1.0f,
contentScale = ContentScale.Fit,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is there any reason for this change?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Using ContentScale.Fit here ensures the image maintains its original aspect ratio. This prevents distortion and guarantees the entire image is visible, even if there's some empty space around it. useful for where preserving the complete image and its proportions is crucial

Settingalpha = 1.0f here ensures the element maintains full opacity. This means it will be completely visible and not transparent at all

Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we make both configurable?

Copy link
Collaborator

Choose a reason for hiding this comment

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

For the alpha default to 1.0f

Copy link
Collaborator

Choose a reason for hiding this comment

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

Revert the colorFilter so it can be used to change the tint for images of type svg && png. Introduce a new property for type (we will support svg, png and jpg/jpeg) default to SVG mostly used in icons.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

noted @ellykits

Copy link

codecov bot commented May 8, 2024

Codecov Report

Attention: Patch coverage is 0% with 56 lines in your changes are missing coverage. Please review.

Project coverage is 29.3%. Comparing base (ac82739) to head (6f8e6ff).
Report is 55 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff            @@
##              main   #3242     +/-   ##
=========================================
- Coverage     29.6%   29.3%   -0.3%     
- Complexity     658     693     +35     
=========================================
  Files          239     252     +13     
  Lines        11204   11955    +751     
  Branches      1948    2093    +145     
=========================================
+ Hits          3323    3512    +189     
- Misses        7447    7982    +535     
- Partials       434     461     +27     
Flag Coverage Δ
engine 64.8% <ø> (-1.4%) ⬇️
geowidget 47.2% <ø> (ø)
quest 5.5% <0.0%> (+<0.1%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
...egister/fhircore/quest/ui/main/AppMainViewModel.kt 5.1% <0.0%> (+0.6%) ⬆️
...ster/fhircore/quest/ui/profile/ProfileViewModel.kt 8.2% <0.0%> (-0.4%) ⬇️
...ister/fhircore/quest/ui/shared/components/Image.kt 0.0% <0.0%> (ø)
...fhircore/quest/util/extensions/ConfigExtensions.kt 0.0% <0.0%> (ø)

... and 10 files with indirect coverage changes

Copy link
Collaborator

@ellykits ellykits left a comment

Choose a reason for hiding this comment

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

Just add a few tests. This Looks good.

Comment on lines 61 to 66
data class ImageConfiguration(
val id: String,
override val resourceType: String,
val contentType: String,
val data: String,
) : Configuration()
Copy link
Collaborator

Choose a reason for hiding this comment

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

I understand why this was needed. However with the fix on image generation via FHIR web it's unnecessary. The double decoding is not needed anymore, actually, this data class is a duplication of Binary resource so either way we do not need to create a new custom model.

Copy link
Contributor Author

@Lentumunai-Mark Lentumunai-Mark May 16, 2024

Choose a reason for hiding this comment

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

Noted @ellykits
will revert the implementation to only decode once, hence remove the config

@ellykits ellykits merged commit 3a2d8a6 into main May 17, 2024
4 of 5 checks passed
@ellykits ellykits deleted the load-icons-enhancement branch May 17, 2024 11:15
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.

3 participants