show note about old options screen if any add-ons are installed

This commit is contained in:
Damien Elmes 2021-05-19 16:20:25 +10:00
parent cbd2314e27
commit 581480191a
5 changed files with 14 additions and 4 deletions

View file

@ -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:

View file

@ -935,6 +935,7 @@ message DeckConfigsForUpdate {
DeckConfig defaults = 3;
bool schema_modified = 4;
bool v3_scheduler = 5;
bool have_addons = 6;
}
message UpdateDeckConfigsIn {

View file

@ -38,6 +38,7 @@ impl Collection {
.get_collection_timestamps()?
.schema_changed_since_sync(),
v3_scheduler: self.get_bool(BoolKey::Sched2021),
have_addons: false,
})
}

View file

@ -11,10 +11,16 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
const auxData = state.currentAuxData;
</script>
{#if $components.length}
{#if $components.length || state.haveAddons}
<div>
<h2>Add-ons</h2>
<p>
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.
</p>
{#each $components as addon}
<svelte:component this={addon.component} bind:data={$auxData} {...addon} />
{/each}

View file

@ -58,6 +58,7 @@ export class DeckOptionsState {
readonly defaults: ConfigInner;
readonly addonComponents: Writable<DynamicSvelteComponent[]>;
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