add follow directly from a note feature

This commit is contained in:
Rashed
2023-03-03 09:53:56 +03:00
parent 83f46f1a66
commit f1711719f4
2 changed files with 14 additions and 1 deletions
@@ -629,6 +629,17 @@ fun NoteDropDownMenu(note: Note, popupExpanded: Boolean, onDismiss: () -> Unit,
expanded = popupExpanded,
onDismissRequest = onDismiss
) {
if (note.author != accountViewModel.accountLiveData.value?.account?.userProfile()) {
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)
}
}