mirror of
https://github.com/oxen-io/session-android.git
synced 2024-11-21 15:05:19 +00:00
Making sure the username is saved when creating an account
This commit is contained in:
parent
0616e148cf
commit
96dded096f
@ -8,6 +8,7 @@ import org.session.libsignal.utilities.KeyHelper
|
||||
import org.session.libsignal.utilities.hexEncodedPublicKey
|
||||
import org.thoughtcrime.securesms.crypto.KeyPairUtilities
|
||||
import org.thoughtcrime.securesms.dependencies.ConfigFactory
|
||||
import org.thoughtcrime.securesms.util.ConfigurationMessageUtilities
|
||||
import org.thoughtcrime.securesms.util.VersionDataFetcher
|
||||
import javax.inject.Inject
|
||||
import javax.inject.Singleton
|
||||
@ -24,7 +25,6 @@ class CreateAccountManager @Inject constructor(
|
||||
|
||||
fun createAccount(displayName: String) {
|
||||
prefs.setProfileName(displayName)
|
||||
configFactory.user?.setName(displayName)
|
||||
|
||||
// This is here to resolve a case where the app restarts before a user completes onboarding
|
||||
// which can result in an invalid database state
|
||||
@ -37,13 +37,16 @@ class CreateAccountManager @Inject constructor(
|
||||
val x25519KeyPair = keyPairGenerationResult.x25519KeyPair
|
||||
|
||||
KeyPairUtilities.store(application, seed, ed25519KeyPair, x25519KeyPair)
|
||||
configFactory.keyPairChanged()
|
||||
val userHexEncodedPublicKey = x25519KeyPair.hexEncodedPublicKey
|
||||
val registrationID = KeyHelper.generateRegistrationId(false)
|
||||
prefs.setLocalRegistrationId(registrationID)
|
||||
prefs.setLocalNumber(userHexEncodedPublicKey)
|
||||
prefs.setRestorationTime(0)
|
||||
|
||||
configFactory.keyPairChanged()
|
||||
configFactory.user?.setName(displayName)
|
||||
ConfigurationMessageUtilities.forceSyncConfigurationNowIfNeeded(application)
|
||||
|
||||
versionDataFetcher.startTimedVersionCheck()
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user