summaryrefslogtreecommitdiffstats
path: root/browser/components/newtab/lib/ActivityStream.sys.mjs
diff options
context:
space:
mode:
Diffstat (limited to 'browser/components/newtab/lib/ActivityStream.sys.mjs')
-rw-r--r--browser/components/newtab/lib/ActivityStream.sys.mjs61
1 files changed, 61 insertions, 0 deletions
diff --git a/browser/components/newtab/lib/ActivityStream.sys.mjs b/browser/components/newtab/lib/ActivityStream.sys.mjs
index fa2d011f11..430707ab5b 100644
--- a/browser/components/newtab/lib/ActivityStream.sys.mjs
+++ b/browser/components/newtab/lib/ActivityStream.sys.mjs
@@ -37,6 +37,7 @@ ChromeUtils.defineESModuleGetters(lazy, {
TopSitesFeed: "resource://activity-stream/lib/TopSitesFeed.sys.mjs",
TopStoriesFeed: "resource://activity-stream/lib/TopStoriesFeed.sys.mjs",
WallpaperFeed: "resource://activity-stream/lib/WallpaperFeed.sys.mjs",
+ WeatherFeed: "resource://activity-stream/lib/WeatherFeed.sys.mjs",
});
// NB: Eagerly load modules that will be loaded/constructed/initialized in the
@@ -57,6 +58,16 @@ function showSpocs({ geo }) {
return spocsGeo.includes(geo);
}
+function showWeather({ geo }) {
+ const weatherGeoString =
+ lazy.NimbusFeatures.pocketNewtab.getVariable("regionWeatherConfig") || "";
+ const weatherGeo = weatherGeoString
+ .split(",")
+ .map(s => s.trim())
+ .filter(item => item);
+ return weatherGeo.includes(geo);
+}
+
// Configure default Activity Stream prefs with a plain `value` or a `getValue`
// that computes a value. A `value_local_dev` is used for development defaults.
export const PREFS_CONFIG = new Map([
@@ -132,6 +143,50 @@ export const PREFS_CONFIG = new Map([
},
],
[
+ "system.showWeather",
+ {
+ title: "system.showWeather",
+ // pref is dynamic
+ getValue: showWeather,
+ },
+ ],
+ [
+ "showWeather",
+ {
+ title: "showWeather",
+ value: true,
+ },
+ ],
+ [
+ "weather.query",
+ {
+ title: "weather.query",
+ value: "",
+ },
+ ],
+ [
+ "weather.locationSearchEnabled",
+ {
+ title: "Enable the option to search for a specific city",
+ value: false,
+ },
+ ],
+ [
+ "weather.temperatureUnits",
+ {
+ title: "Switch the temperature between Celsius and Fahrenheit",
+ value: "f",
+ },
+ ],
+ [
+ "weather.display",
+ {
+ title:
+ "Toggle the weather widget to include a text summary of the current conditions",
+ value: "simple",
+ },
+ ],
+ [
"pocketCta",
{
title: "Pocket cta and button for logged out users.",
@@ -552,6 +607,12 @@ const FEEDS_DATA = [
title: "Handles fetching and managing wallpaper data from RemoteSettings",
value: true,
},
+ {
+ name: "weatherfeed",
+ factory: () => new lazy.WeatherFeed(),
+ title: "Handles fetching and caching weather data",
+ value: true,
+ },
];
const FEEDS_CONFIG = new Map();