mirror of
https://github.com/m2049r/xmrwallet
synced 2024-11-28 17:43:22 +01:00
correct address entry message (#409)
This commit is contained in:
parent
45ec3198a0
commit
b0629e46e8
@ -28,6 +28,7 @@ import java.util.Map;
|
|||||||
import timber.log.Timber;
|
import timber.log.Timber;
|
||||||
|
|
||||||
public class BarcodeData {
|
public class BarcodeData {
|
||||||
|
|
||||||
public static final String XMR_SCHEME = "monero:";
|
public static final String XMR_SCHEME = "monero:";
|
||||||
public static final String XMR_PAYMENTID = "tx_payment_id";
|
public static final String XMR_PAYMENTID = "tx_payment_id";
|
||||||
public static final String XMR_AMOUNT = "tx_amount";
|
public static final String XMR_AMOUNT = "tx_amount";
|
||||||
@ -43,13 +44,19 @@ public class BarcodeData {
|
|||||||
XMR, BTC
|
XMR, BTC
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public enum Security {
|
||||||
|
NORMAL,
|
||||||
|
OA_NO_DNSSEC,
|
||||||
|
OA_DNSSEC
|
||||||
|
}
|
||||||
|
|
||||||
public Asset asset = null;
|
public Asset asset = null;
|
||||||
public String addressName = null;
|
public String addressName = null;
|
||||||
public String address = null;
|
public String address = null;
|
||||||
public String paymentId = null;
|
public String paymentId = null;
|
||||||
public String amount = null;
|
public String amount = null;
|
||||||
public String description = null;
|
public String description = null;
|
||||||
public boolean isSecure = true;
|
public Security security = Security.NORMAL;
|
||||||
|
|
||||||
public BarcodeData(String uri) {
|
public BarcodeData(String uri) {
|
||||||
this.asset = asset;
|
this.asset = asset;
|
||||||
@ -86,8 +93,8 @@ public class BarcodeData {
|
|||||||
addressName = name;
|
addressName = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void isSecure(boolean isSecure) {
|
public void setSecurity(Security security) {
|
||||||
this.isSecure = isSecure;
|
this.security = security;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Uri getUri() {
|
public Uri getUri() {
|
||||||
|
@ -252,7 +252,7 @@ public class SendAddressWizardFragment extends SendWizardFragment {
|
|||||||
BarcodeData barcodeData = dataMap.get(BarcodeData.Asset.XMR);
|
BarcodeData barcodeData = dataMap.get(BarcodeData.Asset.XMR);
|
||||||
if (barcodeData == null) barcodeData = dataMap.get(BarcodeData.Asset.BTC);
|
if (barcodeData == null) barcodeData = dataMap.get(BarcodeData.Asset.BTC);
|
||||||
if (barcodeData != null) {
|
if (barcodeData != null) {
|
||||||
Timber.d("DNSSEC=%b, %s", barcodeData.isSecure, barcodeData.address);
|
Timber.d("Security=%s, %s", barcodeData.security.toString(), barcodeData.address);
|
||||||
processScannedData(barcodeData);
|
processScannedData(barcodeData);
|
||||||
etDummy.requestFocus();
|
etDummy.requestFocus();
|
||||||
Helper.hideKeyboard(getActivity());
|
Helper.hideKeyboard(getActivity());
|
||||||
@ -388,9 +388,9 @@ public class SendAddressWizardFragment extends SendWizardFragment {
|
|||||||
if (scannedAddress != null) {
|
if (scannedAddress != null) {
|
||||||
etAddress.getEditText().setText(scannedAddress);
|
etAddress.getEditText().setText(scannedAddress);
|
||||||
if (checkAddress()) {
|
if (checkAddress()) {
|
||||||
if (!barcodeData.isSecure)
|
if (barcodeData.security == BarcodeData.Security.OA_NO_DNSSEC)
|
||||||
etAddress.setError(getString(R.string.send_address_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));
|
etAddress.setError(getString(R.string.send_address_openalias));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -142,7 +142,7 @@ public class OpenAliasHelper {
|
|||||||
for (String txt : txts) {
|
for (String txt : txts) {
|
||||||
BarcodeData bc = BarcodeData.parseOpenAlias(txt);
|
BarcodeData bc = BarcodeData.parseOpenAlias(txt);
|
||||||
if (bc != null) {
|
if (bc != null) {
|
||||||
bc.isSecure(dnssec);
|
bc.setSecurity(dnssec ? BarcodeData.Security.OA_DNSSEC : BarcodeData.Security.OA_NO_DNSSEC);
|
||||||
if (!dataMap.containsKey(bc.asset)) {
|
if (!dataMap.containsKey(bc.asset)) {
|
||||||
dataMap.put(bc.asset, bc);
|
dataMap.put(bc.asset, bc);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user