kopia lustrzana https://github.com/ryukoposting/Signal-Android
Do not display stories as valid selections when sending view-once media.
rodzic
5c77c33dff
commit
9aa7543f2f
|
@ -10,7 +10,6 @@ import androidx.core.content.ContextCompat
|
||||||
import androidx.fragment.app.Fragment
|
import androidx.fragment.app.Fragment
|
||||||
import org.signal.core.util.logging.Log
|
import org.signal.core.util.logging.Log
|
||||||
import org.thoughtcrime.securesms.R
|
import org.thoughtcrime.securesms.R
|
||||||
import org.thoughtcrime.securesms.color.ViewColorSet
|
|
||||||
import org.thoughtcrime.securesms.components.FragmentWrapperActivity
|
import org.thoughtcrime.securesms.components.FragmentWrapperActivity
|
||||||
import org.thoughtcrime.securesms.contacts.paged.ContactSearchKey
|
import org.thoughtcrime.securesms.contacts.paged.ContactSearchKey
|
||||||
import org.thoughtcrime.securesms.conversation.mutiselect.forward.MultiselectForwardFragment.Companion.RESULT_SELECTION
|
import org.thoughtcrime.securesms.conversation.mutiselect.forward.MultiselectForwardFragment.Companion.RESULT_SELECTION
|
||||||
|
|
|
@ -459,7 +459,7 @@ class MultiselectForwardFragment :
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun isSelectedMediaValidForStories(): Boolean {
|
private fun isSelectedMediaValidForStories(): Boolean {
|
||||||
return args.multiShareArgs.all { it.isValidForStories }
|
return !args.isViewOnce && args.multiShareArgs.all { it.isValidForStories }
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun isSelectedMediaValidForNonStories(): Boolean {
|
private fun isSelectedMediaValidForNonStories(): Boolean {
|
||||||
|
|
|
@ -46,7 +46,8 @@ data class MultiselectForwardFragmentArgs @JvmOverloads constructor(
|
||||||
val selectSingleRecipient: Boolean = false,
|
val selectSingleRecipient: Boolean = false,
|
||||||
val sendButtonColors: ViewColorSet = ViewColorSet.PRIMARY,
|
val sendButtonColors: ViewColorSet = ViewColorSet.PRIMARY,
|
||||||
val storySendRequirements: Stories.MediaTransform.SendRequirements = Stories.MediaTransform.SendRequirements.CAN_NOT_SEND,
|
val storySendRequirements: Stories.MediaTransform.SendRequirements = Stories.MediaTransform.SendRequirements.CAN_NOT_SEND,
|
||||||
val isSearchEnabled: Boolean = true
|
val isSearchEnabled: Boolean = true,
|
||||||
|
val isViewOnce: Boolean = false
|
||||||
) : Parcelable {
|
) : Parcelable {
|
||||||
|
|
||||||
fun withSendButtonTint(@ColorInt sendButtonTint: Int) = copy(sendButtonColors = ViewColorSet.forCustomColor(sendButtonTint))
|
fun withSendButtonTint(@ColorInt sendButtonTint: Int) = copy(sendButtonColors = ViewColorSet.forCustomColor(sendButtonTint))
|
||||||
|
|
|
@ -160,12 +160,15 @@ class MediaReviewFragment : Fragment(R.layout.v2_media_review_fragment) {
|
||||||
}
|
}
|
||||||
|
|
||||||
sendButton.setOnClickListener {
|
sendButton.setOnClickListener {
|
||||||
|
val viewOnce: Boolean = sharedViewModel.state.value?.viewOnceToggleState == MediaSelectionState.ViewOnceToggleState.ONCE
|
||||||
|
|
||||||
if (sharedViewModel.isContactSelectionRequired) {
|
if (sharedViewModel.isContactSelectionRequired) {
|
||||||
val args = MultiselectForwardFragmentArgs(
|
val args = MultiselectForwardFragmentArgs(
|
||||||
false,
|
false,
|
||||||
title = R.string.MediaReviewFragment__send_to,
|
title = R.string.MediaReviewFragment__send_to,
|
||||||
storySendRequirements = sharedViewModel.getStorySendRequirements(),
|
storySendRequirements = sharedViewModel.getStorySendRequirements(),
|
||||||
isSearchEnabled = !sharedViewModel.isStory()
|
isSearchEnabled = !sharedViewModel.isStory(),
|
||||||
|
isViewOnce = viewOnce
|
||||||
)
|
)
|
||||||
|
|
||||||
if (sharedViewModel.isStory()) {
|
if (sharedViewModel.isStory()) {
|
||||||
|
|
|
@ -149,6 +149,10 @@ public final class MultiShareArgs implements Parcelable {
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isValidForStories() {
|
public boolean isValidForStories() {
|
||||||
|
if (isViewOnce()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
return isTextStory ||
|
return isTextStory ||
|
||||||
(!media.isEmpty() && media.stream().allMatch(m -> MediaUtil.isStorySupportedType(m.getMimeType()))) ||
|
(!media.isEmpty() && media.stream().allMatch(m -> MediaUtil.isStorySupportedType(m.getMimeType()))) ||
|
||||||
MediaUtil.isStorySupportedType(dataType) ||
|
MediaUtil.isStorySupportedType(dataType) ||
|
||||||
|
|
Ładowanie…
Reference in New Issue