diff --git a/src/core/features/settings/pages/dev/dev.html b/src/core/features/settings/pages/dev/dev.html
index d7dd7f061..bf055c1ca 100644
--- a/src/core/features/settings/pages/dev/dev.html
+++ b/src/core/features/settings/pages/dev/dev.html
@@ -45,6 +45,14 @@
+
+
+ Reset user tours
+
+
+
+
+
diff --git a/src/core/features/settings/pages/dev/dev.ts b/src/core/features/settings/pages/dev/dev.ts
index 9b14f3e42..913708872 100644
--- a/src/core/features/settings/pages/dev/dev.ts
+++ b/src/core/features/settings/pages/dev/dev.ts
@@ -14,7 +14,9 @@
import { Component, OnInit } from '@angular/core';
import { CoreSitePlugins } from '@features/siteplugins/services/siteplugins';
+import { CoreUserTours } from '@features/usertours/services/user-tours';
import { CoreSites } from '@services/sites';
+import { CoreDomUtils } from '@services/utils/dom';
import { CoreUtils } from '@services/utils/utils';
import { Platform } from '@singletons';
@@ -36,6 +38,7 @@ export class CoreSettingsDevPage implements OnInit {
pluginStyles = true;
pluginStylesCount = 0;
sitePlugins: CoreSitePluginsBasicInfo[] = [];
+ userToursEnabled = true;
disabledFeatures: string[] = [];
@@ -60,6 +63,8 @@ export class CoreSettingsDevPage implements OnInit {
this.pluginStyles = false;
this.pluginStylesCount = 0;
+ this.userToursEnabled = !CoreUserTours.isDisabled();
+
document.head.querySelectorAll('style').forEach((style) => {
if (this.siteId && style.id.endsWith(this.siteId)) {
if (style.innerHTML.length > 0) {
@@ -139,6 +144,14 @@ export class CoreSettingsDevPage implements OnInit {
CoreUtils.copyToClipboard(JSON.stringify({ disabledFeatures: this.disabledFeatures, sitePlugins: this.sitePlugins }));
}
+ /**
+ * Reset all user tours.
+ */
+ async resetUserTours(): Promise {
+ await CoreUserTours.resetTours();
+ CoreDomUtils.showToast('User tours have been reseted');
+ }
+
}
// Basic site plugin info.
diff --git a/src/core/features/usertours/services/user-tours.ts b/src/core/features/usertours/services/user-tours.ts
index fac59c705..d73c52071 100644
--- a/src/core/features/usertours/services/user-tours.ts
+++ b/src/core/features/usertours/services/user-tours.ts
@@ -63,7 +63,7 @@ export class CoreUserToursService {
* @returns Whether the User Tour is pending or not.
*/
async isPending(id: string): Promise {
- if (CoreConstants.CONFIG.disableUserTours || CoreConstants.CONFIG.disabledUserTours?.includes(id)) {
+ if (this.isDisabled(id)) {
return false;
}
@@ -252,6 +252,31 @@ export class CoreUserToursService {
}
}
+ /**
+ * Is user Tour disabled?
+ *
+ * @param tourId Tour Id or undefined to check all user tours.
+ * @return Wether a particular or all user tours are disabled.
+ */
+ isDisabled(tourId?: string): boolean {
+ if (CoreConstants.CONFIG.disableUserTours) {
+ return true;
+ }
+
+ return !!tourId && !!CoreConstants.CONFIG.disabledUserTours?.includes(tourId);
+ }
+
+ /**
+ * It will reset all user tours.
+ */
+ async resetTours(): Promise {
+ if (this.isDisabled()) {
+ return;
+ }
+
+ await this.table.delete();
+ }
+
}
export const CoreUserTours = makeSingleton(CoreUserToursService);