crypto: Rewrap and use the new isUserTracked method

This commit is contained in:
Damir Jelić 2021-11-24 14:35:52 +01:00
parent ac153c80d5
commit 38644f0aa2
2 changed files with 16 additions and 1 deletions

View file

@ -255,7 +255,11 @@ internal class DefaultCryptoService @Inject constructor(
* @return the tracking status
*/
override fun getDeviceTrackingStatus(userId: String): Int {
return cryptoStore.getDeviceTrackingStatus(userId, DeviceListManager.TRACKING_STATUS_NOT_TRACKED)
return if (olmMachine.isUserTracked(userId)) {
3
} else {
-1
}
}
/**

View file

@ -332,6 +332,17 @@ internal class OlmMachine(
suspend fun updateTrackedUsers(users: List<String>) =
withContext(Dispatchers.IO) { inner.updateTrackedUsers(users) }
/**
* Check if the given user is considered to be tracked.
* A user can be marked for tracking using the
* [OlmMachine.updateTrackedUsers] method.
*/
@Throws(CryptoStoreException::class)
fun isUserTracked(userId: String): Boolean {
return this.inner.isUserTracked(userId)
}
/**
* Generate one-time key claiming requests for all the users we are missing sessions for.
*