Update call tab to display unread missed call count.
This commit is contained in:
parent
cd5a3768eb
commit
18554170f2
2 changed files with 27 additions and 1 deletions
|
@ -1324,6 +1324,20 @@ open class MessageTable(context: Context?, databaseHelper: SignalDatabase) : Dat
|
||||||
return MmsReader(rawQueryWithAttachments(query, args, false, limit.toLong()))
|
return MmsReader(rawQueryWithAttachments(query, args, false, limit.toLong()))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun getUnreadMisedCallCount(): Long {
|
||||||
|
return readableDatabase
|
||||||
|
.select("COUNT(*)")
|
||||||
|
.from(TABLE_NAME)
|
||||||
|
.where(
|
||||||
|
"($TYPE = ? OR $TYPE = ?) AND $READ = ?",
|
||||||
|
MessageTypes.MISSED_AUDIO_CALL_TYPE,
|
||||||
|
MessageTypes.MISSED_VIDEO_CALL_TYPE,
|
||||||
|
0
|
||||||
|
)
|
||||||
|
.run()
|
||||||
|
.readToSingleLong(0L)
|
||||||
|
}
|
||||||
|
|
||||||
fun getParentStoryIdForGroupReply(messageId: Long): GroupReply? {
|
fun getParentStoryIdForGroupReply(messageId: Long): GroupReply? {
|
||||||
return readableDatabase
|
return readableDatabase
|
||||||
.select(PARENT_STORY_ID)
|
.select(PARENT_STORY_ID)
|
||||||
|
|
|
@ -48,6 +48,18 @@ class ConversationListTabRepository {
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getNumberOfUnseenCalls(): Observable<Long> {
|
fun getNumberOfUnseenCalls(): Observable<Long> {
|
||||||
return Observable.just(99)
|
return Observable.create { emitter ->
|
||||||
|
fun refresh() {
|
||||||
|
emitter.onNext(SignalDatabase.messages.getUnreadMisedCallCount())
|
||||||
|
}
|
||||||
|
|
||||||
|
val listener = DatabaseObserver.Observer {
|
||||||
|
refresh()
|
||||||
|
}
|
||||||
|
|
||||||
|
ApplicationDependencies.getDatabaseObserver().registerConversationListObserver(listener)
|
||||||
|
emitter.setCancellable { ApplicationDependencies.getDatabaseObserver().unregisterObserver(listener) }
|
||||||
|
refresh()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue