Skip to content
Draft
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
2 changes: 2 additions & 0 deletions .agents/commands/release.md
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,8 @@ Print the path to the local draft. Store it for the summary. Slack posting is de

### 7. Build & Upload to TestFlight (optional)

Before archiving, `Secrets.xcconfig` must exist at the repo root with `BREEZ_API_KEY` set (copy `Secrets.xcconfig.template`). Release builds fail without it. Check with `grep -q '^BREEZ_API_KEY = .\+' Secrets.xcconfig`; if it fails, stop and ask the releaser for the key. Never print the key.

Use `AskUserQuestion`:

**Question:** `"Archive and upload to TestFlight?"`
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,5 @@ buildServer.json
# XcodeBuildMCP
.xcodebuildmcp/config.yaml

# Local build secrets
# Local build secrets (see Secrets.xcconfig.template)
Secrets.xcconfig
4 changes: 4 additions & 0 deletions Bitkit.xcconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// Base settings for the Bitkit app target.
// Local secrets stay out of git: copy Secrets.xcconfig.template to Secrets.xcconfig and fill it in.
// Without it the app builds with Spark (Lightning without channels) off on mainnet.
#include? "Secrets.xcconfig"
42 changes: 42 additions & 0 deletions Bitkit.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
4AAB08CA2E1FE77600BA63DF /* Lottie in Frameworks */ = {isa = PBXBuildFile; productRef = 4AAB08C92E1FE77600BA63DF /* Lottie */; };
961058E32C355B5500E1F1D8 /* BitkitNotification.appex in Embed Foundation Extensions */ = {isa = PBXBuildFile; fileRef = 961058DC2C355B5500E1F1D8 /* BitkitNotification.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
968FDF162DFAFE230053CD7F /* LDKNode in Frameworks */ = {isa = PBXBuildFile; productRef = 9613018B2C5022D700878183 /* LDKNode */; };
72B5EE0000000000000000A3 /* BreezSdkSpark in Frameworks */ = {isa = PBXBuildFile; productRef = 72B5EE0000000000000000A2 /* BreezSdkSpark */; };
968FE1402DFB016B0053CD7F /* LDKNode in Frameworks */ = {isa = PBXBuildFile; productRef = 968FE13F2DFB016B0053CD7F /* LDKNode */; };
96DEA03A2DE8BBA1009932BF /* BitkitCore in Frameworks */ = {isa = PBXBuildFile; productRef = 96DEA0392DE8BBA1009932BF /* BitkitCore */; };
96DEA03C2DE8BBAB009932BF /* BitkitCore in Frameworks */ = {isa = PBXBuildFile; productRef = 96DEA03B2DE8BBAB009932BF /* BitkitCore */; };
Expand Down Expand Up @@ -74,6 +75,7 @@
/* End PBXCopyFilesBuildPhase section */

/* Begin PBXFileReference section */
B17C0F1A2EAE000000000001 /* Bitkit.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Bitkit.xcconfig; sourceTree = "<group>"; };
3D76260E4C9C4A53B1E4A001 /* CoreBluetooth.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreBluetooth.framework; path = System/Library/Frameworks/CoreBluetooth.framework; sourceTree = SDKROOT; };
4A319B4F2E8F24F2002B9AC9 /* BitkitWidgetExtension.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = BitkitWidgetExtension.appex; sourceTree = BUILT_PRODUCTS_DIR; };
4A319B502E8F24F2002B9AC9 /* WidgetKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = WidgetKit.framework; path = System/Library/Frameworks/WidgetKit.framework; sourceTree = SDKROOT; };
Expand Down Expand Up @@ -262,6 +264,7 @@
buildActionMask = 2147483647;
files = (
182817C12F59A7F10055A441 /* Paykit in Frameworks */,
72B5EE0000000000000000A3 /* BreezSdkSpark in Frameworks */,
3D76260F4C9C4A53B1E4A001 /* CoreBluetooth.framework in Frameworks */,
968FDF162DFAFE230053CD7F /* LDKNode in Frameworks */,
18D65E002EB964B500252335 /* VssRustClientFfi in Frameworks */,
Expand Down Expand Up @@ -302,6 +305,7 @@
96FE1F582C2DE6AA006D0C8B = {
isa = PBXGroup;
children = (
B17C0F1A2EAE000000000001 /* Bitkit.xcconfig */,
4A319B6E2E8F25F6002B9AC9 /* BitkitWidgetExtension.entitlements */,
96A44E912CEF5EA700FBACFF /* Bitkit */,
96A44F4A2CEF5F4B00FBACFF /* BitkitTests */,
Expand Down Expand Up @@ -378,6 +382,7 @@
isa = PBXNativeTarget;
buildConfigurationList = 96FE1F862C2DE6AC006D0C8B /* Build configuration list for PBXNativeTarget "Bitkit" */;
buildPhases = (
B17C0F1A2EAE000000000002 /* Check Breez API Key */,
96FE1F5D2C2DE6AA006D0C8B /* Sources */,
96FE1F5E2C2DE6AA006D0C8B /* Frameworks */,
96FE1F5F2C2DE6AA006D0C8B /* Resources */,
Expand All @@ -402,6 +407,7 @@
4AAB08C92E1FE77600BA63DF /* Lottie */,
18D65DFF2EB964B500252335 /* VssRustClientFfi */,
182817C02F59A7F10055A441 /* Paykit */,
72B5EE0000000000000000A2 /* BreezSdkSpark */,
);
productName = Bitkit;
productReference = 96FE1F612C2DE6AA006D0C8B /* Bitkit.app */;
Expand Down Expand Up @@ -511,6 +517,7 @@
4AAB08C82E1FE77600BA63DF /* XCRemoteSwiftPackageReference "lottie-ios" */,
18D65DFE2EB9649F00252335 /* XCRemoteSwiftPackageReference "vss-rust-client-ffi" */,
182817BF2F59A7F10055A441 /* XCRemoteSwiftPackageReference "paykit-rs" */,
72B5EE0000000000000000A1 /* XCRemoteSwiftPackageReference "breez-sdk-spark-swift" */,
);
productRefGroup = 96FE1F622C2DE6AA006D0C8B /* Products */;
projectDirPath = "";
Expand Down Expand Up @@ -565,6 +572,26 @@
/* End PBXResourcesBuildPhase section */

/* Begin PBXShellScriptBuildPhase section */
B17C0F1A2EAE000000000002 /* Check Breez API Key */ = {
isa = PBXShellScriptBuildPhase;
alwaysOutOfDate = 1;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
);
inputPaths = (
);
name = "Check Breez API Key";
outputFileListPaths = (
);
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "if [ \"$CONFIGURATION\" = \"Release\" ] && [ -z \"$(echo \"${BREEZ_API_KEY}\" | tr -d ' ')\" ]; then\n echo \"error: BREEZ_API_KEY is empty. Copy Secrets.xcconfig.template to Secrets.xcconfig and set the key before a Release build or archive (Docs/RELEASE.md).\"\n exit 1\nfi\n";
showEnvVarsInLog = 0;
};
751000000000000000000001 /* Generate Plural Localizations */ = {
isa = PBXShellScriptBuildPhase;
alwaysOutOfDate = 1;
Expand Down Expand Up @@ -944,6 +971,7 @@
};
96FE1F872C2DE6AC006D0C8B /* Debug */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = B17C0F1A2EAE000000000001 /* Bitkit.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
Expand Down Expand Up @@ -997,6 +1025,7 @@
};
96FE1F882C2DE6AC006D0C8B /* Release */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = B17C0F1A2EAE000000000001 /* Bitkit.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
Expand Down Expand Up @@ -1219,6 +1248,14 @@
version = 4.6.1;
};
};
72B5EE0000000000000000A1 /* XCRemoteSwiftPackageReference "breez-sdk-spark-swift" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/breez/breez-sdk-spark-swift";
requirement = {
kind = exactVersion;
version = 0.28.0;
};
};
968FE13E2DFB016B0053CD7F /* XCRemoteSwiftPackageReference "ldk-node" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/synonymdev/ldk-node";
Expand Down Expand Up @@ -1266,6 +1303,11 @@
package = 4AAB08C82E1FE77600BA63DF /* XCRemoteSwiftPackageReference "lottie-ios" */;
productName = Lottie;
};
72B5EE0000000000000000A2 /* BreezSdkSpark */ = {
isa = XCSwiftPackageProductDependency;
package = 72B5EE0000000000000000A1 /* XCRemoteSwiftPackageReference "breez-sdk-spark-swift" */;
productName = BreezSdkSpark;
};
9613018B2C5022D700878183 /* LDKNode */ = {
isa = XCSwiftPackageProductDependency;
package = 968FE13E2DFB016B0053CD7F /* XCRemoteSwiftPackageReference "ldk-node" */;
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

31 changes: 31 additions & 0 deletions Bitkit/AppScene.swift
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,16 @@ enum IncomingPaykitPaymentRequestPresentationDispatcher {
return IncomingPaykitPaymentRequestPresentationFeedback(paymentDetailsPendingWasRequested: wasRequested)
}

/// Ends a presentation the user asked for once its payment details fail to resolve, so the send sheet stops loading
/// and the user sees why; the request stays in Payment Requests to try again. Automatic presentations keep retrying.
static func finishRequestedPresentationAfterResolutionFailure(
for request: PaykitPaymentRequest,
with manager: PaykitPaymentRequestManager
) -> IncomingPaykitPaymentRequestPresentationFeedback? {
guard manager.requestedPresentationId == request.id else { return nil }
return finishPendingPrivateLink(for: request, with: manager)
}

static func handleStateChange(
from previous: IncomingPaykitPaymentRequestPresentationState,
to current: IncomingPaykitPaymentRequestPresentationState,
Expand Down Expand Up @@ -1799,6 +1809,20 @@ struct AppScene: View {
return
}
guard case let .opened(paymentTarget, privatePaymentContext, endpoints) = result else {
let isWaitingForUpdatedList = if case .waitingForUpdatedPaymentList = result {
true
} else {
false
}
if !isWaitingForUpdatedList,
let feedback = IncomingPaykitPaymentRequestPresentationDispatcher.finishRequestedPresentationAfterResolutionFailure(
for: request,
with: paykitPaymentRequestManager
)
{
presentIncomingPaykitPaymentRequestFeedback(feedback, for: request)
return
}
deferIncomingPaykitPaymentRequestPresentation(
request,
reason: result.incomingPaymentRequestFailureReason ?? .resolutionFailed
Expand Down Expand Up @@ -1926,6 +1950,13 @@ struct AppScene: View {
return
} catch {
guard isCurrentIncomingPaymentRequestPreparation(preparation) else { return }
if let feedback = IncomingPaykitPaymentRequestPresentationDispatcher.finishRequestedPresentationAfterResolutionFailure(
for: request,
with: paykitPaymentRequestManager
) {
presentIncomingPaykitPaymentRequestFeedback(feedback, for: request)
return
}
deferIncomingPaykitPaymentRequestPresentation(request, reason: .resolutionFailed)
return
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"images" : [
{
"filename" : "coin-stack-x.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 5 additions & 1 deletion Bitkit/Components/FeeDisplayRow.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,16 @@ import SwiftUI
struct FeeDisplayRow: View {
let label: String
let amount: UInt64
/// Shown before the amount when it is a bound or an estimate ("up to", "≈").
var prefix: String?
/// Shimmers the amount while it is being priced.
var isLoading = false

var body: some View {
VStack(alignment: .leading, spacing: 0) {
CaptionMText(label)
.padding(.bottom, 8)
MoneyText(sats: Int(amount), size: .bodySSB, symbol: true)
MoneyText(sats: Int(amount), size: .bodySSB, symbol: true, prefix: prefix, shimmer: isLoading)
.padding(.bottom, 16)
Divider()
}
Expand Down
62 changes: 53 additions & 9 deletions Bitkit/Components/FeeItem.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,60 @@ import BitkitCore
import SwiftUI

struct FeeItem: View {
let speed: TransactionSpeed
let title: String
let subtitle: String
let iconName: String
let iconColor: Color
let amount: UInt64
/// Shown before the amount when it is a bound or an estimate ("up to", "≈").
var amountPrefix: String?
let isSelected: Bool
let isDisabled: Bool
/// When set (e.g. for custom speed with fee estimates), shown instead of `speed.range` as the subtitle.
var rangeOverride: String?
let onPress: () -> Void

@EnvironmentObject var currency: CurrencyViewModel

private var rangeText: String {
rangeOverride ?? speed.range
/// - Parameter rangeOverride: When set (e.g. for custom speed with fee estimates), shown instead of `speed.range`.
init(
speed: TransactionSpeed,
amount: UInt64,
isSelected: Bool,
isDisabled: Bool,
rangeOverride: String? = nil,
onPress: @escaping () -> Void
) {
self.init(
title: speed.title,
subtitle: rangeOverride ?? speed.range,
iconName: speed.iconName,
iconColor: speed.iconColor,
amount: amount,
isSelected: isSelected,
isDisabled: isDisabled,
onPress: onPress
)
}

init(
title: String,
subtitle: String,
iconName: String,
iconColor: Color,
amount: UInt64,
amountPrefix: String? = nil,
isSelected: Bool,
isDisabled: Bool,
onPress: @escaping () -> Void
) {
self.title = title
self.subtitle = subtitle
self.iconName = iconName
self.iconColor = iconColor
self.amount = amount
self.amountPrefix = amountPrefix
self.isSelected = isSelected
self.isDisabled = isDisabled
self.onPress = onPress
}

var body: some View {
Expand All @@ -23,14 +65,14 @@ struct FeeItem: View {

Button(action: onPress) {
HStack(spacing: 16) {
Image(speed.iconName)
.foregroundColor(isDisabled ? .gray : speed.iconColor)
Image(iconName)
.foregroundColor(isDisabled ? .gray : iconColor)
.frame(width: 32, height: 32)

HStack {
VStack(alignment: .leading, spacing: 0) {
BodyMSBText(speed.title, textColor: isDisabled ? .gray3 : .textPrimary)
BodySSBText(rangeText, textColor: isDisabled ? .gray3 : .textSecondary)
BodyMSBText(title, textColor: isDisabled ? .gray3 : .textPrimary)
BodySSBText(subtitle, textColor: isDisabled ? .gray3 : .textSecondary)
}

Spacer()
Expand All @@ -42,6 +84,7 @@ struct FeeItem: View {
unitType: .primary,
size: .bodyMSB,
symbol: true,
prefix: amountPrefix,
color: isDisabled ? .gray3 : .textPrimary
)

Expand All @@ -50,6 +93,7 @@ struct FeeItem: View {
unitType: .secondary,
size: .bodySSB,
symbol: true,
prefix: amountPrefix,
color: isDisabled ? .gray3 : .textSecondary
)
}
Expand Down
Loading
Loading