mirror of
https://github.com/bitwarden/android.git
synced 2025-12-10 09:56:45 -06:00
Update Credential Provider Events APIs (#5926)
This commit is contained in:
parent
df34db52e4
commit
e965134697
@ -1,6 +1,4 @@
|
||||
@file:Suppress("unused")
|
||||
|
||||
package androidx.credentials.providerevents.playservices
|
||||
package androidx.credentials.providerevents
|
||||
|
||||
import android.app.Activity
|
||||
import android.content.Intent
|
||||
@ -8,10 +6,12 @@ import android.net.Uri
|
||||
import androidx.credentials.providerevents.exception.ImportCredentialsException
|
||||
import androidx.credentials.providerevents.transfer.ImportCredentialsResponse
|
||||
import androidx.credentials.providerevents.transfer.ProviderImportCredentialsRequest
|
||||
import com.bitwarden.annotation.OmitFromCoverage
|
||||
|
||||
/**
|
||||
* A stub implementation of the Credential Provider Events IntentHandler class.
|
||||
*/
|
||||
@OmitFromCoverage
|
||||
object IntentHandler {
|
||||
|
||||
/**
|
||||
@ -12,4 +12,5 @@ data class ProviderImportCredentialsRequest(
|
||||
val request: ImportCredentialsRequest,
|
||||
val callingAppInfo: CallingAppInfo,
|
||||
val uri: Uri,
|
||||
val credId: String,
|
||||
)
|
||||
|
||||
@ -2,7 +2,7 @@ package com.bitwarden.cxf.manager
|
||||
|
||||
import android.app.Activity
|
||||
import android.content.Intent
|
||||
import androidx.credentials.providerevents.playservices.IntentHandler
|
||||
import androidx.credentials.providerevents.IntentHandler
|
||||
import androidx.credentials.providerevents.transfer.ImportCredentialsResponse
|
||||
import com.bitwarden.cxf.manager.model.ExportCredentialsResult
|
||||
|
||||
|
||||
@ -1,17 +1,17 @@
|
||||
package com.bitwarden.cxf.model
|
||||
|
||||
import android.net.Uri
|
||||
import androidx.credentials.provider.CallingAppInfo
|
||||
import android.os.Parcelable
|
||||
import kotlinx.parcelize.Parcelize
|
||||
|
||||
/**
|
||||
* A request to import the provider's credentials.
|
||||
*
|
||||
* @property uri the FileProvider uri that the importer will read the response from.
|
||||
* @property requestJson the request to import the provider's credentials.
|
||||
* @property callingAppInfo the caller's app info.
|
||||
*/
|
||||
data class BitwardenImportCredentialsRequest(
|
||||
@Parcelize
|
||||
data class ImportCredentialsRequestData(
|
||||
val uri: Uri,
|
||||
val requestJson: String,
|
||||
val callingAppInfo: CallingAppInfo,
|
||||
)
|
||||
) : Parcelable
|
||||
@ -3,19 +3,12 @@
|
||||
package com.bitwarden.cxf.util
|
||||
|
||||
import android.content.Intent
|
||||
import androidx.credentials.providerevents.playservices.IntentHandler
|
||||
import androidx.credentials.providerevents.IntentHandler
|
||||
import androidx.credentials.providerevents.transfer.ProviderImportCredentialsRequest
|
||||
import com.bitwarden.annotation.OmitFromCoverage
|
||||
import com.bitwarden.cxf.model.BitwardenImportCredentialsRequest
|
||||
|
||||
/**
|
||||
* Retrieves the [BitwardenImportCredentialsRequest] from the intent.
|
||||
* Retrieves the [ProviderImportCredentialsRequest] from the intent.
|
||||
*/
|
||||
fun Intent.getProviderImportCredentialsRequest(): BitwardenImportCredentialsRequest? = IntentHandler
|
||||
fun Intent.getProviderImportCredentialsRequest(): ProviderImportCredentialsRequest? = IntentHandler
|
||||
.retrieveProviderImportCredentialsRequest(this)
|
||||
?.let {
|
||||
BitwardenImportCredentialsRequest(
|
||||
uri = it.uri,
|
||||
requestJson = it.request.requestJson,
|
||||
callingAppInfo = it.callingAppInfo,
|
||||
)
|
||||
}
|
||||
|
||||
@ -2,8 +2,8 @@ package com.bitwarden.cxf.manager
|
||||
|
||||
import android.app.Activity
|
||||
import android.net.Uri
|
||||
import androidx.credentials.providerevents.IntentHandler
|
||||
import androidx.credentials.providerevents.exception.ImportCredentialsException
|
||||
import androidx.credentials.providerevents.playservices.IntentHandler
|
||||
import com.bitwarden.cxf.manager.model.ExportCredentialsResult
|
||||
import io.mockk.Ordering
|
||||
import io.mockk.every
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user