icrc / openmrs-android-fhir

BSD 3-Clause "New" or "Revised" License
3 stars 9 forks source link

On Startup, connect to the server only if online #66

Open icrc-fdeniger opened 2 months ago

icrc-fdeniger commented 2 months ago

Currently, the application attempts to log into the backend at startup. It should only connect to the server on the first launch to download the initial configuration.

For subsequent attempts, the app should check if the user is online by verifying access to the check_server_url.

Data Synchronization after being offline: If the user selects "Synchronize" after being offline, the app will first attempt to log them into OpenMRS. For OpenID Connect, a refresh token should be generated. For basic authentication, the user may need to enter their credentials again, depending on the session timeout configuration. See #64

The process should be tested with the OpenID Connect workflow to ensure proper session timeout handling.

AdityaKBhadragond14 commented 1 day ago

Hi @icrc-fdeniger I have added the prompt to state that the current login has expired with three choices as stated above: "Yes," "No," and "No, and don’t ask me again". This prompt is immediately displayed when the current access token gets expired.

Also I have added the network status listener where when the device comes online from offline then it will trigger the one time sync.

I have also added the network status (offline/online) in the App Top Bar.

Screenshot_20241128_162523

I had a few questions as follows:

  1. What should be the behavior of each choice in the dialog?
  2. The sync should be stopped or it should continue when the dialog is displayed?

Also other than sync trigger on network status change is there anything else required for Data synchronization?

icrc-fdeniger commented 1 day ago
  1. What should be the behavior of each choice in the dialog?
  1. The sync should be stopped or it should continue when the dialog is displayed?

if the login is expired, the sync is stopped in any case as no synchro can be done in any case no ?

This dialog should appearch only if online and if OpenMRS server is accessible. It's possible that the user has access to internet but not to OpenMRS Server

AdityaKBhadragond14 commented 11 hours ago

So, in case of only "No" choice although the sync will not happen the periodic sync worker has to be kept running or should be stopped? Because the login has expired.

icrc-fdeniger commented 11 hours ago

I would keep the sync up and running