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
|
@ -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"
|
||||
|
|
|
@ -265,6 +265,7 @@
|
|||
<string name="dialog_download_image">Download</string>
|
||||
<string name="dialog_message_cancel_follow_request">Revoke the follow request?</string>
|
||||
<string name="dialog_unfollow_warning">Unfollow this account?</string>
|
||||
<string name="dialog_follow_warning">Follow this account?</string>
|
||||
<string name="dialog_delete_post_warning">Delete this post?</string>
|
||||
<string name="dialog_redraft_post_warning">Delete and re-draft this post?</string>
|
||||
<string name="dialog_delete_conversation_warning">Delete this conversation?</string>
|
||||
|
@ -720,6 +721,7 @@
|
|||
<string name="pref_title_show_cards_in_timelines">Show link previews in timelines</string>
|
||||
<string name="pref_title_confirm_reblogs">Show confirmation before boosting</string>
|
||||
<string name="pref_title_confirm_favourites">Show confirmation before favoriting</string>
|
||||
<string name="pref_title_confirm_follows">Show confirmation before following</string>
|
||||
<string name="pref_title_hide_top_toolbar">Hide the title of the top toolbar</string>
|
||||
<string name="pref_title_wellbeing_mode">Wellbeing</string>
|
||||
<string name="account_note_hint">Your private note about this account</string>
|
||||
|
|
Loading…
Reference in New Issue