From 94a0e361e180223adf2bc9760c8810dfa3c2681f Mon Sep 17 00:00:00 2001 From: jelemux Date: Thu, 28 Jan 2021 22:24:32 +0100 Subject: use different vcard library --- src/view/name.rs | 27 ++++++--------------------- 1 file changed, 6 insertions(+), 21 deletions(-) (limited to 'src/view/name.rs') diff --git a/src/view/name.rs b/src/view/name.rs index df3fb15..bee9256 100644 --- a/src/view/name.rs +++ b/src/view/name.rs @@ -1,7 +1,7 @@ use crate::viewmodel::Error; use crate::view::WeakComponentLink; use yew::prelude::*; -use vcard::properties; +use vobject::Property; use crate::viewmodel::name::*; use crate::viewmodel::VCardPropertyInputObject; use super::VCardPropertyInputComponent; @@ -24,12 +24,12 @@ pub enum Msg { #[derive(Clone, PartialEq, Properties)] pub struct Props { - pub generated_name: Callback>, - pub generated_fn: Callback>, + pub generated_name: Callback, + pub generated_fn: Callback, pub weak_link: WeakComponentLink, } -impl VCardPropertyInputComponent for NameView { +impl VCardPropertyInputComponent for NameView { fn get_input_object(&self) -> Name { self.value.clone() } @@ -60,23 +60,8 @@ impl Component for NameView { Msg::UpdateLastName(l) => self.value.last_name = l, Msg::UpdateSuffix(s) => self.value.suffix = s, Generate => { - match self.value.formatted_name() { - Ok(formatted_name) => self.props.generated_fn.emit(Ok(formatted_name)), - Err(error) => { - self.props.generated_fn.emit(Err(())); - self.error = Some(error); - }, - }; - match self.value.to_vcard_property() { - Ok(name) => { - self.props.generated_name.emit(Ok(name)); - return false; - }, - Err(error) => { - self.props.generated_name.emit(Err(())); - self.error = Some(error); - }, - }; + self.props.generated_fn.emit(self.value.generate_fn()); + self.props.generated_name.emit(self.value); }, }; true -- cgit v1.2.3