mirror of
https://github.com/Yubico/yubioath-flutter.git
synced 2024-11-22 16:32:01 +03:00
remove extension method from Map<>
This commit is contained in:
parent
000f0d83ac
commit
a9a5532067
@ -28,16 +28,21 @@ data class Options(
|
|||||||
val credentialMgmtPreview: Boolean,
|
val credentialMgmtPreview: Boolean,
|
||||||
val bioEnroll: Boolean?,
|
val bioEnroll: Boolean?,
|
||||||
val alwaysUv: Boolean
|
val alwaysUv: Boolean
|
||||||
)
|
) {
|
||||||
|
constructor(infoData: InfoData) : this(
|
||||||
|
infoData.getOptionsBoolean("clientPin") ?: false,
|
||||||
|
infoData.getOptionsBoolean("credMgmt") ?: false,
|
||||||
|
infoData.getOptionsBoolean("credentialMgmtPreview") ?: false,
|
||||||
|
infoData.getOptionsBoolean("bioEnroll"),
|
||||||
|
infoData.getOptionsBoolean("alwaysUv") ?: false,
|
||||||
|
)
|
||||||
|
|
||||||
fun Map<String, Any?>.getBoolean(
|
companion object {
|
||||||
key: String,
|
private fun InfoData.getOptionsBoolean(
|
||||||
default: Boolean = false
|
key: String
|
||||||
): Boolean = get(key) as? Boolean ?: default
|
): Boolean? = options[key] as? Boolean?
|
||||||
|
}
|
||||||
fun Map<String, Any?>.getOptionalBoolean(
|
}
|
||||||
key: String
|
|
||||||
): Boolean? = get(key) as? Boolean
|
|
||||||
|
|
||||||
@Serializable
|
@Serializable
|
||||||
data class SessionInfo(
|
data class SessionInfo(
|
||||||
@ -49,13 +54,7 @@ data class SessionInfo(
|
|||||||
val forcePinChange: Boolean
|
val forcePinChange: Boolean
|
||||||
) {
|
) {
|
||||||
constructor(infoData: InfoData) : this(
|
constructor(infoData: InfoData) : this(
|
||||||
Options(
|
Options(infoData),
|
||||||
infoData.options.getBoolean("clientPin"),
|
|
||||||
infoData.options.getBoolean("credMgmt"),
|
|
||||||
infoData.options.getBoolean("credentialMgmtPreview"),
|
|
||||||
infoData.options.getOptionalBoolean("bioEnroll"),
|
|
||||||
infoData.options.getBoolean("alwaysUv")
|
|
||||||
),
|
|
||||||
infoData.aaguid,
|
infoData.aaguid,
|
||||||
infoData.minPinLength,
|
infoData.minPinLength,
|
||||||
infoData.forcePinChange
|
infoData.forcePinChange
|
||||||
|
Loading…
Reference in New Issue
Block a user