mirror of
https://github.com/M66B/FairEmail.git
synced 2025-02-24 07:01:05 +00:00
Auto reset on refresh
This commit is contained in:
parent
66dbaf1777
commit
496ce0ae9e
4 changed files with 15 additions and 31 deletions
|
@ -267,12 +267,6 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
|
|||
drawerLayout.closeDrawer(drawerContainer);
|
||||
onMenuSetup();
|
||||
}
|
||||
}, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
drawerLayout.closeDrawer(drawerContainer);
|
||||
onReset();
|
||||
}
|
||||
}));
|
||||
|
||||
madapter.set(menus);
|
||||
|
@ -990,10 +984,6 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
|
|||
Helper.view(this, this, getIntentOtherApps());
|
||||
}
|
||||
|
||||
private void onReset() {
|
||||
ServiceSynchronize.reset(this);
|
||||
}
|
||||
|
||||
private void onDebugInfo() {
|
||||
new SimpleTask<Long>() {
|
||||
@Override
|
||||
|
|
|
@ -452,8 +452,6 @@ public class AdapterFolder extends RecyclerView.Adapter<AdapterFolder.ViewHolder
|
|||
if (!Helper.getNetworkState(context).isSuitable())
|
||||
throw new IllegalArgumentException(context.getString(R.string.title_no_internet));
|
||||
|
||||
boolean now = true;
|
||||
|
||||
DB db = DB.getInstance(context);
|
||||
try {
|
||||
db.beginTransaction();
|
||||
|
@ -466,8 +464,11 @@ public class AdapterFolder extends RecyclerView.Adapter<AdapterFolder.ViewHolder
|
|||
|
||||
if (folder.account != null) {
|
||||
EntityAccount account = db.account().getAccount(folder.account);
|
||||
if (account != null && !"connected".equals(account.state))
|
||||
now = false;
|
||||
if (account != null && !"connected".equals(account.state)) {
|
||||
ServiceSynchronize.reset(context);
|
||||
// Causes rollback
|
||||
throw new IllegalArgumentException(context.getString(R.string.title_no_connection));
|
||||
}
|
||||
}
|
||||
|
||||
db.setTransactionSuccessful();
|
||||
|
@ -476,9 +477,6 @@ public class AdapterFolder extends RecyclerView.Adapter<AdapterFolder.ViewHolder
|
|||
db.endTransaction();
|
||||
}
|
||||
|
||||
if (!now)
|
||||
throw new IllegalArgumentException(context.getString(R.string.title_no_connection));
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
@ -317,8 +317,6 @@ public class FragmentFolders extends FragmentBase {
|
|||
if (!Helper.getNetworkState(context).isSuitable())
|
||||
throw new IllegalArgumentException(context.getString(R.string.title_no_internet));
|
||||
|
||||
boolean now = true;
|
||||
|
||||
DB db = DB.getInstance(context);
|
||||
try {
|
||||
db.beginTransaction();
|
||||
|
@ -331,8 +329,11 @@ public class FragmentFolders extends FragmentBase {
|
|||
|
||||
if (folder.account != null) {
|
||||
EntityAccount account = db.account().getAccount(folder.account);
|
||||
if (account != null && !"connected".equals(account.state))
|
||||
now = false;
|
||||
if (account != null && !"connected".equals(account.state)) {
|
||||
ServiceSynchronize.reset(context);
|
||||
// Causes rollback
|
||||
throw new IllegalArgumentException(context.getString(R.string.title_no_connection));
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
@ -350,9 +351,6 @@ public class FragmentFolders extends FragmentBase {
|
|||
db.endTransaction();
|
||||
}
|
||||
|
||||
if (!now)
|
||||
throw new IllegalArgumentException(context.getString(R.string.title_no_connection));
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
@ -652,8 +652,6 @@ public class FragmentMessages extends FragmentBase {
|
|||
if (!Helper.getNetworkState(context).isSuitable())
|
||||
throw new IllegalArgumentException(context.getString(R.string.title_no_internet));
|
||||
|
||||
boolean now = true;
|
||||
|
||||
DB db = DB.getInstance(context);
|
||||
try {
|
||||
db.beginTransaction();
|
||||
|
@ -672,8 +670,11 @@ public class FragmentMessages extends FragmentBase {
|
|||
|
||||
if (folder.account != null) {
|
||||
EntityAccount account = db.account().getAccount(folder.account);
|
||||
if (account != null && !"connected".equals(account.state))
|
||||
now = false;
|
||||
if (account != null && !"connected".equals(account.state)) {
|
||||
ServiceSynchronize.reset(context);
|
||||
// Causes rollback
|
||||
throw new IllegalArgumentException(context.getString(R.string.title_no_connection));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -682,9 +683,6 @@ public class FragmentMessages extends FragmentBase {
|
|||
db.endTransaction();
|
||||
}
|
||||
|
||||
if (!now)
|
||||
throw new IllegalArgumentException(context.getString(R.string.title_no_connection));
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue