do not show Data/WiFi Settings Toast if device has no internet

Before, if the Data/WiFi Settings made it so the update process is not
allowed to run and the device was not offline or in Airplane Mode, it would
show this Toast then it would show the "your device is offline" Toast.
This commit is contained in:
Hans-Christoph Steiner 2018-07-20 10:41:27 +02:00
parent 34c788681b
commit 2040d885f2

View File

@ -116,12 +116,16 @@ public class UpdateService extends JobIntentService {
}
/**
* Add work to the queue for processing now
* Add work to the queue for processing now.
* <p>
* This also shows a {@link Toast} if the Data/WiFi Settings make it so the
* update process is not allowed to run and the device is attached to a
* network (e.g. is not offline or in Airplane Mode).
*
* @see JobIntentService#enqueueWork(Context, Class, int, Intent)
*/
private static void enqueueWork(Context context, @NonNull Intent intent) {
if (!Preferences.get().isOnDemandDownloadAllowed()) {
if (FDroidApp.networkState > 0 && !Preferences.get().isOnDemandDownloadAllowed()) {
Toast.makeText(context, R.string.updates_disabled_by_settings, Toast.LENGTH_LONG).show();
}