diff --git a/openpilot/starpilot/galaxy/tests/test_app_reminder.mjs b/openpilot/starpilot/galaxy/tests/test_app_reminder.mjs index 5300ac04d9..e80c244080 100644 --- a/openpilot/starpilot/galaxy/tests/test_app_reminder.mjs +++ b/openpilot/starpilot/galaxy/tests/test_app_reminder.mjs @@ -35,10 +35,39 @@ assert.ok(appReminderPreference.error) assert.equal(reminderHidden({}), false) assert.equal(reminderDismissed({}), false) const context = { download: APP_DOWNLOADS.ios, pref: { hidden: false }, dismissed: false } -assert.match(AppDownloadReminder.template, /The easiest way to connect to your comma\./) +assert.match(AppDownloadReminder.template, /The most seamless way to connect to your StarPilot via Bluetooth, Wi-Fi, or over the network\./) assert.ok(AppDownloadReminder.computed.visible.call(context)) context.pref.hidden = true assert.equal(AppDownloadReminder.computed.visible.call(context), false) +const dismissal = { dismissed: false, pref: { set: hidden => appReminderPreference.set(hidden, target) } } +AppDownloadReminder.methods.dismiss.call(dismissal) +assert.equal(dismissal.dismissed, true) +assert.equal(reminderHidden(target), true, 'dismissing must persist across browser sessions') +values.delete(DISMISSED_APP_REMINDER) +assert.equal(reminderDismissed(target), false) +assert.equal(reminderHidden(target), true, 'ending the session must not bring the prompt back') +assert.equal(appReminderPreference.set(false, target), true, 'browser preferences can enable reminders again') +const later = { dismissed: false } +const originalSessionStorage = globalThis.sessionStorage +try { + globalThis.sessionStorage = target.sessionStorage + AppDownloadReminder.methods.showLater.call(later) + assert.equal(later.dismissed, true) + assert.equal(reminderDismissed(target), true, 'show later dismisses for the tab session') + assert.equal(reminderHidden(target), false, 'show later must not disable future reminders') + values.delete(DISMISSED_APP_REMINDER) + assert.equal(reminderDismissed(target), false, 'a new session allows the reminder again') +} finally { + if (originalSessionStorage === undefined) delete globalThis.sessionStorage + else globalThis.sessionStorage = originalSessionStorage +} +const failedDismissal = { dismissed: false, pref: { set: hidden => appReminderPreference.set(hidden, denied) } } +AppDownloadReminder.methods.dismiss.call(failedDismissal) +assert.equal(failedDismissal.dismissed, true, 'storage failure must not prevent closing the prompt') +assert.equal(appReminderPreference.hidden, false) +assert.match(AppDownloadReminder.template, /Don't Remind Me/) +assert.match(AppDownloadReminder.template, /@click="showLater">Not Now/) +assert.doesNotMatch(AppDownloadReminder.template, /download.name/) context.pref.hidden = false context.dismissed = true assert.equal(AppDownloadReminder.computed.visible.call(context), false) diff --git a/openpilot/starpilot/galaxy/web/css/galaxy.css b/openpilot/starpilot/galaxy/web/css/galaxy.css index 8a8303bd03..0d1f74089f 100644 --- a/openpilot/starpilot/galaxy/web/css/galaxy.css +++ b/openpilot/starpilot/galaxy/web/css/galaxy.css @@ -1886,6 +1886,8 @@ progress { max-width: 100%; accent-color: var(--primary); } .gx-app-download h2 { margin: 0; font-size: 1.5rem; line-height: 1.2; } .gx-app-download > p { margin: 0; color: var(--text-muted); line-height: 1.5; } .gx-app-download__get { width: 100%; min-height: 48px; } +.gx-app-download__actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; width: 100%; } +.gx-app-download__actions > .gx-btn { min-width: 0; min-height: 48px; padding-inline: 8px; white-space: normal; } .gx-app-download > .gx-app-download__platform { margin-top: -8px; font-size: .75rem; } .gx-app-download > .gx-btn--text { background: transparent; border-color: transparent; box-shadow: none; color: var(--text-muted); min-height: 44px; } diff --git a/openpilot/starpilot/galaxy/web/js/app-reminder.js b/openpilot/starpilot/galaxy/web/js/app-reminder.js index 60ce062d71..1cc65cac57 100644 --- a/openpilot/starpilot/galaxy/web/js/app-reminder.js +++ b/openpilot/starpilot/galaxy/web/js/app-reminder.js @@ -45,8 +45,13 @@ export const AppDownloadReminder = { dismissed: reminderDismissed() }), computed: { visible() { return this.download && !this.pref.hidden && !this.dismissed } }, methods: { + showLater() { + this.dismissed = true + try { sessionStorage.setItem(DISMISSED_APP_REMINDER, "1") } catch {} + }, dismiss() { this.dismissed = true + this.pref.set(true) try { sessionStorage.setItem(DISMISSED_APP_REMINDER, "1") } catch {} }, }, @@ -54,11 +59,13 @@ export const AppDownloadReminder = { class="gx-app-download" @close="dismiss">

Get the Galaxy app

-

The easiest way to connect to your comma.

+

The most seamless way to connect to your StarPilot via Bluetooth, Wi-Fi, or over the network.

{{ download.label }} -

{{ download.name }}

- +
+ + +
`, }