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 | 31 const {updatesVersion} = require("../adblockplusui/lib/prefs"); |
32 /** | |
33 * The version of major updates that the user should be aware of. | |
34 * See also Prefs.lastUpdatesVersion | |
35 * | |
36 * @type {number} | |
37 */ | |
38 const updatesVersion = 1; | |
kzar
2018/01/15 11:58:35
I figured we should instead reuse the extension's
Thomas Greiner
2018/01/17 18:00:06
I'm wondering whether we (a) will always increment
Sebastian Noack
2018/01/18 12:46:48
This is not true. We only advanced the version to
Thomas Greiner
2018/01/18 13:36:01
My bad, I looked at a local build of mine which I
Sebastian Noack
2018/01/18 16:23:12
Oh, that was a mistake. We should not have advance
| |
39 | 32 |
40 let firstRun; | 33 let firstRun; |
41 let subscriptionsCallback = null; | 34 let subscriptionsCallback = null; |
42 | 35 |
43 /** | 36 /** |
44 * If there aren't any filters, the default subscriptions are added. | 37 * If there aren't any filters, the default subscriptions are added. |
45 * However, if patterns.ini already did exist and/or any preference | 38 * However, if patterns.ini already did exist and/or any preference |
46 * 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 |
47 * first run, but something went wrong. | 40 * first run, but something went wrong. |
48 * | 41 * |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
214 } | 207 } |
215 | 208 |
216 if (!Prefs.suppress_first_run_page) | 209 if (!Prefs.suppress_first_run_page) |
217 { | 210 { |
218 let page = null; | 211 let page = null; |
219 if (firstRun) | 212 if (firstRun) |
220 { | 213 { |
221 page = "firstRun.html"; | 214 page = "firstRun.html"; |
222 } | 215 } |
223 // For now we're limiting the updates page to users of | 216 // For now we're limiting the updates page to users of |
224 // Chromium-based browsers to gage its impact | 217 // Chromium-based browsers to gage its impact |
kzar
2018/01/15 11:58:35
That's not mentioned in the issue, would you mind
Thomas Greiner
2018/01/17 18:00:06
Weird, I actually thought it'd be in the spec sinc
kzar
2018/01/18 10:53:13
Acknowledged.
Sebastian Noack
2018/01/18 12:46:48
Well, the current update page, announces the new o
Thomas Greiner
2018/01/18 13:36:01
I haven't heard back yet on whether we want to men
| |
225 else if (info.platform == "chromium" && | 218 else if (info.platform == "chromium" && |
226 updatesVersion > Prefs.lastUpdatesVersion) | 219 updatesVersion > Prefs.last_updates_page_displayed) |
kzar
2018/01/15 11:58:35
I guess this comparison gets a little trickier wit
kzar
2018/01/15 12:17:20
In fact if you like I'll add this to adblockplusch
Thomas Greiner
2018/01/17 18:00:06
We used to use Firefox' `Services.vc.compare()` fo
kzar
2018/01/18 10:53:13
Good point, yes we should reuse that instead of re
Sebastian Noack
2018/01/18 12:46:48
For reference, originally the version comparison l
Thomas Greiner
2018/01/18 13:36:01
That means that none of our devbuild users will re
Sebastian Noack
2018/01/18 16:23:12
Well, we have to special case either Firefox or Ch
kzar
2018/01/19 11:05:23
Yea, I'm coming around to the idea of having the s
| |
227 { | 220 { |
228 page = "updates.html"; | 221 page = "updates.html"; |
229 } | 222 } |
230 | 223 |
231 if (page) | 224 if (page) |
232 { | 225 { |
233 browser.tabs.create({url: browser.extension.getURL(page)}); | 226 browser.tabs.create({url: browser.extension.getURL(page)}); |
Thomas Greiner
2018/01/12 16:33:39
Note that in later versions we can simply use `Pre
kzar
2018/01/18 10:53:13
I'm not quite sure how that would work. So the pla
kzar
2018/01/18 11:38:24
Hmm, I suppose we need to make sure the updates pa
Thomas Greiner
2018/01/18 11:50:26
Yep, the simplest way would be to pass it as a GET
kzar
2018/01/18 12:01:39
Generally I agree about not implementing stuff bef
Sebastian Noack
2018/01/18 12:46:48
FWIW, I think, in the (rather theoretical) scenari
Thomas Greiner
2018/01/18 13:36:01
Ok, so if Dave agrees with that as well I'd not im
kzar
2018/01/19 11:05:23
Alright then, seems I'm outnumbered.
| |
234 Prefs.lastUpdatesVersion = updatesVersion; | 227 |
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; | |
235 } | 231 } |
236 } | 232 } |
237 | 233 |
238 initNotifications(); | 234 initNotifications(); |
239 } | 235 } |
240 | 236 |
241 Promise.all([FilterNotifier.once("load"), | 237 Promise.all([FilterNotifier.once("load"), |
242 Prefs.untilLoaded]).then(detectFirstRun) | 238 Prefs.untilLoaded]).then(detectFirstRun) |
243 .then(getSubscriptions) | 239 .then(getSubscriptions) |
244 .then(finishInitialization); | 240 .then(finishInitialization); |
(...skipping 11 matching lines...) Expand all Loading... | |
256 * 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 |
257 * during initialization. The callback must return an array of subscriptions | 253 * during initialization. The callback must return an array of subscriptions |
258 * that will effectively be added. | 254 * that will effectively be added. |
259 * | 255 * |
260 * @param {function} callback | 256 * @param {function} callback |
261 */ | 257 */ |
262 exports.setSubscriptionsCallback = callback => | 258 exports.setSubscriptionsCallback = callback => |
263 { | 259 { |
264 subscriptionsCallback = callback; | 260 subscriptionsCallback = callback; |
265 }; | 261 }; |
LEFT | RIGHT |