chore(opds): disable popular online opds catalogs in certain regions on App Store (#3031)

This commit is contained in:
Huang Xin
2026-01-22 11:42:16 +01:00
committed by GitHub
parent d1d0d2d59c
commit 48920a87bf
18 changed files with 170 additions and 46 deletions
@@ -186,6 +186,13 @@ pub(crate) async fn select_directory<R: Runtime>(
Ok(result)
}
#[command]
pub(crate) async fn get_storefront_region_code<R: Runtime>(
app: AppHandle<R>,
) -> Result<GetStorefrontRegionCodeResponse> {
app.native_bridge().get_storefront_region_code()
}
#[command]
pub(crate) async fn request_manage_storage_permission<R: Runtime>(
app: AppHandle<R>,
@@ -137,6 +137,10 @@ impl<R: Runtime> NativeBridge<R> {
Err(crate::Error::UnsupportedPlatformError)
}
pub fn get_storefront_region_code(&self) -> crate::Result<GetStorefrontRegionCodeResponse> {
Err(crate::Error::UnsupportedPlatformError)
}
pub fn request_manage_storage_permission(
&self,
) -> crate::Result<RequestManageStoragePermissionResponse> {
@@ -77,6 +77,7 @@ pub fn init<R: Runtime>() -> TauriPlugin<R> {
commands::get_external_sdcard_path,
commands::open_external_url,
commands::select_directory,
commands::get_storefront_region_code,
commands::request_manage_storage_permission,
])
.setup(|app, api| {
@@ -224,6 +224,14 @@ impl<R: Runtime> NativeBridge<R> {
}
}
impl<R: Runtime> NativeBridge<R> {
pub fn get_storefront_region_code(&self) -> crate::Result<GetStorefrontRegionCodeResponse> {
self.0
.run_mobile_plugin("get_storefront_region_code", ())
.map_err(Into::into)
}
}
impl<R: Runtime> NativeBridge<R> {
pub fn request_manage_storage_permission(
&self,
@@ -230,3 +230,10 @@ pub struct SelectDirectoryResponse {
pub path: Option<String>,
pub error: Option<String>,
}
#[derive(Debug, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct GetStorefrontRegionCodeResponse {
pub region_code: Option<String>,
pub error: Option<String>,
}