From 6930859067075fe8de1cb44a5ffa2ea8d8b686c9 Mon Sep 17 00:00:00 2001 From: Sebastian Richner Date: Mon, 26 Feb 2024 15:00:51 +0100 Subject: [PATCH] Add third onboarding step after initial startup for macOS and firs for windows --- .../electron/main/entities/Settings.ts | 3 +++ src/electron/electron/main/index.ts | 12 +++++++++- .../electron/main/services/WindowService.ts | 7 +++--- src/electron/src/views/OnboardingView.vue | 24 +++++++++++++++++++ 4 files changed, 42 insertions(+), 4 deletions(-) diff --git a/src/electron/electron/main/entities/Settings.ts b/src/electron/electron/main/entities/Settings.ts index fd3c06e2..8fca0448 100644 --- a/src/electron/electron/main/entities/Settings.ts +++ b/src/electron/electron/main/entities/Settings.ts @@ -31,6 +31,9 @@ export class Settings extends BaseEntity { @Column({ type: 'boolean', nullable: false, default: false }) onboardingShown: boolean; + @Column({ type: 'boolean', nullable: false, default: false }) + studyAndTrackersStartedShown: boolean; + @CreateDateColumn({ name: 'created_at' }) createdAt: Date; diff --git a/src/electron/electron/main/index.ts b/src/electron/electron/main/index.ts index b08bb9d5..72d544bb 100644 --- a/src/electron/electron/main/index.ts +++ b/src/electron/electron/main/index.ts @@ -99,11 +99,21 @@ app.whenReady().then(async () => { LOG.debug( `Onboarding shown: ${settings.onboardingShown}, hasAccessibilityAndScreenRecordingPermission: ${macOSHasAccessibilityAndScreenRecordingPermission()}, creating onboarding window...` ); - await windowService.createOnboardingWindow(); + await windowService.createOnboardingWindow(!is.macOS ? 'study-trackers-started' : undefined); settings.onboardingShown = true; await settings.save(); } + if ( + is.macOS && + settings.onboardingShown === true && + settings.studyAndTrackersStartedShown === false + ) { + await windowService.createOnboardingWindow('study-trackers-started'); + settings.studyAndTrackersStartedShown = true; + await settings.save(); + } + if (!is.macOS || macOSHasAccessibilityAndScreenRecordingPermission()) { LOG.debug( `Onboarding shown: ${settings.onboardingShown}, hasAccessibilityAndScreenRecordingPermission: ${macOSHasAccessibilityAndScreenRecordingPermission()}, starting all trackers...` diff --git a/src/electron/electron/main/services/WindowService.ts b/src/electron/electron/main/services/WindowService.ts index 752c6f0d..e7d30ce5 100644 --- a/src/electron/electron/main/services/WindowService.ts +++ b/src/electron/electron/main/services/WindowService.ts @@ -154,7 +154,7 @@ export class WindowService { } } - public async createOnboardingWindow() { + public async createOnboardingWindow(goToStep?: string) { this.closeOnboardingWindow(); const __filename = fileURLToPath(import.meta.url); @@ -176,11 +176,12 @@ export class WindowService { if (process.env.VITE_DEV_SERVER_URL) { await this.onboardingWindow.loadURL( - process.env.VITE_DEV_SERVER_URL + `#onboarding?isMacOS=${process.platform === 'darwin'}` + process.env.VITE_DEV_SERVER_URL + + `#onboarding?isMacOS=${is.macOS}&goToStep=${goToStep ?? 'welcome'}` ); } else { await this.onboardingWindow.loadFile(path.join(process.env.DIST, 'index.html'), { - hash: `onboarding?isMacOS=${process.platform === 'darwin'}` + hash: `onboarding?isMacOS=${is.macOS}&goToStep=${goToStep ?? 'welcome'}` }); } diff --git a/src/electron/src/views/OnboardingView.vue b/src/electron/src/views/OnboardingView.vue index 62dce27d..da5138ee 100644 --- a/src/electron/src/views/OnboardingView.vue +++ b/src/electron/src/views/OnboardingView.vue @@ -19,6 +19,7 @@ const isScreenRecordingPermissionLoading = ref(false); const route = useRoute(); const isMacOS: string | null | LocationQueryValue[] = route.query.isMacOS; +const goToStep: string | null | LocationQueryValue[] = route.query.goToStep; const availableSteps = ['welcome']; @@ -26,6 +27,11 @@ if (isMacOS === 'true') { availableSteps.push('data-collection'); } +if (goToStep === 'study-trackers-started') { + availableSteps.push('study-trackers-started'); + currentStep.value = availableSteps.indexOf('study-trackers-started'); +} + const maxSteps = computed(() => { return availableSteps.length; }); @@ -219,6 +225,24 @@ function startAllTrackers() {

+
+

Data Collection

+
+

+ PersonalAnalytics now has the necessary permissions to collect data and is collecting + data in the background. You can manually open the application or view the collected + data at any time by right-clicking the icon in the menu bar. +

+

+ PersonalAnalytics is now collecting data. You can manually open the application or + view the collected data at any time by right-clicking the icon in the menu bar. +

+

+ The following trackers are currently running: + {{ studyInfo.currentlyActiveTrackers.join(', ') }} +

+
+