From 46effa572c385e509056dd388c14eea5a4f3e744 Mon Sep 17 00:00:00 2001 From: greenart7c3 Date: Fri, 1 Sep 2023 10:18:49 -0300 Subject: [PATCH] refactor default values in signEvent variables --- .../vitorpamplona/amethyst/model/Account.kt | 30 +++++------ .../amethyst/service/AmberUtils.kt | 6 +-- .../amethyst/ui/actions/NewPostViewModel.kt | 11 ++-- .../amethyst/ui/note/AddBountyAmountDialog.kt | 50 ++++++++++++++++--- .../amethyst/ui/note/NoteQuickActionMenu.kt | 6 ++- .../amethyst/ui/note/ReactionsRow.kt | 8 +-- .../amethyst/ui/note/ZapNoteCompose.kt | 4 +- .../ui/screen/loggedIn/AccountViewModel.kt | 14 +++--- .../ui/screen/loggedIn/ChannelScreen.kt | 28 +++++++++-- .../ui/screen/loggedIn/ChatroomScreen.kt | 11 ++-- .../ui/screen/loggedIn/HashtagScreen.kt | 4 +- .../ui/screen/loggedIn/ProfileScreen.kt | 6 +-- 12 files changed, 123 insertions(+), 55 deletions(-) diff --git a/app/src/main/java/com/vitorpamplona/amethyst/model/Account.kt b/app/src/main/java/com/vitorpamplona/amethyst/model/Account.kt index 921e6003a..fb2199437 100644 --- a/app/src/main/java/com/vitorpamplona/amethyst/model/Account.kt +++ b/app/src/main/java/com/vitorpamplona/amethyst/model/Account.kt @@ -264,7 +264,7 @@ class Account( return note.hasReacted(userProfile(), reaction) } - fun reactTo(note: Note, reaction: String, signEvent: Boolean = true): ReactionEvent? { + fun reactTo(note: Note, reaction: String, signEvent: Boolean): ReactionEvent? { if (!isWriteable() && signEvent) return null if (hasReacted(note, reaction)) { @@ -465,11 +465,11 @@ class Account( LocalCache.consume(event, null) } - fun delete(note: Note, signEvent: Boolean = true): DeletionEvent? { + fun delete(note: Note, signEvent: Boolean): DeletionEvent? { return delete(listOf(note), signEvent) } - fun delete(notes: List, signEvent: Boolean = true): DeletionEvent? { + fun delete(notes: List, signEvent: Boolean): DeletionEvent? { if (!isWriteable() && signEvent) return null val myNotes = notes.filter { it.author == userProfile() }.map { it.idHex } @@ -491,7 +491,7 @@ class Account( return HTTPAuthorizationEvent.create(url, method, body, keyPair.privKey!!) } - fun boost(note: Note, signEvent: Boolean = true): Event? { + fun boost(note: Note, signEvent: Boolean): Event? { if (!isWriteable() && signEvent) return null if (note.hasBoostedInTheLast5Minutes(userProfile())) { @@ -558,7 +558,7 @@ class Account( return returningContactList } - fun follow(user: User, signEvent: Boolean = true): ContactListEvent? { + fun follow(user: User, signEvent: Boolean): ContactListEvent? { if (!isWriteable() && signEvent) return null val contactList = migrateCommunitiesAndChannelsIfNeeded(userProfile().latestContactList) @@ -643,7 +643,7 @@ class Account( return null } - fun followHashtag(tag: String, signEvent: Boolean = true): ContactListEvent? { + fun followHashtag(tag: String, signEvent: Boolean): ContactListEvent? { if (!isWriteable() && signEvent) return null val contactList = migrateCommunitiesAndChannelsIfNeeded(userProfile().latestContactList) @@ -707,7 +707,7 @@ class Account( return null } - fun unfollow(user: User, signEvent: Boolean = true): ContactListEvent? { + fun unfollow(user: User, signEvent: Boolean): ContactListEvent? { if (!isWriteable() && signEvent) return null val contactList = migrateCommunitiesAndChannelsIfNeeded(userProfile().latestContactList) @@ -730,7 +730,7 @@ class Account( return null } - fun unfollowHashtag(tag: String, signEvent: Boolean = true): ContactListEvent? { + fun unfollowHashtag(tag: String, signEvent: Boolean): ContactListEvent? { if (!isWriteable() && signEvent) return null val contactList = migrateCommunitiesAndChannelsIfNeeded(userProfile().latestContactList) @@ -936,7 +936,7 @@ class Account( directMentions: Set, relayList: List? = null, geohash: String? = null, - signEvent: Boolean = true + signEvent: Boolean ): TextNoteEvent? { if (!isWriteable() && signEvent) return null @@ -1000,7 +1000,7 @@ class Account( zapRaiserAmount: Long? = null, relayList: List? = null, geohash: String? = null, - signEvent: Boolean = true + signEvent: Boolean ): PollNoteEvent? { if (!isWriteable() && signEvent) return null @@ -1056,7 +1056,7 @@ class Account( wantsToMarkAsSensitive: Boolean, zapRaiserAmount: Long? = null, geohash: String? = null, - signEvent: Boolean = true + signEvent: Boolean ): ChannelMessageEvent? { if (!isWriteable() && signEvent) return null @@ -1095,7 +1095,7 @@ class Account( wantsToMarkAsSensitive: Boolean, zapRaiserAmount: Long? = null, geohash: String? = null, - signEvent: Boolean = true + signEvent: Boolean ): LiveActivitiesChatMessageEvent? { if (!isWriteable() && signEvent) return null @@ -1126,7 +1126,7 @@ class Account( } fun sendPrivateMessage(message: String, toUser: User, replyingTo: Note? = null, mentions: List?, zapReceiver: String? = null, wantsToMarkAsSensitive: Boolean, zapRaiserAmount: Long? = null, geohash: String? = null): PrivateDmEvent? { - return sendPrivateMessage(message, toUser.pubkeyHex, replyingTo, mentions, zapReceiver, wantsToMarkAsSensitive, zapRaiserAmount, geohash) + return sendPrivateMessage(message, toUser.pubkeyHex, replyingTo, mentions, zapReceiver, wantsToMarkAsSensitive, zapRaiserAmount, geohash, true) } fun sendPrivateMessage( @@ -1138,7 +1138,7 @@ class Account( wantsToMarkAsSensitive: Boolean, zapRaiserAmount: Long? = null, geohash: String? = null, - signEvent: Boolean = true + signEvent: Boolean ): PrivateDmEvent? { if (!isWriteable() && signEvent) return null @@ -1179,7 +1179,7 @@ class Account( wantsToMarkAsSensitive: Boolean, zapRaiserAmount: Long? = null, geohash: String? = null, - signEvent: Boolean = true + signEvent: Boolean ): List? { if (!isWriteable() && signEvent) return null diff --git a/app/src/main/java/com/vitorpamplona/amethyst/service/AmberUtils.kt b/app/src/main/java/com/vitorpamplona/amethyst/service/AmberUtils.kt index 26a049695..0f2e45920 100644 --- a/app/src/main/java/com/vitorpamplona/amethyst/service/AmberUtils.kt +++ b/app/src/main/java/com/vitorpamplona/amethyst/service/AmberUtils.kt @@ -43,7 +43,7 @@ object AmberUtils { "" ) while (isActivityRunning) { - Thread.sleep(250) + // do nothing } } @@ -57,7 +57,7 @@ object AmberUtils { pubKey ) while (isActivityRunning) { - Thread.sleep(250) + // do nothing } } } @@ -72,7 +72,7 @@ object AmberUtils { pubKey ) while (isActivityRunning) { - Thread.sleep(250) + // do nothing } } } diff --git a/app/src/main/java/com/vitorpamplona/amethyst/ui/actions/NewPostViewModel.kt b/app/src/main/java/com/vitorpamplona/amethyst/ui/actions/NewPostViewModel.kt index d774fafe4..b6c5b7a26 100644 --- a/app/src/main/java/com/vitorpamplona/amethyst/ui/actions/NewPostViewModel.kt +++ b/app/src/main/java/com/vitorpamplona/amethyst/ui/actions/NewPostViewModel.kt @@ -158,7 +158,7 @@ open class NewPostViewModel() : ViewModel() { this.account = account } - fun sendPost(relayList: List? = null, signEvent: Boolean = true): Event? { + fun sendPost(relayList: List? = null, signEvent: Boolean): Event? { try { val tagger = NewMessageTagger(message.text, mentions, replyTos, originalNote?.channelHex()) tagger.run() @@ -207,7 +207,8 @@ open class NewPostViewModel() : ViewModel() { wantsToMarkAsSensitive = wantsToMarkAsSensitive, zapReceiver = zapReceiver, zapRaiserAmount = localZapRaiserAmount, - geohash = geoHash + geohash = geoHash, + signEvent = signEvent ) return null } else if (!dmUsers.isNullOrEmpty()) { @@ -221,7 +222,8 @@ open class NewPostViewModel() : ViewModel() { wantsToMarkAsSensitive = wantsToMarkAsSensitive, zapReceiver = zapReceiver, zapRaiserAmount = localZapRaiserAmount, - geohash = geoHash + geohash = geoHash, + signEvent = signEvent ) return null } else { @@ -233,7 +235,8 @@ open class NewPostViewModel() : ViewModel() { wantsToMarkAsSensitive = wantsToMarkAsSensitive, zapReceiver = zapReceiver, zapRaiserAmount = localZapRaiserAmount, - geohash = geoHash + geohash = geoHash, + signEvent = signEvent ) return null } diff --git a/app/src/main/java/com/vitorpamplona/amethyst/ui/note/AddBountyAmountDialog.kt b/app/src/main/java/com/vitorpamplona/amethyst/ui/note/AddBountyAmountDialog.kt index 2f57f3479..e12228955 100644 --- a/app/src/main/java/com/vitorpamplona/amethyst/ui/note/AddBountyAmountDialog.kt +++ b/app/src/main/java/com/vitorpamplona/amethyst/ui/note/AddBountyAmountDialog.kt @@ -17,6 +17,8 @@ import androidx.compose.material.Text import androidx.compose.runtime.Composable import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableStateOf +import androidx.compose.runtime.remember +import androidx.compose.runtime.rememberCoroutineScope import androidx.compose.runtime.setValue import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier @@ -31,11 +33,18 @@ import androidx.lifecycle.ViewModel import androidx.lifecycle.viewmodel.compose.viewModel import com.vitorpamplona.amethyst.R import com.vitorpamplona.amethyst.model.Account +import com.vitorpamplona.amethyst.model.LocalCache import com.vitorpamplona.amethyst.model.Note +import com.vitorpamplona.amethyst.service.relays.Client import com.vitorpamplona.amethyst.ui.actions.CloseButton import com.vitorpamplona.amethyst.ui.actions.PostButton +import com.vitorpamplona.amethyst.ui.actions.SignerDialog import com.vitorpamplona.amethyst.ui.screen.loggedIn.AccountViewModel import com.vitorpamplona.amethyst.ui.theme.placeholderText +import com.vitorpamplona.quartz.events.Event +import com.vitorpamplona.quartz.events.TextNoteEvent +import kotlinx.coroutines.Dispatchers +import kotlinx.coroutines.launch class AddBountyAmountViewModel : ViewModel() { private var account: Account? = null @@ -48,11 +57,11 @@ class AddBountyAmountViewModel : ViewModel() { this.bounty = bounty } - fun sendPost() { + fun sendPost(signEvent: Boolean): TextNoteEvent? { val newValue = nextAmount.text.trim().toLongOrNull() if (newValue != null) { - account?.sendPost( + val event = account?.sendPost( message = newValue.toString(), replyTo = listOfNotNull(bounty), mentions = listOfNotNull(bounty?.author), @@ -60,11 +69,14 @@ class AddBountyAmountViewModel : ViewModel() { wantsToMarkAsSensitive = false, replyingTo = null, root = null, - directMentions = setOf() + directMentions = setOf(), + signEvent = signEvent ) nextAmount = TextFieldValue("") + return event } + return null } fun cancel() { @@ -80,6 +92,26 @@ class AddBountyAmountViewModel : ViewModel() { fun AddBountyAmountDialog(bounty: Note, accountViewModel: AccountViewModel, onClose: () -> Unit) { val postViewModel: AddBountyAmountViewModel = viewModel() postViewModel.load(accountViewModel.account, bounty) + val scope = rememberCoroutineScope() + + var event by remember { mutableStateOf(null) } + if (event != null) { + SignerDialog( + onClose = { + event = null + }, + onPost = { + scope.launch(Dispatchers.IO) { + val signedEvent = Event.fromJson(it) + Client.send(signedEvent) + LocalCache.verifyAndConsume(signedEvent, null) + event = null + onClose() + } + }, + data = event!!.toJson() + ) + } Dialog( onDismissRequest = { onClose() }, @@ -89,7 +121,11 @@ fun AddBountyAmountDialog(bounty: Note, accountViewModel: AccountViewModel, onCl ) ) { Surface() { - Column(modifier = Modifier.padding(10.dp).width(IntrinsicSize.Min)) { + Column( + modifier = Modifier + .padding(10.dp) + .width(IntrinsicSize.Min) + ) { Row( horizontalArrangement = Arrangement.SpaceBetween, verticalAlignment = Alignment.CenterVertically, @@ -102,8 +138,10 @@ fun AddBountyAmountDialog(bounty: Note, accountViewModel: AccountViewModel, onCl PostButton( onPost = { - postViewModel.sendPost() - onClose() + event = postViewModel.sendPost(!accountViewModel.loggedInWithAmber()) + if (!accountViewModel.loggedInWithAmber()) { + onClose() + } }, isActive = postViewModel.hasChanged() ) diff --git a/app/src/main/java/com/vitorpamplona/amethyst/ui/note/NoteQuickActionMenu.kt b/app/src/main/java/com/vitorpamplona/amethyst/ui/note/NoteQuickActionMenu.kt index e86582f45..1b97c6e3d 100644 --- a/app/src/main/java/com/vitorpamplona/amethyst/ui/note/NoteQuickActionMenu.kt +++ b/app/src/main/java/com/vitorpamplona/amethyst/ui/note/NoteQuickActionMenu.kt @@ -315,8 +315,10 @@ private fun RenderMainPopup( stringResource(R.string.quick_action_unfollow) ) { scope.launch(Dispatchers.IO) { - accountViewModel.unfollow(note.author!!) - onDismiss() + event = accountViewModel.unfollow(note.author!!, !accountViewModel.loggedInWithAmber()) + if (!accountViewModel.loggedInWithAmber()) { + onDismiss() + } } } } else { diff --git a/app/src/main/java/com/vitorpamplona/amethyst/ui/note/ReactionsRow.kt b/app/src/main/java/com/vitorpamplona/amethyst/ui/note/ReactionsRow.kt index bd8f6f67c..8bd56cba3 100644 --- a/app/src/main/java/com/vitorpamplona/amethyst/ui/note/ReactionsRow.kt +++ b/app/src/main/java/com/vitorpamplona/amethyst/ui/note/ReactionsRow.kt @@ -674,7 +674,7 @@ fun BoostReaction( if (accountViewModel.isWriteable()) { if (accountViewModel.hasBoosted(baseNote)) { scope.launch(Dispatchers.IO) { - accountViewModel.deleteBoostsTo(baseNote) + accountViewModel.deleteBoostsTo(baseNote, true) } } else { wantsToBoost = true @@ -961,9 +961,9 @@ private fun likeClick( scope.launch(Dispatchers.IO) { val reaction = accountViewModel.account.reactionChoices.first() if (accountViewModel.hasReactedTo(baseNote, reaction)) { - accountViewModel.deleteReactionTo(baseNote, reaction) + accountViewModel.deleteReactionTo(baseNote, reaction, true) } else { - accountViewModel.reactTo(baseNote, reaction) + accountViewModel.reactTo(baseNote, reaction, true) } } } else if (accountViewModel.account.reactionChoices.size > 1) { @@ -1273,7 +1273,7 @@ private fun BoostTypeChoicePopup(baseNote: Note, iconSize: Dp, accountViewModel: onClick = { if (accountViewModel.isWriteable()) { scope.launch(Dispatchers.IO) { - accountViewModel.boost(baseNote) + accountViewModel.boost(baseNote, true) onDismiss() } } else { diff --git a/app/src/main/java/com/vitorpamplona/amethyst/ui/note/ZapNoteCompose.kt b/app/src/main/java/com/vitorpamplona/amethyst/ui/note/ZapNoteCompose.kt index 4ddde43c0..7971f7469 100644 --- a/app/src/main/java/com/vitorpamplona/amethyst/ui/note/ZapNoteCompose.kt +++ b/app/src/main/java/com/vitorpamplona/amethyst/ui/note/ZapNoteCompose.kt @@ -344,7 +344,7 @@ fun ShowFollowingOrUnfollowingButton( UnfollowButton { if (!accountViewModel.isWriteable()) { if (accountViewModel.loggedInWithAmber()) { - event = accountViewModel.account.unfollow(baseAuthor, false) + event = accountViewModel.unfollow(baseAuthor, false) } else { scope.launch { Toast @@ -358,7 +358,7 @@ fun ShowFollowingOrUnfollowingButton( } } else { scope.launch(Dispatchers.IO) { - accountViewModel.unfollow(baseAuthor) + accountViewModel.unfollow(baseAuthor, true) } } } diff --git a/app/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/AccountViewModel.kt b/app/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/AccountViewModel.kt index 6936e55d6..c589d75ad 100644 --- a/app/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/AccountViewModel.kt +++ b/app/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/AccountViewModel.kt @@ -112,11 +112,11 @@ class AccountViewModel(val account: Account) : ViewModel() { return account.userProfile() } - fun reactTo(note: Note, reaction: String, signEvent: Boolean = true): ReactionEvent? { + fun reactTo(note: Note, reaction: String, signEvent: Boolean): ReactionEvent? { return account.reactTo(note, reaction, signEvent) } - fun reactToOrDelete(note: Note, reaction: String, signEvent: Boolean = true): Event? { + fun reactToOrDelete(note: Note, reaction: String, signEvent: Boolean): Event? { val currentReactions = account.reactionTo(note, reaction) if (currentReactions.isNotEmpty()) { return account.delete(currentReactions, signEvent) @@ -134,7 +134,7 @@ class AccountViewModel(val account: Account) : ViewModel() { return account.hasReacted(baseNote, reaction) } - fun deleteReactionTo(note: Note, reaction: String, signEvent: Boolean = true): DeletionEvent? { + fun deleteReactionTo(note: Note, reaction: String, signEvent: Boolean): DeletionEvent? { return account.delete(account.reactionTo(note, reaction), signEvent) } @@ -142,7 +142,7 @@ class AccountViewModel(val account: Account) : ViewModel() { return account.hasBoosted(baseNote) } - fun deleteBoostsTo(note: Note, signEvent: Boolean = true): DeletionEvent? { + fun deleteBoostsTo(note: Note, signEvent: Boolean): DeletionEvent? { return account.delete(account.boostsTo(note), signEvent) } @@ -302,7 +302,7 @@ class AccountViewModel(val account: Account) : ViewModel() { } } - fun boost(note: Note, signEvent: Boolean = true): Event? { + fun boost(note: Note, signEvent: Boolean): Event? { return account.boost(note, signEvent) } @@ -386,8 +386,8 @@ class AccountViewModel(val account: Account) : ViewModel() { return account.follow(user, signEvent) } - fun unfollow(user: User) { - account.unfollow(user) + fun unfollow(user: User, signEvent: Boolean): ContactListEvent? { + return account.unfollow(user, signEvent) } fun isLoggedUser(user: User?): Boolean { diff --git a/app/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/ChannelScreen.kt b/app/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/ChannelScreen.kt index 6709b91d9..15afe9fa9 100644 --- a/app/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/ChannelScreen.kt +++ b/app/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/ChannelScreen.kt @@ -263,6 +263,24 @@ fun ChannelScreen( val scope = rememberCoroutineScope() + var event by remember { mutableStateOf(null) } + if (event != null) { + SignerDialog( + onClose = { + event = null + }, + onPost = { + scope.launch(Dispatchers.IO) { + val signedEvent = Event.fromJson(it) + Client.send(signedEvent) + LocalCache.verifyAndConsume(signedEvent, null) + event = null + } + }, + data = event!!.toJson() + ) + } + // LAST ROW EditFieldRow(newPostModel, isPrivate = false, accountViewModel = accountViewModel) { scope.launch(Dispatchers.IO) { @@ -274,20 +292,22 @@ fun ChannelScreen( ) tagger.run() if (channel is PublicChatChannel) { - accountViewModel.account.sendChannelMessage( + event = accountViewModel.account.sendChannelMessage( message = tagger.message, toChannel = channel.idHex, replyTo = tagger.replyTos, mentions = tagger.mentions, - wantsToMarkAsSensitive = false + wantsToMarkAsSensitive = false, + signEvent = !accountViewModel.loggedInWithAmber() ) } else if (channel is LiveActivitiesChannel) { - accountViewModel.account.sendLiveMessage( + event = accountViewModel.account.sendLiveMessage( message = tagger.message, toChannel = channel.address, replyTo = tagger.replyTos, mentions = tagger.mentions, - wantsToMarkAsSensitive = false + wantsToMarkAsSensitive = false, + signEvent = !accountViewModel.loggedInWithAmber() ) } newPostModel.message = TextFieldValue("") diff --git a/app/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/ChatroomScreen.kt b/app/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/ChatroomScreen.kt index 5719805dd..6a7f9e0b8 100644 --- a/app/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/ChatroomScreen.kt +++ b/app/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/ChatroomScreen.kt @@ -344,12 +344,14 @@ fun ChatroomScreen( PrivateMessageEditFieldRow(newPostModel, isPrivate = true, accountViewModel) { scope.launch(Dispatchers.IO) { if (newPostModel.nip24 || room.users.size > 1 || replyTo.value?.event is ChatMessageEvent) { + // TODO: add support for amber accountViewModel.account.sendNIP24PrivateMessage( message = newPostModel.message.text, toUsers = room.users.toList(), replyingTo = replyTo.value, mentions = null, - wantsToMarkAsSensitive = false + wantsToMarkAsSensitive = false, + signEvent = true ) } else { if (!accountViewModel.isWriteable() && accountViewModel.loggedInWithAmber()) { @@ -360,7 +362,8 @@ fun ChatroomScreen( toUser = room.users.first(), replyingTo = replyTo.value, mentions = null, - wantsToMarkAsSensitive = false + wantsToMarkAsSensitive = false, + signEvent = true ) } } @@ -690,13 +693,15 @@ fun NewSubjectView(onClose: () -> Unit, accountViewModel: AccountViewModel, room PostButton( onPost = { scope.launch(Dispatchers.IO) { + // TODO: add support for amber accountViewModel.account.sendNIP24PrivateMessage( message = message.value, toUsers = room.users.toList(), subject = groupName.value.ifBlank { null }, replyingTo = null, mentions = null, - wantsToMarkAsSensitive = false + wantsToMarkAsSensitive = false, + signEvent = true ) } diff --git a/app/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/HashtagScreen.kt b/app/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/HashtagScreen.kt index c8d0fe746..9c3073d35 100644 --- a/app/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/HashtagScreen.kt +++ b/app/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/HashtagScreen.kt @@ -186,7 +186,7 @@ fun HashtagActionOptions( } } else { scope.launch(Dispatchers.IO) { - accountViewModel.account.unfollowHashtag(tag) + accountViewModel.account.unfollowHashtag(tag, true) } } } @@ -208,7 +208,7 @@ fun HashtagActionOptions( } } else { scope.launch(Dispatchers.IO) { - accountViewModel.account.followHashtag(tag) + accountViewModel.account.followHashtag(tag, true) } } } diff --git a/app/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/ProfileScreen.kt b/app/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/ProfileScreen.kt index 6d7b7c512..d7d791b5e 100644 --- a/app/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/ProfileScreen.kt +++ b/app/src/main/java/com/vitorpamplona/amethyst/ui/screen/loggedIn/ProfileScreen.kt @@ -895,7 +895,7 @@ private fun DisplayFollowUnfollowButton( } } else { scope.launch(Dispatchers.IO) { - accountViewModel.account.unfollow(baseUser) + accountViewModel.account.unfollow(baseUser, true) } } } @@ -918,7 +918,7 @@ private fun DisplayFollowUnfollowButton( } } else { scope.launch(Dispatchers.IO) { - accountViewModel.account.follow(baseUser) + accountViewModel.account.follow(baseUser, true) } } } @@ -940,7 +940,7 @@ private fun DisplayFollowUnfollowButton( } } else { scope.launch(Dispatchers.IO) { - accountViewModel.account.follow(baseUser) + accountViewModel.account.follow(baseUser, true) } } }