mirror of
https://github.com/bitwarden/android.git
synced 2026-05-10 15:16:52 -05:00
PM-21156: Fix ConfigService retrofit instance (#5126)
This commit is contained in:
@@ -18,7 +18,6 @@ import com.x8bit.bitwarden.ui.platform.feature.settings.autofill.chrome.model.Ch
|
||||
import com.x8bit.bitwarden.ui.platform.util.persistentListOfNotNull
|
||||
import dagger.hilt.android.lifecycle.HiltViewModel
|
||||
import kotlinx.collections.immutable.ImmutableList
|
||||
import kotlinx.collections.immutable.persistentListOf
|
||||
import kotlinx.coroutines.flow.launchIn
|
||||
import kotlinx.coroutines.flow.map
|
||||
import kotlinx.coroutines.flow.onEach
|
||||
@@ -58,7 +57,9 @@ class AutoFillViewModel @Inject constructor(
|
||||
defaultUriMatchType = settingsRepository.defaultUriMatchType,
|
||||
showAutofillActionCard = false,
|
||||
activeUserId = userId,
|
||||
chromeAutofillSettingsOptions = persistentListOf(),
|
||||
chromeAutofillSettingsOptions = chromeThirdPartyAutofillEnabledManager
|
||||
.chromeThirdPartyAutofillStatus
|
||||
.toChromeAutoFillSettingsOptions(),
|
||||
)
|
||||
},
|
||||
) {
|
||||
|
||||
@@ -50,6 +50,7 @@ class AutoFillViewModelTest : BaseViewModelTest() {
|
||||
private val chromeThirdPartyAutofillEnabledManager =
|
||||
mockk<ChromeThirdPartyAutofillEnabledManager> {
|
||||
every { chromeThirdPartyAutofillStatusFlow } returns mutableChromeAutofillStatusFlow
|
||||
every { chromeThirdPartyAutofillStatus } returns DEFAULT_AUTOFILL_STATUS
|
||||
}
|
||||
|
||||
private val settingsRepository: SettingsRepository = mockk {
|
||||
@@ -79,7 +80,6 @@ class AutoFillViewModelTest : BaseViewModelTest() {
|
||||
|
||||
@Test
|
||||
fun `initial state should be correct when not set`() {
|
||||
mockkStatic(::isBuildVersionBelow)
|
||||
every { isBuildVersionBelow(Build.VERSION_CODES.UPSIDE_DOWN_CAKE) } returns false
|
||||
|
||||
val viewModel = createViewModel(state = null)
|
||||
@@ -90,7 +90,6 @@ class AutoFillViewModelTest : BaseViewModelTest() {
|
||||
|
||||
@Test
|
||||
fun `initial state should be correct when set`() {
|
||||
mockkStatic(::isBuildVersionBelow)
|
||||
every { isBuildVersionBelow(Build.VERSION_CODES.UPSIDE_DOWN_CAKE) } returns false
|
||||
|
||||
mutableIsAutofillEnabledStateFlow.value = true
|
||||
@@ -106,7 +105,6 @@ class AutoFillViewModelTest : BaseViewModelTest() {
|
||||
|
||||
@Test
|
||||
fun `initial state should be correct when sdk is below min`() {
|
||||
mockkStatic(::isBuildVersionBelow)
|
||||
every { isBuildVersionBelow(Build.VERSION_CODES.UPSIDE_DOWN_CAKE) } returns true
|
||||
|
||||
val expected = DEFAULT_STATE.copy(
|
||||
|
||||
@@ -118,7 +118,7 @@ internal class BitwardenServiceClientImpl(
|
||||
|
||||
override val configService: ConfigService by lazy {
|
||||
ConfigServiceImpl(
|
||||
configApi = retrofits.createStaticRetrofit().create(),
|
||||
configApi = retrofits.unauthenticatedApiRetrofit.create(),
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -7,7 +7,6 @@ import com.bitwarden.network.util.toResult
|
||||
/**
|
||||
* Default implementation of [ConfigService] for querying app configurations.
|
||||
*/
|
||||
// TODO [PM-19846] Make internal when dependents are migrated.
|
||||
internal class ConfigServiceImpl(private val configApi: ConfigApi) : ConfigService {
|
||||
override suspend fun getConfig(): Result<ConfigResponseJson> = configApi.getConfig().toResult()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user