Render downloads internal page

This commit is contained in:
2026-05-07 21:30:39 -04:00
parent d40e33c206
commit f93943ccfe
8 changed files with 361 additions and 3 deletions
@@ -0,0 +1,35 @@
use std::time::SystemTime;
use ely_domain::{DownloadEntry, DownloadId, UrlText};
use crate::CoreError;
use super::BrowserCore;
impl BrowserCore {
pub fn record_download_started(
&mut self,
source_url: UrlText,
file_name: impl Into<String>,
total_bytes: Option<u64>,
) -> Result<DownloadId, CoreError> {
let entry = DownloadEntry::started(
self.active_profile_id.clone(),
source_url,
file_name,
total_bytes,
SystemTime::now(),
)?;
let download_id = entry.id().clone();
self.download_entries.push(entry);
Ok(download_id)
}
pub(super) fn visible_downloads(&self) -> Vec<DownloadEntry> {
self.download_entries
.iter()
.filter(|entry| entry.profile_id() == &self.active_profile_id)
.cloned()
.collect()
}
}