mirror of
https://github.com/bitwarden/android.git
synced 2025-12-10 00:06:22 -06:00
Update Autofill logging (#5697)
This commit is contained in:
parent
6d25c12271
commit
f4102bcd30
@ -13,6 +13,7 @@ import com.x8bit.bitwarden.data.vault.repository.model.VaultUnlockData
|
||||
import com.x8bit.bitwarden.data.vault.repository.util.statusFor
|
||||
import dagger.hilt.android.lifecycle.HiltViewModel
|
||||
import kotlinx.coroutines.flow.first
|
||||
import timber.log.Timber
|
||||
import javax.inject.Inject
|
||||
|
||||
/**
|
||||
@ -40,7 +41,10 @@ class AutofillTotpCopyViewModel @Inject constructor(
|
||||
private fun handleIntentReceived(action: AutofillTotpCopyAction.IntentReceived) {
|
||||
viewModelScope
|
||||
.launchWithTimeout(
|
||||
timeoutBlock = { finishActivity() },
|
||||
timeoutBlock = {
|
||||
Timber.w("Autofill -- Timeout")
|
||||
finishActivity()
|
||||
},
|
||||
timeoutDuration = CIPHER_WAIT_TIMEOUT_MILLIS,
|
||||
) {
|
||||
// Extract TOTP copy data from the intent.
|
||||
@ -49,16 +53,31 @@ class AutofillTotpCopyViewModel @Inject constructor(
|
||||
.getTotpCopyIntentOrNull()
|
||||
?.cipherId
|
||||
|
||||
if (cipherId == null || isVaultLocked()) {
|
||||
if (cipherId == null) {
|
||||
Timber.w("Autofill -- Cipher was not provided")
|
||||
finishActivity()
|
||||
return@launchWithTimeout
|
||||
}
|
||||
if (isVaultLocked()) {
|
||||
Timber.w("Autofill -- Vault is locked")
|
||||
finishActivity()
|
||||
return@launchWithTimeout
|
||||
}
|
||||
|
||||
// Try and find the matching cipher.
|
||||
when (val result = vaultRepository.getCipher(cipherId = cipherId)) {
|
||||
GetCipherResult.CipherNotFound -> finishActivity()
|
||||
is GetCipherResult.Failure -> finishActivity()
|
||||
GetCipherResult.CipherNotFound -> {
|
||||
Timber.w("Autofill -- Cipher not found")
|
||||
finishActivity()
|
||||
}
|
||||
|
||||
is GetCipherResult.Failure -> {
|
||||
Timber.w(result.error, "Autofill -- Get cipher failure")
|
||||
finishActivity()
|
||||
}
|
||||
|
||||
is GetCipherResult.Success -> {
|
||||
Timber.d("Autofill -- Cipher found")
|
||||
sendEvent(AutofillTotpCopyEvent.CompleteAutofill(result.cipherView))
|
||||
}
|
||||
}
|
||||
|
||||
@ -23,7 +23,7 @@ class FillResponseBuilderImpl : FillResponseBuilder {
|
||||
saveInfo: SaveInfo?,
|
||||
): FillResponse? =
|
||||
if (filledData.fillableAutofillIds.isNotEmpty()) {
|
||||
Timber.w("Autofill request constructing FillResponse")
|
||||
Timber.d("Autofill request constructing FillResponse")
|
||||
val fillResponseBuilder = FillResponse.Builder()
|
||||
saveInfo?.let { nonNullSaveInfo -> fillResponseBuilder.setSaveInfo(nonNullSaveInfo) }
|
||||
|
||||
|
||||
@ -17,6 +17,7 @@ import com.x8bit.bitwarden.data.platform.manager.event.OrganizationEventManager
|
||||
import com.x8bit.bitwarden.data.platform.manager.model.OrganizationEvent
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.launch
|
||||
import timber.log.Timber
|
||||
|
||||
/**
|
||||
* Primary implementation of [AutofillCompletionManager].
|
||||
@ -41,6 +42,7 @@ class AutofillCompletionManagerImpl(
|
||||
.intent
|
||||
?.getAutofillAssistStructureOrNull()
|
||||
?: run {
|
||||
Timber.w("Assist structure not found")
|
||||
activity.cancelAndFinish()
|
||||
return
|
||||
}
|
||||
@ -51,6 +53,7 @@ class AutofillCompletionManagerImpl(
|
||||
assistStructure = assistStructure,
|
||||
)
|
||||
if (autofillRequest !is AutofillRequest.Fillable) {
|
||||
Timber.w("Request is not fillable")
|
||||
activity.cancelAndFinish()
|
||||
return
|
||||
}
|
||||
@ -68,11 +71,13 @@ class AutofillCompletionManagerImpl(
|
||||
authIntentSender = null,
|
||||
)
|
||||
?: run {
|
||||
Timber.w("Dataset not found")
|
||||
activity.cancelAndFinish()
|
||||
return@launch
|
||||
}
|
||||
totpManager.tryCopyTotpToClipboard(cipherView = cipherView)
|
||||
val resultIntent = createAutofillSelectionResultIntent(dataset)
|
||||
Timber.d("Autofill success")
|
||||
activity.setResultAndFinish(resultIntent = resultIntent)
|
||||
cipherView.id?.let {
|
||||
organizationEventManager.trackEvent(
|
||||
|
||||
@ -135,7 +135,7 @@ class AutofillParserImpl(
|
||||
|
||||
// Get inline information if available
|
||||
val isInlineAutofillEnabled = settingsRepository.isInlineAutofillEnabled
|
||||
Timber.e("Autofill request isInlineEnabled=$isInlineAutofillEnabled -- ${fillRequest?.id}")
|
||||
Timber.d("Autofill request isInlineEnabled=$isInlineAutofillEnabled -- ${fillRequest?.id}")
|
||||
val maxInlineSuggestionsCount = fillRequest.getMaxInlineSuggestionsCount(
|
||||
autofillAppInfo = autofillAppInfo,
|
||||
isInlineAutofillEnabled = isInlineAutofillEnabled,
|
||||
|
||||
@ -190,7 +190,7 @@ internal class FlightRecorderManagerImpl(
|
||||
}
|
||||
}
|
||||
|
||||
private inner class FlightRecorderTree : Timber.Tree() {
|
||||
private inner class FlightRecorderTree : Timber.DebugTree() {
|
||||
var flightRecorderData: FlightRecorderDataSet.FlightRecorderData? = null
|
||||
set(value) {
|
||||
value?.let {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user