Clean up unused catalog function and wire source info into catalog view
This commit is contained in:
@@ -94,24 +94,6 @@ pub fn sync_catalog(db: &Database, source: &CatalogSource) -> Result<u32, Catalo
|
||||
Ok(count)
|
||||
}
|
||||
|
||||
/// Search the local catalog database for apps matching a query.
|
||||
pub fn search_catalog(db: &Database, query: &str) -> Vec<CatalogApp> {
|
||||
let records = db.search_catalog_apps(query).unwrap_or_default();
|
||||
records.into_iter().map(|r| CatalogApp {
|
||||
name: r.name,
|
||||
description: r.description,
|
||||
categories: r.categories
|
||||
.map(|c| c.split(", ").map(String::from).collect())
|
||||
.unwrap_or_default(),
|
||||
latest_version: r.latest_version,
|
||||
download_url: r.download_url,
|
||||
icon_url: r.icon_url,
|
||||
homepage: r.homepage,
|
||||
file_size: r.file_size.map(|s| s as u64),
|
||||
architecture: r.architecture,
|
||||
}).collect()
|
||||
}
|
||||
|
||||
/// Download an AppImage from the catalog to a local directory.
|
||||
pub fn install_from_catalog(app: &CatalogApp, install_dir: &Path) -> Result<PathBuf, CatalogError> {
|
||||
fs::create_dir_all(install_dir).map_err(|e| CatalogError::Io(e.to_string()))?;
|
||||
@@ -351,7 +333,7 @@ mod tests {
|
||||
#[test]
|
||||
fn test_search_catalog_empty() {
|
||||
let db = crate::core::database::Database::open_in_memory().unwrap();
|
||||
let results = search_catalog(&db, "firefox");
|
||||
let results = db.search_catalog_apps("firefox").unwrap();
|
||||
assert!(results.is_empty());
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user