Ensure OTK are uploaded when we upload the device keys

The sync response can omit the field device_one_time_keys_count.signed_curve25519 and the SDK was waiting to know this value to upload the OTK.
Now the SDK uploads the OTK when it uploads the device keys.
This commit is contained in:
Benoit Marty 2021-07-22 15:24:05 +02:00
parent 2070b0ecde
commit be488ae75a

View file

@ -314,6 +314,12 @@ internal class DefaultCryptoService @Inject constructor(
cryptoCoroutineScope.launchToCallback(coroutineDispatchers.crypto, NoOpMatrixCallback()) {
// Open the store
cryptoStore.open()
if (!cryptoStore.getDeviceKeysUploaded()) {
// Schedule upload of OTK
oneTimeKeysUploader.updateOneTimeKeyCount(0)
}
// this can throw if no network
tryOrNull {
uploadDeviceKeys()