mirror of
https://github.com/oxen-io/session-android.git
synced 2024-11-27 12:05:22 +00:00
fix: out of order config messages and avatar downloads, use the hex encoding instead of the mnemonic from seed
This commit is contained in:
parent
6c81580d93
commit
9136f1ac2d
@ -30,6 +30,7 @@ import org.session.libsignal.libsignal.util.KeyHelper
|
||||
import org.session.libsignal.service.loki.crypto.MnemonicCodec
|
||||
import org.session.libsignal.service.loki.utilities.hexEncodedPublicKey
|
||||
import org.session.libsignal.utilities.Hex
|
||||
import org.session.libsignal.utilities.logging.Log
|
||||
import org.thoughtcrime.securesms.ApplicationContext
|
||||
import org.thoughtcrime.securesms.BaseActionBarActivity
|
||||
import org.thoughtcrime.securesms.loki.fragments.ScanQRCodeWrapperFragment
|
||||
@ -68,7 +69,13 @@ class LinkDeviceActivity : BaseActionBarActivity(), ScanQRCodeWrapperFragmentDel
|
||||
|
||||
// region Interaction
|
||||
override fun handleQRCodeScanned(mnemonic: String) {
|
||||
continueWithMnemonic(mnemonic)
|
||||
try {
|
||||
val seed = Hex.fromStringCondensed(mnemonic)
|
||||
continueWithSeed(seed)
|
||||
} catch (e: Exception) {
|
||||
Log.e("Loki","Error getting seed from QR code", e)
|
||||
Toast.makeText(this, "An error occurred.", Toast.LENGTH_LONG).show()
|
||||
}
|
||||
}
|
||||
|
||||
fun continueWithMnemonic(mnemonic: String) {
|
||||
|
@ -32,7 +32,7 @@ class PNModeActivity : BaseActionBarActivity() {
|
||||
// region Lifecycle
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
setUpActionBarSessionLogo()
|
||||
setUpActionBarSessionLogo(true)
|
||||
TextSecurePreferences.setHasSeenWelcomeScreen(this, true)
|
||||
setContentView(R.layout.activity_pn_mode)
|
||||
contentView.disableClipping()
|
||||
|
@ -82,13 +82,12 @@ object MultiDeviceProtocol {
|
||||
// TODO: remove this after we migrate to new message receiving pipeline
|
||||
@JvmStatic
|
||||
fun handleConfigurationMessage(context: Context, content: SignalServiceProtos.Content, senderPublicKey: String, timestamp: Long) {
|
||||
val userPublicKey = TextSecurePreferences.getLocalNumber(context) ?: return
|
||||
synchronized(this) {
|
||||
val userPublicKey = TextSecurePreferences.getLocalNumber(context) ?: return
|
||||
if (TextSecurePreferences.getConfigurationMessageSynced(context) && !TextSecurePreferences.shouldUpdateProfile(context, timestamp)) return
|
||||
if (senderPublicKey != userPublicKey) return
|
||||
TextSecurePreferences.setConfigurationMessageSynced(context, true)
|
||||
TextSecurePreferences.setLastProfileUpdateTime(context, timestamp)
|
||||
}
|
||||
|
||||
val configurationMessage = ConfigurationMessage.fromProto(content) ?: return
|
||||
|
||||
@ -155,6 +154,7 @@ object MultiDeviceProtocol {
|
||||
if (configurationMessage.contacts.isNotEmpty()) {
|
||||
threadDatabase.notifyUpdatedFromConfig()
|
||||
}
|
||||
}
|
||||
// TODO: handle new configuration message fields or handle in new pipeline
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user