Skip to content

Commit 50b9d62

Browse files
marie-jjleveugle
authored andcommitted
feat(public-cloud): store walkme value in local storage
1 parent 507bc5b commit 50b9d62

File tree

2 files changed

+29
-20
lines changed

2 files changed

+29
-20
lines changed

packages/manager/apps/public-cloud/src/components/walkMe/walkme.service.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,9 @@ export default class WalkMe {
7575
return tour;
7676
}
7777

78+
// eslint-disable-next-line class-methods-use-this
7879
end() {
79-
return this.ovhUserPref.assign(KEY, true);
80+
// return this.ovhUserPref.assign(KEY, true);
81+
return localStorage.setItem(KEY, false);
8082
}
8183
}

packages/manager/apps/public-cloud/src/index.controller.js

Lines changed: 26 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -7,33 +7,40 @@ import options from './navbar.config';
77

88
export default class PublicCloudController {
99
/* @ngInject */
10-
constructor($scope, $window, ovhUserPref, WalkMe) {
10+
constructor($scope, $timeout, $window, ovhUserPref, WalkMe) {
1111
this.$scope = $scope;
12-
this.$window = $window;
1312
this.feedbackUrl = __FEEDBACK_URL__;
1413
this.feedback = feedback;
1514
this.ovhUserPref = ovhUserPref;
1615
this.WalkMe = WalkMe;
1716

18-
1917
this.navbarOptions = options;
2018

21-
$scope.$on('navbar.loaded', () => this.ovhUserPref.getValue(KEY)
22-
.then(({ value }) => {
23-
this.shouldShowWalkMe = value;
24-
})
25-
.catch(({ status }) => {
26-
if (status === 404) {
27-
this.shouldShowWalkMe = true;
28-
}
29-
})
30-
.finally(() => {
31-
// TODO : Remove matchMedia for mobile version
32-
if (this.shouldShowWalkMe && $window.matchMedia(`(min-width: ${BREAKPOINT}px)`).matches) {
33-
this.tour = this.WalkMe.start();
34-
angular.element('oui-navbar').on('click', () => this.endWalkMe());
35-
}
36-
}));
19+
$scope.$on('navbar.loaded', () => $timeout(() => {
20+
this.shouldShowWalkMe = (localStorage.getItem(KEY) || true) && $window.matchMedia(`(min-width: ${BREAKPOINT}px)`).matches;
21+
if (this.shouldShowWalkMe) {
22+
this.tour = this.WalkMe.start();
23+
angular.element('oui-navbar').on('click', () => this.endWalkMe());
24+
}
25+
}));
26+
27+
// this.ovhUserPref.getValue(KEY)
28+
// .then(({ value }) => {
29+
// this.shouldShowWalkMe = value;
30+
// })
31+
// .catch(({ status }) => {
32+
// if (status === 404) {
33+
// this.shouldShowWalkMe = true;
34+
// }
35+
// })
36+
// .finally(() => {
37+
// // TODO : Remove matchMedia for mobile version
38+
// if (this.shouldShowWalkMe
39+
// && $window.matchMedia(`(min-width: ${BREAKPOINT}px)`).matches) {
40+
// this.tour = this.WalkMe.start();
41+
// angular.element('oui-navbar').on('click', () => this.endWalkMe());
42+
// }
43+
// }));
3744
}
3845

3946
endWalkMe() {

0 commit comments

Comments
 (0)