Custom fields repo into AppState
This commit is contained in:
1 parent
be64b1da2d
commit
f61f93717c
6 files changed
+20
-3
No files matched your search
@@ -17,6 +17,7 @@ use log::info;
|
||||
use parking_lot::{Mutex, RwLock};
|
||||
use rusqlite::Connection;
|
||||
use std::sync::Arc;
|
||||
use crate::data_provider::custom_fields::CustomFieldRepository;
|
||||
|
||||
pub const USER_FONT: Font = Font::with_name("Noto Sans JP");
|
||||
|
||||
@@ -65,6 +66,7 @@ pub struct AppState {
|
||||
pub decks: DeckRepository,
|
||||
pub word_groups: WordGroupRepository,
|
||||
pub card_states: CardStateRepository,
|
||||
pub custom_fields: CustomFieldRepository,
|
||||
pub connection: Arc<Mutex<SqliteConnection>>,
|
||||
pub sync_data: Arc<RwLock<AppSettings>>,
|
||||
pub history: HistoryRepository,
|
||||
@@ -85,6 +87,7 @@ impl AppState {
|
||||
word_groups: WordGroupRepository::new(connection.clone()),
|
||||
card_states: CardStateRepository::new(connection.clone()),
|
||||
history: HistoryRepository::new(connection.clone()),
|
||||
custom_fields: CustomFieldRepository::new(connection.clone()),
|
||||
sync_data: Arc::new(RwLock::new(AppSettings {
|
||||
key: None,
|
||||
auto_web_fetch: false,
|
||||
@@ -104,6 +107,7 @@ pub fn fill_state(state: &mut AppState) {
|
||||
state.decks.write().start().unwrap();
|
||||
state.history.write().start().unwrap();
|
||||
state.card_states.write().start().unwrap();
|
||||
state.custom_fields.write().start().unwrap();
|
||||
|
||||
state.sync_data = Arc::new(RwLock::new(setting))
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user