Add a feature and preference to confirm follows. (#4445)
This means a popup will appear if you have that option enabled in the preferences which will have a popup similar to the unfollow dialog asking you if you want to follow the user.
This commit is contained in:
parent
45d36a6a87
commit
a690b537c2
4 changed files with 25 additions and 1 deletions
|
|
@ -675,6 +675,8 @@ class AccountActivity : BottomSheetActivity(), ActionButtonActivity, MenuProvide
|
|||
binding.accountFloatingActionButton.setOnClickListener { mention() }
|
||||
|
||||
binding.accountFollowButton.setOnClickListener {
|
||||
val preferences = PreferenceManager.getDefaultSharedPreferences(this)
|
||||
val confirmFollows = preferences.getBoolean(PrefKeys.CONFIRM_FOLLOWS, false)
|
||||
if (viewModel.isSelf) {
|
||||
val intent = Intent(this@AccountActivity, EditProfileActivity::class.java)
|
||||
startActivity(intent)
|
||||
|
|
@ -688,7 +690,11 @@ class AccountActivity : BottomSheetActivity(), ActionButtonActivity, MenuProvide
|
|||
|
||||
when (followState) {
|
||||
FollowState.NOT_FOLLOWING -> {
|
||||
viewModel.changeFollowState()
|
||||
if (confirmFollows) {
|
||||
showFollowWarningDialog()
|
||||
} else {
|
||||
viewModel.changeFollowState()
|
||||
}
|
||||
}
|
||||
FollowState.REQUESTED -> {
|
||||
showFollowRequestPendingDialog()
|
||||
|
|
@ -908,6 +914,14 @@ class AccountActivity : BottomSheetActivity(), ActionButtonActivity, MenuProvide
|
|||
.show()
|
||||
}
|
||||
|
||||
private fun showFollowWarningDialog() {
|
||||
AlertDialog.Builder(this)
|
||||
.setMessage(R.string.dialog_follow_warning)
|
||||
.setPositiveButton(android.R.string.ok) { _, _ -> viewModel.changeFollowState() }
|
||||
.setNegativeButton(android.R.string.cancel, null)
|
||||
.show()
|
||||
}
|
||||
|
||||
private fun toggleBlockDomain(instance: String) {
|
||||
if (blockingDomain) {
|
||||
viewModel.unblockDomain(instance)
|
||||
|
|
|
|||
|
|
@ -241,6 +241,13 @@ class PreferencesFragment : PreferenceFragmentCompat() {
|
|||
isSingleLineTitle = false
|
||||
}
|
||||
|
||||
switchPreference {
|
||||
setDefaultValue(false)
|
||||
key = PrefKeys.CONFIRM_FOLLOWS
|
||||
setTitle(R.string.pref_title_confirm_follows)
|
||||
isSingleLineTitle = false
|
||||
}
|
||||
|
||||
switchPreference {
|
||||
setDefaultValue(true)
|
||||
key = PrefKeys.ENABLE_SWIPE_FOR_TABS
|
||||
|
|
|
|||
|
|
@ -71,6 +71,7 @@ object PrefKeys {
|
|||
const val SHOW_CARDS_IN_TIMELINES = "showCardsInTimelines"
|
||||
const val CONFIRM_REBLOGS = "confirmReblogs"
|
||||
const val CONFIRM_FAVOURITES = "confirmFavourites"
|
||||
const val CONFIRM_FOLLOWS = "confirmFollows"
|
||||
const val ENABLE_SWIPE_FOR_TABS = "enableSwipeForTabs"
|
||||
const val ANIMATE_CUSTOM_EMOJIS = "animateCustomEmojis"
|
||||
const val SHOW_STATS_INLINE = "showStatsInline"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue