Add message: Please wait some time before refreshing again (#7950)

This commit is contained in:
Hans-Peter Lehmann 2025-08-27 18:17:25 +02:00 committed by GitHub
parent 3a94f1f430
commit 5eccb2e64e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 9 additions and 0 deletions

View File

@ -34,6 +34,8 @@ public class FeedUpdateManagerImpl extends FeedUpdateManager {
public static final String EXTRA_EVEN_ON_MOBILE = "even_on_mobile";
public static final String EXTRA_MANUAL = "manual";
private static final String TAG = "AutoUpdateManager";
private static long lastManualRefreshTime = 0;
private static final long REFRESH_COOLDOWN_MS = 20_000;
/**
* Start / restart periodic auto feed refresh
@ -64,6 +66,7 @@ public class FeedUpdateManagerImpl extends FeedUpdateManager {
}
public void runOnce(Context context, Feed feed, boolean nextPage) {
lastManualRefreshTime = System.currentTimeMillis();
OneTimeWorkRequest.Builder workRequest = new OneTimeWorkRequest.Builder(FeedUpdateWorker.class)
.setInitialDelay(0L, TimeUnit.MILLISECONDS)
.setExpedited(OutOfQuotaPolicy.RUN_AS_NON_EXPEDITED_WORK_REQUEST)
@ -89,6 +92,11 @@ public class FeedUpdateManagerImpl extends FeedUpdateManager {
}
public void runOnceOrAsk(@NonNull Context context, @Nullable Feed feed) {
if (System.currentTimeMillis() - lastManualRefreshTime < REFRESH_COOLDOWN_MS) {
EventBus.getDefault().post(new MessageEvent(context.getString(R.string.please_wait_before_refreshing)));
EventBus.getDefault().postSticky(new FeedUpdateRunningEvent(false));
return;
}
Log.d(TAG, "Run auto update immediately in background.");
if (feed != null && feed.isLocalFeed()) {
runOnce(context, feed);

View File

@ -211,6 +211,7 @@
<string name="multi_select_started_talkback">Multi select actions shown at the bottom</string>
<string name="filtered_label">Filtered</string>
<string name="refresh_failed_msg">Last refresh failed. Tap to view details.</string>
<string name="please_wait_before_refreshing">Please wait some time before refreshing podcasts again.</string>
<string name="open_podcast">Open podcast</string>
<string name="please_wait_for_data">Please wait until the data is loaded</string>
<string name="updates_disabled_label">Updates disabled</string>