mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2025-10-10 07:52:33 +02:00
Only calculates follows when needed.
This commit is contained in:
@@ -109,8 +109,6 @@ fun NoteQuickActionMenu(note: Note, popupExpanded: Boolean, onDismiss: () -> Uni
|
|||||||
var showDeleteAlertDialog by remember { mutableStateOf(false) }
|
var showDeleteAlertDialog by remember { mutableStateOf(false) }
|
||||||
var showBlockAlertDialog by remember { mutableStateOf(false) }
|
var showBlockAlertDialog by remember { mutableStateOf(false) }
|
||||||
var showReportDialog by remember { mutableStateOf(false) }
|
var showReportDialog by remember { mutableStateOf(false) }
|
||||||
val isOwnNote = accountViewModel.isLoggedUser(note.author)
|
|
||||||
val isFollowingUser = !isOwnNote && accountViewModel.isFollowing(note.author!!)
|
|
||||||
|
|
||||||
val backgroundColor = if (MaterialTheme.colors.isLight) {
|
val backgroundColor = if (MaterialTheme.colors.isLight) {
|
||||||
MaterialTheme.colors.primary
|
MaterialTheme.colors.primary
|
||||||
@@ -129,6 +127,9 @@ fun NoteQuickActionMenu(note: Note, popupExpanded: Boolean, onDismiss: () -> Uni
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (popupExpanded) {
|
if (popupExpanded) {
|
||||||
|
val isOwnNote = accountViewModel.isLoggedUser(note.author)
|
||||||
|
val isFollowingUser = !isOwnNote && accountViewModel.isFollowing(note.author!!)
|
||||||
|
|
||||||
Popup(onDismissRequest = onDismiss) {
|
Popup(onDismissRequest = onDismiss) {
|
||||||
Card(
|
Card(
|
||||||
modifier = Modifier.shadow(elevation = 6.dp, shape = cardShape),
|
modifier = Modifier.shadow(elevation = 6.dp, shape = cardShape),
|
||||||
|
@@ -170,7 +170,7 @@ class AccountViewModel(private val account: Account) : ViewModel() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun isLoggedUser(user: User?): Boolean {
|
fun isLoggedUser(user: User?): Boolean {
|
||||||
return account.userProfile() == user
|
return account.userProfile() === user
|
||||||
}
|
}
|
||||||
|
|
||||||
fun isFollowing(user: User?): Boolean {
|
fun isFollowing(user: User?): Boolean {
|
||||||
|
Reference in New Issue
Block a user