Bug 1620029 - Simplified about:welcome seen pref update r=k88hudson,mconley

Differential Revision: https://phabricator.services.mozilla.com/D65608

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Punam Dahiya 2020-03-06 23:33:04 +00:00
Родитель a48980ac8c
Коммит 18fa7b220b
3 изменённых файлов: 33 добавлений и 15 удалений

Просмотреть файл

@ -5,6 +5,7 @@
"use strict";
const EXPORTED_SYMBOLS = ["AboutWelcomeParent"];
const { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
const { XPCOMUtils } = ChromeUtils.import(
"resource://gre/modules/XPCOMUtils.jsm"
@ -30,6 +31,8 @@ XPCOMUtils.defineLazyGetter(
() => new AboutWelcomeTelemetry()
);
const DID_SEE_ABOUT_WELCOME_PREF = "trailhead.firstrun.didSeeAboutWelcome";
class AboutWelcomeParent extends JSWindowActorParent {
/**
* Handle messages from AboutWelcomeChild.jsm
@ -42,6 +45,13 @@ class AboutWelcomeParent extends JSWindowActorParent {
onContentMessage(type, data, browser, window) {
log.debug(`Received content event: ${type}`);
switch (type) {
case "AWPage:SET_WELCOME_MESSAGE_SEEN":
try {
Services.prefs.setBoolPref(DID_SEE_ABOUT_WELCOME_PREF, true);
} catch (e) {
log.debug(`Fails to set ${DID_SEE_ABOUT_WELCOME_PREF}.`);
}
break;
case "AWPage:OPEN_AWESOME_BAR":
window.gURLBar.search("");
break;

Просмотреть файл

@ -133,7 +133,10 @@ class AboutWelcome extends react__WEBPACK_IMPORTED_MODULE_0___default.a.PureComp
window.AWSendEventTelemetry({
event: "IMPRESSION",
message_id: "SIMPLIFIED_ABOUT_WELCOME"
});
}); // Captures user has seen about:welcome by setting
// firstrun.didSeeAboutWelcome pref to true
window.AWSendToParent("SET_WELCOME_MESSAGE_SEEN");
}
handleStartBtnClick() {
@ -154,7 +157,7 @@ class AboutWelcome extends react__WEBPACK_IMPORTED_MODULE_0___default.a.PureComp
className: "trailheadCards"
}, react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("div", {
className: "trailheadCardsInner"
}, react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_components_HeroText__WEBPACK_IMPORTED_MODULE_2__["HeroText"], {
}, react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement("main", null, react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_components_HeroText__WEBPACK_IMPORTED_MODULE_2__["HeroText"], {
title: props.title,
subtitle: props.subtitle
}), react__WEBPACK_IMPORTED_MODULE_0___default.a.createElement(_components_FxCards__WEBPACK_IMPORTED_MODULE_3__["FxCards"], {
@ -165,7 +168,7 @@ class AboutWelcome extends react__WEBPACK_IMPORTED_MODULE_0___default.a.PureComp
className: "start-button",
"data-l10n-id": props.startButton.string_id,
onClick: this.handleStartBtnClick
})));
}))));
}
}

Просмотреть файл

@ -29,6 +29,9 @@ class AboutWelcome extends React.PureComponent {
event: "IMPRESSION",
message_id: "SIMPLIFIED_ABOUT_WELCOME",
});
// Captures user has seen about:welcome by setting
// firstrun.didSeeAboutWelcome pref to true
window.AWSendToParent("SET_WELCOME_MESSAGE_SEEN");
}
handleStartBtnClick() {
@ -46,19 +49,21 @@ class AboutWelcome extends React.PureComponent {
return (
<div className="trailheadCards">
<div className="trailheadCardsInner">
<HeroText title={props.title} subtitle={props.subtitle} />
<FxCards
cards={props.cards}
metricsFlowUri={this.state.metricsFlowUri}
sendTelemetry={window.AWSendEventTelemetry}
/>
{props.startButton && props.startButton.string_id && (
<button
className="start-button"
data-l10n-id={props.startButton.string_id}
onClick={this.handleStartBtnClick}
<main>
<HeroText title={props.title} subtitle={props.subtitle} />
<FxCards
cards={props.cards}
metricsFlowUri={this.state.metricsFlowUri}
sendTelemetry={window.AWSendEventTelemetry}
/>
)}
{props.startButton && props.startButton.string_id && (
<button
className="start-button"
data-l10n-id={props.startButton.string_id}
onClick={this.handleStartBtnClick}
/>
)}
</main>
</div>
</div>
);