diff --git a/phoenix-ios/phoenix-ios/Localizable.xcstrings b/phoenix-ios/phoenix-ios/Localizable.xcstrings index b10ba290e..f378a7b13 100644 --- a/phoenix-ios/phoenix-ios/Localizable.xcstrings +++ b/phoenix-ios/phoenix-ios/Localizable.xcstrings @@ -9103,6 +9103,9 @@ } } } + }, + "BLIP 42 (DEBUG build only)" : { + }, "Block height" : { "localizations" : { @@ -12519,6 +12522,9 @@ } } } + }, + "contact secret" : { + }, "Contact support if needed." : { "localizations" : { @@ -29891,6 +29897,12 @@ } } } + }, + "payer address" : { + + }, + "payer offer" : { + }, "Payment" : { "localizations" : { diff --git a/phoenix-ios/phoenix-ios/views/inspect/DetailsView.swift b/phoenix-ios/phoenix-ios/views/inspect/DetailsView.swift index 5011b1816..391952d6f 100644 --- a/phoenix-ios/phoenix-ios/views/inspect/DetailsView.swift +++ b/phoenix-ios/phoenix-ios/views/inspect/DetailsView.swift @@ -180,6 +180,19 @@ fileprivate struct DetailsInfoGrid: InfoGridView { paymentRequest_invoice(paymentRequest) } } + + #if DEBUG + if let metadata = incomingPayment.incomingOfferMetadataV2() { + + InlineSection { + header("BLIP 42 (DEBUG build only)") + } content: { + blip42_contactSecret(metadata.contactSecret) + blip42_offer(metadata.payerOffer) + blip42_address(metadata.payerAddress) + } + } + #endif if let received = incomingPayment.received { @@ -274,6 +287,19 @@ fileprivate struct DetailsInfoGrid: InfoGridView { } } + #if DEBUG + if let request = outgoingPayment.outgoingInvoiceRequest() { + + InlineSection { + header("BLIP 42 (DEBUG build only)") + } content: { + blip42_contactSecret(request.contactSecret) + blip42_offer(request.payerOffer) + blip42_address(request.payerAddress) + } + } + #endif + } else if let spliceOut = outgoingPayment as? Lightning_kmpSpliceOutgoingPayment { InlineSection { @@ -1163,6 +1189,81 @@ fileprivate struct DetailsInfoGrid: InfoGridView { common_channelId(payment.channelId) } + @ViewBuilder + func blip42_contactSecret( + _ secret: Bitcoin_kmpByteVector32? + ) -> some View { + let identifier: String = #function + + InfoGridRowWrapper( + identifier: identifier, + keyColumnWidth: keyColumnWidth(identifier: identifier) + ) { + keyColumn("contact secret") + + } valueColumn: { + + if let str = secret?.toHex() { + Text(str) + .lineLimit(2) + .truncationMode(.middle) + } else { + Text(verbatim: "") + .foregroundStyle(Color.secondary) + } + } + } + + @ViewBuilder + func blip42_offer( + _ offer: Lightning_kmpOfferTypesOffer? + ) -> some View { + let identifier: String = #function + + InfoGridRowWrapper( + identifier: identifier, + keyColumnWidth: keyColumnWidth(identifier: identifier) + ) { + keyColumn("payer offer") + + } valueColumn: { + + if let str = offer?.encode() { + Text(str) + .lineLimit(2) + .truncationMode(.middle) + } else { + Text(verbatim: "") + .foregroundStyle(Color.secondary) + } + } + } + + @ViewBuilder + func blip42_address( + _ address: Lightning_kmpContactAddress? + ) -> some View { + let identifier: String = #function + + InfoGridRowWrapper( + identifier: identifier, + keyColumnWidth: keyColumnWidth(identifier: identifier) + ) { + keyColumn("payer address") + + } valueColumn: { + + if let str = address?.description() { + Text(str) + .lineLimit(2) + .truncationMode(.middle) + } else { + Text(verbatim: "") + .foregroundStyle(Color.secondary) + } + } + } + // -------------------------------------------------- // MARK: View Builders: Common Rows // --------------------------------------------------