From c4f9c45883d0f25c091b1b61da2d8a600d645b40 Mon Sep 17 00:00:00 2001 From: anjmao Date: Mon, 8 Jun 2020 17:24:28 +0300 Subject: [PATCH] Adapt for fast registration flow --- android/app/build.gradle | 2 +- .../src/main/java/network/mysterium/ui/AccountViewModel.kt | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/android/app/build.gradle b/android/app/build.gradle index ae6110beb..b982d51f0 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -163,7 +163,7 @@ dependencies { androidTestImplementation 'com.android.support.test.espresso:espresso-contrib:3.0.2' androidTestImplementation 'androidx.test:rules:1.3.0-alpha03' - implementation 'network.mysterium:mobile-node:0.33.0-rc0' + implementation 'network.mysterium:mobile-node:0.34.1' // Comment network.mysterium:mobile-node and replace with your local path to use local node build. // implementation files('/Users/anjmao/go/src/github.com/mysteriumnetwork/node/build/package/Mysterium.aar') } diff --git a/android/app/src/main/java/network/mysterium/ui/AccountViewModel.kt b/android/app/src/main/java/network/mysterium/ui/AccountViewModel.kt index 7f1d92170..65775122c 100644 --- a/android/app/src/main/java/network/mysterium/ui/AccountViewModel.kt +++ b/android/app/src/main/java/network/mysterium/ui/AccountViewModel.kt @@ -47,11 +47,14 @@ class IdentityModel( val channelAddress: String, var status: IdentityRegistrationStatus ) { + // Identity is considered as registered if it's status RegisteredConsumer or InProgress since we support fast + // identity registration flow which means there is no need to wait for actual registration. val registered: Boolean get() { - return status == IdentityRegistrationStatus.REGISTERED_CONSUMER + return status == IdentityRegistrationStatus.REGISTERED_CONSUMER || status == IdentityRegistrationStatus.IN_PROGRESS } + val registrationFailed: Boolean get() { return status == IdentityRegistrationStatus.REGISTRATION_ERROR @@ -113,7 +116,7 @@ class AccountViewModel(private val nodeRepository: NodeRepository, private val b ) identity.value = identityResult bugReporter.setUserIdentifier(nodeIdentity.address) - Log.i(TAG, "Loaded identity ${nodeIdentity.address}, channel addr: ${nodeIdentity.channelAddress}") + Log.i(TAG, "Loaded identity ${nodeIdentity.address}, channel addr: ${nodeIdentity.channelAddress}, status: ${nodeIdentity.registrationStatus}") // Register identity if not registered or failed. if (identityResult.status == IdentityRegistrationStatus.UNREGISTERED || identityResult.status == IdentityRegistrationStatus.REGISTRATION_ERROR) {