Index: src/org/adblockplus/android/AndroidFilterChangeCallback.java |
diff --git a/src/org/adblockplus/brazil/TransparentProxyHandler.java b/src/org/adblockplus/android/AndroidFilterChangeCallback.java |
similarity index 51% |
copy from src/org/adblockplus/brazil/TransparentProxyHandler.java |
copy to src/org/adblockplus/android/AndroidFilterChangeCallback.java |
index 87abada97d2e35348bb9bbeb09686892baf71a73..f07836c5b4162160706fc92ea7c96df54e8235ab 100644 |
--- a/src/org/adblockplus/brazil/TransparentProxyHandler.java |
+++ b/src/org/adblockplus/android/AndroidFilterChangeCallback.java |
@@ -15,35 +15,31 @@ |
* along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. |
*/ |
-package org.adblockplus.brazil; |
+package org.adblockplus.android; |
-import java.io.IOException; |
+import org.adblockplus.libadblockplus.FilterChangeCallback; |
+import org.adblockplus.libadblockplus.JsValue; |
+import org.adblockplus.libadblockplus.Subscription; |
-import sunlabs.brazil.server.Handler; |
-import sunlabs.brazil.server.Request; |
-import sunlabs.brazil.server.Server; |
+import android.content.Context; |
-/** |
- * Reconstructs request url to comply with proxy specification if transparent |
- * proxy is used. |
- */ |
-public class TransparentProxyHandler implements Handler |
+public class AndroidFilterChangeCallback extends FilterChangeCallback |
{ |
+ private final Context context; |
- @Override |
- public boolean init(Server server, String prefix) |
+ public AndroidFilterChangeCallback(final Context context) |
{ |
- return true; |
+ this.context = context; |
} |
@Override |
- public boolean respond(Request request) throws IOException |
+ public void filterChangeCallback(final String action, final JsValue jsValue) |
{ |
- if (!request.url.contains("://")) |
+ if (action.equals("subscription.lastDownload") || action.equals("subscription.downloadStatus")) |
{ |
- request.url = "http://" + request.headers.get("host") + request.url; |
+ final Subscription sub = new Subscription(jsValue); |
+ |
+ Utils.updateSubscriptionStatus(this.context, sub); |
} |
- return false; |
} |
- |
} |