mirror of
https://github.com/meshtastic/Meshtastic-Android.git
synced 2026-04-20 22:23:37 +00:00
feat: Integrate notification management and preferences across platforms (#4819)
Signed-off-by: James Rich <2199651+jamesarich@users.noreply.github.com>
This commit is contained in:
parent
0b2e89c46f
commit
8c964a15ca
45 changed files with 1304 additions and 61 deletions
|
|
@ -42,8 +42,8 @@ import org.meshtastic.core.model.Node
|
|||
import org.meshtastic.core.model.service.ServiceAction
|
||||
import org.meshtastic.core.repository.CustomEmojiPrefs
|
||||
import org.meshtastic.core.repository.HomoglyphPrefs
|
||||
import org.meshtastic.core.repository.MeshServiceNotifications
|
||||
import org.meshtastic.core.repository.NodeRepository
|
||||
import org.meshtastic.core.repository.NotificationManager
|
||||
import org.meshtastic.core.repository.PacketRepository
|
||||
import org.meshtastic.core.repository.RadioConfigRepository
|
||||
import org.meshtastic.core.repository.ServiceRepository
|
||||
|
|
@ -64,7 +64,7 @@ class MessageViewModel(
|
|||
private val uiPrefs: UiPrefs,
|
||||
private val customEmojiPrefs: CustomEmojiPrefs,
|
||||
private val homoglyphEncodingPrefs: HomoglyphPrefs,
|
||||
private val meshServiceNotifications: MeshServiceNotifications,
|
||||
private val notificationManager: NotificationManager,
|
||||
private val sendMessageUseCase: SendMessageUseCase,
|
||||
) : ViewModel() {
|
||||
private val _title = MutableStateFlow("")
|
||||
|
|
@ -235,6 +235,6 @@ class MessageViewModel(
|
|||
packetRepository.clearUnreadCount(contact, lastReadTimestamp)
|
||||
packetRepository.updateLastReadMessage(contact, messageUuid, lastReadTimestamp)
|
||||
val unreadCount = packetRepository.getUnreadCount(contact)
|
||||
if (unreadCount == 0) meshServiceNotifications.cancelMessageNotification(contact)
|
||||
if (unreadCount == 0) notificationManager.cancel(contact.hashCode())
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,7 +26,6 @@ import org.meshtastic.core.data.repository.QuickChatActionRepository
|
|||
import org.meshtastic.core.model.service.ServiceAction
|
||||
import org.meshtastic.core.repository.CustomEmojiPrefs
|
||||
import org.meshtastic.core.repository.HomoglyphPrefs
|
||||
import org.meshtastic.core.repository.MeshServiceNotifications
|
||||
import org.meshtastic.core.repository.RadioConfigRepository
|
||||
import org.meshtastic.core.repository.ServiceRepository
|
||||
import org.meshtastic.core.repository.UiPrefs
|
||||
|
|
@ -60,7 +59,6 @@ class MessageViewModelTest {
|
|||
private lateinit var customEmojiPrefs: CustomEmojiPrefs
|
||||
private lateinit var homoglyphPrefs: HomoglyphPrefs
|
||||
private lateinit var uiPrefs: UiPrefs
|
||||
private lateinit var meshServiceNotifications: MeshServiceNotifications
|
||||
|
||||
private fun setUp() {
|
||||
// Create saved state with test contact ID
|
||||
|
|
@ -86,7 +84,6 @@ class MessageViewModelTest {
|
|||
homoglyphPrefs =
|
||||
mockk(relaxed = true) { every { homoglyphEncodingEnabled } returns MutableStateFlow<Boolean>(false) }
|
||||
uiPrefs = mockk(relaxed = true) { every { showQuickChat } returns MutableStateFlow<Boolean>(false) }
|
||||
meshServiceNotifications = mockk(relaxed = true)
|
||||
|
||||
// Create ViewModel with mocked dependencies
|
||||
viewModel =
|
||||
|
|
@ -101,7 +98,7 @@ class MessageViewModelTest {
|
|||
customEmojiPrefs = customEmojiPrefs,
|
||||
homoglyphEncodingPrefs = homoglyphPrefs,
|
||||
uiPrefs = uiPrefs,
|
||||
meshServiceNotifications = meshServiceNotifications,
|
||||
notificationManager = mockk(relaxed = true),
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue