Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Delta Between Two Patch Sets: lib/notification.js

Issue 29501607: Issue 5459 - Add support to show a notification based on the number of ads blocked (Closed)
Left Patch Set: Addressed review comments Created Aug. 24, 2017, 4:28 p.m.
Right Patch Set: Show notification for blockedTotal* only if Prefs.show_statsinpopup Created Aug. 24, 2017, 4:35 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 | test/notification.js » ('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-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 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 blockedTotalMax: v => Prefs.show_statsinpopup &&
236 Prefs.blocked_total <= v,
235 locales: v => v.includes(Utils.appLocale) 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;
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
479 else if (index != -1 && forceValue !== true) 481 else if (index != -1 && forceValue !== true)
480 categories.splice(index, 1); 482 categories.splice(index, 1);
481 483
482 // HACK: JSON values aren't saved unless they are assigned a 484 // HACK: JSON values aren't saved unless they are assigned a
483 // different object. 485 // different object.
484 Prefs.notifications_ignoredcategories = 486 Prefs.notifications_ignoredcategories =
485 JSON.parse(JSON.stringify(categories)); 487 JSON.parse(JSON.stringify(categories));
486 } 488 }
487 }; 489 };
488 Notification.init(); 490 Notification.init();
LEFTRIGHT

Powered by Google App Engine
This is Rietveld