Block input if a friend request is pending

This commit is contained in:
Niels Andriesse
2019-07-19 13:15:17 +10:00
parent b123948230
commit 8c054a060e
5 changed files with 30 additions and 6 deletions

View File

@@ -9,6 +9,7 @@ import org.whispersystems.signalservice.loki.messaging.LokiThreadDatabaseProtoco
import org.whispersystems.signalservice.loki.messaging.LokiThreadFriendRequestStatus
class LokiThreadFriendRequestDatabase(context: Context, helper: SQLCipherOpenHelper) : Database(context, helper), LokiThreadDatabaseProtocol {
var delegate: LokiThreadFriendRequestDatabaseDelegate? = null
companion object {
private val tableName = "loki_thread_friend_request_database"
@@ -40,6 +41,8 @@ class LokiThreadFriendRequestDatabase(context: Context, helper: SQLCipherOpenHel
contentValues.put(Companion.friendRequestStatus, friendRequestStatus.rawValue)
database.insertOrUpdate(tableName, contentValues, "${Companion.threadID} = ?", arrayOf( threadID.toString() ))
notifyConversationListListeners()
notifyConversationListeners(threadID)
delegate?.handleThreadFriendRequestStatusChanged(threadID)
}
fun hasPendingFriendRequest(threadID: Long): Boolean {

View File

@@ -0,0 +1,6 @@
package org.thoughtcrime.securesms.loki
interface LokiThreadFriendRequestDatabaseDelegate {
fun handleThreadFriendRequestStatusChanged(threadID: Long)
}