Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UI - onboarding styling and colors #131

Merged
merged 33 commits into from
Dec 9, 2024
Merged
Show file tree
Hide file tree
Changes from 25 commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
8ca66a9
Fix ldk node package issue
danielnordh Oct 25, 2024
ea5109e
Update Onboardingview, logo, styling
danielnordh Oct 25, 2024
235faa0
Use Monday name and Bolt image
danielnordh Oct 25, 2024
d206422
Format code
danielnordh Oct 25, 2024
b330dd1
Set max dynamic type size
danielnordh Nov 27, 2024
6fcd2ff
WIP: .navigationlink style, use apple text style
danielnordh Nov 27, 2024
ffae221
Remove unused stuff
danielnordh Nov 27, 2024
2d77310
WIP move import to separate screen
danielnordh Nov 28, 2024
74811ae
WIP network settings styling
danielnordh Nov 28, 2024
cf19364
Xcode stuff
danielnordh Dec 3, 2024
835cb44
Create EsploraServer Struct to hold name and url
danielnordh Dec 3, 2024
7e5f4c8
Separate NetworkSettingsView and ImportWalletView
danielnordh Dec 3, 2024
ae0d622
Remove duplicate Hashable type
danielnordh Dec 3, 2024
bff0ab9
Remove unused ref to @AppStorage
danielnordh Dec 3, 2024
1f14532
Increase dynamic type acceptance
danielnordh Dec 3, 2024
c2ca8e0
Match texfield size to button height and radius
danielnordh Dec 3, 2024
0af1285
Increase fontweight on toolbar
danielnordh Dec 3, 2024
0ed1b50
Remove "" from info.plist string
danielnordh Dec 4, 2024
baebfee
Undo bundle id change
danielnordh Dec 5, 2024
1e16bf0
Swift format
danielnordh Dec 6, 2024
f79a99c
Update LDKNodeMonday/View Model/Home/OnboardingViewModel.swift
danielnordh Dec 9, 2024
f71549c
Improve EsploraServer struct with predefined options, available to ou…
danielnordh Dec 9, 2024
8bb5f61
Remove unnecessary use of isFirstTime
danielnordh Dec 9, 2024
08199e6
Fix build issues
danielnordh Dec 9, 2024
7c6e8e2
Replace < Back button with Done button
danielnordh Dec 9, 2024
6e685df
Update ImportWalletView to match current
danielnordh Dec 9, 2024
13f649b
Apply update in onboardingview, networksettings and importwalletview
danielnordh Dec 9, 2024
51261a7
WIP switch back to ObservableObject (does not build yet)
danielnordh Dec 9, 2024
be68e0a
Packages
danielnordh Dec 9, 2024
49a4391
Complete return to ObservableObject
danielnordh Dec 9, 2024
cda09fe
Use Cancel instead of < Back on ImportWalletView
danielnordh Dec 9, 2024
3db9ac0
Remove duplicate NetworkSettingsView.swift reference
danielnordh Dec 9, 2024
15451ed
Try to fix merge conflict
danielnordh Dec 9, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 31 additions & 21 deletions LDKNodeMonday.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
objects = {

/* Begin PBXBuildFile section */
65875A932CCB9809000D3E70 /* LDKNode in Frameworks */ = {isa = PBXBuildFile; productRef = 65875A922CCB9809000D3E70 /* LDKNode */; };
658D1E832CFF1978005BD1F3 /* NetworkSettingsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 658D1E822CFF1978005BD1F3 /* NetworkSettingsView.swift */; };
659EE6952CF8D4990064ED78 /* ImportWalletView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 659EE6942CF8D4990064ED78 /* ImportWalletView.swift */; };
AE00550E2B479EF000100797 /* OnboardingView.swift in Sources */ = {isa = PBXBuildFile; fileRef = AE00550D2B479EF000100797 /* OnboardingView.swift */; };
AE0055102B479F1100100797 /* OnboardingViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = AE00550F2B479F1100100797 /* OnboardingViewModel.swift */; };
AE0055122B47A65700100797 /* Color+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = AE0055112B47A65700100797 /* Color+Extensions.swift */; };
Expand Down Expand Up @@ -86,11 +89,12 @@
AEE8FDDD29F855E700406DD9 /* String+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = AEE8FDDC29F855E700406DD9 /* String+Extensions.swift */; };
AEE8FDDF29F8579600406DD9 /* Date+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = AEE8FDDE29F8579600406DD9 /* Date+Extensions.swift */; };
AEF66F522BA4B11A00FA15F9 /* PaymentKind+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = AEF66F512BA4B11A00FA15F9 /* PaymentKind+Extensions.swift */; };
AEFA825E2CC15C7C0095B0BA /* LDKNode in Frameworks */ = {isa = PBXBuildFile; productRef = AEFA825D2CC15C7C0095B0BA /* LDKNode */; };
AEFAF2922A433F6F001128DF /* LightningPaymentStatus.swift in Sources */ = {isa = PBXBuildFile; fileRef = AEFAF2912A433F6F001128DF /* LightningPaymentStatus.swift */; };
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
658D1E822CFF1978005BD1F3 /* NetworkSettingsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NetworkSettingsView.swift; sourceTree = "<group>"; };
659EE6942CF8D4990064ED78 /* ImportWalletView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ImportWalletView.swift; sourceTree = "<group>"; };
AE00550D2B479EF000100797 /* OnboardingView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OnboardingView.swift; sourceTree = "<group>"; };
AE00550F2B479F1100100797 /* OnboardingViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OnboardingViewModel.swift; sourceTree = "<group>"; };
AE0055112B47A65700100797 /* Color+Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Color+Extensions.swift"; sourceTree = "<group>"; };
Expand Down Expand Up @@ -173,7 +177,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
AEFA825E2CC15C7C0095B0BA /* LDKNode in Frameworks */,
65875A932CCB9809000D3E70 /* LDKNode in Frameworks */,
AE060C382C051B59006724F1 /* LDKNode in Frameworks */,
AE1D9BEC2B2A1FFD00620748 /* BitcoinUI in Frameworks */,
AEE5B7652A09B1FC001E5E59 /* CodeScanner in Frameworks */,
Expand Down Expand Up @@ -299,6 +303,8 @@
AE00550D2B479EF000100797 /* OnboardingView.swift */,
AE186B8D2A1540B700338463 /* StartView.swift */,
AE4C15B12A1316D100AA8917 /* BitcoinView.swift */,
659EE6942CF8D4990064ED78 /* ImportWalletView.swift */,
658D1E822CFF1978005BD1F3 /* NetworkSettingsView.swift */,
AE551D402B8ECC2D0034B61E /* Payments */,
AE551D412B8ECC390034B61E /* Send */,
AE551D422B8ECC400034B61E /* Receive */,
Expand Down Expand Up @@ -548,7 +554,7 @@
AE7C4A072B406D590061189D /* SimpleToast */,
AE060C372C051B59006724F1 /* LDKNode */,
AE80C2042C4AB5E4006E7193 /* LDKNode */,
AEFA825D2CC15C7C0095B0BA /* LDKNode */,
65875A922CCB9809000D3E70 /* LDKNode */,
);
productName = LDKNodeMonday;
productReference = AE17E8D629A402E30058C9C9 /* LDKNodeMonday.app */;
Expand Down Expand Up @@ -583,7 +589,7 @@
AE01C5AE2AB3BEED00F28C7E /* XCRemoteSwiftPackageReference "KeychainAccess" */,
AE1D9BEA2B2A1FFD00620748 /* XCRemoteSwiftPackageReference "BitcoinUI" */,
AE7C4A062B406D590061189D /* XCRemoteSwiftPackageReference "SimpleToast" */,
AEFA825C2CC15C7C0095B0BA /* XCRemoteSwiftPackageReference "ldk-node" */,
65875A912CCB9809000D3E70 /* XCRemoteSwiftPackageReference "ldk-node" */,
);
productRefGroup = AE17E8D729A402E30058C9C9 /* Products */;
projectDirPath = "";
Expand Down Expand Up @@ -630,6 +636,7 @@
AE49E8662A2537D5002623E8 /* PeerViewModel.swift in Sources */,
AE33D3AE2C7BD0EE00AF562B /* URL+Extensions.swift in Sources */,
AEBAA4942A01C6BD0042EA82 /* DisconnectView.swift in Sources */,
658D1E832CFF1978005BD1F3 /* NetworkSettingsView.swift in Sources */,
AE49E8682A2537FB002623E8 /* DisconnectViewModel.swift in Sources */,
AE94226A2A007D6C007E4F12 /* ChannelsListView.swift in Sources */,
AEA057ED2B912FEA00DB1096 /* JITInvoiceView.swift in Sources */,
Expand Down Expand Up @@ -681,6 +688,7 @@
AE4C15B22A1316D100AA8917 /* BitcoinView.swift in Sources */,
AEE5B76A2A09C722001E5E59 /* Peer.swift in Sources */,
AE49E84C2A24F96F002623E8 /* Constants.swift in Sources */,
659EE6952CF8D4990064ED78 /* ImportWalletView.swift in Sources */,
AE0BD4AC2B598C3F00B9901E /* UInt32+Extensions.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand Down Expand Up @@ -814,17 +822,18 @@
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_ASSET_PATHS = "\"LDKNodeMonday/Preview Content\"";
DEVELOPMENT_TEAM = 9G6M658RKZ;
DEVELOPMENT_TEAM = "";
ENABLE_PREVIEWS = YES;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = LDKNodeMonday/Info.plist;
INFOPLIST_KEY_CFBundleDisplayName = Monday;
INFOPLIST_KEY_NSCameraUsageDescription = "To scan QR codes.";
INFOPLIST_KEY_NSCameraUsageDescription = "\"To scan QR codes.\"";
INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES;
INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
INFOPLIST_KEY_UILaunchScreen_Generation = YES;
INFOPLIST_KEY_UISupportedInterfaceOrientations = UIInterfaceOrientationPortrait;
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown";
INFOPLIST_KEY_UISupportsDocumentBrowser = YES;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
Expand All @@ -846,17 +855,18 @@
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_ASSET_PATHS = "\"LDKNodeMonday/Preview Content\"";
DEVELOPMENT_TEAM = 9G6M658RKZ;
DEVELOPMENT_TEAM = "";
ENABLE_PREVIEWS = YES;
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = LDKNodeMonday/Info.plist;
INFOPLIST_KEY_CFBundleDisplayName = Monday;
INFOPLIST_KEY_NSCameraUsageDescription = "To scan QR codes.";
INFOPLIST_KEY_NSCameraUsageDescription = "\"To scan QR codes.\"";
INFOPLIST_KEY_UIApplicationSceneManifest_Generation = YES;
INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
INFOPLIST_KEY_UILaunchScreen_Generation = YES;
INFOPLIST_KEY_UISupportedInterfaceOrientations = UIInterfaceOrientationPortrait;
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown";
INFOPLIST_KEY_UISupportsDocumentBrowser = YES;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
Expand Down Expand Up @@ -894,6 +904,14 @@
/* End XCConfigurationList section */

/* Begin XCRemoteSwiftPackageReference section */
65875A912CCB9809000D3E70 /* XCRemoteSwiftPackageReference "ldk-node" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/lightningdevkit/ldk-node.git";
requirement = {
kind = exactVersion;
version = 0.4.0;
};
};
AE01C5AE2AB3BEED00F28C7E /* XCRemoteSwiftPackageReference "KeychainAccess" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/kishikawakatsumi/KeychainAccess.git";
Expand Down Expand Up @@ -926,17 +944,14 @@
version = 2.0.0;
};
};
AEFA825C2CC15C7C0095B0BA /* XCRemoteSwiftPackageReference "ldk-node" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/lightningdevkit/ldk-node.git";
requirement = {
kind = exactVersion;
version = 0.4.0;
};
};
/* End XCRemoteSwiftPackageReference section */

/* Begin XCSwiftPackageProductDependency section */
65875A922CCB9809000D3E70 /* LDKNode */ = {
isa = XCSwiftPackageProductDependency;
package = 65875A912CCB9809000D3E70 /* XCRemoteSwiftPackageReference "ldk-node" */;
productName = LDKNode;
};
AE01C5AF2AB3BEED00F28C7E /* KeychainAccess */ = {
isa = XCSwiftPackageProductDependency;
package = AE01C5AE2AB3BEED00F28C7E /* XCRemoteSwiftPackageReference "KeychainAccess" */;
Expand Down Expand Up @@ -969,11 +984,6 @@
package = AEE5B7632A09B1FC001E5E59 /* XCRemoteSwiftPackageReference "CodeScanner" */;
productName = CodeScanner;
};
AEFA825D2CC15C7C0095B0BA /* LDKNode */ = {
isa = XCSwiftPackageProductDependency;
package = AEFA825C2CC15C7C0095B0BA /* XCRemoteSwiftPackageReference "ldk-node" */;
productName = LDKNode;
};
/* End XCSwiftPackageProductDependency section */
};
rootObject = AE17E8CE29A402E30058C9C9 /* Project object */;
Expand Down
18 changes: 14 additions & 4 deletions LDKNodeMonday/Assets.xcassets/AccentColor.colorset/Contents.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,13 @@
"colors" : [
{
"color" : {
"platform" : "universal",
"reference" : "systemBlueColor"
"color-space" : "display-p3",
"components" : {
"alpha" : "1.000",
"blue" : "0.894",
"green" : "0.188",
"red" : "0.111"
}
},
"idiom" : "universal"
},
Expand All @@ -15,8 +20,13 @@
}
],
"color" : {
"platform" : "universal",
"reference" : "systemBlueColor"
"color-space" : "display-p3",
"components" : {
"alpha" : "1.000",
"blue" : "0xCD",
"green" : "0xF3",
"red" : "0x77"
}
},
"idiom" : "universal"
}
Expand Down
2 changes: 1 addition & 1 deletion LDKNodeMonday/Extensions/ChannelDetails+Extensions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ extension ChannelDetails {
}
}

extension ChannelDetails: Hashable {
extension ChannelDetails {
public static func == (lhs: ChannelDetails, rhs: ChannelDetails) -> Bool {
return lhs.channelId == rhs.channelId
}
Expand Down
6 changes: 1 addition & 5 deletions LDKNodeMonday/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@
<key>ITSAppUsesNonExemptEncryption</key>
<false/>
<key>NSPasteboardUsageDescription</key>
<string> &quot;To allow users to copy and paste text between the app and other apps&quot;</string>
<key>NSCameraUsageDescription</key>
<string>&quot;To scan QR codes.&quot;</string>
<key>UISupportsDocumentBrowser</key>
<true/>
<string>To allow users to copy and paste text between the app and other apps</string>
</dict>
</plist>
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class LightningNodeService {
let storedNetworkString = try! keyService.getNetwork() ?? Network.signet.description
let storedEsploraURL =
try! keyService.getEsploraURL()
?? Constants.Config.EsploraServerURLNetwork.Signet.mutiny
?? EsploraServer.mutiny_signet.url

self.network = Network(stringValue: storedNetworkString) ?? .signet
self.keyService = keyService
Expand Down
41 changes: 25 additions & 16 deletions LDKNodeMonday/Utilities/Constants.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,35 +14,27 @@ struct Constants {

struct EsploraServerURLNetwork {
struct Bitcoin {
static let blockstream = "https://blockstream.info/api"
static let mempoolspace = "https://mempool.space/api"
static let allValues = [
blockstream,
mempoolspace,
EsploraServer.blockstream_bitcoin,
EsploraServer.mempoolspace_bitcoin,
]
}
struct Regtest {
private static let local = "http://127.0.0.1:3002"
static let allValues = [
local
EsploraServer.local_regtest
]
}
struct Signet {
static let bdk = "http://signet.bitcoindevkit.net"
static let mutiny = "https://mutinynet.com/api"
static let allValues = [
mutiny,
bdk,
EsploraServer.mutiny_signet,
EsploraServer.bdk_signet,
]
}
struct Testnet {
static let blockstream = "http://blockstream.info/testnet/api"
static let kuutamo = "https://esplora.testnet.kuutamo.cloud"
static let mempoolspace = "https://mempool.space/testnet/api"
static let allValues = [
blockstream,
kuutamo,
mempoolspace,
EsploraServer.blockstream_testnet,
EsploraServer.kuutamo_testnet,
EsploraServer.mempoolspace_testnet,
]
}
}
Expand Down Expand Up @@ -99,3 +91,20 @@ struct Constants {
}

}

struct EsploraServer: Hashable {
var name: String
var url: String

static let blockstream_bitcoin = EsploraServer(name: "Blockstream", url: "https://blockstream.info/api")
static let mempoolspace_bitcoin = EsploraServer(name: "Mempool", url: "https://mempool.space/api")

static let mutiny_signet = EsploraServer(name: "Mutiny", url: "https://mutinynet.com/api")
static let bdk_signet = EsploraServer(name: "BDK", url: "http://signet.bitcoindevkit.net")

static let local_regtest = EsploraServer(name: "Local", url: "http://127.0.0.1:3002")

static let blockstream_testnet = EsploraServer(name: "Blockstream", url: "http://blockstream.info/testnet/api")
static let kuutamo_testnet = EsploraServer(name: "Kuutamo", url: "https://esplora.testnet.kuutamo.cloud")
static let mempoolspace_testnet = EsploraServer(name: "Mempool.space", url: "https://mempool.space/testnet/api")
}
37 changes: 18 additions & 19 deletions LDKNodeMonday/View Model/Home/OnboardingViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,23 @@
import LDKNode
import SwiftUI

class OnboardingViewModel: ObservableObject {
@AppStorage("isOnboarding") var isOnboarding: Bool?
@Published var networkColor = Color.gray
@Published var onboardingViewError: MondayError?
@Published var seedPhrase: String = "" {
@Observable
class OnboardingViewModel {
var networkColor = Color.gray
var onboardingViewError: MondayError?
var seedPhrase: String = "" {
Copy link
Owner

@reez reez Dec 7, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

change requested: I like @observable more too, but since we AppStorage and @observable dont play nice together I see why you did what you did.

however I'd prefer to leave this view model using ObservableObject and @AppStorage("isOnboarding") var isOnboarding: Bool? for the moment just because we do the same thing in 2 other view models, so if we make a change to this one we should make a change to the other 2, and for the moment I'd prefer we just keep things as is to keep this PR focused (unless you just couldn't get things to work with ObservableObject at all? I know you mentioned something about ObservableObject related to this PR and maybe something not working quite right with passing the isOnboarding between views or something, so let me know if ObservableObject just didn't work for you anymore here and maybe we can figure out a reason/alternative?)

I do like using @Observable and I also like using AppStorage so we will have to come back to this in another PR to get those two working together.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Managed to switch back to @observableobject, clearly the errors I encountered previously were user errors.
This minimises the changes for this PR.

I do wonder however for the future if we can find another pattern to rely on when knowing if the app should be in onboarding mode or not, other than calling Appstorage from so many different files. Some options:

  • If a node is running successfully in LightningNodeService, we are not in onboarding mode
  • If BackupInfo is found (for the relevant network) node should start and we are not in onboarding mode

Here's what I did in BDG Wallet:

// Check if user already has a node seed
if backupManager.backupInfo != nil {
   // If they do, start node
   do {
      try ldkNodeManager.start(mnemonic: backupManager.backupInfo!.mnemonic, passphrase: nil)
   } catch let error {
      debugPrint(error)
   }
}

didSet {
updateSeedPhraseArray()
}
}
@Published var seedPhraseArray: [String] = []
@Published var selectedNetwork: Network = .signet {
var seedPhraseArray: [String] = []
var selectedNetwork: Network = .signet {
didSet {
do {
let networkString = selectedNetwork.description
try KeyClient.live.saveNetwork(networkString)
selectedURL = availableURLs.first ?? ""
try KeyClient.live.saveEsploraURL(selectedURL)
self.selectedEsploraServer = availableEsploraServers.first ?? EsploraServer(name: "", url: "")
try KeyClient.live.saveEsploraURL(selectedEsploraServer.url)
} catch {
DispatchQueue.main.async {
self.onboardingViewError = .init(
Expand All @@ -35,10 +35,11 @@ class OnboardingViewModel: ObservableObject {
}
}
}
@Published var selectedURL: String = "" {
var selectedEsploraServer: EsploraServer = EsploraServer.mutiny_signet
{
didSet {
do {
try KeyClient.live.saveEsploraURL(selectedURL)
try KeyClient.live.saveEsploraURL(selectedEsploraServer.url)
} catch {
DispatchQueue.main.async {
self.onboardingViewError = .init(
Expand All @@ -49,7 +50,7 @@ class OnboardingViewModel: ObservableObject {
}
}
}
var availableURLs: [String] {
var availableEsploraServers: [EsploraServer] {
switch selectedNetwork {
case .bitcoin:
return Constants.Config.EsploraServerURLNetwork.Bitcoin.allValues
Expand Down Expand Up @@ -80,13 +81,11 @@ class OnboardingViewModel: ObservableObject {
do {
if let networkString = try KeyClient.live.getNetwork() {
self.selectedNetwork = Network(stringValue: networkString) ?? .signet
} else {
self.selectedNetwork = .signet
}
if let esploraURL = try KeyClient.live.getEsploraURL() {
self.selectedURL = esploraURL
} else {
self.selectedURL = availableURLs.first ?? ""
self.selectedEsploraServer = availableEsploraServers.first(where: {
$0.url == esploraURL
}) ?? EsploraServer.mutiny_signet
}
} catch {
DispatchQueue.main.async {
Expand All @@ -104,10 +103,10 @@ class OnboardingViewModel: ObservableObject {
let backupInfo = BackupInfo(mnemonic: seedPhrase)
try KeyClient.live.saveBackupInfo(backupInfo)
try KeyClient.live.saveNetwork(selectedNetwork.description)
try KeyClient.live.saveEsploraURL(selectedURL)
try KeyClient.live.saveEsploraURL(selectedEsploraServer.url)
LightningNodeService.shared = LightningNodeService()
DispatchQueue.main.async {
self.isOnboarding = false
UserDefaults.standard.set(false, forKey: "isOnboarding")
}
} catch let error as NodeError {
let errorString = handleNodeError(error)
Expand Down
Loading