mirror of
https://github.com/oxen-io/session-android.git
synced 2025-01-11 18:53:40 +00:00
Make member ordering consistent
This commit is contained in:
parent
ed87961850
commit
2441d86b32
@ -5,34 +5,31 @@ import org.session.libsession.messaging.utilities.Data
|
|||||||
import org.session.libsession.utilities.TextSecurePreferences
|
import org.session.libsession.utilities.TextSecurePreferences
|
||||||
|
|
||||||
class TrimThreadJob(val threadId: Long) : Job {
|
class TrimThreadJob(val threadId: Long) : Job {
|
||||||
companion object {
|
|
||||||
const val KEY: String = "TrimThreadJob"
|
|
||||||
|
|
||||||
const val THREAD_ID = "thread_id"
|
|
||||||
}
|
|
||||||
|
|
||||||
override var delegate: JobDelegate? = null
|
override var delegate: JobDelegate? = null
|
||||||
override var id: String? = null
|
override var id: String? = null
|
||||||
override var failureCount: Int = 0
|
override var failureCount: Int = 0
|
||||||
|
|
||||||
override val maxFailureCount: Int = 1
|
override val maxFailureCount: Int = 1
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
const val KEY: String = "TrimThreadJob"
|
||||||
|
const val THREAD_ID = "thread_id"
|
||||||
|
}
|
||||||
|
|
||||||
override fun execute() {
|
override fun execute() {
|
||||||
val context = MessagingModuleConfiguration.shared.context
|
val context = MessagingModuleConfiguration.shared.context
|
||||||
val trimmingEnabled = TextSecurePreferences.isThreadLengthTrimmingEnabled(context)
|
val trimmingEnabled = TextSecurePreferences.isThreadLengthTrimmingEnabled(context)
|
||||||
val threadLengthLimit = TextSecurePreferences.getThreadTrimLength(context)
|
val threadLengthLimit = TextSecurePreferences.getThreadTrimLength(context)
|
||||||
|
|
||||||
if (trimmingEnabled) {
|
if (trimmingEnabled) {
|
||||||
MessagingModuleConfiguration.shared.storage.trimThread(threadId, threadLengthLimit)
|
MessagingModuleConfiguration.shared.storage.trimThread(threadId, threadLengthLimit)
|
||||||
}
|
}
|
||||||
|
|
||||||
delegate?.handleJobSucceeded(this)
|
delegate?.handleJobSucceeded(this)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun serialize(): Data {
|
override fun serialize(): Data {
|
||||||
return Data.Builder()
|
return Data.Builder()
|
||||||
.putLong(THREAD_ID, threadId)
|
.putLong(THREAD_ID, threadId)
|
||||||
.build()
|
.build()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getFactoryKey(): String = "TrimThreadJob"
|
override fun getFactoryKey(): String = "TrimThreadJob"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user