mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2025-02-09 08:38:43 +01:00
crypto: Remove some more unused methods
This commit is contained in:
parent
dc8711be30
commit
ef93d9e625
@ -68,8 +68,6 @@ interface CryptoService {
|
|||||||
|
|
||||||
fun getUserDevices(userId: String): MutableList<CryptoDeviceInfo>
|
fun getUserDevices(userId: String): MutableList<CryptoDeviceInfo>
|
||||||
|
|
||||||
fun setDevicesKnown(devices: List<MXDeviceInfo>, callback: MatrixCallback<Unit>?)
|
|
||||||
|
|
||||||
fun getMyDevice(): CryptoDeviceInfo
|
fun getMyDevice(): CryptoDeviceInfo
|
||||||
|
|
||||||
fun getGlobalBlacklistUnverifiedDevices(): Boolean
|
fun getGlobalBlacklistUnverifiedDevices(): Boolean
|
||||||
@ -126,8 +124,6 @@ interface CryptoService {
|
|||||||
|
|
||||||
fun getCryptoDeviceInfo(userId: String): List<CryptoDeviceInfo>
|
fun getCryptoDeviceInfo(userId: String): List<CryptoDeviceInfo>
|
||||||
|
|
||||||
fun getLiveCryptoDeviceInfo(): LiveData<List<CryptoDeviceInfo>>
|
|
||||||
|
|
||||||
fun getLiveCryptoDeviceInfo(userId: String): LiveData<List<CryptoDeviceInfo>>
|
fun getLiveCryptoDeviceInfo(userId: String): LiveData<List<CryptoDeviceInfo>>
|
||||||
|
|
||||||
fun getLiveCryptoDeviceInfo(userIds: List<String>): LiveData<List<CryptoDeviceInfo>>
|
fun getLiveCryptoDeviceInfo(userIds: List<String>): LiveData<List<CryptoDeviceInfo>>
|
||||||
|
@ -413,10 +413,6 @@ internal class DefaultCryptoService @Inject constructor(
|
|||||||
return cryptoStore.getUserDeviceList(userId).orEmpty()
|
return cryptoStore.getUserDeviceList(userId).orEmpty()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getLiveCryptoDeviceInfo(): LiveData<List<CryptoDeviceInfo>> {
|
|
||||||
return cryptoStore.getLiveDeviceList()
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun getLiveCryptoDeviceInfo(userId: String): LiveData<List<CryptoDeviceInfo>> {
|
override fun getLiveCryptoDeviceInfo(userId: String): LiveData<List<CryptoDeviceInfo>> {
|
||||||
return cryptoStore.getLiveDeviceList(userId)
|
return cryptoStore.getLiveDeviceList(userId)
|
||||||
}
|
}
|
||||||
@ -425,43 +421,6 @@ internal class DefaultCryptoService @Inject constructor(
|
|||||||
return cryptoStore.getLiveDeviceList(userIds)
|
return cryptoStore.getLiveDeviceList(userIds)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the devices as known
|
|
||||||
*
|
|
||||||
* @param devices the devices. Note that the verified member of the devices in this list will not be updated by this method.
|
|
||||||
* @param callback the asynchronous callback
|
|
||||||
*/
|
|
||||||
override fun setDevicesKnown(devices: List<MXDeviceInfo>, callback: MatrixCallback<Unit>?) {
|
|
||||||
// build a devices map
|
|
||||||
val devicesIdListByUserId = devices.groupBy({ it.userId }, { it.deviceId })
|
|
||||||
|
|
||||||
for ((userId, deviceIds) in devicesIdListByUserId) {
|
|
||||||
val storedDeviceIDs = cryptoStore.getUserDevices(userId)
|
|
||||||
|
|
||||||
// sanity checks
|
|
||||||
if (null != storedDeviceIDs) {
|
|
||||||
var isUpdated = false
|
|
||||||
|
|
||||||
deviceIds.forEach { deviceId ->
|
|
||||||
val device = storedDeviceIDs[deviceId]
|
|
||||||
|
|
||||||
// assume if the device is either verified or blocked
|
|
||||||
// it means that the device is known
|
|
||||||
if (device?.isUnknown == true) {
|
|
||||||
device.trustLevel = DeviceTrustLevel(crossSigningVerified = false, locallyVerified = false)
|
|
||||||
isUpdated = true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isUpdated) {
|
|
||||||
cryptoStore.storeUserDevices(userId, storedDeviceIDs)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
callback?.onSuccess(Unit)
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update the blocked/verified state of the given device.
|
* Update the blocked/verified state of the given device.
|
||||||
*
|
*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user