This commit is contained in:
Niels Andriesse 2019-06-28 14:07:42 +10:00
parent 86c765b1c2
commit 52a0b2a5e8
3 changed files with 3 additions and 8 deletions

View File

@ -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) {

View File

@ -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() {

View File

@ -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
}
}