Auto-review
This commit is contained in:
parent
4125baf066
commit
2e93b7c4c9
|
@ -21,14 +21,14 @@ import im.vector.matrix.android.internal.crypto.model.rest.RestKeyInfo
|
||||||
|
|
||||||
internal object CryptoInfoMapper {
|
internal object CryptoInfoMapper {
|
||||||
|
|
||||||
fun map(restDeviceInfo: DeviceKeysWithUnsigned): CryptoDeviceInfo {
|
fun map(deviceKeysWithUnsigned: DeviceKeysWithUnsigned): CryptoDeviceInfo {
|
||||||
return CryptoDeviceInfo(
|
return CryptoDeviceInfo(
|
||||||
deviceId = restDeviceInfo.deviceId ?: "",
|
deviceId = deviceKeysWithUnsigned.deviceId,
|
||||||
userId = restDeviceInfo.userId ?: "",
|
userId = deviceKeysWithUnsigned.userId,
|
||||||
algorithms = restDeviceInfo.algorithms,
|
algorithms = deviceKeysWithUnsigned.algorithms,
|
||||||
keys = restDeviceInfo.keys,
|
keys = deviceKeysWithUnsigned.keys,
|
||||||
signatures = restDeviceInfo.signatures,
|
signatures = deviceKeysWithUnsigned.signatures,
|
||||||
unsigned = restDeviceInfo.unsigned,
|
unsigned = deviceKeysWithUnsigned.unsigned,
|
||||||
trustLevel = null
|
trustLevel = null
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,13 +25,13 @@ data class DeviceKeysWithUnsigned(
|
||||||
* Required. The ID of the user the device belongs to. Must match the user ID used when logging in.
|
* Required. The ID of the user the device belongs to. Must match the user ID used when logging in.
|
||||||
*/
|
*/
|
||||||
@Json(name = "user_id")
|
@Json(name = "user_id")
|
||||||
val userId: String?,
|
val userId: String,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Required. The ID of the device these keys belong to. Must match the device ID used when logging in.
|
* Required. The ID of the device these keys belong to. Must match the device ID used when logging in.
|
||||||
*/
|
*/
|
||||||
@Json(name = "device_id")
|
@Json(name = "device_id")
|
||||||
val deviceId: String?,
|
val deviceId: String,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Required. The encryption algorithms supported by this device.
|
* Required. The encryption algorithms supported by this device.
|
||||||
|
|
|
@ -23,16 +23,16 @@ import io.realm.annotations.PrimaryKey
|
||||||
|
|
||||||
internal fun DeviceInfoEntity.Companion.createPrimaryKey(userId: String, deviceId: String) = "$userId|$deviceId"
|
internal fun DeviceInfoEntity.Companion.createPrimaryKey(userId: String, deviceId: String) = "$userId|$deviceId"
|
||||||
|
|
||||||
// deviceInfoData contains serialized data
|
internal open class DeviceInfoEntity(
|
||||||
internal open class DeviceInfoEntity(@PrimaryKey var primaryKey: String = "",
|
@PrimaryKey var primaryKey: String = "",
|
||||||
var deviceId: String? = null,
|
var deviceId: String? = null,
|
||||||
var identityKey: String? = null,
|
var identityKey: String? = null,
|
||||||
// var deviceInfoData: String? = null,
|
|
||||||
var userId: String? = null,
|
var userId: String? = null,
|
||||||
var isBlocked: Boolean? = null,
|
var isBlocked: Boolean? = null,
|
||||||
var algorithmListJson: String? = null,
|
var algorithmListJson: String? = null,
|
||||||
var keysMapJson: String? = null,
|
var keysMapJson: String? = null,
|
||||||
var signatureMapJson: String? = null,
|
var signatureMapJson: String? = null,
|
||||||
|
// Will contain the device name from unsigned data if present
|
||||||
var unsignedMapJson: String? = null,
|
var unsignedMapJson: String? = null,
|
||||||
var trustLevelEntity: TrustLevelEntity? = null,
|
var trustLevelEntity: TrustLevelEntity? = null,
|
||||||
/**
|
/**
|
||||||
|
@ -42,16 +42,6 @@ internal open class DeviceInfoEntity(@PrimaryKey var primaryKey: String = "",
|
||||||
var firstTimeSeenLocalTs: Long? = null
|
var firstTimeSeenLocalTs: Long? = null
|
||||||
) : RealmObject() {
|
) : RealmObject() {
|
||||||
|
|
||||||
// // Deserialize data
|
|
||||||
// fun getDeviceInfo(): MXDeviceInfo? {
|
|
||||||
// return deserializeFromRealm(deviceInfoData)
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// // Serialize data
|
|
||||||
// fun putDeviceInfo(deviceInfo: MXDeviceInfo?) {
|
|
||||||
// deviceInfoData = serializeForRealm(deviceInfo)
|
|
||||||
// }
|
|
||||||
|
|
||||||
@LinkingObjects("devices")
|
@LinkingObjects("devices")
|
||||||
val users: RealmResults<UserEntity>? = null
|
val users: RealmResults<UserEntity>? = null
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue