Skip to content

Commit cc2e69d

Browse files
committed
added kyoto in settings
1 parent a37b954 commit cc2e69d

File tree

4 files changed

+25
-19
lines changed

4 files changed

+25
-19
lines changed

BDKSwiftExampleWallet/Resources/Localizable.xcstrings

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1322,6 +1322,9 @@
13221322
}
13231323
}
13241324
}
1325+
},
1326+
"Using Kyoto" : {
1327+
13251328
},
13261329
"Vout: %u" : {
13271330
"localizations" : {

BDKSwiftExampleWallet/Service/BDK Service/BDKService.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ private class BDKService {
2727

2828
init(keyClient: KeyClient = .live) {
2929
self.keyClient = keyClient
30-
let storedNetworkString = try? keyClient.getNetwork() ?? Network.bitcoin.description
31-
self.network = Network(stringValue: storedNetworkString ?? "") ?? .bitcoin
30+
let storedNetworkString = try? keyClient.getNetwork() ?? Network.signet.description
31+
self.network = Network(stringValue: storedNetworkString ?? "") ?? .signet
3232

3333
self.esploraURL = (try? keyClient.getEsploraURL()) ?? self.network.url
3434
}

BDKSwiftExampleWallet/View Model/Settings/SettingsViewModel.swift

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,20 +21,15 @@ class SettingsViewModel: ObservableObject {
2121
@Published var showingSettingsViewErrorAlert = false
2222
@Published var walletSyncState: WalletSyncState = .notStarted
2323

24-
private var updateProgressFullScan: @Sendable (UInt64) -> Void {
25-
{ [weak self] inspected in
26-
DispatchQueue.main.async {
27-
self?.inspectedScripts = inspected
28-
}
29-
}
30-
}
24+
let syncMode: SyncMode
3125

3226
init(
3327
bdkClient: BDKClient = .live
3428
) {
3529
self.bdkClient = bdkClient
3630
self.network = bdkClient.getNetwork().description
3731
self.esploraURL = bdkClient.getEsploraURL()
32+
self.syncMode = bdkClient.getSyncMode() ?? .esplora
3833
}
3934

4035
func delete() {
@@ -46,7 +41,7 @@ class SettingsViewModel: ObservableObject {
4641
self.showingSettingsViewErrorAlert = true
4742
}
4843
}
49-
44+
5045
func fullScanWithProgress() async {
5146
DispatchQueue.main.async {
5247
self.walletSyncState = .syncing

BDKSwiftExampleWallet/View/Settings/SettingsView.swift

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -35,16 +35,24 @@ struct SettingsView: View {
3535
.foregroundStyle(.secondary)
3636

3737
Form {
38-
39-
Section(header: Text("Network")) {
40-
if let network = viewModel.network, let url = viewModel.esploraURL {
41-
Text(
42-
"\(network.capitalized)\(url.replacingOccurrences(of: "https://", with: "").replacingOccurrences(of: "http://", with: ""))"
43-
)
44-
.foregroundStyle(.primary)
38+
Group {
39+
if viewModel.syncMode == .kyoto {
40+
Section(header: Text("Network")) {
41+
Text("Using Kyoto")
42+
.foregroundStyle(.primary)
43+
}
4544
} else {
46-
HStack {
47-
Text("No Network")
45+
Section(header: Text("Network")) {
46+
if let network = viewModel.network, let url = viewModel.esploraURL {
47+
Text(
48+
"\(network.capitalized)\(url.replacingOccurrences(of: "https://", with: "").replacingOccurrences(of: "http://", with: ""))"
49+
)
50+
.foregroundStyle(.primary)
51+
} else {
52+
HStack {
53+
Text("No Network")
54+
}
55+
}
4856
}
4957
}
5058
}

0 commit comments

Comments
 (0)