|
@ -27,45 +27,59 @@ struct SelectWalletView: View { |
|
|
|
|
|
|
|
|
var body: some View { |
|
|
var body: some View { |
|
|
NavigationView { |
|
|
NavigationView { |
|
|
VStack(alignment: .leading) { |
|
|
Form { |
|
|
Section("Invoice") { |
|
|
VStack(alignment: .leading) { |
|
|
HStack { |
|
|
Text("Copy invoice") |
|
|
Text(invoice) |
|
|
.bold() |
|
|
|
|
|
.font(.title3) |
|
|
Image(systemName: self.invoice_copied ? "checkmark.circle" : "doc.on.doc") |
|
|
.multilineTextAlignment(.center) |
|
|
} |
|
|
.padding([.bottom, .top], 8) |
|
|
.clipShape(RoundedRectangle(cornerRadius: 5)).onTapGesture { |
|
|
HStack { |
|
|
UIPasteboard.general.string = invoice |
|
|
Text(invoice).font(.body) |
|
|
self.invoice_copied = true |
|
|
.multilineTextAlignment(.center) |
|
|
generator.impactOccurred() |
|
|
.lineLimit(3) |
|
|
} |
|
|
.truncationMode(.tail) |
|
|
|
|
|
|
|
|
|
|
|
Image(systemName: self.invoice_copied ? "checkmark.circle" : "doc.on.doc") |
|
|
|
|
|
} |
|
|
|
|
|
.clipShape(RoundedRectangle(cornerRadius: 5)).onTapGesture { |
|
|
|
|
|
UIPasteboard.general.string = invoice |
|
|
|
|
|
self.invoice_copied = true |
|
|
|
|
|
generator.impactOccurred() |
|
|
|
|
|
} |
|
|
|
|
|
Spacer() |
|
|
|
|
|
Text("Select a lightning wallet") |
|
|
|
|
|
.bold() |
|
|
|
|
|
.font(.title3) |
|
|
|
|
|
.multilineTextAlignment(.center) |
|
|
|
|
|
.padding([.bottom], 8) |
|
|
|
|
|
ForEach(walletItems) { wallet in |
|
|
|
|
|
HStack(spacing: 20) { |
|
|
|
|
|
Image(wallet.image) |
|
|
|
|
|
.resizable() |
|
|
|
|
|
.frame(width: 32.0, height: 32.0,alignment: .center) |
|
|
|
|
|
.cornerRadius(5) |
|
|
|
|
|
Text("\(wallet.name)") |
|
|
|
|
|
}.onTapGesture { |
|
|
|
|
|
if let url = URL(string: "\(wallet.link)\(invoice)"), UIApplication.shared.canOpenURL(url) { |
|
|
|
|
|
openURL(url) |
|
|
|
|
|
} else { |
|
|
|
|
|
if let url = URL(string: wallet.appStoreLink), UIApplication.shared.canOpenURL(url) { |
|
|
|
|
|
openURL(url) |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
Divider() |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
ForEach(walletItems) { wallet in |
|
|
.navigationBarTitle(Text("Pay the lightning invoice"), displayMode: .inline) |
|
|
HStack(spacing: 20) { |
|
|
|
|
|
Image(wallet.image) |
|
|
|
|
|
.resizable() |
|
|
|
|
|
.frame(width: 32.0, height: 32.0,alignment: .center) |
|
|
|
|
|
.cornerRadius(5) |
|
|
|
|
|
Text("\(wallet.name)") |
|
|
|
|
|
}.onTapGesture { |
|
|
|
|
|
if let url = URL(string: "\(wallet.link)\(invoice)"), UIApplication.shared.canOpenURL(url) { |
|
|
|
|
|
openURL(url) |
|
|
|
|
|
} else { |
|
|
|
|
|
if let url = URL(string: wallet.appStoreLink), UIApplication.shared.canOpenURL(url) { |
|
|
|
|
|
openURL(url) |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
Divider() |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
.navigationBarTitle(Text("Select Wallet"), displayMode: .inline) |
|
|
|
|
|
.navigationBarItems(trailing: Button(action: { |
|
|
.navigationBarItems(trailing: Button(action: { |
|
|
self.show_select_wallet = false |
|
|
self.show_select_wallet = false |
|
|
}) { |
|
|
}) { |
|
|
Text("Done").bold() |
|
|
Text("Done").bold() |
|
|
}) |
|
|
}) |
|
|
}.padding([.leading, .trailing], 6) |
|
|
} |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|