mirror of https://github.com/M66B/FairEmail.git
Report account errors
This commit is contained in:
parent
3ada7a7432
commit
f1e90e038c
|
@ -52,7 +52,8 @@ public interface DaoFolder {
|
||||||
EntityFolder getBrowsableFolder(long folder, boolean search);
|
EntityFolder getBrowsableFolder(long folder, boolean search);
|
||||||
|
|
||||||
@Query("SELECT folder.*" +
|
@Query("SELECT folder.*" +
|
||||||
", account.name AS accountName, account.color AS accountColor, account.state AS accountState" +
|
", account.name AS accountName, account.color AS accountColor" +
|
||||||
|
", account.state AS accountState, account.error AS accountError" +
|
||||||
", COUNT(message.id) AS messages" +
|
", COUNT(message.id) AS messages" +
|
||||||
", SUM(CASE WHEN message.content = 1 THEN 1 ELSE 0 END) AS content" +
|
", SUM(CASE WHEN message.content = 1 THEN 1 ELSE 0 END) AS content" +
|
||||||
", SUM(CASE WHEN message.ui_seen = 0 THEN 1 ELSE 0 END) AS unseen" +
|
", SUM(CASE WHEN message.ui_seen = 0 THEN 1 ELSE 0 END) AS unseen" +
|
||||||
|
@ -67,7 +68,8 @@ public interface DaoFolder {
|
||||||
LiveData<List<TupleFolderEx>> liveFolders(Long account);
|
LiveData<List<TupleFolderEx>> liveFolders(Long account);
|
||||||
|
|
||||||
@Query("SELECT folder.*" +
|
@Query("SELECT folder.*" +
|
||||||
", account.name AS accountName, account.color AS accountColor, account.state AS accountState" +
|
", account.name AS accountName, account.color AS accountColor" +
|
||||||
|
", account.state AS accountState, account.error AS accountError" +
|
||||||
", COUNT(message.id) AS messages" +
|
", COUNT(message.id) AS messages" +
|
||||||
", SUM(CASE WHEN message.content = 1 THEN 1 ELSE 0 END) AS content" +
|
", SUM(CASE WHEN message.content = 1 THEN 1 ELSE 0 END) AS content" +
|
||||||
", SUM(CASE WHEN message.ui_seen = 0 THEN 1 ELSE 0 END) AS unseen" +
|
", SUM(CASE WHEN message.ui_seen = 0 THEN 1 ELSE 0 END) AS unseen" +
|
||||||
|
@ -85,7 +87,8 @@ public interface DaoFolder {
|
||||||
LiveData<EntityFolder> livePrimaryDrafts();
|
LiveData<EntityFolder> livePrimaryDrafts();
|
||||||
|
|
||||||
@Query("SELECT folder.*" +
|
@Query("SELECT folder.*" +
|
||||||
", account.name AS accountName, account.color AS accountColor, account.state AS accountState" +
|
", account.name AS accountName, account.color AS accountColor" +
|
||||||
|
", account.state AS accountState, account.error AS accountError" +
|
||||||
", COUNT(message.id) AS messages" +
|
", COUNT(message.id) AS messages" +
|
||||||
", SUM(CASE WHEN message.content = 1 THEN 1 ELSE 0 END) AS content" +
|
", SUM(CASE WHEN message.content = 1 THEN 1 ELSE 0 END) AS content" +
|
||||||
", SUM(CASE WHEN message.ui_seen = 0 THEN 1 ELSE 0 END) AS unseen" +
|
", SUM(CASE WHEN message.ui_seen = 0 THEN 1 ELSE 0 END) AS unseen" +
|
||||||
|
|
|
@ -1521,7 +1521,7 @@ public class FragmentMessages extends FragmentBase {
|
||||||
boolean errors = false;
|
boolean errors = false;
|
||||||
for (TupleFolderEx folder : folders) {
|
for (TupleFolderEx folder : folders) {
|
||||||
unseen += folder.unseen;
|
unseen += folder.unseen;
|
||||||
if (!TextUtils.isEmpty(folder.error))
|
if (folder.error != null || folder.accountError != null)
|
||||||
errors = true;
|
errors = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1543,8 +1543,7 @@ public class FragmentMessages extends FragmentBase {
|
||||||
rvMessage.scrollToPosition(0);
|
rvMessage.scrollToPosition(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (errors &&
|
if (errors && !refreshing && swipeRefresh.isRefreshing())
|
||||||
!refreshing && swipeRefresh.isRefreshing())
|
|
||||||
Snackbar.make(view, R.string.title_sync_errors, Snackbar.LENGTH_LONG).show();
|
Snackbar.make(view, R.string.title_sync_errors, Snackbar.LENGTH_LONG).show();
|
||||||
|
|
||||||
swipeRefresh.setRefreshing(refreshing);
|
swipeRefresh.setRefreshing(refreshing);
|
||||||
|
@ -1580,9 +1579,11 @@ public class FragmentMessages extends FragmentBase {
|
||||||
rvMessage.scrollToPosition(0);
|
rvMessage.scrollToPosition(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (folder != null && !TextUtils.isEmpty(folder.error) &&
|
String error = null;
|
||||||
!refreshing && swipeRefresh.isRefreshing())
|
if (folder != null)
|
||||||
Snackbar.make(view, folder.error, Snackbar.LENGTH_LONG).show();
|
error = (folder.error == null ? folder.accountError : folder.error);
|
||||||
|
if (error != null && !refreshing && swipeRefresh.isRefreshing())
|
||||||
|
Snackbar.make(view, error, Snackbar.LENGTH_LONG).show();
|
||||||
|
|
||||||
swipeRefresh.setRefreshing(refreshing);
|
swipeRefresh.setRefreshing(refreshing);
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,6 +25,7 @@ public class TupleFolderEx extends EntityFolder {
|
||||||
public String accountName;
|
public String accountName;
|
||||||
public Integer accountColor;
|
public Integer accountColor;
|
||||||
public String accountState;
|
public String accountState;
|
||||||
|
public String accountError;
|
||||||
public int messages;
|
public int messages;
|
||||||
public int content;
|
public int content;
|
||||||
public int unseen;
|
public int unseen;
|
||||||
|
@ -37,6 +38,7 @@ public class TupleFolderEx extends EntityFolder {
|
||||||
Objects.equals(accountName, other.accountName) &&
|
Objects.equals(accountName, other.accountName) &&
|
||||||
Objects.equals(this.accountColor, other.accountColor) &&
|
Objects.equals(this.accountColor, other.accountColor) &&
|
||||||
Objects.equals(accountState, other.accountState) &&
|
Objects.equals(accountState, other.accountState) &&
|
||||||
|
Objects.equals(accountError, other.accountError) &&
|
||||||
this.messages == other.messages &&
|
this.messages == other.messages &&
|
||||||
this.content == other.content &&
|
this.content == other.content &&
|
||||||
this.unseen == other.unseen);
|
this.unseen == other.unseen);
|
||||||
|
|
Loading…
Reference in New Issue