mirror of
https://github.com/oxen-io/session-android.git
synced 2024-11-21 15:05:19 +00:00
Implemented task SS-79 to only provide a save attachment menu option when the attachment download is complete
This commit is contained in:
parent
20662c8222
commit
ba2d0275e4
@ -2146,9 +2146,11 @@ class ConversationActivityV2 : PassphraseRequiredActionBarActivity(), InputBarDe
|
||||
override fun saveAttachment(messages: Set<MessageRecord>) {
|
||||
val message = messages.first() as MmsMessageRecord
|
||||
|
||||
// Do not allow the user to download a file attachment before it has finished downloading
|
||||
// Note: The save option is only added to the menu in ConversationReactionOverlay.getMenuActionItems
|
||||
// if the attachment has finished downloading, so we don't really have to check for message.isMediaPending
|
||||
// here - but we'll do it anyway and bail should that be the case as a defensive programming strategy.
|
||||
if (message.isMediaPending) {
|
||||
Toast.makeText(this, resources.getString(R.string.conversation_activity__wait_until_attachment_has_finished_downloading), Toast.LENGTH_LONG).show()
|
||||
Log.w(TAG, "Somehow we were asked to download an attachment before it had finished downloading - aborting download.")
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -39,6 +39,7 @@ import org.session.libsession.snode.SnodeAPI
|
||||
import org.session.libsession.utilities.StringSubstitutionConstants.TIME_LARGE_KEY
|
||||
import org.session.libsession.utilities.TextSecurePreferences.Companion.getLocalNumber
|
||||
import org.session.libsession.utilities.ThemeUtil
|
||||
import org.session.libsignal.utilities.Log
|
||||
import org.thoughtcrime.securesms.components.emoji.EmojiImageView
|
||||
import org.thoughtcrime.securesms.components.emoji.RecentEmojiPageModel
|
||||
import org.thoughtcrime.securesms.components.menu.ActionItem
|
||||
@ -564,9 +565,17 @@ class ConversationReactionOverlay : FrameLayout {
|
||||
if (message.isSyncFailed) {
|
||||
items += ActionItem(R.attr.menu_reply_icon, R.string.resync, { handleActionItemClicked(Action.RESYNC) })
|
||||
}
|
||||
// Save media
|
||||
if (message.isMms && (message as MediaMmsMessageRecord).containsMediaSlide()) {
|
||||
items += ActionItem(R.attr.menu_save_icon, R.string.save, { handleActionItemClicked(Action.DOWNLOAD) }, R.string.AccessibilityId_save_attachment)
|
||||
// Save media..
|
||||
if (message.isMms) {
|
||||
// ..but only provide the save option if the there is a media attachment which has finished downloading.
|
||||
val mmsMessage = message as MediaMmsMessageRecord
|
||||
if (mmsMessage.containsMediaSlide() && !mmsMessage.isMediaPending) {
|
||||
items += ActionItem(R.attr.menu_save_icon,
|
||||
R.string.save,
|
||||
{ handleActionItemClicked(Action.DOWNLOAD) },
|
||||
R.string.AccessibilityId_save_attachment
|
||||
)
|
||||
}
|
||||
}
|
||||
backgroundView.visibility = VISIBLE
|
||||
foregroundView.visibility = VISIBLE
|
||||
|
@ -15,7 +15,6 @@
|
||||
<string name="AccessibilityId_recovery_password_container">Recovery password container</string>
|
||||
<string name="AccessibilityId_recovery_password_menu_item">Recovery password menu item</string>
|
||||
<string name="AccessibilityId_view_qr_code">View QR code</string>
|
||||
<string name="contentDescriptionMediaMessage">Multimedia message</string>
|
||||
<string name="AccessibilityId_fast_mode_notifications_button">Fast mode notifications button</string>
|
||||
<string name="AccessibilityId_slow_mode_notifications_button">Slow mode notifications button</string>
|
||||
<string name="AccessibilityId_loading_animation">Loading animation</string>
|
||||
@ -188,4 +187,5 @@
|
||||
<string name="expiration_type_disappear_legacy_description">Original version of disappearing messages.</string>
|
||||
<string name="expand">Expand</string>
|
||||
|
||||
<string name="contentDescriptionMediaMessage">Media message</string>
|
||||
</resources>
|
@ -70,11 +70,6 @@
|
||||
-->
|
||||
<string name="attachment_type_selector__gallery">Gallery</string>
|
||||
|
||||
<!-- REQUIRED: Toast shown when a user attempts to download a second attachment while the first is still downloading.
|
||||
Figma: Unable to locate this string in Figma.
|
||||
-->
|
||||
<string name="conversation_activity__wait_until_attachment_has_finished_downloading">Please wait until attachment has finished downloading</string>
|
||||
|
||||
<!-- REQUIRED: Used when a users follows the disappearing messages of another user to turn them off.
|
||||
Figma: https://www.figma.com/design/tEgZ8ujg76DdtPwEJv8zFp/Disappearing-Messages?node-id=0-1&t=RmpaOwy9gz7ohKSE-0
|
||||
-->
|
||||
|
Loading…
Reference in New Issue
Block a user