mirror of
https://github.com/bitwarden/android.git
synced 2025-02-16 20:09:59 +03:00
BIT-2040 Correct redirect behavior for Import Items action (#1150)
This commit is contained in:
parent
143a46165c
commit
3ba2f704e3
3 changed files with 10 additions and 8 deletions
|
@ -117,7 +117,7 @@ fun VaultSettingsScreen(
|
||||||
dialogMessage =
|
dialogMessage =
|
||||||
stringResource(
|
stringResource(
|
||||||
id = R.string.you_can_import_data_to_your_vault_on_x,
|
id = R.string.you_can_import_data_to_your_vault_on_x,
|
||||||
state.value.baseUrl,
|
state.value.importUrl,
|
||||||
),
|
),
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.semantics { testTag = "ImportItemsLinkItemView" }
|
.semantics { testTag = "ImportItemsLinkItemView" }
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package com.x8bit.bitwarden.ui.platform.feature.settings.vault
|
package com.x8bit.bitwarden.ui.platform.feature.settings.vault
|
||||||
|
|
||||||
import com.x8bit.bitwarden.data.platform.repository.EnvironmentRepository
|
import com.x8bit.bitwarden.data.platform.repository.EnvironmentRepository
|
||||||
import com.x8bit.bitwarden.data.platform.repository.util.baseWebVaultUrlOrDefault
|
|
||||||
import com.x8bit.bitwarden.data.platform.repository.util.toBaseWebVaultImportUrl
|
import com.x8bit.bitwarden.data.platform.repository.util.toBaseWebVaultImportUrl
|
||||||
import com.x8bit.bitwarden.ui.platform.base.BaseViewModel
|
import com.x8bit.bitwarden.ui.platform.base.BaseViewModel
|
||||||
import dagger.hilt.android.lifecycle.HiltViewModel
|
import dagger.hilt.android.lifecycle.HiltViewModel
|
||||||
|
@ -16,10 +15,6 @@ class VaultSettingsViewModel @Inject constructor(
|
||||||
) : BaseViewModel<VaultSettingsState, VaultSettingsEvent, VaultSettingsAction>(
|
) : BaseViewModel<VaultSettingsState, VaultSettingsEvent, VaultSettingsAction>(
|
||||||
initialState = run {
|
initialState = run {
|
||||||
VaultSettingsState(
|
VaultSettingsState(
|
||||||
baseUrl = environmentRepository
|
|
||||||
.environment
|
|
||||||
.environmentUrlData
|
|
||||||
.baseWebVaultUrlOrDefault,
|
|
||||||
importUrl = environmentRepository
|
importUrl = environmentRepository
|
||||||
.environment
|
.environment
|
||||||
.environmentUrlData
|
.environmentUrlData
|
||||||
|
@ -58,7 +53,6 @@ class VaultSettingsViewModel @Inject constructor(
|
||||||
* Models the state for the VaultSettingScreen.
|
* Models the state for the VaultSettingScreen.
|
||||||
*/
|
*/
|
||||||
data class VaultSettingsState(
|
data class VaultSettingsState(
|
||||||
val baseUrl: String,
|
|
||||||
val importUrl: String,
|
val importUrl: String,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,7 @@ class VaultSettingsScreenTest : BaseComposeTest() {
|
||||||
private val mutableEventFlow = bufferedMutableSharedFlow<VaultSettingsEvent>()
|
private val mutableEventFlow = bufferedMutableSharedFlow<VaultSettingsEvent>()
|
||||||
private val mutableStateFlow = MutableStateFlow(
|
private val mutableStateFlow = MutableStateFlow(
|
||||||
VaultSettingsState(
|
VaultSettingsState(
|
||||||
baseUrl = "testUrl", importUrl = "testUrl/#/tools/import",
|
importUrl = "testUrl/#/tools/import",
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
private val intentManager: IntentManager = mockk(relaxed = true) {
|
private val intentManager: IntentManager = mockk(relaxed = true) {
|
||||||
|
@ -97,6 +97,14 @@ class VaultSettingsScreenTest : BaseComposeTest() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun `import items click should display dialog with importUrl`() {
|
||||||
|
composeTestRule.onNodeWithText("Import items").performClick()
|
||||||
|
composeTestRule
|
||||||
|
.onNodeWithText(mutableStateFlow.value.importUrl, substring = true)
|
||||||
|
.assertIsDisplayed()
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `NavigateBack should call onNavigateBack`() {
|
fun `NavigateBack should call onNavigateBack`() {
|
||||||
mutableEventFlow.tryEmit(VaultSettingsEvent.NavigateBack)
|
mutableEventFlow.tryEmit(VaultSettingsEvent.NavigateBack)
|
||||||
|
|
Loading…
Add table
Reference in a new issue