mirror of
https://github.com/oxen-io/session-android.git
synced 2024-12-24 16:57:50 +00:00
Fix remaining registration issues
This commit is contained in:
parent
3c2504418d
commit
eae5e90814
@ -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()
|
||||
|
@ -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()
|
||||
|
Loading…
x
Reference in New Issue
Block a user