Add group story removal dialog.
This commit is contained in:
parent
cc5aab6be3
commit
35f1baf965
6 changed files with 38 additions and 3 deletions
|
@ -16,6 +16,15 @@ class StoryDialogLauncherFragment : DSLSettingsFragment(titleId = R.string.prefe
|
||||||
|
|
||||||
private fun getConfiguration(): DSLConfiguration {
|
private fun getConfiguration(): DSLConfiguration {
|
||||||
return configure {
|
return configure {
|
||||||
|
clickPref(
|
||||||
|
title = DSLSettingsText.from(R.string.preferences__internal_remove_group_story),
|
||||||
|
onClick = {
|
||||||
|
StoryDialogs.removeGroupStory(requireContext(), "Family") {
|
||||||
|
Toast.makeText(requireContext(), R.string.preferences__internal_remove_group_story, Toast.LENGTH_SHORT).show()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
clickPref(
|
clickPref(
|
||||||
title = DSLSettingsText.from(R.string.preferences__internal_retry_send),
|
title = DSLSettingsText.from(R.string.preferences__internal_retry_send),
|
||||||
onClick = {
|
onClick = {
|
||||||
|
|
|
@ -66,7 +66,7 @@ object StoryContextMenu {
|
||||||
val intent = if (messageRecord.storyType.isTextStory) {
|
val intent = if (messageRecord.storyType.isTextStory) {
|
||||||
val textStoryBody = StoryTextPost.parseFrom(Base64.decode(messageRecord.body)).body
|
val textStoryBody = StoryTextPost.parseFrom(Base64.decode(messageRecord.body)).body
|
||||||
val linkUrl = messageRecord.linkPreviews.firstOrNull()?.url ?: ""
|
val linkUrl = messageRecord.linkPreviews.firstOrNull()?.url ?: ""
|
||||||
val shareText = "${textStoryBody} $linkUrl".trim()
|
val shareText = "$textStoryBody $linkUrl".trim()
|
||||||
|
|
||||||
ShareCompat.IntentBuilder(fragment.requireContext())
|
ShareCompat.IntentBuilder(fragment.requireContext())
|
||||||
.setText(shareText)
|
.setText(shareText)
|
||||||
|
|
|
@ -10,6 +10,19 @@ import org.thoughtcrime.securesms.R
|
||||||
|
|
||||||
object StoryDialogs {
|
object StoryDialogs {
|
||||||
|
|
||||||
|
fun removeGroupStory(
|
||||||
|
context: Context,
|
||||||
|
groupName: String,
|
||||||
|
onConfirmed: () -> Unit
|
||||||
|
) {
|
||||||
|
MaterialAlertDialogBuilder(context)
|
||||||
|
.setTitle(R.string.StoryDialogs__remove_group_story)
|
||||||
|
.setMessage(context.getString(R.string.StoryDialogs__s_will_be_removed, groupName))
|
||||||
|
.setPositiveButton(R.string.StoryDialogs__remove) { _, _ -> onConfirmed() }
|
||||||
|
.setNegativeButton(android.R.string.cancel) { _, _ -> }
|
||||||
|
.show()
|
||||||
|
}
|
||||||
|
|
||||||
fun deleteDistributionList(
|
fun deleteDistributionList(
|
||||||
context: Context,
|
context: Context,
|
||||||
distributionListName: String,
|
distributionListName: String,
|
||||||
|
|
|
@ -15,6 +15,7 @@ import org.thoughtcrime.securesms.components.settings.DSLSettingsFragment
|
||||||
import org.thoughtcrime.securesms.components.settings.DSLSettingsText
|
import org.thoughtcrime.securesms.components.settings.DSLSettingsText
|
||||||
import org.thoughtcrime.securesms.components.settings.configure
|
import org.thoughtcrime.securesms.components.settings.configure
|
||||||
import org.thoughtcrime.securesms.conversation.ConversationIntents
|
import org.thoughtcrime.securesms.conversation.ConversationIntents
|
||||||
|
import org.thoughtcrime.securesms.stories.dialogs.StoryDialogs
|
||||||
import org.thoughtcrime.securesms.stories.settings.custom.PrivateStoryItem
|
import org.thoughtcrime.securesms.stories.settings.custom.PrivateStoryItem
|
||||||
import org.thoughtcrime.securesms.util.LifecycleDisposable
|
import org.thoughtcrime.securesms.util.LifecycleDisposable
|
||||||
import org.thoughtcrime.securesms.util.adapter.mapping.MappingAdapter
|
import org.thoughtcrime.securesms.util.adapter.mapping.MappingAdapter
|
||||||
|
@ -94,7 +95,12 @@ class GroupStorySettingsFragment : DSLSettingsFragment(menuId = R.menu.story_gro
|
||||||
DSLSettingsText.ColorModifier(ContextCompat.getColor(requireContext(), R.color.signal_colorError))
|
DSLSettingsText.ColorModifier(ContextCompat.getColor(requireContext(), R.color.signal_colorError))
|
||||||
),
|
),
|
||||||
onClick = {
|
onClick = {
|
||||||
viewModel.doNotDisplayAsStory()
|
StoryDialogs.removeGroupStory(
|
||||||
|
requireContext(),
|
||||||
|
state.name
|
||||||
|
) {
|
||||||
|
viewModel.doNotDisplayAsStory()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -2761,6 +2761,7 @@
|
||||||
<string name="preferences__internal_story_or_profile_selector" translatable="false">Story or profile selector</string>
|
<string name="preferences__internal_story_or_profile_selector" translatable="false">Story or profile selector</string>
|
||||||
<string name="preferences__internal_stories_dialog_launcher" translatable="false">Stories dialog launcher</string>
|
<string name="preferences__internal_stories_dialog_launcher" translatable="false">Stories dialog launcher</string>
|
||||||
<string name="preferences__internal_retry_send" translatable="false">Retry send</string>
|
<string name="preferences__internal_retry_send" translatable="false">Retry send</string>
|
||||||
|
<string name="preferences__internal_remove_group_story" translatable="false">Remove group story</string>
|
||||||
<string name="preferences__internal_clear_onboarding_state" translatable="false">Clear onboarding state</string>
|
<string name="preferences__internal_clear_onboarding_state" translatable="false">Clear onboarding state</string>
|
||||||
<string name="preferences__internal_clears_onboarding_flag_and_triggers_download_of_onboarding_stories" translatable="false">Clears onboarding flag and triggers download of onboarding stories.</string>
|
<string name="preferences__internal_clears_onboarding_flag_and_triggers_download_of_onboarding_stories" translatable="false">Clears onboarding flag and triggers download of onboarding stories.</string>
|
||||||
<string name="preferences__internal_preferences" translatable="false">Internal Preferences</string>
|
<string name="preferences__internal_preferences" translatable="false">Internal Preferences</string>
|
||||||
|
@ -4940,6 +4941,12 @@
|
||||||
<string name="ChangeMyStoryMembershipFragment__only_share_with">Only share with…</string>
|
<string name="ChangeMyStoryMembershipFragment__only_share_with">Only share with…</string>
|
||||||
<!-- Done button label for hide story from screen -->
|
<!-- Done button label for hide story from screen -->
|
||||||
<string name="HideStoryFromFragment__done">Done</string>
|
<string name="HideStoryFromFragment__done">Done</string>
|
||||||
|
<!-- Dialog title for removing a group story -->
|
||||||
|
<string name="StoryDialogs__remove_group_story">Remove group story?</string>
|
||||||
|
<!-- Dialog message for removing a group story -->
|
||||||
|
<string name="StoryDialogs__s_will_be_removed">\"%1$s\" will be removed.</string>
|
||||||
|
<!-- Dialog positive action for removing a group story -->
|
||||||
|
<string name="StoryDialogs__remove">Remove</string>
|
||||||
<!-- Dialog title for deleting a private story -->
|
<!-- Dialog title for deleting a private story -->
|
||||||
<string name="StoryDialogs__delete_private_story">Delete private story?</string>
|
<string name="StoryDialogs__delete_private_story">Delete private story?</string>
|
||||||
<!-- Dialog message for deleting a private story -->
|
<!-- Dialog message for deleting a private story -->
|
||||||
|
|
|
@ -127,4 +127,4 @@ class StoryContextMenuTest {
|
||||||
val targetIntent: Intent = chooserIntent.getParcelableExtra(Intent.EXTRA_INTENT)!!
|
val targetIntent: Intent = chooserIntent.getParcelableExtra(Intent.EXTRA_INTENT)!!
|
||||||
assertEquals(expected, targetIntent.getStringExtra(Intent.EXTRA_TEXT))
|
assertEquals(expected, targetIntent.getStringExtra(Intent.EXTRA_TEXT))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue