LEFT | RIGHT |
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 Loading... |
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 * Technical name of the platform the app is running on (not user visible). | |
138 * @param application application | |
139 */ | |
140 public AdblockHelper setApplication(String application) | |
141 { | |
142 this.application = application; | |
143 return this; | |
144 } | |
145 | |
146 /** | |
147 * Current version of the platform the app is running on. | |
148 * @param applicationVersion platform version | |
149 */ | |
150 public AdblockHelper setApplicationVersion(String applicationVersion) | |
151 { | |
152 this.applicationVersion = applicationVersion; | |
153 return this; | 139 return this; |
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 |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 } |
LEFT | RIGHT |