User TImber instead of LogsManager directly (#4140)

This commit is contained in:
David Perez 2024-10-23 10:11:31 -05:00 committed by GitHub
parent a23fc319de
commit 79ebd2ba33
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 2 additions and 11 deletions

View file

@ -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.processor.AutofillProcessorImpl
import com.x8bit.bitwarden.data.autofill.provider.AutofillCipherProvider import com.x8bit.bitwarden.data.autofill.provider.AutofillCipherProvider
import com.x8bit.bitwarden.data.autofill.provider.AutofillCipherProviderImpl 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.PolicyManager
import com.x8bit.bitwarden.data.platform.manager.ciphermatching.CipherMatchingManager import com.x8bit.bitwarden.data.platform.manager.ciphermatching.CipherMatchingManager
import com.x8bit.bitwarden.data.platform.manager.clipboard.BitwardenClipboardManager import com.x8bit.bitwarden.data.platform.manager.clipboard.BitwardenClipboardManager
@ -121,7 +120,6 @@ object AutofillModule {
policyManager: PolicyManager, policyManager: PolicyManager,
saveInfoBuilder: SaveInfoBuilder, saveInfoBuilder: SaveInfoBuilder,
settingsRepository: SettingsRepository, settingsRepository: SettingsRepository,
logsManager: LogsManager,
): AutofillProcessor = ): AutofillProcessor =
AutofillProcessorImpl( AutofillProcessorImpl(
dispatcherManager = dispatcherManager, dispatcherManager = dispatcherManager,
@ -131,7 +129,6 @@ object AutofillModule {
policyManager = policyManager, policyManager = policyManager,
saveInfoBuilder = saveInfoBuilder, saveInfoBuilder = saveInfoBuilder,
settingsRepository = settingsRepository, settingsRepository = settingsRepository,
logsManager = logsManager,
) )
@Singleton @Singleton

View file

@ -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.parser.AutofillParser
import com.x8bit.bitwarden.data.autofill.util.createAutofillSavedItemIntentSender import com.x8bit.bitwarden.data.autofill.util.createAutofillSavedItemIntentSender
import com.x8bit.bitwarden.data.autofill.util.toAutofillSaveItem 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.PolicyManager
import com.x8bit.bitwarden.data.platform.manager.dispatcher.DispatcherManager import com.x8bit.bitwarden.data.platform.manager.dispatcher.DispatcherManager
import com.x8bit.bitwarden.data.platform.repository.SettingsRepository 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.CoroutineScope
import kotlinx.coroutines.Job import kotlinx.coroutines.Job
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
import timber.log.Timber
/** /**
* The default implementation of [AutofillProcessor]. Its purpose is to handle autofill related * The default implementation of [AutofillProcessor]. Its purpose is to handle autofill related
@ -35,7 +35,6 @@ class AutofillProcessorImpl(
private val parser: AutofillParser, private val parser: AutofillParser,
private val saveInfoBuilder: SaveInfoBuilder, private val saveInfoBuilder: SaveInfoBuilder,
private val settingsRepository: SettingsRepository, private val settingsRepository: SettingsRepository,
private val logsManager: LogsManager,
) : AutofillProcessor { ) : AutofillProcessor {
/** /**
@ -146,7 +145,7 @@ class AutofillProcessorImpl(
} catch (e: RuntimeException) { } catch (e: RuntimeException) {
// This is to catch any TransactionTooLargeExceptions that could occur here. // This is to catch any TransactionTooLargeExceptions that could occur here.
// These exceptions get wrapped as a RuntimeException. // These exceptions get wrapped as a RuntimeException.
logsManager.trackNonFatalException(e) Timber.e(e, "Autofill Error")
} }
} }

View file

@ -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.createAutofillSavedItemIntentSender
import com.x8bit.bitwarden.data.autofill.util.toAutofillSaveItem import com.x8bit.bitwarden.data.autofill.util.toAutofillSaveItem
import com.x8bit.bitwarden.data.platform.base.FakeDispatcherManager 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.manager.PolicyManager
import com.x8bit.bitwarden.data.platform.repository.SettingsRepository import com.x8bit.bitwarden.data.platform.repository.SettingsRepository
import com.x8bit.bitwarden.data.vault.datasource.network.model.PolicyTypeJson import com.x8bit.bitwarden.data.vault.datasource.network.model.PolicyTypeJson
@ -57,7 +56,6 @@ class AutofillProcessorTest {
private val policyManager: PolicyManager = mockk() private val policyManager: PolicyManager = mockk()
private val saveInfoBuilder: SaveInfoBuilder = mockk() private val saveInfoBuilder: SaveInfoBuilder = mockk()
private val settingsRepository: SettingsRepository = mockk() private val settingsRepository: SettingsRepository = mockk()
private val logsManager: LogsManager = mockk()
private val appInfo: AutofillAppInfo = AutofillAppInfo( private val appInfo: AutofillAppInfo = AutofillAppInfo(
context = mockk(), context = mockk(),
@ -79,7 +77,6 @@ class AutofillProcessorTest {
policyManager = policyManager, policyManager = policyManager,
saveInfoBuilder = saveInfoBuilder, saveInfoBuilder = saveInfoBuilder,
settingsRepository = settingsRepository, settingsRepository = settingsRepository,
logsManager = logsManager,
) )
} }
@ -246,7 +243,6 @@ class AutofillProcessorTest {
} returns fillResponse } returns fillResponse
val runtimeException = RuntimeException("TransactionToLarge") val runtimeException = RuntimeException("TransactionToLarge")
every { fillCallback.onSuccess(fillResponse) } throws runtimeException every { fillCallback.onSuccess(fillResponse) } throws runtimeException
every { logsManager.trackNonFatalException(runtimeException) } just runs
// Test // Test
autofillProcessor.processFillRequest( autofillProcessor.processFillRequest(
@ -271,7 +267,6 @@ class AutofillProcessorTest {
saveInfo = saveInfo, saveInfo = saveInfo,
) )
fillCallback.onSuccess(fillResponse) fillCallback.onSuccess(fillResponse)
logsManager.trackNonFatalException(runtimeException)
} }
} }