| Left: | ||
| Right: |
| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * This file is part of Adblock Plus <https://adblockplus.org/>, | 2 * This file is part of Adblock Plus <https://adblockplus.org/>, |
| 3 * Copyright (C) 2006-present eyeo GmbH | 3 * Copyright (C) 2006-present eyeo GmbH |
| 4 * | 4 * |
| 5 * Adblock Plus is free software: you can redistribute it and/or modify | 5 * Adblock Plus is free software: you can redistribute it and/or modify |
| 6 * it under the terms of the GNU General Public License version 3 as | 6 * it under the terms of the GNU General Public License version 3 as |
| 7 * published by the Free Software Foundation. | 7 * published by the Free Software Foundation. |
| 8 * | 8 * |
| 9 * Adblock Plus is distributed in the hope that it will be useful, | 9 * Adblock Plus is distributed in the hope that it will be useful, |
| 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 196 { | 196 { |
| 197 // This is a temporary fix to not write filters that might crash Samsung Internet | 197 // This is a temporary fix to not write filters that might crash Samsung Internet |
| 198 // See https://issues.adblockplus.org/ticket/4772 | 198 // See https://issues.adblockplus.org/ticket/4772 |
| 199 if (!filter.matches(UNSUPPORTED_FILTERS_REGEX)) | 199 if (!filter.matches(UNSUPPORTED_FILTERS_REGEX)) |
| 200 { | 200 { |
| 201 w.write(filter); | 201 w.write(filter); |
| 202 w.write('\n'); | 202 w.write('\n'); |
| 203 } | 203 } |
| 204 else | 204 else |
| 205 { | 205 { |
| 206 w.write(filter); | |
| 207 w.write('\n'); | |
|
diegocarloslima
2017/09/22 17:43:43
We shouldn't revert this temporary fix in this tic
jens
2017/09/26 10:25:02
Sorry, I don't know how these two lines slipped in
| |
| 206 Log.d(TAG, "Ignoring unsupported filter: " + filter); | 208 Log.d(TAG, "Ignoring unsupported filter: " + filter); |
| 207 } | 209 } |
| 208 } | 210 } |
| 209 } | 211 } |
| 210 } | 212 } |
| 211 | 213 |
| 212 public Subscription add(final Subscription sub) | 214 public Subscription add(final Subscription sub) |
| 213 { | 215 { |
| 214 final String id = sub.getId(); | 216 final String id = sub.getId(); |
| 215 if (!this.subscriptions.containsKey(id)) | 217 if (!this.subscriptions.containsKey(id)) |
| 216 { | 218 { |
| 217 this.subscriptions.put(id, sub); | 219 this.subscriptions.put(id, sub); |
| 218 return sub; | 220 return sub; |
| 219 } | 221 } |
| 220 return this.subscriptions.get(id); | 222 return this.subscriptions.get(id); |
| 221 } | 223 } |
| 222 | 224 |
| 225 public boolean remove(final String id) | |
| 226 { | |
| 227 return this.subscriptions.remove(id) != null; | |
| 228 } | |
| 229 | |
| 223 public static Subscriptions initialize(final Engine engine, final File appFold er, | 230 public static Subscriptions initialize(final Engine engine, final File appFold er, |
| 224 final File cacheFolder) | 231 final File cacheFolder) |
| 225 { | 232 { |
| 226 final Subscriptions subs = new Subscriptions(engine, appFolder, cacheFolder) ; | 233 final Subscriptions subs = new Subscriptions(engine, appFolder, cacheFolder) ; |
| 227 | 234 |
| 228 subs.subscriptionFolder.mkdirs(); | 235 subs.subscriptionFolder.mkdirs(); |
| 229 subs.cacheFolder.mkdirs(); | 236 subs.cacheFolder.mkdirs(); |
| 230 | 237 |
| 231 final File[] files = subs.subscriptionFolder.listFiles(); | 238 final File[] files = subs.subscriptionFolder.listFiles(); |
| 232 for (File f : files) | 239 for (File f : files) |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 284 if (sub != null) | 291 if (sub != null) |
| 285 { | 292 { |
| 286 if (sub.updateSubscription(responseCode, text, httpHeaders, this.getMetaFi le(sub), | 293 if (sub.updateSubscription(responseCode, text, httpHeaders, this.getMetaFi le(sub), |
| 287 this.getFiltersFile(sub))) | 294 this.getFiltersFile(sub))) |
| 288 { | 295 { |
| 289 this.engine.requestUpdateBroadcast(); | 296 this.engine.requestUpdateBroadcast(); |
| 290 } | 297 } |
| 291 } | 298 } |
| 292 } | 299 } |
| 293 } | 300 } |
| OLD | NEW |