Show account errors warning

pull/194/merge
M66B 3 years ago
parent f672fe9977
commit 59f0db8d25

@ -38,7 +38,8 @@ public interface DaoFolder {
@Query("SELECT folder.*" +
", account.id AS accountId, account.pop AS accountProtocol, account.`order` AS accountOrder" +
", account.name AS accountName, account.category AS accountCategory, account.color AS accountColor, account.state AS accountState" +
", account.name AS accountName, account.category AS accountCategory, account.color AS accountColor" +
", account.state AS accountState, account.error AS accountError" +
", COUNT(DISTINCT CASE WHEN rule.enabled THEN rule.id ELSE NULL END) rules" +
", COUNT(DISTINCT message.id) AS messages" +
", COUNT(DISTINCT CASE WHEN message.content = 1 THEN message.id ELSE NULL END) AS content" +
@ -77,7 +78,8 @@ public interface DaoFolder {
@Transaction
@Query("SELECT folder.*" +
", account.id AS accountId, account.pop AS accountProtocol, account.`order` AS accountOrder" +
", account.name AS accountName, account.category AS accountCategory, account.color AS accountColor, account.state AS accountState" +
", account.name AS accountName, account.category AS accountCategory, account.color AS accountColor" +
", account.state AS accountState, account.error AS accountError" +
", COUNT(DISTINCT CASE WHEN rule.enabled THEN rule.id ELSE NULL END) rules" +
", COUNT(DISTINCT CASE WHEN message.ui_hide THEN NULL ELSE message.id END) AS messages" +
", COUNT(DISTINCT CASE WHEN message.content = 1 AND NOT message.ui_hide THEN message.id ELSE NULL END) AS content" +
@ -100,7 +102,8 @@ public interface DaoFolder {
@Query("SELECT folder.*" +
", account.id AS accountId, account.pop AS accountProtocol, account.`order` AS accountOrder" +
", account.name AS accountName, account.category AS accountCategory, account.color AS accountColor, account.state AS accountState" +
", account.name AS accountName, account.category AS accountCategory, account.color AS accountColor" +
", account.state AS accountState, account.error AS accountError" +
", COUNT(DISTINCT CASE WHEN rule.enabled THEN rule.id ELSE NULL END) rules" +
", COUNT(DISTINCT message.id) AS messages" +
", COUNT(DISTINCT CASE WHEN message.content = 1 THEN message.id ELSE NULL END) AS content" +
@ -124,7 +127,8 @@ public interface DaoFolder {
@Query("SELECT folder.*" +
", account.id AS accountId, account.pop AS accountProtocol, account.`order` AS accountOrder" +
", account.name AS accountName, account.category AS accountCategory, account.color AS accountColor, account.state AS accountState" +
", account.name AS accountName, account.category AS accountCategory, account.color AS accountColor" +
", account.state AS accountState, account.error AS accountError" +
", COUNT(DISTINCT CASE WHEN rule.enabled THEN rule.id ELSE NULL END) rules" +
", COUNT(DISTINCT message.id) AS messages" +
", COUNT(DISTINCT CASE WHEN message.content = 1 THEN message.id ELSE NULL END) AS content" +

@ -1380,7 +1380,19 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
fabError.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
onMenuFolders(account);
if (Boolean.TRUE.equals(v.getTag())) {
Bundle args = new Bundle();
args.putBoolean("settings", false);
FragmentAccounts fragment = new FragmentAccounts();
fragment.setArguments(args);
FragmentManager fm = getParentFragmentManager();
FragmentTransaction fragmentTransaction = fm.beginTransaction();
fragmentTransaction.replace(R.id.content_frame, fragment).addToBackStack("unified");
fragmentTransaction.commit();
} else
onMenuFolders(account);
}
});
@ -5410,18 +5422,25 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
// Get state
int unseen = 0;
boolean errors = false;
boolean refreshing = false;
boolean folderErrors = false;
boolean accountErrors = false;
for (TupleFolderEx folder : folders) {
unseen += folder.unseen;
if (folder.error != null && folder.account != null /* outbox */)
errors = true;
if (folder.sync_state != null &&
!"downloading".equals(folder.sync_state) &&
(folder.account == null ||
"connecting".equals(folder.accountState) ||
"connected".equals(folder.accountState)))
refreshing = true;
if (folder.account != null) { // Outbox
if (folder.error != null)
folderErrors = true;
if (!BuildConfig.PLAY_STORE_RELEASE && folder.accountError != null)
accountErrors = true;
}
}
// Get name
@ -5448,7 +5467,8 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
else
setSubtitle(getString(R.string.title_name_count, name, NF.format(unseen)));
if (errors)
fabError.setTag(accountErrors);
if (folderErrors || accountErrors)
fabError.show();
else
fabError.hide();

@ -44,6 +44,7 @@ public class TupleFolderEx extends EntityFolder implements Serializable {
public String accountCategory;
public Integer accountColor;
public String accountState;
public String accountError;
public int rules;
public int messages;
public int content;
@ -74,6 +75,7 @@ public class TupleFolderEx extends EntityFolder implements Serializable {
Objects.equals(this.accountCategory, other.accountCategory) &&
Objects.equals(this.accountColor, other.accountColor) &&
Objects.equals(this.accountState, other.accountState) &&
Objects.equals(this.accountError, other.accountError) &&
this.rules == other.rules &&
this.messages == other.messages &&
this.content == other.content &&

@ -458,9 +458,9 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal|bottom"
android:layout_margin="@dimen/fab_padding"
android:contentDescription="@string/title_legend_section_folders"
android:tooltipText="@string/title_compose"
android:layout_marginBottom="45dp"
android:contentDescription="@string/title_setup_error"
android:tooltipText="@string/title_setup_error"
app:backgroundTint="?attr/colorWarning"
app:srcCompat="@drawable/twotone_warning_24"
app:tint="?attr/colorFabForeground" />

Loading…
Cancel
Save