Skip to content

Commit

Permalink
Fix infinite refresh indicator (#7137)
Browse files Browse the repository at this point in the history
Before when refreshing any feed(s) without network the refresh indicator
stayed indefinitely.

This was also the case if you were on mobile, trying to refresh a need
and in the popup selected "don't update over mobile".
  • Loading branch information
flofriday committed Apr 25, 2024
1 parent 7b048ed commit 4cf3623
Showing 1 changed file with 5 additions and 1 deletion.
Expand Up @@ -14,6 +14,7 @@
import androidx.work.PeriodicWorkRequest;
import androidx.work.WorkManager;
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
import de.danoeh.antennapod.event.FeedUpdateRunningEvent;
import de.danoeh.antennapod.net.common.NetworkUtils;
import de.danoeh.antennapod.event.MessageEvent;
import de.danoeh.antennapod.model.feed.Feed;
Expand Down Expand Up @@ -90,6 +91,7 @@ public void runOnceOrAsk(@NonNull Context context, @Nullable Feed feed) {
runOnce(context, feed);
} else if (!NetworkUtils.networkAvailable()) {
EventBus.getDefault().post(new MessageEvent(context.getString(R.string.download_error_no_connection)));
EventBus.getDefault().postSticky(new FeedUpdateRunningEvent(false));
} else if (NetworkUtils.isFeedRefreshAllowed()) {
runOnce(context, feed);
} else {
Expand All @@ -106,7 +108,9 @@ private void confirmMobileRefresh(final Context context, @Nullable Feed feed) {
UserPreferences.setAllowMobileFeedRefresh(true);
runOnce(context, feed);
})
.setNegativeButton(R.string.no, null);
.setNegativeButton(R.string.no, (dialog, which) -> {
EventBus.getDefault().postSticky(new FeedUpdateRunningEvent(false));
});
if (NetworkUtils.isNetworkRestricted() && NetworkUtils.isVpnOverWifi()) {
builder.setMessage(R.string.confirm_mobile_feed_refresh_dialog_message_vpn);
} else {
Expand Down

0 comments on commit 4cf3623

Please sign in to comment.