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
23 changes: 4 additions & 19 deletions BDKSwiftExampleWallet.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,10 @@
AE7F67092A7451AA00CED561 /* Price.swift in Sources */ = {isa = PBXBuildFile; fileRef = AE7F67082A7451AA00CED561 /* Price.swift */; };
AE7F670C2A7451D700CED561 /* CurrencyCode.swift in Sources */ = {isa = PBXBuildFile; fileRef = AE7F670B2A7451D700CED561 /* CurrencyCode.swift */; };
AE83EFDB2C9D07B200B41244 /* ChainPosition+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = AE83EFDA2C9D07B200B41244 /* ChainPosition+Extensions.swift */; };
AE8D001C2D19F1760029C4C9 /* UIScreen+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = AE8D001B2D19F1760029C4C9 /* UIScreen+Extensions.swift */; };
AE91CEED2C0FDB70000AAD20 /* SentAndReceivedValues+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = AE91CEEC2C0FDB70000AAD20 /* SentAndReceivedValues+Extensions.swift */; };
AE91CEEF2C0FDBC7000AAD20 /* CanonicalTx+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = AE91CEEE2C0FDBC7000AAD20 /* CanonicalTx+Extensions.swift */; };
AE96F6622A424C400055623C /* BDKSwiftExampleWalletReceiveViewModelTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = AE96F6612A424C400055623C /* BDKSwiftExampleWalletReceiveViewModelTests.swift */; };
AEA1F6432CE43702004EC538 /* BitcoinDevKit in Frameworks */ = {isa = PBXBuildFile; productRef = AEA1F6422CE43702004EC538 /* BitcoinDevKit */; };
AEAB03112ABDDB86000C9528 /* FeeViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = AEAB03102ABDDB86000C9528 /* FeeViewModel.swift */; };
AEAB03132ABDDBF4000C9528 /* AmountViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = AEAB03122ABDDBF4000C9528 /* AmountViewModel.swift */; };
AEAF83B62B7BD4D10019B23B /* CodeScanner in Frameworks */ = {isa = PBXBuildFile; productRef = AEAF83B52B7BD4D10019B23B /* CodeScanner */; };
Expand All @@ -90,7 +90,6 @@
AEE6C74C2ABCB3E200442ADD /* Transaction+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = AEE6C74B2ABCB3E200442ADD /* Transaction+Extensions.swift */; };
AEE6C74F2ABCBA4600442ADD /* WalletSyncState.swift in Sources */ = {isa = PBXBuildFile; fileRef = AEE6C74E2ABCBA4600442ADD /* WalletSyncState.swift */; };
AEE83A492C07F54B00834468 /* BitcoinDevKit in Frameworks */ = {isa = PBXBuildFile; productRef = AEE83A482C07F54B00834468 /* BitcoinDevKit */; };
AEEA24572D136898000C1694 /* BitcoinDevKit in Frameworks */ = {isa = PBXBuildFile; productRef = AEEA24562D136898000C1694 /* BitcoinDevKit */; };
/* End PBXBuildFile section */

/* Begin PBXContainerItemProxy section */
Expand Down Expand Up @@ -161,6 +160,7 @@
AE7F67082A7451AA00CED561 /* Price.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Price.swift; sourceTree = "<group>"; };
AE7F670B2A7451D700CED561 /* CurrencyCode.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CurrencyCode.swift; sourceTree = "<group>"; };
AE83EFDA2C9D07B200B41244 /* ChainPosition+Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "ChainPosition+Extensions.swift"; sourceTree = "<group>"; };
AE8D001B2D19F1760029C4C9 /* UIScreen+Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIScreen+Extensions.swift"; sourceTree = "<group>"; };
AE91CEEC2C0FDB70000AAD20 /* SentAndReceivedValues+Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "SentAndReceivedValues+Extensions.swift"; sourceTree = "<group>"; };
AE91CEEE2C0FDBC7000AAD20 /* CanonicalTx+Extensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "CanonicalTx+Extensions.swift"; sourceTree = "<group>"; };
AE96F6612A424C400055623C /* BDKSwiftExampleWalletReceiveViewModelTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BDKSwiftExampleWalletReceiveViewModelTests.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -521,6 +521,7 @@
AE184EFB2BFE52C800374362 /* Amount+Extensions.swift */,
AE91CEEC2C0FDB70000AAD20 /* SentAndReceivedValues+Extensions.swift */,
AE91CEEE2C0FDBC7000AAD20 /* CanonicalTx+Extensions.swift */,
AE8D001B2D19F1760029C4C9 /* UIScreen+Extensions.swift */,
);
path = "BDK+Extensions";
sourceTree = "<group>";
Expand Down Expand Up @@ -654,6 +655,7 @@
AEB905C32A7EEBF000CD0337 /* BackupInfo.swift in Sources */,
AE783A072AB4F7C7005F0CBA /* FeeView.swift in Sources */,
AE2B8C1D2A9678C900815B2F /* FeeService.swift in Sources */,
AE8D001C2D19F1760029C4C9 /* UIScreen+Extensions.swift in Sources */,
AEC2CF5A2ABFBA19008065E4 /* BuildTransactionViewModel.swift in Sources */,
AE2B8C1F2A96797300815B2F /* RecommendedFees.swift in Sources */,
AE7F670C2A7451D700CED561 /* CurrencyCode.swift in Sources */,
Expand Down Expand Up @@ -1034,14 +1036,6 @@
kind = branch;
};
};
AEEA24552D136898000C1694 /* XCRemoteSwiftPackageReference "bdk-swift" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/bitcoindevkit/bdk-swift.git";
requirement = {
kind = exactVersion;
version = "1.0.0-beta.6";
};
};
/* End XCRemoteSwiftPackageReference section */

/* Begin XCSwiftPackageProductDependency section */
Expand Down Expand Up @@ -1071,10 +1065,6 @@
package = AE7D5A0C2A7EE62200EAC8CE /* XCRemoteSwiftPackageReference "KeychainAccess" */;
productName = KeychainAccess;
};
AEA1F6422CE43702004EC538 /* BitcoinDevKit */ = {
isa = XCSwiftPackageProductDependency;
productName = BitcoinDevKit;
};
AEAF83B52B7BD4D10019B23B /* CodeScanner */ = {
isa = XCSwiftPackageProductDependency;
package = AEAF83B42B7BD4D10019B23B /* XCRemoteSwiftPackageReference "CodeScanner" */;
Expand All @@ -1089,11 +1079,6 @@
isa = XCSwiftPackageProductDependency;
productName = BitcoinDevKit;
};
AEEA24562D136898000C1694 /* BitcoinDevKit */ = {
isa = XCSwiftPackageProductDependency;
package = AEEA24552D136898000C1694 /* XCRemoteSwiftPackageReference "bdk-swift" */;
productName = BitcoinDevKit;
};
/* End XCSwiftPackageProductDependency section */
};
rootObject = AE4984702A1BBBD6009951E2 /* Project object */;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
//
// UIScreen+Extensions.swift
// BDKSwiftExampleWallet
//
// Created by Matthew Ramsden on 12/23/24.
//

import Foundation
import UIKit

extension UIScreen {
static let iPhoneSEHeight: CGFloat = 667

var isPhoneSE: Bool {
self.bounds.height <= UIScreen.iPhoneSEHeight
}
}
23 changes: 16 additions & 7 deletions BDKSwiftExampleWallet/View/OnboardingView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ struct OnboardingView: View {
@State private var showingImportView = false
@State private var showingScanner = false
let pasteboard = UIPasteboard.general
var isSmallDevice: Bool {
UIScreen.main.isPhoneSE
}

var body: some View {

Expand All @@ -25,7 +28,7 @@ struct OnboardingView: View {

VStack {

HStack {
HStack(alignment: .center, spacing: 40) {

Spacer()

Expand All @@ -38,7 +41,6 @@ struct OnboardingView: View {
}
.tint(.secondary)
.font(.title)
.padding()

Button {
if let clipboardContent = UIPasteboard.general.string {
Expand All @@ -50,7 +52,6 @@ struct OnboardingView: View {
}
.tint(.secondary)
.font(.title)
.padding()
} else {
Button {
viewModel.words = ""
Expand All @@ -60,19 +61,25 @@ struct OnboardingView: View {
}
.tint(.primary)
.font(.title)
.padding()
}
}
.padding()

Spacer()

VStack(spacing: 25) {
VStack(
spacing: isSmallDevice ? 5 : 25
) {
Image(systemName: "bitcoinsign.circle")
.resizable()
.foregroundStyle(
.secondary
)
.frame(width: 100, height: 100, alignment: .center)
.frame(
width: isSmallDevice ? 40 : 100,
height: isSmallDevice ? 40 : 100,
alignment: .center
)
Text("powered by Bitcoin Dev Kit")
.foregroundStyle(
LinearGradient(
Expand Down Expand Up @@ -138,7 +145,9 @@ struct OnboardingView: View {
usePaging: true,
wordsPerPage: 4
)
.frame(height: 200)
.frame(
height: isSmallDevice ? 150 : 200
)
.padding()
}
}
Expand Down
16 changes: 6 additions & 10 deletions BDKSwiftExampleWallet/View/Receive/ReceiveView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ struct ReceiveView: View {
@Bindable var viewModel: ReceiveViewModel
@State private var isCopied = false
@State private var showCheckmark = false
var isSmallDevice: Bool {
UIScreen.main.isPhoneSE
}

var body: some View {

Expand All @@ -37,12 +40,12 @@ struct ReceiveView: View {
VStack(spacing: 8) {
Image("bitcoinsign.arrow.down")
.symbolRenderingMode(.hierarchical)
.font(.title)
.font(isSmallDevice ? .caption : .title)
Text("Receive")
.fontWeight(.semibold)
}
.font(.caption)
.padding(.top, 40.0)
.padding(.top, isSmallDevice ? 20.0 : 40.0)

Spacer()

Expand All @@ -59,18 +62,11 @@ struct ReceiveView: View {
AddressFormattedView(
address: viewModel.address,
columns: 4,
spacing: 20.0,
spacing: isSmallDevice ? 5.0 : 20.0,
gridItemSize: 60.0
)
.padding()

// Button {
// viewModel.startNFCSession()
// } label: {
// Image(systemName: "wave.3.right")
// .foregroundColor(.primary)
// }

HStack {
Button {
UIPasteboard.general.string = viewModel.address
Expand Down
11 changes: 8 additions & 3 deletions BDKSwiftExampleWallet/View/Send/AmountView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ struct AmountView: View {
@Binding var navigationPath: NavigationPath
@State var numpadAmount = "0"
let address: String
var isSmallDevice: Bool {
UIScreen.main.isPhoneSE
}

var body: some View {

Expand Down Expand Up @@ -47,16 +50,18 @@ struct AmountView: View {
}

GeometryReader { geometry in
let buttonSize = geometry.size.width / 4
VStack(spacing: buttonSize / 10) {
let buttonDivider: CGFloat = isSmallDevice ? 5 : 4
let buttonSize = geometry.size.width / buttonDivider
let spacingDivider: CGFloat = isSmallDevice ? 12 : 10
VStack(spacing: buttonSize / spacingDivider) {
numpadRow(["1", "2", "3"], buttonSize: buttonSize)
numpadRow(["4", "5", "6"], buttonSize: buttonSize)
numpadRow(["7", "8", "9"], buttonSize: buttonSize)
numpadRow([" ", "0", "<"], buttonSize: buttonSize)
}
.frame(maxWidth: .infinity)
}
.frame(height: 300)
.frame(height: isSmallDevice ? 200 : 300)

Spacer()

Expand Down
5 changes: 4 additions & 1 deletion BDKSwiftExampleWallet/View/Settings/SettingsView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ struct SettingsView: View {
@State private var isSeedPresented = false
@State private var showingDeleteSeedConfirmation = false
@State private var showingShowSeedConfirmation = false
var isSmallDevice: Bool {
UIScreen.main.isPhoneSE
}

var body: some View {

Expand Down Expand Up @@ -108,7 +111,7 @@ struct SettingsView: View {
}
.sheet(isPresented: $isSeedPresented) {
WalletRecoveryView(viewModel: .init())
.presentationDetents([.medium, .large])
.presentationDetents(isSmallDevice ? [.large] : [.medium, .large])
.presentationDragIndicator(.visible)
}
.alert(
Expand Down