Bug 1409977 - mark Onboarding tour will set as completed instantly via define a tour property;r=Fischer

MozReview-Commit-ID: 4zsPzXieZap

--HG--
extra : rebase_source : fdefc23e74d268359e0f421271d1cae867ddea36
This commit is contained in:
Fred Lin 2017-10-30 10:44:39 +08:00
Родитель cd62426903
Коммит 1e17939ca3
1 изменённых файлов: 19 добавлений и 15 удалений

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

@ -31,6 +31,8 @@ const ICON_STATE_DEFAULT = "default";
* "tourId": { // The short tour id which could be saved in pref * "tourId": { // The short tour id which could be saved in pref
* // The unique tour id * // The unique tour id
* id: "onboarding-tour-addons", * 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 * // The string id of tour name which would be displayed on the navigation bar
* tourNameId: "onboarding.tour-addon", * tourNameId: "onboarding.tour-addon",
* // The method returing strings used on tour notification * // The method returing strings used on tour notification
@ -130,6 +132,7 @@ var onboardingTourset = {
}, },
"default": { "default": {
id: "onboarding-tour-default-browser", id: "onboarding-tour-default-browser",
instantComplete: true,
tourNameId: "onboarding.tour-default-browser", tourNameId: "onboarding.tour-default-browser",
getNotificationStrings(bundle) { getNotificationStrings(bundle) {
return { return {
@ -168,6 +171,7 @@ var onboardingTourset = {
}, },
"sync": { "sync": {
id: "onboarding-tour-sync", id: "onboarding-tour-sync",
instantComplete: true,
tourNameId: "onboarding.tour-sync2", tourNameId: "onboarding.tour-sync2",
getNotificationStrings(bundle) { getNotificationStrings(bundle) {
return { return {
@ -277,6 +281,7 @@ var onboardingTourset = {
}, },
"performance": { "performance": {
id: "onboarding-tour-performance", id: "onboarding-tour-performance",
instantComplete: true,
tourNameId: "onboarding.tour-performance", tourNameId: "onboarding.tour-performance",
getNotificationStrings(bundle) { getNotificationStrings(bundle) {
return { return {
@ -807,26 +812,22 @@ class Onboarding {
tour_id: tourId, tour_id: tourId,
session_key: this._session_key, 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 { } else {
tab.classList.remove("onboarding-active"); tab.classList.remove("onboarding-active");
tab.setAttribute("aria-selected", false); 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) { isTourCompleted(tourId) {
@ -1220,6 +1221,9 @@ class Onboarding {
tab.id = tour.id; tab.id = tour.id;
tab.textContent = this._bundle.GetStringFromName(tour.tourNameId); tab.textContent = this._bundle.GetStringFromName(tour.tourNameId);
tab.className = "onboarding-tour-item"; tab.className = "onboarding-tour-item";
if (tour.instantComplete) {
tab.dataset.instantComplete = true;
}
tab.tabIndex = 0; tab.tabIndex = 0;
tab.setAttribute("role", "tab"); tab.setAttribute("role", "tab");