mirror of
https://github.com/mollyim/mollyim-insider-android.git
synced 2025-05-13 05:40:53 +01:00
Switch to using dateSent for jump-to-calendar.
We use dateSent for date dividers, but were using dateReceived for calendar date availability, which would occasionally result in a mismatch. Switched to use the same thing we use for date dividers.
This commit is contained in:
parent
8c5768cec9
commit
4020ec0b1f
4 changed files with 9 additions and 9 deletions
|
@ -4136,7 +4136,7 @@ class ConversationFragment :
|
|||
}
|
||||
|
||||
override fun onDatePickerSelected() {
|
||||
disposables += viewModel.getEarliestMessageDate().subscribe { earliestDate ->
|
||||
disposables += viewModel.getEarliestMessageSentDate().subscribe { earliestDate ->
|
||||
val local = LocalDateTime.now()
|
||||
.atMidnight()
|
||||
.atUTC()
|
||||
|
|
|
@ -585,9 +585,9 @@ class ConversationRepository(
|
|||
}
|
||||
}
|
||||
|
||||
fun getEarliestMessageDate(threadId: Long): Single<Long> {
|
||||
fun getEarliestMessageSentDate(threadId: Long): Single<Long> {
|
||||
return Single
|
||||
.fromCallable { SignalDatabase.messages.getEarliestMessageDate(threadId) }
|
||||
.fromCallable { SignalDatabase.messages.getEarliestMessageSentDate(threadId) }
|
||||
.subscribeOn(Schedulers.io())
|
||||
}
|
||||
|
||||
|
|
|
@ -520,9 +520,9 @@ class ConversationViewModel(
|
|||
_jumpToDateValidator
|
||||
}
|
||||
|
||||
fun getEarliestMessageDate(): Single<Long> {
|
||||
fun getEarliestMessageSentDate(): Single<Long> {
|
||||
return repository
|
||||
.getEarliestMessageDate(threadId)
|
||||
.getEarliestMessageSentDate(threadId)
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3969,17 +3969,17 @@ open class MessageTable(context: Context?, databaseHelper: SignalDatabase) : Dat
|
|||
return dayStarts.associateWith { startOfDay ->
|
||||
readableDatabase
|
||||
.exists(TABLE_NAME)
|
||||
.where("$THREAD_ID = $threadId AND $DATE_RECEIVED >= $startOfDay AND $DATE_RECEIVED < $startOfDay + 86400000 AND $SCHEDULED_DATE = -1 AND $LATEST_REVISION_ID IS NULL AND $STORY_TYPE = 0 AND $PARENT_STORY_ID <= 0")
|
||||
.where("$THREAD_ID = $threadId AND $DATE_SENT >= $startOfDay AND $DATE_SENT < $startOfDay + 86400000 AND $SCHEDULED_DATE = -1 AND $LATEST_REVISION_ID IS NULL AND $STORY_TYPE = 0 AND $PARENT_STORY_ID <= 0")
|
||||
.run()
|
||||
}
|
||||
}
|
||||
|
||||
fun getEarliestMessageDate(threadId: Long): Long {
|
||||
fun getEarliestMessageSentDate(threadId: Long): Long {
|
||||
return readableDatabase
|
||||
.select(DATE_RECEIVED)
|
||||
.select(DATE_SENT)
|
||||
.from(TABLE_NAME)
|
||||
.where("$THREAD_ID = $threadId AND $SCHEDULED_DATE = -1 AND $LATEST_REVISION_ID IS NULL AND $STORY_TYPE = 0 AND $PARENT_STORY_ID <= 0")
|
||||
.orderBy("$DATE_RECEIVED ASC")
|
||||
.orderBy("$DATE_SENT ASC")
|
||||
.limit(1)
|
||||
.run()
|
||||
.readToSingleLong(0)
|
||||
|
|
Loading…
Reference in a new issue