From 4bdf3694c3696fee371ed76e79f7b8e1339828b0 Mon Sep 17 00:00:00 2001 From: lollipopkit Date: Thu, 7 Sep 2023 19:05:46 +0800 Subject: [PATCH] new: snippet for installing ServerBoxMonitor --- lib/data/provider/snippet.dart | 10 ++++++++++ lib/data/store/setting.dart | 6 ++++++ 2 files changed, 16 insertions(+) diff --git a/lib/data/provider/snippet.dart b/lib/data/provider/snippet.dart index e050fe27..29575a0a 100644 --- a/lib/data/provider/snippet.dart +++ b/lib/data/provider/snippet.dart @@ -29,9 +29,19 @@ class SnippetProvider extends ChangeNotifier { order.removeWhere((e) => surplus.any((ele) => ele == e)); _setting.snippetOrder.put(order); } + _addInternal(); _updateTags(); } + void _addInternal() { + if (!_setting.fTISBM.fetch()) { + return; + } + _snippets.add(installSBM); + _store.put(installSBM); + _setting.fTISBM.put(false); + } + void _updateTags() { _tags.clear(); final tags = {}; diff --git a/lib/data/store/setting.dart b/lib/data/store/setting.dart index 46c6125f..75e097ef 100644 --- a/lib/data/store/setting.dart +++ b/lib/data/store/setting.dart @@ -191,9 +191,15 @@ class SettingStore extends PersistentStore { ); // Never show these settings for users + // Guide for these settings: + // - key should start with `_` and be shorter as possible + // // ------BEGIN------ /// Version of store db late final storeVersion = StoreProperty(box, 'storeVersion', 0); + + /// Whether is first time to add Snippet + late final fTISBM = StoreProperty(box, '_fTISBM', true); // ------END------ }