From eae5e908147ab8e3a8d59a0a1c6eebddd3ee1135 Mon Sep 17 00:00:00 2001 From: Niels Andriesse Date: Wed, 5 Jun 2019 15:33:31 +1000 Subject: [PATCH] Fix remaining registration issues --- .../securesms/loki/AccountDetailsActivity.kt | 9 +++++++-- src/org/thoughtcrime/securesms/loki/KeyPairActivity.kt | 5 +++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/org/thoughtcrime/securesms/loki/AccountDetailsActivity.kt b/src/org/thoughtcrime/securesms/loki/AccountDetailsActivity.kt index c9cbab0f0e..bde386b8fa 100644 --- a/src/org/thoughtcrime/securesms/loki/AccountDetailsActivity.kt +++ b/src/org/thoughtcrime/securesms/loki/AccountDetailsActivity.kt @@ -5,6 +5,7 @@ import android.os.Bundle import kotlinx.android.synthetic.main.activity_account_details.* import org.thoughtcrime.securesms.BaseActionBarActivity import org.thoughtcrime.securesms.R +import org.thoughtcrime.securesms.util.TextSecurePreferences import org.whispersystems.signalservice.api.crypto.ProfileCipher class AccountDetailsActivity : BaseActionBarActivity() { @@ -18,8 +19,12 @@ class AccountDetailsActivity : BaseActionBarActivity() { private fun continueIfPossible() { val uncheckedName = nameEditText.text.toString() val name = if (uncheckedName.isNotEmpty()) { uncheckedName.trim() } else { null } - if (name != null && name.toByteArray().size > ProfileCipher.NAME_PADDED_LENGTH) { - return nameEditText.input.setError("Too Long") + if (name != null) { + if (name.toByteArray().size > ProfileCipher.NAME_PADDED_LENGTH) { + return nameEditText.input.setError("Too Long") + } else { + TextSecurePreferences.setProfileName(this, name) + } } startActivity(Intent(this, KeyPairActivity::class.java)) finish() diff --git a/src/org/thoughtcrime/securesms/loki/KeyPairActivity.kt b/src/org/thoughtcrime/securesms/loki/KeyPairActivity.kt index 1937457399..c27135ed28 100644 --- a/src/org/thoughtcrime/securesms/loki/KeyPairActivity.kt +++ b/src/org/thoughtcrime/securesms/loki/KeyPairActivity.kt @@ -13,6 +13,8 @@ import org.thoughtcrime.securesms.database.IdentityDatabase import org.thoughtcrime.securesms.util.TextSecurePreferences import org.whispersystems.libsignal.IdentityKeyPair import org.whispersystems.signalservice.loki.crypto.MnemonicCodec +import org.whispersystems.signalservice.loki.utilities.hexEncodedPrivateKey +import org.whispersystems.signalservice.loki.utilities.hexEncodedPublicKey import java.io.File import java.io.FileOutputStream @@ -74,11 +76,10 @@ class KeyPairActivity : BaseActionBarActivity() { // region Interaction private fun register() { val publicKey = keyPair!!.publicKey - val hexEncodedPublicKey = publicKey.fingerprint + val hexEncodedPublicKey = keyPair!!.hexEncodedPublicKey DatabaseFactory.getIdentityDatabase(this).saveIdentity(Address.fromSerialized(hexEncodedPublicKey), publicKey, IdentityDatabase.VerifiedStatus.VERIFIED, true, System.currentTimeMillis(), true) TextSecurePreferences.setLocalNumber(this, hexEncodedPublicKey) - TextSecurePreferences.setProfileName(this, "User McUserFace") // TODO: For debugging purposes TextSecurePreferences.setPromptedPushRegistration(this, true) startActivity(Intent(this, ConversationListActivity::class.java)) finish()