@@ -127,7 +127,7 @@ class ImageUploadTesting {
|
||||
// assertEquals(server.baseUrl, "${server.baseUrl}/$initialHash", result.url?.removeSuffix(".png"))
|
||||
|
||||
val imageData: ByteArray =
|
||||
ImageDownloader().waitAndGetImage(result.url!!, { client })?.bytes
|
||||
ImageDownloader().waitAndGetImage(result.url!!) { client }?.bytes
|
||||
?: run {
|
||||
fail("${server.name}: Should not be null")
|
||||
return
|
||||
@@ -142,8 +142,7 @@ class ImageUploadTesting {
|
||||
ServerInfoRetriever()
|
||||
.loadInfo(
|
||||
server.baseUrl,
|
||||
{ client },
|
||||
)
|
||||
) { client }
|
||||
|
||||
val payload = getBitmap()
|
||||
val inputStream = payload.inputStream()
|
||||
@@ -172,7 +171,7 @@ class ImageUploadTesting {
|
||||
Assert.assertTrue("${server.name}: Invalid result url", url.startsWith("http"))
|
||||
|
||||
val imageData: ByteArray =
|
||||
ImageDownloader().waitAndGetImage(url, { client })?.bytes
|
||||
ImageDownloader().waitAndGetImage(url) { client }?.bytes
|
||||
?: run {
|
||||
fail("${server.name}: Should not be null")
|
||||
return
|
||||
|
||||
@@ -1240,7 +1240,7 @@ class Account(
|
||||
val event = signer.sign(template)
|
||||
cache.justConsumeMyOwnEvent(event)
|
||||
val relays = relayList(event)
|
||||
if (relays != null && relays.isNotEmpty()) {
|
||||
if (!relays.isNullOrEmpty()) {
|
||||
client.send(event, relays.toSet())
|
||||
} else {
|
||||
client.send(event, computeRelayListToBroadcast(event))
|
||||
@@ -1898,7 +1898,7 @@ class Account(
|
||||
fun getRelevantReports(note: Note): Set<Note> {
|
||||
val innerReports =
|
||||
if (note.event is RepostEvent || note.event is GenericRepostEvent) {
|
||||
note.replyTo?.map { getRelevantReports(it) }?.flatten() ?: emptyList()
|
||||
note.replyTo?.flatMap { getRelevantReports(it) } ?: emptyList()
|
||||
} else {
|
||||
emptyList()
|
||||
}
|
||||
|
||||
@@ -2770,10 +2770,9 @@ object LocalCache : ILocalCache, ICacheProvider {
|
||||
val childrenToBeRemoved = mutableListOf<Note>()
|
||||
|
||||
val toBeRemoved =
|
||||
account.hiddenUsers.flow.value.hiddenUsers
|
||||
.map { userHex ->
|
||||
(notes.filter { _, it -> it.event?.pubKey == userHex } + addressables.filter { _, it -> it.event?.pubKey == userHex }).toSet()
|
||||
}.flatten()
|
||||
account.hiddenUsers.flow.value.hiddenUsers.flatMap { userHex ->
|
||||
(notes.filter { _, it -> it.event?.pubKey == userHex } + addressables.filter { _, it -> it.event?.pubKey == userHex }).toSet()
|
||||
}
|
||||
|
||||
toBeRemoved.forEach {
|
||||
removeFromCache(it)
|
||||
|
||||
+4
-4
@@ -34,9 +34,9 @@ data class LabeledBookmarkList(
|
||||
val privateBookmarks: Set<BookmarkIdTag> = emptySet(),
|
||||
val publicBookmarks: Set<BookmarkIdTag> = emptySet(),
|
||||
) {
|
||||
val privatePostBookmarks = privateBookmarks.filter { it is EventBookmark }.map { bookmarkIdTag -> bookmarkIdTag as EventBookmark }
|
||||
val publicPostBookmarks = publicBookmarks.filter { it is EventBookmark }.map { bookmarkIdTag -> bookmarkIdTag as EventBookmark }
|
||||
val privatePostBookmarks = privateBookmarks.filterIsInstance<EventBookmark>()
|
||||
val publicPostBookmarks = publicBookmarks.filterIsInstance<EventBookmark>()
|
||||
|
||||
val privateArticleBookmarks = privateBookmarks.filter { it is AddressBookmark }.map { bookmarkIdTag -> bookmarkIdTag as AddressBookmark }
|
||||
val publicArticleBookmarks = publicBookmarks.filter { it is AddressBookmark }.map { bookmarkIdTag -> bookmarkIdTag as AddressBookmark }
|
||||
val privateArticleBookmarks = privateBookmarks.filterIsInstance<AddressBookmark>()
|
||||
val publicArticleBookmarks = publicBookmarks.filterIsInstance<AddressBookmark>()
|
||||
}
|
||||
|
||||
+2
-5
@@ -65,14 +65,11 @@ class LightningAddressResolver {
|
||||
okHttpClient: (String) -> OkHttpClient,
|
||||
context: Context,
|
||||
): String {
|
||||
val url = assembleUrl(lnAddress)
|
||||
|
||||
if (url == null) {
|
||||
throw LightningAddressError(
|
||||
val url =
|
||||
assembleUrl(lnAddress) ?: throw LightningAddressError(
|
||||
stringRes(context, R.string.error_unable_to_fetch_invoice),
|
||||
stringRes(context, R.string.could_not_assemble_lnurl_from_lightning_address_check_the_user_s_setup, lnAddress),
|
||||
)
|
||||
}
|
||||
|
||||
val client = okHttpClient(url)
|
||||
|
||||
|
||||
@@ -48,8 +48,7 @@ class OkHttpWebSocket(
|
||||
override fun needsReconnect(): Boolean {
|
||||
if (socket == null) return true
|
||||
|
||||
val myUsingOkHttp = usingOkHttp
|
||||
if (myUsingOkHttp == null) return true
|
||||
val myUsingOkHttp = usingOkHttp ?: return true
|
||||
|
||||
val currentOkHttp = httpClient(url)
|
||||
|
||||
|
||||
+1
-1
@@ -41,7 +41,7 @@ class ListWithUniqueSetCache<T, U>(
|
||||
}
|
||||
|
||||
fun distinct(): Set<U> {
|
||||
var currentSet = cacheSet.get()
|
||||
val currentSet = cacheSet.get()
|
||||
|
||||
// Check if the cached set is based on the current list
|
||||
if (currentSet != null) {
|
||||
|
||||
+1
-1
@@ -36,7 +36,7 @@ fun filterDraftsFromKey(
|
||||
pubkey: HexKey?,
|
||||
since: Long?,
|
||||
): List<RelayBasedFilter> {
|
||||
if (pubkey == null || pubkey.isEmpty()) return emptyList()
|
||||
if (pubkey.isNullOrEmpty()) return emptyList()
|
||||
|
||||
return listOf(
|
||||
RelayBasedFilter(
|
||||
|
||||
+1
-1
@@ -92,7 +92,7 @@ fun pickRelaysToLoadUsers(
|
||||
|
||||
val outbox = key.authorRelayList()?.writeRelaysNorm()
|
||||
|
||||
if (outbox != null && outbox.isNotEmpty()) {
|
||||
if (!outbox.isNullOrEmpty()) {
|
||||
// If there is a home, get from it.
|
||||
|
||||
// if it tried all outbox relays, stop.
|
||||
|
||||
+1
-1
@@ -70,7 +70,7 @@ fun filterBasicAccountInfoFromKeys(
|
||||
otherAccounts: List<HexKey>?,
|
||||
since: Long?,
|
||||
): List<RelayBasedFilter> {
|
||||
if (otherAccounts == null || otherAccounts.isEmpty()) return emptyList()
|
||||
if (otherAccounts.isNullOrEmpty()) return emptyList()
|
||||
|
||||
return listOf(
|
||||
RelayBasedFilter(
|
||||
|
||||
+1
-1
@@ -38,7 +38,7 @@ fun filterBookmarksAndReportsFromKey(
|
||||
pubkey: HexKey?,
|
||||
since: Long?,
|
||||
): List<RelayBasedFilter> {
|
||||
if (pubkey == null || pubkey.isEmpty()) return emptyList()
|
||||
if (pubkey.isNullOrEmpty()) return emptyList()
|
||||
|
||||
return listOf(
|
||||
RelayBasedFilter(
|
||||
|
||||
+3
-3
@@ -90,7 +90,7 @@ fun filterSummaryNotificationsToPubkey(
|
||||
pubkey: HexKey?,
|
||||
since: Long?,
|
||||
): List<RelayBasedFilter> {
|
||||
if (pubkey == null || pubkey.isEmpty()) return emptyList()
|
||||
if (pubkey.isNullOrEmpty()) return emptyList()
|
||||
|
||||
return listOf(
|
||||
RelayBasedFilter(
|
||||
@@ -111,7 +111,7 @@ fun filterNotificationsToPubkey(
|
||||
pubkey: HexKey?,
|
||||
since: Long?,
|
||||
): List<RelayBasedFilter> {
|
||||
if (pubkey == null || pubkey.isEmpty()) return emptyList()
|
||||
if (pubkey.isNullOrEmpty()) return emptyList()
|
||||
|
||||
return listOf(
|
||||
RelayBasedFilter(
|
||||
@@ -142,7 +142,7 @@ fun filterJustTheLatestNotificationsToPubkeyFromRandomRelays(
|
||||
pubkey: HexKey?,
|
||||
since: Long?,
|
||||
): List<RelayBasedFilter> {
|
||||
if (pubkey == null || pubkey.isEmpty()) return emptyList()
|
||||
if (pubkey.isNullOrEmpty()) return emptyList()
|
||||
|
||||
return listOf(
|
||||
RelayBasedFilter(
|
||||
|
||||
+1
-1
@@ -32,7 +32,7 @@ fun filterGiftWrapsToPubkey(
|
||||
pubkey: HexKey?,
|
||||
since: Long?,
|
||||
): List<RelayBasedFilter> {
|
||||
if (pubkey == null || pubkey.isEmpty()) return emptyList()
|
||||
if (pubkey.isNullOrEmpty()) return emptyList()
|
||||
|
||||
return listOf(
|
||||
RelayBasedFilter(
|
||||
|
||||
+3
-3
@@ -40,7 +40,7 @@ fun potentialRelaysToFindAddress(note: AddressableNote): Set<NormalizedRelayUrl>
|
||||
|
||||
LocalCache.getAnyChannel(note)?.relays()?.let { set.addAll(it) }
|
||||
|
||||
note.replyTo?.map { parentNote ->
|
||||
note.replyTo?.forEach { parentNote ->
|
||||
set.addAll(parentNote.relays)
|
||||
|
||||
LocalCache.getAnyChannel(parentNote)?.relays()?.let { set.addAll(it) }
|
||||
@@ -48,7 +48,7 @@ fun potentialRelaysToFindAddress(note: AddressableNote): Set<NormalizedRelayUrl>
|
||||
parentNote.author?.inboxRelays()?.let { set.addAll(it) }
|
||||
}
|
||||
|
||||
note.replies.map { childNote ->
|
||||
note.replies.forEach { childNote ->
|
||||
set.addAll(childNote.relays)
|
||||
|
||||
LocalCache.getAnyChannel(childNote)?.relays()?.let { set.addAll(it) }
|
||||
@@ -63,7 +63,7 @@ fun potentialRelaysToFindAddress(note: AddressableNote): Set<NormalizedRelayUrl>
|
||||
}
|
||||
}
|
||||
|
||||
note.boosts.map { childNote ->
|
||||
note.boosts.forEach { childNote ->
|
||||
set.addAll(childNote.relays)
|
||||
childNote.author?.outboxRelays()?.let { set.addAll(it) }
|
||||
}
|
||||
|
||||
+3
-3
@@ -36,7 +36,7 @@ fun potentialRelaysToFindEvent(note: Note): Set<NormalizedRelayUrl> {
|
||||
|
||||
LocalCache.getAnyChannel(note)?.relays()?.let { set.addAll(it) }
|
||||
|
||||
note.replyTo?.map { parentNote ->
|
||||
note.replyTo?.forEach { parentNote ->
|
||||
set.addAll(parentNote.relays)
|
||||
|
||||
LocalCache.getAnyChannel(parentNote)?.relays()?.let { set.addAll(it) }
|
||||
@@ -44,7 +44,7 @@ fun potentialRelaysToFindEvent(note: Note): Set<NormalizedRelayUrl> {
|
||||
parentNote.author?.inboxRelays()?.let { set.addAll(it) }
|
||||
}
|
||||
|
||||
note.replies.map { childNote ->
|
||||
note.replies.forEach { childNote ->
|
||||
set.addAll(childNote.relays)
|
||||
|
||||
LocalCache.getAnyChannel(childNote)?.relays()?.let { set.addAll(it) }
|
||||
@@ -59,7 +59,7 @@ fun potentialRelaysToFindEvent(note: Note): Set<NormalizedRelayUrl> {
|
||||
}
|
||||
}
|
||||
|
||||
note.boosts.map { childNote ->
|
||||
note.boosts.forEach { childNote ->
|
||||
set.addAll(childNote.relays)
|
||||
childNote.author?.outboxRelays()?.let { set.addAll(it) }
|
||||
}
|
||||
|
||||
+1
-1
@@ -68,7 +68,7 @@ class UserCardsSubAssembler(
|
||||
val trustedAccounts: Map<NormalizedRelayUrl, Set<HexKey>> =
|
||||
mapOfSet {
|
||||
accounts.forEach { account ->
|
||||
account.homeRelays.flow.value.map {
|
||||
account.homeRelays.flow.value.forEach {
|
||||
add(it, account.userProfile().pubkeyHex)
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -170,7 +170,7 @@ internal fun <T> Iterable<T>.fillToSize(
|
||||
transform: (List<T>) -> T,
|
||||
): List<T> {
|
||||
val capacity = ceil(size.safeDiv(count())).roundToInt()
|
||||
return map { data -> List(capacity) { data } }.flatten().chunkToSize(size, transform)
|
||||
return flatMap { data -> List(capacity) { data } }.chunkToSize(size, transform)
|
||||
}
|
||||
|
||||
internal fun <T> Iterable<T>.chunkToSize(
|
||||
|
||||
+1
-1
@@ -117,7 +117,7 @@ fun SensitivityWarning(
|
||||
@Composable
|
||||
fun ContentWarningNotePreview() {
|
||||
ThemeComparisonColumn {
|
||||
ContentWarningNote({})
|
||||
ContentWarningNote {}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -167,7 +167,7 @@ fun ObserveAllStatusesToAvoidSwitchigAllTheTime(
|
||||
statuses: ImmutableList<AddressableNote>,
|
||||
accountViewModel: AccountViewModel,
|
||||
) {
|
||||
statuses.map {
|
||||
statuses.forEach {
|
||||
EventFinderFilterAssemblerSubscription(it, accountViewModel)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -86,8 +86,8 @@ fun ReplyInformationChannel(
|
||||
onUserTagClick: (User) -> Unit,
|
||||
) {
|
||||
FlowRow {
|
||||
if (mentions != null && mentions.isNotEmpty()) {
|
||||
if (replyTo != null && replyTo.isNotEmpty()) {
|
||||
if (!mentions.isNullOrEmpty()) {
|
||||
if (!replyTo.isNullOrEmpty()) {
|
||||
Text(
|
||||
stringRes(id = R.string.replying_to),
|
||||
fontSize = 13.sp,
|
||||
|
||||
+3
-3
@@ -66,15 +66,15 @@ fun DisplayUncitedHashtags(
|
||||
val tagsInContent =
|
||||
state
|
||||
.paragraphs
|
||||
.map {
|
||||
it.words.mapNotNull {
|
||||
.flatMap { paragraphState ->
|
||||
paragraphState.words.mapNotNull {
|
||||
if (it is HashTagSegment) {
|
||||
it.hashtag
|
||||
} else {
|
||||
null
|
||||
}
|
||||
}
|
||||
}.flatten()
|
||||
}
|
||||
|
||||
val unusedHashtags =
|
||||
tagsInEvent.filterNot { eventTag ->
|
||||
|
||||
+1
-1
@@ -35,7 +35,7 @@ fun filterNip04DMs(
|
||||
account: Account?,
|
||||
since: SincePerRelayMap?,
|
||||
): List<RelayBasedFilter>? {
|
||||
if (group == null || group.isEmpty() || account == null) return null
|
||||
if (group.isNullOrEmpty() || account == null) return null
|
||||
|
||||
val userOutboxRelays = account.homeRelays.flow.value
|
||||
val userInboxRelays = account.dmRelays.flow.value
|
||||
|
||||
+1
-1
@@ -596,7 +596,7 @@ class ChatNewMessageViewModel :
|
||||
toUsersTagger.run()
|
||||
|
||||
val users = toUsersTagger.pTags?.mapTo(mutableSetOf()) { it.pubkeyHex }
|
||||
if (users == null || users.isEmpty()) {
|
||||
if (users.isNullOrEmpty()) {
|
||||
room = null
|
||||
updateNIP17StatusFromRoom()
|
||||
} else {
|
||||
|
||||
+1
-2
@@ -117,8 +117,7 @@ open class DiscoverLiveFeedFilter(
|
||||
|
||||
fun convertStatusToOrder(event: LiveActivitiesEvent?): Int {
|
||||
if (event == null) return 0
|
||||
val url = event.streaming()
|
||||
if (url == null) return 0
|
||||
val url = event.streaming() ?: return 0
|
||||
return when (event.status()) {
|
||||
StatusTag.STATUS.LIVE -> {
|
||||
if (OnlineChecker.isCachedAndOffline(url)) {
|
||||
|
||||
+1
-1
@@ -34,7 +34,7 @@ fun filterCommunitiesByHashtag(
|
||||
hashtags: Set<String>?,
|
||||
since: Long?,
|
||||
): List<RelayBasedFilter> {
|
||||
if (hashtags == null || hashtags.isEmpty()) return emptyList()
|
||||
if (hashtags.isNullOrEmpty()) return emptyList()
|
||||
|
||||
val hashtags = hashtags.flatMap(::hashtagAlts).distinct().sorted()
|
||||
|
||||
|
||||
+1
-1
@@ -33,7 +33,7 @@ fun filterClassifiedsByHashtag(
|
||||
hashtags: Set<String>?,
|
||||
since: Long?,
|
||||
): List<RelayBasedFilter>? {
|
||||
if (hashtags == null || hashtags.isEmpty()) return null
|
||||
if (hashtags.isNullOrEmpty()) return null
|
||||
|
||||
val hashtags = hashtags.flatMap(::hashtagAlts).distinct().sorted()
|
||||
|
||||
|
||||
+2
-2
@@ -555,8 +555,8 @@ open class ShortNotePostViewModel :
|
||||
val serverToUse = voiceSelectedServer ?: accountViewModel.account.settings.defaultFileServer
|
||||
uploadVoiceMessageSync(
|
||||
serverToUse,
|
||||
{ _, _ -> }, // Error handling is done by checking voiceMetadata below
|
||||
)
|
||||
) { _, _ -> } // Error handling is done by checking voiceMetadata below
|
||||
|
||||
// Abort if upload failed - don't post without voice data
|
||||
if (voiceMetadata == null) {
|
||||
Log.w("ShortNotePostViewModel", "Voice upload failed, aborting post")
|
||||
|
||||
+2
-4
@@ -160,10 +160,8 @@ class HomeLiveFilter(
|
||||
val noteEvent = note.event
|
||||
|
||||
if (noteEvent is LiveActivitiesChatMessageEvent) {
|
||||
val stream = noteEvent.activityAddress()
|
||||
if (stream == null) return false
|
||||
val streamChannel = LocalCache.getLiveActivityChannelIfExists(stream)
|
||||
if (streamChannel == null) return false
|
||||
val stream = noteEvent.activityAddress() ?: return false
|
||||
val streamChannel = LocalCache.getLiveActivityChannelIfExists(stream) ?: return false
|
||||
|
||||
if (streamChannel.info?.status() != StatusTag.STATUS.LIVE) return false
|
||||
}
|
||||
|
||||
+42
-43
@@ -165,13 +165,13 @@ class CardFeedContentState(
|
||||
val reactionsPerEvent = mutableMapOf<Note, MutableList<Note>>()
|
||||
notes
|
||||
.filter { it.event is ReactionEvent }
|
||||
.forEach {
|
||||
.forEach { note ->
|
||||
val reactedPost =
|
||||
it.replyTo?.lastOrNull {
|
||||
note.replyTo?.lastOrNull {
|
||||
it.event !is ChannelMetadataEvent && it.event !is ChannelCreateEvent
|
||||
}
|
||||
if (reactedPost != null) {
|
||||
reactionsPerEvent.getOrPut(reactedPost, { mutableListOf() }).add(it)
|
||||
reactionsPerEvent.getOrPut(reactedPost) { mutableListOf() }.add(note)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -192,7 +192,7 @@ class CardFeedContentState(
|
||||
// var newZapRequestEvent = LocalCache.checkPrivateZap(zapRequest.event as Event)
|
||||
// zapRequest.event = newZapRequestEvent
|
||||
zapsPerEvent
|
||||
.getOrPut(zappedPost, { mutableListOf() })
|
||||
.getOrPut(zappedPost) { mutableListOf() }
|
||||
.add(CombinedZap(zapRequest, zapEvent))
|
||||
}
|
||||
} else {
|
||||
@@ -215,7 +215,7 @@ class CardFeedContentState(
|
||||
val zapRequestNote = getNoteIfExists(zapRequest.id)
|
||||
if (zapRequestNote != null) {
|
||||
zapsPerUser
|
||||
.getOrPut(author, { mutableListOf() })
|
||||
.getOrPut(author) { mutableListOf() }
|
||||
.add(CombinedZap(zapRequestNote, zapEvent))
|
||||
}
|
||||
}
|
||||
@@ -226,13 +226,13 @@ class CardFeedContentState(
|
||||
val boostsPerEvent = mutableMapOf<Note, MutableList<Note>>()
|
||||
notes
|
||||
.filter { it.event is RepostEvent || it.event is GenericRepostEvent }
|
||||
.forEach {
|
||||
.forEach { note ->
|
||||
val boostedPost =
|
||||
it.replyTo?.lastOrNull {
|
||||
note.replyTo?.lastOrNull {
|
||||
it.event !is ChannelMetadataEvent && it.event !is ChannelCreateEvent
|
||||
}
|
||||
if (boostedPost != null) {
|
||||
boostsPerEvent.getOrPut(boostedPost, { mutableListOf() }).add(it)
|
||||
boostsPerEvent.getOrPut(boostedPost) { mutableListOf() }.add(note)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -240,42 +240,41 @@ class CardFeedContentState(
|
||||
|
||||
val allBaseNotes = zapsPerEvent.keys + boostsPerEvent.keys + reactionsPerEvent.keys
|
||||
val multiCards =
|
||||
allBaseNotes
|
||||
.map { baseNote ->
|
||||
val boostsInCard = boostsPerEvent[baseNote] ?: emptyList()
|
||||
val reactionsInCard = reactionsPerEvent[baseNote] ?: emptyList()
|
||||
val zapsInCard = zapsPerEvent[baseNote] ?: emptyList()
|
||||
allBaseNotes.flatMap { baseNote ->
|
||||
val boostsInCard = boostsPerEvent[baseNote] ?: emptyList()
|
||||
val reactionsInCard = reactionsPerEvent[baseNote] ?: emptyList()
|
||||
val zapsInCard = zapsPerEvent[baseNote] ?: emptyList()
|
||||
|
||||
val singleList =
|
||||
(boostsInCard + zapsInCard.map { it.response } + reactionsInCard).groupBy {
|
||||
sdf.format(
|
||||
Instant
|
||||
.ofEpochSecond(it.createdAt() ?: 0L)
|
||||
.atZone(ZoneId.systemDefault())
|
||||
.toLocalDateTime(),
|
||||
val singleList =
|
||||
(boostsInCard + zapsInCard.map { it.response } + reactionsInCard).groupBy {
|
||||
sdf.format(
|
||||
Instant
|
||||
.ofEpochSecond(it.createdAt() ?: 0L)
|
||||
.atZone(ZoneId.systemDefault())
|
||||
.toLocalDateTime(),
|
||||
)
|
||||
}
|
||||
|
||||
val days = singleList.keys.sortedBy { it }
|
||||
|
||||
days
|
||||
.mapNotNull { string ->
|
||||
val sortedList =
|
||||
singleList
|
||||
.get(string)
|
||||
?.sortedWith(compareBy({ it.createdAt() }, { it.idHex }))
|
||||
?.reversed()
|
||||
|
||||
sortedList?.chunked(30)?.map { chunk ->
|
||||
MultiSetCard(
|
||||
baseNote,
|
||||
boostsInCard.filter { it in chunk }.toImmutableList(),
|
||||
reactionsInCard.filter { it in chunk }.toImmutableList(),
|
||||
zapsInCard.filter { it.response in chunk }.toImmutableList(),
|
||||
)
|
||||
}
|
||||
|
||||
val days = singleList.keys.sortedBy { it }
|
||||
|
||||
days
|
||||
.mapNotNull {
|
||||
val sortedList =
|
||||
singleList
|
||||
.get(it)
|
||||
?.sortedWith(compareBy({ it.createdAt() }, { it.idHex }))
|
||||
?.reversed()
|
||||
|
||||
sortedList?.chunked(30)?.map { chunk ->
|
||||
MultiSetCard(
|
||||
baseNote,
|
||||
boostsInCard.filter { it in chunk }.toImmutableList(),
|
||||
reactionsInCard.filter { it in chunk }.toImmutableList(),
|
||||
zapsInCard.filter { it.response in chunk }.toImmutableList(),
|
||||
)
|
||||
}
|
||||
}.flatten()
|
||||
}.flatten()
|
||||
}.flatten()
|
||||
}
|
||||
|
||||
val userZaps =
|
||||
zapsPerUser
|
||||
@@ -290,10 +289,10 @@ class CardFeedContentState(
|
||||
)
|
||||
}
|
||||
|
||||
byDay.values.map {
|
||||
byDay.values.map { zaps ->
|
||||
ZapUserSetCard(
|
||||
user.key,
|
||||
it
|
||||
zaps
|
||||
.sortedWith(compareBy({ it.createdAt() }, { it.idHex() }))
|
||||
.reversed()
|
||||
.toImmutableList(),
|
||||
|
||||
+1
-3
@@ -37,9 +37,7 @@ class UserProfileBookmarksFeedFilter(
|
||||
|
||||
override fun feed(): List<Note> {
|
||||
val note = LocalCache.getOrCreateAddressableNote(BookmarkListEvent.createBookmarkAddress(user.pubkeyHex))
|
||||
val noteEvent = note.event as? BookmarkListEvent
|
||||
|
||||
if (noteEvent == null) return emptyList()
|
||||
val noteEvent = note.event as? BookmarkListEvent ?: return emptyList()
|
||||
|
||||
val notes =
|
||||
noteEvent.publicBookmarks().mapNotNull {
|
||||
|
||||
+24
-25
@@ -76,29 +76,28 @@ fun filterUserProfilePosts(
|
||||
user.outboxRelays()?.ifEmpty { null }
|
||||
?: (user.allUsedRelays() + LocalCache.relayHints.hintsForKey(user.pubkeyHex))
|
||||
|
||||
return relays
|
||||
.map { relay ->
|
||||
listOf(
|
||||
RelayBasedFilter(
|
||||
relay = relay,
|
||||
filter =
|
||||
Filter(
|
||||
kinds = UserProfilePostKinds1,
|
||||
authors = listOf(user.pubkeyHex),
|
||||
limit = 500,
|
||||
since = since?.get(relay)?.time,
|
||||
),
|
||||
),
|
||||
RelayBasedFilter(
|
||||
relay = relay,
|
||||
filter =
|
||||
Filter(
|
||||
kinds = UserProfilePostKinds2,
|
||||
authors = listOf(user.pubkeyHex),
|
||||
limit = 50,
|
||||
since = since?.get(relay)?.time,
|
||||
),
|
||||
),
|
||||
)
|
||||
}.flatten()
|
||||
return relays.flatMap { relay ->
|
||||
listOf(
|
||||
RelayBasedFilter(
|
||||
relay = relay,
|
||||
filter =
|
||||
Filter(
|
||||
kinds = UserProfilePostKinds1,
|
||||
authors = listOf(user.pubkeyHex),
|
||||
limit = 500,
|
||||
since = since?.get(relay)?.time,
|
||||
),
|
||||
),
|
||||
RelayBasedFilter(
|
||||
relay = relay,
|
||||
filter =
|
||||
Filter(
|
||||
kinds = UserProfilePostKinds2,
|
||||
authors = listOf(user.pubkeyHex),
|
||||
limit = 50,
|
||||
since = since?.get(relay)?.time,
|
||||
),
|
||||
),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -842,7 +842,7 @@ private fun RenderClassifiedsReaderForThread(
|
||||
|
||||
Row(modifier = Modifier.padding(start = 12.dp, end = 12.dp, bottom = 12.dp)) {
|
||||
Column {
|
||||
if (imageSet != null && imageSet.isNotEmpty()) {
|
||||
if (!imageSet.isNullOrEmpty()) {
|
||||
AutoNonlazyGrid(imageSet.size) {
|
||||
ZoomableContentView(
|
||||
content = imageSet[it],
|
||||
|
||||
Reference in New Issue
Block a user