Cleanup: rename parameters, make some fields private, add Javadoc, fix copy paste error

This commit is contained in:
Benoit Marty 2020-09-02 12:03:03 +02:00
parent bf4f869524
commit 28081aa7d2
3 changed files with 14 additions and 5 deletions

View file

@ -124,8 +124,14 @@ interface SendService {
*/
fun deleteFailedEcho(localEcho: TimelineEvent)
/**
* Delete all the events in one of the sending states
*/
fun clearSendingQueue()
/**
* Cancel sending a specific event. It has to be in one of the sending states
*/
fun cancelSend(eventId: String)
/**

View file

@ -22,9 +22,12 @@ import java.io.IOException
import java.io.InputStream
import java.security.MessageDigest
class MatrixDigestCheckInputStream(`in`: InputStream?, val expectedDigest: String) : FilterInputStream(`in`) {
class MatrixDigestCheckInputStream(
inputStream: InputStream?,
private val expectedDigest: String
) : FilterInputStream(inputStream) {
val digest = MessageDigest.getInstance("SHA-256")
private val digest = MessageDigest.getInstance("SHA-256")
@Throws(IOException::class)
override fun read(): Int {

View file

@ -1076,12 +1076,12 @@ class RoomDetailViewModel @AssistedInject constructor(
private fun handleCancel(action: RoomDetailAction.CancelSend) {
val targetEventId = action.eventId
room.getTimeLineEvent(targetEventId)?.let {
// State must be UNDELIVERED or Failed
// State must be in one of the sending states
if (!it.root.sendState.isSending()) {
Timber.e("Cannot resend message, it is not failed, Cancel first")
Timber.e("Cannot cancel message, it is not sending")
return
}
room.cancelSend(action.eventId)
room.cancelSend(targetEventId)
}
}