зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1074932 - Desktop client user can access product tour from gears menu. r=MattN
This commit is contained in:
Родитель
cf1e11e596
Коммит
cda17719db
|
@ -615,12 +615,15 @@ function injectLoopAPI(targetWindow) {
|
|||
|
||||
/**
|
||||
* Opens the Getting Started tour in the browser.
|
||||
*
|
||||
* @param {String} aSrc
|
||||
* - The UI element that the user used to begin the tour, optional.
|
||||
*/
|
||||
openGettingStartedTour: {
|
||||
enumerable: true,
|
||||
writable: true,
|
||||
value: function() {
|
||||
return MozLoopService.openGettingStartedTour();
|
||||
value: function(aSrc) {
|
||||
return MozLoopService.openGettingStartedTour(aSrc);
|
||||
},
|
||||
},
|
||||
|
||||
|
|
|
@ -1406,12 +1406,18 @@ this.MozLoopService = {
|
|||
|
||||
/**
|
||||
* Opens the Getting Started tour in the browser.
|
||||
*
|
||||
* @param {String} aSrc
|
||||
* - The UI element that the user used to begin the tour, optional.
|
||||
*/
|
||||
openGettingStartedTour: Task.async(function() {
|
||||
openGettingStartedTour: Task.async(function(aSrc = null) {
|
||||
try {
|
||||
let url = Services.prefs.getCharPref("loop.gettingStarted.url");
|
||||
let url = new URL(Services.prefs.getCharPref("loop.gettingStarted.url"));
|
||||
if (aSrc) {
|
||||
url.searchParams.set("source", aSrc);
|
||||
}
|
||||
let win = Services.wm.getMostRecentWindow("navigator:browser");
|
||||
win.switchToTabHavingURI(url, true);
|
||||
win.switchToTabHavingURI(url, true, {replaceQueryString: true});
|
||||
} catch (ex) {
|
||||
log.error("Error opening Getting Started tour", ex);
|
||||
}
|
||||
|
|
|
@ -286,6 +286,10 @@ loop.panel = (function(_, mozL10n) {
|
|||
return !!navigator.mozLoop.userProfile;
|
||||
},
|
||||
|
||||
openGettingStartedTour: function() {
|
||||
navigator.mozLoop.openGettingStartedTour("settingsMenu");
|
||||
},
|
||||
|
||||
render: function() {
|
||||
var cx = React.addons.classSet;
|
||||
|
||||
|
@ -308,6 +312,8 @@ loop.panel = (function(_, mozL10n) {
|
|||
onClick: this.handleClickAccountEntry,
|
||||
icon: "account",
|
||||
displayed: this._isSignedIn()}),
|
||||
SettingsDropdownEntry({label: mozL10n.get("tour_label"),
|
||||
onClick: this.openGettingStartedTour}),
|
||||
SettingsDropdownEntry({label: this._isSignedIn() ?
|
||||
mozL10n.get("settings_menu_item_signout") :
|
||||
mozL10n.get("settings_menu_item_signin"),
|
||||
|
|
|
@ -286,6 +286,10 @@ loop.panel = (function(_, mozL10n) {
|
|||
return !!navigator.mozLoop.userProfile;
|
||||
},
|
||||
|
||||
openGettingStartedTour: function() {
|
||||
navigator.mozLoop.openGettingStartedTour("settingsMenu");
|
||||
},
|
||||
|
||||
render: function() {
|
||||
var cx = React.addons.classSet;
|
||||
|
||||
|
@ -308,6 +312,8 @@ loop.panel = (function(_, mozL10n) {
|
|||
onClick={this.handleClickAccountEntry}
|
||||
icon="account"
|
||||
displayed={this._isSignedIn()} />
|
||||
<SettingsDropdownEntry label={mozL10n.get("tour_label")}
|
||||
onClick={this.openGettingStartedTour} />
|
||||
<SettingsDropdownEntry label={this._isSignedIn() ?
|
||||
mozL10n.get("settings_menu_item_signout") :
|
||||
mozL10n.get("settings_menu_item_signin")}
|
||||
|
|
Загрузка…
Ссылка в новой задаче