mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2026-08-12 09:13:23 +00:00
Merge pull request #3572 from vitorpamplona/claude/kotlin-compiler-warnings-g10py4
Replace nullable safe calls with immutable map operations
This commit is contained in:
+2
-2
@@ -114,7 +114,7 @@ fun MinichatScreen(
|
||||
// public-chat (NIP-28/NIP-29) replies come over a relay REQ for this message's kind-1111 children.
|
||||
if (isConcord) {
|
||||
ConcordChannelSubscription(accountViewModel.dataSources().concordChannels, accountViewModel)
|
||||
ConcordChannelHistorySubscription(communityId!!, channelId!!, accountViewModel.dataSources().concordChannelHistory, accountViewModel)
|
||||
ConcordChannelHistorySubscription(communityId, channelId, accountViewModel.dataSources().concordChannelHistory, accountViewModel)
|
||||
ConcordMinichatBackfillUntilRoot(rootNote, accountViewModel.dataSources().concordChannelHistory.history)
|
||||
}
|
||||
EventFinderFilterAssemblerSubscription(rootNote, accountViewModel)
|
||||
@@ -151,7 +151,7 @@ fun MinichatScreen(
|
||||
// itself", where the whole timeline loads and (if you aren't a member yet) you can
|
||||
// join. This is the way out when the pinned root is still backfilling or unavailable.
|
||||
if (isConcord) {
|
||||
IconButton(onClick = { nav.nav(Route.Concord(communityId!!, channelId!!)) }) {
|
||||
IconButton(onClick = { nav.nav(Route.Concord(communityId, channelId)) }) {
|
||||
SymbolIcon(symbol = MaterialSymbols.Forum, contentDescription = stringRes(R.string.concord_open_channel))
|
||||
}
|
||||
}
|
||||
|
||||
+3
-3
@@ -236,11 +236,11 @@ fun ConcordChannelListScreen(
|
||||
LazyColumn(Modifier.fillMaxSize().padding(padding)) {
|
||||
items(channels, key = { it.key }) { entry ->
|
||||
val def = entry.value.definition
|
||||
val name = def?.name ?: entry.key
|
||||
val name = def.name.ifBlank { entry.key }
|
||||
val icon =
|
||||
when {
|
||||
def?.voice == true -> MaterialSymbols.Mic
|
||||
def?.private == true -> MaterialSymbols.Lock
|
||||
def.voice == true -> MaterialSymbols.Mic
|
||||
def.private == true -> MaterialSymbols.Lock
|
||||
else -> MaterialSymbols.Tag
|
||||
}
|
||||
Row(
|
||||
|
||||
+2
-2
@@ -72,8 +72,8 @@ fun rememberConcordImageModel(
|
||||
val ciphertext =
|
||||
client.newCall(Request.Builder().url(pointer.url).build()).execute().use { resp ->
|
||||
if (!resp.isSuccessful) return@runCatching null
|
||||
resp.body?.bytes()
|
||||
} ?: return@runCatching null
|
||||
resp.body.bytes()
|
||||
}
|
||||
|
||||
val plaintext = pointer.decryptOrNull(ciphertext) ?: return@runCatching null
|
||||
cacheFile.writeBytes(plaintext)
|
||||
|
||||
+3
-3
@@ -222,11 +222,11 @@ fun ConcordHomeScreen(
|
||||
ConcordChannelRow(
|
||||
communityId = entry.id,
|
||||
channelKey = ch.key,
|
||||
channelName = def?.name ?: ch.key,
|
||||
channelName = def.name.ifBlank { ch.key },
|
||||
icon =
|
||||
when {
|
||||
def?.voice == true -> MaterialSymbols.Mic
|
||||
def?.private == true -> MaterialSymbols.Lock
|
||||
def.voice == true -> MaterialSymbols.Mic
|
||||
def.private == true -> MaterialSymbols.Lock
|
||||
else -> MaterialSymbols.Tag
|
||||
},
|
||||
hideIfRead = mode == ChannelExpand.UNREAD,
|
||||
|
||||
+2
-2
@@ -280,7 +280,7 @@ class PoWPublishQueue(
|
||||
|
||||
val job = MiningJob(id, kind, difficulty, persisted = persistAs != null, dedupeKey = dedupeKey, owner = owner, work = work)
|
||||
persistAs?.let { persistence?.save(it) }
|
||||
pending.update { it.put(job.id, job) }
|
||||
pending.update { it.putting(job.id, job) }
|
||||
_jobs.update { (it + PoWJobState(job.id, job.kind, job.difficulty)).toImmutableList() }
|
||||
Log.d(TAG) {
|
||||
val durability = if (persistAs != null) "persisted" else "in-memory only, lost on process death"
|
||||
@@ -409,7 +409,7 @@ class PoWPublishQueue(
|
||||
dropCheckpoint: Boolean,
|
||||
persisted: Boolean,
|
||||
) {
|
||||
pending.update { it.remove(jobId) }
|
||||
pending.update { it.removing(jobId) }
|
||||
_jobs.update { list -> list.filter { it.id != jobId }.toImmutableList() }
|
||||
if (persisted && dropCheckpoint) persistence?.remove(jobId)
|
||||
}
|
||||
|
||||
-1
@@ -439,7 +439,6 @@ class NappletBrokerTest {
|
||||
broker(ScriptedPrompt(GrantState.ALLOW_ONCE))
|
||||
.handle(applet, NappletRequest.PayInvoice("lnbc1..."), allDeclared)
|
||||
assertIs<NappletResponse.Unsupported>(response)
|
||||
assertNull((response as? NappletResponse.Paid)?.preimage)
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
+1
-1
@@ -153,7 +153,7 @@ class PrivacyLockStateTest {
|
||||
state.onUnlockSuccess()
|
||||
advanceTimeBy(InactivityTimer.OneMin.millis!! - 1_000L)
|
||||
state.onUserInteraction()
|
||||
advanceTimeBy(InactivityTimer.OneMin.millis!! - 1_000L)
|
||||
advanceTimeBy(InactivityTimer.OneMin.millis - 1_000L)
|
||||
assertTrue(state.state.value is LockState.Unlocked)
|
||||
advanceTimeBy(2_000L)
|
||||
assertEquals(LockState.Locked, state.state.value)
|
||||
|
||||
+1
-1
@@ -96,7 +96,7 @@ class RelayAuthenticator(
|
||||
private fun publishSnapshot(relayUrl: NormalizedRelayUrl) {
|
||||
val status = authStatus.get(relayUrl)
|
||||
_authStateFlow.update { current ->
|
||||
if (status == null) current.remove(relayUrl) else current.put(relayUrl, status.snapshot())
|
||||
if (status == null) current.removing(relayUrl) else current.putting(relayUrl, status.snapshot())
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user