Skip to content

Commit 8dd5a9d

Browse files
authored
[PM-8331] Using default send url when on US cloud (#4925)
1 parent 3469618 commit 8dd5a9d

File tree

5 files changed

+26
-7
lines changed

5 files changed

+26
-7
lines changed

app/src/main/java/com/x8bit/bitwarden/data/platform/repository/util/EnvironmentUrlDataJsonExtensions.kt

+9-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,15 @@ val EnvironmentUrlDataJson.baseWebSendUrl: String
5959
get() =
6060
this
6161
.baseWebVaultUrlOrNull
62-
?.let { "$it/#/send/" }
62+
?.let {
63+
// Only on US Cloud we should use the default web send URL
64+
// On all other server instances we should use the base web send URL
65+
if (it == DEFAULT_WEB_VAULT_URL) {
66+
DEFAULT_WEB_SEND_URL
67+
} else {
68+
"$it/#/send/"
69+
}
70+
}
6371
?: DEFAULT_WEB_SEND_URL
6472

6573
/**

app/src/test/java/com/x8bit/bitwarden/data/platform/repository/util/EnvironmentUrlsDataJsonExtensionsTest.kt

+11
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,17 @@ class EnvironmentUrlsDataJsonExtensionsTest {
164164
assertEquals("https://send.bitwarden.com/#", result)
165165
}
166166

167+
@Test
168+
fun `baseWebSendUrl should return the default when webvault matches default webvault`() {
169+
val result = DEFAULT_CUSTOM_ENVIRONMENT_URL_DATA
170+
.copy(
171+
webVault = "https://vault.bitwarden.com",
172+
base = "",
173+
)
174+
.baseWebSendUrl
175+
assertEquals("https://send.bitwarden.com/#", result)
176+
}
177+
167178
@Test
168179
fun `labelOrBaseUrlHost should correctly convert US environment to the correct label`() {
169180
val environment = EnvironmentUrlDataJson.DEFAULT_US

app/src/test/java/com/x8bit/bitwarden/ui/platform/feature/search/SearchViewModelTest.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1637,7 +1637,7 @@ private val DEFAULT_STATE: SearchState = SearchState(
16371637
viewState = SearchState.ViewState.Loading,
16381638
dialogState = null,
16391639
vaultFilterData = null,
1640-
baseWebSendUrl = "https://vault.bitwarden.com/#/send/",
1640+
baseWebSendUrl = "https://send.bitwarden.com/#",
16411641
baseIconUrl = "https://vault.bitwarden.com/icons",
16421642
isIconLoadingDisabled = false,
16431643
hasMasterPassword = true,

app/src/test/java/com/x8bit/bitwarden/ui/tools/feature/send/addsend/AddSendViewModelTest.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1062,7 +1062,7 @@ class AddSendViewModelTest : BaseViewModelTest() {
10621062
selectedType = DEFAULT_SELECTED_TYPE_STATE,
10631063
)
10641064

1065-
private const val DEFAULT_ENVIRONMENT_URL = "https://vault.bitwarden.com/#/send/"
1065+
private const val DEFAULT_ENVIRONMENT_URL = "https://send.bitwarden.com/#"
10661066

10671067
private val DEFAULT_STATE = AddSendState(
10681068
addSendType = AddSendType.AddItem,

app/src/test/java/com/x8bit/bitwarden/ui/vault/feature/itemlisting/util/VaultItemListingDataUtil.kt

+4-4
Original file line numberDiff line numberDiff line change
@@ -301,10 +301,10 @@ fun createMockDisplayItemForSend(
301301
overflowOptions = listOf(
302302
ListingItemOverflowAction.SendAction.EditClick(sendId = "mockId-$number"),
303303
ListingItemOverflowAction.SendAction.CopyUrlClick(
304-
sendUrl = "https://vault.bitwarden.com/#/send/mockAccessId-$number/mockKey-$number",
304+
sendUrl = "https://send.bitwarden.com/#mockAccessId-$number/mockKey-$number",
305305
),
306306
ListingItemOverflowAction.SendAction.ShareUrlClick(
307-
sendUrl = "https://vault.bitwarden.com/#/send/mockAccessId-$number/mockKey-$number",
307+
sendUrl = "https://send.bitwarden.com/#mockAccessId-$number/mockKey-$number",
308308
),
309309
ListingItemOverflowAction.SendAction.RemovePasswordClick(sendId = "mockId-$number"),
310310
ListingItemOverflowAction.SendAction.DeleteClick(sendId = "mockId-$number"),
@@ -344,10 +344,10 @@ fun createMockDisplayItemForSend(
344344
overflowOptions = listOf(
345345
ListingItemOverflowAction.SendAction.EditClick(sendId = "mockId-$number"),
346346
ListingItemOverflowAction.SendAction.CopyUrlClick(
347-
sendUrl = "https://vault.bitwarden.com/#/send/mockAccessId-$number/mockKey-$number",
347+
sendUrl = "https://send.bitwarden.com/#mockAccessId-$number/mockKey-$number",
348348
),
349349
ListingItemOverflowAction.SendAction.ShareUrlClick(
350-
sendUrl = "https://vault.bitwarden.com/#/send/mockAccessId-$number/mockKey-$number",
350+
sendUrl = "https://send.bitwarden.com/#mockAccessId-$number/mockKey-$number",
351351
),
352352
ListingItemOverflowAction.SendAction.RemovePasswordClick(sendId = "mockId-$number"),
353353
ListingItemOverflowAction.SendAction.DeleteClick(sendId = "mockId-$number"),

0 commit comments

Comments
 (0)