Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 0 additions & 6 deletions BDKSwiftExampleWallet/Resources/Localizable.xcstrings
Original file line number Diff line number Diff line change
Expand Up @@ -178,9 +178,6 @@
}
}
}
},
"12 Word Seed Phrase" : {

},
"12 Word Seed Phrase (Optional)" : {
"extractionState" : "stale",
Expand Down Expand Up @@ -404,9 +401,6 @@
}
}
}
},
"Import" : {

},
"Navigation Title" : {
"extractionState" : "stale",
Expand Down
67 changes: 10 additions & 57 deletions BDKSwiftExampleWallet/View/OnboardingView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ struct OnboardingView: View {
@AppStorage("isOnboarding") var isOnboarding: Bool?
@State private var showingOnboardingViewErrorAlert = false
@State private var showingImportView = false
let pasteboard = UIPasteboard.general

var body: some View {

Expand All @@ -26,25 +27,25 @@ struct OnboardingView: View {
HStack {
Spacer()
Button {
showingImportView = true
if viewModel.wordArray.isEmpty {
if let clipboardContent = UIPasteboard.general.string {
viewModel.words = clipboardContent
}
} else {
viewModel.words = ""
}
} label: {
Image(
systemName: viewModel.wordArray.isEmpty
? "square.and.arrow.down" : "square.and.arrow.down.fill"
? "arrow.down.square" : "clear"
)
.contentTransition(.symbolEffect(.replace))
}
.tint(
viewModel.wordArray.isEmpty ? .secondary : .primary
)
.font(.title)
.padding()
.sheet(isPresented: $showingImportView) {
ImportView(
isPresented: $showingImportView,
importedWords: $viewModel.words
)
.presentationDetents([.medium])
}
}

Spacer()
Expand Down Expand Up @@ -148,54 +149,6 @@ struct OnboardingView: View {
}
}

struct ImportView: View {
@Binding var isPresented: Bool
@Binding var importedWords: String

private var wordArray: [String] {
importedWords.split(separator: " ").map(String.init)
}

var body: some View {

VStack {

Spacer()

TextField("12 Word Seed Phrase", text: $importedWords)
.submitLabel(.done)
.textFieldStyle(RoundedBorderTextFieldStyle())
.padding(.horizontal, 40)

if !importedWords.isEmpty {
SeedPhraseView(
words: wordArray,
preferredWordsPerRow: 2,
usePaging: true,
wordsPerPage: 4
)
.frame(height: 200)
}

Spacer()

Button("Import") {
isPresented = false
}
.buttonStyle(
BitcoinFilled(
tintColor: .bitcoinOrange,
textColor: Color(uiColor: .systemBackground),
isCapsule: true
)
)
.padding()

}

}
}

#if DEBUG
#Preview("OnboardingView - en") {
OnboardingView(viewModel: .init(bdkClient: .mock))
Expand Down
2 changes: 1 addition & 1 deletion BDKSwiftExampleWallet/View/Settings/SeedView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ struct SeedView: View {
words: seed.mnemonic.components(separatedBy: " "),
preferredWordsPerRow: 2,
usePaging: true,
wordsPerPage: 6
wordsPerPage: 4
)

HStack {
Expand Down
Loading