Added resend indication

This commit is contained in:
M66B 2021-12-18 08:05:04 +01:00
parent 6ec57066bd
commit e32cbe0111
5 changed files with 2702 additions and 5 deletions

File diff suppressed because it is too large Load Diff

View File

@ -70,7 +70,7 @@ import io.requery.android.database.sqlite.SQLiteDatabase;
// https://developer.android.com/topic/libraries/architecture/room.html
@Database(
version = 218,
version = 219,
entities = {
EntityIdentity.class,
EntityAccount.class,
@ -2216,6 +2216,12 @@ public abstract class DB extends RoomDatabase {
db.execSQL("ALTER TABLE `message` ADD COLUMN `smtp_from` TEXT");
db.execSQL("ALTER TABLE `message` ADD COLUMN `from_domain` INTEGER");
}
}).addMigrations(new Migration(218, 219) {
@Override
public void migrate(@NonNull SupportSQLiteDatabase db) {
Log.i("DB migration from version " + startVersion + " to " + endVersion);
db.execSQL("ALTER TABLE `message` ADD COLUMN `resend` INTEGER");
}
}).addMigrations(new Migration(998, 999) {
@Override
public void migrate(@NonNull SupportSQLiteDatabase db) {

View File

@ -174,6 +174,7 @@ public class EntityMessage implements Serializable {
public Boolean content = false;
public String language = null; // classified
public Boolean plain_only = null;
public Boolean resend = null;
public Integer encrypt = null;
public Integer ui_encrypt = null;
@NonNull

View File

@ -4569,6 +4569,7 @@ public class FragmentCompose extends FragmentBase {
data.draft.thread = data.draft.msgid; // new thread
data.draft.wasforwardedfrom = ref.msgid;
} else if ("resend".equals(action)) {
data.draft.resend = true;
data.draft.thread = data.draft.msgid;
data.draft.headers = ref.headers;
} else if ("editasnew".equals(action))
@ -5290,7 +5291,9 @@ public class FragmentCompose extends FragmentBase {
draft.dsn != null && !EntityMessage.DSN_NONE.equals(draft.dsn)
? View.VISIBLE : View.GONE);
tvResend.setVisibility(draft.headers == null ? View.GONE : View.VISIBLE);
tvResend.setVisibility(
draft.headers != null && Boolean.TRUE.equals(draft.resend)
? View.VISIBLE : View.GONE);
tvPlainTextOnly.setVisibility(
draft.plain_only != null && draft.plain_only && !plain_only

View File

@ -288,7 +288,7 @@ public class MessageHelper {
if (message.from != null && message.from.length > 0)
ourFrom = getFrom(message, identity);
if (message.headers == null) {
if (message.headers == null || !Boolean.TRUE.equals(message.resend)) {
imessage.setHeader("Date", ourDate);
// Addresses
@ -392,7 +392,7 @@ public class MessageHelper {
// Send message
if (identity != null) {
if (message.headers == null) {
if (message.headers == null || !Boolean.TRUE.equals(message.resend)) {
// Add reply to
if (identity.replyto != null)
imessage.setReplyTo(convertAddress(InternetAddress.parse(identity.replyto), identity));
@ -835,7 +835,7 @@ public class MessageHelper {
// Build html body
Document document = JsoupEx.parse(message.getFile(context));
if (message.headers != null) {
if (message.headers != null && Boolean.TRUE.equals(message.resend)) {
Element body = document.body();
if (body.children().size() == 1) {
// Restore original body