- Updates several libraries

- Reformats code to the newest Klint
- Fixes isEmpty bug on Filters
This commit is contained in:
Vitor Pamplona
2026-02-09 14:06:07 -05:00
parent 710f15f790
commit eb66182211
133 changed files with 1373 additions and 580 deletions
@@ -296,6 +296,7 @@ fun App(
onLoginSuccess = { onScreenChange(DesktopScreen.Feed) },
)
}
is AccountState.LoggedIn -> {
val account = accountState as AccountState.LoggedIn
val nwcConnection by accountManager.nwcConnection.collectAsState()
@@ -442,7 +443,7 @@ fun MainContent(
modifier = Modifier.weight(1f).fillMaxHeight().padding(24.dp),
) {
when (currentScreen) {
DesktopScreen.Feed ->
DesktopScreen.Feed -> {
FeedScreen(
relayManager = relayManager,
localCache = localCache,
@@ -458,7 +459,9 @@ fun MainContent(
},
onZapFeedback = onZapFeedback,
)
DesktopScreen.Reads ->
}
DesktopScreen.Reads -> {
ReadsScreen(
relayManager = relayManager,
localCache = localCache,
@@ -470,7 +473,9 @@ fun MainContent(
onScreenChange(DesktopScreen.Thread(noteId))
},
)
DesktopScreen.Search ->
}
DesktopScreen.Search -> {
SearchScreen(
localCache = localCache,
relayManager = relayManager,
@@ -482,7 +487,9 @@ fun MainContent(
onScreenChange(DesktopScreen.Thread(noteId))
},
)
DesktopScreen.Bookmarks ->
}
DesktopScreen.Bookmarks -> {
BookmarksScreen(
relayManager = relayManager,
localCache = localCache,
@@ -497,9 +504,17 @@ fun MainContent(
},
onZapFeedback = onZapFeedback,
)
DesktopScreen.Messages -> MessagesPlaceholder()
DesktopScreen.Notifications -> NotificationsScreen(relayManager, account, subscriptionsCoordinator)
DesktopScreen.MyProfile ->
}
DesktopScreen.Messages -> {
MessagesPlaceholder()
}
DesktopScreen.Notifications -> {
NotificationsScreen(relayManager, account, subscriptionsCoordinator)
}
DesktopScreen.MyProfile -> {
UserProfileScreen(
pubKeyHex = account.pubKeyHex,
relayManager = relayManager,
@@ -514,7 +529,9 @@ fun MainContent(
},
onZapFeedback = onZapFeedback,
)
is DesktopScreen.UserProfile ->
}
is DesktopScreen.UserProfile -> {
UserProfileScreen(
pubKeyHex = currentScreen.pubKeyHex,
relayManager = relayManager,
@@ -529,7 +546,9 @@ fun MainContent(
},
onZapFeedback = onZapFeedback,
)
is DesktopScreen.Thread ->
}
is DesktopScreen.Thread -> {
ThreadScreen(
noteId = currentScreen.noteId,
relayManager = relayManager,
@@ -547,7 +566,11 @@ fun MainContent(
onZapFeedback = onZapFeedback,
onReply = onShowReplyDialog,
)
DesktopScreen.Settings -> RelaySettingsScreen(relayManager, account, accountManager)
}
DesktopScreen.Settings -> {
RelaySettingsScreen(relayManager, account, accountManager)
}
}
}
}
@@ -171,9 +171,11 @@ class NwcPaymentHandler(
is PayInvoiceSuccessResponse -> {
PaymentResult.Success(response.result?.preimage)
}
is PayInvoiceErrorResponse -> {
PaymentResult.Error(response.error?.message ?: "Unknown error")
}
else -> {
PaymentResult.Error("Unexpected response type: ${response.resultType}")
}
@@ -266,6 +266,7 @@ fun BookmarksScreen(
isLoading && !hasReceivedEose -> {
LoadingState(message = "Loading bookmarks...")
}
currentBookmarkIds.isEmpty() && hasReceivedEose -> {
EmptyState(
title = if (selectedTab == BookmarkTab.PUBLIC) "No public bookmarks" else "No private bookmarks",
@@ -277,6 +278,7 @@ fun BookmarksScreen(
},
)
}
else -> {
LazyColumn(
modifier = Modifier.fillMaxSize(),
@@ -268,6 +268,7 @@ fun FeedScreen(
},
)
}
FeedMode.FOLLOWING -> {
if (followedUsers.isNotEmpty()) {
createFollowingFeedSubscription(
@@ -971,9 +971,11 @@ private suspend fun zapNote(
is NwcPaymentHandler.PaymentResult.Success -> {
ZapFeedback.Success(amountSats)
}
is NwcPaymentHandler.PaymentResult.Error -> {
ZapFeedback.Error(paymentResult.message)
}
is NwcPaymentHandler.PaymentResult.Timeout -> {
ZapFeedback.Timeout
}
@@ -984,6 +986,7 @@ private suspend fun zapNote(
ZapFeedback.ExternalWallet(amountSats)
}
}
is ZapAction.ZapResult.Error -> {
ZapFeedback.Error(result.message)
}
@@ -153,17 +153,21 @@ fun NotificationsScreen(
val notification =
when (event) {
is ReactionEvent ->
is ReactionEvent -> {
NotificationItem.Reaction(
event = event,
timestamp = event.createdAt,
content = event.content,
)
is RepostEvent, is GenericRepostEvent ->
}
is RepostEvent, is GenericRepostEvent -> {
NotificationItem.Repost(
event = event,
timestamp = event.createdAt,
)
}
is LnZapEvent -> {
val amount = event.amount?.toLong()
NotificationItem.Zap(
@@ -172,6 +176,7 @@ fun NotificationsScreen(
amount = amount,
)
}
is TextNoteEvent -> {
val eTags = event.tags.filter { it.size > 1 && it[0] == "e" }
val isReply = eTags.isNotEmpty()
@@ -181,7 +186,10 @@ fun NotificationsScreen(
NotificationItem.Mention(event, event.createdAt)
}
}
else -> NotificationItem.Mention(event, event.createdAt)
else -> {
NotificationItem.Mention(event, event.createdAt)
}
}
notificationState.addItem(notification)
@@ -230,15 +238,26 @@ fun NotificationsScreen(
fun NotificationCard(notification: NotificationItem) {
val (icon, label, color) =
when (notification) {
is NotificationItem.Mention -> Triple(Icons.Default.Favorite, "mentioned you", MaterialTheme.colorScheme.primary)
is NotificationItem.Reply -> Triple(Reply, "replied", MaterialTheme.colorScheme.secondary)
is NotificationItem.Reaction ->
is NotificationItem.Mention -> {
Triple(Icons.Default.Favorite, "mentioned you", MaterialTheme.colorScheme.primary)
}
is NotificationItem.Reply -> {
Triple(Reply, "replied", MaterialTheme.colorScheme.secondary)
}
is NotificationItem.Reaction -> {
Triple(
Icons.Default.Favorite,
"reacted ${notification.content}",
MaterialTheme.colorScheme.tertiary,
)
is NotificationItem.Repost -> Triple(Repost, "reposted", MaterialTheme.colorScheme.primary)
}
is NotificationItem.Repost -> {
Triple(Repost, "reposted", MaterialTheme.colorScheme.primary)
}
is NotificationItem.Zap -> {
val amountText = notification.amount?.let { " ${it / 1000} sats" } ?: ""
Triple(Zap, "zapped$amountText", MaterialTheme.colorScheme.primary)
@@ -237,6 +237,7 @@ fun ReadsScreen(
},
)
}
FeedMode.FOLLOWING -> {
if (followedUsers.isNotEmpty()) {
createFollowingLongFormFeedSubscription(
@@ -322,12 +323,15 @@ fun ReadsScreen(
connectedRelays.isEmpty() -> {
LoadingState("Connecting to relays...")
}
feedMode == FeedMode.FOLLOWING && followedUsers.isEmpty() -> {
LoadingState("Loading followed users...")
}
events.isEmpty() && !initialLoadComplete -> {
LoadingState("Loading articles...")
}
events.isEmpty() && initialLoadComplete -> {
EmptyState(
title =
@@ -345,6 +349,7 @@ fun ReadsScreen(
onRefresh = { relayManager.connect() },
)
}
else -> {
LazyColumn(
verticalArrangement = Arrangement.spacedBy(12.dp),
@@ -384,13 +384,25 @@ private fun SearchResultCard(
.fillMaxWidth()
.clickable {
when (result) {
is SearchResult.UserResult -> onNavigateToProfile(result.pubKeyHex)
is SearchResult.CachedUserResult -> onNavigateToProfile(result.user.pubkeyHex)
is SearchResult.NoteResult -> onNavigateToThread(result.noteIdHex)
is SearchResult.UserResult -> {
onNavigateToProfile(result.pubKeyHex)
}
is SearchResult.CachedUserResult -> {
onNavigateToProfile(result.user.pubkeyHex)
}
is SearchResult.NoteResult -> {
onNavigateToThread(result.noteIdHex)
}
is SearchResult.AddressResult -> {
onNavigateToThread("${result.kind}:${result.pubKeyHex}:${result.dTag}")
}
is SearchResult.HashtagResult -> onNavigateToHashtag(result.hashtag)
is SearchResult.HashtagResult -> {
onNavigateToHashtag(result.hashtag)
}
}
},
colors =
@@ -339,6 +339,7 @@ fun UserProfileScreen(
Spacer(Modifier.width(8.dp))
Text("Loading...")
}
isLoading -> {
androidx.compose.material3.CircularProgressIndicator(
modifier = Modifier.size(16.dp),
@@ -348,6 +349,7 @@ fun UserProfileScreen(
Spacer(Modifier.width(8.dp))
Text(if (isFollowing) "Unfollowing..." else "Following...")
}
else -> {
Icon(
if (isFollowing) Icons.Default.PersonRemove else Icons.Default.PersonAdd,
@@ -529,6 +531,7 @@ fun UserProfileScreen(
}
}
}
postsLoading -> {
// Loading state
Box(
@@ -546,6 +549,7 @@ fun UserProfileScreen(
}
}
}
events.isEmpty() -> {
// Empty state (loaded but no posts)
Box(
@@ -559,6 +563,7 @@ fun UserProfileScreen(
)
}
}
else -> {
// Posts loaded successfully
LazyColumn(