Skip to content

Commit bcf29f4

Browse files
committed
update types
1 parent db319c3 commit bcf29f4

File tree

9 files changed

+80
-41
lines changed

9 files changed

+80
-41
lines changed

src-ahqstore-types/Cargo.lock

Lines changed: 22 additions & 21 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src-ahqstore-types/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "ahqstore-types"
33
description = "Standard types used by AHQ Store"
4-
version = "3.12.1"
4+
version = "3.14.0"
55
edition = "2021"
66
license-file = "../LICENSE.md"
77
repository = "https://github.com/ahqstore/client"

src-ahqstore-types/js_macros/Cargo.lock

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src-ahqstore-types/js_macros/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "kfghdfghdfkgh_js_macros"
3-
version = "1.0.1"
3+
version = "1.0.2"
44
edition = "2021"
55
description = "This is an internal crate"
66
license = "MIT"

src-ahqstore-types/src/api/fdroid.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ pub static FDROID_APP_ASSET_URL: LazyLock<String> =
1717
LazyLock::new(|| format!("{FDROID_BASE_URL}/db/res/{{APP_ID}}/{{ASSET}}"));
1818

1919
pub static FDROID_TOTAL: LazyLock<String> = LazyLock::new(|| format!("{FDROID_BASE_URL}/db/total"));
20+
pub static FDROID_HOME: LazyLock<String> = LazyLock::new(|| format!("{FDROID_BASE_URL}/db/home.json"));
2021

2122
pub static FDROID_SEARCH: LazyLock<String> =
2223
LazyLock::new(|| format!("{FDROID_BASE_URL}/db/search/{{ID}}.json"));

src-ahqstore-types/src/api/internet.rs

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,14 @@ use super::{
1616
AHQSTORE_MAP, AHQSTORE_SEARCH, AHQSTORE_TOTAL,
1717
},
1818
fdroid::{
19-
FDROID_APPS_DEV, FDROID_APP_ASSET_URL, FDROID_APP_URL, FDROID_DEV_DATA, FDROID_MAP,
20-
FDROID_SEARCH, FDROID_TOTAL,
19+
FDROID_APPS_DEV, FDROID_APP_ASSET_URL, FDROID_APP_URL, FDROID_DEV_DATA, FDROID_HOME, FDROID_MAP, FDROID_SEARCH, FDROID_TOTAL
2120
},
2221
linux::{
23-
self, LINUX_APPS_DEV, LINUX_APP_ASSET_URL, LINUX_APP_URL, LINUX_DEV_DATA, LINUX_MAP,
24-
LINUX_SEARCH, LINUX_TOTAL,
22+
self, LINUX_APPS_DEV, LINUX_APP_ASSET_URL, LINUX_APP_URL, LINUX_DEV_DATA, LINUX_HOME, LINUX_MAP, LINUX_SEARCH, LINUX_TOTAL
2523
},
2624
methods::{self, OfficialManifestSource, Store},
2725
winget::{
28-
WINGET_APPS_DEV, WINGET_APP_ASSET_URL, WINGET_APP_URL, WINGET_DEV_DATA, WINGET_MAP,
29-
WINGET_SEARCH, WINGET_TOTAL,
26+
WINGET_APPS_DEV, WINGET_APP_ASSET_URL, WINGET_APP_URL, WINGET_DEV_DATA, WINGET_HOME, WINGET_MAP, WINGET_SEARCH, WINGET_TOTAL
3027
},
3128
SearchEntry,
3229
};
@@ -89,10 +86,19 @@ pub async fn get_total_maps_by_source(
8986
methods::get_total_maps(total, commit).await.context("")
9087
}
9188

92-
pub async fn get_home(ahqstore_repo_commit: &str) -> Result<Vec<(String, Vec<String>)>> {
93-
let home = &*AHQSTORE_HOME;
89+
#[allow(unreachable_patterns)]
90+
pub async fn get_home(source: OfficialManifestSource, commit: &str) -> Result<Vec<(String, Vec<String>)>> {
91+
let home = match source {
92+
OfficialManifestSource::AHQStore => &*AHQSTORE_HOME,
93+
OfficialManifestSource::WinGet => &*WINGET_HOME,
94+
OfficialManifestSource::FDroid => &*FDROID_HOME,
95+
OfficialManifestSource::Linux => &*LINUX_HOME,
96+
_ => {
97+
return Err(anyhow!("source not supported"));
98+
}
99+
};
94100

95-
methods::get_home(home, ahqstore_repo_commit)
101+
methods::get_home(home, commit)
96102
.await
97103
.context("")
98104
}

src-ahqstore-types/src/api/winget.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ pub static WINGET_APP_ASSET_URL: LazyLock<String> =
1717
LazyLock::new(|| format!("{WINGET_BASE_URL}/db/res/{{APP_ID}}/{{ASSET}}"));
1818

1919
pub static WINGET_TOTAL: LazyLock<String> = LazyLock::new(|| format!("{WINGET_BASE_URL}/db/total"));
20+
pub static WINGET_HOME: LazyLock<String> = LazyLock::new(|| format!("{WINGET_BASE_URL}/db/home.json"));
2021

2122
pub static WINGET_SEARCH: LazyLock<String> =
2223
LazyLock::new(|| format!("{WINGET_BASE_URL}/db/search/{{ID}}.json"));

src-ahqstore-types/src/app/install.rs

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ pub struct InstallerOptionsWindows {
5555

5656
#[allow(non_snake_case)]
5757
#[derive(Serialize, Deserialize, Debug, Clone)]
58-
#[doc = "🔬 Planned\n\n"]
58+
#[doc = "🔬 Under Development\n\n"]
5959
#[cfg_attr(feature = "js", wasm_bindgen)]
6060
pub enum AndroidAbi {
6161
Aarch64,
@@ -75,9 +75,19 @@ impl AndroidAbi {
7575
}
7676
}
7777

78+
fn android_abi() -> &'static str {
79+
match ARCH {
80+
"x86" => "android-x86",
81+
"x86_64" => "android-x86_64",
82+
"arm" => "android-armv7",
83+
"aarch64" => "android-aarch64",
84+
_ => "none"
85+
}
86+
}
87+
7888
#[allow(non_snake_case)]
7989
#[derive(Serialize, Deserialize, Debug, Clone)]
80-
#[doc = "🔬 Planned\n\n"]
90+
#[doc = "🔬 Under Development\n\n"]
8191
#[cfg_attr(feature = "js", wasm_bindgen(getter_with_clone))]
8292
pub struct InstallerOptionsAndroid {
8393
#[doc = "🎯 Introduced in v2\n\n"]
@@ -137,12 +147,27 @@ impl InstallerOptions {
137147
pub fn is_supported(&self) -> bool {
138148
let os = self.list_os_arch();
139149
if OS == "android" {
140-
return os.contains(&"android");
150+
return os.contains(&android_abi());
141151
}
142152

143153
os.contains(&format!("{}-{}", OS, ARCH).as_str())
144154
}
145155

156+
#[doc = "🎯 Introduced in v3"]
157+
pub fn is_supported_android(&self, sdk: u32) -> bool {
158+
let os = self.list_os_arch();
159+
160+
let Some(x) = &self.android else {
161+
return false;
162+
};
163+
164+
if OS == "android" {
165+
return os.contains(&android_abi()) && x.min_sdk == sdk;
166+
}
167+
168+
false
169+
}
170+
146171
#[doc = "🎯 Introduced in v2"]
147172
pub fn has_platform(&self) -> bool {
148173
self.is_supported()

src-ahqstore-types/src/app/mod.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ pub struct AHQStoreApplication {
5050
/// App description
5151
pub description: String,
5252

53-
/// Your Github Repo associated
53+
/// The Github Repo associated
5454
pub repo: AppRepo,
5555

5656
/// Will be generated by the cli, it is the unique-version-hash of your app
@@ -269,6 +269,11 @@ impl AHQStoreApplication {
269269
}
270270
}
271271

272+
#[doc = "🎯 Introduced in v3"]
273+
pub fn is_supported_android(&self, sdk: u32) -> bool {
274+
self.install.is_supported_android(sdk)
275+
}
276+
272277
#[doc = "🎯 Introduced in v2"]
273278
pub fn get_android_download(&self) -> Option<&DownloadUrl> {
274279
let Some(android) = &self.install.android else {

0 commit comments

Comments
 (0)