Skip to content

Commit

Permalink
Bug 1803654 - Update PDF.js annotation Feature Callout messages to in…
Browse files Browse the repository at this point in the history
…clude both treatment branches r=jprickett

Differential Revision: https://phabricator.services.mozilla.com/D163639
  • Loading branch information
lmegviar committed Dec 2, 2022
1 parent 2e3d1f9 commit 6b64e95
Show file tree
Hide file tree
Showing 2 changed files with 170 additions and 19 deletions.
20 changes: 11 additions & 9 deletions browser/components/firefoxview/featureCallout.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,17 @@ export class FeatureCallout {
return this.win.pageEventManager;
});

const inChrome =
this.win.location.toString() === "chrome://browser/content/browser.xhtml";
// When the window is focused, ensure tour is synced with tours in
// any other instances of the parent page
this.win.addEventListener(
"visibilitychange",
this._handlePrefChange.bind(this)
);
// any other instances of the parent page. This does not apply when
// the Callout is shown in the browser chrome.
if (!inChrome) {
this.win.addEventListener(
"visibilitychange",
this._handlePrefChange.bind(this)
);
}

const positionCallout = this._positionCallout.bind(this);

Expand Down Expand Up @@ -111,10 +116,7 @@ export class FeatureCallout {
// displaying a feature tour, and transitions are handled
// based on the value of a tour progress pref. Otherwise,
// just show the feature callout.
// Bug 1797364 adds supports for feature tours in the browser chrome
const inChrome =
this.win.location.toString() === "chrome://browser/content/browser.xhtml";
if (inChrome || this.config?.screens.length === 1) {
if (this.config?.screens.length === 1) {
this.showFeatureCallout();
return;
}
Expand Down
169 changes: 159 additions & 10 deletions browser/components/newtab/lib/FeatureCalloutMessages.jsm
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ const MESSAGES = () => {
trigger: { id: "featureCalloutCheck" },
},
{
id: "PDFJS_FEATURE_TOUR_1",
id: "PDFJS_FEATURE_TOUR_1_A",
template: "feature_callout",
content: {
id: "PDFJS_FEATURE_TOUR",
Expand All @@ -402,10 +402,14 @@ const MESSAGES = () => {
disableHistoryUpdates: true,
screens: [
{
id: "FEATURE_CALLOUT_1",
id: "FEATURE_CALLOUT_1_A",
parent_selector: "#editorFreeText",
content: {
position: "callout",
callout_position_override: {
top: "130px",
right: "55px",
},
arrow_position: "top-end",
title: {
string_id: "callout-pdfjs-edit-title",
Expand All @@ -423,7 +427,7 @@ const MESSAGES = () => {
pref: {
name: PDFJS_PREF,
value: JSON.stringify({
screen: "FEATURE_CALLOUT_2",
screen: "FEATURE_CALLOUT_2_A",
complete: false,
}),
},
Expand All @@ -447,16 +451,17 @@ const MESSAGES = () => {
},
},
EMPTY_SCREEN,
EMPTY_SCREEN,
],
},
priority: 1,
// Targeting to be updated in Bug 1797368
targeting: "false",
targeting: `${matchCurrentScreenTargeting(
PDFJS_PREF,
"FEATURE_CALLOUT_1_A"
)}`,
trigger: { id: "featureCalloutCheck" },
},
{
id: "PDFJS_FEATURE_TOUR_2",
id: "PDFJS_FEATURE_TOUR_2_A",
template: "feature_callout",
content: {
id: "PDFJS_FEATURE_TOUR",
Expand All @@ -468,10 +473,14 @@ const MESSAGES = () => {
screens: [
EMPTY_SCREEN,
{
id: "FEATURE_CALLOUT_2",
id: "FEATURE_CALLOUT_2_A",
parent_selector: "#editorInk",
content: {
position: "callout",
callout_position_override: {
top: "130px",
right: "25px",
},
arrow_position: "top-end",
title: {
string_id: "callout-pdfjs-draw-title",
Expand Down Expand Up @@ -512,12 +521,152 @@ const MESSAGES = () => {
},
},
},
],
},
priority: 1,
targeting: `${matchCurrentScreenTargeting(
PDFJS_PREF,
"FEATURE_CALLOUT_2_A"
)}`,
trigger: { id: "featureCalloutCheck" },
},
{
id: "PDFJS_FEATURE_TOUR_1_B",
template: "feature_callout",
content: {
id: "PDFJS_FEATURE_TOUR",
template: "multistage",
backdrop: "transparent",
transitions: false,
disableHistoryUpdates: true,
screens: [
{
id: "FEATURE_CALLOUT_1_B",
parent_selector: "#editorFreeText",
content: {
position: "callout",
callout_position_override: {
top: "130px",
right: "55px",
},
arrow_position: "top-end",
title: {
string_id: "callout-pdfjs-edit-title",
},
subtitle: {
string_id: "callout-pdfjs-edit-body-b",
},
primary_button: {
label: {
string_id: "callout-pdfjs-edit-button",
},
action: {
type: "SET_PREF",
data: {
pref: {
name: PDFJS_PREF,
value: JSON.stringify({
screen: "FEATURE_CALLOUT_2_B",
complete: false,
}),
},
},
},
},
dismiss_button: {
action: {
type: "SET_PREF",
data: {
pref: {
name: PDFJS_PREF,
value: JSON.stringify({
screen: "",
complete: true,
}),
},
},
},
},
},
},
EMPTY_SCREEN,
],
},
priority: 1,
// Targeting to be updated in Bug 1797368 https://bugzilla.mozilla.org/show_bug.cgi?id=1797368
targeting: "false",
targeting: `${matchCurrentScreenTargeting(
PDFJS_PREF,
"FEATURE_CALLOUT_1_B"
)}`,
trigger: { id: "featureCalloutCheck" },
},
{
id: "PDFJS_FEATURE_TOUR_2_B",
template: "feature_callout",
content: {
id: "PDFJS_FEATURE_TOUR",
startScreen: 1,
template: "multistage",
backdrop: "transparent",
transitions: false,
disableHistoryUpdates: true,
screens: [
EMPTY_SCREEN,
{
id: "FEATURE_CALLOUT_2_B",
parent_selector: "#editorInk",
content: {
position: "callout",
callout_position_override: {
top: "130px",
right: "25px",
},
arrow_position: "top-end",
title: {
string_id: "callout-pdfjs-draw-title",
},
subtitle: {
string_id: "callout-pdfjs-draw-body-b",
},
primary_button: {
label: {
string_id: "callout-pdfjs-draw-button",
},
action: {
type: "SET_PREF",
data: {
pref: {
name: PDFJS_PREF,
value: JSON.stringify({
screen: "",
complete: true,
}),
},
},
},
},
dismiss_button: {
action: {
type: "SET_PREF",
data: {
pref: {
name: PDFJS_PREF,
value: JSON.stringify({
screen: "",
complete: true,
}),
},
},
},
},
},
},
],
},
priority: 1,
targeting: `${matchCurrentScreenTargeting(
PDFJS_PREF,
"FEATURE_CALLOUT_2_B"
)}`,
trigger: { id: "featureCalloutCheck" },
},
];
Expand Down

0 comments on commit 6b64e95

Please sign in to comment.