| 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-2017 eyeo GmbH | 3 * Copyright (C) 2006-2017 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 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 210 let notifications = localData.concat(remoteData); | 210 let notifications = localData.concat(remoteData); |
| 211 if (notifications.length === 0) | 211 if (notifications.length === 0) |
| 212 return null; | 212 return null; |
| 213 | 213 |
| 214 const {addonName, addonVersion, application, | 214 const {addonName, addonVersion, application, |
| 215 applicationVersion, platform, platformVersion} = require("info"); | 215 applicationVersion, platform, platformVersion} = require("info"); |
| 216 | 216 |
| 217 let targetChecks = { | 217 let targetChecks = { |
| 218 extension: v => v == addonName, | 218 extension: v => v == addonName, |
| 219 extensionMinVersion: | 219 extensionMinVersion: |
| 220 v => Services.vc.compare(addonVersion, v) >= 0, | 220 v => Services.vc.compare(addonVersion, v) >= 0, |
|
Wladimir Palant
2017/08/23 11:00:10
Here and below: we shouldn't have one-space indent
wspee
2017/08/24 16:39:22
Acknowledged.
| |
| 221 extensionMaxVersion: | 221 extensionMaxVersion: |
| 222 v => Services.vc.compare(addonVersion, v) <= 0, | 222 v => Services.vc.compare(addonVersion, v) <= 0, |
| 223 application: v => v == application, | 223 application: v => v == application, |
| 224 applicationMinVersion: | 224 applicationMinVersion: |
| 225 v => Services.vc.compare(applicationVersion, v) >= 0, | 225 v => Services.vc.compare(applicationVersion, v) >= 0, |
| 226 applicationMaxVersion: | 226 applicationMaxVersion: |
| 227 v => Services.vc.compare(applicationVersion, v) <= 0, | 227 v => Services.vc.compare(applicationVersion, v) <= 0, |
| 228 platform: v => v == platform, | 228 platform: v => v == platform, |
| 229 platformMinVersion: | 229 platformMinVersion: |
| 230 v => Services.vc.compare(platformVersion, v) >= 0, | 230 v => Services.vc.compare(platformVersion, v) >= 0, |
| 231 platformMaxVersion: | 231 platformMaxVersion: |
| 232 v => Services.vc.compare(platformVersion, v) <= 0, | 232 v => Services.vc.compare(platformVersion, v) <= 0, |
| 233 blockedTotalMin: v => Prefs.blocked_total >= v, | 233 blockedTotalMin: v => Prefs.show_statsinpopup && |
| 234 blockedTotalMax: v => Prefs.blocked_total <= v, | 234 Prefs.blocked_total >= v, |
| 235 locales: v => v.indexOf(Utils.appLocale) != -1 | 235 blockedTotalMax: v => Prefs.show_statsinpopup && |
|
Wladimir Palant
2017/08/23 11:00:10
Sorry, overlooked a detail in the previous review.
wspee
2017/08/24 16:39:22
Acknowledged.
| |
| 236 Prefs.blocked_total <= v, | |
| 237 locales: v => v.includes(Utils.appLocale) | |
| 236 }; | 238 }; |
| 237 | 239 |
| 238 let notificationToShow = null; | 240 let notificationToShow = null; |
| 239 for (let notification of notifications) | 241 for (let notification of notifications) |
| 240 { | 242 { |
| 241 if (typeof notification.type === "undefined" || | 243 if (typeof notification.type === "undefined" || |
| 242 notification.type !== "critical") | 244 notification.type !== "critical") |
| 243 { | 245 { |
| 244 let shown; | 246 let shown; |
| 245 if (typeof Prefs.notificationdata.shown == "object") | 247 if (typeof Prefs.notificationdata.shown == "object") |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 296 else | 298 else |
| 297 continue; | 299 continue; |
| 298 } | 300 } |
| 299 | 301 |
| 300 if (notification.targets instanceof Array) | 302 if (notification.targets instanceof Array) |
| 301 { | 303 { |
| 302 let match = false; | 304 let match = false; |
| 303 | 305 |
| 304 for (let target of notification.targets) | 306 for (let target of notification.targets) |
| 305 { | 307 { |
| 306 match = false; | |
|
Wladimir Palant
2017/08/23 11:00:11
This assignment is no longer necessary.
wspee
2017/08/24 16:39:22
Acknowledged.
| |
| 307 if (Object.keys(target).every(key => | 308 if (Object.keys(target).every(key => |
| 308 targetChecks.hasOwnProperty(key) && | 309 targetChecks.hasOwnProperty(key) && |
| 309 targetChecks[key](target[key]))) | 310 targetChecks[key](target[key]))) |
| 310 { | 311 { |
| 311 match = true; | 312 match = true; |
| 312 break; | 313 break; |
| 313 } | 314 } |
| 314 } | 315 } |
| 315 if (!match) | 316 if (!match) |
| 316 { | 317 { |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 480 else if (index != -1 && forceValue !== true) | 481 else if (index != -1 && forceValue !== true) |
| 481 categories.splice(index, 1); | 482 categories.splice(index, 1); |
| 482 | 483 |
| 483 // HACK: JSON values aren't saved unless they are assigned a | 484 // HACK: JSON values aren't saved unless they are assigned a |
| 484 // different object. | 485 // different object. |
| 485 Prefs.notifications_ignoredcategories = | 486 Prefs.notifications_ignoredcategories = |
| 486 JSON.parse(JSON.stringify(categories)); | 487 JSON.parse(JSON.stringify(categories)); |
| 487 } | 488 } |
| 488 }; | 489 }; |
| 489 Notification.init(); | 490 Notification.init(); |
| LEFT | RIGHT |