Add more servers to the list (#1394)
- 8 more servers added to the list - Order of servers changed to show default as 1st, custom as 2nd
This commit is contained in:
parent
e0439f0ca9
commit
2ac9f5ebd4
|
@ -18,20 +18,40 @@ object AvailableServerProvider {
|
||||||
// Mainnet: mainnet.lightwalletd.com | 9067
|
// Mainnet: mainnet.lightwalletd.com | 9067
|
||||||
// Testnet: lightwalletd.testnet.electriccoin.co | 9067
|
// Testnet: lightwalletd.testnet.electriccoin.co | 9067
|
||||||
|
|
||||||
private const val HOST_NA = "na.lightwalletd.com" // NON-NLS
|
private const val NH_HOST_NA = "na.lightwalletd.com" // NON-NLS
|
||||||
private const val HOST_SA = "sa.lightwalletd.com" // NON-NLS
|
private const val NH_HOST_SA = "sa.lightwalletd.com" // NON-NLS
|
||||||
private const val HOST_EU = "eu.lightwalletd.com" // NON-NLS
|
private const val NH_HOST_EU = "eu.lightwalletd.com" // NON-NLS
|
||||||
private const val HOST_AI = "ai.lightwalletd.com" // NON-NLS
|
private const val NH_HOST_AI = "ai.lightwalletd.com" // NON-NLS
|
||||||
private const val PORT = 443
|
private const val NH_PORT = 443
|
||||||
|
|
||||||
|
private const val YW_HOST_1 = "lwd1.zcash-infra.com" // NON-NLS
|
||||||
|
private const val YW_HOST_2 = "lwd2.zcash-infra.com" // NON-NLS
|
||||||
|
private const val YW_HOST_3 = "lwd3.zcash-infra.com" // NON-NLS
|
||||||
|
private const val YW_HOST_4 = "lwd4.zcash-infra.com" // NON-NLS
|
||||||
|
private const val YW_HOST_5 = "lwd5.zcash-infra.com" // NON-NLS
|
||||||
|
private const val YW_HOST_6 = "lwd6.zcash-infra.com" // NON-NLS
|
||||||
|
private const val YW_HOST_7 = "lwd7.zcash-infra.com" // NON-NLS
|
||||||
|
private const val YW_HOST_8 = "lwd8.zcash-infra.com" // NON-NLS
|
||||||
|
private const val YW_PORT = 9067
|
||||||
|
|
||||||
fun toList(network: ZcashNetwork) =
|
fun toList(network: ZcashNetwork) =
|
||||||
buildList {
|
buildList {
|
||||||
if (network == ZcashNetwork.Mainnet) {
|
if (network == ZcashNetwork.Mainnet) {
|
||||||
add(LightWalletEndpoint.Mainnet)
|
add(LightWalletEndpoint.Mainnet)
|
||||||
add(LightWalletEndpoint(HOST_NA, PORT, true))
|
|
||||||
add(LightWalletEndpoint(HOST_SA, PORT, true))
|
add(LightWalletEndpoint(YW_HOST_1, YW_PORT, true))
|
||||||
add(LightWalletEndpoint(HOST_EU, PORT, true))
|
add(LightWalletEndpoint(YW_HOST_2, YW_PORT, true))
|
||||||
add(LightWalletEndpoint(HOST_AI, PORT, true))
|
add(LightWalletEndpoint(YW_HOST_3, YW_PORT, true))
|
||||||
|
add(LightWalletEndpoint(YW_HOST_4, YW_PORT, true))
|
||||||
|
add(LightWalletEndpoint(YW_HOST_5, YW_PORT, true))
|
||||||
|
add(LightWalletEndpoint(YW_HOST_6, YW_PORT, true))
|
||||||
|
add(LightWalletEndpoint(YW_HOST_7, YW_PORT, true))
|
||||||
|
add(LightWalletEndpoint(YW_HOST_8, YW_PORT, true))
|
||||||
|
|
||||||
|
add(LightWalletEndpoint(NH_HOST_NA, NH_PORT, true))
|
||||||
|
add(LightWalletEndpoint(NH_HOST_SA, NH_PORT, true))
|
||||||
|
add(LightWalletEndpoint(NH_HOST_EU, NH_PORT, true))
|
||||||
|
add(LightWalletEndpoint(NH_HOST_AI, NH_PORT, true))
|
||||||
} else {
|
} else {
|
||||||
add(LightWalletEndpoint.Testnet)
|
add(LightWalletEndpoint.Testnet)
|
||||||
}
|
}
|
||||||
|
|
|
@ -145,6 +145,8 @@ private fun ChooseServerTopAppBar(
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const val CUSTOM_SERVER_OPTION_INDEX = 1
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
@Suppress("LongMethod", "LongParameterList")
|
@Suppress("LongMethod", "LongParameterList")
|
||||||
private fun ChooseServerMainContent(
|
private fun ChooseServerMainContent(
|
||||||
|
@ -162,10 +164,10 @@ private fun ChooseServerMainContent(
|
||||||
// server list obtaining is implemented.
|
// server list obtaining is implemented.
|
||||||
if (contains(wallet.endpoint)) {
|
if (contains(wallet.endpoint)) {
|
||||||
// We define the custom server as secured by default
|
// We define the custom server as secured by default
|
||||||
add(LightWalletEndpoint("", -1, true))
|
add(CUSTOM_SERVER_OPTION_INDEX, LightWalletEndpoint("", -1, true))
|
||||||
} else {
|
} else {
|
||||||
// Adding previously chosen custom endpoint
|
// Adding previously chosen custom endpoint
|
||||||
add(wallet.endpoint)
|
add(CUSTOM_SERVER_OPTION_INDEX, wallet.endpoint)
|
||||||
}
|
}
|
||||||
}.toImmutableList()
|
}.toImmutableList()
|
||||||
|
|
||||||
|
@ -175,9 +177,13 @@ private fun ChooseServerMainContent(
|
||||||
}
|
}
|
||||||
|
|
||||||
val initialCustomServerValue =
|
val initialCustomServerValue =
|
||||||
options.last().run {
|
options[CUSTOM_SERVER_OPTION_INDEX].run {
|
||||||
if (options.last().isValid()) {
|
if (options[CUSTOM_SERVER_OPTION_INDEX].isValid()) {
|
||||||
stringResource(R.string.choose_server_textfield_value, options.last().host, options.last().port)
|
stringResource(
|
||||||
|
R.string.choose_server_textfield_value,
|
||||||
|
options[CUSTOM_SERVER_OPTION_INDEX].host,
|
||||||
|
options[CUSTOM_SERVER_OPTION_INDEX].port
|
||||||
|
)
|
||||||
} else {
|
} else {
|
||||||
""
|
""
|
||||||
}
|
}
|
||||||
|
@ -243,7 +249,7 @@ fun ServerList(
|
||||||
options.forEachIndexed { index, endpoint ->
|
options.forEachIndexed { index, endpoint ->
|
||||||
val isSelected = index == selectedOption
|
val isSelected = index == selectedOption
|
||||||
|
|
||||||
if (index == options.lastIndex) {
|
if (index == CUSTOM_SERVER_OPTION_INDEX) {
|
||||||
Column(
|
Column(
|
||||||
modifier = Modifier.animateContentSize()
|
modifier = Modifier.animateContentSize()
|
||||||
) {
|
) {
|
||||||
|
@ -284,6 +290,8 @@ fun ServerList(
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.padding(horizontal = ZcashTheme.dimens.spacingSmall)
|
.padding(horizontal = ZcashTheme.dimens.spacingSmall)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
Spacer(modifier = Modifier.height(ZcashTheme.dimens.spacingSmall))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -339,7 +347,7 @@ fun SaveButton(
|
||||||
text = stringResource(id = R.string.choose_server_save),
|
text = stringResource(id = R.string.choose_server_save),
|
||||||
onClick = {
|
onClick = {
|
||||||
val selectedServer =
|
val selectedServer =
|
||||||
if (selectedOption == options.lastIndex) {
|
if (selectedOption == CUSTOM_SERVER_OPTION_INDEX) {
|
||||||
if (!validateCustomServerValue(customServerValue)) {
|
if (!validateCustomServerValue(customServerValue)) {
|
||||||
setShowErrorDialog(true)
|
setShowErrorDialog(true)
|
||||||
return@PrimaryButton
|
return@PrimaryButton
|
||||||
|
|
Loading…
Reference in New Issue