mirror of
https://github.com/oxen-io/session-android.git
synced 2025-12-03 08:32:34 +00:00
Make long text attachments contain the entire message.
Instead of just containing the 'overflow', long text attachments now contain the entire body in full.
This commit is contained in:
@@ -1968,20 +1968,20 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity
|
||||
|
||||
private Pair<String, Optional<Slide>> getSplitMessage(String rawText, int maxPrimaryMessageSize) {
|
||||
String bodyText = rawText;
|
||||
Optional<Slide> extraText = Optional.absent();
|
||||
Optional<Slide> textSlide = Optional.absent();
|
||||
|
||||
if (bodyText.length() > maxPrimaryMessageSize) {
|
||||
bodyText = rawText.substring(0, maxPrimaryMessageSize);
|
||||
|
||||
byte[] extraData = rawText.substring(maxPrimaryMessageSize).getBytes();
|
||||
Uri textUri = MemoryBlobProvider.getInstance().createUri(extraData);
|
||||
byte[] textData = rawText.getBytes();
|
||||
Uri textUri = MemoryBlobProvider.getInstance().createUri(textData);
|
||||
String timestamp = new SimpleDateFormat("yyyy-MM-dd-HHmmss", Locale.US).format(new Date());
|
||||
String filename = String.format("signal-%s.txt", timestamp);
|
||||
|
||||
extraText = Optional.of(new TextSlide(this, textUri, filename, extraData.length));
|
||||
textSlide = Optional.of(new TextSlide(this, textUri, filename, textData.length));
|
||||
}
|
||||
|
||||
return new Pair<>(bodyText, extraText);
|
||||
return new Pair<>(bodyText, textSlide);
|
||||
}
|
||||
|
||||
private MediaConstraints getCurrentMediaConstraints() {
|
||||
|
||||
@@ -564,8 +564,8 @@ public class ConversationFragment extends Fragment
|
||||
|
||||
if (mediaMessage.getSlideDeck().getTextSlide() != null && mediaMessage.getSlideDeck().getTextSlide().getUri() != null) {
|
||||
try (InputStream stream = PartAuthority.getAttachmentStream(requireContext(), mediaMessage.getSlideDeck().getTextSlide().getUri())) {
|
||||
String extraText = Util.readFullyAsString(stream);
|
||||
composeIntent.putExtra(Intent.EXTRA_TEXT, message.getDisplayBody().toString() + extraText);
|
||||
String fullBody = Util.readFullyAsString(stream);
|
||||
composeIntent.putExtra(Intent.EXTRA_TEXT, fullBody);
|
||||
} catch (IOException e) {
|
||||
Log.w(TAG, "Failed to read long message text when forwarding.");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user