mirror of
https://github.com/oxen-io/session-android.git
synced 2024-12-25 09:17:44 +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 kotlinx.android.synthetic.main.activity_account_details.*
|
||||||
import org.thoughtcrime.securesms.BaseActionBarActivity
|
import org.thoughtcrime.securesms.BaseActionBarActivity
|
||||||
import org.thoughtcrime.securesms.R
|
import org.thoughtcrime.securesms.R
|
||||||
|
import org.thoughtcrime.securesms.util.TextSecurePreferences
|
||||||
import org.whispersystems.signalservice.api.crypto.ProfileCipher
|
import org.whispersystems.signalservice.api.crypto.ProfileCipher
|
||||||
|
|
||||||
class AccountDetailsActivity : BaseActionBarActivity() {
|
class AccountDetailsActivity : BaseActionBarActivity() {
|
||||||
@ -18,8 +19,12 @@ class AccountDetailsActivity : BaseActionBarActivity() {
|
|||||||
private fun continueIfPossible() {
|
private fun continueIfPossible() {
|
||||||
val uncheckedName = nameEditText.text.toString()
|
val uncheckedName = nameEditText.text.toString()
|
||||||
val name = if (uncheckedName.isNotEmpty()) { uncheckedName.trim() } else { null }
|
val name = if (uncheckedName.isNotEmpty()) { uncheckedName.trim() } else { null }
|
||||||
if (name != null && name.toByteArray().size > ProfileCipher.NAME_PADDED_LENGTH) {
|
if (name != null) {
|
||||||
return nameEditText.input.setError("Too Long")
|
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))
|
startActivity(Intent(this, KeyPairActivity::class.java))
|
||||||
finish()
|
finish()
|
||||||
|
@ -13,6 +13,8 @@ import org.thoughtcrime.securesms.database.IdentityDatabase
|
|||||||
import org.thoughtcrime.securesms.util.TextSecurePreferences
|
import org.thoughtcrime.securesms.util.TextSecurePreferences
|
||||||
import org.whispersystems.libsignal.IdentityKeyPair
|
import org.whispersystems.libsignal.IdentityKeyPair
|
||||||
import org.whispersystems.signalservice.loki.crypto.MnemonicCodec
|
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.File
|
||||||
import java.io.FileOutputStream
|
import java.io.FileOutputStream
|
||||||
|
|
||||||
@ -74,11 +76,10 @@ class KeyPairActivity : BaseActionBarActivity() {
|
|||||||
// region Interaction
|
// region Interaction
|
||||||
private fun register() {
|
private fun register() {
|
||||||
val publicKey = keyPair!!.publicKey
|
val publicKey = keyPair!!.publicKey
|
||||||
val hexEncodedPublicKey = publicKey.fingerprint
|
val hexEncodedPublicKey = keyPair!!.hexEncodedPublicKey
|
||||||
DatabaseFactory.getIdentityDatabase(this).saveIdentity(Address.fromSerialized(hexEncodedPublicKey), publicKey,
|
DatabaseFactory.getIdentityDatabase(this).saveIdentity(Address.fromSerialized(hexEncodedPublicKey), publicKey,
|
||||||
IdentityDatabase.VerifiedStatus.VERIFIED, true, System.currentTimeMillis(), true)
|
IdentityDatabase.VerifiedStatus.VERIFIED, true, System.currentTimeMillis(), true)
|
||||||
TextSecurePreferences.setLocalNumber(this, hexEncodedPublicKey)
|
TextSecurePreferences.setLocalNumber(this, hexEncodedPublicKey)
|
||||||
TextSecurePreferences.setProfileName(this, "User McUserFace") // TODO: For debugging purposes
|
|
||||||
TextSecurePreferences.setPromptedPushRegistration(this, true)
|
TextSecurePreferences.setPromptedPushRegistration(this, true)
|
||||||
startActivity(Intent(this, ConversationListActivity::class.java))
|
startActivity(Intent(this, ConversationListActivity::class.java))
|
||||||
finish()
|
finish()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user