Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
@file:Suppress("unused")

package androidx.credentials.providerevents.playservices
package androidx.credentials.providerevents

import android.app.Activity
import android.content.Intent
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 {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@ data class ProviderImportCredentialsRequest(
val request: ImportCredentialsRequest,
val callingAppInfo: CallingAppInfo,
val uri: Uri,
val credId: String,
)
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down