-
Notifications
You must be signed in to change notification settings - Fork 8
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
Provide callback instead of doing UI tasks of calling app #49 #50
base: main
Are you sure you want to change the base?
Provide callback instead of doing UI tasks of calling app #49 #50
Conversation
3d64c67
to
fe9ba2d
Compare
fe9ba2d
to
f3d1cc0
Compare
lib/src/main/java/at/bitfire/cert4android/UserDecisionRegistry.kt
Outdated
Show resolved
Hide resolved
lib/src/main/java/at/bitfire/cert4android/UserDecisionRegistry.kt
Outdated
Show resolved
Hide resolved
d88df8e
to
2776ce7
Compare
2776ce7
to
7ec1ded
Compare
I see that the activity was completely removed together with all its strings (+ translations). While that the UI action should be done in the calling application, it could still be helpful to have a helping template/building block in cert4android. It's also not really the task of a calling app to know too much about certificates etc. So I suggest to keep M3 Composables (most importantly the screen that shows the certificate contents) that could be used by the calling apps. If this would be a "big library", it should probably go into cert4android-ui-m3 or something like that, but in our case I think we can just keep it in cert4android. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works correctly
lib/src/main/java/at/bitfire/cert4android/TrustCertificateActivity.kt
Outdated
Show resolved
Hide resolved
@ArnyminerZ I have removed the theme and some of the dependencies |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fair enough. Eventually we should move all the UI things to their own module, as Ricki said. But again, this isn't that big of a library, so I don't even think it's worth it. I'd just merge like is.
Purpose
cert4android shouldn't show the
TrustCertificateActivity
and a notification by itself. Instead it should execute a callback which is provided by the calling application.Short description
appInForeground
) to cert4androidgetUserDecision
and the coroutine scope in which it should runNote
I would like to avoid the
delay(1000)
intestCheck_MultipleDecisionsForSameCert_Negative
, but I could not make it work using a countdown latch and using a mutex quickly became complicated too. I also thought of launching a 6th seperate coroutine which would watchregistry.pendingDecisions.size
with a while loop and release the semaphore as soon as 5 pending decisions are reached, but could not make that work either. In the end thedelay(1000)
is quite simple and seems to work well, but let me know if you find a cleaner way.