Skip to content

[desktop] Add dismiss controls for default PDF app prompt#6100

Open
nickzerjeski wants to merge 7 commits intoStirling-Tools:mainfrom
nickzerjeski:codex/default-app-prompt-controls-5772
Open

[desktop] Add dismiss controls for default PDF app prompt#6100
nickzerjeski wants to merge 7 commits intoStirling-Tools:mainfrom
nickzerjeski:codex/default-app-prompt-controls-5772

Conversation

@nickzerjeski
Copy link
Copy Markdown

Description of Changes

Implemented the desktop default-PDF-association banner flow requested in #5772.

What changed:

  • Added a new explicit Don't ask again action in the default app banner.
  • Kept the regular dismiss action but made it persistent and stateful.
  • Implemented reminder logic so dismissing once hides the banner, then re-shows it once after ~30 days, and after that second dismiss it stays hidden.
  • Added settings controls to re-enable the banner reminder if the user previously suppressed it.
  • Wired all of the above through the desktop default-app service and hook state.

Why:

  • The banner currently appears too aggressively and can be frustrating for users who use Stirling PDF for editing but not default viewing.
  • Maintainer guidance in the issue requested:
    • a "don't remind me again" path,
    • a settings path to re-enable later,
    • and a safer periodic reminder behavior.

Root cause addressed:

  • Banner visibility was effectively session-level and lacked a clear persisted opt-out/re-enable model.

Validation performed:

  • npm run format:check (frontend) for changed files
  • npm run prep:desktop
  • npm run typecheck:desktop

Closes #5772


Checklist

General

Documentation

Translations (if applicable)

UI Changes (if applicable)

  • Screenshots or videos demonstrating the UI changes are attached (e.g., as comments or direct attachments in the PR)

Testing (if applicable)

  • I have tested my changes locally. Refer to the Testing Guide for more details.

Copilot AI review requested due to automatic review settings April 13, 2026 13:17
@dosubot dosubot bot added size:L This PR changes 100-499 lines ignoring generated files. enhancement New feature or request labels Apr 13, 2026
@stirlingbot stirlingbot bot added Front End Issues or pull requests related to front-end development and removed enhancement New feature or request labels Apr 13, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a less-intrusive, persisted “make Stirling PDF the default handler” banner flow for the desktop app, including a permanent opt-out and a settings-based re-enable path, as requested in #5772.

Changes:

  • Implemented persisted dismissal + “Don’t ask again” + ~30-day reminder logic in the desktop default-app service.
  • Updated the desktop default-app hook and banner to use the new prompt-visibility state and actions.
  • Extended the shared InfoBanner to support an optional secondary action button.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
frontend/src/desktop/services/defaultAppService.ts Adds localStorage-backed prompt suppression state, timestamps, and reminder-window logic.
frontend/src/desktop/hooks/useDefaultApp.ts Exposes showPrompt / suppression state and new dismiss/reset actions to UI.
frontend/src/desktop/components/shared/DefaultAppBanner.tsx Adds “Don’t ask again” action and switches visibility gating to showPrompt.
frontend/src/desktop/components/shared/config/configSections/DefaultAppSettings.tsx Adds settings UI to re-enable the startup reminder when suppressed.
frontend/src/core/components/shared/InfoBanner.tsx Adds optional secondary button props and rendering support.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.


const lastDismissedAt = this.getLastDismissedAt();
if (lastDismissedAt === null) {
return true;
Copy link

Copilot AI Apr 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldShowPrompt() currently returns true when hasUserDismissedPrompt() is true but DISMISSED_AT_KEY is missing (lastDismissedAt === null). This creates an upgrade/migration regression: users who dismissed the banner in older versions (which only stored the boolean) will immediately see the prompt again after updating. Consider treating a missing timestamp as “dismissed recently” (e.g., set DISMISSED_AT_KEY to Date.now() and return false, or otherwise default to suppressing until the next reminder window).

Suggested change
return true;
// Migrate legacy dismissed state that predates timestamp storage:
// treat it as a recent dismissal so the prompt is not shown again immediately.
try {
localStorage.setItem(DISMISSED_AT_KEY, Date.now().toString());
} catch (error) {
console.error("[DefaultApp] Failed to persist dismissal timestamp:", error);
}
return false;

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Implemented in commit b27841ab6.

shouldShowPrompt() now migrates legacy dismissed state (missing DISMISSED_AT_KEY) by storing Date.now() and returning false, so users who dismissed previously do not see the prompt immediately after upgrade.

Copy link
Copy Markdown
Author

Implemented a follow-up commit to address the review feedback:

  1. Legacy migration fix (defaultAppService.shouldShowPrompt)

    • If DISMISSED_KEY exists but DISMISSED_AT_KEY is missing (older installs), we now persist DISMISSED_AT_KEY=Date.now() and return false to avoid re-showing immediately after upgrade.
  2. Avoid duplicate native check (useDefaultApp)

    • checkDefaultStatus() now passes the already-fetched status into shouldShowPrompt(status) to avoid invoking isDefaultPdfHandler() twice.
  3. Banner visibility state bug (DefaultAppBanner)

    • Removed local React dismissed state and now rely on showPrompt only, so re-enabling reminder in settings can show the banner again in-session.
  4. Secondary action during loading (InfoBanner)

    • Secondary button is now disabled={loading}.

Validation rerun:

  • npm run format:check
  • npm run prep:desktop
  • npm run typecheck:desktop

All passed locally.

@stirlingbot
Copy link
Copy Markdown
Contributor

stirlingbot bot commented Apr 13, 2026

🌐 TOML Translation Verification Summary

🔄 Reference Branch: pr-branch

📃 File Check: en-GB/translation.toml

  1. Test Status:Passed
  2. Test Status:Passed
  3. Test Status:Passed

✅ Overall Check Status: Success

Thanks @nickzerjeski for your help in keeping the translations up to date.

@Frooodle
Copy link
Copy Markdown
Member

I dont think having a setting to re-enable the remidner makes sense... I might have mis-spoken in issue ticket, there is no case a user would want to re-enable the reminder, only enable the feature itself

if the user wants to enable the actual default app feature there should a button to do that (idk if there is outside of banner)

@Frooodle
Copy link
Copy Markdown
Member

Looks like we do already have the button in desktop mode so i guess we can just remove the other you added! sorry for that confusion

@nickzerjeski
Copy link
Copy Markdown
Author

nickzerjeski commented Apr 14, 2026

@Frooodle done. I removed the settings-side reminder re-enable path/button as requested and kept only the existing default-app action path.

Included in commit: df25bd4
What changed:
-Removed the defaultPdfEditorPromptRestore / defaultPdfEditorPromptSuppressed UI block from DefaultAppSettings.

  • Removed corresponding hook/service wiring that supported resetting prompt preferences from settings.
  • Removed the now-unused en-GB translation keys for that settings block.

@nickzerjeski nickzerjeski requested a review from Ludy87 as a code owner April 14, 2026 10:24
@stirlingbot stirlingbot bot added the Github label Apr 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Front End Issues or pull requests related to front-end development Github size:L This PR changes 100-499 lines ignoring generated files. Translation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature Request]: A way to permanently disable the request to make Stirling PDF your default application for opening PDF files

5 participants