diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index aa81fafc2b..c958e4b64c 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -235,10 +235,6 @@
android:screenOrientation="portrait"
android:theme="@style/Theme.Session.DayNight">
-
{
- if (message == null) return;
-
- if (!message.isPresent()) {
- Toast.makeText(this, R.string.LongMessageActivity_unable_to_find_message, Toast.LENGTH_SHORT).show();
- finish();
- return;
- }
-
- if (message.get().getMessageRecord().isOutgoing()) {
- getSupportActionBar().setTitle(getString(R.string.LongMessageActivity_your_message));
- } else {
- Recipient recipient = message.get().getMessageRecord().getRecipient();
- String name = Util.getFirstNonEmpty(recipient.getName(), recipient.getProfileName(), recipient.getAddress().serialize());
- getSupportActionBar().setTitle(getString(R.string.LongMessageActivity_message_from_s, name));
- }
- Spannable bodySpans = VisibleMessageContentView.Companion.getBodySpans(this, message.get().getMessageRecord(), null);
- textBody.setText(bodySpans);
- textBody.setMovementMethod(LinkMovementMethod.getInstance());
- });
- }
-
-}
diff --git a/app/src/main/java/org/thoughtcrime/securesms/longmessage/LongMessageRepository.java b/app/src/main/java/org/thoughtcrime/securesms/longmessage/LongMessageRepository.java
deleted file mode 100644
index 4f3e1e6ec3..0000000000
--- a/app/src/main/java/org/thoughtcrime/securesms/longmessage/LongMessageRepository.java
+++ /dev/null
@@ -1,102 +0,0 @@
-package org.thoughtcrime.securesms.longmessage;
-
-import android.content.Context;
-import android.database.Cursor;
-import android.net.Uri;
-
-import androidx.annotation.NonNull;
-import androidx.annotation.WorkerThread;
-
-import org.session.libsession.utilities.Util;
-import org.session.libsession.utilities.concurrent.SignalExecutors;
-import org.session.libsignal.utilities.Log;
-import org.session.libsignal.utilities.guava.Optional;
-import org.thoughtcrime.securesms.database.MmsDatabase;
-import org.thoughtcrime.securesms.database.SmsDatabase;
-import org.thoughtcrime.securesms.database.model.MessageRecord;
-import org.thoughtcrime.securesms.database.model.MmsMessageRecord;
-import org.thoughtcrime.securesms.dependencies.DatabaseComponent;
-import org.thoughtcrime.securesms.mms.PartAuthority;
-import org.thoughtcrime.securesms.mms.TextSlide;
-
-import java.io.IOException;
-import java.io.InputStream;
-
-class LongMessageRepository {
-
- private final static String TAG = LongMessageRepository.class.getSimpleName();
-
- private final MmsDatabase mmsDatabase;
- private final SmsDatabase smsDatabase;
-
- LongMessageRepository(@NonNull Context context) {
- this.mmsDatabase = DatabaseComponent.get(context).mmsDatabase();
- this.smsDatabase = DatabaseComponent.get(context).smsDatabase();
- }
-
- void getMessage(@NonNull Context context, long messageId, boolean isMms, @NonNull Callback> callback) {
- SignalExecutors.BOUNDED.execute(() -> {
- if (isMms) {
- callback.onComplete(getMmsLongMessage(context, mmsDatabase, messageId));
- } else {
- callback.onComplete(getSmsLongMessage(smsDatabase, messageId));
- }
- });
- }
-
- @WorkerThread
- private Optional getMmsLongMessage(@NonNull Context context, @NonNull MmsDatabase mmsDatabase, long messageId) {
- Optional record = getMmsMessage(mmsDatabase, messageId);
-
- if (record.isPresent()) {
- TextSlide textSlide = record.get().getSlideDeck().getTextSlide();
-
- if (textSlide != null && textSlide.getUri() != null) {
- return Optional.of(new LongMessage(record.get(), readFullBody(context, textSlide.getUri())));
- } else {
- return Optional.of(new LongMessage(record.get(), ""));
- }
- } else {
- return Optional.absent();
- }
- }
-
- @WorkerThread
- private Optional getSmsLongMessage(@NonNull SmsDatabase smsDatabase, long messageId) {
- Optional record = getSmsMessage(smsDatabase, messageId);
-
- if (record.isPresent()) {
- return Optional.of(new LongMessage(record.get(), ""));
- } else {
- return Optional.absent();
- }
- }
-
-
- @WorkerThread
- private Optional getMmsMessage(@NonNull MmsDatabase mmsDatabase, long messageId) {
- try (Cursor cursor = mmsDatabase.getMessage(messageId)) {
- return Optional.fromNullable((MmsMessageRecord) mmsDatabase.readerFor(cursor).getNext());
- }
- }
-
- @WorkerThread
- private Optional getSmsMessage(@NonNull SmsDatabase smsDatabase, long messageId) {
- try (Cursor cursor = smsDatabase.getMessageCursor(messageId)) {
- return Optional.fromNullable(smsDatabase.readerFor(cursor).getNext());
- }
- }
-
- private String readFullBody(@NonNull Context context, @NonNull Uri uri) {
- try (InputStream stream = PartAuthority.getAttachmentStream(context, uri)) {
- return Util.readFullyAsString(stream);
- } catch (IOException e) {
- Log.w(TAG, "Failed to read full text body.", e);
- return "";
- }
- }
-
- interface Callback {
- void onComplete(T result);
- }
-}
diff --git a/app/src/main/java/org/thoughtcrime/securesms/longmessage/LongMessageViewModel.java b/app/src/main/java/org/thoughtcrime/securesms/longmessage/LongMessageViewModel.java
deleted file mode 100644
index 27495a492a..0000000000
--- a/app/src/main/java/org/thoughtcrime/securesms/longmessage/LongMessageViewModel.java
+++ /dev/null
@@ -1,84 +0,0 @@
-package org.thoughtcrime.securesms.longmessage;
-
-import android.app.Application;
-import androidx.lifecycle.LiveData;
-import androidx.lifecycle.MutableLiveData;
-import androidx.lifecycle.ViewModel;
-import androidx.lifecycle.ViewModelProvider;
-
-import android.database.ContentObserver;
-import android.net.Uri;
-import android.os.Handler;
-import androidx.annotation.NonNull;
-
-import org.thoughtcrime.securesms.database.DatabaseContentProviders;
-import org.session.libsignal.utilities.guava.Optional;
-
-class LongMessageViewModel extends ViewModel {
-
- private final Application application;
- private final LongMessageRepository repository;
- private final long messageId;
- private final boolean isMms;
-
- private final MutableLiveData> message;
- private final MessageObserver messageObserver;
-
- private LongMessageViewModel(@NonNull Application application, @NonNull LongMessageRepository repository, long messageId, boolean isMms) {
- this.application = application;
- this.repository = repository;
- this.messageId = messageId;
- this.isMms = isMms;
- this.message = new MutableLiveData<>();
- this.messageObserver = new MessageObserver(new Handler());
-
- repository.getMessage(application, messageId, isMms, longMessage -> {
- if (longMessage.isPresent()) {
- Uri uri = DatabaseContentProviders.Conversation.getUriForThread(longMessage.get().getMessageRecord().getThreadId());
- application.getContentResolver().registerContentObserver(uri, true, messageObserver);
- }
-
- message.postValue(longMessage);
- });
- }
-
- LiveData> getMessage() {
- return message;
- }
-
- @Override
- protected void onCleared() {
- application.getContentResolver().unregisterContentObserver(messageObserver);
- }
-
- private class MessageObserver extends ContentObserver {
- MessageObserver(Handler handler) {
- super(handler);
- }
-
- @Override
- public void onChange(boolean selfChange) {
- repository.getMessage(application, messageId, isMms, message::postValue);
- }
- }
-
- static class Factory extends ViewModelProvider.NewInstanceFactory {
-
- private final Application context;
- private final LongMessageRepository repository;
- private final long messageId;
- private final boolean isMms;
-
- public Factory(@NonNull Application application, @NonNull LongMessageRepository repository, long messageId, boolean isMms) {
- this.context = application;
- this.repository = repository;
- this.messageId = messageId;
- this.isMms = isMms;
- }
-
- @Override
- public @NonNull T create(@NonNull Class modelClass) {
- return modelClass.cast(new LongMessageViewModel(context, repository, messageId, isMms));
- }
- }
-}
diff --git a/app/src/main/res/layout/longmessage_activity.xml b/app/src/main/res/layout/longmessage_activity.xml
deleted file mode 100644
index 0436fdae2f..0000000000
--- a/app/src/main/res/layout/longmessage_activity.xml
+++ /dev/null
@@ -1,23 +0,0 @@
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file