Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: adblockplussbrowser/src/main/java/org/adblockplus/sbrowser/contentblocker/engine/Subscriptions.java

Issue 29673565: Issue 6066 - Implement 'force update' functionality for subscriptions (Closed)
Patch Set: Fixes Created Jan. 23, 2018, 3:12 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: adblockplussbrowser/src/main/java/org/adblockplus/sbrowser/contentblocker/engine/Subscriptions.java
===================================================================
--- a/adblockplussbrowser/src/main/java/org/adblockplus/sbrowser/contentblocker/engine/Subscriptions.java
+++ b/adblockplussbrowser/src/main/java/org/adblockplus/sbrowser/contentblocker/engine/Subscriptions.java
@@ -113,17 +113,17 @@ final class Subscriptions
if (sub != null)
{
if (enabled != sub.isEnabled())
{
sub.setEnabled(enabled);
sub.serializeMetaData(this.getMetaFile(sub));
if (enabled)
{
- this.engine.enqueueDownload(sub, true);
+ this.engine.enqueueDownload(sub, true, false);
}
this.engine.subscriptionStateChanged();
this.engine.requestUpdateBroadcast();
return true;
}
}
return false;
@@ -178,17 +178,17 @@ final class Subscriptions
{
Log.d(TAG, "Adding filters for '" + s.getId() + "'");
s.deserializeFilters(this.getFiltersFile(s));
s.copyFilters(filters);
s.clearFilters();
}
if ((!s.isMetaDataValid() || !s.isFiltersValid()) && s.getURL() != null)
{
- this.engine.enqueueDownload(s, true);
+ this.engine.enqueueDownload(s, true, false);
}
}
try (final BufferedWriter w = new BufferedWriter(
new OutputStreamWriter(new FileOutputStream(output), StandardCharsets.UTF_8)))
{
Log.d(TAG, "Writing " + filters.size() + " filters");
Engine.writeFilterHeaders(w);
@@ -265,23 +265,23 @@ final class Subscriptions
final Subscription userSub = Subscription.createUserSubscription(title);
if (!this.subscriptions.containsKey(userSub.getId()))
{
this.subscriptions.put(userSub.getId(), userSub);
}
}
}
- public void checkForUpdates() throws IOException
+ public void checkForUpdates(final boolean forced, final boolean allowMetered) throws IOException
{
for (Subscription sub : this.subscriptions.values())
{
if (sub.isEnabled())
{
- this.engine.enqueueDownload(sub, false);
+ this.engine.enqueueDownload(sub, forced, allowMetered);
}
}
}
public void updateSubscription(final String id, final int responseCode, final String text,
final Map<String, String> httpHeaders)
throws IOException
{

Powered by Google App Engine
This is Rietveld