pull/194/merge
M66B 4 years ago
parent b7ede2cf50
commit 41bfbffe84

File diff suppressed because it is too large Load Diff

@ -126,6 +126,7 @@ public class AdapterFolder extends RecyclerView.Adapter<AdapterFolder.ViewHolder
private ImageView ivSubscribed;
private ImageView ivRule;
private ImageView ivNotify;
private ImageView ivAutoAdd;
private TextView tvName;
private TextView tvMessages;
private ImageView ivMessages;
@ -164,6 +165,7 @@ public class AdapterFolder extends RecyclerView.Adapter<AdapterFolder.ViewHolder
ivSubscribed = itemView.findViewById(R.id.ivSubscribed);
ivRule = itemView.findViewById(R.id.ivRule);
ivNotify = itemView.findViewById(R.id.ivNotify);
ivAutoAdd = itemView.findViewById(R.id.ivAutoAdd);
tvName = itemView.findViewById(R.id.tvName);
tvMessages = itemView.findViewById(R.id.tvMessages);
ivMessages = itemView.findViewById(R.id.ivMessages);
@ -282,6 +284,10 @@ public class AdapterFolder extends RecyclerView.Adapter<AdapterFolder.ViewHolder
ivSubscribed.setVisibility(subscriptions && folder.subscribed != null && folder.subscribed ? View.VISIBLE : View.GONE);
ivRule.setVisibility(folder.rules > 0 ? View.VISIBLE : View.GONE);
ivNotify.setVisibility(folder.notify ? View.VISIBLE : View.GONE);
ivAutoAdd.setVisibility(BuildConfig.DEBUG &&
EntityFolder.SENT.equals(folder.type) &&
(folder.auto_add == null || folder.auto_add)
? View.VISIBLE : View.GONE);
}
int cunseen = (folder.collapsed ? folder.childs_unseen : 0);

@ -1858,6 +1858,8 @@ class Core {
}
private static void onExists(Context context, JSONArray jargs, EntityAccount account, EntityFolder folder, EntityMessage message, EntityOperation op, IMAPFolder ifolder) throws MessagingException, IOException {
DB db = DB.getInstance(context);
boolean retry = jargs.optBoolean(0);
if (message.uid != null)
@ -1908,12 +1910,15 @@ class Core {
msgid = message.msgid;
}
if (Objects.equals(message.msgid, msgid)) {
db.folder().setFolderAutoAdd(folder.id, false);
long uid = ifolder.getUID(imessages[0]);
EntityOperation.queue(context, folder, EntityOperation.FETCH, uid);
} else {
db.folder().setFolderAutoAdd(folder.id, true);
EntityOperation.queue(context, message, EntityOperation.ADD);
}
} else {
db.folder().setFolderAutoAdd(folder.id, true);
if (imessages != null && imessages.length > 1)
Log.e(folder.name + " EXISTS messages=" + imessages.length + " retry=" + retry);
EntityLog.log(context, folder.name +
@ -3553,7 +3558,8 @@ class Core {
dup.uid = uid;
dup.thread = thread;
if (EntityFolder.SENT.equals(folder.type)) {
if (EntityFolder.SENT.equals(folder.type) &&
(folder.auto_add == null || !folder.auto_add)) {
Long sent = helper.getSent();
Long received = helper.getReceived();
if (sent != null)

@ -68,7 +68,7 @@ import io.requery.android.database.sqlite.SQLiteDatabase;
// https://developer.android.com/topic/libraries/architecture/room.html
@Database(
version = 214,
version = 215,
entities = {
EntityIdentity.class,
EntityAccount.class,
@ -2185,6 +2185,12 @@ public abstract class DB extends RoomDatabase {
db.execSQL("DROP VIEW IF EXISTS `account_view`");
db.execSQL("CREATE VIEW IF NOT EXISTS `account_view` AS " + TupleAccountView.query);
}
}).addMigrations(new Migration(214, 215) {
@Override
public void migrate(@NonNull SupportSQLiteDatabase db) {
Log.i("DB migration from version " + startVersion + " to " + endVersion);
db.execSQL("ALTER TABLE `folder` ADD COLUMN `auto_add` INTEGER");
}
}).addMigrations(new Migration(998, 999) {
@Override
public void migrate(@NonNull SupportSQLiteDatabase db) {

@ -356,6 +356,9 @@ public interface DaoFolder {
@Query("UPDATE folder SET read_only = :read_only WHERE id = :id AND NOT (read_only IS :read_only)")
int setFolderReadOnly(long id, boolean read_only);
@Query("UPDATE folder SET auto_add = :auto_add WHERE id = :id AND NOT (auto_add IS :auto_add)")
int setFolderAutoAdd(long id, Boolean auto_add);
@Query("UPDATE folder SET tbc = NULL WHERE id = :id AND tbc IS NOT NULL")
int resetFolderTbc(long id);

@ -102,6 +102,7 @@ public class EntityFolder extends EntityOrder implements Serializable {
public Integer keep_days;
@NonNull
public Boolean auto_delete = false;
public Boolean auto_add; // sent messages
public String display;
public Integer color;
@NonNull

@ -111,6 +111,16 @@
app:layout_constraintTop_toTopOf="@+id/tvName"
app:srcCompat="@drawable/twotone_notifications_24" />
<ImageView
android:id="@+id/ivAutoAdd"
android:layout_width="30dp"
android:layout_height="24dp"
android:paddingEnd="6dp"
app:layout_constraintBottom_toBottomOf="@+id/tvName"
app:layout_constraintStart_toEndOf="@id/ivNotify"
app:layout_constraintTop_toTopOf="@+id/tvName"
app:srcCompat="@drawable/twotone_add_24" />
<eu.faircode.email.FixedTextView
android:id="@+id/tvName"
android:layout_width="0dp"
@ -123,7 +133,7 @@
android:text="Name"
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
app:layout_constraintEnd_toStartOf="@+id/tvMessages"
app:layout_constraintStart_toEndOf="@id/ivNotify"
app:layout_constraintStart_toEndOf="@id/ivAutoAdd"
app:layout_constraintTop_toTopOf="parent" />
<eu.faircode.email.FixedTextView

Loading…
Cancel
Save