-
Notifications
You must be signed in to change notification settings - Fork 11
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
1 parent
4434324
commit ed22a7b
Showing
2 changed files
with
37 additions
and
0 deletions.
There are no files selected for viewing
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 |
---|---|---|
|
@@ -14,6 +14,7 @@ pub mod skin; | |
pub mod social; | ||
pub mod status; | ||
pub mod sync; | ||
pub mod theme; | ||
|
||
pub use sync::*; | ||
|
||
|
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,36 @@ | ||
use std::collections::HashMap; | ||
|
||
use serde::{Deserialize, Serialize}; | ||
|
||
use crate::utils::time::time; | ||
|
||
#[derive(Deserialize, Serialize, Default)] | ||
pub struct HomeTheme { | ||
selected: String, | ||
themes: HashMap<String, Theme>, | ||
} | ||
|
||
impl HomeTheme { | ||
pub fn new() -> Self { | ||
Self::default() | ||
} | ||
|
||
pub fn select_theme(&mut self, id: String) { | ||
self.selected = id | ||
} | ||
|
||
pub fn set_theme(&mut self, id: String) { | ||
self.themes.insert(id, Theme::default()); | ||
} | ||
} | ||
|
||
#[derive(Deserialize, Serialize)] | ||
pub struct Theme { | ||
unlock: u64, | ||
} | ||
|
||
impl Default for Theme { | ||
fn default() -> Self { | ||
Self { unlock: time() } | ||
} | ||
} |