Added resend indication

pull/194/merge
M66B 3 years ago
parent 6ec57066bd
commit e32cbe0111

File diff suppressed because it is too large Load Diff

@ -70,7 +70,7 @@ import io.requery.android.database.sqlite.SQLiteDatabase;
// https://developer.android.com/topic/libraries/architecture/room.html // https://developer.android.com/topic/libraries/architecture/room.html
@Database( @Database(
version = 218, version = 219,
entities = { entities = {
EntityIdentity.class, EntityIdentity.class,
EntityAccount.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 `smtp_from` TEXT");
db.execSQL("ALTER TABLE `message` ADD COLUMN `from_domain` INTEGER"); 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) { }).addMigrations(new Migration(998, 999) {
@Override @Override
public void migrate(@NonNull SupportSQLiteDatabase db) { public void migrate(@NonNull SupportSQLiteDatabase db) {

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

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

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

Loading…
Cancel
Save