Immutable data class. var -> val

This commit is contained in:
Benoit Marty 2022-04-13 18:55:56 +02:00
parent 10b47c33d1
commit 3435357b1c
2 changed files with 20 additions and 21 deletions

View file

@ -20,23 +20,21 @@ import org.matrix.android.sdk.api.session.crypto.model.CryptoDeviceInfo
/** /**
* A signature in a `KeysBackupVersionTrust` object. * A signature in a `KeysBackupVersionTrust` object.
* TODO Make it a data class with only val
*/ */
class KeysBackupVersionTrustSignature { data class KeysBackupVersionTrustSignature(
/** /**
* The id of the device that signed the backup version. * The id of the device that signed the backup version.
*/ */
var deviceId: String? = null val deviceId: String?,
/** /**
* The device that signed the backup version. * The device that signed the backup version.
* Can be null if the device is not known. * Can be null if the device is not known.
*/ */
var device: CryptoDeviceInfo? = null val device: CryptoDeviceInfo?,
/** /**
* Flag to indicate the signature from this device is valid. * Flag to indicate the signature from this device is valid.
*/ */
var valid = false val valid: Boolean,
} )

View file

@ -455,10 +455,11 @@ internal class DefaultKeysBackupService @Inject constructor(
} }
} }
val signature = KeysBackupVersionTrustSignature() val signature = KeysBackupVersionTrustSignature(
signature.device = device deviceId = deviceId,
signature.valid = isSignatureValid device = device,
signature.deviceId = deviceId valid = isSignatureValid,
)
keysBackupVersionTrustSignatures.add(signature) keysBackupVersionTrustSignatures.add(signature)
} }
} }