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

Unified Diff: libadblockplus-android/src/org/adblockplus/libadblockplus/android/AdblockEngine.java

Issue 29405564: Issue 5121 - Use Acceptable Ads API in libadblockplus (Closed)
Patch Set: removed comment Created April 28, 2017, 6:20 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: libadblockplus-android/src/org/adblockplus/libadblockplus/android/AdblockEngine.java
diff --git a/libadblockplus-android/src/org/adblockplus/libadblockplus/android/AdblockEngine.java b/libadblockplus-android/src/org/adblockplus/libadblockplus/android/AdblockEngine.java
index 9f4e981b89aa4eb788acaff233f9f14abffbcba9..82341ade131451ab742848f26322fc5e7b64d6a6 100644
--- a/libadblockplus-android/src/org/adblockplus/libadblockplus/android/AdblockEngine.java
+++ b/libadblockplus-android/src/org/adblockplus/libadblockplus/android/AdblockEngine.java
@@ -510,41 +510,6 @@ public final class AdblockEngine
}
}
- public boolean isAcceptableAdsEnabled()
- {
- final String url = getAcceptableAdsSubscriptionURL();
- List<Subscription> subscriptions = this.filterEngine.getListedSubscriptions();
- try
- {
- for (Subscription eachSubscription : subscriptions)
- {
- JsValue jsUrl = eachSubscription.getProperty("url");
- try
- {
- if (jsUrl.toString().equals(url))
- {
- return true;
- }
- }
- finally
- {
- jsUrl.dispose();
- }
- }
- return false;
- }
- finally
- {
- if (subscriptions != null)
- {
- for (Subscription eachSubscription : subscriptions)
- {
- eachSubscription.dispose();
- }
- }
- }
- }
-
public void setEnabled(final boolean enabled)
{
this.enabled = enabled;
@@ -557,39 +522,17 @@ public final class AdblockEngine
public String getAcceptableAdsSubscriptionURL()
{
- JsValue jsPref = this.filterEngine.getPref("subscriptions_exceptionsurl");
- try
- {
- return jsPref.toString();
- }
- finally
- {
- jsPref.dispose();
- }
+ return filterEngine.getAcceptableAdsSubscriptionURL();
+ }
+
+ public boolean isAcceptableAdsEnabled()
+ {
+ return filterEngine.isAcceptableAdsEnabled();
}
public void setAcceptableAdsEnabled(final boolean enabled)
{
- final String url = getAcceptableAdsSubscriptionURL();
- final Subscription sub = this.filterEngine.getSubscription(url);
- if (sub != null)
- {
- try
- {
- if (enabled)
- {
- sub.addToList();
- }
- else
- {
- sub.removeFromList();
- }
- }
- finally
- {
- sub.dispose();
- }
- }
+ filterEngine.setAcceptableAdsEnabled(enabled);
}
public String getDocumentationLink()

Powered by Google App Engine
This is Rietveld