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

Show the LoaderDialog when syncing the Location data #3598

Merged
merged 3 commits into from
Nov 18, 2024

Conversation

qaziabubakar-vd
Copy link
Contributor

@qaziabubakar-vd qaziabubakar-vd commented Nov 8, 2024

Show the LoaderDialog when syncing the Location data
Update the LoaderDialog:
- Make box and progressBar size dynamic
- Make the progressDialog message as optional
- Add the ability to show either the ProgressBar or LineSpinFadeLoaderProgressIndicator

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

Fixes [https://github.com//issues/3544]

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

Update the LoaderDialog:
    - Make box and progressBar size dynamic
    - Make the progressDialog message as optional
    - Add the ability to show either the ProgressBar or LineSpinFadeLoaderProgressIndicator
@qaziabubakar-vd qaziabubakar-vd marked this pull request as ready for review November 11, 2024 15:28
Text(
text = it,
color = Color.White,
fontSize = 14.sp,
Copy link
Member

Choose a reason for hiding this comment

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

@ellykits @qaziabubakar-vd Does this font size align with the default font size in other areas of the app?


if (showPercentageProgress) {
Text(
fontSize = 15.sp,
Copy link
Member

Choose a reason for hiding this comment

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

@ellykits @qaziabubakar-vd Does this font size align with the default font size in other areas of the app?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I haven't changed any font sizes, we were showing this same font size before in the LoaderDialog class, I just refactored it a little for my implementation.
I can confirm with @ellykits if the size is aligned with the rest of the app.

@ellykits
Copy link
Collaborator

Share screenshot/video with demo for review @qaziabubakar-vd

@qaziabubakar-vd
Copy link
Contributor Author

Here is the video recording of the implementation for showing the LoaderDialog:
https://github.com/user-attachments/assets/874b6271-9d1f-4315-ac5a-30967d557375

@qaziabubakar-vd
Copy link
Contributor Author

For showing the LoaderDialog for the CustomSyncWorker, that is still a WIP.

Summary of Attempted Solutions so far

  • Used observeForever with getWorkInfosForUniqueWorkLiveData
  • Tried observing worker status using observeForever on getWorkInfosForUniqueWorkLiveData.
  • The worker status updates were not received in real-time. Instead, all logs related to the worker were delayed and displayed only after the worker finished execution.
  • Created a combined extension method schedulePeriodicallyWithObserver to both schedule and observe workers.
  • Despite ensuring LiveData observation and worker execution were on separate threads, status updates were not reliably delivered in real-time.

Next Steps, Current flow that I am trying:

  • Replace LiveData-based observation with a Flow-based solution that can emit worker status updates incrementally. This might offer more reliable real-time updates with WorkManager.

  • Will focus on tracking the progress of the fetchResources function within the worker by adding progress updates during its execution. Specifically, we plan to:

  • Emit Progress from fetchResources: Introduce a mechanism, such as calling setProgress(workDataOf("progress" to value)), at key points in the fetchResources function:

  • After each successful call to fhirResourceDataSource.getResource() or getResourceWithGatewayModeHeader().

  • **Observe Progress Updates:**Use WorkManager.getWorkInfoByIdLiveData() to observe these progress updates in real-time. This will allow us to get incremental updates about the resources being fetched and processed.

This approach might give us more control into what the worker is doing at runtime and help identify bottlenecks or delays in the fetchResources execution.
cc: @ellykits

@ellykits ellykits merged commit 772ef2a into improve-sync-progress-ux Nov 18, 2024
@ellykits ellykits deleted the loader-dialog-for-location-sync branch November 18, 2024 09:29
ellykits added a commit that referenced this pull request Dec 11, 2024
* Implement LineSpinFadeLoaderProgressIndicator

Signed-off-by: Elly Kitoto <[email protected]>

* Run spotless

Signed-off-by: Elly Kitoto <[email protected]>

* Fix spacing

Signed-off-by: Elly Kitoto <[email protected]>

* Show the loader dialog when syncing the location data (#3598)

* Show the LoaderDialog when syncing the Location data
Update the LoaderDialog:
    - Make box and progressBar size dynamic
    - Make the progressDialog message as optional
    - Add the ability to show either the ProgressBar or LineSpinFadeLoaderProgressIndicator

* Add an option in the LoaderDialog to show a dialog with non blocking UI
Show a non blocking dialog when applying location filtering

* clean-up: rename variables

* fix tests

* 🚧 Increase the loading dialog size on the geowidget screen

* Fix showing map snackbar messages

Signed-off-by: Elly Kitoto <[email protected]>

* Formate code

Signed-off-by: Elly Kitoto <[email protected]>

---------

Signed-off-by: Elly Kitoto <[email protected]>
Co-authored-by: qaziabubakar-vd <[email protected]>
Co-authored-by: Benjamin Mwalimu <[email protected]>
Co-authored-by: qaziabubakar-vd <[email protected]>
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