mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-12-02 23:43:40 +08:00
app download reminder UI with improved dismissal options and updated messaging
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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; }
|
||||
|
||||
|
||||
@@ -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">
|
||||
<img class="gx-app-download__icon" src="./assets/galaxy-icon-180.png" width="72" height="72" alt="" />
|
||||
<h2 id="gx-app-download-title">Get the Galaxy app</h2>
|
||||
<p id="gx-app-download-description">The easiest way to connect to your comma.</p>
|
||||
<p id="gx-app-download-description">The most seamless way to connect to your StarPilot via Bluetooth, Wi-Fi, or over the network.</p>
|
||||
<a class="gx-btn gx-app-download__get" :href="download.href" target="_blank" rel="noopener noreferrer" @click="dismiss">
|
||||
<i class="bi" :class="download.icon" aria-hidden="true"></i>{{ download.label }}</a>
|
||||
<p class="gx-app-download__platform">{{ download.name }}</p>
|
||||
<button class="gx-btn gx-btn--text" type="button" @click="dismiss">Not now</button>
|
||||
<div class="gx-app-download__actions">
|
||||
<button class="gx-btn gx-btn--tonal" type="button" @click="showLater">Not Now</button>
|
||||
<button class="gx-btn gx-btn--tonal" type="button" @click="dismiss">Don't Remind Me</button>
|
||||
</div>
|
||||
</GxDialog>`,
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user