From 79ebd2ba3314381102f947385b5db77c7fd28777 Mon Sep 17 00:00:00 2001 From: David Perez Date: Wed, 23 Oct 2024 10:11:31 -0500 Subject: [PATCH] User TImber instead of LogsManager directly (#4140) --- .../com/x8bit/bitwarden/data/autofill/di/AutofillModule.kt | 3 --- .../data/autofill/processor/AutofillProcessorImpl.kt | 5 ++--- .../data/autofill/processor/AutofillProcessorTest.kt | 5 ----- 3 files changed, 2 insertions(+), 11 deletions(-) diff --git a/app/src/main/java/com/x8bit/bitwarden/data/autofill/di/AutofillModule.kt b/app/src/main/java/com/x8bit/bitwarden/data/autofill/di/AutofillModule.kt index fdb632791..e9f59922d 100644 --- a/app/src/main/java/com/x8bit/bitwarden/data/autofill/di/AutofillModule.kt +++ b/app/src/main/java/com/x8bit/bitwarden/data/autofill/di/AutofillModule.kt @@ -21,7 +21,6 @@ import com.x8bit.bitwarden.data.autofill.processor.AutofillProcessor import com.x8bit.bitwarden.data.autofill.processor.AutofillProcessorImpl import com.x8bit.bitwarden.data.autofill.provider.AutofillCipherProvider import com.x8bit.bitwarden.data.autofill.provider.AutofillCipherProviderImpl -import com.x8bit.bitwarden.data.platform.manager.LogsManager import com.x8bit.bitwarden.data.platform.manager.PolicyManager import com.x8bit.bitwarden.data.platform.manager.ciphermatching.CipherMatchingManager import com.x8bit.bitwarden.data.platform.manager.clipboard.BitwardenClipboardManager @@ -121,7 +120,6 @@ object AutofillModule { policyManager: PolicyManager, saveInfoBuilder: SaveInfoBuilder, settingsRepository: SettingsRepository, - logsManager: LogsManager, ): AutofillProcessor = AutofillProcessorImpl( dispatcherManager = dispatcherManager, @@ -131,7 +129,6 @@ object AutofillModule { policyManager = policyManager, saveInfoBuilder = saveInfoBuilder, settingsRepository = settingsRepository, - logsManager = logsManager, ) @Singleton diff --git a/app/src/main/java/com/x8bit/bitwarden/data/autofill/processor/AutofillProcessorImpl.kt b/app/src/main/java/com/x8bit/bitwarden/data/autofill/processor/AutofillProcessorImpl.kt index 611e18000..79cdf437e 100644 --- a/app/src/main/java/com/x8bit/bitwarden/data/autofill/processor/AutofillProcessorImpl.kt +++ b/app/src/main/java/com/x8bit/bitwarden/data/autofill/processor/AutofillProcessorImpl.kt @@ -13,7 +13,6 @@ import com.x8bit.bitwarden.data.autofill.model.AutofillRequest import com.x8bit.bitwarden.data.autofill.parser.AutofillParser import com.x8bit.bitwarden.data.autofill.util.createAutofillSavedItemIntentSender import com.x8bit.bitwarden.data.autofill.util.toAutofillSaveItem -import com.x8bit.bitwarden.data.platform.manager.LogsManager import com.x8bit.bitwarden.data.platform.manager.PolicyManager import com.x8bit.bitwarden.data.platform.manager.dispatcher.DispatcherManager import com.x8bit.bitwarden.data.platform.repository.SettingsRepository @@ -21,6 +20,7 @@ import com.x8bit.bitwarden.data.vault.datasource.network.model.PolicyTypeJson import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.Job import kotlinx.coroutines.launch +import timber.log.Timber /** * The default implementation of [AutofillProcessor]. Its purpose is to handle autofill related @@ -35,7 +35,6 @@ class AutofillProcessorImpl( private val parser: AutofillParser, private val saveInfoBuilder: SaveInfoBuilder, private val settingsRepository: SettingsRepository, - private val logsManager: LogsManager, ) : AutofillProcessor { /** @@ -146,7 +145,7 @@ class AutofillProcessorImpl( } catch (e: RuntimeException) { // This is to catch any TransactionTooLargeExceptions that could occur here. // These exceptions get wrapped as a RuntimeException. - logsManager.trackNonFatalException(e) + Timber.e(e, "Autofill Error") } } diff --git a/app/src/test/java/com/x8bit/bitwarden/data/autofill/processor/AutofillProcessorTest.kt b/app/src/test/java/com/x8bit/bitwarden/data/autofill/processor/AutofillProcessorTest.kt index ec85b9be9..d132a2fda 100644 --- a/app/src/test/java/com/x8bit/bitwarden/data/autofill/processor/AutofillProcessorTest.kt +++ b/app/src/test/java/com/x8bit/bitwarden/data/autofill/processor/AutofillProcessorTest.kt @@ -22,7 +22,6 @@ import com.x8bit.bitwarden.data.autofill.parser.AutofillParser import com.x8bit.bitwarden.data.autofill.util.createAutofillSavedItemIntentSender import com.x8bit.bitwarden.data.autofill.util.toAutofillSaveItem import com.x8bit.bitwarden.data.platform.base.FakeDispatcherManager -import com.x8bit.bitwarden.data.platform.manager.LogsManager import com.x8bit.bitwarden.data.platform.manager.PolicyManager import com.x8bit.bitwarden.data.platform.repository.SettingsRepository import com.x8bit.bitwarden.data.vault.datasource.network.model.PolicyTypeJson @@ -57,7 +56,6 @@ class AutofillProcessorTest { private val policyManager: PolicyManager = mockk() private val saveInfoBuilder: SaveInfoBuilder = mockk() private val settingsRepository: SettingsRepository = mockk() - private val logsManager: LogsManager = mockk() private val appInfo: AutofillAppInfo = AutofillAppInfo( context = mockk(), @@ -79,7 +77,6 @@ class AutofillProcessorTest { policyManager = policyManager, saveInfoBuilder = saveInfoBuilder, settingsRepository = settingsRepository, - logsManager = logsManager, ) } @@ -246,7 +243,6 @@ class AutofillProcessorTest { } returns fillResponse val runtimeException = RuntimeException("TransactionToLarge") every { fillCallback.onSuccess(fillResponse) } throws runtimeException - every { logsManager.trackNonFatalException(runtimeException) } just runs // Test autofillProcessor.processFillRequest( @@ -271,7 +267,6 @@ class AutofillProcessorTest { saveInfo = saveInfo, ) fillCallback.onSuccess(fillResponse) - logsManager.trackNonFatalException(runtimeException) } }