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 29399749: Issue 5081 - Make libadblockplus-android users supply the application and applicationVersion parame… (Closed)
Left Patch Set: Created March 31, 2017, 1:28 p.m.
Right Patch Set: application/-Version are required now Created March 31, 2017, 3:09 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
« no previous file with change/comment | « no previous file | libadblockplus-android-webviewapp/src/org/adblockplus/libadblockplus/android/webviewapp/Application.java » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 * Init with context 104 * Init with context
105 * @param context application context 105 * @param context application context
106 * @param basePath file system root to store files 106 * @param basePath file system root to store files
107 * 107 *
108 * Adblock Plus library will download subscription files and s tore them on 108 * Adblock Plus library will download subscription files and s tore them on
109 * the path passed. The path should exist and the directory co ntent should not be 109 * the path passed. The path should exist and the directory co ntent should not be
110 * cleared out occasionally. Using `context.getCacheDir().getA bsolutePath()` is not 110 * cleared out occasionally. Using `context.getCacheDir().getA bsolutePath()` is not
111 * recommended because it can be cleared by the system. 111 * recommended because it can be cleared by the system.
112 * @param developmentBuild debug or release? 112 * @param developmentBuild debug or release?
113 * @param preferenceName Shared Preferences name to store adblock settings 113 * @param preferenceName Shared Preferences name to store adblock settings
114 */ 114 * @param application Technical name of the platform the app is running on (no t user visible).
115 public AdblockHelper init(Context context, String basePath, boolean developmen tBuild, String preferenceName) 115 * @param applicationVersion Current version of the platform the app is runnin g on.
116 */
117 public AdblockHelper init(Context context, String basePath,
118 boolean developmentBuild, String preferenceName,
119 String application, String applicationVersion)
116 { 120 {
117 this.context = context.getApplicationContext(); 121 this.context = context.getApplicationContext();
118 this.basePath = basePath; 122 this.basePath = basePath;
119 this.developmentBuild = developmentBuild; 123 this.developmentBuild = developmentBuild;
120 this.settingsPreferenceName = preferenceName; 124 this.settingsPreferenceName = preferenceName;
125 this.application = application;
126 this.applicationVersion = applicationVersion;
121 return this; 127 return this;
122 } 128 }
123 129
124 /** 130 /**
125 * Use preloaded subscriptions 131 * Use preloaded subscriptions
126 * @param preferenceName Shared Preferences name to store intercepted requests stats 132 * @param preferenceName Shared Preferences name to store intercepted requests stats
127 * @param urlToResourceIdMap 133 * @param urlToResourceIdMap
128 */ 134 */
129 public AdblockHelper preloadSubscriptions(String preferenceName, Map<String, I nteger> urlToResourceIdMap) 135 public AdblockHelper preloadSubscriptions(String preferenceName, Map<String, I nteger> urlToResourceIdMap)
130 { 136 {
131 this.preloadedPreferenceName = preferenceName; 137 this.preloadedPreferenceName = preferenceName;
132 this.urlToResourceIdMap = urlToResourceIdMap; 138 this.urlToResourceIdMap = urlToResourceIdMap;
133 return this;
134 }
135
136 /**
137 * Use for requests to identify the client
138 * @param application application
139 */
140 public AdblockHelper setApplication(String application)
141 {
142 this.application = application;
143 return this;
144 }
145
146 /**
147 * Use for requests to identify the client
148 * @param applicationVersion application
149 */
150 public AdblockHelper setApplicationVersion(String applicationVersion)
151 {
152 this.applicationVersion = applicationVersion;
153 return this; 139 return this;
diegocarloslima 2017/03/31 14:07:14 By the ticket description, it seems that applicati
anton 2017/03/31 14:16:08 if they are required then i agree. it's not clear
154 } 140 }
155 141
156 private void createAdblock() 142 private void createAdblock()
157 { 143 {
158 this.isAllowedConnectionCallback = new IsAllowedConnectionCallbackImpl(conte xt); 144 this.isAllowedConnectionCallback = new IsAllowedConnectionCallbackImpl(conte xt);
159 145
160 Log.d(TAG, "Creating adblock engine ..."); 146 Log.d(TAG, "Creating adblock engine ...");
161 147
162 // read and apply current settings 148 // read and apply current settings
163 SharedPreferences settingsPrefs = context.getSharedPreferences( 149 SharedPreferences settingsPrefs = context.getSharedPreferences(
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
309 engineCreated.countDown(); 295 engineCreated.countDown();
310 engineCreated = null; 296 engineCreated = null;
311 } 297 }
312 else 298 else
313 { 299 {
314 disposeAdblock(); 300 disposeAdblock();
315 } 301 }
316 } 302 }
317 } 303 }
318 } 304 }
LEFTRIGHT

Powered by Google App Engine
This is Rietveld