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

Delta Between Two Patch Sets: libadblockplus-android-settings/src/org/adblockplus/libadblockplus/android/settings/AdblockHelper.java

Issue 29379647: Issue 4948 - add possibility to not send data depending on connection properties (Closed)
Left Patch Set: felix's comments Created March 24, 2017, 9:46 a.m.
Right Patch Set: updated dependency to binaries, updated comment for allowed connection type Created March 30, 2017, 2:12 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
LEFTRIGHT
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-2016 Eyeo GmbH 3 * Copyright (C) 2006-2016 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 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 true, // `true` as we need element hiding 121 true, // `true` as we need element hiding
122 isAllowedConnectionCallback); 122 isAllowedConnectionCallback);
123 Log.d(TAG, "Adblock engine created"); 123 Log.d(TAG, "Adblock engine created");
124 124
125 AdblockSettings settings = storage.load(); 125 AdblockSettings settings = storage.load();
126 if (settings != null) 126 if (settings != null)
127 { 127 {
128 Log.d(TAG, "Applying saved adblock settings to adblock engine"); 128 Log.d(TAG, "Applying saved adblock settings to adblock engine");
129 // apply last saved settings to adblock engine 129 // apply last saved settings to adblock engine
130 130
131 // all the settings except `enabled`, whitelisted domains list 131 // all the settings except `enabled` and whitelisted domains list
132 // and allowed connection type are saved by adblock engine itself 132 // are saved by adblock engine itself
133 engine.setEnabled(settings.isAdblockEnabled()); 133 engine.setEnabled(settings.isAdblockEnabled());
134 engine.setWhitelistedDomains(settings.getWhitelistedDomains()); 134 engine.setWhitelistedDomains(settings.getWhitelistedDomains());
135 135
136 // allowed connection type is saved by filter engine but we need to overri de it
137 // as filter engine can be not created when changing
136 String connectionType = (settings.getAllowedConnectionType() != null 138 String connectionType = (settings.getAllowedConnectionType() != null
137 ? settings.getAllowedConnectionType().getValue() 139 ? settings.getAllowedConnectionType().getValue()
138 : null); 140 : null);
139 engine.getFilterEngine().setAllowedConnectionType(connectionType); 141 engine.getFilterEngine().setAllowedConnectionType(connectionType);
140 } 142 }
141 else 143 else
142 { 144 {
143 Log.w(TAG, "No saved adblock settings"); 145 Log.w(TAG, "No saved adblock settings");
144 } 146 }
145 147
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 */ 232 */
231 public synchronized void release() 233 public synchronized void release()
232 { 234 {
233 if (referenceCounter.decrementAndGet() == 0) 235 if (referenceCounter.decrementAndGet() == 0)
234 { 236 {
235 waitForReady(); 237 waitForReady();
236 disposeAdblock(); 238 disposeAdblock();
237 } 239 }
238 } 240 }
239 } 241 }
LEFTRIGHT

Powered by Google App Engine
This is Rietveld