resolving some more warnings
This commit is contained in:
+1
-2
@@ -20,7 +20,6 @@
|
||||
*/
|
||||
package com.vitorpamplona.amethyst.desktop.ui
|
||||
|
||||
import com.vitorpamplona.amethyst.commons.model.User
|
||||
import com.vitorpamplona.amethyst.commons.model.cache.ICacheProvider
|
||||
import com.vitorpamplona.amethyst.desktop.ui.note.NoteDisplayData
|
||||
import com.vitorpamplona.quartz.nip01Core.core.Event
|
||||
@@ -31,7 +30,7 @@ import com.vitorpamplona.quartz.nip19Bech32.toNpub
|
||||
* Extension to convert Event to NoteDisplayData for the shared NoteCard.
|
||||
*/
|
||||
fun Event.toNoteDisplayData(cache: ICacheProvider? = null): NoteDisplayData {
|
||||
val user = (cache?.getUserIfExists(pubKey) as? User)
|
||||
val user = (cache?.getUserIfExists(pubKey))
|
||||
|
||||
val displayName =
|
||||
user?.toBestDisplayName()
|
||||
|
||||
@@ -83,7 +83,6 @@ import androidx.compose.ui.text.font.FontFamily
|
||||
import androidx.compose.ui.text.input.TextFieldValue
|
||||
import androidx.compose.ui.unit.dp
|
||||
import com.vitorpamplona.amethyst.commons.chess.RelaySyncStatus
|
||||
import com.vitorpamplona.amethyst.commons.model.User
|
||||
import com.vitorpamplona.amethyst.commons.search.AdvancedSearchBarState
|
||||
import com.vitorpamplona.amethyst.commons.search.QuerySerializer
|
||||
import com.vitorpamplona.amethyst.commons.search.SavedSearch
|
||||
@@ -195,7 +194,7 @@ fun SearchScreen(
|
||||
if (event is MetadataEvent) {
|
||||
localCache.consumeMetadata(event)
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
val user = localCache.getUserIfExists(event.pubKey) as? User
|
||||
val user = localCache.getUserIfExists(event.pubKey)
|
||||
if (user != null) {
|
||||
state.addPeopleResult(user)
|
||||
}
|
||||
|
||||
+5
-3
@@ -33,6 +33,8 @@ import androidx.compose.foundation.layout.size
|
||||
import androidx.compose.foundation.layout.width
|
||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||
import androidx.compose.material.icons.Icons
|
||||
import androidx.compose.material.icons.automirrored.filled.Forward
|
||||
import androidx.compose.material.icons.automirrored.filled.InsertDriveFile
|
||||
import androidx.compose.material.icons.filled.Download
|
||||
import androidx.compose.material.icons.filled.Forward
|
||||
import androidx.compose.material.icons.filled.InsertDriveFile
|
||||
@@ -92,7 +94,7 @@ fun ChatFileAttachment(
|
||||
|
||||
// Auto-decrypt images
|
||||
LaunchedEffect(url) {
|
||||
if (keyBytes != null && nonce != null && url != null) {
|
||||
if (keyBytes != null && nonce != null) {
|
||||
isLoading = true
|
||||
try {
|
||||
val bytes = EncryptedMediaService.downloadAndDecrypt(url, keyBytes, nonce)
|
||||
@@ -191,7 +193,7 @@ fun ChatFileAttachment(
|
||||
// Non-image file
|
||||
Row(verticalAlignment = Alignment.CenterVertically) {
|
||||
Icon(
|
||||
Icons.Default.InsertDriveFile,
|
||||
Icons.AutoMirrored.Filled.InsertDriveFile,
|
||||
contentDescription = "File",
|
||||
modifier = Modifier.size(32.dp),
|
||||
)
|
||||
@@ -237,7 +239,7 @@ fun ChatFileAttachment(
|
||||
DropdownMenuItem(
|
||||
text = { Text("Forward") },
|
||||
leadingIcon = {
|
||||
Icon(Icons.Default.Forward, contentDescription = null, modifier = Modifier.size(18.dp))
|
||||
Icon(Icons.AutoMirrored.Filled.Forward, contentDescription = null, modifier = Modifier.size(18.dp))
|
||||
},
|
||||
onClick = {
|
||||
showContextMenu = false
|
||||
|
||||
+2
-3
@@ -85,7 +85,6 @@ import androidx.compose.ui.window.Popup
|
||||
import androidx.compose.ui.window.PopupProperties
|
||||
import com.vitorpamplona.amethyst.commons.model.IAccount
|
||||
import com.vitorpamplona.amethyst.commons.model.Note
|
||||
import com.vitorpamplona.amethyst.commons.model.User
|
||||
import com.vitorpamplona.amethyst.commons.model.cache.ICacheProvider
|
||||
import com.vitorpamplona.amethyst.commons.ui.chat.ChatMessageCompose
|
||||
import com.vitorpamplona.amethyst.commons.ui.chat.ChatroomHeader
|
||||
@@ -196,7 +195,7 @@ fun ChatPane(
|
||||
}
|
||||
|
||||
// Resolve users for the header
|
||||
val users = roomKey.users.mapNotNull { cacheProvider.getUserIfExists(it) as? User }
|
||||
val users = roomKey.users.mapNotNull { cacheProvider.getUserIfExists(it) }
|
||||
val isGroup = users.size > 1
|
||||
|
||||
// Load room into message state
|
||||
@@ -804,7 +803,7 @@ private suspend fun sendEncryptedFiles(
|
||||
) {
|
||||
val orchestrator = DesktopUploadOrchestrator()
|
||||
val server = DesktopPreferences.preferredBlossomServer
|
||||
val recipients = roomKey.users.mapNotNull { cacheProvider.getUserIfExists(it) as? User }.map { it.toPTag() }
|
||||
val recipients = roomKey.users.mapNotNull { cacheProvider.getUserIfExists(it) }.map { it.toPTag() }
|
||||
|
||||
for (file in files) {
|
||||
val cipher = AESGCM()
|
||||
|
||||
+2
-2
@@ -199,11 +199,11 @@ class ChatroomListState(
|
||||
// Skip rooms with no messages
|
||||
if (chatroom.messages.isEmpty()) continue
|
||||
|
||||
val users = key.users.mapNotNull { cacheProvider.getUserIfExists(it) as? User }
|
||||
val users = key.users.mapNotNull { cacheProvider.getUserIfExists(it) }
|
||||
|
||||
// Collect pubkeys without profile info
|
||||
for (pubkey in key.users) {
|
||||
val user = cacheProvider.getUserIfExists(pubkey) as? User
|
||||
val user = cacheProvider.getUserIfExists(pubkey)
|
||||
if (user == null || user.metadataOrNull() == null) {
|
||||
pubkeysNeedingMetadata.add(pubkey)
|
||||
}
|
||||
|
||||
+1
-2
@@ -51,7 +51,6 @@ import androidx.compose.ui.focus.FocusRequester
|
||||
import androidx.compose.ui.focus.focusRequester
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.window.Dialog
|
||||
import com.vitorpamplona.amethyst.commons.model.User
|
||||
import com.vitorpamplona.amethyst.commons.model.cache.ICacheProvider
|
||||
import com.vitorpamplona.amethyst.commons.search.SearchResult
|
||||
import com.vitorpamplona.amethyst.commons.ui.components.UserSearchCard
|
||||
@@ -183,7 +182,7 @@ fun NewDmDialog(
|
||||
bech32Results.filterIsInstance<SearchResult.UserResult>()
|
||||
items(userResults) { result ->
|
||||
val user =
|
||||
cacheProvider.getUserIfExists(result.pubKeyHex) as? User
|
||||
cacheProvider.getUserIfExists(result.pubKeyHex)
|
||||
if (user != null) {
|
||||
UserSearchCard(
|
||||
user = user,
|
||||
|
||||
Reference in New Issue
Block a user