Skip to content

Prevent logout while filling in a questionnaire (+ offline redirect fix)#3843

Open
allan-on wants to merge 3 commits into
mainfrom
fix/prevent-logout-mid-filling-in-questionnaire
Open

Prevent logout while filling in a questionnaire (+ offline redirect fix)#3843
allan-on wants to merge 3 commits into
mainfrom
fix/prevent-logout-mid-filling-in-questionnaire

Conversation

@allan-on

@allan-on allan-on commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Brings the "prevent redirecting to the login screen in the middle of filling in a Questionnaire" implementation to main, together with its follow-up bug fix.

Both changes currently live only on custom-engage; this PR cherry-picks them onto a branch off main:

  1. Prevent logout when filling questionnaire (cherry-picked from 75eb3468d, by @FikriMilano)
  2. If refresh token expired redirect to login if online (cherry-picked from 81240e7d5) — fixes Offline session-expired re-authentication loop after questionnaire submit #3842

@allan-on
allan-on force-pushed the fix/prevent-logout-mid-filling-in-questionnaire branch from 1df5e84 to 2a4449f Compare June 11, 2026 06:40
@allan-on
allan-on requested review from LZRS and ellykits June 11, 2026 06:48
@codecov

codecov Bot commented Jun 11, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 19.35484% with 25 lines in your changes missing coverage. Please review.
✅ Project coverage is 24.6%. Comparing base (aaebbb6) to head (ef37900).
⚠️ Report is 11 commits behind head on main.

Files with missing lines Patch % Lines
...register/fhircore/quest/ui/main/AppMainActivity.kt 0.0% 20 Missing ⚠️
...re/quest/ui/questionnaire/QuestionnaireActivity.kt 0.0% 4 Missing ⚠️
...re/engine/data/remote/shared/TokenAuthenticator.kt 85.7% 0 Missing and 1 partial ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff            @@
##              main   #3843     +/-   ##
=========================================
- Coverage     25.0%   24.6%   -0.4%     
- Complexity     844     853      +9     
=========================================
  Files          297     305      +8     
  Lines        16102   16538    +436     
  Branches      2689    2749     +60     
=========================================
+ Hits          4038    4082     +44     
- Misses       11580   11968    +388     
- Partials       484     488      +4     
Flag Coverage Δ
engine 60.8% <85.7%> (-0.2%) ⬇️
geowidget 21.6% <ø> (+3.0%) ⬆️
quest 4.6% <0.0%> (+<0.1%) ⬆️

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

Files with missing lines Coverage Δ
...re/engine/data/remote/shared/TokenAuthenticator.kt 78.7% <85.7%> (+4.3%) ⬆️
...re/quest/ui/questionnaire/QuestionnaireActivity.kt 0.6% <0.0%> (-0.1%) ⬇️
...register/fhircore/quest/ui/main/AppMainActivity.kt 3.6% <0.0%> (-0.5%) ⬇️

... and 6 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Covers the logout-prevention implementation cherry-picked from
75eb346:
- TokenAuthenticator: verify that suppressLoginRedirect skips session
  PIN deletion and LoginActivity launch when set, and performs them
  when unset.
- QuestionnaireActivity: verify suppressLoginRedirect is enabled while
  the questionnaire is open and reset on destroy.
@allan-on
allan-on force-pushed the fix/prevent-logout-mid-filling-in-questionnaire branch from 2a4449f to ef37900 Compare June 11, 2026 07:19
@allan-on
allan-on enabled auto-merge June 11, 2026 14:58

@ellykits ellykits left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks for the PR @allan-on, while this temporarily fixes the issue, the underlying reason why this happen is not actually addressed in this PR. What we are doing is suppressing the redirect to the login page, via a class property flag. What would happen when the class is garbage collected? Can we think about resolving this in a different way?

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.

Offline session-expired re-authentication loop after questionnaire submit

4 participants