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

Side by Side Diff: lib/uninstall.js

Issue 29336812: Issue 3649 - Group the notificationDownloadCount (Closed)
Patch Set: Created Feb. 22, 2016, 5:13 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 12 matching lines...) Expand all
23 23
24 function setUninstallURL() 24 function setUninstallURL()
25 { 25 {
26 let search = []; 26 let search = [];
27 let keys = ["addonName", "addonVersion", "application", "applicationVersion", 27 let keys = ["addonName", "addonVersion", "application", "applicationVersion",
28 "platform", "platformVersion"]; 28 "platform", "platformVersion"];
29 for (let key of keys) 29 for (let key of keys)
30 search.push(key + "=" + encodeURIComponent(info[key])); 30 search.push(key + "=" + encodeURIComponent(info[key]));
31 31
32 let downlCount = Prefs.notificationdata.downloadCount || 0; 32 let downlCount = Prefs.notificationdata.downloadCount || 0;
33
34 if (downlCount > 4)
35 {
36 if (downlCount < 8)
37 downlCount = "5-7";
38 else if (downlCount < 30)
39 downlCount = "8-29";
40 else if (downlCount < 90)
41 downlCount = "30-89";
42 else if (downlCount < 180)
43 downlCount = "90-179";
44 else
45 downlCount = "180+";
46 }
47
33 search.push("notificationDownloadCount=" + encodeURIComponent(downlCount)); 48 search.push("notificationDownloadCount=" + encodeURIComponent(downlCount));
34 49
35 chrome.runtime.setUninstallURL(Utils.getDocLink("uninstalled") + "&" + 50 chrome.runtime.setUninstallURL(Utils.getDocLink("uninstalled") + "&" +
36 search.join("&")); 51 search.join("&"));
37 } 52 }
38 53
39 // The uninstall URL contains the notification download count as a parameter, 54 // The uninstall URL contains the notification download count as a parameter,
40 // therefore we must wait for preferences to be loaded before generating the 55 // therefore we must wait for preferences to be loaded before generating the
41 // URL and we need to re-generate it each time the notification data changes. 56 // URL and we need to re-generate it each time the notification data changes.
42 if ("setUninstallURL" in chrome.runtime) 57 if ("setUninstallURL" in chrome.runtime)
43 { 58 {
44 Prefs.isLoaded.then(setUninstallURL); 59 Prefs.isLoaded.then(setUninstallURL);
45 Prefs.onChanged.addListener(function(name) 60 Prefs.onChanged.addListener(function(name)
46 { 61 {
47 if (name == "notificationdata") 62 if (name == "notificationdata")
48 setUninstallURL(); 63 setUninstallURL();
49 }); 64 });
50 } 65 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld