From 55875b060e3b7421dd8a970e77e30bc509f585f0 Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 27 Apr 2026 14:32:55 +0000 Subject: [PATCH 1/2] fix(notifications): remove broken Pause action from always-on service The Pause action called stopSelf(), but onDestroy() then triggered the auto-restart broadcast (because alwaysOnNotificationService was still enabled), so the notification reappeared seconds later. There was no way to actually pause without toggling the setting, so the button was just confusing. Drops the ACTION_STOP intent, the notification action, and the always_on_notif_stop string from all locales. Also includes incidental spotless fixes the pre-commit hook required. --- .../notifications/NotificationRelayService.kt | 34 +++---------------- .../creators/uploads/ImageVideoDescription.kt | 6 +++- .../src/main/res/values-cs-rCZ/strings.xml | 1 - .../src/main/res/values-de-rDE/strings.xml | 1 - .../src/main/res/values-hi-rIN/strings.xml | 1 - .../src/main/res/values-hu-rHU/strings.xml | 1 - .../src/main/res/values-pl-rPL/strings.xml | 1 - .../src/main/res/values-pt-rBR/strings.xml | 1 - .../src/main/res/values-sl-rSI/strings.xml | 1 - .../src/main/res/values-sv-rSE/strings.xml | 1 - .../src/main/res/values-zh-rCN/strings.xml | 1 - amethyst/src/main/res/values/strings.xml | 1 - .../service/ai/MLKitImageLabelService.kt | 3 +- 13 files changed, 11 insertions(+), 42 deletions(-) diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/service/notifications/NotificationRelayService.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/service/notifications/NotificationRelayService.kt index a9f386356a..9265d889d2 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/service/notifications/NotificationRelayService.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/service/notifications/NotificationRelayService.kt @@ -78,7 +78,6 @@ class NotificationRelayService : Service() { private const val NOTIFICATION_ID = 9832 private const val ACTION_START = "com.vitorpamplona.amethyst.START_NOTIFICATION_SERVICE" - private const val ACTION_STOP = "com.vitorpamplona.amethyst.STOP_NOTIFICATION_SERVICE" const val ACTION_AUTO_RESTART = "com.vitorpamplona.amethyst.AUTO_RESTART_NOTIFICATION_SERVICE" @@ -129,21 +128,11 @@ class NotificationRelayService : Service() { flags: Int, startId: Int, ): Int { - when (intent?.action) { - ACTION_STOP -> { - Log.d(TAG, "Stopping service") - stopSelf() - return START_NOT_STICKY - } - - else -> { - Log.d(TAG, "Starting service") - // Safety: also call startForeground from onStartCommand in case - // onCreate didn't complete before onStartCommand fired (ntfy #1520) - initializeForeground() - startRelayConnection() - } - } + Log.d(TAG, "Starting service") + // Safety: also call startForeground from onStartCommand in case + // onCreate didn't complete before onStartCommand fired (ntfy #1520) + initializeForeground() + startRelayConnection() return START_STICKY } @@ -288,25 +277,12 @@ class NotificationRelayService : Service() { PendingIntent.FLAG_IMMUTABLE or PendingIntent.FLAG_UPDATE_CURRENT, ) - val stopIntent = - Intent(this, NotificationRelayService::class.java).apply { - action = ACTION_STOP - } - val stopPendingIntent = - PendingIntent.getService( - this, - 1, - stopIntent, - PendingIntent.FLAG_IMMUTABLE or PendingIntent.FLAG_UPDATE_CURRENT, - ) - return NotificationCompat .Builder(this, CHANNEL_ID) .setContentTitle(getString(R.string.always_on_notif_title)) .setContentText(contentText) .setSmallIcon(R.drawable.amethyst) .setContentIntent(pendingIntent) - .addAction(0, getString(R.string.always_on_notif_stop), stopPendingIntent) .setOngoing(true) .setSilent(true) .setPriority(NotificationCompat.PRIORITY_LOW) diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/creators/uploads/ImageVideoDescription.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/creators/uploads/ImageVideoDescription.kt index c59a347e04..500a8bc06b 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/creators/uploads/ImageVideoDescription.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/creators/uploads/ImageVideoDescription.kt @@ -114,7 +114,11 @@ fun ImageVideoDescription( val context = LocalContext.current val firstImageUri = remember(uris) { - uris.first().takeIf { it.media.isImage() == true && it.media.isGif().not() }?.media?.uri + uris + .first() + .takeIf { it.media.isImage() == true && it.media.isGif().not() } + ?.media + ?.uri } val labelService = remember { MLKitImageLabelService(context.applicationContext) } var isLabeling by remember { mutableStateOf(false) } diff --git a/amethyst/src/main/res/values-cs-rCZ/strings.xml b/amethyst/src/main/res/values-cs-rCZ/strings.xml index b8cd9fe6b8..ebe604b9bd 100644 --- a/amethyst/src/main/res/values-cs-rCZ/strings.xml +++ b/amethyst/src/main/res/values-cs-rCZ/strings.xml @@ -832,7 +832,6 @@ Amethyst oznámení aktivní Připojeno k %1$d inbox relayím Připojování k inbox relayím\u2026 - Pozastavit Služba trvalých oznámení Udržuje trvalé připojení k vašim inbox relayím pro okamžité doručování oznámení. Zobrazuje průběžné oznámení. Spotřebovává více baterie, ale zajišťuje, že nezmeškáte žádnou zprávu. Optimalizace baterie aktivní diff --git a/amethyst/src/main/res/values-de-rDE/strings.xml b/amethyst/src/main/res/values-de-rDE/strings.xml index 88ceeea327..732070867e 100644 --- a/amethyst/src/main/res/values-de-rDE/strings.xml +++ b/amethyst/src/main/res/values-de-rDE/strings.xml @@ -837,7 +837,6 @@ anz der Bedingungen ist erforderlich Amethyst-Benachrichtigungen aktiv Mit %1$d Inbox-Relays verbunden Verbinde mit Inbox-Relays\u2026 - Pausieren Dauerhafter Benachrichtigungsdienst Hält eine dauerhafte Verbindung zu deinen Inbox-Relays für sofortige Benachrichtigungen aufrecht. Zeigt eine fortlaufende Benachrichtigung an. Verbraucht mehr Akku, stellt aber sicher, dass du keine Nachricht verpasst. Akkuoptimierung aktiv diff --git a/amethyst/src/main/res/values-hi-rIN/strings.xml b/amethyst/src/main/res/values-hi-rIN/strings.xml index d746ed3236..519960f0cf 100644 --- a/amethyst/src/main/res/values-hi-rIN/strings.xml +++ b/amethyst/src/main/res/values-hi-rIN/strings.xml @@ -836,7 +836,6 @@ अमेथिस्ट सूचनाएँ सक्रिय संयोजित %1$d आगतपेटिका पुनःप्रसारकों के साथ आगतपेटिका पुनःप्रसारकों के साथ संयोजन किया जा रहा है \u2026 - विराम सदैव सक्रिय सूचना सेवा अनवरत संयोजन बनाए रखता है आपके आगतपेटिका पुनःप्रसारकों के साथ तत्काल सूचना वितरण के लिए। एक स्थायी सूचना दिखाता है। विद्युत्कोष का अधिक उपयोग करता है पर निश्चित करता है कि आप कभी भी सन्देश नहीं खोएँगे। विद्युत्कोष अनुकूलन सक्रिय diff --git a/amethyst/src/main/res/values-hu-rHU/strings.xml b/amethyst/src/main/res/values-hu-rHU/strings.xml index bab00d59d5..c431ea5e9f 100644 --- a/amethyst/src/main/res/values-hu-rHU/strings.xml +++ b/amethyst/src/main/res/values-hu-rHU/strings.xml @@ -836,7 +836,6 @@ Amethyst értesítések aktíválva Kapcsolódva %1$d beérkező üzenetátjátszóhoz Kapcsolódás a beérkező üzenetátjátszókhoz\u2026 - Szüneteltetés Folyamatos értesítési szolgáltatás Folyamatos kapcsolatot tart fenn a beérkező üzenetek átjátszóival az értesítések azonnali kézbesítése érdekében. Megjeleníti a folyamatban lévő értesítéseket. Több akkumulátort fogyaszt, de így biztosan nem marad le egyetlen üzenetről sem. Akkumulátor-optimalizálás aktív diff --git a/amethyst/src/main/res/values-pl-rPL/strings.xml b/amethyst/src/main/res/values-pl-rPL/strings.xml index c1e6167953..0d919efb86 100644 --- a/amethyst/src/main/res/values-pl-rPL/strings.xml +++ b/amethyst/src/main/res/values-pl-rPL/strings.xml @@ -833,7 +833,6 @@ Powiadomienia Ametyst Aktywne Połączono z %1$d transmiterami odbiorczymi Łączenie z transmiterami odbiorczymi\u2026 - Pauza Usługa powiadomień zawsze włączona Utrzymuje stałe połączenie z transmiterami odbiorczymi, aby zapewnić natychmiastowe dostarczanie powiadomień. Wyświetla bieżące powiadomienia. Zużywa więcej baterii, ale gwarantuje, że nigdy nie przegapisz żadnej wiadomości. Optymalizacja baterii aktywna diff --git a/amethyst/src/main/res/values-pt-rBR/strings.xml b/amethyst/src/main/res/values-pt-rBR/strings.xml index 65dd266db9..84be67f3a7 100644 --- a/amethyst/src/main/res/values-pt-rBR/strings.xml +++ b/amethyst/src/main/res/values-pt-rBR/strings.xml @@ -832,7 +832,6 @@ Notificações do Amethyst ativas Conectado a %1$d relays de caixa de entrada Conectando aos relays de caixa de entrada\u2026 - Pausar Serviço de notificações sempre ativo Mantém uma conexão persistente com seus relays de caixa de entrada para entrega instantânea de notificações. Mostra uma notificação contínua. Usa mais bateria, mas garante que você nunca perca uma mensagem. Otimização de bateria ativa diff --git a/amethyst/src/main/res/values-sl-rSI/strings.xml b/amethyst/src/main/res/values-sl-rSI/strings.xml index ed0b2e1701..ee261288ca 100644 --- a/amethyst/src/main/res/values-sl-rSI/strings.xml +++ b/amethyst/src/main/res/values-sl-rSI/strings.xml @@ -847,7 +847,6 @@ Za podpisovanje se je potrebno prijaviti s privatnim ključem Amethyst obvestila so aktivna Povezan z %1$d vhodnimi releji Povezovanje vhodnih relejev\u2026 - Premor Vedno aktivna obvestila Ohranja stalno povezavo z vašimi releji za takojšnjo dostavo obvestil. Prikazuje trajno obvestilo. Porabi več baterije, a zagotavlja, da ne zamudite nobenega sporočila. Optimizacija baterije je aktivna diff --git a/amethyst/src/main/res/values-sv-rSE/strings.xml b/amethyst/src/main/res/values-sv-rSE/strings.xml index 3959559cb9..b5728d7158 100644 --- a/amethyst/src/main/res/values-sv-rSE/strings.xml +++ b/amethyst/src/main/res/values-sv-rSE/strings.xml @@ -831,7 +831,6 @@ Amethyst-notifieringar aktiva Ansluten till %1$d inbox-relän Ansluter till inbox-relän\u2026 - Pausa Alltid på-notifieringstjänst Upprätthåller en konstant anslutning till dina inbox-relän för omedelbar leverans av notifieringar. Visar en pågående notifiering. Använder mer batteri men säkerställer att du aldrig missar ett meddelande. Batterioptimering aktiv diff --git a/amethyst/src/main/res/values-zh-rCN/strings.xml b/amethyst/src/main/res/values-zh-rCN/strings.xml index d1a813275b..601d642a1f 100644 --- a/amethyst/src/main/res/values-zh-rCN/strings.xml +++ b/amethyst/src/main/res/values-zh-rCN/strings.xml @@ -836,7 +836,6 @@ Amethyst 通知活跃 已连接到 %1$d 个收件箱中继 正在连接到收件箱中继\u2026 - 暂停 始终开启通知服务 保持与收件箱中继的持续连接以便即时发送通知。 显示正在进行的通知。使用更多电量,但确保您永远不会错过消息。 电池优化已启用 diff --git a/amethyst/src/main/res/values/strings.xml b/amethyst/src/main/res/values/strings.xml index 6348846500..d45ed3747e 100644 --- a/amethyst/src/main/res/values/strings.xml +++ b/amethyst/src/main/res/values/strings.xml @@ -943,7 +943,6 @@ Amethyst Notifications Active Connected to %1$d inbox relays Connecting to inbox relays\u2026 - Pause Always-on notification service Keeps a persistent connection to your inbox relays for instant notification delivery. Shows an ongoing notification. Uses more battery but ensures you never miss a message. diff --git a/amethyst/src/play/java/com/vitorpamplona/amethyst/service/ai/MLKitImageLabelService.kt b/amethyst/src/play/java/com/vitorpamplona/amethyst/service/ai/MLKitImageLabelService.kt index d07ae1eeb6..25d044b34c 100644 --- a/amethyst/src/play/java/com/vitorpamplona/amethyst/service/ai/MLKitImageLabelService.kt +++ b/amethyst/src/play/java/com/vitorpamplona/amethyst/service/ai/MLKitImageLabelService.kt @@ -54,8 +54,7 @@ class MLKitImageLabelService( // mid-session in practice, and one composer mount only needs to ask AICore once. @Volatile private var cachedGenAiStatus: Int? = null - private fun ensureLabeler(): ImageLabeler = - labeler ?: ImageLabeling.getClient(ImageLabelerOptions.DEFAULT_OPTIONS).also { labeler = it } + private fun ensureLabeler(): ImageLabeler = labeler ?: ImageLabeling.getClient(ImageLabelerOptions.DEFAULT_OPTIONS).also { labeler = it } private fun ensureDescriber(): ImageDescriber? = describer From aa7b5b054fb7776784d1ae65176233c573072d96 Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 27 Apr 2026 14:46:20 +0000 Subject: [PATCH 2/2] fix(uploads): migrate ImageVideoDescription icons to MaterialSymbols The AI-suggested alt-text chip was using androidx.compose.material.icons.*, which the project no longer pulls in (migrated to MaterialSymbols a while back). The file failed to compile until the dep was either re-added or the icons migrated. Switching to MaterialSymbols.AutoAwesome / .Close. --- .../ui/note/creators/uploads/ImageVideoDescription.kt | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/creators/uploads/ImageVideoDescription.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/creators/uploads/ImageVideoDescription.kt index 500a8bc06b..603b499f80 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/creators/uploads/ImageVideoDescription.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/ui/note/creators/uploads/ImageVideoDescription.kt @@ -31,16 +31,12 @@ import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.size import androidx.compose.foundation.layout.windowInsetsPadding import androidx.compose.foundation.text.KeyboardOptions -import androidx.compose.material.icons.Icons -import androidx.compose.material.icons.filled.AutoAwesome -import androidx.compose.material.icons.filled.Close import androidx.compose.material3.AssistChip import androidx.compose.material3.AssistChipDefaults import androidx.compose.material3.Button import androidx.compose.material3.ButtonDefaults import androidx.compose.material3.CircularProgressIndicator import androidx.compose.material3.HorizontalDivider -import androidx.compose.material3.Icon import androidx.compose.material3.IconButton import androidx.compose.material3.MaterialTheme import androidx.compose.material3.OutlinedTextField @@ -66,6 +62,8 @@ import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.sp import com.vitorpamplona.amethyst.R +import com.vitorpamplona.amethyst.commons.icons.symbols.Icon +import com.vitorpamplona.amethyst.commons.icons.symbols.MaterialSymbols import com.vitorpamplona.amethyst.service.ai.MLKitImageLabelService import com.vitorpamplona.amethyst.service.uploads.MultiOrchestrator import com.vitorpamplona.amethyst.ui.actions.mediaServers.DEFAULT_MEDIA_SERVERS @@ -322,14 +320,14 @@ fun ImageVideoDescription( label = { Text(text = stringRes(R.string.ai_suggested_alt_text_hint)) }, leadingIcon = { Icon( - imageVector = Icons.Default.AutoAwesome, + symbol = MaterialSymbols.AutoAwesome, contentDescription = null, modifier = Modifier.size(AssistChipDefaults.IconSize), ) }, trailingIcon = { Icon( - imageVector = Icons.Default.Close, + symbol = MaterialSymbols.Close, contentDescription = stringRes(R.string.ai_suggested_alt_text_dismiss), modifier = Modifier.size(AssistChipDefaults.IconSize), )