-
Notifications
You must be signed in to change notification settings - Fork 9
Provide callback instead of doing UI tasks of calling app #49 #50
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
Closed
sunkup
wants to merge
36
commits into
main
from
49-provide-callback-instead-of-doing-ui-tasks-of-calling-app
Closed
Changes from 20 commits
Commits
Show all changes
36 commits
Select commit
Hold shift + click to select a range
f3d1cc0
Provide callback instead of doing UI tasks of calling app
sunkup 6bd6422
Use the right scope
sunkup b465b60
Use a deferred to await user decision instead of flow
sunkup 11f6cf7
Pass scope only where needed
sunkup ce1d76e
Minor rearrangements
sunkup c91fbb4
Fix tests
sunkup 0924124
Mark userDecision property as volatile
sunkup e32a205
Remove TrustCertificateActivity from manifest
sunkup 96a102e
Remove unused strings
sunkup 7ec1ded
Fix tests for CI
sunkup 67c6a1b
Remove remaining notification related code
sunkup 031f718
Update README.md
sunkup 89d5990
Remove remaining unused string resources
sunkup 8fb0ea2
Merge branch 'main' into 49-provide-callback-instead-of-doing-ui-task…
rfc2822 aa7fea6
Revert "Remove unused strings"
sunkup 9d9bfdb
Revert "Remove remaining unused string resources"
sunkup a85285d
Extract and use composable from TrustCertificateActivity
sunkup 42efa84
Merge branch 'main' into 49-provide-callback-instead-of-doing-ui-task…
sunkup 7c65abb
Remove theme
sunkup cf358a1
Remove livedata, viewmodel and activity related dependencies
sunkup 246a542
Minor UI changes
rfc2822 751d675
Move state of pending decision into Flow
rfc2822 863629d
Improve kdoc
sunkup 8c6e7b7
Move companion object to the end of class
sunkup 6d4263c
Make PendingDecision a data class
sunkup 02427de
Update comment
sunkup 106c60a
Revert "Make PendingDecision a data class"
sunkup 47b9aca
Minor changes in structure, comments
rfc2822 e42a98a
Add param to kdoc
sunkup f4ace05
Replace iterator with forEach
sunkup c5bfc05
Revert "Replace iterator with forEach"
sunkup 6b60ca4
More comments for iteration
rfc2822 12f1b45
Use Collections.synchronizedMap to synchronize access
rfc2822 0c0bbd5
Add test to check whether pendingDecisions are empty after cancellation
sunkup 49bd354
Remove decisions list from pendingDecisions map if list is empty
sunkup 3de7b87
Main activity: edge-to-edge
rfc2822 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
lib/src/main/java/at/bitfire/cert4android/CertificateDetails.kt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
package at.bitfire.cert4android | ||
|
||
import java.security.cert.X509Certificate | ||
import java.security.spec.MGF1ParameterSpec.SHA1 | ||
import java.security.spec.MGF1ParameterSpec.SHA256 | ||
import java.text.DateFormat | ||
|
||
/** | ||
* Certificate details. | ||
* Create with [CertificateDetails.create] and use with [TrustCertificateDialog] | ||
*/ | ||
data class CertificateDetails( | ||
val issuedFor: String? = null, | ||
val issuedBy: String? = null, | ||
val validFrom: String? = null, | ||
val validTo: String? = null, | ||
val sha1: String? = null, | ||
val sha256: String? = null, | ||
) { | ||
companion object { | ||
|
||
/** | ||
* Creates [CertificateDetails] from [X509Certificate]. | ||
* | ||
* @param cert X509Certificate | ||
* @return CertificateDetails | ||
*/ | ||
fun create(cert: X509Certificate): CertificateDetails? { | ||
val subject = cert.subjectAlternativeNames?.let { altNames -> | ||
val sb = StringBuilder() | ||
for (altName in altNames) { | ||
val name = altName[1] | ||
if (name is String) | ||
sb.append("[").append(altName[0]).append("]").append(name).append(" ") | ||
} | ||
sb.toString() | ||
} ?: /* use CN if alternative names are not available */ cert.subjectDN.name | ||
|
||
val timeFormatter = DateFormat.getDateInstance(DateFormat.LONG) | ||
return CertificateDetails( | ||
issuedFor = subject, | ||
issuedBy = cert.issuerDN.toString(), | ||
validFrom = timeFormatter.format(cert.notBefore), | ||
validTo = timeFormatter.format(cert.notAfter), | ||
sha1 = "SHA1: " + CertUtils.fingerprint(cert, SHA1.digestAlgorithm), | ||
sha256 = "SHA256: " + CertUtils.fingerprint(cert, SHA256.digestAlgorithm) | ||
) | ||
} | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.