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

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

Issue 29399749: Issue 5081 - Make libadblockplus-android users supply the application and applicationVersion parame… (Closed)
Patch Set: minor reformatting Created March 31, 2017, 1:43 p.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
« no previous file with comments | « no previous file | libadblockplus-android-webviewapp/src/org/adblockplus/libadblockplus/android/webviewapp/Application.java » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: libadblockplus-android-settings/src/org/adblockplus/libadblockplus/android/settings/AdblockHelper.java
diff --git a/libadblockplus-android-settings/src/org/adblockplus/libadblockplus/android/settings/AdblockHelper.java b/libadblockplus-android-settings/src/org/adblockplus/libadblockplus/android/settings/AdblockHelper.java
index 21ff3dc51aa0584b9fd46cb0b4ec1cf0c93823a9..a2d38f86d87ae699cd22279ff4042d7ef70e755f 100644
--- a/libadblockplus-android-settings/src/org/adblockplus/libadblockplus/android/settings/AdblockHelper.java
+++ b/libadblockplus-android-settings/src/org/adblockplus/libadblockplus/android/settings/AdblockHelper.java
@@ -22,12 +22,10 @@ import android.content.SharedPreferences;
import android.util.Log;
import org.adblockplus.libadblockplus.IsAllowedConnectionCallback;
-import org.adblockplus.libadblockplus.UpdateCheckDoneCallback;
import org.adblockplus.libadblockplus.android.AdblockEngine;
import org.adblockplus.libadblockplus.android.AndroidWebRequestResourceWrapper;
import org.adblockplus.libadblockplus.android.Utils;
-import java.io.File;
import java.util.Map;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.atomic.AtomicInteger;
@@ -57,6 +55,8 @@ public class AdblockHelper
private String settingsPreferenceName;
private String preloadedPreferenceName;
private Map<String, Integer> urlToResourceIdMap;
+ private String application;
+ private String applicationVersion;
private AdblockEngine engine;
private AdblockSettingsStorage storage;
private CountDownLatch engineCreated;
@@ -126,10 +126,31 @@ public class AdblockHelper
* @param preferenceName Shared Preferences name to store intercepted requests stats
* @param urlToResourceIdMap
*/
- public void preloadSubscriptions(String preferenceName, Map<String, Integer> urlToResourceIdMap)
+ public AdblockHelper preloadSubscriptions(String preferenceName, Map<String, Integer> urlToResourceIdMap)
{
this.preloadedPreferenceName = preferenceName;
this.urlToResourceIdMap = urlToResourceIdMap;
+ return this;
+ }
+
+ /**
+ * Used for requests to identify the client
Felix Dahlke 2017/03/31 14:06:57 Nit: We should probably use more concrete descript
+ * @param application application
+ */
+ public AdblockHelper setApplication(String application)
+ {
+ this.application = application;
+ return this;
+ }
+
+ /**
+ * Used for requests to identify the client
+ * @param applicationVersion application version
+ */
+ public AdblockHelper setApplicationVersion(String applicationVersion)
+ {
+ this.applicationVersion = applicationVersion;
+ return this;
}
private void createAdblock()
@@ -146,7 +167,7 @@ public class AdblockHelper
AdblockEngine.Builder builder = AdblockEngine
.builder(
- AdblockEngine.generateAppInfo(context, developmentBuild),
+ AdblockEngine.generateAppInfo(context, developmentBuild, application, applicationVersion),
basePath)
.setIsAllowedConnectionCallback(isAllowedConnectionCallback)
.enableElementHiding(true);
« no previous file with comments | « no previous file | libadblockplus-android-webviewapp/src/org/adblockplus/libadblockplus/android/webviewapp/Application.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld