From 171f763908a5c6147b02f7b809397209ed962281 Mon Sep 17 00:00:00 2001 From: Vitor Pamplona Date: Thu, 29 Jun 2023 12:42:11 -0400 Subject: [PATCH] Additional checks for main thread in Notifications --- .../com/vitorpamplona/amethyst/ui/note/UserReactionsRow.kt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/src/main/java/com/vitorpamplona/amethyst/ui/note/UserReactionsRow.kt b/app/src/main/java/com/vitorpamplona/amethyst/ui/note/UserReactionsRow.kt index 8b5f03826..8559271f5 100644 --- a/app/src/main/java/com/vitorpamplona/amethyst/ui/note/UserReactionsRow.kt +++ b/app/src/main/java/com/vitorpamplona/amethyst/ui/note/UserReactionsRow.kt @@ -163,6 +163,8 @@ class UserReactionsViewModel(val account: Account) : ViewModel() { fun today() = sdf.format(LocalDateTime.now()) private suspend fun initializeSuspend() { + checkNotInMainThread() + val currentUser = user.pubkeyHex val reactions = mutableMapOf() @@ -212,6 +214,8 @@ class UserReactionsViewModel(val account: Account) : ViewModel() { } suspend fun addToStatsSuspend(newNotes: Set) { + checkNotInMainThread() + val currentUser = user.pubkeyHex val reactions = this._reactions.value.toMutableMap() @@ -268,6 +272,8 @@ class UserReactionsViewModel(val account: Account) : ViewModel() { } private suspend fun refreshChartModel() { + checkNotInMainThread() + val day = 24 * 60 * 60L val now = LocalDateTime.now() val displayAxisFormatter = DateTimeFormatter.ofPattern("EEE")