-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
49 additions
and
2 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
use serde::{Deserialize, Serialize}; | ||
use serde_json::json; | ||
use tauri::{AppHandle, Manager}; | ||
use tauri_plugin_store::StoreBuilder; | ||
|
||
#[derive(Deserialize, Serialize, Debug)] | ||
#[serde(rename_all = "SCREAMING_SNAKE_CASE")] | ||
pub enum WindowLayout { | ||
Left, | ||
Right, | ||
Center, | ||
} | ||
|
||
#[derive(Deserialize, Serialize, Debug)] | ||
#[serde(rename_all = "camelCase")] | ||
pub struct Config { | ||
pub pin: bool, | ||
pub placment: WindowLayout, | ||
pub telemetry: bool, | ||
pub join_history_notifications: bool, | ||
pub show_only_talking_users: bool, | ||
} | ||
|
||
// create a helper function to seed the config with values | ||
pub fn create_config(app: &AppHandle) { | ||
// create the store | ||
let mut appdir = app.path_resolver().app_data_dir().unwrap(); | ||
appdir.push("config_v2.json"); | ||
|
||
let mut store = StoreBuilder::new(app.app_handle(), appdir).build(); | ||
store.insert("pin".to_string(), json!(false)); | ||
store.insert("placement".to_string(), json!(WindowLayout::Center)); | ||
store.insert("telemetry".to_string(), json!(true)); | ||
store.insert("join_history_notifications".to_string(), json!(true)); | ||
store.insert("show_only_talking_users".to_string(), json!(true)); | ||
|
||
store.save(); | ||
println!("ayo"); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters