From 581480191acc512b64b7af67f4660e3a49355f9b Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Wed, 19 May 2021 16:20:25 +1000 Subject: [PATCH] show note about old options screen if any add-ons are installed --- qt/aqt/mediasrv.py | 6 +++--- rslib/backend.proto | 1 + rslib/src/deckconfig/update.rs | 1 + ts/deckoptions/Addons.svelte | 8 +++++++- ts/deckoptions/lib.ts | 2 ++ 5 files changed, 14 insertions(+), 4 deletions(-) diff --git a/qt/aqt/mediasrv.py b/qt/aqt/mediasrv.py index a5302df77..2db39f80c 100644 --- a/qt/aqt/mediasrv.py +++ b/qt/aqt/mediasrv.py @@ -282,9 +282,9 @@ def i18n_resources() -> bytes: def deck_configs_for_update() -> bytes: args = from_json_bytes(request.data) - return aqt.mw.col.decks.get_deck_configs_for_update( - deck_id=args["deckId"] - ).SerializeToString() + msg = aqt.mw.col.decks.get_deck_configs_for_update(deck_id=args["deckId"]) + msg.have_addons = aqt.mw.addonManager.dirty + return msg.SerializeToString() def update_deck_configs_request() -> bytes: diff --git a/rslib/backend.proto b/rslib/backend.proto index 78bc7766a..1f3f6e725 100644 --- a/rslib/backend.proto +++ b/rslib/backend.proto @@ -935,6 +935,7 @@ message DeckConfigsForUpdate { DeckConfig defaults = 3; bool schema_modified = 4; bool v3_scheduler = 5; + bool have_addons = 6; } message UpdateDeckConfigsIn { diff --git a/rslib/src/deckconfig/update.rs b/rslib/src/deckconfig/update.rs index 063c9ef83..c018a32fe 100644 --- a/rslib/src/deckconfig/update.rs +++ b/rslib/src/deckconfig/update.rs @@ -38,6 +38,7 @@ impl Collection { .get_collection_timestamps()? .schema_changed_since_sync(), v3_scheduler: self.get_bool(BoolKey::Sched2021), + have_addons: false, }) } diff --git a/ts/deckoptions/Addons.svelte b/ts/deckoptions/Addons.svelte index 040f47892..19dd1220e 100644 --- a/ts/deckoptions/Addons.svelte +++ b/ts/deckoptions/Addons.svelte @@ -11,10 +11,16 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html const auxData = state.currentAuxData; -{#if $components.length} +{#if $components.length || state.haveAddons}

Add-ons

+

+ If you're using an add-on that hasn't been updated to use this new screen + yet, you can access the old deck options screen by holding down the shift + key when opening the options. +

+ {#each $components as addon} {/each} diff --git a/ts/deckoptions/lib.ts b/ts/deckoptions/lib.ts index 416a4e9fd..f31af59f3 100644 --- a/ts/deckoptions/lib.ts +++ b/ts/deckoptions/lib.ts @@ -58,6 +58,7 @@ export class DeckOptionsState { readonly defaults: ConfigInner; readonly addonComponents: Writable; readonly v3Scheduler: boolean; + readonly haveAddons: boolean; private targetDeckId: number; private configs: ConfigWithCount[]; @@ -84,6 +85,7 @@ export class DeckOptionsState { this.configs.findIndex((c) => c.config.id === this.currentDeck.configId) ); this.v3Scheduler = data.v3Scheduler; + this.haveAddons = data.haveAddons; // decrement the use count of the starting item, as we'll apply +1 to currently // selected one at display time