(feat): add ttp-tauri and integrate it
(feat): change font to Public Sans
This commit is contained in:
parent
1e90171ee9
commit
4c0f2fde91
13 changed files with 73 additions and 64 deletions
|
|
@ -1,47 +1,9 @@
|
|||
use tauri::{AppHandle, ipc::Channel};
|
||||
use serde::Serialize;
|
||||
|
||||
#[derive(Clone, Serialize)]
|
||||
#[serde(rename_all = "camelCase", rename_all_fields = "camelCase", tag = "event", content = "data")]
|
||||
enum DownloadEvent<'a> {
|
||||
Started {
|
||||
url: &'a str,
|
||||
download_id: usize,
|
||||
content_length: usize,
|
||||
},
|
||||
Progress {
|
||||
download_id: usize,
|
||||
chunk_length: usize,
|
||||
},
|
||||
Finished {
|
||||
download_id: usize,
|
||||
},
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
fn download(app: AppHandle, url: String, on_event: Channel<DownloadEvent>) {
|
||||
let content_length = 1000;
|
||||
let download_id = 1;
|
||||
|
||||
on_event.send(DownloadEvent::Started {
|
||||
url: &url,
|
||||
download_id,
|
||||
content_length,
|
||||
}).unwrap();
|
||||
|
||||
for chunk_length in [15, 150, 35, 500, 300] {
|
||||
on_event.send(DownloadEvent::Progress {
|
||||
download_id,
|
||||
chunk_length,
|
||||
}).unwrap();
|
||||
}
|
||||
|
||||
on_event.send(DownloadEvent::Finished { download_id }).unwrap();
|
||||
}
|
||||
|
||||
#[cfg_attr(mobile, tauri::mobile_entry_point)]
|
||||
pub fn run() {
|
||||
let builder = tauri::Builder::default().plugin(tauri_plugin_log::Builder::new().level(tauri_plugin_log::log::LevelFilter::Info).build()).plugin(tauri_plugin_notification::init());
|
||||
let builder = tauri::Builder::default()
|
||||
.plugin(tauri_plugin_log::Builder::new().level(tauri_plugin_log::log::LevelFilter::Info).build())
|
||||
.plugin(tauri_plugin_notification::init())
|
||||
.plugin(ttp_tauri::init());
|
||||
|
||||
let builder = builder
|
||||
.plugin(tauri_plugin_deep_link::init())
|
||||
|
|
|
|||
Loading…
Reference in a new issue