mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-02-26 20:55:10 +00:00
Add the ability to edit a link preview in stories before sending.
Resolves #14035
This commit is contained in:
@@ -120,6 +120,10 @@ class TextStoryPostCreationFragment : Fragment(R.layout.stories_text_post_creati
|
||||
viewModel.setLinkPreview("")
|
||||
}
|
||||
|
||||
binding.storyTextPost.setLinkPreviewClickListener {
|
||||
TextStoryPostLinkEntryFragment(true).show(childFragmentManager, null)
|
||||
}
|
||||
|
||||
val launcher = registerForActivityResult(StoriesMultiselectForwardActivity.SelectionContract()) {
|
||||
if (it.isNotEmpty()) {
|
||||
performSend(it.toSet())
|
||||
|
||||
@@ -131,6 +131,10 @@ class TextStoryPostCreationViewModel(private val repository: TextStoryPostSendRe
|
||||
)
|
||||
}
|
||||
|
||||
fun getLinkInputPreset(): String? {
|
||||
return store.state.linkPreviewUri
|
||||
}
|
||||
|
||||
class Factory(private val repository: TextStoryPostSendRepository) : ViewModelProvider.Factory {
|
||||
override fun <T : ViewModel> create(modelClass: Class<T>): T {
|
||||
return modelClass.cast(TextStoryPostCreationViewModel(repository)) as T
|
||||
|
||||
@@ -21,7 +21,7 @@ import org.thoughtcrime.securesms.util.ViewUtil
|
||||
import org.thoughtcrime.securesms.util.setIncognitoKeyboardEnabled
|
||||
import org.thoughtcrime.securesms.util.visible
|
||||
|
||||
class TextStoryPostLinkEntryFragment : KeyboardEntryDialogFragment(
|
||||
class TextStoryPostLinkEntryFragment(private val shouldPreset: Boolean = false) : KeyboardEntryDialogFragment(
|
||||
contentLayoutId = R.layout.stories_text_post_link_entry_fragment
|
||||
) {
|
||||
|
||||
@@ -35,6 +35,12 @@ class TextStoryPostLinkEntryFragment : KeyboardEntryDialogFragment(
|
||||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
input = view.findViewById(R.id.input)
|
||||
if (shouldPreset) {
|
||||
viewModel.getLinkInputPreset()?.let {
|
||||
input.text.append(it)
|
||||
linkPreviewViewModel.onTextChanged(it, 0, it.length - 1)
|
||||
}
|
||||
}
|
||||
|
||||
val linkPreview: StoryLinkPreviewView = view.findViewById(R.id.link_preview)
|
||||
val confirmButton: View = view.findViewById(R.id.confirm_button)
|
||||
|
||||
Reference in New Issue
Block a user