Permalink
Browse files

2.5.8

  • Loading branch information...
1 parent 8dc7c55 commit fea9edff2069b676b70c1b925bb8329775d487dd @DanielWeigl DanielWeigl committed Dec 3, 2015
Showing with 3,295 additions and 2,001 deletions.
  1. +1 −0 README.md
  2. +4 −4 public/bitlib/src/main/java/com/megiontechnologies/Bitcoins.java
  3. +28 −18 public/bitlib/src/main/java/com/mrd/bitlib/StandardTransactionBuilder.java
  4. +1 −0 public/bitlib/src/main/java/com/mrd/bitlib/crypto/PrivateKeyRing.java
  5. +1 −0 public/bitlib/src/main/java/com/mrd/bitlib/model/OutPoint.java
  6. +8 −0 public/bitlib/src/main/java/com/mrd/bitlib/model/Transaction.java
  7. +2 −6 public/btchip/src/main/java/com/btchip/BTChipDongle.java
  8. +4 −1 public/coinapult/build.gradle
  9. +1 −0 public/lt-api/src/main/java/com/mycelium/lt/api/model/ChatEntry.java
  10. +9 −2 public/mbw/build.gradle
  11. +5 −0 public/mbw/res-sources/licenses.md
  12. BIN public/mbw/res-sources/localTraderLocalOnly.png
  13. BIN public/mbw/res-sources/localTraderLocalOnly.xcf
  14. +13 −0 public/mbw/res-sources/updateDrawables.sh
  15. +1 −0 public/mbw/src/main/AndroidManifest.xml
  16. +3 −2 public/mbw/src/main/java/com/mycelium/wallet/AddressBookManager.java
  17. +1 −1 public/mbw/src/main/java/com/mycelium/wallet/{BitidKeyDerivation.java → BitIdKeyDerivation.java}
  18. +25 −15 public/mbw/src/main/java/com/mycelium/wallet/BitcoinUri.java
  19. +1 −1 public/mbw/src/main/java/com/mycelium/wallet/ClearPinDialog.java
  20. +0 −2 public/mbw/src/main/java/com/mycelium/wallet/Constants.java
  21. +99 −79 public/mbw/src/main/java/com/mycelium/wallet/CurrencySwitcher.java
  22. +10 −3 public/mbw/src/main/java/com/mycelium/wallet/DataExport.java
  23. +4 −11 public/mbw/src/main/java/com/mycelium/wallet/ExchangeRateManager.java
  24. +2 −1 public/mbw/src/main/java/com/mycelium/wallet/HttpErrorCollector.java
  25. +1 −1 public/mbw/src/main/java/com/mycelium/wallet/LedgerPin2FADialog.java
  26. +1 −1 public/mbw/src/main/java/com/mycelium/wallet/MbwEnvironment.java
  27. +67 −35 public/mbw/src/main/java/com/mycelium/wallet/MbwManager.java
  28. +0 −42 public/mbw/src/main/java/com/mycelium/wallet/StringHandleConfig.java
  29. +118 −41 public/mbw/src/main/java/com/mycelium/wallet/Utils.java
  30. +1 −1 public/mbw/src/main/java/com/mycelium/wallet/VersionManager.java
  31. +7 −105 public/mbw/src/main/java/com/mycelium/wallet/activity/AddAccountActivity.java
  32. +250 −0 public/mbw/src/main/java/com/mycelium/wallet/activity/AddCoinapultAccountActivity.java
  33. +140 −161 public/mbw/src/main/java/com/mycelium/wallet/activity/GetAmountActivity.java
  34. +1 −1 public/mbw/src/main/java/com/mycelium/wallet/activity/WordAutoCompleterFragment.java
  35. +26 −25 public/mbw/src/main/java/com/mycelium/wallet/activity/export/ExportAsQrCodeActivity.java
  36. +3 −4 public/mbw/src/main/java/com/mycelium/wallet/activity/export/MrdDecryptDataActivity.java
  37. +17 −19 public/mbw/src/main/java/com/mycelium/wallet/activity/main/BalanceFragment.java
  38. +1 −1 public/mbw/src/main/java/com/mycelium/wallet/activity/main/BalanceMasterFragment.java
  39. +32 −16 public/mbw/src/main/java/com/mycelium/wallet/activity/main/TransactionArrayAdapter.java
  40. +1 −4 public/mbw/src/main/java/com/mycelium/wallet/activity/main/TransactionHistoryFragment.java
  41. +61 −47 public/mbw/src/main/java/com/mycelium/wallet/activity/modern/AccountsFragment.java
  42. +1 −1 public/mbw/src/main/java/com/mycelium/wallet/activity/modern/DarkThemeChangeLog.java
  43. +0 −2 public/mbw/src/main/java/com/mycelium/wallet/activity/modern/HDSigningActivity.java
  44. +43 −21 public/mbw/src/main/java/com/mycelium/wallet/activity/modern/ModernMain.java
  45. +5 −3 public/mbw/src/main/java/com/mycelium/wallet/activity/modern/RecordRowBuilder.java
  46. +8 −4 public/mbw/src/main/java/com/mycelium/wallet/activity/pop/PopActivity.java
  47. +1 −1 public/mbw/src/main/java/com/mycelium/wallet/activity/pop/PopSelectTransactionActivity.java
  48. +9 −1 public/mbw/src/main/java/com/mycelium/wallet/activity/pop/PopUtils.java
  49. +72 −48 public/mbw/src/main/java/com/mycelium/wallet/activity/receive/ReceiveCoinsActivity.java
  50. +6 −5 public/mbw/src/main/java/com/mycelium/wallet/activity/send/InstantWalletActivity.java
  51. +345 −299 public/mbw/src/main/java/com/mycelium/wallet/activity/send/SendMainActivity.java
  52. +5 −1 public/mbw/src/main/java/com/mycelium/wallet/activity/send/VerifyPaymentRequestActivity.java
  53. +4 −9 public/mbw/src/main/java/com/mycelium/wallet/activity/settings/SetLocalCurrencyActivity.java
  54. +2 −3 public/mbw/src/main/java/com/mycelium/wallet/activity/settings/SettingsActivity.java
  55. +1 −1 public/mbw/src/main/java/com/mycelium/wallet/activity/util/MasterseedScanManager.java
  56. +1 −1 public/mbw/src/main/java/com/mycelium/wallet/activity/util/ToggleableCurrencyButton.java
  57. +40 −31 public/mbw/src/main/java/com/mycelium/wallet/activity/util/ToggleableCurrencyDisplay.java
  58. +3 −2 public/mbw/src/main/java/com/mycelium/wallet/bitid/BitIDAuthenticationActivity.java
  59. +2 −7 public/mbw/src/main/java/com/mycelium/wallet/bitid/ExternalService.java
  60. +425 −358 ...c/mbw/src/main/java/com/mycelium/wallet/{CoinapultManager.java → coinapult/CoinapultAccount.java}
  61. +376 −0 public/mbw/src/main/java/com/mycelium/wallet/coinapult/CoinapultManager.java
  62. +4 −3 public/mbw/src/main/java/com/mycelium/wallet/{ → coinapult}/CoinapultTransactionSummary.java
  63. +39 −0 public/mbw/src/main/java/com/mycelium/wallet/event/ExtraAccountsChanged.java
  64. +0 −175 public/mbw/src/main/java/com/mycelium/wallet/external/cashila/activity/BcdCodedSepaData.java
  65. +3 −56 public/mbw/src/main/java/com/mycelium/wallet/external/cashila/activity/CashilaNewFragment.java
  66. +0 −7 public/mbw/src/main/java/com/mycelium/wallet/external/cashila/activity/CashilaPaymentsActivity.java
  67. +0 −2 public/mbw/src/main/java/com/mycelium/wallet/external/cashila/activity/CashilaPendingFragment.java
  68. +2 −4 public/mbw/src/main/java/com/mycelium/wallet/lt/activity/ChangeLocationActivity.java
  69. +1 −1 public/mbw/src/main/java/com/mycelium/wallet/lt/activity/MyInfoFragment.java
  70. +4 −4 public/mbw/src/main/java/com/mycelium/wallet/lt/activity/SendRequestActivity.java
  71. +51 −28 public/mbw/src/main/java/com/mycelium/wallet/lt/activity/TradeActivity.java
  72. +8 −10 public/mbw/src/main/java/com/mycelium/wallet/lt/activity/TradeHistoryFragment.java
  73. +1 −1 public/mbw/src/main/java/com/mycelium/wallet/lt/activity/TraderInfoAdapter.java
  74. +1 −1 public/mbw/src/main/java/com/mycelium/wallet/lt/activity/ViewTraderInfoActivity.java
  75. +2 −3 public/mbw/src/main/java/com/mycelium/wallet/lt/activity/sell/CreateOrEditAdActivity.java
  76. +40 −30 public/mbw/src/main/java/com/mycelium/wallet/persistence/MetadataStorage.java
  77. +1 −1 public/mbw/src/main/java/com/mycelium/wallet/persistence/PersistedOutput.java
  78. +1 −0 public/mbw/src/main/java/com/mycelium/wallet/persistence/TradeSessionDb.java
  79. +10 −10 public/mbw/src/main/java/crl/android/pdfwriter/Page.java
  80. BIN public/mbw/src/main/res/drawable-hdpi/lt_local_only_warning.png
  81. BIN public/mbw/src/main/res/drawable-ldpi/lt_local_only_warning.png
  82. BIN public/mbw/src/main/res/drawable-mdpi/lt_local_only_warning.png
  83. BIN public/mbw/src/main/res/drawable-xhdpi/lt_local_only_warning.png
  84. BIN public/mbw/src/main/res/drawable-xxhdpi/lt_local_only_warning.png
  85. +2 −2 public/mbw/src/main/res/layout/add_account_activity.xml
  86. +98 −0 public/mbw/src/main/res/layout/add_coinapult_account_activity.xml
  87. +18 −7 public/mbw/src/main/res/layout/ext_coinapult_tos.xml
  88. +23 −4 public/mbw/src/main/res/layout/lt_chat_entry_row.xml
  89. +1 −1 public/mbw/src/main/res/layout/lt_trader_info_row.xml
  90. +1 −1 public/mbw/src/main/res/layout/toggleable_currency_display.xml
  91. +1 −1 public/mbw/src/main/res/layout/transaction_row.xml
  92. +2 −2 public/mbw/src/main/res/menu/record_options_menu_global.xml
  93. +2 −2 public/mbw/src/main/res/menu/record_options_menu_set_coinapult_mail.xml
  94. +2 −2 public/mbw/src/main/res/values-de/strings.xml
  95. +10 −11 public/mbw/src/main/res/values-el/strings.xml
  96. +10 −11 public/mbw/src/main/res/values-fr/strings.xml
  97. +5 −5 public/mbw/src/main/res/values-sq/strings.xml
  98. +22 −19 public/mbw/src/main/res/values/strings.xml
  99. +2 −1 public/mbw/src/main/res/values/strings_nolocale.xml
  100. +9 −2 public/mbw/src/main/res/xml/changelog_master.xml
  101. +6 −6 public/mbwlib/src/main/java/com/mycelium/paymentrequest/PaymentRequestInformation.java
  102. +1 −1 public/wapi/src/main/java/com/mycelium/wapi/model/TransactionEx.java
  103. +5 −2 public/wapi/src/main/java/com/mycelium/wapi/model/TransactionSummary.java
  104. +2 −2 public/wapi/src/main/java/com/mycelium/wapi/sample/CmdLineWallet.java
  105. +56 −33 public/wapi/src/main/java/com/mycelium/wapi/wallet/AbstractAccount.java
  106. +47 −0 public/wapi/src/main/java/com/mycelium/wapi/wallet/AccountProvider.java
  107. +8 −0 public/wapi/src/main/java/com/mycelium/wapi/wallet/WalletAccount.java
  108. +83 −55 public/wapi/src/main/java/com/mycelium/wapi/wallet/WalletManager.java
  109. +3 −0 public/wapi/src/main/java/com/mycelium/wapi/wallet/currency/BitcoinValue.java
  110. +46 −0 public/wapi/src/main/java/com/mycelium/wapi/wallet/currency/CurrencySum.java
  111. +84 −14 public/wapi/src/main/java/com/mycelium/wapi/wallet/currency/CurrencyValue.java
  112. +5 −0 public/wapi/src/main/java/com/mycelium/wapi/wallet/currency/ExactBitcoinValue.java
  113. +6 −1 public/wapi/src/main/java/com/mycelium/wapi/wallet/currency/ExactCurrencyValue.java
  114. +1 −1 public/wapi/src/main/java/com/mycelium/wapi/wallet/currency/ExactFiatValue.java
  115. +11 −2 public/wapi/src/main/java/com/mycelium/wapi/wallet/currency/ExchangeBasedBitcoinValue.java
  116. +116 −27 public/wapi/src/main/java/com/mycelium/wapi/wallet/currency/ExchangeBasedCurrencyValue.java
  117. +6 −0 public/wapi/src/main/java/com/mycelium/wapi/wallet/currency/ExchangeBasedFiatValue.java
  118. +123 −0 public/wapi/src/test/java/com/mycelium/wapi/wallet/currency/CurrencySumTest.java
  119. +11 −2 public/wapi/src/test/java/com/mycelium/wapi/wallet/currency/CurrencyValueTest.java
View
@@ -107,6 +107,7 @@ Authors
- Dmitry Murashchik
- Constantin Vennekel
- Leo Wandersleb
+ - Daniel Krawisz
Credits
=======
@@ -123,9 +123,9 @@ public BigDecimal multiply(BigDecimal pricePerBtc) {
return toBigDecimal().multiply(BigDecimal.valueOf(satoshis));
}
- protected Bitcoins parse(String input) {
- return Bitcoins.valueOf(input);
- }
+ protected Bitcoins parse(String input) {
+ return Bitcoins.valueOf(input);
+ }
@Override
public String toString() {
@@ -201,4 +201,4 @@ private static long roundToSignificantFigures(long num, int n) {
return ret;
}
-}
+}
@@ -111,8 +111,8 @@ public SigningRequest(PublicKey publicKey, Sha256Hash toSign) {
return _funding;
}
- protected UnsignedTransaction(List<TransactionOutput> outputs, List<UnspentTransactionOutput> funding,
- IPublicKeyRing keyRing, NetworkParameters network) {
+ public UnsignedTransaction(List<TransactionOutput> outputs, List<UnspentTransactionOutput> funding,
+ IPublicKeyRing keyRing, NetworkParameters network) {
_network = network;
_outputs = outputs.toArray(new TransactionOutput[]{});
_funding = funding.toArray(new UnspentTransactionOutput[]{});
@@ -251,7 +251,7 @@ public void addOutputs(OutputList outputs) throws OutputTooSmallException {
}
}
- private static TransactionOutput createOutput(Address sendTo, long value, NetworkParameters network) {
+ public static TransactionOutput createOutput(Address sendTo, long value, NetworkParameters network) {
ScriptOutput script;
if (sendTo.isMultisig(network)) {
script = new ScriptOutputP2SH(sendTo.getTypeSpecificBytes());
@@ -299,11 +299,11 @@ public UnsignedTransaction createUnsignedTransaction(Collection<UnspentTransacti
throws InsufficientFundsException, UnableToBuildTransactionException {
// Make a copy so we can mutate the list
List<UnspentTransactionOutput> unspent = new LinkedList<UnspentTransactionOutput>(inventory);
- OldOutputs oldOutputs = new OldOutputs(minerFeeToUse, unspent);
- long fee = oldOutputs.getFee();
- long outputSum = oldOutputs.getOutputSum();
- //todo extract coinselector interface with 2 implementations, oldest and pruning
- List<UnspentTransactionOutput> funding = pruneRedundantOutputs(oldOutputs.getAllFunding(), fee + outputSum);
+ OldestOutputsFirst oldestOutputsFirst = new OldestOutputsFirst(minerFeeToUse, unspent);
+ long fee = oldestOutputsFirst.getFee();
+ long outputSum = oldestOutputsFirst.getOutputSum();
+ List<UnspentTransactionOutput> funding = pruneRedundantOutputs(oldestOutputsFirst.getAllNeededFundings(), fee + outputSum);
+ // the number of inputs might have changed - recalculate the fee
fee = estimateFee(funding.size(), _outputs.size() + 1, minerFeeToUse);
long found = 0;
@@ -501,26 +501,36 @@ private static int estimateTransactionSize(int inputs, int outputs) {
return estimate;
}
- private static long estimateFee(int inputs, int outputs, long minerFeeToUse) {
+ /**
+ * Returns the estimate needed fee in satoshis for a default P2PKH transaction with a certain number
+ * of inputs and outputs and the specified per-kB-fee
+ *
+ * @param inputs number of inputs
+ * @param outputs number of outputs
+ * @param minerFeePerKb miner fee in satoshis per kB
+ **/
+ public static long estimateFee(int inputs, int outputs, long minerFeePerKb) {
+ // fee is based on the size of the transaction, we have to pay for
+ // every 1000 bytes
+ int txSize = estimateTransactionSize(inputs, outputs);
+ long requiredFee = (long) (((float) txSize / 1000.0) * minerFeePerKb);
+
// check if our estimation leads to a small fee that's below the default bitcoind-MIN_RELAY_FEE
// if so, use the MIN_RELAY_FEE
- if (minerFeeToUse < MIN_RELAY_FEE) {
- minerFeeToUse = MIN_RELAY_FEE;
+ if (requiredFee < MIN_RELAY_FEE) {
+ requiredFee = MIN_RELAY_FEE;
}
- // fee is based on the size of the transaction, we have to pay for
- // every 1000 bytes
- int txSize = estimateTransactionSize(inputs, outputs);
- long requiredFee = (long) (((float) txSize / 1000.0) * minerFeeToUse);
return requiredFee;
}
- private class OldOutputs {
+ // todo: generalize this into a interface and provide different coin-selectors
+ private class OldestOutputsFirst {
private List<UnspentTransactionOutput> allFunding;
private long fee;
private long outputSum;
- public OldOutputs(long minerFeeToUse, List<UnspentTransactionOutput> unspent) throws InsufficientFundsException {
+ public OldestOutputsFirst(long minerFeeToUse, List<UnspentTransactionOutput> unspent) throws InsufficientFundsException {
// Find the funding for this transaction
allFunding = new LinkedList<UnspentTransactionOutput>();
fee = minerFeeToUse;
@@ -540,7 +550,7 @@ public OldOutputs(long minerFeeToUse, List<UnspentTransactionOutput> unspent) th
}
}
- public List<UnspentTransactionOutput> getAllFunding() {
+ public List<UnspentTransactionOutput> getAllNeededFundings() {
return allFunding;
}
@@ -50,6 +50,7 @@ public void addPrivateKey(PrivateKey privateKey, PublicKey publicKey, Address ad
/**
* Find a Bitcoin signer by public key
*/
+ @Override
public BitcoinSigner findSignerByPublicKey(PublicKey publicKey) {
return _privateKeys.get(publicKey);
}
@@ -24,6 +24,7 @@
import com.mrd.bitlib.util.Sha256Hash;
import com.mrd.bitlib.util.ByteReader.InsufficientBytesException;
+// OutPoint denotes a particular output of a given transaction.
public class OutPoint implements Serializable {
private static final long serialVersionUID = 1L;
@@ -27,6 +27,14 @@
import java.io.Serializable;
+/**
+ * Transaction represents a raw Bitcoin transaction. In other words, it contains only the information found in the
+ * byte string representing a Bitcoin transaction. It contains no contextual information, such as the height
+ * of the transaction in the block chain or the outputs that its inputs redeem.
+ *
+ * Implements Serializable and is inserted directly in and out of the database. Therefore it cannot be changed
+ * without messing with the database.
+ */
public class Transaction implements Serializable {
private static final long serialVersionUID = 1L;
public static class TransactionParsingException extends Exception {
@@ -20,11 +20,7 @@
package com.btchip;
import com.btchip.comm.BTChipTransport;
-import com.btchip.utils.BIP32Utils;
-import com.btchip.utils.BufferUtils;
-import com.btchip.utils.CoinFormatUtils;
-import com.btchip.utils.Dump;
-import com.btchip.utils.VarintUtils;
+import com.btchip.utils.*;
import java.io.ByteArrayOutputStream;
import java.util.Arrays;
@@ -366,7 +362,7 @@ public boolean hasScreenSupport() {
throw new BTChipException("Truncated response");
}
lastSW = ((int) (response[response.length - 2] & 0xff) << 8) |
- (int) (response[response.length - 1] & 0xff);
+ (int) (response[response.length - 1] & 0xff);
byte[] result = new byte[response.length - 2];
System.arraycopy(response, 0, result, 0, response.length - 2);
return result;
@@ -18,7 +18,10 @@ dependencies {
compile 'com.fasterxml.jackson.core:jackson-core:2.1.0'
compile 'com.fasterxml.jackson.core:jackson-annotations:2.1.0'
compile 'com.fasterxml.jackson.core:jackson-databind:2.1.0'
- compile 'com.google.http-client:google-http-client-jackson2:1.19.0'
+ compile ('com.google.http-client:google-http-client-jackson2:1.19.0') {
+ // jackson comes with an older version of findbugs than required elsewhere
+ exclude group: 'com.google.code.findbugs'
+ }
compile 'com.madgag.spongycastle:core:1.51.0.0'
compile 'com.madgag.spongycastle:prov:1.51.0.0'
@@ -42,6 +42,7 @@
public static final int EVENT_SUBTYPE_OWNER_STOPPED = 12;
public static final int EVENT_SUBTYPE_PEER_STOPPED = 13;
public static final int EVENT_SUBTYPE_TRADE_LOCATION = 14;
+ public static final int EVENT_SUBTYPE_CASH_ONLY_WARNING = 15;
@JsonProperty
public long time;
@@ -39,6 +39,13 @@ dependencies {
compile 'com.squareup.okhttp:okhttp:2.2.0'
compile 'com.android.support:multidex:1.0.1'
+ compile ('com.google.code.findbugs:annotations:3.0.1') {
+ //transitive = false
+ //exclude group: 'javax/annotation/**'
+ // with these excludes stuff works. not sure which can be removed.
+ exclude module: 'jsr305'
+ exclude module: 'jcip-annotations'
+ }
}
def commonDebugKeystore = file("../../keystore_debug")
@@ -64,8 +71,8 @@ android {
buildToolsVersion androidSdkBuildVersion
defaultConfig {
- versionCode 25700
- versionName '2.5.7'
+ versionCode 25805
+ versionName '2.5.8'
multiDexEnabled true
}
@@ -0,0 +1,5 @@
+Files used for the localTraderLocalOnly.xcf:
+
+* thumbs-up: [public domain](https://pixabay.com/en/hand-thumb-sign-ok-yes-positive-311121/)
+* guys: [public domain](https://openclipart.org/detail/201468/men-shacking-hand-4-differents-versions)
+* earth: [public domanin](https://openclipart.org/detail/3320/earth)
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
@@ -0,0 +1,13 @@
+#!/bin/bash
+
+sizeNames=(ldpi mdpi hdpi xhdpi xxhdpi)
+sizes=(360 480 720 960 1800)
+fileIn=localTraderLocalOnly.png
+fileOut=lt_local_only_warning.png
+
+for ((n=0; n <= 4; n++))
+do
+ fOut="../src/main/res/drawable-"${sizeNames[n]}"/"$fileOut
+ convert -background none -resize ${sizes[n]}"x" $fileIn - | \
+ pngquant --force 64 > $fOut
+done
@@ -59,6 +59,7 @@
<activity android:name=".activity.modern.GetFromAddressBookActivity" />
<activity android:name=".activity.AddAccountActivity" />
<activity android:name=".activity.AddAdvancedAccountActivity" />
+ <activity android:name=".activity.AddCoinapultAccountActivity" />
<activity android:name=".activity.ScanActivity" />
<activity android:name=".activity.TransactionDetailsActivity" />
<activity android:name=".activity.settings.SettingsActivity" />
@@ -269,9 +269,10 @@ private static String decode(String value) {
sb.append('(');
} else if (c == ')') {
sb.append(')');
- } else {
- // decode error, ignore this character
}
+ // else {
+ // decode error, ignore this character
+ // }
} else {
if (c == '/') {
slash = true;
@@ -39,6 +39,6 @@
/**
* Created by Andreas on 20.06.2015.
*/
-public interface BitidKeyDerivation {
+public interface BitIdKeyDerivation {
InMemoryPrivateKey deriveKey(int accountIndex, String site);
}
@@ -34,15 +34,14 @@
package com.mycelium.wallet;
-import java.io.Serializable;
-import java.math.BigDecimal;
-
import android.net.Uri;
-
import com.google.common.base.Optional;
import com.mrd.bitlib.model.Address;
import com.mrd.bitlib.model.NetworkParameters;
+import java.io.Serializable;
+import java.math.BigDecimal;
+
/**
* This is a crude implementation of a Bitcoin URI, but for now it works for our
* purpose.
@@ -56,8 +55,8 @@
public final String callbackURL;
// returns a BitcoinUriWithAddress if address != null
- public static BitcoinUri from(Address address, Long amount, String label, String callbackURL){
- if (address != null){
+ public static BitcoinUri from(Address address, Long amount, String label, String callbackURL) {
+ if (address != null) {
return new BitcoinUriWithAddress(address, amount, label, callbackURL);
} else {
return new BitcoinUri(null, amount, label, callbackURL);
@@ -108,7 +107,12 @@ public BitcoinUri(Address address, Long amount, String label, String callbackURL
}
// Label
+ // Bip21 defines "?label" and "?message" - lets try "label" first and if it does not
+ // exist, lets use "message"
String label = u.getQueryParameter("label");
+ if (label == null) {
+ label = u.getQueryParameter("message");
+ }
// Payment Uri
String paymentUri = u.getQueryParameter("r");
@@ -125,15 +129,21 @@ public static BitcoinUri fromAddress(Address address) {
return new BitcoinUri(address, null, null);
}
- public String toString() {
- Uri.Builder builder = new Uri.Builder()
- .scheme("bitcoin")
- .authority(address == null ? "" : address.toString());
- if (amount != null) builder.appendQueryParameter("amount", amount.toString());
- if (label != null) builder.appendQueryParameter("label", label);
- if (callbackURL != null) builder.appendQueryParameter("r", callbackURL);
+ public String toString() {
+ Uri.Builder builder = new Uri.Builder()
+ .scheme("bitcoin")
+ .authority(address == null ? "" : address.toString());
+ if (amount != null) {
+ builder.appendQueryParameter("amount", amount.toString());
+ }
+ if (label != null) {
+ builder.appendQueryParameter("label", label);
+ }
+ if (callbackURL != null) {
+ builder.appendQueryParameter("r", callbackURL);
+ }
//todo: this can probably be solved nicer with some opaque flags or something
- return builder.toString().replace("/", "");
- }
+ return builder.toString().replace("/", "");
+ }
}
@@ -86,7 +86,7 @@ public void onClick(View v) {
return new View.OnClickListener() {
@Override
public void onClick(View v) {
- AlertDialog d = new AlertDialog.Builder(ClearPinDialog.this.getContext())
+ new AlertDialog.Builder(ClearPinDialog.this.getContext())
.setPositiveButton(context.getString(R.string.yes), new OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
@@ -131,6 +131,4 @@
public static final int MIN_PIN_BLOCKHEIGHT_AGE_RESET_PIN = 7 * BITCOIN_BLOCKS_PER_DAY;
// Force user to read the warnings about additional backups
public static final int WAIT_SECONDS_BEFORE_ADDITIONAL_BACKUP = 60;
- public static final BigDecimal COINAPULT_MINIMUM_AMOUNT = BigDecimal.ONE;
-
}
Oops, something went wrong.

0 comments on commit fea9edf

Please sign in to comment.