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 29760569: Issue 6238 - Download/store notifications.json (Closed)
Patch Set: Created May 15, 2018, 9:57 a.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
@@ -26,16 +26,17 @@ import java.nio.charset.StandardCharsets
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import org.adblockplus.sbrowser.contentblocker.engine.Subscription.Type;
+import org.adblockplus.sbrowser.contentblocker.util.SubscriptionUtils;
import android.util.Log;
/**
* This class holds all listed subscriptions and manages the subscription
* aggregation cache folder.
*/
final class Subscriptions
@@ -139,16 +140,21 @@ final class Subscriptions
else
{
filtersFile = new File(this.subscriptionFolder, "url_"
+ new File(sub.getURL().getPath()).getName() + ".sub");
}
return filtersFile;
}
+ File getNotificationDataFile()
+ {
+ return new File (this.subscriptionFolder, Notification.NOTIFICATION_DATA_FILE_NAME);
+ }
+
File getMetaFile(final Subscription sub)
{
return new File(getFiltersFile(sub).getAbsolutePath() + ".meta");
}
void persistSubscription(final Subscription sub) throws IOException
{
sub.serializeSubscription(this.getMetaFile(sub), this.getFiltersFile(sub));
@@ -169,17 +175,17 @@ final class Subscriptions
* @param output
* @throws IOException
*/
private void writeFile(final File output) throws IOException
{
final HashSet<String> filters = new HashSet<>();
for (final Subscription s : this.subscriptions.values())
{
- if (s.isEnabled())
+ if (s.isEnabled() && !SubscriptionUtils.isNotificationSubscription(s.getId()))
{
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)
{

Powered by Google App Engine
This is Rietveld