Merge pull request from rashedswen/main

add follow directly from a note feature
This commit is contained in:
Vitor Pamplona 2023-03-03 11:35:54 -05:00 committed by GitHub
commit f52bf26520
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 1 deletions
app/src/main/java/com/vitorpamplona/amethyst/ui

@ -629,6 +629,18 @@ fun NoteDropDownMenu(note: Note, popupExpanded: Boolean, onDismiss: () -> Unit,
expanded = popupExpanded,
onDismissRequest = onDismiss
) {
if (note.author != accountViewModel.accountLiveData.value?.account?.userProfile() && !accountViewModel.accountLiveData.value?.account?.userProfile()
!!.isFollowing(note.author!!)) {
DropdownMenuItem(onClick = {
accountViewModel.follow(
note.author ?: return@DropdownMenuItem
); onDismiss()
}) {
Text(stringResource(R.string.follow))
}
Divider()
}
DropdownMenuItem(onClick = { clipboardManager.setText(AnnotatedString(accountViewModel.decrypt(note) ?: "")); onDismiss() }) {
Text(stringResource(R.string.copy_text))
}

@ -113,7 +113,9 @@ class AccountViewModel(private val account: Account): ViewModel() {
account.prefer(source, target, preference)
}
fun follow(user: User) {
account.follow(user)
}
}