kopia lustrzana https://github.com/ryukoposting/Signal-Android
Add support for general media attachments to release notes channel messages.
rodzic
98dfd5bfbf
commit
43fe789807
|
@ -43,9 +43,9 @@ class InternalSettingsRepository(context: Context) {
|
|||
body = body,
|
||||
threadId = threadId,
|
||||
messageRanges = bodyRangeList.build(),
|
||||
image = "/static/release-notes/signal.png",
|
||||
imageWidth = 1800,
|
||||
imageHeight = 720
|
||||
media = "/static/release-notes/signal.png",
|
||||
mediaWidth = 1800,
|
||||
mediaHeight = 720
|
||||
)
|
||||
|
||||
SignalDatabase.messages.insertBoostRequestMessage(recipientId, threadId)
|
||||
|
|
|
@ -208,9 +208,10 @@ class RetrieveRemoteAnnouncementsJob private constructor(private val force: Bool
|
|||
body = body,
|
||||
threadId = threadId,
|
||||
messageRanges = bodyRangeList.build(),
|
||||
image = note.translation.image,
|
||||
imageWidth = note.translation.imageWidth?.toIntOrNull() ?: 0,
|
||||
imageHeight = note.translation.imageHeight?.toIntOrNull() ?: 0
|
||||
media = note.translation.media,
|
||||
mediaWidth = note.translation.mediaWidth?.toIntOrNull() ?: 0,
|
||||
mediaHeight = note.translation.mediaHeight?.toIntOrNull() ?: 0,
|
||||
mediaType = note.translation.mediaContentType ?: "image/webp"
|
||||
)
|
||||
|
||||
if (insertResult != null) {
|
||||
|
@ -397,9 +398,10 @@ class RetrieveRemoteAnnouncementsJob private constructor(private val force: Bool
|
|||
|
||||
data class TranslatedReleaseNote(
|
||||
@JsonProperty val uuid: String,
|
||||
@JsonProperty val image: String?,
|
||||
@JsonProperty val imageWidth: String?,
|
||||
@JsonProperty val imageHeight: String?,
|
||||
@JsonProperty val media: String?,
|
||||
@JsonProperty val mediaWidth: String?,
|
||||
@JsonProperty val mediaHeight: String?,
|
||||
@JsonProperty val mediaContentType: String?,
|
||||
@JsonProperty val linkText: String?,
|
||||
@JsonProperty val title: String,
|
||||
@JsonProperty val body: String,
|
||||
|
|
|
@ -7,6 +7,7 @@ import org.thoughtcrime.securesms.database.model.StoryType
|
|||
import org.thoughtcrime.securesms.database.model.databaseprotos.BodyRangeList
|
||||
import org.thoughtcrime.securesms.mms.IncomingMediaMessage
|
||||
import org.thoughtcrime.securesms.recipients.RecipientId
|
||||
import org.thoughtcrime.securesms.util.MediaUtil
|
||||
import org.whispersystems.signalservice.api.messages.SignalServiceAttachment
|
||||
import org.whispersystems.signalservice.api.messages.SignalServiceAttachmentPointer
|
||||
import org.whispersystems.signalservice.api.messages.SignalServiceAttachmentRemoteId
|
||||
|
@ -24,29 +25,30 @@ object ReleaseChannel {
|
|||
recipientId: RecipientId,
|
||||
body: String,
|
||||
threadId: Long,
|
||||
image: String? = null,
|
||||
imageWidth: Int = 0,
|
||||
imageHeight: Int = 0,
|
||||
media: String? = null,
|
||||
mediaWidth: Int = 0,
|
||||
mediaHeight: Int = 0,
|
||||
mediaType: String = "image/webp",
|
||||
serverUuid: String? = UUID.randomUUID().toString(),
|
||||
messageRanges: BodyRangeList? = null,
|
||||
storyType: StoryType = StoryType.NONE
|
||||
): MessageTable.InsertResult? {
|
||||
|
||||
val attachments: Optional<List<SignalServiceAttachment>> = if (image != null) {
|
||||
val attachments: Optional<List<SignalServiceAttachment>> = if (media != null) {
|
||||
val attachment = SignalServiceAttachmentPointer(
|
||||
CDN_NUMBER,
|
||||
SignalServiceAttachmentRemoteId.from(""),
|
||||
"image/webp",
|
||||
mediaType,
|
||||
null,
|
||||
Optional.empty(),
|
||||
Optional.empty(),
|
||||
imageWidth,
|
||||
imageHeight,
|
||||
mediaWidth,
|
||||
mediaHeight,
|
||||
Optional.empty(),
|
||||
Optional.of(image),
|
||||
false,
|
||||
Optional.of(media),
|
||||
false,
|
||||
false,
|
||||
MediaUtil.isVideo(mediaType),
|
||||
Optional.empty(),
|
||||
Optional.empty(),
|
||||
System.currentTimeMillis()
|
||||
|
|
Ładowanie…
Reference in New Issue