summaryrefslogtreecommitdiff
path: root/src/viewmodel/utility.rs
diff options
context:
space:
mode:
authorjelemux <jeremias.weber@protonmail.com>2021-02-17 17:06:48 +0100
committerjelemux <jeremias.weber@protonmail.com>2021-02-17 17:06:48 +0100
commitcb310a66e94db4e0c4f7d0373a670156b012412a (patch)
tree501fd4ed17d892d693d4123fffaca8d942144e3b /src/viewmodel/utility.rs
parentbe3367dd2921eb30ae7970d233b83ac3af861952 (diff)
parent0660151a8b641fa0a23dde2598132029970f7ae4 (diff)
downloadwasm-card-cb310a66e94db4e0c4f7d0373a670156b012412a.tar.gz
wasm-card-cb310a66e94db4e0c4f7d0373a670156b012412a.tar.bz2
Merge branch 'main' of codeberg.org:jelemux/wasm-card
Diffstat (limited to 'src/viewmodel/utility.rs')
-rw-r--r--src/viewmodel/utility.rs45
1 files changed, 0 insertions, 45 deletions
diff --git a/src/viewmodel/utility.rs b/src/viewmodel/utility.rs
deleted file mode 100644
index 617ee45..0000000
--- a/src/viewmodel/utility.rs
+++ /dev/null
@@ -1,45 +0,0 @@
-#[derive(Clone)]
-pub struct Download {
- pub file_name: String,
- pub content: String,
- pub mime_type: MimeType,
-}
-
-impl Download {
- pub fn as_data_link(&self) -> String {
- let data = base64::encode(&*self.content);
- let uri_component: String = js_sys::encode_uri_component(&data).into();
-
- format!("data:{};base64,{}", self.mime_type.as_text(), uri_component)
- }
-}
-
-#[derive(Clone, Copy)]
-pub enum MimeType {
- PDF,
- VCard,
- SVG,
-}
-
-impl MimeType {
- pub fn as_text(&self) -> &str {
- match self {
- MimeType::PDF => "application/pdf",
- MimeType::VCard => "text/vcard",
- MimeType::SVG => "image/svg+xml",
- }
- }
-}
-
-#[derive(Clone, Copy, PartialEq)]
-pub enum DownloadOption {
- PDF,
- VCard,
- QrCode,
-}
-
-#[derive(Clone, Debug, PartialEq)]
-pub struct File {
- pub name: String,
- pub content: String,
-}