correct address entry message (#409)

This commit is contained in:
m2049r 2018-09-17 17:56:04 +02:00 committed by GitHub
parent 45ec3198a0
commit b0629e46e8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 7 deletions

View File

@ -28,6 +28,7 @@ import java.util.Map;
import timber.log.Timber;
public class BarcodeData {
public static final String XMR_SCHEME = "monero:";
public static final String XMR_PAYMENTID = "tx_payment_id";
public static final String XMR_AMOUNT = "tx_amount";
@ -43,13 +44,19 @@ public class BarcodeData {
XMR, BTC
}
public enum Security {
NORMAL,
OA_NO_DNSSEC,
OA_DNSSEC
}
public Asset asset = null;
public String addressName = null;
public String address = null;
public String paymentId = null;
public String amount = null;
public String description = null;
public boolean isSecure = true;
public Security security = Security.NORMAL;
public BarcodeData(String uri) {
this.asset = asset;
@ -86,8 +93,8 @@ public class BarcodeData {
addressName = name;
}
public void isSecure(boolean isSecure) {
this.isSecure = isSecure;
public void setSecurity(Security security) {
this.security = security;
}
public Uri getUri() {

View File

@ -252,7 +252,7 @@ public class SendAddressWizardFragment extends SendWizardFragment {
BarcodeData barcodeData = dataMap.get(BarcodeData.Asset.XMR);
if (barcodeData == null) barcodeData = dataMap.get(BarcodeData.Asset.BTC);
if (barcodeData != null) {
Timber.d("DNSSEC=%b, %s", barcodeData.isSecure, barcodeData.address);
Timber.d("Security=%s, %s", barcodeData.security.toString(), barcodeData.address);
processScannedData(barcodeData);
etDummy.requestFocus();
Helper.hideKeyboard(getActivity());
@ -388,9 +388,9 @@ public class SendAddressWizardFragment extends SendWizardFragment {
if (scannedAddress != null) {
etAddress.getEditText().setText(scannedAddress);
if (checkAddress()) {
if (!barcodeData.isSecure)
if (barcodeData.security == BarcodeData.Security.OA_NO_DNSSEC)
etAddress.setError(getString(R.string.send_address_no_dnssec));
else
else if (barcodeData.security == BarcodeData.Security.OA_DNSSEC)
etAddress.setError(getString(R.string.send_address_openalias));
}
} else {

View File

@ -142,7 +142,7 @@ public class OpenAliasHelper {
for (String txt : txts) {
BarcodeData bc = BarcodeData.parseOpenAlias(txt);
if (bc != null) {
bc.isSecure(dnssec);
bc.setSecurity(dnssec ? BarcodeData.Security.OA_DNSSEC : BarcodeData.Security.OA_NO_DNSSEC);
if (!dataMap.containsKey(bc.asset)) {
dataMap.put(bc.asset, bc);
}