Skip to content

Commit 7c9ca01

Browse files
committed
Pop a toast to start tour only on user action
1 parent 27c8ecd commit 7c9ca01

File tree

1 file changed

+25
-17
lines changed

1 file changed

+25
-17
lines changed

src/tutorialManager.ts

Lines changed: 25 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -136,23 +136,31 @@ export class TutorialManager implements ITutorialManager {
136136
);
137137
}
138138

139-
INotification.info(`Try the ${tutorialList[0].label}.`, {
140-
autoClose: 5000,
141-
buttons: [
142-
{
143-
label: 'Start now',
144-
callback: (): void => {
145-
this._tutorialLaunched.emit(tutorialList);
146-
}
147-
},
148-
{
149-
label: "Don't show me again",
150-
callback: (): void => {
151-
tutorialList.forEach(tour => this._rememberDoneTutorial(tour.id));
152-
}
153-
}
154-
]
155-
});
139+
if (tutorialList.length > 0) {
140+
if (force) {
141+
this._tutorialLaunched.emit(tutorialList);
142+
} else {
143+
INotification.info(`Try the ${tutorialList[0].label}.`, {
144+
autoClose: 10000,
145+
buttons: [
146+
{
147+
label: 'Start now',
148+
callback: (): void => {
149+
this._tutorialLaunched.emit(tutorialList);
150+
}
151+
},
152+
{
153+
label: "Don't show me again",
154+
callback: (): void => {
155+
tutorialList.forEach(tour =>
156+
this._rememberDoneTutorial(tour.id)
157+
);
158+
}
159+
}
160+
]
161+
});
162+
}
163+
}
156164

157165
return Promise.resolve();
158166
}

0 commit comments

Comments
 (0)