Refactor: Make Spotify cloneable

This commit is contained in:
Henrik Friedrichsen
2021-04-03 22:35:08 +02:00
parent 8483653cde
commit 0f573f8247
14 changed files with 49 additions and 62 deletions

View File

@@ -36,12 +36,12 @@ pub struct Library {
pub user_id: Option<String>,
pub display_name: Option<String>,
ev: EventManager,
spotify: Arc<Spotify>,
spotify: Spotify,
pub cfg: Arc<Config>,
}
impl Library {
pub fn new(ev: &EventManager, spotify: Arc<Spotify>, cfg: Arc<Config>) -> Self {
pub fn new(ev: &EventManager, spotify: Spotify, cfg: Arc<Config>) -> Self {
let current_user = spotify.current_user();
let user_id = current_user.as_ref().map(|u| u.id.clone());
let display_name = current_user.as_ref().and_then(|u| u.display_name.clone());