More conditions to account for

This commit is contained in:
pokkst 2023-03-11 18:35:36 -06:00
parent 2cc6942e27
commit ae4a8724e8
No known key found for this signature in database
GPG key ID: 90C2ED85E67A50FF

View file

@ -202,6 +202,17 @@ public class SendFragment extends Fragment {
return true; return true;
} }
private boolean destsHasPaymentId() {
List<Pair<String, String>> dests = getRawDests();
for(Pair<String, String> dest : dests) {
String address = dest.component1();
UriData uriData = UriData.parse(address);
if(uriData == null) return false;
if(uriData.hasPaymentId()) return true;
}
return false;
}
private void bindObservers() { private void bindObservers() {
mViewModel.sendingMax.observe(getViewLifecycleOwner(), sendingMax -> { mViewModel.sendingMax.observe(getViewLifecycleOwner(), sendingMax -> {
if (mViewModel.pendingTransaction.getValue() == null) { if (mViewModel.pendingTransaction.getValue() == null) {
@ -216,7 +227,7 @@ public class SendFragment extends Fragment {
}); });
mViewModel.showAddOutputButton.observe(getViewLifecycleOwner(), show -> { mViewModel.showAddOutputButton.observe(getViewLifecycleOwner(), show -> {
setAddOutputButtonVisibility(show ? View.VISIBLE : View.INVISIBLE); setAddOutputButtonVisibility((show && !destsHasPaymentId()) ? View.VISIBLE : View.INVISIBLE);
}); });
mViewModel.pendingTransaction.observe(getViewLifecycleOwner(), pendingTx -> { mViewModel.pendingTransaction.observe(getViewLifecycleOwner(), pendingTx -> {