From 1c7a0ab5832dc9957f3162b3a28d7764f9fef55d Mon Sep 17 00:00:00 2001 From: sachinchauhan Date: Mon, 9 Sep 2019 17:31:36 +0530 Subject: [PATCH 01/22] Version bump up to 2.3.2-beta.1 and version code to 37 --- ostsdk/gradle.properties | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ostsdk/gradle.properties b/ostsdk/gradle.properties index 39931ea3..edbfa911 100644 --- a/ostsdk/gradle.properties +++ b/ostsdk/gradle.properties @@ -22,9 +22,9 @@ # org.gradle.parallel=true #Increase version when publishing. -VERSION_NAME=2.3.1 +VERSION_NAME=2.3.2-beta.1 #Increase version code when publishing. -VERSION_CODE=36 +VERSION_CODE=37 #Everything else. GROUP=com.ost From 034ed3ed0ea869f6598336bc9a719b0ccb56825a Mon Sep 17 00:00:00 2001 From: sachinchauhan Date: Tue, 24 Sep 2019 21:45:07 +0530 Subject: [PATCH 02/22] flowInterrupt when Workflow Destroyed --- .../com/ost/walletsdk/ui/workflow/OstWorkFlowActivity.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/ostsdk/src/main/java/com/ost/walletsdk/ui/workflow/OstWorkFlowActivity.java b/ostsdk/src/main/java/com/ost/walletsdk/ui/workflow/OstWorkFlowActivity.java index 19d6ef9a..8dcf0844 100644 --- a/ostsdk/src/main/java/com/ost/walletsdk/ui/workflow/OstWorkFlowActivity.java +++ b/ostsdk/src/main/java/com/ost/walletsdk/ui/workflow/OstWorkFlowActivity.java @@ -301,4 +301,11 @@ public void invalidPin(long workflowId, OstWorkflowContext ostWorkflowContext, S protected boolean isCrossButtonClicked(OstError ostError) { return CROSS_BUTTON_CLICK_CODE.equals(ostError.getInternalErrorCode()); } + + @Override + protected void onDestroy() { + super.onDestroy(); + OstError error = new OstError("owfa_ond_2", OstErrors.ErrorCode.UNCAUGHT_EXCEPTION_HANDELED); + if (null != mWorkFlowListener) mWorkFlowListener.flowInterrupt(getWorkflowContext(), error); + } } \ No newline at end of file From 73ce572a71e5ea021364b36f5623c4692c567671 Mon Sep 17 00:00:00 2001 From: sachinchauhan Date: Tue, 24 Sep 2019 22:19:46 +0530 Subject: [PATCH 03/22] Workflow view destroyed error added --- .../com/ost/walletsdk/ui/workflow/OstWorkFlowActivity.java | 2 +- .../java/com/ost/walletsdk/workflows/errors/OstErrors.java | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/ostsdk/src/main/java/com/ost/walletsdk/ui/workflow/OstWorkFlowActivity.java b/ostsdk/src/main/java/com/ost/walletsdk/ui/workflow/OstWorkFlowActivity.java index 8dcf0844..b88d2ab7 100644 --- a/ostsdk/src/main/java/com/ost/walletsdk/ui/workflow/OstWorkFlowActivity.java +++ b/ostsdk/src/main/java/com/ost/walletsdk/ui/workflow/OstWorkFlowActivity.java @@ -305,7 +305,7 @@ protected boolean isCrossButtonClicked(OstError ostError) { @Override protected void onDestroy() { super.onDestroy(); - OstError error = new OstError("owfa_ond_2", OstErrors.ErrorCode.UNCAUGHT_EXCEPTION_HANDELED); + OstError error = new OstError("owfa_ond_2", OstErrors.ErrorCode.WORKFLOW_VIEW_DESTROYED); if (null != mWorkFlowListener) mWorkFlowListener.flowInterrupt(getWorkflowContext(), error); } } \ No newline at end of file diff --git a/ostsdk/src/main/java/com/ost/walletsdk/workflows/errors/OstErrors.java b/ostsdk/src/main/java/com/ost/walletsdk/workflows/errors/OstErrors.java index 39df5fbd..ea36de35 100644 --- a/ostsdk/src/main/java/com/ost/walletsdk/workflows/errors/OstErrors.java +++ b/ostsdk/src/main/java/com/ost/walletsdk/workflows/errors/OstErrors.java @@ -201,6 +201,9 @@ public static String getMessage(ErrorCode code) { case WORKFLOW_FAILED: return "Something went wrong, please try again"; + case WORKFLOW_VIEW_DESTROYED: + return "The application interrupted the workflow. The view got terminated while performing the workflow"; + //deprecated case GET_USER_API_FAILED: return "Failed to fetch user information. Either OST server is unavailable temporarily OR your connection is going idle. Check your connection and re-submit the request a bit later."; @@ -310,6 +313,7 @@ public enum ErrorCode { UNKNOWN, WORKFLOW_CANCELLED, WORKFLOW_FAILED, + WORKFLOW_VIEW_DESTROYED, UNCAUGHT_EXCEPTION_HANDELED, FAILED_TO_GENERATE_ETH_KEY, OST_PLATFORM_API_ERROR, From 671828757ee4143bc390c2f7a3bc42e7f8bdcba8 Mon Sep 17 00:00:00 2001 From: sachinchauhan Date: Tue, 24 Sep 2019 22:50:03 +0530 Subject: [PATCH 04/22] version bump up to 39 --- ostsdk/gradle.properties | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ostsdk/gradle.properties b/ostsdk/gradle.properties index 69a89188..302ad96b 100644 --- a/ostsdk/gradle.properties +++ b/ostsdk/gradle.properties @@ -22,9 +22,9 @@ # org.gradle.parallel=true #Increase version when publishing. -VERSION_NAME=2.3.3 +VERSION_NAME=2.3.4-alpha.1 #Increase version code when publishing. -VERSION_CODE=38 +VERSION_CODE=39 #Everything else. GROUP=com.ost From 20c9405a54a17a1f02cbad5729e83244123502c2 Mon Sep 17 00:00:00 2001 From: sachinchauhan Date: Wed, 25 Sep 2019 17:52:09 +0530 Subject: [PATCH 05/22] finishActivity Handling --- .../walletsdk/ui/workflow/OstWorkFlowActivity.java | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/ostsdk/src/main/java/com/ost/walletsdk/ui/workflow/OstWorkFlowActivity.java b/ostsdk/src/main/java/com/ost/walletsdk/ui/workflow/OstWorkFlowActivity.java index b88d2ab7..08a93b4f 100644 --- a/ostsdk/src/main/java/com/ost/walletsdk/ui/workflow/OstWorkFlowActivity.java +++ b/ostsdk/src/main/java/com/ost/walletsdk/ui/workflow/OstWorkFlowActivity.java @@ -98,13 +98,13 @@ protected void onCreate(Bundle savedInstanceState) { ensureValidState(); } catch (OstError error) { mWorkFlowListener.flowInterrupt(getWorkflowContext(), error); - finish(); + finishActivity(); return; } catch (Throwable th) { OstError error = new OstError("owfa_onc_1", OstErrors.ErrorCode.UNCAUGHT_EXCEPTION_HANDELED); error.setStackTrace( th.getStackTrace() ); mWorkFlowListener.flowInterrupt(getWorkflowContext(), error); - finish(); + finishActivity(); return; } @@ -229,21 +229,21 @@ public boolean pinValidated(String workflowId, OstWorkflowContext ostWorkflowCon @Override public boolean flowComplete(String workflowId, OstWorkflowContext ostWorkflowContext, OstContextEntity ostContextEntity) { showProgress(false); - finish(); + finishActivity(); return false; } @Override public boolean flowInterrupt(String workflowId, OstWorkflowContext ostWorkflowContext, OstError ostError) { showProgress(false); - finish(); + finishActivity(); return false; } @Override public boolean requestAcknowledged(String workflowId, OstWorkflowContext ostWorkflowContext, OstContextEntity ostContextEntity) { showProgress(false); - finish(); + finishActivity(); return false; } @@ -252,6 +252,10 @@ public boolean verifyData(String workflowId, OstWorkflowContext ostWorkflowConte return false; } + private void finishActivity() { + mWorkFlowListener = null; + finish(); + } private void showGetPinFragment(String workflowId, String userId, OstWorkflowContext ostWorkflowContext, OstPinAcceptInterface ostPinAcceptInterface) { JSONObject stringConfigJsonObject = getContentString(ostWorkflowContext); WorkFlowPinFragment fragment = WorkFlowPinFragment.newInstance("Get Pin", getResources().getString(R.string.pin_sub_heading_get_pin), showBackButton()); From 13c2e36476cd548b3c1263ee297c742b73e590b3 Mon Sep 17 00:00:00 2001 From: sachinchauhan Date: Wed, 25 Sep 2019 18:45:07 +0530 Subject: [PATCH 06/22] version bump up --- ostsdk/gradle.properties | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ostsdk/gradle.properties b/ostsdk/gradle.properties index 302ad96b..7023093f 100644 --- a/ostsdk/gradle.properties +++ b/ostsdk/gradle.properties @@ -22,9 +22,9 @@ # org.gradle.parallel=true #Increase version when publishing. -VERSION_NAME=2.3.4-alpha.1 +VERSION_NAME=2.3.4-alpha.2 #Increase version code when publishing. -VERSION_CODE=39 +VERSION_CODE=40 #Everything else. GROUP=com.ost From 21b1b8ae07456b4e09a136e96ed7df71589eefdf Mon Sep 17 00:00:00 2001 From: sachinchauhan Date: Fri, 27 Sep 2019 17:20:27 +0530 Subject: [PATCH 07/22] bug fix for current device --- .../com/ost/walletsdk/models/entities/OstUser.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/ostsdk/src/main/java/com/ost/walletsdk/models/entities/OstUser.java b/ostsdk/src/main/java/com/ost/walletsdk/models/entities/OstUser.java index 4ee2f8af..c70ff3bf 100644 --- a/ostsdk/src/main/java/com/ost/walletsdk/models/entities/OstUser.java +++ b/ostsdk/src/main/java/com/ost/walletsdk/models/entities/OstUser.java @@ -50,7 +50,7 @@ public static String getIdentifier() { } @Ignore - private OstDevice currentDevice = null; + private String mCurrentDeviceAddress = null; public static OstUser getById(String id) { return OstModelFactory.getUserModel().getEntityById(id); @@ -75,14 +75,17 @@ public static OstUser init(String id, String tokenId) { } public OstDevice getCurrentDevice() { - if (null == currentDevice) { + if (null == mCurrentDeviceAddress) { OstKeyManager ostKeyManager = new OstKeyManager(getId()); String currentDeviceAddress = ostKeyManager.getDeviceAddress(); + mCurrentDeviceAddress = currentDeviceAddress; if (null != currentDeviceAddress) { - currentDevice = OstDevice.getById(currentDeviceAddress); Log.d(TAG, String.format("currentDeviceAddress: %s", currentDeviceAddress)); + } else { + Log.e(TAG, "Not Expected Current Device Address null"); } } + OstDevice currentDevice = OstDevice.getById(mCurrentDeviceAddress); return currentDevice; } @@ -289,7 +292,7 @@ public boolean isActivating() { } public void flushCurrentDevice() { - this.currentDevice = null; + this.mCurrentDeviceAddress = null; } public UserStatus getUserStatus() { From 2f53483d791255076fdec1aecbc26defb1b193fd Mon Sep 17 00:00:00 2001 From: sachinchauhan Date: Fri, 27 Sep 2019 17:36:43 +0530 Subject: [PATCH 08/22] LRU size update --- .../walletsdk/models/Impls/OstDeviceManagerModelRepository.java | 2 +- .../ost/walletsdk/models/Impls/OstSessionModelRepository.java | 2 +- .../walletsdk/models/Impls/OstTransactionModelRepository.java | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ostsdk/src/main/java/com/ost/walletsdk/models/Impls/OstDeviceManagerModelRepository.java b/ostsdk/src/main/java/com/ost/walletsdk/models/Impls/OstDeviceManagerModelRepository.java index 86282418..373de54d 100644 --- a/ostsdk/src/main/java/com/ost/walletsdk/models/Impls/OstDeviceManagerModelRepository.java +++ b/ostsdk/src/main/java/com/ost/walletsdk/models/Impls/OstDeviceManagerModelRepository.java @@ -20,7 +20,7 @@ class OstDeviceManagerModelRepository extends OstBaseModelCacheRepository implements OstDeviceManagerModel { - private static final int LRU_CACHE_SIZE = 5; + private static final int LRU_CACHE_SIZE = 150; private OstDeviceManagerDao mOstDeviceManagerDao; OstDeviceManagerModelRepository() { diff --git a/ostsdk/src/main/java/com/ost/walletsdk/models/Impls/OstSessionModelRepository.java b/ostsdk/src/main/java/com/ost/walletsdk/models/Impls/OstSessionModelRepository.java index f9c162d6..1833d949 100644 --- a/ostsdk/src/main/java/com/ost/walletsdk/models/Impls/OstSessionModelRepository.java +++ b/ostsdk/src/main/java/com/ost/walletsdk/models/Impls/OstSessionModelRepository.java @@ -20,7 +20,7 @@ class OstSessionModelRepository extends OstBaseModelCacheRepository implements OstSessionModel { - private static final int LRU_CACHE_SIZE = 5; + private static final int LRU_CACHE_SIZE = 150; private OstSessionDao mOstSessionDao; OstSessionModelRepository() { diff --git a/ostsdk/src/main/java/com/ost/walletsdk/models/Impls/OstTransactionModelRepository.java b/ostsdk/src/main/java/com/ost/walletsdk/models/Impls/OstTransactionModelRepository.java index 292fb1be..85647a11 100644 --- a/ostsdk/src/main/java/com/ost/walletsdk/models/Impls/OstTransactionModelRepository.java +++ b/ostsdk/src/main/java/com/ost/walletsdk/models/Impls/OstTransactionModelRepository.java @@ -18,7 +18,7 @@ class OstTransactionModelRepository extends OstBaseModelCacheRepository implements OstTransactionModel { - private static final int LRU_CACHE_SIZE = 5; + private static final int LRU_CACHE_SIZE = 150; private OstTransactionDao mOstTransactionDao; OstTransactionModelRepository() { From f194838780aad60ad0134cc71a351e60e32b2301 Mon Sep 17 00:00:00 2001 From: sachinchauhan Date: Fri, 27 Sep 2019 17:42:28 +0530 Subject: [PATCH 09/22] logic update for getCurrentDevice --- .../java/com/ost/walletsdk/models/entities/OstUser.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ostsdk/src/main/java/com/ost/walletsdk/models/entities/OstUser.java b/ostsdk/src/main/java/com/ost/walletsdk/models/entities/OstUser.java index c70ff3bf..49f5fc9b 100644 --- a/ostsdk/src/main/java/com/ost/walletsdk/models/entities/OstUser.java +++ b/ostsdk/src/main/java/com/ost/walletsdk/models/entities/OstUser.java @@ -75,17 +75,19 @@ public static OstUser init(String id, String tokenId) { } public OstDevice getCurrentDevice() { + OstDevice currentDevice = null; if (null == mCurrentDeviceAddress) { OstKeyManager ostKeyManager = new OstKeyManager(getId()); String currentDeviceAddress = ostKeyManager.getDeviceAddress(); mCurrentDeviceAddress = currentDeviceAddress; if (null != currentDeviceAddress) { + currentDevice = OstDevice.getById(mCurrentDeviceAddress); Log.d(TAG, String.format("currentDeviceAddress: %s", currentDeviceAddress)); } else { - Log.e(TAG, "Not Expected Current Device Address null"); + Log.e(TAG, "Current Device address is null, seems like device has been revoked"); } } - OstDevice currentDevice = OstDevice.getById(mCurrentDeviceAddress); + return currentDevice; } From dd4a51407306d53390d81a165bc22a9ccd85ae3e Mon Sep 17 00:00:00 2001 From: sachinchauhan Date: Fri, 27 Sep 2019 18:46:20 +0530 Subject: [PATCH 10/22] logic update for getCurrentDevice part 2 --- .../com/ost/walletsdk/models/entities/OstUser.java | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/ostsdk/src/main/java/com/ost/walletsdk/models/entities/OstUser.java b/ostsdk/src/main/java/com/ost/walletsdk/models/entities/OstUser.java index 49f5fc9b..b0862e91 100644 --- a/ostsdk/src/main/java/com/ost/walletsdk/models/entities/OstUser.java +++ b/ostsdk/src/main/java/com/ost/walletsdk/models/entities/OstUser.java @@ -78,16 +78,14 @@ public OstDevice getCurrentDevice() { OstDevice currentDevice = null; if (null == mCurrentDeviceAddress) { OstKeyManager ostKeyManager = new OstKeyManager(getId()); - String currentDeviceAddress = ostKeyManager.getDeviceAddress(); - mCurrentDeviceAddress = currentDeviceAddress; - if (null != currentDeviceAddress) { - currentDevice = OstDevice.getById(mCurrentDeviceAddress); - Log.d(TAG, String.format("currentDeviceAddress: %s", currentDeviceAddress)); - } else { + mCurrentDeviceAddress = ostKeyManager.getDeviceAddress(); + if (null == mCurrentDeviceAddress) { Log.e(TAG, "Current Device address is null, seems like device has been revoked"); + return null; } } - + Log.d(TAG, String.format("currentDeviceAddress: %s", mCurrentDeviceAddress)); + currentDevice = OstDevice.getById(mCurrentDeviceAddress); return currentDevice; } From 7b4448b0cad416a4bbd796828350e821754ad71b Mon Sep 17 00:00:00 2001 From: sachinchauhan Date: Fri, 27 Sep 2019 19:14:40 +0530 Subject: [PATCH 11/22] Version bump up --- ostsdk/gradle.properties | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ostsdk/gradle.properties b/ostsdk/gradle.properties index 7023093f..0700f0a1 100644 --- a/ostsdk/gradle.properties +++ b/ostsdk/gradle.properties @@ -22,9 +22,9 @@ # org.gradle.parallel=true #Increase version when publishing. -VERSION_NAME=2.3.4-alpha.2 +VERSION_NAME=2.3.4-alpha.3 #Increase version code when publishing. -VERSION_CODE=40 +VERSION_CODE=41 #Everything else. GROUP=com.ost From ec37a2a5bb4f6f73d4bd9027436d38e25cf363cf Mon Sep 17 00:00:00 2001 From: sachinchauhan Date: Sat, 28 Sep 2019 13:57:33 +0530 Subject: [PATCH 12/22] disabled proguard --- ostsdk/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ostsdk/build.gradle b/ostsdk/build.gradle index 8e1b9985..ef11ff7b 100644 --- a/ostsdk/build.gradle +++ b/ostsdk/build.gradle @@ -14,7 +14,7 @@ apply from: 'maven-push.gradle' /** * Run Proguard to shrink the Java bytecode in release builds. */ -def enableProguardInReleaseBuilds = true +def enableProguardInReleaseBuilds = false android { compileSdkVersion 28 From 81a9c421edbb803d12da548f26ce80ac4cd4edfc Mon Sep 17 00:00:00 2001 From: sachinchauhan Date: Sat, 28 Sep 2019 15:49:04 +0530 Subject: [PATCH 13/22] enable proguard and bug fix --- ostsdk/build.gradle | 2 +- .../java/com/ost/walletsdk/ui/workflow/OstWorkFlowActivity.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ostsdk/build.gradle b/ostsdk/build.gradle index ef11ff7b..8e1b9985 100644 --- a/ostsdk/build.gradle +++ b/ostsdk/build.gradle @@ -14,7 +14,7 @@ apply from: 'maven-push.gradle' /** * Run Proguard to shrink the Java bytecode in release builds. */ -def enableProguardInReleaseBuilds = false +def enableProguardInReleaseBuilds = true android { compileSdkVersion 28 diff --git a/ostsdk/src/main/java/com/ost/walletsdk/ui/workflow/OstWorkFlowActivity.java b/ostsdk/src/main/java/com/ost/walletsdk/ui/workflow/OstWorkFlowActivity.java index 08a93b4f..5899bcab 100644 --- a/ostsdk/src/main/java/com/ost/walletsdk/ui/workflow/OstWorkFlowActivity.java +++ b/ostsdk/src/main/java/com/ost/walletsdk/ui/workflow/OstWorkFlowActivity.java @@ -243,7 +243,7 @@ public boolean flowInterrupt(String workflowId, OstWorkflowContext ostWorkflowCo @Override public boolean requestAcknowledged(String workflowId, OstWorkflowContext ostWorkflowContext, OstContextEntity ostContextEntity) { showProgress(false); - finishActivity(); + finish(); return false; } From 74fce94c35fff83db98ab74b4644fd1ba934c63b Mon Sep 17 00:00:00 2001 From: sachinchauhan Date: Mon, 30 Sep 2019 12:24:18 +0530 Subject: [PATCH 14/22] Closing of Workflow UI in case of RequestAcknowledge was also closing and assigning null to workflow listener. Both should be decoupled. workflow listener should be closed only if workflow has completed or interrupted. --- .../ui/workflow/OstWorkFlowActivity.java | 21 +++++++++++-------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/ostsdk/src/main/java/com/ost/walletsdk/ui/workflow/OstWorkFlowActivity.java b/ostsdk/src/main/java/com/ost/walletsdk/ui/workflow/OstWorkFlowActivity.java index 5899bcab..f136fc31 100644 --- a/ostsdk/src/main/java/com/ost/walletsdk/ui/workflow/OstWorkFlowActivity.java +++ b/ostsdk/src/main/java/com/ost/walletsdk/ui/workflow/OstWorkFlowActivity.java @@ -5,6 +5,7 @@ import android.content.Intent; import android.os.Bundle; import android.support.v4.app.Fragment; +import android.util.Log; import android.view.View; import com.ost.walletsdk.OstSdk; @@ -14,9 +15,6 @@ import com.ost.walletsdk.ui.ChildFragmentStack; import com.ost.walletsdk.ui.WebViewFragment; import com.ost.walletsdk.ui.WorkFlowPinFragment; -import com.ost.walletsdk.ui.interfaces.FlowCompleteListener; -import com.ost.walletsdk.ui.interfaces.FlowInterruptListener; -import com.ost.walletsdk.ui.interfaces.RequestAcknowledgedListener; import com.ost.walletsdk.ui.managedevices.Device; import com.ost.walletsdk.ui.managedevices.DeviceListRecyclerViewAdapter; import com.ost.walletsdk.ui.recovery.AbortRecoveryFragment; @@ -73,6 +71,7 @@ public class OstWorkFlowActivity extends BaseActivity implements WalletSetUpFrag private static final String CROSS_BUTTON_CLICK_CODE = "owfa_gb"; WorkFlowListener mWorkFlowListener; + private boolean workflowFinished = false; private Intent mIntent; String mWorkflowId; String mWorkFlowName; @@ -98,13 +97,13 @@ protected void onCreate(Bundle savedInstanceState) { ensureValidState(); } catch (OstError error) { mWorkFlowListener.flowInterrupt(getWorkflowContext(), error); - finishActivity(); + finishWorkflow(); return; } catch (Throwable th) { OstError error = new OstError("owfa_onc_1", OstErrors.ErrorCode.UNCAUGHT_EXCEPTION_HANDELED); error.setStackTrace( th.getStackTrace() ); mWorkFlowListener.flowInterrupt(getWorkflowContext(), error); - finishActivity(); + finishWorkflow(); return; } @@ -229,14 +228,14 @@ public boolean pinValidated(String workflowId, OstWorkflowContext ostWorkflowCon @Override public boolean flowComplete(String workflowId, OstWorkflowContext ostWorkflowContext, OstContextEntity ostContextEntity) { showProgress(false); - finishActivity(); + finishWorkflow(); return false; } @Override public boolean flowInterrupt(String workflowId, OstWorkflowContext ostWorkflowContext, OstError ostError) { showProgress(false); - finishActivity(); + finishWorkflow(); return false; } @@ -252,8 +251,9 @@ public boolean verifyData(String workflowId, OstWorkflowContext ostWorkflowConte return false; } - private void finishActivity() { + private void finishWorkflow() { mWorkFlowListener = null; + workflowFinished = true; finish(); } private void showGetPinFragment(String workflowId, String userId, OstWorkflowContext ostWorkflowContext, OstPinAcceptInterface ostPinAcceptInterface) { @@ -310,6 +310,9 @@ protected boolean isCrossButtonClicked(OstError ostError) { protected void onDestroy() { super.onDestroy(); OstError error = new OstError("owfa_ond_2", OstErrors.ErrorCode.WORKFLOW_VIEW_DESTROYED); - if (null != mWorkFlowListener) mWorkFlowListener.flowInterrupt(getWorkflowContext(), error); + if (null != mWorkFlowListener && !workflowFinished) { + Log.d(LOG_TAG, "Workflow view destroyed"); + mWorkFlowListener.flowInterrupt(getWorkflowContext(), error); + } } } \ No newline at end of file From 81b4ba45fa403c79617b3b0b50c5515afb341aa5 Mon Sep 17 00:00:00 2001 From: sachinchauhan Date: Mon, 30 Sep 2019 12:53:26 +0530 Subject: [PATCH 15/22] WorkflowFinished flag should be UI worflowFinished flag, because it signifies ui worflow activity. --- .../walletsdk/ui/workflow/OstWorkFlowActivity.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/ostsdk/src/main/java/com/ost/walletsdk/ui/workflow/OstWorkFlowActivity.java b/ostsdk/src/main/java/com/ost/walletsdk/ui/workflow/OstWorkFlowActivity.java index f136fc31..658f7552 100644 --- a/ostsdk/src/main/java/com/ost/walletsdk/ui/workflow/OstWorkFlowActivity.java +++ b/ostsdk/src/main/java/com/ost/walletsdk/ui/workflow/OstWorkFlowActivity.java @@ -71,7 +71,7 @@ public class OstWorkFlowActivity extends BaseActivity implements WalletSetUpFrag private static final String CROSS_BUTTON_CLICK_CODE = "owfa_gb"; WorkFlowListener mWorkFlowListener; - private boolean workflowFinished = false; + private boolean uiWorkflowFinished = false; private Intent mIntent; String mWorkflowId; String mWorkFlowName; @@ -242,6 +242,7 @@ public boolean flowInterrupt(String workflowId, OstWorkflowContext ostWorkflowCo @Override public boolean requestAcknowledged(String workflowId, OstWorkflowContext ostWorkflowContext, OstContextEntity ostContextEntity) { showProgress(false); + setUiWorkFLowFinished(); finish(); return false; } @@ -253,9 +254,14 @@ public boolean verifyData(String workflowId, OstWorkflowContext ostWorkflowConte private void finishWorkflow() { mWorkFlowListener = null; - workflowFinished = true; + setUiWorkFLowFinished(); finish(); } + + private void setUiWorkFLowFinished() { + uiWorkflowFinished = true; + } + private void showGetPinFragment(String workflowId, String userId, OstWorkflowContext ostWorkflowContext, OstPinAcceptInterface ostPinAcceptInterface) { JSONObject stringConfigJsonObject = getContentString(ostWorkflowContext); WorkFlowPinFragment fragment = WorkFlowPinFragment.newInstance("Get Pin", getResources().getString(R.string.pin_sub_heading_get_pin), showBackButton()); @@ -310,7 +316,7 @@ protected boolean isCrossButtonClicked(OstError ostError) { protected void onDestroy() { super.onDestroy(); OstError error = new OstError("owfa_ond_2", OstErrors.ErrorCode.WORKFLOW_VIEW_DESTROYED); - if (null != mWorkFlowListener && !workflowFinished) { + if (null != mWorkFlowListener && !uiWorkflowFinished) { Log.d(LOG_TAG, "Workflow view destroyed"); mWorkFlowListener.flowInterrupt(getWorkflowContext(), error); } From f51e93f6a35afb6b826bf4fc538f72db6aa11860 Mon Sep 17 00:00:00 2001 From: sachinchauhan Date: Mon, 30 Sep 2019 15:13:51 +0530 Subject: [PATCH 16/22] Code review changes: mWorkflowListener should not be used as flag to make decision --- .../ui/workflow/OstWorkFlowActivity.java | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/ostsdk/src/main/java/com/ost/walletsdk/ui/workflow/OstWorkFlowActivity.java b/ostsdk/src/main/java/com/ost/walletsdk/ui/workflow/OstWorkFlowActivity.java index 658f7552..18dee44b 100644 --- a/ostsdk/src/main/java/com/ost/walletsdk/ui/workflow/OstWorkFlowActivity.java +++ b/ostsdk/src/main/java/com/ost/walletsdk/ui/workflow/OstWorkFlowActivity.java @@ -71,7 +71,7 @@ public class OstWorkFlowActivity extends BaseActivity implements WalletSetUpFrag private static final String CROSS_BUTTON_CLICK_CODE = "owfa_gb"; WorkFlowListener mWorkFlowListener; - private boolean uiWorkflowFinished = false; + private boolean mUiWorkflowFinished = false; private Intent mIntent; String mWorkflowId; String mWorkFlowName; @@ -242,7 +242,7 @@ public boolean flowInterrupt(String workflowId, OstWorkflowContext ostWorkflowCo @Override public boolean requestAcknowledged(String workflowId, OstWorkflowContext ostWorkflowContext, OstContextEntity ostContextEntity) { showProgress(false); - setUiWorkFLowFinished(); + setUiWorkfLowFinished(); finish(); return false; } @@ -253,13 +253,12 @@ public boolean verifyData(String workflowId, OstWorkflowContext ostWorkflowConte } private void finishWorkflow() { - mWorkFlowListener = null; - setUiWorkFLowFinished(); + setUiWorkfLowFinished(); finish(); } - private void setUiWorkFLowFinished() { - uiWorkflowFinished = true; + private void setUiWorkfLowFinished() { + mUiWorkflowFinished = true; } private void showGetPinFragment(String workflowId, String userId, OstWorkflowContext ostWorkflowContext, OstPinAcceptInterface ostPinAcceptInterface) { @@ -316,9 +315,9 @@ protected boolean isCrossButtonClicked(OstError ostError) { protected void onDestroy() { super.onDestroy(); OstError error = new OstError("owfa_ond_2", OstErrors.ErrorCode.WORKFLOW_VIEW_DESTROYED); - if (null != mWorkFlowListener && !uiWorkflowFinished) { + if (!mUiWorkflowFinished) { Log.d(LOG_TAG, "Workflow view destroyed"); - mWorkFlowListener.flowInterrupt(getWorkflowContext(), error); + if (null != mWorkFlowListener) mWorkFlowListener.flowInterrupt(getWorkflowContext(), error); } } } \ No newline at end of file From e2dab882d567a1ab46c26068bcdce64ce25b481d Mon Sep 17 00:00:00 2001 From: sachinchauhan Date: Mon, 30 Sep 2019 19:24:18 +0530 Subject: [PATCH 17/22] UI shall not show toast for Error --- .../ui/entermnemonics/EnterMnemonicsFragment.java | 14 ++++++++++++++ .../ui/entermnemonics/EnterMnemonicsPresenter.java | 3 ++- .../ui/entermnemonics/EnterMnemonicsView.java | 2 +- .../walletsdk/ui/recovery/RecoveryPresenter.java | 12 +++++------- .../walletsdk/ui/resetpin/ResetPinPresenter.java | 6 ++++-- .../ui/walletsetup/WalletSetUpPresenter.java | 4 +++- .../workflow/OstAuthorizeDeviceViaQRWorkflow.java | 1 - .../ui/workflow/OstExecuteTxnViaQRWorkflow.java | 1 - .../res/layout/ost_fragment_enter_mnemonics.xml | 11 +++++++++++ ostsdk/src/main/res/values/strings.xml | 3 +++ 10 files changed, 43 insertions(+), 14 deletions(-) diff --git a/ostsdk/src/main/java/com/ost/walletsdk/ui/entermnemonics/EnterMnemonicsFragment.java b/ostsdk/src/main/java/com/ost/walletsdk/ui/entermnemonics/EnterMnemonicsFragment.java index 2dcff068..12382657 100644 --- a/ostsdk/src/main/java/com/ost/walletsdk/ui/entermnemonics/EnterMnemonicsFragment.java +++ b/ostsdk/src/main/java/com/ost/walletsdk/ui/entermnemonics/EnterMnemonicsFragment.java @@ -25,6 +25,7 @@ import com.ost.walletsdk.ui.sdkInteract.SdkInteract; import com.ost.walletsdk.ui.sdkInteract.WorkFlowListener; import com.ost.walletsdk.ui.uicomponents.AppBar; +import com.ost.walletsdk.ui.uicomponents.OstTextView; import com.ost.walletsdk.ui.uicomponents.uiutils.content.ContentConfig; import com.ost.walletsdk.ui.uicomponents.uiutils.content.StringConfig; @@ -45,6 +46,8 @@ public class EnterMnemonicsFragment extends BaseFragment implements EnterMnemoni EnterMnemonicsPresenter mEnterMnemonicsPresenter = EnterMnemonicsPresenter.getInstance(); JSONObject contentConfig = ContentConfig.getInstance().getStringConfig("add_current_device_with_mnemonics").optJSONObject("provide_mnemonics"); + private OstTextView mErrorMessage; + public EnterMnemonicsFragment() { // Required empty public constructor } @@ -110,6 +113,8 @@ public void onClick(View v) { } }); + mErrorMessage = viewGroup.findViewById(R.id.otv_error_message); + mEnterMnemonicsPresenter.attachView(this); AppBar appBar = AppBar.newInstance(getContext(), false); setUpAppBar(viewGroup, appBar); @@ -121,4 +126,13 @@ public void onDestroyView() { mEnterMnemonicsPresenter.detachView(); mEnterMnemonicsPresenter = null; } + + @Override + public void showErrorMessage(boolean show) { + if (show) { + mErrorMessage.setVisibility(View.VISIBLE); + } else { + mErrorMessage.setVisibility(View.INVISIBLE); + } + } } \ No newline at end of file diff --git a/ostsdk/src/main/java/com/ost/walletsdk/ui/entermnemonics/EnterMnemonicsPresenter.java b/ostsdk/src/main/java/com/ost/walletsdk/ui/entermnemonics/EnterMnemonicsPresenter.java index d3876dd3..1e43405d 100644 --- a/ostsdk/src/main/java/com/ost/walletsdk/ui/entermnemonics/EnterMnemonicsPresenter.java +++ b/ostsdk/src/main/java/com/ost/walletsdk/ui/entermnemonics/EnterMnemonicsPresenter.java @@ -47,9 +47,10 @@ void recoverWallet(String mnemonicsPhrase) { //mnemonics validation String[] mnemonicsArray = mnemonicsPhrase.split(" "); if (mnemonicsArray.length != 12) { - getMvpView().showToastMessage("Mnemonics length should be of 12 words", false); + getMvpView().showErrorMessage(true); return; } + getMvpView().showErrorMessage(false); getMvpView().showProgress(true, StringConfig.instance(contentConfig.optJSONObject("initial_loader")).getString()); diff --git a/ostsdk/src/main/java/com/ost/walletsdk/ui/entermnemonics/EnterMnemonicsView.java b/ostsdk/src/main/java/com/ost/walletsdk/ui/entermnemonics/EnterMnemonicsView.java index bfa615af..67e908f1 100644 --- a/ostsdk/src/main/java/com/ost/walletsdk/ui/entermnemonics/EnterMnemonicsView.java +++ b/ostsdk/src/main/java/com/ost/walletsdk/ui/entermnemonics/EnterMnemonicsView.java @@ -14,5 +14,5 @@ import com.ost.walletsdk.ui.BaseView; interface EnterMnemonicsView extends BaseView { - + void showErrorMessage(boolean show); } \ No newline at end of file diff --git a/ostsdk/src/main/java/com/ost/walletsdk/ui/recovery/RecoveryPresenter.java b/ostsdk/src/main/java/com/ost/walletsdk/ui/recovery/RecoveryPresenter.java index 982a493e..4213f89b 100644 --- a/ostsdk/src/main/java/com/ost/walletsdk/ui/recovery/RecoveryPresenter.java +++ b/ostsdk/src/main/java/com/ost/walletsdk/ui/recovery/RecoveryPresenter.java @@ -18,6 +18,8 @@ import com.ost.walletsdk.ui.sdkInteract.SdkInteract; import com.ost.walletsdk.ui.sdkInteract.WorkFlowListener; import com.ost.walletsdk.workflows.OstWorkflowContext; +import com.ost.walletsdk.workflows.errors.OstError; +import com.ost.walletsdk.workflows.errors.OstErrors; class RecoveryPresenter extends BasePresenter { @@ -46,7 +48,9 @@ public void setPassphrase(String passphrase) { @Override public void cancelFlow() { Log.d("getPinSalt", "Exception in fetching Pin Salt."); - recoverySaltFetchFailed(); + getMvpView().showProgress(false); + OstError error = new OstError("ws_wsp_cf", OstErrors.ErrorCode.WORKFLOW_CANCELLED); + workFlowListener.flowInterrupt(getWorkFlowContext(), error); } }); } @@ -59,12 +63,6 @@ void startWorkFlow(String ostUserId, UserPassphrase currentUserPassPhrase, Strin } - private void recoverySaltFetchFailed(){ - getMvpView().showProgress(false); - getMvpView().gotoDashboard(null); - getMvpView().showToastMessage("Recovery could not be initiated. Please try after sometime.", false); - } - public void setArguments(String userId, String workflowId, String deviceAddress) { this.mUserId = userId; this.mWorkflowId = workflowId; diff --git a/ostsdk/src/main/java/com/ost/walletsdk/ui/resetpin/ResetPinPresenter.java b/ostsdk/src/main/java/com/ost/walletsdk/ui/resetpin/ResetPinPresenter.java index 0f8b23ac..b17d8b56 100644 --- a/ostsdk/src/main/java/com/ost/walletsdk/ui/resetpin/ResetPinPresenter.java +++ b/ostsdk/src/main/java/com/ost/walletsdk/ui/resetpin/ResetPinPresenter.java @@ -21,6 +21,8 @@ import com.ost.walletsdk.ui.uicomponents.uiutils.content.ContentConfig; import com.ost.walletsdk.ui.uicomponents.uiutils.content.StringConfig; import com.ost.walletsdk.workflows.OstWorkflowContext; +import com.ost.walletsdk.workflows.errors.OstError; +import com.ost.walletsdk.workflows.errors.OstErrors; import org.json.JSONObject; @@ -81,8 +83,8 @@ public void setPassphrase(String passphrase) { public void cancelFlow() { Log.d("getPinSalt", "Exception in fetching Pin Salt."); getMvpView().showProgress(false); - getMvpView().showToastMessage("Reset PIN failed. Please try after sometime.", false); - getMvpView().gotoDashboard(null); + OstError error = new OstError("rpp_ope_cf", OstErrors.ErrorCode.WORKFLOW_CANCELLED); + workFlowListener.flowInterrupt(new OstWorkflowContext(OstWorkflowContext.WORKFLOW_TYPE.RESET_PIN), error); } }); diff --git a/ostsdk/src/main/java/com/ost/walletsdk/ui/walletsetup/WalletSetUpPresenter.java b/ostsdk/src/main/java/com/ost/walletsdk/ui/walletsetup/WalletSetUpPresenter.java index c3142bbc..f6cdd46b 100644 --- a/ostsdk/src/main/java/com/ost/walletsdk/ui/walletsetup/WalletSetUpPresenter.java +++ b/ostsdk/src/main/java/com/ost/walletsdk/ui/walletsetup/WalletSetUpPresenter.java @@ -27,6 +27,7 @@ import com.ost.walletsdk.workflows.OstContextEntity; import com.ost.walletsdk.workflows.OstWorkflowContext; import com.ost.walletsdk.workflows.errors.OstError; +import com.ost.walletsdk.workflows.errors.OstErrors; import org.json.JSONObject; @@ -107,7 +108,8 @@ public void setPassphrase(String passphrase) { @Override public void cancelFlow() { getMvpView().showProgress(false); - getMvpView().showToastMessage("User Activation failed. Please try after sometime.", false); + OstError error = new OstError("ws_swf_cf", OstErrors.ErrorCode.WORKFLOW_CANCELLED); + workFlowListener.flowInterrupt(new OstWorkflowContext(OstWorkflowContext.WORKFLOW_TYPE.ACTIVATE_USER), error); } }); } diff --git a/ostsdk/src/main/java/com/ost/walletsdk/ui/workflow/OstAuthorizeDeviceViaQRWorkflow.java b/ostsdk/src/main/java/com/ost/walletsdk/ui/workflow/OstAuthorizeDeviceViaQRWorkflow.java index 72920287..00ad7a16 100644 --- a/ostsdk/src/main/java/com/ost/walletsdk/ui/workflow/OstAuthorizeDeviceViaQRWorkflow.java +++ b/ostsdk/src/main/java/com/ost/walletsdk/ui/workflow/OstAuthorizeDeviceViaQRWorkflow.java @@ -94,7 +94,6 @@ public void onResultString(Intent data) { } catch (JSONException e) { Log.e(LOG_TAG, "Exception in Data;"); showProgress(false); - showToastMessage("QR Reading failed.. Try Again", false); } } } diff --git a/ostsdk/src/main/java/com/ost/walletsdk/ui/workflow/OstExecuteTxnViaQRWorkflow.java b/ostsdk/src/main/java/com/ost/walletsdk/ui/workflow/OstExecuteTxnViaQRWorkflow.java index f3a9282a..104e2a8c 100644 --- a/ostsdk/src/main/java/com/ost/walletsdk/ui/workflow/OstExecuteTxnViaQRWorkflow.java +++ b/ostsdk/src/main/java/com/ost/walletsdk/ui/workflow/OstExecuteTxnViaQRWorkflow.java @@ -98,7 +98,6 @@ public void onResultString(Intent data) { } catch (JSONException e) { Log.e(LOG_TAG, "Exception in Data;"); showProgress(false); - showToastMessage("QR Reading failed.. Try Again", false); } } } diff --git a/ostsdk/src/main/res/layout/ost_fragment_enter_mnemonics.xml b/ostsdk/src/main/res/layout/ost_fragment_enter_mnemonics.xml index da5f127f..4c4792ac 100644 --- a/ostsdk/src/main/res/layout/ost_fragment_enter_mnemonics.xml +++ b/ostsdk/src/main/res/layout/ost_fragment_enter_mnemonics.xml @@ -50,6 +50,17 @@ android:layout_marginEnd="15dp" android:layout_marginBottom="10dp"/> + The Wallet setup process takes about 30 seconds. You can continue to use the app and we’ll notify when the wallet is ready to use. No Transactions Completed! Looks like you have not made any transactions, send some tokens to other users. + + + Invalid Mnemonics passed From 19cc2fc1e2c5bb5fabaa130bc813b54ac58735a8 Mon Sep 17 00:00:00 2001 From: sachinchauhan Date: Tue, 1 Oct 2019 17:48:19 +0530 Subject: [PATCH 18/22] Pagination fix for device list --- .../ui/managedevices/DeviceListFragment.java | 6 +- .../ui/managedevices/DeviceListPresenter.java | 76 +++++++++++-------- 2 files changed, 50 insertions(+), 32 deletions(-) diff --git a/ostsdk/src/main/java/com/ost/walletsdk/ui/managedevices/DeviceListFragment.java b/ostsdk/src/main/java/com/ost/walletsdk/ui/managedevices/DeviceListFragment.java index 243d6aa0..b66c7646 100644 --- a/ostsdk/src/main/java/com/ost/walletsdk/ui/managedevices/DeviceListFragment.java +++ b/ostsdk/src/main/java/com/ost/walletsdk/ui/managedevices/DeviceListFragment.java @@ -46,6 +46,7 @@ public class DeviceListFragment extends BaseFragment implements DeviceListView { private static final String ACTION_NAME = "action_name"; private static final String INITIATED_RECOVERY = "initiate_recovery"; private static final String MANAGE_DEVICE = "manage_device"; + private static final int SCROLL_ITEM_THRESHOLD = 5; public JSONObject contentConfig = new JSONObject(); private DeviceListRecyclerViewAdapter.OnDeviceListInteractionListener mListener; @@ -148,8 +149,8 @@ public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) { int visibleItemCount = layoutManager.getChildCount(); int totalItemCount = layoutManager.getItemCount(); int firstVisibleItemPosition = layoutManager.findFirstVisibleItemPosition(); - if (!paginationRequestSent && dy > 0 && (visibleItemCount + firstVisibleItemPosition) >= - totalItemCount && firstVisibleItemPosition >= 0) { + if (!paginationRequestSent && dy > 0 && (SCROLL_ITEM_THRESHOLD + firstVisibleItemPosition) >= + totalItemCount) { paginationRequestSent = true; mDeviceListPresenter.updateDeviceList(false); } @@ -197,5 +198,6 @@ public void notifyDataSetChanged() { @Override public void setRefreshing(boolean refreshing) { mPullToRefresh.setRefreshing(refreshing); + paginationRequestSent = false; } } \ No newline at end of file diff --git a/ostsdk/src/main/java/com/ost/walletsdk/ui/managedevices/DeviceListPresenter.java b/ostsdk/src/main/java/com/ost/walletsdk/ui/managedevices/DeviceListPresenter.java index 9afa3137..adb214c7 100644 --- a/ostsdk/src/main/java/com/ost/walletsdk/ui/managedevices/DeviceListPresenter.java +++ b/ostsdk/src/main/java/com/ost/walletsdk/ui/managedevices/DeviceListPresenter.java @@ -34,10 +34,12 @@ class DeviceListPresenter extends BasePresenter { private static final String LOG_TAG = "OstDeviceListPresenter"; + private static final int MINIMUM_DEVICES = 5; private String mUserId; private String currentDeviceAddress; private String mLoaderString = "Loading..."; private boolean mRunningLoader = false; + private boolean mClearDeviceList; private DeviceListPresenter() {} @@ -59,57 +61,72 @@ public void attachView(DeviceListView mvpView) { updateDeviceList(true); } - void updateDeviceList(Boolean clearList) { + void updateDeviceList(boolean clearList) { if(httpRequestPending){ return; } + httpRequestPending = true; if(clearList){ - ostDeviceList.clear(); + mClearDeviceList = true; nextPayload = new JSONObject(); } else if(!hasMoreData){ return; } - httpRequestPending = true; + showProgress(true); + getDeviceList(); + } + private void getDeviceList() { Map mapPayload = new HashMap<>(); try { mapPayload = new CommonUtils().convertJsonToMap(nextPayload); } catch (JSONException e) { Log.e(LOG_TAG, "Exception while converting payload map", e); } - showProgress(true); OstJsonApi.getDeviceList(mUserId, mapPayload, new OstJsonApiCallback() { @Override public void onOstJsonApiSuccess(@Nullable JSONObject dataJSONObject) { - showLoaderProgress(false); - showProgress(false); - if (null == dataJSONObject) { - httpRequestPending = false; - return; - } - try { - JSONObject meta = dataJSONObject.optJSONObject("meta"); - if (null != meta) nextPayload = meta.optJSONObject("next_page_payload"); - - hasMoreData = (nextPayload != null && !nextPayload.toString().equals("{}")); - JSONArray deviceJSONArray = (JSONArray) dataJSONObject.get(dataJSONObject.getString(OstConstants.RESULT_TYPE)); - - for (int i = 0; i < deviceJSONArray.length(); i++) { - JSONObject deviceJSONObject = deviceJSONArray.getJSONObject(i); - Device device = Device.newInstance(deviceJSONObject); - if (device.isAuthorized() && !device.getDeviceAddress().equalsIgnoreCase(currentDeviceAddress)) { - ostDeviceList.add(device); + if (null != dataJSONObject) { + try { + JSONObject meta = dataJSONObject.optJSONObject("meta"); + if (null != meta) nextPayload = meta.optJSONObject("next_page_payload"); + + + hasMoreData = (nextPayload != null && !nextPayload.toString().equals("{}")); + JSONArray deviceJSONArray = (JSONArray) dataJSONObject.get(dataJSONObject.getString(OstConstants.RESULT_TYPE)); + + //Clear list if new device request received + if (mClearDeviceList) { + ostDeviceList.clear(); + mClearDeviceList = false; } + + //Populate authorized device in the list + for (int i = 0; i < deviceJSONArray.length(); i++) { + JSONObject deviceJSONObject = deviceJSONArray.getJSONObject(i); + Device device = Device.newInstance(deviceJSONObject); + if (device.isAuthorized() && !device.getDeviceAddress().equalsIgnoreCase(currentDeviceAddress)) { + ostDeviceList.add(device); + } + } + + if (ostDeviceList.isEmpty()) { + ostDeviceList.add(Device.newInstance(new JSONObject())); + } + + // Make request if did not get enough devices + if (hasMoreData && ostDeviceList.size() < MINIMUM_DEVICES) { + getDeviceList(); + return; + } + } catch (JSONException e) { + //Exception not expected } - if (ostDeviceList.isEmpty()) { - ostDeviceList.add(Device.newInstance(new JSONObject())); - } - } catch (JSONException e) { - //Exception not expected } - getMvpView().notifyDataSetChanged(); - httpRequestPending = false; + showLoaderProgress(false); + showProgress(false); + getMvpView().notifyDataSetChanged(); } @Override @@ -122,7 +139,6 @@ public void onOstJsonApiError(@NonNull OstError err, @Nullable JSONObject respon } }); } - private void showProgress(boolean show) { if (mRunningLoader) return; if (null != getMvpView()) getMvpView().setRefreshing(show); From 9e5a02d85340a2076d3660794fc2e30801c74f9a Mon Sep 17 00:00:00 2001 From: sachinchauhan Date: Wed, 2 Oct 2019 16:32:58 +0530 Subject: [PATCH 19/22] Version bump up from 41 to 42 --- ostsdk/gradle.properties | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ostsdk/gradle.properties b/ostsdk/gradle.properties index 0700f0a1..54572d87 100644 --- a/ostsdk/gradle.properties +++ b/ostsdk/gradle.properties @@ -22,9 +22,9 @@ # org.gradle.parallel=true #Increase version when publishing. -VERSION_NAME=2.3.4-alpha.3 +VERSION_NAME=2.3.4-alpha.4 #Increase version code when publishing. -VERSION_CODE=41 +VERSION_CODE=42 #Everything else. GROUP=com.ost From 5a384952bea457fcd13f7d878f5abf117cc3a0ea Mon Sep 17 00:00:00 2001 From: sachinchauhan Date: Thu, 3 Oct 2019 12:32:44 +0530 Subject: [PATCH 20/22] Version bump up from 42 to 43 --- ostsdk/gradle.properties | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ostsdk/gradle.properties b/ostsdk/gradle.properties index 54572d87..58fbc8ab 100644 --- a/ostsdk/gradle.properties +++ b/ostsdk/gradle.properties @@ -22,9 +22,9 @@ # org.gradle.parallel=true #Increase version when publishing. -VERSION_NAME=2.3.4-alpha.4 +VERSION_NAME=2.3.4 #Increase version code when publishing. -VERSION_CODE=42 +VERSION_CODE=43 #Everything else. GROUP=com.ost From 1bf813cb7635b0d71cf65a8df67f6e5c08808029 Mon Sep 17 00:00:00 2001 From: sachinchauhan Date: Thu, 3 Oct 2019 13:00:56 +0530 Subject: [PATCH 21/22] Change log update --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0a849dd9..99f479f0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # OST Wallet SDK Changelog +## Version 2.3.4 +### Bug Fixes: +* Device list inconsistency fix in manage devices. +* User entity current device caching fix. +* Converted Toast error message of enter mnemonics view to inline error message + ## Version 2.3.3 ### Changes: * Proguard usage to remove verbose and debug logs. From 0bb1e97ee3fed61d31fa7ad42ecd536af31069fd Mon Sep 17 00:00:00 2001 From: sachinchauhan Date: Thu, 3 Oct 2019 13:52:01 +0530 Subject: [PATCH 22/22] Readme version update --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 6dfd45a0..f41f7bcb 100644 --- a/README.md +++ b/README.md @@ -108,7 +108,7 @@ compileOptions { ``` dependencies { - implementation 'com.ost:ost-wallet-sdk-android:2.3.3' + implementation 'com.ost:ost-wallet-sdk-android:2.3.4' ... ... ...