diff --git a/src/org/thoughtcrime/securesms/jobs/PushDecryptJob.java b/src/org/thoughtcrime/securesms/jobs/PushDecryptJob.java index 704001145c..f2476c6783 100644 --- a/src/org/thoughtcrime/securesms/jobs/PushDecryptJob.java +++ b/src/org/thoughtcrime/securesms/jobs/PushDecryptJob.java @@ -827,11 +827,11 @@ public class PushDecryptJob extends BaseJob implements InjectableType { } private void handleFriendRequestIfNeeded(@NonNull SignalServiceEnvelope envelope, @NonNull SignalServiceContent content, @NonNull SignalServiceDataMessage message) { - Recipient recipient = getMessageDestination(content, message); - long threadID = DatabaseFactory.getThreadDatabase(context).getThreadIdIfExistsFor(recipient); LokiThreadFriendRequestDatabase threadFriendRequestDatabase = DatabaseFactory.getLokiThreadFriendRequestDatabase(context); - LokiThreadFriendRequestStatus threadFriendRequestStatus = threadFriendRequestDatabase.getFriendRequestStatus(threadID); LokiMessageFriendRequestDatabase messageFriendRequestDatabase = DatabaseFactory.getLokiMessageFriendRequestDatabase(context); + Recipient contactID = getMessageDestination(content, message); + long threadID = DatabaseFactory.getThreadDatabase(context).getThreadIdIfExistsFor(contactID); + LokiThreadFriendRequestStatus threadFriendRequestStatus = threadFriendRequestDatabase.getFriendRequestStatus(threadID); long messageID = DatabaseFactory.getSmsDatabase(context).getLastMessageIDForThread(threadID); if (envelope.isFriendRequest()) { if (threadFriendRequestStatus == LokiThreadFriendRequestStatus.REQUEST_SENT) { diff --git a/src/org/thoughtcrime/securesms/loki/FriendRequestView.kt b/src/org/thoughtcrime/securesms/loki/FriendRequestView.kt index 02a88450e4..925124de3e 100644 --- a/src/org/thoughtcrime/securesms/loki/FriendRequestView.kt +++ b/src/org/thoughtcrime/securesms/loki/FriendRequestView.kt @@ -82,7 +82,6 @@ class FriendRequestView(context: Context, attrs: AttributeSet?, defStyleAttr: In buttonLinearLayout.layoutParams = LayoutParams(LayoutParams.MATCH_PARENT, toPx(50, resources)) addView(buttonLinearLayout) } - // TODO: Observe friend request status changes } private fun updateUI() { diff --git a/src/org/thoughtcrime/securesms/loki/LokiMessageFriendRequestDatabase.kt b/src/org/thoughtcrime/securesms/loki/LokiMessageFriendRequestDatabase.kt index 220779284d..497b151242 100644 --- a/src/org/thoughtcrime/securesms/loki/LokiMessageFriendRequestDatabase.kt +++ b/src/org/thoughtcrime/securesms/loki/LokiMessageFriendRequestDatabase.kt @@ -42,8 +42,4 @@ class LokiMessageFriendRequestDatabase(context: Context, helper: SQLCipherOpenHe fun isFriendRequest(messageID: Long): Boolean { return getFriendRequestStatus(messageID) != LokiMessageFriendRequestStatus.NONE } - - fun hasFriendRequestStatusMessage(messageID: Long): Boolean { - return isFriendRequest(messageID) && getFriendRequestStatus(messageID) != LokiMessageFriendRequestStatus.REQUEST_SENDING_OR_FAILED - } } \ No newline at end of file