Skip to content

Commit

Permalink
Bug 1409977 - mark Onboarding tour will set as completed instantly vi…
Browse files Browse the repository at this point in the history
…a define a tour property;r=Fischer

MozReview-Commit-ID: 4zsPzXieZap
  • Loading branch information
gasolin committed Oct 30, 2017
1 parent ba181ab commit e63df06
Showing 1 changed file with 19 additions and 15 deletions.
34 changes: 19 additions & 15 deletions browser/extensions/onboarding/content/onboarding.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ const ICON_STATE_DEFAULT = "default";
* "tourId": { // The short tour id which could be saved in pref
* // The unique tour id
* id: "onboarding-tour-addons",
* // (optional) mark tour as complete instantly when user enters the tour
* instantComplete: false,
* // The string id of tour name which would be displayed on the navigation bar
* tourNameId: "onboarding.tour-addon",
* // The method returing strings used on tour notification
Expand Down Expand Up @@ -130,6 +132,7 @@ var onboardingTourset = {
},
"default": {
id: "onboarding-tour-default-browser",
instantComplete: true,
tourNameId: "onboarding.tour-default-browser",
getNotificationStrings(bundle) {
return {
Expand Down Expand Up @@ -168,6 +171,7 @@ var onboardingTourset = {
},
"sync": {
id: "onboarding-tour-sync",
instantComplete: true,
tourNameId: "onboarding.tour-sync2",
getNotificationStrings(bundle) {
return {
Expand Down Expand Up @@ -277,6 +281,7 @@ var onboardingTourset = {
},
"performance": {
id: "onboarding-tour-performance",
instantComplete: true,
tourNameId: "onboarding.tour-performance",
getNotificationStrings(bundle) {
return {
Expand Down Expand Up @@ -807,26 +812,22 @@ class Onboarding {
tour_id: tourId,
session_key: this._session_key,
});

// some tours should completed instantly upon showing.
if (tab.getAttribute("data-instant-complete")) {
this.setToursCompleted([tourId]);
// also track auto completed tour so we can filter data with the same event
telemetry({
event: "overlay-cta-click",
tour_id: tourId,
session_key: this._session_key,
});
}
} else {
tab.classList.remove("onboarding-active");
tab.setAttribute("aria-selected", false);
}
}

switch (tourId) {
// These tours should tagged completed instantly upon showing.
case "onboarding-tour-default-browser":
case "onboarding-tour-sync":
case "onboarding-tour-performance":
this.setToursCompleted([tourId]);
// also track auto completed tour so we can filter data with the same event
telemetry({
event: "overlay-cta-click",
tour_id: tourId,
session_key: this._session_key,
});
break;
}
}

isTourCompleted(tourId) {
Expand Down Expand Up @@ -1220,6 +1221,9 @@ class Onboarding {
tab.id = tour.id;
tab.textContent = this._bundle.GetStringFromName(tour.tourNameId);
tab.className = "onboarding-tour-item";
if (tour.instantComplete) {
tab.dataset.instantComplete = true;
}
tab.tabIndex = 0;
tab.setAttribute("role", "tab");

Expand Down

0 comments on commit e63df06

Please sign in to comment.