mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-22 01:40:07 +01:00
Add dialog for when you hit edit message limit.
This commit is contained in:
@@ -5,7 +5,7 @@ import org.thoughtcrime.securesms.database.model.MessageRecord
|
||||
import org.thoughtcrime.securesms.recipients.Recipient
|
||||
import org.thoughtcrime.securesms.recipients.RecipientId
|
||||
import java.util.concurrent.TimeUnit
|
||||
import kotlin.time.Duration.Companion.hours
|
||||
import kotlin.time.Duration.Companion.milliseconds
|
||||
|
||||
/**
|
||||
* Helpers for determining if a message send/receive is valid for those that
|
||||
@@ -15,7 +15,7 @@ object MessageConstraintsUtil {
|
||||
private val RECEIVE_THRESHOLD = TimeUnit.DAYS.toMillis(1)
|
||||
private val SEND_THRESHOLD = TimeUnit.HOURS.toMillis(3)
|
||||
|
||||
private val MAX_EDIT_COUNT = 10
|
||||
const val MAX_EDIT_COUNT = 10
|
||||
|
||||
@JvmStatic
|
||||
fun isValidRemoteDeleteReceive(targetMessage: MessageRecord, deleteSenderId: RecipientId, deleteServerTimestamp: Long): Boolean {
|
||||
@@ -42,9 +42,14 @@ object MessageConstraintsUtil {
|
||||
return targetMessages.all { isValidRemoteDeleteSend(it, currentTime) }
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun isWithinMaxEdits(targetMessage: MessageRecord): Boolean {
|
||||
return targetMessage.revisionNumber < MAX_EDIT_COUNT
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun getEditMessageThresholdHours(): Int {
|
||||
return SEND_THRESHOLD.hours.inWholeHours.toInt()
|
||||
return SEND_THRESHOLD.milliseconds.inWholeHours.toInt()
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user