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

[cert4android] Tracking of foreground is not reliable #1313

Open
4 tasks
rfc2822 opened this issue Feb 13, 2025 · 1 comment
Open
4 tasks

[cert4android] Tracking of foreground is not reliable #1313

rfc2822 opened this issue Feb 13, 2025 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@rfc2822
Copy link
Member

rfc2822 commented Feb 13, 2025

Currently, the cert4android TrustCertificateActivity doesn't always appear automatically, but only when the HttpClient is set to "in foreground".

This amplifies the problem mentioned here: #1294 (comment)

It should be possible to keep track of being in foreground using LifecycleResumeEffect in the Theme.

  • Keep track of foreground/resume with lifecycle observer in Theme
  • When creating a HttpClient, provide a callback that evaluates the foreground information from the lifecycle observer and start the TrustCertificateActivity whenever DAVx5 is in foreground. The notification should always be shown, using the standard DAVx⁵ way of creating notifications.
  • inForeground of HttpClient can be dropped
  • Use cert4android with Provide callback instead of doing UI tasks of calling app cert4android#49

We still have to find a good place to put the methods in. Maybe some cert4android integration class, which is then referenced both from the theme and the callback that is provided by HttpClient to cert4nadroid?

Another advantage would be that the UI of cert4android would become more modular, so that a later point we maybe don't need the TrustCertificateActivity anymore, but could just provide a Composable thats then used by the calling app in its navigation hierarchy whenever needed.

@rfc2822
Copy link
Member Author

rfc2822 commented Mar 1, 2025

We could also split this into two issues/PRs:

  1. Keep appInForeground as it is, but not set when HttpClient is created, but by a flag that is dynamically changed by lifecycle observers in the theme. Then we would already get the desired behavior.
  2. Another PR: the thing with the cert4android change (that it doesn't do the UI) for better architecture.

Have created two sub-issues

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Todo
Development

No branches or pull requests

2 participants