Left: | ||
Right: |
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-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 10 matching lines...) Expand all Loading... | |
21 | 21 |
22 const {Subscription, DownloadableSubscription, | 22 const {Subscription, DownloadableSubscription, |
23 SpecialSubscription} = require("subscriptionClasses"); | 23 SpecialSubscription} = require("subscriptionClasses"); |
24 const {FilterStorage} = require("filterStorage"); | 24 const {FilterStorage} = require("filterStorage"); |
25 const {FilterNotifier} = require("filterNotifier"); | 25 const {FilterNotifier} = require("filterNotifier"); |
26 const info = require("info"); | 26 const info = require("info"); |
27 const {Prefs} = require("prefs"); | 27 const {Prefs} = require("prefs"); |
28 const {Synchronizer} = require("synchronizer"); | 28 const {Synchronizer} = require("synchronizer"); |
29 const {Utils} = require("utils"); | 29 const {Utils} = require("utils"); |
30 const {initNotifications} = require("notificationHelper"); | 30 const {initNotifications} = require("notificationHelper"); |
31 const {updatesVersion} = require("ui"); | 31 const {updatesVersion} = require("../adblockplusui/lib/prefs"); |
32 | 32 |
33 let firstRun; | 33 let firstRun; |
34 let subscriptionsCallback = null; | 34 let subscriptionsCallback = null; |
35 | 35 |
36 /** | 36 /** |
37 * If there aren't any filters, the default subscriptions are added. | 37 * If there aren't any filters, the default subscriptions are added. |
38 * However, if patterns.ini already did exist and/or any preference | 38 * However, if patterns.ini already did exist and/or any preference |
39 * is set to a non-default value, this indicates that this isn't the | 39 * is set to a non-default value, this indicates that this isn't the |
40 * first run, but something went wrong. | 40 * first run, but something went wrong. |
41 * | 41 * |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
209 if (!Prefs.suppress_first_run_page) | 209 if (!Prefs.suppress_first_run_page) |
210 { | 210 { |
211 let page = null; | 211 let page = null; |
212 if (firstRun) | 212 if (firstRun) |
213 { | 213 { |
214 page = "firstRun.html"; | 214 page = "firstRun.html"; |
215 } | 215 } |
216 // For now we're limiting the updates page to users of | 216 // For now we're limiting the updates page to users of |
217 // Chromium-based browsers to gage its impact | 217 // Chromium-based browsers to gage its impact |
218 else if (info.platform == "chromium" && | 218 else if (info.platform == "chromium" && |
219 updatesVersion > Prefs.updates_version) | 219 updatesVersion > Prefs.last_updates_page_displayed) |
kzar
2018/01/23 10:07:13
Nit: This indentation is quite unusual, mind putti
Thomas Greiner
2018/01/25 11:09:45
Done.
I don't mind making such adjustments but it
kzar
2018/01/25 11:46:25
Yes, it would be great if ESLint could capture all
Thomas Greiner
2018/01/25 13:09:04
Just to clarify: I'm not talking about linting rul
| |
220 { | 220 { |
221 page = "updates.html"; | 221 page = "updates.html"; |
222 } | 222 } |
223 | 223 |
224 if (page) | 224 if (page) |
225 { | 225 { |
226 browser.tabs.create({url: browser.extension.getURL(page)}); | 226 browser.tabs.create({url: browser.extension.getURL(page)}); |
227 Prefs.updates_version = updatesVersion; | 227 |
kzar
2018/01/23 10:07:13
Mind adding a short comment here explaining that w
Thomas Greiner
2018/01/25 11:09:45
Done.
kzar
2018/01/25 11:46:25
Thanks but the main thing I wanted to mention was
Thomas Greiner
2018/01/25 13:09:03
Done. My bad.
Note that I replaced "the next time
| |
228 // For new users and users that have already seen this updates page we | |
229 // want to avoid showing it again for subsequent updates. | |
230 Prefs.last_updates_page_displayed = updatesVersion; | |
228 } | 231 } |
229 } | 232 } |
230 | 233 |
231 initNotifications(); | 234 initNotifications(); |
232 } | 235 } |
233 | 236 |
234 Promise.all([FilterNotifier.once("load"), | 237 Promise.all([FilterNotifier.once("load"), |
235 Prefs.untilLoaded]).then(detectFirstRun) | 238 Prefs.untilLoaded]).then(detectFirstRun) |
236 .then(getSubscriptions) | 239 .then(getSubscriptions) |
237 .then(finishInitialization); | 240 .then(finishInitialization); |
(...skipping 11 matching lines...) Expand all Loading... | |
249 * Sets a callback that is called with an array of subscriptions to be added | 252 * Sets a callback that is called with an array of subscriptions to be added |
250 * during initialization. The callback must return an array of subscriptions | 253 * during initialization. The callback must return an array of subscriptions |
251 * that will effectively be added. | 254 * that will effectively be added. |
252 * | 255 * |
253 * @param {function} callback | 256 * @param {function} callback |
254 */ | 257 */ |
255 exports.setSubscriptionsCallback = callback => | 258 exports.setSubscriptionsCallback = callback => |
256 { | 259 { |
257 subscriptionsCallback = callback; | 260 subscriptionsCallback = callback; |
258 }; | 261 }; |
LEFT | RIGHT |