Make the grapheneapi multi account compatible

master
hvarona 2018-06-27 20:49:26 -04:00
parent 3b66b91807
commit 594bd4b816
1 changed files with 280 additions and 278 deletions

View File

@ -128,7 +128,10 @@ public abstract class GrapheneApiGenerator {
List<UserAccount> accounts = resp.get(0);
if (accounts.size() > 0) {
for (UserAccount account : accounts) {
request.getListener().success(account,request.getId());}}}
request.getListener().success(account, request.getId());
}
}
}
request.getListener().fail(request.getId());
}
@ -292,6 +295,7 @@ public abstract class GrapheneApiGenerator {
/**
* Gets the asset ifnormation using the id of the net
*
* @param assetIds The list of the ids to retrieve
* @param request the api request object, to answer this petition
*/
@ -412,25 +416,23 @@ public abstract class GrapheneApiGenerator {
currentBitsharesListener.put(accountId, balanceListener);
bitsharesSubscriptionHub.addSubscriptionListener(balanceListener);
try {
if (!subscriptionThread.isConnected() && !subscriptionThread.isAlive()) {
try {
subscriptionThread.start();
}catch(Exception e){
e.printStackTrace();
}
} else if (bitsharesSubscriptionHub != null && !bitsharesSubscriptionHub.isSubscribed()) {
try {
bitsharesSubscriptionHub.resubscribe();
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
}
/**
* Function to save a transaction retrieved from the update
*
* @param transaction The transaction db object
* @param currency The currency of the transaccion
* @param accountBitsharesId The id of the account in the bitshares network