Merge remote-tracking branch 'origin/main' into claude/fix-nests-audio-receiver-HCgOY

This commit is contained in:
Claude
2026-05-06 03:18:09 +00:00
13 changed files with 412 additions and 28 deletions
+25 -3
View File
@@ -142,10 +142,32 @@ android {
]
}
// Opt-in fast-build flags. Default behavior is unchanged.
//
// -PdisableAbiSplits=true skip per-ABI APK splits; produces a single
// APK per (flavor, buildType) instead of 5.
// Cuts ~600 MB of intermediates and several
// minutes off CI.
// -PdisableUniversalApk=true when ABI splits are enabled, skip the
// extra universal APK output. (No effect
// when disableAbiSplits is also set, since
// there are no splits to add to.)
// -Pamethyst.skipMapping=true disable R8 minification on release and
// benchmark. APK is larger, but builds are
// much faster and outputs/mapping/ (~260MB)
// is not produced. Local-dev and PR-CI use
// only — release pipelines must not set it.
def disableAbiSplits = providers.gradleProperty("disableAbiSplits")
.map { it.toBoolean() }.getOrElse(false)
def disableUniversalApk = providers.gradleProperty("disableUniversalApk")
.map { it.toBoolean() }.getOrElse(false)
def skipMapping = providers.gradleProperty("amethyst.skipMapping")
.map { it.toBoolean() }.getOrElse(false)
buildTypes {
release {
proguardFiles getDefaultProguardFile("proguard-android-optimize.txt"), 'proguard-rules.pro'
minifyEnabled = true
minifyEnabled = !skipMapping
}
debug {
applicationIdSuffix '.debug'
@@ -186,10 +208,10 @@ android {
splits {
abi {
enable = true
enable = !disableAbiSplits
reset()
include "x86", "x86_64", "arm64-v8a", "armeabi-v7a"
universalApk = true
universalApk = !disableUniversalApk
}
}
@@ -83,6 +83,7 @@ import com.vitorpamplona.quartz.nip71Video.VideoVerticalEvent
import com.vitorpamplona.quartz.nip84Highlights.HighlightEvent
import com.vitorpamplona.quartz.nip88Polls.poll.PollEvent
import com.vitorpamplona.quartz.nipACWebRtcCalls.events.CallOfferEvent
import com.vitorpamplona.quartz.nipC7Chats.ChatEvent
import com.vitorpamplona.quartz.utils.Log
import com.vitorpamplona.quartz.utils.TimeUtils
import kotlinx.coroutines.TimeoutCancellationException
@@ -495,6 +496,67 @@ class EventNotificationConsumer(
)
}
/**
* Marmot kind:445 group messages have no `p` tag (recipients are routed
* by the `h` tag carrying the nostr_group_id), so the cache-observer path
* in [NotificationDispatcher] can't match them to an account. They're
* dispatched here directly from [com.vitorpamplona.amethyst.ui.screen.loggedIn.GroupEventHandler]
* once [com.vitorpamplona.quartz.marmot.MarmotInboundProcessor] has
* decrypted the outer ChaCha20-Poly1305 layer and verified the inner
* MLS-signed payload.
*
* Typed to [ChatEvent] so the caller has to narrow first — reactions,
* control messages, and deletions stay silent at the type level,
* mirroring how NIP-17 (kind:14) is the only DM kind we notify.
*/
suspend fun notifyGroupMessage(
innerEvent: ChatEvent,
nostrGroupId: String,
account: Account,
) = withWakeLock {
Log.d(TAG, "New Marmot Group Message to Notify")
if (!notificationManager().areNotificationsEnabled()) return@withWakeLock
if (MainActivity.isResumed) return@withWakeLock
// old event being re-broadcast
if (innerEvent.createdAt < TimeUtils.fifteenMinutesAgo()) return@withWakeLock
// a message we ourselves sent
if (innerEvent.pubKey == account.signer.pubKey) return@withWakeLock
val chatroom = account.marmotGroupList.getOrCreateGroup(nostrGroupId)
val groupName = chatroom.displayName.value?.takeIf { it.isNotBlank() } ?: "Private group"
val sender = LocalCache.getOrCreateUser(innerEvent.pubKey)
val senderName = sender.toBestDisplayName()
val senderPicture = sender.profilePicture()
// Defensive fallback for the rare empty-content ChatEvent so the
// popup is still actionable. Non-chat inner kinds were filtered
// out at the call site by the ChatEvent type narrowing.
val body = innerEvent.content.takeIf { it.isNotBlank() } ?: "New message"
val accountNpub =
account.signer.pubKey
.hexToByteArray()
.toNpub()
// marmot:<groupHex>?account=<npub> — same scheme as notifyWelcome,
// taps deep-link straight to the group's chatroom.
val noteUri = "marmot:$nostrGroupId$ACCOUNT_QUERY_PARAM$accountNpub"
notificationManager()
.sendDMNotification(
id = innerEvent.id,
messageBody = "$senderName: $body",
senderName = groupName,
time = innerEvent.createdAt,
pictureUrl = senderPicture,
uri = noteUri,
applicationContext = applicationContext,
accountNpub = accountNpub,
accountPictureUrl = account.userProfile().profilePicture(),
chatroomMembers = null,
)
}
suspend fun decryptZapContentAuthor(
event: LnZapRequestEvent,
signer: NostrSigner,
@@ -51,6 +51,7 @@ import com.vitorpamplona.quartz.nip71Video.VideoVerticalEvent
import com.vitorpamplona.quartz.nip84Highlights.HighlightEvent
import com.vitorpamplona.quartz.nip88Polls.poll.PollEvent
import com.vitorpamplona.quartz.nipACWebRtcCalls.events.CallOfferEvent
import com.vitorpamplona.quartz.nipC7Chats.ChatEvent
import com.vitorpamplona.quartz.utils.Log
import com.vitorpamplona.quartz.utils.TimeUtils
import kotlinx.coroutines.CancellationException
@@ -222,4 +223,24 @@ class NotificationDispatcher(
Log.e(TAG, "Failed to dispatch Welcome notification ${event.id}", e)
}
}
/**
* Direct-invocation entry point for Marmot kind:445 group messages.
* Bypasses the cache-observer path because GroupEvents are routed by
* the `h` tag (nostr_group_id), not by `p` tag. Called from
* [com.vitorpamplona.amethyst.ui.screen.loggedIn.GroupEventHandler]
* once the MLS-decrypted inner event has been parsed and indexed.
*/
suspend fun notifyGroupMessage(
innerEvent: ChatEvent,
nostrGroupId: String,
account: Account,
) {
try {
consumer.notifyGroupMessage(innerEvent, nostrGroupId, account)
} catch (e: Exception) {
if (e is CancellationException) throw e
Log.e(TAG, "Failed to dispatch Group Message notification ${innerEvent.id}", e)
}
}
}
@@ -49,6 +49,7 @@ import com.vitorpamplona.quartz.nipACWebRtcCalls.events.CallIceCandidateEvent
import com.vitorpamplona.quartz.nipACWebRtcCalls.events.CallOfferEvent
import com.vitorpamplona.quartz.nipACWebRtcCalls.events.CallRejectEvent
import com.vitorpamplona.quartz.nipACWebRtcCalls.events.CallRenegotiateEvent
import com.vitorpamplona.quartz.nipC7Chats.ChatEvent
import com.vitorpamplona.quartz.utils.Log
import kotlinx.coroutines.CancellationException
import kotlinx.coroutines.sync.Mutex
@@ -660,6 +661,21 @@ class GroupEventHandler(
// re-persist would silently grow the on-disk log).
if (isNew) {
manager.persistDecryptedMessage(result.groupId, result.innerEventJson)
// GroupEvents have no `p` tag, so the cache-observer
// notification path can't route them. Fire the popup
// directly here — only on first-time decryption, so
// a relay re-broadcast or persist-replay doesn't
// double-notify. Restrict to ChatEvent (kind:9) so
// reactions, deletions, and control messages stay
// silent.
if (innerEvent is ChatEvent) {
Amethyst.instance.notificationDispatcher.notifyGroupMessage(
innerEvent,
result.groupId,
account,
)
}
}
}
@@ -22,6 +22,7 @@ package com.vitorpamplona.amethyst.ui.screen.loggedIn.chats.rooms.twopane
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.imePadding
import androidx.compose.foundation.layout.padding
import androidx.compose.material3.Scaffold
import androidx.compose.material3.windowsizeclass.WindowWidthSizeClass
@@ -73,6 +74,7 @@ fun MessagesTwoPane(
val displayFeatures = calculateDisplayFeatures(act)
Scaffold(
modifier = Modifier.imePadding(),
topBar = {
UserDrawerSearchTopBar(accountViewModel, nav) { AmethystClickableIcon() }
},
@@ -43,12 +43,16 @@
<string name="login_with_a_private_key_to_be_able_to_boost_posts">Вы используете публичный ключ, они - только для чтения. Войдите в систему приватным ключом, чтобы продвигать записи</string>
<string name="login_with_a_private_key_to_like_posts">Вы используете публичный ключ, они - только для чтения. Войдите с приватным ключом, чтобы лайкать посты</string>
<string name="no_zap_amount_setup_long_press_to_change">Не настроены запы. Нажмите и удерживайте для настройки</string>
<string name="chat_zap_anonymous">Анонимный</string>
<string name="chat_clip_created_a_clip">создал клип</string>
<string name="login_with_a_private_key_to_be_able_to_send_zaps">Войдите с приватным ключом чтобы запать</string>
<string name="login_with_a_private_key_to_be_able_to_follow">Вы используете публичный ключ, они - только для чтения. Войдите в систему приватным ключом, чтобы иметь возможность подписаться</string>
<string name="login_with_a_private_key_to_be_able_to_unfollow">Вы используете публичный ключ, они - только для чтения. Войдите в систему приватным ключом, чтобы иметь возможность отписаться</string>
<string name="login_with_a_private_key_to_be_able_to_hide_word">Вы используете публичный ключ, они - только для чтения. Войдите в систему приватным ключом, чтобы иметь возможность скрыть слово или предложение</string>
<string name="login_with_a_private_key_to_be_able_to_show_word">Вы используете публичный ключ, они - только для чтения. Войдите в систему приватным ключом, чтобы иметь возможность показать слово или предложение</string>
<string name="login_with_a_private_key_to_be_able_to_change_settings">Вы используете публичный ключ. Войдите приватным ключом, чтобы редактировать</string>
<string name="login_with_a_private_key_to_be_able_to_upload">Вы используете публичный ключ, они - только для чтения. Войдите в систему приватным ключом, чтобы иметь возможность загружать</string>
<string name="unauthorized_exception_description">Подписчик не авторизовал расшифровку, необходимую для выполнения этой операции. Активируйте расшифровки NIP-44 в приложении для подписчика и попробуйте еще раз</string>
<string name="signer_not_found_exception">Подпись не найдена</string>
<string name="zaps">Запы</string>
<string name="view_count">Просмотры</string>
@@ -146,10 +150,14 @@
<string name="upload_file">Загрузить файл</string>
<string name="take_a_picture">Сделать фото</string>
<string name="record_a_video">Снять видео</string>
<string name="record_a_message">Записать сообщение</string>
<string name="record_a_message_title">Записать сообщение</string>
<string name="record_a_message_description">Нажмите и удерживайте, чтобы записать сообщение</string>
<string name="re_record">Перезаписать</string>
<string name="recording_indicator_description">Запись</string>
<string name="uploading">Загрузка…</string>
<string name="upload_error_title">Ошибка загрузки</string>
<string name="upload_error_voice_message_failed">Неудалось загрузить голосовое сообщение</string>
<string name="voice_preset_none">Отсутствует</string>
<string name="voice_preset_deep">Глубокий</string>
<string name="voice_preset_high">Высокий</string>
@@ -230,6 +238,7 @@
<string name="unfollow">Отписаться</string>
<string name="channel_created">Канал создан</string>
<string name="channel_information_changed_to">"Информация о канале изменена на"</string>
<string name="ephemeral_relay_chat">Исчезающий чат</string>
<string name="public_chat">Публичный чат</string>
<string name="posts_received">записей получено</string>
<string name="remove">Удалить</string>
@@ -336,6 +345,14 @@
<string name="bookmark_list_creation_screen_title">Новый список закладок</string>
<string name="bookmark_list_delete_btn_label">Удалить список закладок</string>
<string name="private_articles_label">Приватные статьи</string>
<string name="bookmark_remove_action_desc">Удалить закладку из списка</string>
<string name="bookmark_add_action_desc">Добавить закладку в список</string>
<string name="public_bookmark_add_action_label">Добавить в Публичные закладки</string>
<string name="private_bookmark_add_action_label">Добавить в Личные закладки</string>
<string name="bookmark_remove_action_label">Удалить из списка закладок</string>
<string name="bookmark_list_explainer">Метаданные списков закладок могут быть видны любым пользователем Nostr. Только ваши частные участники зашифрованы.</string>
<string name="move_bookmark_to_public_label">Переместить в публчный</string>
<string name="move_bookmark_to_private_label">Переместить в личные</string>
<string name="wallet_connect_service">Служба Wallet Connect</string>
<string name="wallet_connect_service_explainer">Позволяет оплачивать запы с помощью секрета, не выходя из приложения. Храните секрет в безопасности и по возможности используйте приватный релей</string>
<string name="wallet_connect_service_pubkey">Публичный ключ Wallet Connect</string>
@@ -343,6 +360,8 @@
<string name="wallet_connect_service_secret">Секрет Wallet Connect</string>
<string name="wallet_connect_service_show_secret">Показать секрет</string>
<string name="wallet_connect_service_secret_placeholder">nsec / приватный ключ в hex</string>
<string name="wallet_connect_status_connected">Подключено</string>
<string name="wallet_connect_manual_config">Дополнительно: ввести детали соединения вручную</string>
<string name="zap_type_section_explainer">Определяет, как отображается ваша личность, когда вы отправляете зап.</string>
<string name="wallet_connect_connect_app">Подключить кошелек</string>
<string name="pledge_amount_in_sats">Сумма взноса в sat</string>
@@ -381,6 +400,8 @@
<string name="content_description_add_video">Добавить видео</string>
<string name="content_description_add_document">Добавить документ</string>
<string name="add_content">Добавить к сообщению</string>
<string name="add_caption_example">Мой дорогой друг</string>
<string name="use_direct_url">Использовать прямой URL-адрес</string>
<string name="content_description">Описание содержимого</string>
<string name="content_description_example">Компания весёлых молодых людей</string>
<string name="zap_type">Тип запа</string>
@@ -393,7 +414,10 @@
<string name="zap_type_anonymous_explainer">Никто не видит отправителя платежа</string>
<string name="zap_type_nonzap">Не-зап</string>
<string name="zap_type_nonzap_explainer">Без следа в Nostr, обычный Lightning платеж</string>
<string name="post_anonymously_explainer">Опубликовать в качестве одноразовой идентификации. Ваша учетная запись не будет связана с этим ответом.</string>
<string name="anonymous_reply_warning">Этот ответ будет опубликован от новой анонимной идентификации</string>
<string name="file_server">Сервер для загрузки</string>
<string name="file_server_description">Выберите сервер для загрузки этого файла</string>
<string name="zap_forward_lnAddress">LnAddress или @User</string>
<string name="built_in_servers_description">Список Amethyst. Вы можете добавить его индивидуально или добавить список.</string>
<string name="uploading_state_uploading">Загрузка</string>