diff --git a/BDKSwiftExampleWallet/Resources/Localizable.xcstrings b/BDKSwiftExampleWallet/Resources/Localizable.xcstrings index 885ae100..ae10762b 100644 --- a/BDKSwiftExampleWallet/Resources/Localizable.xcstrings +++ b/BDKSwiftExampleWallet/Resources/Localizable.xcstrings @@ -178,9 +178,6 @@ } } } - }, - "12 Word Seed Phrase" : { - }, "12 Word Seed Phrase (Optional)" : { "extractionState" : "stale", @@ -404,9 +401,6 @@ } } } - }, - "Import" : { - }, "Navigation Title" : { "extractionState" : "stale", diff --git a/BDKSwiftExampleWallet/View/OnboardingView.swift b/BDKSwiftExampleWallet/View/OnboardingView.swift index c80b8e2e..cec75006 100644 --- a/BDKSwiftExampleWallet/View/OnboardingView.swift +++ b/BDKSwiftExampleWallet/View/OnboardingView.swift @@ -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 { @@ -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() @@ -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)) diff --git a/BDKSwiftExampleWallet/View/Settings/SeedView.swift b/BDKSwiftExampleWallet/View/Settings/SeedView.swift index 6189c89c..45485d7b 100644 --- a/BDKSwiftExampleWallet/View/Settings/SeedView.swift +++ b/BDKSwiftExampleWallet/View/Settings/SeedView.swift @@ -25,7 +25,7 @@ struct SeedView: View { words: seed.mnemonic.components(separatedBy: " "), preferredWordsPerRow: 2, usePaging: true, - wordsPerPage: 6 + wordsPerPage: 4 ) HStack {