mirror of
https://github.com/oxen-io/session-android.git
synced 2024-11-23 18:15:22 +00:00
Remove incorrectly maintained & unused value
This commit is contained in:
parent
2a3d06e485
commit
80c90fa53d
@ -52,7 +52,7 @@ class BackgroundPollWorker(val context: Context, params: WorkerParameters) : Wor
|
||||
val dmsPromise = SnodeAPI.getMessages(userPublicKey).map { envelopes ->
|
||||
envelopes.map { envelope ->
|
||||
// FIXME: Using a job here seems like a bad idea...
|
||||
MessageReceiveJob(envelope.toByteArray(), false).executeAsync()
|
||||
MessageReceiveJob(envelope.toByteArray()).executeAsync()
|
||||
}
|
||||
}
|
||||
promises.addAll(dmsPromise.get())
|
||||
@ -61,12 +61,6 @@ class BackgroundPollWorker(val context: Context, params: WorkerParameters) : Wor
|
||||
promises.addAll(ClosedGroupPoller().pollOnce())
|
||||
|
||||
// Open Groups
|
||||
val openGroups = DatabaseFactory.getLokiThreadDatabase(context).getAllPublicChats().values
|
||||
for (openGroup in openGroups) {
|
||||
val poller = OpenGroupPoller(openGroup)
|
||||
promises.add(poller.pollForNewMessages())
|
||||
}
|
||||
|
||||
val v2OpenGroups = DatabaseFactory.getLokiThreadDatabase(context).getAllV2OpenGroups().values.groupBy(OpenGroupV2::server)
|
||||
|
||||
v2OpenGroups.values.map { groups ->
|
||||
|
@ -28,7 +28,7 @@ class PushNotificationService : FirebaseMessagingService() {
|
||||
if (data != null) {
|
||||
try {
|
||||
val envelopeAsData = MessageWrapper.unwrap(data).toByteArray()
|
||||
val job = MessageReceiveJob(envelopeAsData,true)
|
||||
val job = MessageReceiveJob(envelopeAsData)
|
||||
JobQueue.shared.add(job)
|
||||
} catch (e: Exception) {
|
||||
Log.d("Loki", "Failed to unwrap data for message due to error: $e.")
|
||||
|
@ -7,7 +7,7 @@ import org.session.libsession.messaging.sending_receiving.handle
|
||||
import org.session.libsession.messaging.utilities.Data
|
||||
import org.session.libsignal.utilities.Log
|
||||
|
||||
class MessageReceiveJob(val data: ByteArray, val isBackgroundPoll: Boolean, val openGroupMessageServerID: Long? = null, val openGroupID: String? = null) : Job {
|
||||
class MessageReceiveJob(val data: ByteArray, val openGroupMessageServerID: Long? = null, val openGroupID: String? = null) : Job {
|
||||
override var delegate: JobDelegate? = null
|
||||
override var id: String? = null
|
||||
override var failureCount: Int = 0
|
||||
@ -69,7 +69,6 @@ class MessageReceiveJob(val data: ByteArray, val isBackgroundPoll: Boolean, val
|
||||
|
||||
override fun serialize(): Data {
|
||||
val builder = Data.Builder().putByteArray(DATA_KEY, data)
|
||||
.putBoolean(IS_BACKGROUND_POLL_KEY, isBackgroundPoll)
|
||||
openGroupMessageServerID?.let { builder.putLong(OPEN_GROUP_MESSAGE_SERVER_ID_KEY, it) }
|
||||
openGroupID?.let { builder.putString(OPEN_GROUP_ID_KEY, it) }
|
||||
return builder.build();
|
||||
@ -84,7 +83,6 @@ class MessageReceiveJob(val data: ByteArray, val isBackgroundPoll: Boolean, val
|
||||
override fun create(data: Data): MessageReceiveJob {
|
||||
return MessageReceiveJob(
|
||||
data.getByteArray(DATA_KEY),
|
||||
data.getBoolean(IS_BACKGROUND_POLL_KEY),
|
||||
data.getLong(OPEN_GROUP_MESSAGE_SERVER_ID_KEY),
|
||||
data.getString(OPEN_GROUP_ID_KEY)
|
||||
)
|
||||
|
@ -70,7 +70,7 @@ class ClosedGroupPoller {
|
||||
return@successBackground
|
||||
}
|
||||
messages.forEach { envelope ->
|
||||
val job = MessageReceiveJob(envelope.toByteArray(), false)
|
||||
val job = MessageReceiveJob(envelope.toByteArray())
|
||||
JobQueue.shared.add(job)
|
||||
}
|
||||
}
|
||||
|
@ -172,7 +172,7 @@ class OpenGroupPoller(private val openGroup: OpenGroup, private val executorServ
|
||||
builder.timestamp = message.timestamp
|
||||
builder.serverTimestamp = message.serverTimestamp
|
||||
val envelope = builder.build()
|
||||
val job = MessageReceiveJob(envelope.toByteArray(), isBackgroundPoll, messageServerID, openGroup.id)
|
||||
val job = MessageReceiveJob(envelope.toByteArray(), messageServerID, openGroup.id)
|
||||
Log.d("Loki", "Scheduling Job $job")
|
||||
if (isBackgroundPoll) {
|
||||
job.executeAsync().always { deferred.resolve(Unit) }
|
||||
|
@ -99,7 +99,7 @@ class OpenGroupV2Poller(private val openGroups: List<OpenGroupV2>, private val e
|
||||
builder.content = message.toProto().toByteString()
|
||||
builder.timestamp = message.sentTimestamp
|
||||
val envelope = builder.build()
|
||||
val job = MessageReceiveJob(envelope.toByteArray(), isBackgroundPoll, message.serverID, serverRoomId)
|
||||
val job = MessageReceiveJob(envelope.toByteArray(), message.serverID, serverRoomId)
|
||||
Log.d("Loki", "Scheduling Job $job")
|
||||
if (isBackgroundPoll) {
|
||||
job.executeAsync()
|
||||
|
@ -92,7 +92,7 @@ class Poller {
|
||||
} else {
|
||||
val messages = SnodeAPI.parseRawMessagesResponse(rawResponse, snode, userPublicKey)
|
||||
messages.forEach { envelope ->
|
||||
val job = MessageReceiveJob(envelope.toByteArray(), false)
|
||||
val job = MessageReceiveJob(envelope.toByteArray())
|
||||
JobQueue.shared.add(job)
|
||||
}
|
||||
poll(snode, deferred)
|
||||
|
Loading…
Reference in New Issue
Block a user