mirror of
https://github.com/quik-sms/quik.git
synced 2026-11-22 21:58:53 +01:00
Merge pull request #533 from benwaffle/emoji-reacts
Parse and render emoji reactions
This commit is contained in:
@@ -81,6 +81,7 @@ dependencies {
|
|||||||
implementation "com.f2prateek.rx.preferences2:rx-preferences:$rx_preferences_version"
|
implementation "com.f2prateek.rx.preferences2:rx-preferences:$rx_preferences_version"
|
||||||
implementation "com.jakewharton.timber:timber:$timber_version"
|
implementation "com.jakewharton.timber:timber:$timber_version"
|
||||||
implementation "com.squareup.moshi:moshi:$moshi_version"
|
implementation "com.squareup.moshi:moshi:$moshi_version"
|
||||||
|
kapt "com.squareup.moshi:moshi-kotlin-codegen:$moshi_version"
|
||||||
implementation "com.squareup.okhttp3:okhttp:$okhttp3_version"
|
implementation "com.squareup.okhttp3:okhttp:$okhttp3_version"
|
||||||
implementation 'io.michaelrocks:libphonenumber-android:8.13.47'
|
implementation 'io.michaelrocks:libphonenumber-android:8.13.47'
|
||||||
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
||||||
|
|||||||
@@ -0,0 +1,22 @@
|
|||||||
|
{
|
||||||
|
"emoji_reaction_ios_generic_added": "^(?s)Reacted (.+?) to “(.+?)”$",
|
||||||
|
"emoji_reaction_ios_generic_removed": "^(?s)Removed (.+?) from “(.+?)”$",
|
||||||
|
|
||||||
|
"emoji_reaction_ios_heart_added": "^(?s)Loved “(.+?)”$",
|
||||||
|
"emoji_reaction_ios_heart_removed": "^(?s)Removed a heart from “(.+?)”$",
|
||||||
|
|
||||||
|
"emoji_reaction_ios_like_added": "^(?s)Liked “(.+?)”$",
|
||||||
|
"emoji_reaction_ios_like_removed": "^(?s)Removed a like from “(.+?)”$",
|
||||||
|
|
||||||
|
"emoji_reaction_ios_dislike_added": "^(?s)Disliked “(.+?)”$",
|
||||||
|
"emoji_reaction_ios_dislike_removed": "^(?s)Removed a dislike from “(.+?)”$",
|
||||||
|
|
||||||
|
"emoji_reaction_ios_laugh_added": "^(?s)Laughed at “(.+?)”$",
|
||||||
|
"emoji_reaction_ios_laugh_removed": "^(?s)Removed a laugh from “(.+?)”$",
|
||||||
|
|
||||||
|
"emoji_reaction_ios_exclamation_added": "^(?s)Emphasized “(.+?)”$",
|
||||||
|
"emoji_reaction_ios_exclamation_removed": "^(?s)Removed an exclamation from “(.+?)”$",
|
||||||
|
|
||||||
|
"emoji_reaction_ios_question_mark_added": "^(?s)Questioned “(.+?)”$",
|
||||||
|
"emoji_reaction_ios_question_mark_removed": "^(?s)Removed a question mark from “(.+?)”$"
|
||||||
|
}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
{
|
||||||
|
"emoji_reaction_ios_heart_added": "^(?s)Очень понравилось «(.+?)»$",
|
||||||
|
|
||||||
|
"emoji_reaction_ios_like_added": "^(?s)Понравилось «(.+?)»$",
|
||||||
|
|
||||||
|
"emoji_reaction_ios_dislike_added": "^(?s)Не понравилось «(.+?)»$",
|
||||||
|
|
||||||
|
"emoji_reaction_ios_laugh_added": "^(?s)Посмеялись над «(.+?)»$",
|
||||||
|
|
||||||
|
"emoji_reaction_ios_exclamation_added": "^(?s)Отмечено «(.+?)»$",
|
||||||
|
|
||||||
|
"emoji_reaction_ios_question_mark_added": "^(?s)Поставлен вопрос на «(.+?)»$"
|
||||||
|
}
|
||||||
@@ -36,7 +36,7 @@ class QkRealmMigration @Inject constructor(
|
|||||||
) : RealmMigration {
|
) : RealmMigration {
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
const val SchemaVersion: Long = 13
|
const val SchemaVersion: Long = 14
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressLint("ApplySharedPref")
|
@SuppressLint("ApplySharedPref")
|
||||||
@@ -252,6 +252,31 @@ class QkRealmMigration @Inject constructor(
|
|||||||
if (version == 12L) {
|
if (version == 12L) {
|
||||||
realm.schema.get("Conversation")
|
realm.schema.get("Conversation")
|
||||||
?.addField("draftDate", Long::class.java, FieldAttribute.REQUIRED)
|
?.addField("draftDate", Long::class.java, FieldAttribute.REQUIRED)
|
||||||
|
|
||||||
|
version++
|
||||||
|
}
|
||||||
|
|
||||||
|
if (version == 13L) {
|
||||||
|
val emojiReactionTable = realm.schema.create("EmojiReaction")
|
||||||
|
.addField("id", Long::class.java, FieldAttribute.PRIMARY_KEY, FieldAttribute.REQUIRED)
|
||||||
|
.addField("reactionMessageId", Long::class.java, FieldAttribute.INDEXED, FieldAttribute.REQUIRED)
|
||||||
|
.addField("senderAddress", String::class.java, FieldAttribute.REQUIRED)
|
||||||
|
.addField("emoji", String::class.java, FieldAttribute.REQUIRED)
|
||||||
|
.addField("originalMessageText", String::class.java, FieldAttribute.REQUIRED)
|
||||||
|
.addField("threadId", Long::class.java, FieldAttribute.INDEXED, FieldAttribute.REQUIRED)
|
||||||
|
|
||||||
|
realm.schema.get("Message")
|
||||||
|
?.addField("isEmojiReaction", Boolean::class.java, FieldAttribute.REQUIRED)
|
||||||
|
?.addRealmListField("emojiReactions", emojiReactionTable)
|
||||||
|
?.transform { msg ->
|
||||||
|
msg.setBoolean("isEmojiReaction", false)
|
||||||
|
}
|
||||||
|
|
||||||
|
realm.schema.create("EmojiSyncNeeded")
|
||||||
|
.addField("createdAt", Long::class.java, FieldAttribute.REQUIRED)
|
||||||
|
|
||||||
|
realm.createObject("EmojiSyncNeeded")
|
||||||
|
|
||||||
version++
|
version++
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,296 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2025
|
||||||
|
*
|
||||||
|
* This file is part of QUIK.
|
||||||
|
*
|
||||||
|
* QUIK is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* QUIK is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with QUIK. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package dev.octoshrimpy.quik.repository
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
import com.squareup.moshi.Moshi
|
||||||
|
import dev.octoshrimpy.quik.extensions.insertOrUpdate
|
||||||
|
import dev.octoshrimpy.quik.manager.KeyManager
|
||||||
|
import dev.octoshrimpy.quik.model.EmojiReaction
|
||||||
|
import dev.octoshrimpy.quik.model.Message
|
||||||
|
import dev.octoshrimpy.quik.util.EmojiPatternStrings
|
||||||
|
import io.realm.Realm
|
||||||
|
import io.realm.Sort
|
||||||
|
import timber.log.Timber
|
||||||
|
import javax.inject.Inject
|
||||||
|
|
||||||
|
class EmojiReactionRepositoryImpl @Inject constructor(
|
||||||
|
private val context: Context,
|
||||||
|
private val keyManager: KeyManager,
|
||||||
|
private val moshi: Moshi,
|
||||||
|
) : EmojiReactionRepository {
|
||||||
|
// We use an ordered map to make sure we can test tapback regexes before generic ones
|
||||||
|
private val reactionPatterns: LinkedHashMap<Regex, (MatchResult) -> ParsedEmojiReaction?> = linkedMapOf(
|
||||||
|
Regex( // Google Messages
|
||||||
|
"(?s)^\u200a[^\u200b\u200a]*\u200b([^\u200b]*)\u200b[^\u200b\u200a]*\u200a(.*)\u200a[^\u200b\u200a]*\u200a\\Z"
|
||||||
|
) to { match -> ParsedEmojiReaction(match.groupValues[1], match.groupValues[2]) }
|
||||||
|
)
|
||||||
|
private val removalPatterns: LinkedHashMap<Regex, (MatchResult) -> ParsedEmojiReaction?> = linkedMapOf(
|
||||||
|
Regex( // Google Messages
|
||||||
|
"(?s)^\u200a[^\u200c\u200a]*\u200c([^\u200c]*)\u200c[^\u200c\u200a]*\u200a(.*)\u200a[^\u200c\u200a]*\u200a\\Z"
|
||||||
|
) to { match -> ParsedEmojiReaction(match.groupValues[1], match.groupValues[2], isRemoval = true) }
|
||||||
|
)
|
||||||
|
|
||||||
|
init {
|
||||||
|
val assetEntries = loadEmojiPatternEntriesFromAssets()
|
||||||
|
assetEntries.forEach { (localeTag, strings) ->
|
||||||
|
try {
|
||||||
|
addPatternsForLocaleStrings(localeTag, strings, reactionPatterns, removalPatterns)
|
||||||
|
} catch (e: Exception) {
|
||||||
|
Timber.w(e, "Failed to load asset patterns for locale: $localeTag")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Timber.i("Loaded emoji reaction patterns for locales: ${assetEntries.map { it.first }}")
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun addPatternsForLocaleStrings(
|
||||||
|
localeTag: String,
|
||||||
|
strings: EmojiPatternStrings,
|
||||||
|
reactionPatterns: LinkedHashMap<Regex, (MatchResult) -> ParsedEmojiReaction?>,
|
||||||
|
removalPatterns: LinkedHashMap<Regex, (MatchResult) -> ParsedEmojiReaction?>
|
||||||
|
) {
|
||||||
|
// iOS tapbacks (important to add these before generic emoji patterns as the regexes may overlap)
|
||||||
|
listOf(
|
||||||
|
Triple("❤️", strings.iosHeartAdded, strings.iosHeartRemoved),
|
||||||
|
Triple("👍", strings.iosLikeAdded, strings.iosLikeRemoved),
|
||||||
|
Triple("👎", strings.iosDislikeAdded, strings.iosDislikeRemoved),
|
||||||
|
Triple("😂", strings.iosLaughAdded, strings.iosLaughRemoved),
|
||||||
|
Triple("‼️", strings.iosExclamationAdded, strings.iosExclamationRemoved),
|
||||||
|
Triple("❓", strings.iosQuestionMarkAdded, strings.iosQuestionMarkRemoved)
|
||||||
|
).forEach { (emoji, added, removed) ->
|
||||||
|
added?.let {
|
||||||
|
reactionPatterns[Regex(it)] =
|
||||||
|
{ match -> ParsedEmojiReaction(emoji, match.groupValues[1]) }
|
||||||
|
}
|
||||||
|
removed?.let {
|
||||||
|
removalPatterns[Regex(it)] =
|
||||||
|
{ match -> ParsedEmojiReaction(emoji, match.groupValues[1], isRemoval = true) }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Generic iOS emoji patterns
|
||||||
|
strings.iosGenericAdded?.let { pattern ->
|
||||||
|
reactionPatterns[Regex(pattern)] = { match ->
|
||||||
|
if (match.groupValues.getOrNull(1) == "with a sticker") null // TODO: localize "with a sticker"
|
||||||
|
else ParsedEmojiReaction(match.groupValues[1], match.groupValues[2])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
strings.iosGenericRemoved?.let { pattern ->
|
||||||
|
removalPatterns[Regex(pattern)] = { match ->
|
||||||
|
ParsedEmojiReaction(match.groupValues[1], match.groupValues[2], isRemoval = true)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Timber.d("Loaded emoji regex patterns for $localeTag from assets")
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun loadEmojiPatternEntriesFromAssets(): List<Pair<String, EmojiPatternStrings>> {
|
||||||
|
val dir = "emojis"
|
||||||
|
val files = context.assets.list(dir) ?: emptyArray()
|
||||||
|
return files.filter { it.endsWith(".json", ignoreCase = true) }
|
||||||
|
.mapNotNull { filename ->
|
||||||
|
val localeTag = filename.removeSuffix(".json")
|
||||||
|
try {
|
||||||
|
val json = context.assets.open("$dir/$filename").bufferedReader().use { it.readText() }
|
||||||
|
val data = parseEmojiPatternsJson(json)
|
||||||
|
localeTag to data
|
||||||
|
} catch (e: Exception) {
|
||||||
|
Timber.w(e, "Failed parsing emoji patterns asset: $filename")
|
||||||
|
null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun parseEmojiPatternsJson(json: String): EmojiPatternStrings {
|
||||||
|
val adapter = moshi.adapter(EmojiPatternStrings::class.java)
|
||||||
|
return requireNotNull(adapter.fromJson(json)) { "Invalid emoji patterns JSON" }
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun parseEmojiReaction(body: String): ParsedEmojiReaction? {
|
||||||
|
val removal = parseRemoval(body)
|
||||||
|
if (removal != null) return removal
|
||||||
|
|
||||||
|
for ((pattern, parser) in reactionPatterns) {
|
||||||
|
val match = pattern.find(body)
|
||||||
|
if (match == null) continue;
|
||||||
|
|
||||||
|
val result = parser(match)
|
||||||
|
if (result == null) continue
|
||||||
|
|
||||||
|
Timber.d("Reaction found with ${result.emoji}")
|
||||||
|
return result
|
||||||
|
}
|
||||||
|
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun parseRemoval(body: String): ParsedEmojiReaction? {
|
||||||
|
for ((pattern, parser) in removalPatterns) {
|
||||||
|
val match = pattern.find(body)
|
||||||
|
if (match == null) continue;
|
||||||
|
|
||||||
|
val result = parser(match)
|
||||||
|
if (result == null) continue
|
||||||
|
|
||||||
|
Timber.d("Removal found with ${result.emoji}")
|
||||||
|
return result
|
||||||
|
}
|
||||||
|
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Search for messages in the same thread with matching text content
|
||||||
|
* We'll search recent messages first
|
||||||
|
*/
|
||||||
|
override fun findTargetMessage(
|
||||||
|
threadId: Long,
|
||||||
|
originalMessageText: String,
|
||||||
|
realm: Realm
|
||||||
|
): Message? {
|
||||||
|
val startTime = System.currentTimeMillis()
|
||||||
|
val messages = realm.where(Message::class.java)
|
||||||
|
.equalTo("threadId", threadId)
|
||||||
|
.sort("date", Sort.DESCENDING)
|
||||||
|
.findAll()
|
||||||
|
val endTime = System.currentTimeMillis()
|
||||||
|
Timber.d("Found ${messages.size} messages as potential emoji targets in ${endTime - startTime}ms")
|
||||||
|
|
||||||
|
val match = messages.find { message ->
|
||||||
|
message.getText(false).trim() == originalMessageText.trim()
|
||||||
|
}
|
||||||
|
if (match != null) {
|
||||||
|
Timber.d("Found match for reaction target: message ID ${match.id}")
|
||||||
|
return match
|
||||||
|
}
|
||||||
|
|
||||||
|
Timber.w("No target message found for reaction text: '$originalMessageText'")
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun removeEmojiReaction(
|
||||||
|
reactionMessage: Message,
|
||||||
|
reaction: ParsedEmojiReaction,
|
||||||
|
targetMessage: Message?,
|
||||||
|
realm: Realm,
|
||||||
|
) {
|
||||||
|
if (targetMessage == null) {
|
||||||
|
Timber.w("Cannot remove emoji reaction '${reaction.emoji}': no target message found")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
val existingReaction = targetMessage.emojiReactions.find { candidate ->
|
||||||
|
candidate.senderAddress == reactionMessage.address && candidate.emoji == reaction.emoji
|
||||||
|
}
|
||||||
|
|
||||||
|
if (existingReaction != null) {
|
||||||
|
existingReaction.deleteFromRealm()
|
||||||
|
Timber.d("Removed emoji reaction: ${reaction.emoji} to message ${targetMessage.id}")
|
||||||
|
} else {
|
||||||
|
Timber.w("No existing emoji reaction found to remove: ${reaction.emoji} to message ${targetMessage.id}")
|
||||||
|
}
|
||||||
|
|
||||||
|
reactionMessage.isEmojiReaction = true
|
||||||
|
realm.insertOrUpdate(reactionMessage)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun saveEmojiReaction(
|
||||||
|
reactionMessage: Message,
|
||||||
|
parsedReaction: ParsedEmojiReaction,
|
||||||
|
targetMessage: Message?,
|
||||||
|
realm: Realm,
|
||||||
|
) {
|
||||||
|
if (parsedReaction.isRemoval) {
|
||||||
|
removeEmojiReaction(reactionMessage, parsedReaction, targetMessage, realm)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
val reaction = EmojiReaction().apply {
|
||||||
|
id = keyManager.newId()
|
||||||
|
reactionMessageId = reactionMessage.id
|
||||||
|
senderAddress = reactionMessage.address
|
||||||
|
emoji = parsedReaction.emoji
|
||||||
|
originalMessageText = parsedReaction.originalMessage
|
||||||
|
threadId = reactionMessage.threadId
|
||||||
|
}
|
||||||
|
realm.insertOrUpdate(reaction)
|
||||||
|
|
||||||
|
if (targetMessage != null) {
|
||||||
|
reactionMessage.isEmojiReaction = true
|
||||||
|
realm.insertOrUpdate(reactionMessage)
|
||||||
|
|
||||||
|
// Overwrite any previous reaction from this sender for this target
|
||||||
|
val priorFromSender = targetMessage.emojiReactions.filter { it.senderAddress == reaction.senderAddress }
|
||||||
|
priorFromSender.forEach { it.deleteFromRealm() }
|
||||||
|
|
||||||
|
targetMessage.emojiReactions.add(reaction)
|
||||||
|
|
||||||
|
Timber.i("Saved emoji reaction: ${reaction.emoji} to message ${targetMessage.id}")
|
||||||
|
} else {
|
||||||
|
Timber.w("No target message, cannot save emoji reaction: ${reaction.emoji}")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun deleteAndReparseAllEmojiReactions(realm: Realm) {
|
||||||
|
val startTime = System.currentTimeMillis()
|
||||||
|
|
||||||
|
realm.delete(EmojiReaction::class.java)
|
||||||
|
realm.where(Message::class.java).findAll().map {
|
||||||
|
it.isEmojiReaction = false
|
||||||
|
}
|
||||||
|
|
||||||
|
val allMessages = realm.where(Message::class.java)
|
||||||
|
.beginGroup()
|
||||||
|
.beginGroup()
|
||||||
|
.equalTo("type", "sms")
|
||||||
|
.isNotEmpty("body")
|
||||||
|
.endGroup()
|
||||||
|
.or()
|
||||||
|
.beginGroup()
|
||||||
|
.equalTo("type", "mms")
|
||||||
|
.notEqualTo("messageType", 130.toLong())
|
||||||
|
.isNotEmpty("parts.text")
|
||||||
|
.endGroup()
|
||||||
|
.endGroup()
|
||||||
|
.sort("date", Sort.ASCENDING) // parse oldest to newest to handle reactions & removals properly
|
||||||
|
.findAll()
|
||||||
|
|
||||||
|
allMessages.forEach { message ->
|
||||||
|
val text = message.getText(false)
|
||||||
|
val parsedReaction = parseEmojiReaction(text)
|
||||||
|
if (parsedReaction != null) {
|
||||||
|
val targetMessage = findTargetMessage(
|
||||||
|
message.threadId,
|
||||||
|
parsedReaction.originalMessage,
|
||||||
|
realm
|
||||||
|
)
|
||||||
|
saveEmojiReaction(
|
||||||
|
message,
|
||||||
|
parsedReaction,
|
||||||
|
targetMessage,
|
||||||
|
realm,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
val endTime = System.currentTimeMillis()
|
||||||
|
Timber.d("Deleted and reparsed all emoji reactions in ${endTime - startTime}ms")
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -78,6 +78,7 @@ open class MessageRepositoryImpl @Inject constructor(
|
|||||||
private val phoneNumberUtils: PhoneNumberUtils,
|
private val phoneNumberUtils: PhoneNumberUtils,
|
||||||
private val prefs: Preferences,
|
private val prefs: Preferences,
|
||||||
private val syncRepository: SyncRepository,
|
private val syncRepository: SyncRepository,
|
||||||
|
private val reactions: EmojiReactionRepository,
|
||||||
) : MessageRepository {
|
) : MessageRepository {
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
@@ -88,6 +89,7 @@ open class MessageRepositoryImpl @Inject constructor(
|
|||||||
Realm.getDefaultInstance()
|
Realm.getDefaultInstance()
|
||||||
.where(Message::class.java)
|
.where(Message::class.java)
|
||||||
.equalTo("threadId", threadId)
|
.equalTo("threadId", threadId)
|
||||||
|
.equalTo("isEmojiReaction", false)
|
||||||
.let {
|
.let {
|
||||||
when (query.isEmpty()) {
|
when (query.isEmpty()) {
|
||||||
true -> it
|
true -> it
|
||||||
@@ -761,6 +763,25 @@ open class MessageRepositoryImpl @Inject constructor(
|
|||||||
// Update contentId after the message has been inserted to the content provider
|
// Update contentId after the message has been inserted to the content provider
|
||||||
realm.executeTransaction { managedMessage?.contentId = id }
|
realm.executeTransaction { managedMessage?.contentId = id }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
managedMessage?.let { savedMessage ->
|
||||||
|
val parsedReaction = reactions.parseEmojiReaction(body)
|
||||||
|
if (parsedReaction != null) {
|
||||||
|
val targetMessage = reactions.findTargetMessage(
|
||||||
|
savedMessage.threadId,
|
||||||
|
parsedReaction.originalMessage,
|
||||||
|
realm
|
||||||
|
)
|
||||||
|
realm.executeTransaction {
|
||||||
|
reactions.saveEmojiReaction(
|
||||||
|
savedMessage,
|
||||||
|
parsedReaction,
|
||||||
|
targetMessage,
|
||||||
|
realm,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return message
|
return message
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ import dev.octoshrimpy.quik.mapper.CursorToRecipient
|
|||||||
import dev.octoshrimpy.quik.model.Contact
|
import dev.octoshrimpy.quik.model.Contact
|
||||||
import dev.octoshrimpy.quik.model.ContactGroup
|
import dev.octoshrimpy.quik.model.ContactGroup
|
||||||
import dev.octoshrimpy.quik.model.Conversation
|
import dev.octoshrimpy.quik.model.Conversation
|
||||||
|
import dev.octoshrimpy.quik.model.EmojiReaction
|
||||||
import dev.octoshrimpy.quik.model.Message
|
import dev.octoshrimpy.quik.model.Message
|
||||||
import dev.octoshrimpy.quik.model.MmsPart
|
import dev.octoshrimpy.quik.model.MmsPart
|
||||||
import dev.octoshrimpy.quik.model.PhoneNumber
|
import dev.octoshrimpy.quik.model.PhoneNumber
|
||||||
@@ -68,7 +69,8 @@ class SyncRepositoryImpl @Inject constructor(
|
|||||||
private val cursorToContactGroupMember: CursorToContactGroupMember,
|
private val cursorToContactGroupMember: CursorToContactGroupMember,
|
||||||
private val keys: KeyManager,
|
private val keys: KeyManager,
|
||||||
private val phoneNumberUtils: PhoneNumberUtils,
|
private val phoneNumberUtils: PhoneNumberUtils,
|
||||||
private val rxPrefs: RxSharedPreferences
|
private val rxPrefs: RxSharedPreferences,
|
||||||
|
private val reactions: EmojiReactionRepository,
|
||||||
) : SyncRepository {
|
) : SyncRepository {
|
||||||
|
|
||||||
override val syncProgress: Subject<SyncRepository.SyncProgress> =
|
override val syncProgress: Subject<SyncRepository.SyncProgress> =
|
||||||
@@ -228,6 +230,9 @@ class SyncRepositoryImpl @Inject constructor(
|
|||||||
|
|
||||||
syncProgress.onNext(SyncRepository.SyncProgress.Running(0, 0, true))
|
syncProgress.onNext(SyncRepository.SyncProgress.Running(0, 0, true))
|
||||||
|
|
||||||
|
// Now that we have all the messages, we can scan for emoji reactions
|
||||||
|
reactions.deleteAndReparseAllEmojiReactions(realm)
|
||||||
|
|
||||||
realm.insert(SyncLog())
|
realm.insert(SyncLog())
|
||||||
}, {
|
}, {
|
||||||
handlerThread.quitSafely()
|
handlerThread.quitSafely()
|
||||||
@@ -287,6 +292,26 @@ class SyncRepositoryImpl @Inject constructor(
|
|||||||
|
|
||||||
conversationRepo.getOrCreateConversation(threadId)
|
conversationRepo.getOrCreateConversation(threadId)
|
||||||
insertOrUpdate()
|
insertOrUpdate()
|
||||||
|
|
||||||
|
val text = getText(false)
|
||||||
|
val parsedReaction = reactions.parseEmojiReaction(text)
|
||||||
|
if (parsedReaction != null) {
|
||||||
|
Realm.getDefaultInstance().use { realm ->
|
||||||
|
val targetMessage = reactions.findTargetMessage(
|
||||||
|
threadId,
|
||||||
|
parsedReaction.originalMessage,
|
||||||
|
realm
|
||||||
|
)
|
||||||
|
realm.executeTransaction {
|
||||||
|
reactions.saveEmojiReaction(
|
||||||
|
this,
|
||||||
|
parsedReaction,
|
||||||
|
targetMessage,
|
||||||
|
realm,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,28 @@
|
|||||||
|
package dev.octoshrimpy.quik.util
|
||||||
|
|
||||||
|
import com.squareup.moshi.Json
|
||||||
|
import com.squareup.moshi.JsonClass
|
||||||
|
|
||||||
|
@JsonClass(generateAdapter = false)
|
||||||
|
data class EmojiPatternStrings(
|
||||||
|
@Json(name = "emoji_reaction_ios_generic_added") val iosGenericAdded: String? = null,
|
||||||
|
@Json(name = "emoji_reaction_ios_generic_removed") val iosGenericRemoved: String? = null,
|
||||||
|
|
||||||
|
@Json(name = "emoji_reaction_ios_heart_added") val iosHeartAdded: String? = null,
|
||||||
|
@Json(name = "emoji_reaction_ios_heart_removed") val iosHeartRemoved: String? = null,
|
||||||
|
|
||||||
|
@Json(name = "emoji_reaction_ios_like_added") val iosLikeAdded: String? = null,
|
||||||
|
@Json(name = "emoji_reaction_ios_like_removed") val iosLikeRemoved: String? = null,
|
||||||
|
|
||||||
|
@Json(name = "emoji_reaction_ios_dislike_added") val iosDislikeAdded: String? = null,
|
||||||
|
@Json(name = "emoji_reaction_ios_dislike_removed") val iosDislikeRemoved: String? = null,
|
||||||
|
|
||||||
|
@Json(name = "emoji_reaction_ios_laugh_added") val iosLaughAdded: String? = null,
|
||||||
|
@Json(name = "emoji_reaction_ios_laugh_removed") val iosLaughRemoved: String? = null,
|
||||||
|
|
||||||
|
@Json(name = "emoji_reaction_ios_exclamation_added") val iosExclamationAdded: String? = null,
|
||||||
|
@Json(name = "emoji_reaction_ios_exclamation_removed") val iosExclamationRemoved: String? = null,
|
||||||
|
|
||||||
|
@Json(name = "emoji_reaction_ios_question_mark_added") val iosQuestionMarkAdded: String? = null,
|
||||||
|
@Json(name = "emoji_reaction_ios_question_mark_removed") val iosQuestionMarkRemoved: String? = null,
|
||||||
|
)
|
||||||
@@ -0,0 +1,42 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2025
|
||||||
|
*
|
||||||
|
* This file is part of QUIK.
|
||||||
|
*
|
||||||
|
* QKSMS is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* QKSMS is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with QKSMS. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package dev.octoshrimpy.quik.model
|
||||||
|
|
||||||
|
import io.realm.RealmObject
|
||||||
|
import io.realm.annotations.Index
|
||||||
|
import io.realm.annotations.PrimaryKey
|
||||||
|
|
||||||
|
open class EmojiReaction : RealmObject() {
|
||||||
|
@PrimaryKey var id: Long = 0
|
||||||
|
|
||||||
|
/** The reaction message ID itself */
|
||||||
|
@Index var reactionMessageId: Long = 0
|
||||||
|
|
||||||
|
/** The sender's address (phone number) */
|
||||||
|
var senderAddress: String = ""
|
||||||
|
|
||||||
|
/** The emoji used in the reaction */
|
||||||
|
var emoji: String = ""
|
||||||
|
|
||||||
|
/** The original message text that was reacted to */
|
||||||
|
var originalMessageText: String = ""
|
||||||
|
|
||||||
|
/** Thread ID for easier querying */
|
||||||
|
@Index var threadId: Long = 0
|
||||||
|
}
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2025
|
||||||
|
*
|
||||||
|
* This file is part of QUIK.
|
||||||
|
*
|
||||||
|
* QUIK is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* QUIK is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with QUIK. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package dev.octoshrimpy.quik.model
|
||||||
|
|
||||||
|
import io.realm.RealmObject
|
||||||
|
|
||||||
|
open class EmojiSyncNeeded : RealmObject() {
|
||||||
|
var createdAt: Long = System.currentTimeMillis()
|
||||||
|
}
|
||||||
@@ -74,6 +74,8 @@ open class Message : RealmObject() {
|
|||||||
var subject: String = ""
|
var subject: String = ""
|
||||||
var textContentType: String = ""
|
var textContentType: String = ""
|
||||||
var parts: RealmList<MmsPart> = RealmList()
|
var parts: RealmList<MmsPart> = RealmList()
|
||||||
|
var isEmojiReaction: Boolean = false
|
||||||
|
val emojiReactions: RealmList<EmojiReaction> = RealmList()
|
||||||
|
|
||||||
fun getUri(): Uri {
|
fun getUri(): Uri {
|
||||||
val baseUri = if (isMms()) Mms.CONTENT_URI else Sms.CONTENT_URI
|
val baseUri = if (isMms()) Mms.CONTENT_URI else Sms.CONTENT_URI
|
||||||
|
|||||||
@@ -0,0 +1,39 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2025
|
||||||
|
*
|
||||||
|
* This file is part of QUIK.
|
||||||
|
*
|
||||||
|
* QUIK is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* QUIK is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with QUIK. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package dev.octoshrimpy.quik.repository
|
||||||
|
|
||||||
|
import dev.octoshrimpy.quik.model.Message
|
||||||
|
import io.realm.Realm
|
||||||
|
|
||||||
|
data class ParsedEmojiReaction(val emoji: String, val originalMessage: String, val isRemoval: Boolean = false)
|
||||||
|
|
||||||
|
interface EmojiReactionRepository {
|
||||||
|
fun parseEmojiReaction(body: String): ParsedEmojiReaction?
|
||||||
|
|
||||||
|
fun findTargetMessage(threadId: Long, originalMessageText: String, realm: Realm): Message?
|
||||||
|
|
||||||
|
fun saveEmojiReaction(
|
||||||
|
reactionMessage: Message,
|
||||||
|
parsedReaction: ParsedEmojiReaction,
|
||||||
|
targetMessage: Message?,
|
||||||
|
realm: Realm,
|
||||||
|
)
|
||||||
|
|
||||||
|
fun deleteAndReparseAllEmojiReactions(realm: Realm)
|
||||||
|
}
|
||||||
@@ -28,6 +28,7 @@ object BubbleUtils {
|
|||||||
|
|
||||||
fun canGroup(message: Message, other: Message?): Boolean {
|
fun canGroup(message: Message, other: Message?): Boolean {
|
||||||
if (other == null) return false
|
if (other == null) return false
|
||||||
|
if (message.emojiReactions.isNotEmpty() || other.emojiReactions.isNotEmpty()) return false
|
||||||
val diff = TimeUnit.MILLISECONDS.toMinutes(Math.abs(message.date - other.date))
|
val diff = TimeUnit.MILLISECONDS.toMinutes(Math.abs(message.date - other.date))
|
||||||
return message.compareSender(other) && diff < TIMESTAMP_THRESHOLD
|
return message.compareSender(other) && diff < TIMESTAMP_THRESHOLD
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -74,7 +74,9 @@ import io.reactivex.subjects.Subject
|
|||||||
import io.realm.RealmResults
|
import io.realm.RealmResults
|
||||||
import kotlinx.android.synthetic.main.message_list_item_in.*
|
import kotlinx.android.synthetic.main.message_list_item_in.*
|
||||||
import kotlinx.android.synthetic.main.message_list_item_in.body
|
import kotlinx.android.synthetic.main.message_list_item_in.body
|
||||||
|
import kotlinx.android.synthetic.main.message_list_item_in.reactionText
|
||||||
import kotlinx.android.synthetic.main.message_list_item_in.parts
|
import kotlinx.android.synthetic.main.message_list_item_in.parts
|
||||||
|
import kotlinx.android.synthetic.main.message_list_item_in.reactions
|
||||||
import kotlinx.android.synthetic.main.message_list_item_in.sim
|
import kotlinx.android.synthetic.main.message_list_item_in.sim
|
||||||
import kotlinx.android.synthetic.main.message_list_item_in.simIndex
|
import kotlinx.android.synthetic.main.message_list_item_in.simIndex
|
||||||
import kotlinx.android.synthetic.main.message_list_item_in.status
|
import kotlinx.android.synthetic.main.message_list_item_in.status
|
||||||
@@ -389,6 +391,50 @@ class MessagesAdapter @Inject constructor(
|
|||||||
contextMenuValue = message.id
|
contextMenuValue = message.id
|
||||||
clicks.subscribe(partClicks) // part clicks gets passed back to compose view model
|
clicks.subscribe(partClicks) // part clicks gets passed back to compose view model
|
||||||
}
|
}
|
||||||
|
|
||||||
|
showEmojiReactions(holder, message)
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun showEmojiReactions(holder: QkViewHolder, message: Message) {
|
||||||
|
holder.reactions?.let { reactionsContainer ->
|
||||||
|
val reactions = message.emojiReactions
|
||||||
|
val hasReactions = reactions.isNotEmpty()
|
||||||
|
|
||||||
|
if (hasReactions) {
|
||||||
|
val reactionCounts = reactions.groupBy { it.emoji }
|
||||||
|
.mapValues { it.value.size }
|
||||||
|
.toList()
|
||||||
|
.sortedByDescending { it.second } // Sort by count, most reactions first
|
||||||
|
|
||||||
|
// For now, show just the first (most popular) reaction
|
||||||
|
val topReaction = reactionCounts.first()
|
||||||
|
val reactionText = if (topReaction.second == 1) {
|
||||||
|
topReaction.first
|
||||||
|
} else {
|
||||||
|
// Use a non-breaking space to keep the emoji and count together
|
||||||
|
"${topReaction.first}\u00A0${topReaction.second}"
|
||||||
|
}
|
||||||
|
|
||||||
|
holder.reactionText?.text = reactionText
|
||||||
|
reactionsContainer.setVisible(true)
|
||||||
|
makeRoomForEmojis(holder)
|
||||||
|
} else {
|
||||||
|
reactionsContainer.setVisible(false)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun makeRoomForEmojis(holder: QkViewHolder) {
|
||||||
|
val paddingBottom = 25.dpToPx(context)
|
||||||
|
|
||||||
|
(holder.reactions?.parent?.parent as? ViewGroup)?.let { parent ->
|
||||||
|
parent.setPadding(
|
||||||
|
parent.paddingLeft,
|
||||||
|
parent.paddingTop,
|
||||||
|
parent.paddingRight,
|
||||||
|
paddingBottom
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun bindStatus(
|
private fun bindStatus(
|
||||||
|
|||||||
@@ -42,8 +42,10 @@ import dev.octoshrimpy.quik.manager.BillingManager
|
|||||||
import dev.octoshrimpy.quik.manager.ChangelogManager
|
import dev.octoshrimpy.quik.manager.ChangelogManager
|
||||||
import dev.octoshrimpy.quik.manager.PermissionManager
|
import dev.octoshrimpy.quik.manager.PermissionManager
|
||||||
import dev.octoshrimpy.quik.manager.RatingManager
|
import dev.octoshrimpy.quik.manager.RatingManager
|
||||||
|
import dev.octoshrimpy.quik.model.EmojiSyncNeeded
|
||||||
import dev.octoshrimpy.quik.model.SyncLog
|
import dev.octoshrimpy.quik.model.SyncLog
|
||||||
import dev.octoshrimpy.quik.repository.ConversationRepository
|
import dev.octoshrimpy.quik.repository.ConversationRepository
|
||||||
|
import dev.octoshrimpy.quik.repository.EmojiReactionRepository
|
||||||
import dev.octoshrimpy.quik.repository.MessageRepository
|
import dev.octoshrimpy.quik.repository.MessageRepository
|
||||||
import dev.octoshrimpy.quik.repository.SyncRepository
|
import dev.octoshrimpy.quik.repository.SyncRepository
|
||||||
import dev.octoshrimpy.quik.util.Preferences
|
import dev.octoshrimpy.quik.util.Preferences
|
||||||
@@ -79,6 +81,7 @@ class MainViewModel @Inject constructor(
|
|||||||
private val permissionManager: PermissionManager,
|
private val permissionManager: PermissionManager,
|
||||||
private val prefs: Preferences,
|
private val prefs: Preferences,
|
||||||
private val ratingManager: RatingManager,
|
private val ratingManager: RatingManager,
|
||||||
|
private val reactions: EmojiReactionRepository,
|
||||||
private val syncContacts: SyncContacts,
|
private val syncContacts: SyncContacts,
|
||||||
private val syncMessages: SyncMessages
|
private val syncMessages: SyncMessages
|
||||||
) : QkViewModel<MainView, MainState>(
|
) : QkViewModel<MainView, MainState>(
|
||||||
@@ -121,6 +124,15 @@ class MainViewModel @Inject constructor(
|
|||||||
syncMessages.execute(Unit)
|
syncMessages.execute(Unit)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// This is only used when we update to a version that newly supports emoji reactions
|
||||||
|
Realm.getDefaultInstance().executeTransactionAsync { realm ->
|
||||||
|
val emojiSyncNeeded = realm.where(EmojiSyncNeeded::class.java).findFirst()
|
||||||
|
if (emojiSyncNeeded != null) {
|
||||||
|
reactions.deleteAndReparseAllEmojiReactions(realm)
|
||||||
|
emojiSyncNeeded.deleteFromRealm()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Sync contacts when we detect a change
|
// Sync contacts when we detect a change
|
||||||
if (permissionManager.hasContacts()) {
|
if (permissionManager.hasContacts()) {
|
||||||
disposables += contactAddedListener.listen()
|
disposables += contactAddedListener.listen()
|
||||||
|
|||||||
@@ -81,6 +81,8 @@ import dev.octoshrimpy.quik.repository.ContactRepository
|
|||||||
import dev.octoshrimpy.quik.repository.ContactRepositoryImpl
|
import dev.octoshrimpy.quik.repository.ContactRepositoryImpl
|
||||||
import dev.octoshrimpy.quik.repository.ConversationRepository
|
import dev.octoshrimpy.quik.repository.ConversationRepository
|
||||||
import dev.octoshrimpy.quik.repository.ConversationRepositoryImpl
|
import dev.octoshrimpy.quik.repository.ConversationRepositoryImpl
|
||||||
|
import dev.octoshrimpy.quik.repository.EmojiReactionRepository
|
||||||
|
import dev.octoshrimpy.quik.repository.EmojiReactionRepositoryImpl
|
||||||
import dev.octoshrimpy.quik.repository.MessageContentFilterRepository
|
import dev.octoshrimpy.quik.repository.MessageContentFilterRepository
|
||||||
import dev.octoshrimpy.quik.repository.MessageContentFilterRepositoryImpl
|
import dev.octoshrimpy.quik.repository.MessageContentFilterRepositoryImpl
|
||||||
import dev.octoshrimpy.quik.repository.MessageRepository
|
import dev.octoshrimpy.quik.repository.MessageRepository
|
||||||
@@ -219,6 +221,9 @@ class AppModule(private var application: Application) {
|
|||||||
@Provides
|
@Provides
|
||||||
fun provideSyncRepository(repository: SyncRepositoryImpl): SyncRepository = repository
|
fun provideSyncRepository(repository: SyncRepositoryImpl): SyncRepository = repository
|
||||||
|
|
||||||
|
@Provides
|
||||||
|
fun provideEmojiReactionRepository(repository: EmojiReactionRepositoryImpl): EmojiReactionRepository = repository
|
||||||
|
|
||||||
// worker factory
|
// worker factory
|
||||||
@Provides
|
@Provides
|
||||||
fun provideWorkerFactory(workerFactory: InjectionWorkerFactory): WorkerFactory = workerFactory
|
fun provideWorkerFactory(workerFactory: InjectionWorkerFactory): WorkerFactory = workerFactory
|
||||||
|
|||||||
@@ -79,7 +79,9 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginStart="12dp"
|
android:layout_marginStart="12dp"
|
||||||
android:orientation="horizontal"
|
android:orientation="horizontal"
|
||||||
app:layout_constraintBottom_toBottomOf="parent">
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
|
android:clipToPadding="false"
|
||||||
|
android:clipChildren="false">
|
||||||
|
|
||||||
<dev.octoshrimpy.quik.common.widget.AvatarView
|
<dev.octoshrimpy.quik.common.widget.AvatarView
|
||||||
android:id="@+id/avatar"
|
android:id="@+id/avatar"
|
||||||
@@ -89,16 +91,21 @@
|
|||||||
app:layout_constraintBottom_toBottomOf="@id/body"
|
app:layout_constraintBottom_toBottomOf="@id/body"
|
||||||
app:layout_constraintStart_toStartOf="parent" />
|
app:layout_constraintStart_toStartOf="parent" />
|
||||||
|
|
||||||
<LinearLayout
|
<RelativeLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginStart="12dp"
|
android:layout_marginStart="12dp"
|
||||||
android:orientation="vertical">
|
android:clipToPadding="false"
|
||||||
|
android:clipChildren="false"
|
||||||
|
android:paddingEnd="4dp"
|
||||||
|
android:paddingStart="4dp">
|
||||||
|
|
||||||
<dev.octoshrimpy.quik.common.widget.QkContextMenuRecyclerViewLongMmsPart
|
<dev.octoshrimpy.quik.common.widget.QkContextMenuRecyclerViewLongMmsPart
|
||||||
android:id="@+id/parts"
|
android:id="@+id/parts"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignParentStart="true"
|
||||||
|
android:layout_alignParentTop="true"
|
||||||
android:nestedScrollingEnabled="false"
|
android:nestedScrollingEnabled="false"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
|
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
|
||||||
@@ -110,6 +117,8 @@
|
|||||||
style="@style/TextPrimary"
|
style="@style/TextPrimary"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignParentStart="true"
|
||||||
|
android:layout_below="@id/parts"
|
||||||
android:layout_marginTop="2dp"
|
android:layout_marginTop="2dp"
|
||||||
android:autoLink="email|phone|web"
|
android:autoLink="email|phone|web"
|
||||||
android:background="@drawable/message_only"
|
android:background="@drawable/message_only"
|
||||||
@@ -118,7 +127,38 @@
|
|||||||
android:textIsSelectable="true"
|
android:textIsSelectable="true"
|
||||||
tools:backgroundTint="@color/tools_theme"
|
tools:backgroundTint="@color/tools_theme"
|
||||||
tools:text="@tools:sample/lorem/random" />
|
tools:text="@tools:sample/lorem/random" />
|
||||||
</LinearLayout>
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/reactions"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignBottom="@id/body"
|
||||||
|
android:layout_alignEnd="@id/body"
|
||||||
|
android:layout_marginEnd="-12dp"
|
||||||
|
android:layout_marginBottom="-20dp"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:visibility="gone"
|
||||||
|
tools:visibility="visible">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/reactionText"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:background="@drawable/message_only"
|
||||||
|
android:backgroundTint="?android:attr/colorBackground"
|
||||||
|
android:elevation="2dp"
|
||||||
|
android:maxLines="1"
|
||||||
|
android:paddingStart="8dp"
|
||||||
|
android:paddingTop="4dp"
|
||||||
|
android:paddingEnd="8dp"
|
||||||
|
android:paddingBottom="4dp"
|
||||||
|
android:text="😂 2"
|
||||||
|
android:textColor="?android:attr/textColorPrimary"
|
||||||
|
android:textSize="16sp" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</RelativeLayout>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
|||||||
@@ -92,7 +92,8 @@
|
|||||||
|
|
||||||
<RelativeLayout
|
<RelativeLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content">
|
android:layout_height="wrap_content"
|
||||||
|
android:clipToPadding="false">
|
||||||
|
|
||||||
<FrameLayout
|
<FrameLayout
|
||||||
android:id="@+id/cancelFrame"
|
android:id="@+id/cancelFrame"
|
||||||
@@ -138,24 +139,64 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_toStartOf="@id/sendNowIcon"
|
android:layout_toStartOf="@id/sendNowIcon"
|
||||||
android:layout_toEndOf="@id/cancelFrame"
|
android:layout_toEndOf="@id/cancelFrame"
|
||||||
android:orientation="horizontal">
|
android:orientation="horizontal"
|
||||||
|
android:clipChildren="false"
|
||||||
|
android:clipToPadding="false">
|
||||||
|
|
||||||
<View
|
<View
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_weight="1" />
|
android:layout_weight="1" />
|
||||||
|
|
||||||
<dev.octoshrimpy.quik.common.widget.TightTextView
|
<FrameLayout
|
||||||
android:id="@+id/body"
|
|
||||||
style="@style/TextPrimary"
|
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:autoLink="email|phone|web"
|
android:paddingStart="18dp"
|
||||||
android:background="@drawable/message_only"
|
android:clipToPadding="false"
|
||||||
android:backgroundTint="?attr/bubbleColor"
|
android:clipChildren="false">
|
||||||
android:gravity="start|center_vertical"
|
|
||||||
android:minHeight="36dp"
|
<dev.octoshrimpy.quik.common.widget.TightTextView
|
||||||
android:textIsSelectable="true" />
|
android:id="@+id/body"
|
||||||
|
style="@style/TextPrimary"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:autoLink="email|phone|web"
|
||||||
|
android:background="@drawable/message_only"
|
||||||
|
android:backgroundTint="?attr/bubbleColor"
|
||||||
|
android:gravity="start|center_vertical"
|
||||||
|
android:minHeight="36dp"
|
||||||
|
android:textIsSelectable="true" />
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/reactions"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="bottom|start"
|
||||||
|
android:layout_marginStart="-16dp"
|
||||||
|
android:layout_marginBottom="-20dp"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:visibility="gone"
|
||||||
|
tools:visibility="visible">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/reactionText"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:background="@drawable/message_only"
|
||||||
|
android:backgroundTint="?android:attr/colorBackground"
|
||||||
|
android:elevation="2dp"
|
||||||
|
android:maxLines="1"
|
||||||
|
android:paddingStart="8dp"
|
||||||
|
android:paddingTop="4dp"
|
||||||
|
android:paddingEnd="8dp"
|
||||||
|
android:paddingBottom="4dp"
|
||||||
|
android:text="👍"
|
||||||
|
android:textColor="?android:attr/textColorPrimary"
|
||||||
|
android:textSize="16sp" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</FrameLayout>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
|
|||||||
Reference in New Issue
Block a user