Skip to content

Commit 309ec17

Browse files
committed
Making sure we ignore non approved and hidden conversations
1 parent f617de5 commit 309ec17

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

app/src/main/java/org/thoughtcrime/securesms/ShareViewModel.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import kotlinx.coroutines.flow.stateIn
2323
import kotlinx.coroutines.flow.update
2424
import kotlinx.coroutines.launch
2525
import network.loki.messenger.R
26+
import network.loki.messenger.libsession_util.ConfigBase.Companion.PRIORITY_HIDDEN
2627
import org.session.libsession.messaging.groups.LegacyGroupDeprecationManager
2728
import org.session.libsession.utilities.Address
2829
import org.session.libsession.utilities.recipients.RecipientData
@@ -91,6 +92,9 @@ class ShareViewModel @Inject constructor(
9192
.filter { thread ->
9293
val recipient = thread.recipient
9394
when {
95+
// if the recipient is hidden or not approved, ignore it
96+
recipient.priority == PRIORITY_HIDDEN || !recipient.approved -> false
97+
9498
// If the recipient is blocked, ignore it
9599
recipient.blocked -> false
96100

app/src/main/java/org/thoughtcrime/securesms/tokenpage/TokenPageViewModel.kt

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,14 @@ import kotlinx.coroutines.delay
1111
import kotlinx.coroutines.flow.MutableStateFlow
1212
import kotlinx.coroutines.flow.StateFlow
1313
import kotlinx.coroutines.flow.asStateFlow
14+
import kotlinx.coroutines.flow.filter
1415
import kotlinx.coroutines.flow.first
16+
import kotlinx.coroutines.flow.map
1517
import kotlinx.coroutines.flow.update
1618
import kotlinx.coroutines.launch
1719
import kotlinx.coroutines.withContext
1820
import network.loki.messenger.R
21+
import network.loki.messenger.libsession_util.ConfigBase.Companion.PRIORITY_HIDDEN
1922
import nl.komponents.kovenant.Promise
2023
import org.session.libsession.LocalisedTimeUtil.toShortSinglePartString
2124
import org.session.libsession.snode.OnionRequestAPI
@@ -37,6 +40,7 @@ import org.thoughtcrime.securesms.util.NumberUtil.formatAbbreviated
3740
import org.thoughtcrime.securesms.util.NumberUtil.formatWithDecimalPlaces
3841
import javax.inject.Inject
3942
import kotlin.math.min
43+
import kotlin.sequences.filter
4044
import kotlin.time.Duration.Companion.milliseconds
4145
import kotlin.time.Duration.Companion.minutes
4246

@@ -255,7 +259,11 @@ class TokenPageViewModel @Inject constructor(
255259
var numGroupV2Convos = 0
256260

257261
// Grab the database and reader details we need to count the conversations / groups
258-
val convoList = conversationRepository.observeConversationList().first()
262+
val convoList = conversationRepository.observeConversationList()
263+
.map{ convo ->
264+
convo.filter { it.recipient.approved }
265+
}
266+
.first()
259267
val result = mutableSetOf<Recipient>()
260268

261269
// Look through the database to build up our conversation & group counts (still on Dispatchers.IO not the main thread)

0 commit comments

Comments
 (0)