Compare commits

...

2 Commits

Author SHA1 Message Date
Lukas Korba 9efb5ecd6d
Merge pull request #1215 from LukasKorba/1214-Add-more-servers-to-the-list
[#1214] Add more servers to the list
2024-04-24 17:45:26 +02:00
Lukas Korba 6abf3bac93 [#1214] Add more servers to the list
- 8 more servers added to the list
- order of servers changed to show default as 1st, custom as 2nd
2024-04-24 17:42:57 +02:00
3 changed files with 72 additions and 40 deletions

View File

@ -6,6 +6,9 @@ directly impact users rather than highlighting other crucial architectural updat
## [Unreleased]
### Changed
- The order of servers available to switch changed and few more servers were added to the list.
## 1.0.5 build 4 (2024-04-19)
### Fixed

View File

@ -25,20 +25,36 @@ extension ZcashSDKEnvironment {
}
case mainnet
case custom
case lwd1
case lwd2
case lwd3
case lwd4
case lwd5
case lwd6
case lwd7
case lwd8
case naNW
case saNW
case euNW
case aiNW
case custom
public func server() -> String {
switch self {
case .mainnet: return "mainnet.lightwalletd.com:9067"
case .custom: return "custom"
case .lwd1: return "lwd1.zcash-infra.com:9067"
case .lwd2: return "lwd1.zcash-infra.com:9067"
case .lwd3: return "lwd1.zcash-infra.com:9067"
case .lwd4: return "lwd1.zcash-infra.com:9067"
case .lwd5: return "lwd1.zcash-infra.com:9067"
case .lwd6: return "lwd1.zcash-infra.com:9067"
case .lwd7: return "lwd1.zcash-infra.com:9067"
case .lwd8: return "lwd1.zcash-infra.com:9067"
case .naNW: return "na.lightwalletd.com:443"
case .saNW: return "sa.lightwalletd.com:443"
case .euNW: return "eu.lightwalletd.com:443"
case .aiNW: return "ai.lightwalletd.com:443"
case .custom: return "custom"
}
}
@ -58,6 +74,13 @@ extension ZcashSDKEnvironment {
secure: true,
streamingCallTimeoutInMillis: ZcashSDKConstants.streamingCallTimeoutInMillis
)
case .lwd1, .lwd2, .lwd3, .lwd4, .lwd5, .lwd6, .lwd7, .lwd8:
return LightWalletEndpoint(
address: String(self.server().dropLast(5)),
port: 9067,
secure: true,
streamingCallTimeoutInMillis: ZcashSDKConstants.streamingCallTimeoutInMillis
)
case .custom:
let udKey = ZcashSDKEnvironment.Servers.Constants.udCustomServerKey
if let storedCustomServer = userDefaults.objectForKey(udKey) as? String{

View File

@ -28,51 +28,57 @@ public struct ServerSetupView: View {
.padding(.vertical, 25)
ForEach(ZcashSDKEnvironment.Servers.allCases, id: \.self) { server in
HStack(spacing: 0) {
Button {
store.send(.someServerTapped(server))
} label: {
HStack(spacing: 10) {
if server == store.server {
Circle()
.fill(Asset.Colors.primary.color)
.frame(width: 20, height: 20)
.overlay {
VStack {
HStack(spacing: 0) {
Button {
store.send(.someServerTapped(server))
} label: {
HStack(spacing: 10) {
WithPerceptionTracking {
if server == store.server {
Circle()
.fill(Asset.Colors.secondary.color)
.frame(width: 8, height: 8)
.fill(Asset.Colors.primary.color)
.frame(width: 20, height: 20)
.overlay {
Circle()
.fill(Asset.Colors.secondary.color)
.frame(width: 8, height: 8)
}
} else {
Circle()
.stroke(Asset.Colors.primary.color)
.frame(width: 20, height: 20)
}
} else {
Circle()
.stroke(Asset.Colors.primary.color)
.frame(width: 20, height: 20)
}
Text(server.server()).tag(server)
.font(.custom(FontFamily.Inter.medium.name, size: 14))
.foregroundColor(Asset.Colors.shade30.color)
}
Text(server.server()).tag(server)
}
.padding(.vertical, 6)
Spacer()
}
.frame(maxWidth: .infinity)
WithPerceptionTracking {
if store.server == .custom && server == .custom {
TextField(L10n.ServerSetup.placeholder, text: $store.customServer)
.frame(height: 40)
.font(.custom(FontFamily.Inter.medium.name, size: 14))
.foregroundColor(Asset.Colors.shade30.color)
.autocapitalization(.none)
.multilineTextAlignment(.leading)
.padding(.horizontal, 10)
.overlay {
Rectangle()
.stroke(Asset.Colors.primary.color, lineWidth: 1)
}
.padding(.top, 8)
}
}
.padding(.vertical, 6)
Spacer()
}
.frame(maxWidth: .infinity)
}
if store.server == .custom {
TextField(L10n.ServerSetup.placeholder, text: $store.customServer)
.frame(height: 40)
.font(.custom(FontFamily.Inter.medium.name, size: 14))
.foregroundColor(Asset.Colors.shade30.color)
.autocapitalization(.none)
.multilineTextAlignment(.leading)
.padding(.horizontal, 10)
.overlay {
Rectangle()
.stroke(Asset.Colors.primary.color, lineWidth: 1)
}
.padding(.top, 8)
}
Button {
@ -88,7 +94,7 @@ public struct ServerSetupView: View {
}
}
.zcashStyle()
.padding(.top, 35)
.padding(.vertical, 35)
.padding(.horizontal, 70)
.disabled(store.isUpdatingServer)