зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1612337 - Moving to ff prefs r=nanj
Differential Revision: https://phabricator.services.mozilla.com/D61602 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
0e678d8a9a
Коммит
97881e96fc
|
@ -1300,6 +1300,10 @@ pref("browser.newtabpage.activity-stream.discoverystream.hardcoded-basic-layout"
|
||||||
pref("browser.newtabpage.activity-stream.discoverystream.spocs-endpoint", "");
|
pref("browser.newtabpage.activity-stream.discoverystream.spocs-endpoint", "");
|
||||||
// List of langs that get the 7 row layout.
|
// List of langs that get the 7 row layout.
|
||||||
pref("browser.newtabpage.activity-stream.discoverystream.lang-layout-config", "en");
|
pref("browser.newtabpage.activity-stream.discoverystream.lang-layout-config", "en");
|
||||||
|
// Switch between different versions of the recommendation provider.
|
||||||
|
pref("browser.newtabpage.activity-stream.discoverystream.personalization.version", 1);
|
||||||
|
// Configurable keys used by personalization version 2.
|
||||||
|
pref("browser.newtabpage.activity-stream.discoverystream.personalization.modelKeys", "nb_model_business, nb_model_career, nb_model_education, nb_model_entertainment, nb_model_environment, nb_model_food, nb_model_gaming, nb_model_health_fitness, nb_model_parenting, nb_model_personal_finance, nb_model_politics, nb_model_science, nb_model_self_improvement, nb_model_sports, nb_model_technology, nb_model_travel");
|
||||||
|
|
||||||
// The pref controls if search hand-off is enabled for Activity Stream.
|
// The pref controls if search hand-off is enabled for Activity Stream.
|
||||||
#ifdef NIGHTLY_BUILD
|
#ifdef NIGHTLY_BUILD
|
||||||
|
|
|
@ -239,13 +239,6 @@ const PREFS_CONFIG = new Map([
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
[
|
|
||||||
"discoverystream.personalization.version",
|
|
||||||
{
|
|
||||||
title: "",
|
|
||||||
value: 1,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
[
|
[
|
||||||
"showSponsored",
|
"showSponsored",
|
||||||
{
|
{
|
||||||
|
@ -254,14 +247,6 @@ const PREFS_CONFIG = new Map([
|
||||||
value: true,
|
value: true,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
[
|
|
||||||
"discoverystream.personalization.modelKeys",
|
|
||||||
{
|
|
||||||
title: "Configurable keys used by personalization version 2.",
|
|
||||||
value:
|
|
||||||
"nb_model_business, nb_model_career, nb_model_education, nb_model_entertainment, nb_model_environment, nb_model_food, nb_model_gaming, nb_model_health_fitness, nb_model_parenting, nb_model_personal_finance, nb_model_politics, nb_model_science, nb_model_self_improvement, nb_model_sports, nb_model_technology, nb_model_travel",
|
|
||||||
},
|
|
||||||
],
|
|
||||||
[
|
[
|
||||||
"pocketCta",
|
"pocketCta",
|
||||||
{
|
{
|
||||||
|
|
|
@ -41,6 +41,27 @@ this.PrefsFeed = class PrefsFeed {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_setStringPref(values, key, defaultValue) {
|
||||||
|
this._setPref(values, key, defaultValue, Services.prefs.getStringPref);
|
||||||
|
}
|
||||||
|
|
||||||
|
_setBoolPref(values, key, defaultValue) {
|
||||||
|
this._setPref(values, key, defaultValue, Services.prefs.getBoolPref);
|
||||||
|
}
|
||||||
|
|
||||||
|
_setIntPref(values, key, defaultValue) {
|
||||||
|
this._setPref(values, key, defaultValue, Services.prefs.getIntPref);
|
||||||
|
}
|
||||||
|
|
||||||
|
_setPref(values, key, defaultValue, getPrefFunction) {
|
||||||
|
let value = getPrefFunction(
|
||||||
|
`browser.newtabpage.activity-stream.${key}`,
|
||||||
|
defaultValue
|
||||||
|
);
|
||||||
|
values[key] = value;
|
||||||
|
this._prefMap.set(key, { value });
|
||||||
|
}
|
||||||
|
|
||||||
init() {
|
init() {
|
||||||
this._prefs.observeBranch(this);
|
this._prefs.observeBranch(this);
|
||||||
this._storage = this.store.dbStorage.getDbTable("sectionPrefs");
|
this._storage = this.store.dbStorage.getDbTable("sectionPrefs");
|
||||||
|
@ -90,42 +111,16 @@ this.PrefsFeed = class PrefsFeed {
|
||||||
value: handoffToAwesomebarPrefValue,
|
value: handoffToAwesomebarPrefValue,
|
||||||
});
|
});
|
||||||
|
|
||||||
let discoveryStreamEnabled = Services.prefs.getBoolPref(
|
this._setBoolPref(values, "discoverystream.enabled", false);
|
||||||
"browser.newtabpage.activity-stream.discoverystream.enabled",
|
this._setBoolPref(values, "discoverystream.hardcoded-basic-layout", false);
|
||||||
false
|
this._setStringPref(values, "discoverystream.lang-layout-config", "");
|
||||||
);
|
this._setStringPref(
|
||||||
let discoveryStreamHardcodedBasicLayout = Services.prefs.getBoolPref(
|
values,
|
||||||
"browser.newtabpage.activity-stream.discoverystream.hardcoded-basic-layout",
|
"discoverystream.personalization.modelKeys",
|
||||||
false
|
|
||||||
);
|
|
||||||
let discoveryStreamSpocsEndpoint = Services.prefs.getStringPref(
|
|
||||||
"browser.newtabpage.activity-stream.discoverystream.spocs-endpoint",
|
|
||||||
""
|
""
|
||||||
);
|
);
|
||||||
let discoveryStreamLangLayoutConfig = Services.prefs.getStringPref(
|
this._setIntPref(values, "discoverystream.personalization.version", 1);
|
||||||
"browser.newtabpage.activity-stream.discoverystream.lang-layout-config",
|
this._setStringPref(values, "discoverystream.spocs-endpoint", "");
|
||||||
""
|
|
||||||
);
|
|
||||||
values["discoverystream.enabled"] = discoveryStreamEnabled;
|
|
||||||
this._prefMap.set("discoverystream.enabled", {
|
|
||||||
value: discoveryStreamEnabled,
|
|
||||||
});
|
|
||||||
values[
|
|
||||||
"discoverystream.hardcoded-basic-layout"
|
|
||||||
] = discoveryStreamHardcodedBasicLayout;
|
|
||||||
this._prefMap.set("discoverystream.hardcoded-basic-layout", {
|
|
||||||
value: discoveryStreamHardcodedBasicLayout,
|
|
||||||
});
|
|
||||||
values["discoverystream.spocs-endpoint"] = discoveryStreamSpocsEndpoint;
|
|
||||||
this._prefMap.set("discoverystream.spocs-endpoint", {
|
|
||||||
value: discoveryStreamSpocsEndpoint,
|
|
||||||
});
|
|
||||||
values[
|
|
||||||
"discoverystream.lang-layout-config"
|
|
||||||
] = discoveryStreamLangLayoutConfig;
|
|
||||||
this._prefMap.set("discoverystream.lang-layout-config", {
|
|
||||||
value: discoveryStreamLangLayoutConfig,
|
|
||||||
});
|
|
||||||
|
|
||||||
// Set the initial state of all prefs in redux
|
// Set the initial state of all prefs in redux
|
||||||
this.store.dispatch(
|
this.store.dispatch(
|
||||||
|
|
|
@ -25,6 +25,7 @@ describe("PrefsFeed", () => {
|
||||||
prefs: {
|
prefs: {
|
||||||
clearUserPref: sinon.spy(),
|
clearUserPref: sinon.spy(),
|
||||||
getStringPref: sinon.spy(),
|
getStringPref: sinon.spy(),
|
||||||
|
getIntPref: sinon.spy(),
|
||||||
getBoolPref: sinon.spy(),
|
getBoolPref: sinon.spy(),
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
Загрузка…
Ссылка в новой задаче