From a008a301433a27922cd1f5a706c5b53aa1f5c1dc Mon Sep 17 00:00:00 2001 From: Mikhail Guliaev <48011967+mgulyaev10@users.noreply.github.com> Date: Mon, 2 Oct 2023 23:41:25 +0200 Subject: [PATCH] feat: update notification channel settings (#89) update notification channel settings --- .../tech/relaycorp/letro/main/home/ui/tabs/LetroTabs.kt | 2 +- app/src/main/java/tech/relaycorp/letro/push/PushManager.kt | 1 - .../main/java/tech/relaycorp/letro/push/di/PushesModule.kt | 5 ++--- .../java/tech/relaycorp/letro/push/model/PushChannel.kt | 7 +++---- .../main/java/tech/relaycorp/letro/push/model/PushData.kt | 2 +- app/src/main/res/values-es-rVE/strings.xml | 2 +- app/src/main/res/values/strings.xml | 5 +---- 7 files changed, 9 insertions(+), 15 deletions(-) diff --git a/app/src/main/java/tech/relaycorp/letro/main/home/ui/tabs/LetroTabs.kt b/app/src/main/java/tech/relaycorp/letro/main/home/ui/tabs/LetroTabs.kt index 8ad5a710..ef613594 100644 --- a/app/src/main/java/tech/relaycorp/letro/main/home/ui/tabs/LetroTabs.kt +++ b/app/src/main/java/tech/relaycorp/letro/main/home/ui/tabs/LetroTabs.kt @@ -36,7 +36,7 @@ fun LetroTabs( val uiState by viewModel.uiState.collectAsState() val tabTitles = listOf( - stringResource(id = R.string.top_bar_tab_conversations), + stringResource(id = R.string.conversations), stringResource(id = R.string.top_bar_tab_contacts), stringResource(id = R.string.top_bar_tab_notifications), ) diff --git a/app/src/main/java/tech/relaycorp/letro/push/PushManager.kt b/app/src/main/java/tech/relaycorp/letro/push/PushManager.kt index 1b06c8bf..b026ebce 100644 --- a/app/src/main/java/tech/relaycorp/letro/push/PushManager.kt +++ b/app/src/main/java/tech/relaycorp/letro/push/PushManager.kt @@ -90,7 +90,6 @@ class PushManagerImpl @Inject constructor( channels .map { channel -> NotificationChannel(channel.id, context.getString(channel.name), NotificationManager.IMPORTANCE_DEFAULT).apply { - description = context.getString(channel.description) group = groupName } } diff --git a/app/src/main/java/tech/relaycorp/letro/push/di/PushesModule.kt b/app/src/main/java/tech/relaycorp/letro/push/di/PushesModule.kt index 4cc1f9d0..3eb1f7d4 100644 --- a/app/src/main/java/tech/relaycorp/letro/push/di/PushesModule.kt +++ b/app/src/main/java/tech/relaycorp/letro/push/di/PushesModule.kt @@ -21,9 +21,8 @@ object PushesModule { fun providePushChannels(): List { return listOf( PushChannel( - id = PushChannel.ChannelId.ID_DEFAULT, - name = R.string.push_channel_default_name, - description = R.string.push_channel_default_description, + id = PushChannel.ChannelId.ID_CONVERSATIONS, + name = R.string.conversations, ), ) } diff --git a/app/src/main/java/tech/relaycorp/letro/push/model/PushChannel.kt b/app/src/main/java/tech/relaycorp/letro/push/model/PushChannel.kt index 2d8ce786..985b88e2 100644 --- a/app/src/main/java/tech/relaycorp/letro/push/model/PushChannel.kt +++ b/app/src/main/java/tech/relaycorp/letro/push/model/PushChannel.kt @@ -2,18 +2,17 @@ package tech.relaycorp.letro.push.model import androidx.annotation.StringDef import androidx.annotation.StringRes -import tech.relaycorp.letro.push.model.PushChannel.ChannelId.Companion.ID_DEFAULT +import tech.relaycorp.letro.push.model.PushChannel.ChannelId.Companion.ID_CONVERSATIONS data class PushChannel( @ChannelId val id: String, @StringRes val name: Int, - @StringRes val description: Int, ) { - @StringDef(ID_DEFAULT) + @StringDef(ID_CONVERSATIONS) annotation class ChannelId { companion object { - const val ID_DEFAULT = "default" + const val ID_CONVERSATIONS = "default" } } } diff --git a/app/src/main/java/tech/relaycorp/letro/push/model/PushData.kt b/app/src/main/java/tech/relaycorp/letro/push/model/PushData.kt index c4f8aecd..b5531f8a 100644 --- a/app/src/main/java/tech/relaycorp/letro/push/model/PushData.kt +++ b/app/src/main/java/tech/relaycorp/letro/push/model/PushData.kt @@ -9,7 +9,7 @@ data class PushData( val action: PushAction, val notificationId: Int, val recipientAccountId: String, - @PushChannel.ChannelId val channelId: String = PushChannel.ChannelId.ID_DEFAULT, + @PushChannel.ChannelId val channelId: String = PushChannel.ChannelId.ID_CONVERSATIONS, ) sealed interface PushAction : Parcelable { diff --git a/app/src/main/res/values-es-rVE/strings.xml b/app/src/main/res/values-es-rVE/strings.xml index ae5b281c..ef280bff 100644 --- a/app/src/main/res/values-es-rVE/strings.xml +++ b/app/src/main/res/values-es-rVE/strings.xml @@ -31,7 +31,7 @@ Ya intentaste conectar con este usuario, pero podemos intentarlo nuevamente si quieres. Ustedes dos ya están conectados. La conexión con este usuario ya está en progreso. - Conversaciones + Conversaciones Contactos Notificaciones Escribe un mensaje nuevo diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index b41a5b64..609d5e33 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -49,7 +49,7 @@ Your pairing with this user is already under way. Enter an id like “alice@example.com“ or “example.com“. - Conversations + Conversations Contacts Notifications @@ -128,9 +128,6 @@ Sent Archive - Name - Description - %d new notification %d new notifications