Moves isAcceptableNote calculations to viewModel

This commit is contained in:
Vitor Pamplona
2023-08-25 17:32:19 -04:00
parent 6c09e47e4f
commit 53b0db61ea
2 changed files with 17 additions and 17 deletions

View File

@@ -441,10 +441,8 @@ fun WatchForReports(
val noteReportsState by note.live().reports.observeAsState()
LaunchedEffect(key1 = noteReportsState, key2 = userFollowsState) {
launch(Dispatchers.Default) {
accountViewModel.isNoteAcceptable(note, onChange)
}
}
}
@Composable

View File

@@ -411,6 +411,7 @@ class AccountViewModel(val account: Account) : ViewModel() {
}
fun isNoteAcceptable(note: Note, onReady: (Boolean, Boolean, ImmutableSet<Note>) -> Unit) {
viewModelScope.launch {
val isFromLoggedIn = note.author?.pubkeyHex == userProfile().pubkeyHex
val isFromLoggedInFollow = note.author?.let { userProfile().isFollowingCached(it) } ?: true
@@ -432,6 +433,7 @@ class AccountViewModel(val account: Account) : ViewModel() {
}
}
}
}
fun unwrap(event: GiftWrapEvent): Event? {
return account.unwrap(event)