Modern-Apps.git
Publicgit clone https://git.maproj.org/Modern-Apps.gitModern-Apps.git / communicate-dev / src / main / java / com / vayunmathur / communicate / data / whatsapp / WhatsAppShims.kt
WhatsAppShims.kt42 lines · 1.5 KiBRaw
| 1 | package com.vayunmathur.communicate.data.whatsapp |
| 2 | |
| 3 | /** |
| 4 | * Small self-contained equivalents of the messages-module types that the ported WhatsApp engine |
| 5 | * referenced (`com.vayunmathur.messages.data.MessageSource`, |
| 6 | * `com.vayunmathur.messages.data.MessageAttachment`, |
| 7 | * `com.vayunmathur.messages.util.ContactSuggestion`). Duplicated here so `communicate` never |
| 8 | * depends on the messages module (repo rule: messages must not be modified / depended upon). |
| 9 | */ |
| 10 | |
| 11 | /** Backend that surfaced a conversation. WhatsApp-only in communicate, but kept as an enum so the |
| 12 | * ported event shapes match the originals verbatim. */ |
| 13 | enum class MessageSource { |
| 14 | WHATSAPP, |
| 15 | } |
| 16 | |
| 17 | /** A media/share attachment carried on a WhatsApp message. Mirrors messages' MessageAttachment. */ |
| 18 | data class MessageAttachment( |
| 19 | val url: String? = null, |
| 20 | val previewUrl: String? = null, |
| 21 | val mimeType: String? = null, |
| 22 | /** image | video | audio | sticker | file | share. */ |
| 23 | val attachmentType: String = "file", |
| 24 | val fileName: String? = null, |
| 25 | val title: String? = null, |
| 26 | val actionUrl: String? = null, |
| 27 | val width: Int = 0, |
| 28 | val height: Int = 0, |
| 29 | ) |
| 30 | |
| 31 | /** A contact search result. Mirrors messages' ContactSuggestion. */ |
| 32 | data class ContactSuggestion( |
| 33 | val displayName: String, |
| 34 | val phoneE164: String?, |
| 35 | val avatarUrl: String?, |
| 36 | val source: MessageSource? = null, |
| 37 | val username: String? = null, |
| 38 | ) |
| 39 | |
| 40 | /** Aggregated reaction on a message (emoji + count). */ |
| 41 | @kotlinx.serialization.Serializable |
| 42 | data class Reaction(val emoji: String, val count: Int) |