Replace subsequent checks with '!isNullOrEmpty()' call
This commit is contained in:
@@ -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))
|
||||
|
||||
+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(
|
||||
|
||||
@@ -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,
|
||||
|
||||
+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
-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()
|
||||
|
||||
|
||||
+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