From 84cc13b5f619fb026c2362f2ae7e19d8e012d4ae Mon Sep 17 00:00:00 2001 From: hvarona Date: Tue, 26 Jun 2018 23:13:39 -0400 Subject: [PATCH] Make the grapheneapi multi account compatible --- .../apigenerator/GrapheneApiGenerator.java | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/cy/agorise/crystalwallet/apigenerator/GrapheneApiGenerator.java b/app/src/main/java/cy/agorise/crystalwallet/apigenerator/GrapheneApiGenerator.java index 1e3e618..d314b4c 100644 --- a/app/src/main/java/cy/agorise/crystalwallet/apigenerator/GrapheneApiGenerator.java +++ b/app/src/main/java/cy/agorise/crystalwallet/apigenerator/GrapheneApiGenerator.java @@ -413,10 +413,18 @@ public abstract class GrapheneApiGenerator { currentBitsharesListener.put(accountId,balanceListener); bitsharesSubscriptionHub.addSubscriptionListener(balanceListener); - if(!subscriptionThread.isConnected()){ - subscriptionThread.start(); + if(!subscriptionThread.isConnected() && !subscriptionThread.isAlive()){ + try { + subscriptionThread.start(); + }catch(Exception e){ + e.printStackTrace(); + } }else if(!bitsharesSubscriptionHub.isSubscribed()){ - bitsharesSubscriptionHub.resubscribe(); + try { + bitsharesSubscriptionHub.resubscribe(); + }catch(Exception e){ + e.printStackTrace(); + } } } }