add support for amber in the follow dropdown menu
This commit is contained in:
@@ -325,8 +325,10 @@ private fun RenderMainPopup(
|
|||||||
stringResource(R.string.quick_action_follow)
|
stringResource(R.string.quick_action_follow)
|
||||||
) {
|
) {
|
||||||
scope.launch(Dispatchers.IO) {
|
scope.launch(Dispatchers.IO) {
|
||||||
accountViewModel.follow(note.author!!)
|
event = accountViewModel.follow(note.author!!, !accountViewModel.loggedInWithAmber())
|
||||||
onDismiss()
|
if (!accountViewModel.loggedInWithAmber()) {
|
||||||
|
onDismiss()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -416,11 +416,15 @@ fun NoteDropDownMenu(note: Note, popupExpanded: MutableState<Boolean>, accountVi
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!state.isFollowingAuthor) {
|
if (!state.isFollowingAuthor) {
|
||||||
DropdownMenuItem(onClick = {
|
DropdownMenuItem(
|
||||||
accountViewModel.follow(
|
onClick = {
|
||||||
note.author ?: return@DropdownMenuItem
|
val author = note.author ?: return@DropdownMenuItem
|
||||||
); onDismiss()
|
event = accountViewModel.follow(author, !accountViewModel.loggedInWithAmber())
|
||||||
}) {
|
if (!accountViewModel.loggedInWithAmber()) {
|
||||||
|
onDismiss()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
) {
|
||||||
Text(stringResource(R.string.follow))
|
Text(stringResource(R.string.follow))
|
||||||
}
|
}
|
||||||
Divider()
|
Divider()
|
||||||
|
|||||||
@@ -269,7 +269,7 @@ fun ShowFollowingOrUnfollowingButton(
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
scope.launch(Dispatchers.IO) {
|
scope.launch(Dispatchers.IO) {
|
||||||
accountViewModel.follow(baseAuthor)
|
accountViewModel.follow(baseAuthor, true)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ import com.vitorpamplona.amethyst.ui.note.ZapraiserStatus
|
|||||||
import com.vitorpamplona.amethyst.ui.note.showAmount
|
import com.vitorpamplona.amethyst.ui.note.showAmount
|
||||||
import com.vitorpamplona.quartz.encoders.HexKey
|
import com.vitorpamplona.quartz.encoders.HexKey
|
||||||
import com.vitorpamplona.quartz.events.BookmarkListEvent
|
import com.vitorpamplona.quartz.events.BookmarkListEvent
|
||||||
|
import com.vitorpamplona.quartz.events.ContactListEvent
|
||||||
import com.vitorpamplona.quartz.events.DeletionEvent
|
import com.vitorpamplona.quartz.events.DeletionEvent
|
||||||
import com.vitorpamplona.quartz.events.Event
|
import com.vitorpamplona.quartz.events.Event
|
||||||
import com.vitorpamplona.quartz.events.GiftWrapEvent
|
import com.vitorpamplona.quartz.events.GiftWrapEvent
|
||||||
@@ -375,8 +376,8 @@ class AccountViewModel(val account: Account) : ViewModel() {
|
|||||||
account.prefer(source, target, preference)
|
account.prefer(source, target, preference)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun follow(user: User) {
|
fun follow(user: User, signEvent: Boolean): ContactListEvent? {
|
||||||
account.follow(user)
|
return account.follow(user, signEvent)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun unfollow(user: User) {
|
fun unfollow(user: User) {
|
||||||
|
|||||||
Reference in New Issue
Block a user