diff --git a/twidere/src/main/kotlin/org/mariotaku/twidere/fragment/ParcelableUsersFragment.kt b/twidere/src/main/kotlin/org/mariotaku/twidere/fragment/ParcelableUsersFragment.kt index 2d9359ccb..b3d92834c 100644 --- a/twidere/src/main/kotlin/org/mariotaku/twidere/fragment/ParcelableUsersFragment.kt +++ b/twidere/src/main/kotlin/org/mariotaku/twidere/fragment/ParcelableUsersFragment.kt @@ -218,7 +218,7 @@ abstract class ParcelableUsersFragment : AbsContentListRecyclerViewFragment { + canAddToList = true + canMute = true + canReportSpam = true + canEnableRetweet = true + canEnableNotifications = true + } + AccountType.MASTODON -> { + canMute = true + } } - menu.setItemAvailability(R.id.add_to_list, isTwitter) - menu.setItemAvailability(R.id.mute_user, !isMyself && isTwitter) - menu.setItemAvailability(R.id.muted_users, isMyself && isTwitter) - menu.setItemAvailability(R.id.report_spam, !isMyself && isTwitter) - menu.setItemAvailability(R.id.enable_retweets, !isMyself && isTwitter) + menu.setItemAvailability(R.id.add_to_list, canAddToList) + menu.setItemAvailability(R.id.mute_user, !isMyself && canMute) + menu.setItemAvailability(R.id.muted_users, isMyself && canMute) + menu.setItemAvailability(R.id.report_spam, !isMyself && canReportSpam) + menu.setItemAvailability(R.id.enable_retweets, !isMyself && canEnableRetweet) if (relationship != null) { menu.findItem(R.id.add_to_filter)?.apply { @@ -822,7 +831,8 @@ class UserFragment : BaseFragment(), OnClickListener, OnLinkClickListener, } else { menu.setItemAvailability(R.id.send_direct_message, relationship.can_dm) menu.setItemAvailability(R.id.block, true) - menu.setItemAvailability(R.id.enable_notifications, isTwitter && relationship.following) + menu.setItemAvailability(R.id.enable_notifications, canEnableNotifications && + relationship.following) menu.findItem(R.id.block)?.apply { ActionIconDrawable.setMenuHighlight(this, TwidereMenuInfo(relationship.blocking)) @@ -948,7 +958,7 @@ class UserFragment : BaseFragment(), OnClickListener, OnLinkClickListener, if (userRelationship.following) { DestroyFriendshipDialogFragment.show(fragmentManager, user) } else { - twitter.createFriendshipAsync(user.account_key, user.key) + twitter.createFriendshipAsync(user.account_key, user.key, user.screen_name) } } return true @@ -1174,7 +1184,7 @@ class UserFragment : BaseFragment(), OnClickListener, OnLinkClickListener, } else if (userRelationship.following) { DestroyFriendshipDialogFragment.show(fragmentManager, user) } else { - twitter.createFriendshipAsync(user.account_key, user.key) + twitter.createFriendshipAsync(user.account_key, user.key, user.screen_name) } } } diff --git a/twidere/src/main/kotlin/org/mariotaku/twidere/util/AsyncTwitterWrapper.kt b/twidere/src/main/kotlin/org/mariotaku/twidere/util/AsyncTwitterWrapper.kt index 7c2cc9f86..5428c2f30 100644 --- a/twidere/src/main/kotlin/org/mariotaku/twidere/util/AsyncTwitterWrapper.kt +++ b/twidere/src/main/kotlin/org/mariotaku/twidere/util/AsyncTwitterWrapper.kt @@ -143,9 +143,9 @@ class AsyncTwitterWrapper( TaskStarter.execute(task) } - fun createFriendshipAsync(accountKey: UserKey, userKey: UserKey) { + fun createFriendshipAsync(accountKey: UserKey, userKey: UserKey, screenName: String) { val task = CreateFriendshipTask(context) - task.setup(accountKey, userKey) + task.setup(accountKey, userKey, screenName) TaskStarter.execute(task) }