Skip to content

Commit

Permalink
Copy addresses as URIs to avoid confusion
Browse files Browse the repository at this point in the history
  • Loading branch information
erasmospunk committed Apr 16, 2016
1 parent ef90006 commit 5fc3748
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 5 deletions.
11 changes: 11 additions & 0 deletions core/src/main/java/com/coinomi/core/uri/CoinURI.java
Original file line number Diff line number Diff line change
Expand Up @@ -504,6 +504,17 @@ public String toString() {
return builder.toString();
}

/**
* Simple coin URI builder using known good fields.
*
* @param address The coin address
* @return A String containing the coin URI
*/
public static String convertToCoinURI(AbstractAddress address) {
return convertToCoinURI(address, null, null, null, null);

}

/**
* Simple coin URI builder using known good fields.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -238,10 +238,10 @@ public void onPause() {
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.action_share:
UiUtils.share(getActivity(), receiveAddress.toString());
UiUtils.share(getActivity(), getUri());
return true;
case R.id.action_copy:
UiUtils.copy(getActivity(), receiveAddress.toString());
UiUtils.copy(getActivity(), getUri());
return true;
case R.id.action_new_address:
showNewAddressDialog();
Expand Down Expand Up @@ -303,10 +303,10 @@ public void updateView() {

updateLabel();

updateQrCode(getQrContent());
updateQrCode(getUri());
}

private String getQrContent() {
private String getUri() {
if (type instanceof BitFamily) {
return CoinURI.convertToCoinURI(receiveAddress, amount, label, message);
} else if (type instanceof NxtFamily){
Expand Down
2 changes: 1 addition & 1 deletion wallet/src/main/java/com/coinomi/wallet/util/UiUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ public boolean onActionItemClicked(ActionMode mode, MenuItem menuItem) {
mode.finish();
return true;
case R.id.action_copy:
UiUtils.copy(context, address.toString());
UiUtils.copy(context, CoinURI.convertToCoinURI(address));
mode.finish();
return true;
}
Expand Down

0 comments on commit 5fc3748

Please sign in to comment.