Debug info: swipe left/right

This commit is contained in:
M66B 2022-03-28 08:32:50 +02:00
parent 82d523db04
commit fe1c67bd2c
3 changed files with 44 additions and 2 deletions

View File

@ -170,15 +170,20 @@ public interface DaoAccount {
@Query(TupleAccountView.query)
LiveData<List<TupleAccountView>> liveAccountView();
@Query("SELECT account.id" +
String swipes = "SELECT account.id" +
", account.swipe_left, l.type AS left_type, l.name AS left_name, l.color AS left_color" +
", account.swipe_right, r.type AS right_type, r.name AS right_name, r.color AS right_color" +
" FROM account" +
" LEFT JOIN folder_view l ON l.id = account.swipe_left" +
" LEFT JOIN folder_view r ON r.id = account.swipe_right" +
" WHERE :account IS NULL OR account.id = :account")
" WHERE :account IS NULL OR account.id = :account";
@Query(swipes)
LiveData<List<TupleAccountSwipes>> liveAccountSwipes(Long account);
@Query(swipes)
List<TupleAccountSwipes> getAccountSwipes(Long account);
@Insert
long insertAccount(EntityAccount account);

View File

@ -567,6 +567,32 @@ public class EntityMessage implements Serializable {
}
}
static String getSwipeType(Long type) {
if (type == null)
return "none";
if (type > 0)
return "folder";
if (SWIPE_ACTION_ASK.equals(type))
return "ask";
if (SWIPE_ACTION_SEEN.equals(type))
return "seen";
if (SWIPE_ACTION_SNOOZE.equals(type))
return "snooze";
if (SWIPE_ACTION_HIDE.equals(type))
return "hide";
if (SWIPE_ACTION_MOVE.equals(type))
return "move";
if (SWIPE_ACTION_FLAG.equals(type))
return "flag";
if (SWIPE_ACTION_DELETE.equals(type))
return "delete";
if (SWIPE_ACTION_JUNK.equals(type))
return "junk";
if (SWIPE_ACTION_REPLY.equals(type))
return "reply";
return "???";
}
@Override
public boolean equals(Object obj) {
if (obj instanceof EntityMessage) {

View File

@ -2139,6 +2139,17 @@ public class Log {
"\r\n");
}
List<TupleAccountSwipes> swipes = db.account().getAccountSwipes(account.id);
if (swipes == null)
size += write(os, "<> swipes?\r\n");
else
for (TupleAccountSwipes swipe : swipes) {
size += write(os, "> " + EntityMessage.getSwipeType(swipe.swipe_left) + " " +
swipe.left_name + ":" + swipe.left_type + "\r\n");
size += write(os, "< " + EntityMessage.getSwipeType(swipe.swipe_right) + " " +
swipe.right_name + ":" + swipe.right_type + "\r\n");
}
size += write(os, "\r\n");
}
}