mirror of
https://github.com/bitwarden/android.git
synced 2026-03-12 13:14:35 -05:00
[PM-8331] Using default send url when on US cloud (#4925)
This commit is contained in:
@@ -59,7 +59,15 @@ val EnvironmentUrlDataJson.baseWebSendUrl: String
|
||||
get() =
|
||||
this
|
||||
.baseWebVaultUrlOrNull
|
||||
?.let { "$it/#/send/" }
|
||||
?.let {
|
||||
// Only on US Cloud we should use the default web send URL
|
||||
// On all other server instances we should use the base web send URL
|
||||
if (it == DEFAULT_WEB_VAULT_URL) {
|
||||
DEFAULT_WEB_SEND_URL
|
||||
} else {
|
||||
"$it/#/send/"
|
||||
}
|
||||
}
|
||||
?: DEFAULT_WEB_SEND_URL
|
||||
|
||||
/**
|
||||
|
||||
@@ -164,6 +164,17 @@ class EnvironmentUrlsDataJsonExtensionsTest {
|
||||
assertEquals("https://send.bitwarden.com/#", result)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `baseWebSendUrl should return the default when webvault matches default webvault`() {
|
||||
val result = DEFAULT_CUSTOM_ENVIRONMENT_URL_DATA
|
||||
.copy(
|
||||
webVault = "https://vault.bitwarden.com",
|
||||
base = "",
|
||||
)
|
||||
.baseWebSendUrl
|
||||
assertEquals("https://send.bitwarden.com/#", result)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `labelOrBaseUrlHost should correctly convert US environment to the correct label`() {
|
||||
val environment = EnvironmentUrlDataJson.DEFAULT_US
|
||||
|
||||
@@ -1637,7 +1637,7 @@ private val DEFAULT_STATE: SearchState = SearchState(
|
||||
viewState = SearchState.ViewState.Loading,
|
||||
dialogState = null,
|
||||
vaultFilterData = null,
|
||||
baseWebSendUrl = "https://vault.bitwarden.com/#/send/",
|
||||
baseWebSendUrl = "https://send.bitwarden.com/#",
|
||||
baseIconUrl = "https://vault.bitwarden.com/icons",
|
||||
isIconLoadingDisabled = false,
|
||||
hasMasterPassword = true,
|
||||
|
||||
@@ -1062,7 +1062,7 @@ class AddSendViewModelTest : BaseViewModelTest() {
|
||||
selectedType = DEFAULT_SELECTED_TYPE_STATE,
|
||||
)
|
||||
|
||||
private const val DEFAULT_ENVIRONMENT_URL = "https://vault.bitwarden.com/#/send/"
|
||||
private const val DEFAULT_ENVIRONMENT_URL = "https://send.bitwarden.com/#"
|
||||
|
||||
private val DEFAULT_STATE = AddSendState(
|
||||
addSendType = AddSendType.AddItem,
|
||||
|
||||
@@ -301,10 +301,10 @@ fun createMockDisplayItemForSend(
|
||||
overflowOptions = listOf(
|
||||
ListingItemOverflowAction.SendAction.EditClick(sendId = "mockId-$number"),
|
||||
ListingItemOverflowAction.SendAction.CopyUrlClick(
|
||||
sendUrl = "https://vault.bitwarden.com/#/send/mockAccessId-$number/mockKey-$number",
|
||||
sendUrl = "https://send.bitwarden.com/#mockAccessId-$number/mockKey-$number",
|
||||
),
|
||||
ListingItemOverflowAction.SendAction.ShareUrlClick(
|
||||
sendUrl = "https://vault.bitwarden.com/#/send/mockAccessId-$number/mockKey-$number",
|
||||
sendUrl = "https://send.bitwarden.com/#mockAccessId-$number/mockKey-$number",
|
||||
),
|
||||
ListingItemOverflowAction.SendAction.RemovePasswordClick(sendId = "mockId-$number"),
|
||||
ListingItemOverflowAction.SendAction.DeleteClick(sendId = "mockId-$number"),
|
||||
@@ -344,10 +344,10 @@ fun createMockDisplayItemForSend(
|
||||
overflowOptions = listOf(
|
||||
ListingItemOverflowAction.SendAction.EditClick(sendId = "mockId-$number"),
|
||||
ListingItemOverflowAction.SendAction.CopyUrlClick(
|
||||
sendUrl = "https://vault.bitwarden.com/#/send/mockAccessId-$number/mockKey-$number",
|
||||
sendUrl = "https://send.bitwarden.com/#mockAccessId-$number/mockKey-$number",
|
||||
),
|
||||
ListingItemOverflowAction.SendAction.ShareUrlClick(
|
||||
sendUrl = "https://vault.bitwarden.com/#/send/mockAccessId-$number/mockKey-$number",
|
||||
sendUrl = "https://send.bitwarden.com/#mockAccessId-$number/mockKey-$number",
|
||||
),
|
||||
ListingItemOverflowAction.SendAction.RemovePasswordClick(sendId = "mockId-$number"),
|
||||
ListingItemOverflowAction.SendAction.DeleteClick(sendId = "mockId-$number"),
|
||||
|
||||
Reference in New Issue
Block a user