Skip to content

Commit

Permalink
release 2.3.4, minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
tbocek committed Aug 11, 2016
1 parent c0a4d75 commit f7a2d65
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 8 deletions.
22 changes: 15 additions & 7 deletions app/src/main/java/com/coinblesk/client/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -473,13 +473,21 @@ public void onServiceConnected(ComponentName className, IBinder binder) {
walletServiceBinder = (WalletService.WalletServiceBinder) binder;
initPeers();

if (SharedPrefUtils.isMultisig2of2ToCltvForwardingEnabled(MainActivity.this)) {
new Multisig2of2ToCltvForwardTask(MainActivity.this,
walletServiceBinder,
walletServiceBinder.getMultisigClientKey(),
walletServiceBinder.getMultisigServerKey())
.execute();
}

walletServiceBinder.onWalletLoaded(new Runnable(){
@Override
public void run() {
if (SharedPrefUtils.isMultisig2of2ToCltvForwardingEnabled(MainActivity.this)) {
new Multisig2of2ToCltvForwardTask(MainActivity.this,
walletServiceBinder,
walletServiceBinder.getMultisigClientKey(),
walletServiceBinder.getMultisigServerKey())
.execute();
}
}
});



}

Expand Down
17 changes: 17 additions & 0 deletions payments/src/main/java/com/coinblesk/payments/WalletService.java
Original file line number Diff line number Diff line change
Expand Up @@ -199,8 +199,12 @@ protected void onSetupCompleted() {
keyExchange();
loadKeysIfExist();
}

initAddresses();

if(walletLRunnable!=null) {
walletLRunnable.run();
}
appKitInitDone = true;
broadcastBalanceChanged();
} catch (Exception e) {
Expand Down Expand Up @@ -1283,8 +1287,21 @@ public boolean isReady() {
public void restartWalletService() {
WalletService.this.restartWalletService();
}


public void onWalletLoaded(Runnable walletLRunnable) {

if(getMultisigClientKey() != null && getMultisigServerKey()!=null) {
walletLRunnable.run();
WalletService.this.walletLRunnable = null;
} else {
WalletService.this.walletLRunnable = walletLRunnable;
}
}
}

private Runnable walletLRunnable;

private class CoinbleskWalletEventListener implements WalletCoinsReceivedEventListener,
WalletCoinsSentEventListener,
ScriptsChangeEventListener,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import com.coinblesk.der.DERObject;
import com.coinblesk.der.DERParser;
import com.coinblesk.payments.WalletService;
import com.coinblesk.payments.communications.PaymentError;
import com.coinblesk.payments.communications.PaymentException;
import com.coinblesk.payments.communications.steps.cltv.PaymentFinalizeStep;
import com.coinblesk.payments.communications.steps.cltv.PaymentRequestReceiveStep;
Expand Down Expand Up @@ -294,7 +295,11 @@ public void run() {
} catch (PaymentException pe) {
approveAddress = null;
approveAmount = null;
broadcastInsufficientBalance();
if(pe.getErrorCode() == PaymentError.INSUFFICIENT_FUNDS) {
broadcastInsufficientBalance();
} else {
broadcastError();
}
long duration = System.currentTimeMillis() - processStartTime;
Log.d(TAG, "Payment not completed: " + duration + "ms");
pe.printStackTrace();
Expand Down Expand Up @@ -373,6 +378,13 @@ private void broadcastInsufficientBalance() {
.sendBroadcast(insufficientBalance);
}

private void broadcastError() {
Intent intent = new Intent(Constants.WALLET_ERROR_ACTION);
LocalBroadcastManager
.getInstance(NFCClientServiceCLTV.this)
.sendBroadcast(intent);
}

private void broadcastInstantPaymentSuccess() {
Intent instantPaymentSuccess = new Intent(Constants.INSTANT_PAYMENT_SUCCESSFUL_ACTION);
LocalBroadcastManager
Expand Down

0 comments on commit f7a2d65

Please sign in to comment.