Added force sync

pull/161/head
M66B 5 years ago
parent eacb162de4
commit fe7887a114

@ -201,6 +201,7 @@ FairEmail follows all the best practices for an email client as decribed in [thi
* [(120) Why are new message notifications not removed on opening the app?](#user-content-faq120) * [(120) Why are new message notifications not removed on opening the app?](#user-content-faq120)
* [(121) How are messages grouped into a conversation?](#user-content-faq121) * [(121) How are messages grouped into a conversation?](#user-content-faq121)
* [(122) Why is the recipient name/email address show with a warning color?](#user-content-faq122) * [(122) Why is the recipient name/email address show with a warning color?](#user-content-faq122)
* [(123) What does 'force sync'?](#user-content-faq123)
[I have another question.](#support) [I have another question.](#support)
@ -2090,6 +2091,16 @@ Mostly this indicates that the message was received *via* an account with anothe
<br /> <br />
<a name="faq123"></a>
**(123) What does 'force sync'?**
FairEmail will wait a fixed time after connectivity changes
and will use a logarithmic back-off time after failing to connect to an account to prevent from being locked out.
*Force sync* will reset all timers and restart the synchronization service.
This should not normally be used.
<br />
## Support ## Support
If you have another question, want to request a feature or report a bug, you can use [this forum](https://forum.xda-developers.com/android/apps-games/source-email-t3824168). If you have another question, want to request a feature or report a bug, you can use [this forum](https://forum.xda-developers.com/android/apps-games/source-email-t3824168).

@ -278,12 +278,6 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
drawerLayout.closeDrawer(drawerContainer); drawerLayout.closeDrawer(drawerContainer);
onMenuSetup(); onMenuSetup();
} }
}, new Runnable() {
@Override
public void run() {
drawerLayout.closeDrawer(drawerContainer);
onReset();
}
})); }));
madapter.set(menus); madapter.set(menus);
@ -938,10 +932,6 @@ public class ActivityView extends ActivityBilling implements FragmentManager.OnB
Helper.view(this, getIntentOtherApps()); Helper.view(this, getIntentOtherApps());
} }
private void onReset() {
ServiceSynchronize.reset(this);
}
private void onDebugInfo() { private void onDebugInfo() {
new SimpleTask<Long>() { new SimpleTask<Long>() {
@Override @Override

@ -2488,6 +2488,8 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
menu.findItem(R.id.menu_select_all).setVisible(!outbox && menu.findItem(R.id.menu_select_all).setVisible(!outbox &&
(viewType == AdapterMessage.ViewType.UNIFIED || viewType == AdapterMessage.ViewType.FOLDER)); (viewType == AdapterMessage.ViewType.UNIFIED || viewType == AdapterMessage.ViewType.FOLDER));
menu.findItem(R.id.menu_force_sync).setVisible(viewType == AdapterMessage.ViewType.UNIFIED);
super.onPrepareOptionsMenu(menu); super.onPrepareOptionsMenu(menu);
} }
@ -2562,6 +2564,10 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
onMenuSelectAll(); onMenuSelectAll();
return true; return true;
case R.id.menu_force_sync:
onMenuForceSync();
return true;
default: default:
return super.onOptionsItemSelected(item); return super.onOptionsItemSelected(item);
} }
@ -2662,6 +2668,11 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
}); });
} }
private void onMenuForceSync() {
ServiceSynchronize.reset(getContext());
ToastEx.makeText(getContext(), R.string.title_executing, Toast.LENGTH_LONG).show();
}
private void updateState(List<TupleFolderEx> folders) { private void updateState(List<TupleFolderEx> folders) {
Log.i("Folder state updated count=" + folders.size()); Log.i("Folder state updated count=" + folders.size());

@ -1554,6 +1554,13 @@ public class ServiceSynchronize extends ServiceBase {
} }
static void reset(Context context) { static void reset(Context context) {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
boolean enabled = prefs.getBoolean("enabled", true);
int pollInterval = prefs.getInt("poll_interval", 0);
if (!enabled || pollInterval > 0) {
ServiceSynchronize.sync = true;
oneshot = true;
}
ContextCompat.startForegroundService(context, ContextCompat.startForegroundService(context,
new Intent(context, ServiceSynchronize.class) new Intent(context, ServiceSynchronize.class)
.setAction("reset")); .setAction("reset"));

@ -94,4 +94,10 @@
android:icon="@drawable/baseline_format_size_24" android:icon="@drawable/baseline_format_size_24"
android:title="@string/title_select_all" android:title="@string/title_select_all"
app:showAsAction="never" /> app:showAsAction="never" />
<item
android:id="@+id/menu_force_sync"
android:icon="@drawable/baseline_sync_24"
android:title="@string/title_force_sync"
app:showAsAction="never" />
</menu> </menu>

@ -585,6 +585,7 @@
<string name="title_compact">Compact view</string> <string name="title_compact">Compact view</string>
<string name="title_zoom">Text size</string> <string name="title_zoom">Text size</string>
<string name="title_select_all">Select all</string> <string name="title_select_all">Select all</string>
<string name="title_force_sync">Force sync</string>
<string name="title_previous">Previous</string> <string name="title_previous">Previous</string>
<string name="title_next">Next</string> <string name="title_next">Next</string>

Loading…
Cancel
Save