mirror of
https://github.com/signalapp/Signal-Android.git
synced 2025-12-20 11:08:31 +00:00
Only add one sustainer request message per release notes update.
This commit is contained in:
@@ -113,7 +113,7 @@ class RetrieveRemoteAnnouncementsJob private constructor(private val force: Bool
|
||||
Log.i(TAG, "First check, saving code and skipping download")
|
||||
values.highestVersionNoteReceived = BuildConfig.CANONICAL_VERSION_CODE
|
||||
}
|
||||
MessageDigest.isEqual(manifestMd5, values.previousManifestMd5) -> {
|
||||
!force && MessageDigest.isEqual(manifestMd5, values.previousManifestMd5) -> {
|
||||
Log.i(TAG, "Manifest has not changed since last fetch.")
|
||||
}
|
||||
else -> fetchManifest(manifestMd5)
|
||||
@@ -178,6 +178,7 @@ class RetrieveRemoteAnnouncementsJob private constructor(private val force: Bool
|
||||
|
||||
val threadId = SignalDatabase.threads.getOrCreateThreadIdFor(Recipient.resolved(values.releaseChannelRecipientId!!))
|
||||
var highestVersion = values.highestVersionNoteReceived
|
||||
var addedNewNotes = false
|
||||
|
||||
resolvedNotes
|
||||
.filterNotNull()
|
||||
@@ -197,7 +198,7 @@ class RetrieveRemoteAnnouncementsJob private constructor(private val force: Bool
|
||||
bodyRangeList.addButton(note.translation.callToActionText, note.releaseNote.ctaId, body.lastIndex, 0)
|
||||
}
|
||||
|
||||
ThreadUtil.sleep(1)
|
||||
ThreadUtil.sleep(5)
|
||||
val insertResult: MessageDatabase.InsertResult? = ReleaseChannel.insertAnnouncement(
|
||||
recipientId = values.releaseChannelRecipientId!!,
|
||||
body = body,
|
||||
@@ -208,9 +209,8 @@ class RetrieveRemoteAnnouncementsJob private constructor(private val force: Bool
|
||||
imageHeight = note.translation.imageHeight?.toIntOrNull() ?: 0
|
||||
)
|
||||
|
||||
SignalDatabase.sms.insertBoostRequestMessage(values.releaseChannelRecipientId!!, threadId)
|
||||
|
||||
if (insertResult != null) {
|
||||
addedNewNotes = true
|
||||
SignalDatabase.attachments.getAttachmentsForMessage(insertResult.messageId)
|
||||
.forEach { ApplicationDependencies.getJobManager().add(AttachmentDownloadJob(insertResult.messageId, it.attachmentId, false)) }
|
||||
|
||||
@@ -221,6 +221,11 @@ class RetrieveRemoteAnnouncementsJob private constructor(private val force: Bool
|
||||
}
|
||||
}
|
||||
|
||||
if (addedNewNotes) {
|
||||
ThreadUtil.sleep(5)
|
||||
SignalDatabase.sms.insertBoostRequestMessage(values.releaseChannelRecipientId!!, threadId)
|
||||
}
|
||||
|
||||
values.highestVersionNoteReceived = highestVersion
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user