diff --git a/common/src/commonMain/kotlin/com/artemchep/keyguard/provider/bitwarden/usecase/CipherUrlCheck.kt b/common/src/commonMain/kotlin/com/artemchep/keyguard/provider/bitwarden/usecase/CipherUrlCheck.kt index 29e4d060..4a4c5132 100644 --- a/common/src/commonMain/kotlin/com/artemchep/keyguard/provider/bitwarden/usecase/CipherUrlCheck.kt +++ b/common/src/commonMain/kotlin/com/artemchep/keyguard/provider/bitwarden/usecase/CipherUrlCheck.kt @@ -23,6 +23,7 @@ class CipherUrlCheckImpl( ) : CipherUrlCheck { companion object { private const val PROTOCOL_ANDROID_APP = "androidapp://" + private const val PROTOCOL_IOS_APP = "iosapp://" } constructor(directDI: DirectDI) : this( @@ -37,9 +38,14 @@ class CipherUrlCheckImpl( ): IO { return when (uri.match ?: defaultMatchDetection) { DSecret.Uri.MatchType.Domain -> { - when { - uri.uri.startsWith(PROTOCOL_ANDROID_APP) -> ::checkUrlMatchByHost - else -> ::checkUrlMatchByDomain + val shouldUseHostMatchInstead = uri.uri.startsWith(PROTOCOL_ANDROID_APP) || + url.startsWith(PROTOCOL_ANDROID_APP) || + uri.uri.startsWith(PROTOCOL_IOS_APP) || + url.startsWith(PROTOCOL_IOS_APP) + if (shouldUseHostMatchInstead) { + ::checkUrlMatchByHost + } else { + ::checkUrlMatchByDomain } }