mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-22 18:00:02 +01:00
Remove more SMS vestiges.
This commit is contained in:
@@ -79,7 +79,7 @@ public class AvatarSelectionActivity extends AppCompatActivity implements Camera
|
||||
|
||||
@Override
|
||||
public void onCameraError() {
|
||||
Toast.makeText(this, R.string.error, Toast.LENGTH_SHORT).show();
|
||||
Toast.makeText(this, R.string.default_error_msg, Toast.LENGTH_SHORT).show();
|
||||
finish();
|
||||
}
|
||||
|
||||
|
||||
@@ -80,7 +80,6 @@ class MediaSelectionRepository(context: Context) {
|
||||
stateMap: Map<Uri, Any>,
|
||||
quality: SentMediaQuality,
|
||||
message: CharSequence?,
|
||||
isSms: Boolean,
|
||||
isViewOnce: Boolean,
|
||||
singleContact: ContactSearchKey.RecipientSearchKey?,
|
||||
contacts: List<ContactSearchKey.RecipientSearchKey>,
|
||||
@@ -89,10 +88,6 @@ class MediaSelectionRepository(context: Context) {
|
||||
sendType: MessageSendType,
|
||||
scheduledTime: Long = -1
|
||||
): Maybe<MediaSendActivityResult> {
|
||||
if (isSms && contacts.isNotEmpty()) {
|
||||
throw IllegalStateException("Provided recipients to send to, but this is SMS!")
|
||||
}
|
||||
|
||||
if (selectedMedia.isEmpty()) {
|
||||
throw IllegalStateException("No selected media!")
|
||||
}
|
||||
@@ -121,8 +116,8 @@ class MediaSelectionRepository(context: Context) {
|
||||
StoryType.NONE
|
||||
}
|
||||
|
||||
if (isSms || MessageSender.isLocalSelfSend(context, singleRecipient, SendType.SIGNAL)) {
|
||||
Log.i(TAG, "SMS or local self-send. Skipping pre-upload.")
|
||||
if (MessageSender.isLocalSelfSend(context, singleRecipient, SendType.SIGNAL)) {
|
||||
Log.i(TAG, "Local self-send. Skipping pre-upload.")
|
||||
emitter.onSuccess(
|
||||
MediaSendActivityResult(
|
||||
recipientId = singleRecipient!!.id,
|
||||
@@ -207,7 +202,7 @@ class MediaSelectionRepository(context: Context) {
|
||||
)
|
||||
)
|
||||
} else {
|
||||
Log.w(TAG, "Got empty upload results! isSms: $isSms, updatedMedia.size(): ${updatedMedia.size}, isViewOnce: $isViewOnce, target: $singleContact")
|
||||
Log.w(TAG, "Got empty upload results! updatedMedia.size(): ${updatedMedia.size}, isViewOnce: $isViewOnce, target: $singleContact")
|
||||
emitter.onSuccess(
|
||||
MediaSendActivityResult(
|
||||
recipientId = singleRecipient!!.id,
|
||||
@@ -249,8 +244,8 @@ class MediaSelectionRepository(context: Context) {
|
||||
uploadRepository.deleteAbandonedAttachments()
|
||||
}
|
||||
|
||||
fun isLocalSelfSend(recipient: Recipient?, isSms: Boolean): Boolean {
|
||||
return MessageSender.isLocalSelfSend(context, recipient, if (isSms) MessageSender.SendType.SMS else MessageSender.SendType.SIGNAL)
|
||||
fun isLocalSelfSend(recipient: Recipient?): Boolean {
|
||||
return MessageSender.isLocalSelfSend(context, recipient, SendType.SIGNAL)
|
||||
}
|
||||
|
||||
@WorkerThread
|
||||
|
||||
@@ -4,7 +4,6 @@ import android.net.Uri
|
||||
import org.thoughtcrime.securesms.conversation.MessageSendType
|
||||
import org.thoughtcrime.securesms.keyvalue.SignalStore
|
||||
import org.thoughtcrime.securesms.mediasend.Media
|
||||
import org.thoughtcrime.securesms.mediasend.MediaSendConstants
|
||||
import org.thoughtcrime.securesms.mediasend.v2.videos.VideoTrimData
|
||||
import org.thoughtcrime.securesms.mms.MediaConstraints
|
||||
import org.thoughtcrime.securesms.mms.SentMediaQuality
|
||||
@@ -37,11 +36,7 @@ data class MediaSelectionState(
|
||||
|
||||
val transcodingPreset: TranscodingPreset = MediaConstraints.getPushMediaConstraints(SentMediaQuality.fromCode(quality.code)).videoTranscodingSettings
|
||||
|
||||
val maxSelection = if (sendType.usesSmsTransport) {
|
||||
MediaSendConstants.MAX_SMS
|
||||
} else {
|
||||
FeatureFlags.maxAttachmentCount()
|
||||
}
|
||||
val maxSelection = FeatureFlags.maxAttachmentCount()
|
||||
|
||||
val canSend = !isSent && selectedMedia.isNotEmpty()
|
||||
|
||||
|
||||
@@ -108,7 +108,7 @@ class MediaSelectionViewModel(
|
||||
store.update {
|
||||
it.copy(
|
||||
isMeteredConnection = metered,
|
||||
isPreUploadEnabled = shouldPreUpload(metered, it.sendType.usesSmsTransport, it.recipient)
|
||||
isPreUploadEnabled = shouldPreUpload(metered, it.recipient)
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -121,7 +121,7 @@ class MediaSelectionViewModel(
|
||||
store.update(Recipient.live(recipientSearchKey.recipientId).liveData) { r, s ->
|
||||
s.copy(
|
||||
recipient = r,
|
||||
isPreUploadEnabled = shouldPreUpload(s.isMeteredConnection, s.sendType.usesSmsTransport, r)
|
||||
isPreUploadEnabled = shouldPreUpload(s.isMeteredConnection, r)
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -320,11 +320,7 @@ class MediaSelectionViewModel(
|
||||
}
|
||||
|
||||
fun getMediaConstraints(): MediaConstraints {
|
||||
return if (store.state.sendType.usesSmsTransport) {
|
||||
MediaConstraints.getMmsMediaConstraints(store.state.sendType.simSubscriptionId ?: -1)
|
||||
} else {
|
||||
MediaConstraints.getPushMediaConstraints()
|
||||
}
|
||||
return MediaConstraints.getPushMediaConstraints()
|
||||
}
|
||||
|
||||
fun setSentMediaQuality(sentMediaQuality: SentMediaQuality) {
|
||||
@@ -396,7 +392,6 @@ class MediaSelectionViewModel(
|
||||
stateMap = store.state.editorStateMap,
|
||||
quality = store.state.quality,
|
||||
message = store.state.message,
|
||||
isSms = store.state.sendType.usesSmsTransport,
|
||||
isViewOnce = isViewOnceEnabled(),
|
||||
singleContact = destination.getRecipientSearchKey(),
|
||||
contacts = selectedContacts.ifEmpty { destination.getRecipientSearchKeyList() },
|
||||
@@ -409,8 +404,7 @@ class MediaSelectionViewModel(
|
||||
}
|
||||
|
||||
private fun isViewOnceEnabled(): Boolean {
|
||||
return !store.state.sendType.usesSmsTransport &&
|
||||
store.state.selectedMedia.size == 1 &&
|
||||
return store.state.selectedMedia.size == 1 &&
|
||||
store.state.viewOnceToggleState == MediaSelectionState.ViewOnceToggleState.ONCE
|
||||
}
|
||||
|
||||
@@ -432,8 +426,8 @@ class MediaSelectionViewModel(
|
||||
repository.uploadRepository.cancelUpload(media)
|
||||
}
|
||||
|
||||
private fun shouldPreUpload(metered: Boolean, isSms: Boolean, recipient: Recipient?): Boolean {
|
||||
return !metered && !isSms && !repository.isLocalSelfSend(recipient, isSms)
|
||||
private fun shouldPreUpload(metered: Boolean, recipient: Recipient?): Boolean {
|
||||
return !metered && !repository.isLocalSelfSend(recipient)
|
||||
}
|
||||
|
||||
fun onSaveState(outState: Bundle) {
|
||||
|
||||
@@ -205,7 +205,6 @@ class MediaReviewFragment : Fragment(R.layout.v2_media_review_fragment), Schedul
|
||||
|
||||
if (sharedViewModel.isContactSelectionRequired) {
|
||||
val args = MultiselectForwardFragmentArgs(
|
||||
false,
|
||||
title = R.string.MediaReviewFragment__send_to,
|
||||
storySendRequirements = sharedViewModel.getStorySendRequirements(),
|
||||
isSearchEnabled = !sharedViewModel.isStory(),
|
||||
|
||||
@@ -146,7 +146,6 @@ class TextStoryPostCreationFragment : Fragment(R.layout.stories_text_post_creati
|
||||
StoriesMultiselectForwardActivity.Args(
|
||||
MultiselectForwardFragmentArgs(
|
||||
title = R.string.MediaReviewFragment__send_to,
|
||||
canSendToNonPush = false,
|
||||
storySendRequirements = Stories.MediaTransform.SendRequirements.VALID_DURATION,
|
||||
isSearchEnabled = false
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user