From e8c52961aa646c1ced02690783262227a608810d Mon Sep 17 00:00:00 2001 From: ryanzhao Date: Fri, 28 May 2021 15:14:05 +1000 Subject: [PATCH] minor fix --- .../securesms/loki/activities/CreatePrivateChatActivity.kt | 5 +++-- app/src/main/res/values/strings.xml | 1 + .../src/main/java/org/session/libsession/snode/SnodeAPI.kt | 5 ++++- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/org/thoughtcrime/securesms/loki/activities/CreatePrivateChatActivity.kt b/app/src/main/java/org/thoughtcrime/securesms/loki/activities/CreatePrivateChatActivity.kt index 2dece4b9e6..54c80227a2 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/loki/activities/CreatePrivateChatActivity.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/loki/activities/CreatePrivateChatActivity.kt @@ -20,6 +20,7 @@ import kotlinx.android.synthetic.main.activity_create_private_chat.viewPager import kotlinx.android.synthetic.main.fragment_enter_public_key.* import network.loki.messenger.R import nl.komponents.kovenant.ui.failUi +import nl.komponents.kovenant.ui.successUi import org.session.libsession.snode.SnodeAPI import org.thoughtcrime.securesms.PassphraseRequiredActionBarActivity import org.thoughtcrime.securesms.conversation.ConversationActivity @@ -89,12 +90,12 @@ class CreatePrivateChatActivity : PassphraseRequiredActionBarActivity(), ScanQRC } else { // This could be an ONS name showLoader() - SnodeAPI.getSessionIDFor(onsNameOrPublicKey).success { hexEncodedPublicKey -> + SnodeAPI.getSessionIDFor(onsNameOrPublicKey).successUi { hexEncodedPublicKey -> hideLoader() this.createPrivateChat(hexEncodedPublicKey) }.failUi { exception -> hideLoader() - var message = "Please check the Session ID or ONS name and try again." + var message = resources.getString(R.string.fragment_enter_public_key_error_message) exception.localizedMessage?.let { message = it } diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 80eb6fd035..b8d6c578d4 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -721,6 +721,7 @@ Enter Session ID or ONS name Users can share their Session ID by going into their account settings and tapping "Share Session ID", or by sharing their QR code. + Please check the Session ID or ONS name and try again. Session needs camera access to scan QR codes Grant Camera Access diff --git a/libsession/src/main/java/org/session/libsession/snode/SnodeAPI.kt b/libsession/src/main/java/org/session/libsession/snode/SnodeAPI.kt index d46ee4bcca..f126871a40 100644 --- a/libsession/src/main/java/org/session/libsession/snode/SnodeAPI.kt +++ b/libsession/src/main/java/org/session/libsession/snode/SnodeAPI.kt @@ -183,7 +183,10 @@ object SnodeAPI { ) val promises = (1..validationCount).map { getRandomSnode().bind { snode -> - invoke(Snode.Method.OxenDaemonRPCCall, snode, null, parameters) + retryIfNeeded(maxRetryCount) { + invoke(Snode.Method.OxenDaemonRPCCall, snode, null, parameters) + } + } } all(promises).success { results ->