From 69bcfe6c020a9f7581eebdc2267b94e9c1f06c5d Mon Sep 17 00:00:00 2001 From: Mikunj Date: Fri, 10 Jul 2020 13:39:05 +1000 Subject: [PATCH] Minor fixes --- .../jobmanager/migration/WorkManagerFactoryMappings.java | 2 ++ src/org/thoughtcrime/securesms/jobs/JobManagerFactories.java | 2 ++ src/org/thoughtcrime/securesms/jobs/PushDecryptJob.java | 2 +- .../thoughtcrime/securesms/loki/api/LokiPublicChatPoller.kt | 4 ++-- .../thoughtcrime/securesms/loki/shelved/LokiRSSFeedPoller.kt | 2 +- 5 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/org/thoughtcrime/securesms/jobmanager/migration/WorkManagerFactoryMappings.java b/src/org/thoughtcrime/securesms/jobmanager/migration/WorkManagerFactoryMappings.java index da6e221978..c4aa802414 100644 --- a/src/org/thoughtcrime/securesms/jobmanager/migration/WorkManagerFactoryMappings.java +++ b/src/org/thoughtcrime/securesms/jobmanager/migration/WorkManagerFactoryMappings.java @@ -44,6 +44,7 @@ import org.thoughtcrime.securesms.jobs.SmsSentJob; import org.thoughtcrime.securesms.jobs.TrimThreadJob; import org.thoughtcrime.securesms.jobs.TypingSendJob; import org.thoughtcrime.securesms.jobs.UpdateApkJob; +import org.thoughtcrime.securesms.loki.protocol.PushNullMessageSendJob; import java.util.HashMap; import java.util.Map; @@ -74,6 +75,7 @@ public class WorkManagerFactoryMappings { put(PushMediaSendJob.class.getName(), PushMediaSendJob.KEY); put(PushNotificationReceiveJob.class.getName(), PushNotificationReceiveJob.KEY); put(PushTextSendJob.class.getName(), PushTextSendJob.KEY); + put(PushNullMessageSendJob.class.getName(), PushNullMessageSendJob.KEY); put(RefreshAttributesJob.class.getName(), RefreshAttributesJob.KEY); put(RefreshPreKeysJob.class.getName(), RefreshPreKeysJob.KEY); put(RefreshUnidentifiedDeliveryAbilityJob.class.getName(), RefreshUnidentifiedDeliveryAbilityJob.KEY); diff --git a/src/org/thoughtcrime/securesms/jobs/JobManagerFactories.java b/src/org/thoughtcrime/securesms/jobs/JobManagerFactories.java index a366bafe8c..c1c869e920 100644 --- a/src/org/thoughtcrime/securesms/jobs/JobManagerFactories.java +++ b/src/org/thoughtcrime/securesms/jobs/JobManagerFactories.java @@ -15,6 +15,7 @@ import org.thoughtcrime.securesms.jobmanager.impl.SqlCipherMigrationConstraint; import org.thoughtcrime.securesms.jobmanager.impl.SqlCipherMigrationConstraintObserver; import org.thoughtcrime.securesms.loki.protocol.MultiDeviceOpenGroupUpdateJob; import org.thoughtcrime.securesms.loki.protocol.PushEphemeralMessageSendJob; +import org.thoughtcrime.securesms.loki.protocol.PushNullMessageSendJob; import java.util.Arrays; import java.util.HashMap; @@ -50,6 +51,7 @@ public final class JobManagerFactories { put(PushMediaSendJob.KEY, new PushMediaSendJob.Factory()); put(PushNotificationReceiveJob.KEY, new PushNotificationReceiveJob.Factory()); put(PushTextSendJob.KEY, new PushTextSendJob.Factory()); + put(PushNullMessageSendJob.KEY, new PushNullMessageSendJob.Factory()); put(RefreshAttributesJob.KEY, new RefreshAttributesJob.Factory()); put(RefreshPreKeysJob.KEY, new RefreshPreKeysJob.Factory()); put(RefreshUnidentifiedDeliveryAbilityJob.KEY, new RefreshUnidentifiedDeliveryAbilityJob.Factory()); diff --git a/src/org/thoughtcrime/securesms/jobs/PushDecryptJob.java b/src/org/thoughtcrime/securesms/jobs/PushDecryptJob.java index 04e7b50762..824dc11ec7 100644 --- a/src/org/thoughtcrime/securesms/jobs/PushDecryptJob.java +++ b/src/org/thoughtcrime/securesms/jobs/PushDecryptJob.java @@ -371,7 +371,7 @@ public class PushDecryptJob extends BaseJob implements InjectableType { // Loki - This is needed for compatibility with refactored desktop clients // ======== - if (envelope.isFriendRequest()) { + if (content.isFriendRequest()) { ApplicationContext.getInstance(context).getJobManager().add(new PushNullMessageSendJob(content.getSender())); } else { Log.w(TAG, "Got unrecognized message..."); diff --git a/src/org/thoughtcrime/securesms/loki/api/LokiPublicChatPoller.kt b/src/org/thoughtcrime/securesms/loki/api/LokiPublicChatPoller.kt index 17770c77a4..3389bb100e 100644 --- a/src/org/thoughtcrime/securesms/loki/api/LokiPublicChatPoller.kt +++ b/src/org/thoughtcrime/securesms/loki/api/LokiPublicChatPoller.kt @@ -34,7 +34,7 @@ import java.util.* class LokiPublicChatPoller(private val context: Context, private val group: LokiPublicChat) { private val handler = Handler() private var hasStarted = false - public var isCaughtUp = false + var isCaughtUp = false // region Convenience private val userHexEncodedPublicKey = TextSecurePreferences.getLocalNumber(context) @@ -166,7 +166,7 @@ class LokiPublicChatPoller(private val context: Context, private val group: Loki } val senderHexEncodedPublicKey = masterHexEncodedPublicKey ?: message.hexEncodedPublicKey val serviceDataMessage = getDataMessage(message) - val serviceContent = SignalServiceContent(serviceDataMessage, senderHexEncodedPublicKey, SignalServiceAddress.DEFAULT_DEVICE_ID, message.timestamp, false, false, false, false, false) + val serviceContent = SignalServiceContent(serviceDataMessage, senderHexEncodedPublicKey, SignalServiceAddress.DEFAULT_DEVICE_ID, message.timestamp, false, false, false, false) if (serviceDataMessage.quote.isPresent || (serviceDataMessage.attachments.isPresent && serviceDataMessage.attachments.get().size > 0) || serviceDataMessage.previews.isPresent) { PushDecryptJob(context).handleMediaMessage(serviceContent, serviceDataMessage, Optional.absent(), Optional.of(message.serverID)) } else { diff --git a/src/org/thoughtcrime/securesms/loki/shelved/LokiRSSFeedPoller.kt b/src/org/thoughtcrime/securesms/loki/shelved/LokiRSSFeedPoller.kt index 7096629119..de10a226fe 100644 --- a/src/org/thoughtcrime/securesms/loki/shelved/LokiRSSFeedPoller.kt +++ b/src/org/thoughtcrime/securesms/loki/shelved/LokiRSSFeedPoller.kt @@ -66,7 +66,7 @@ class LokiRSSFeedPoller(private val context: Context, private val feed: LokiRSSF val id = feed.id.toByteArray() val x1 = SignalServiceGroup(SignalServiceGroup.Type.UPDATE, id, SignalServiceGroup.GroupType.RSS_FEED, null, null, null, null) val x2 = SignalServiceDataMessage(timestamp, x1, null, body) - val x3 = SignalServiceContent(x2, "Loki", SignalServiceAddress.DEFAULT_DEVICE_ID, timestamp, false, false, false, false, false) + val x3 = SignalServiceContent(x2, "Loki", SignalServiceAddress.DEFAULT_DEVICE_ID, timestamp, false, false, false, false) PushDecryptJob(context).handleTextMessage(x3, x2, Optional.absent(), Optional.absent()) } }.fail { exception ->