ohos: hide the app icon choice

This commit is contained in:
Tomás Romero committed 2026-10-31 16:43:15 +01:00
1 parent f9ace0e1b1
commit b07038b024
5 files changed
+17 -3

No files matched your search

+1
View File
@@ -86,6 +86,7 @@ provides these crate-internal items, which shared code calls without a `cfg`:
| `lower_current_thread_priority()` | Run the PDF worker thread at background priority. |
| `install_preview_lifecycle()` | Register for background/memory-pressure notifications, which must call `flectar_mail::suspend_file_preview()`. |
| `NAME` | The platform's name, which Settings uses to describe where the app icon appears. |
| `SWITCHES_APP_ICON` | Whether apps may switch their home screen icon. Settings offers the choice only where they may. |
| `show_app_icon(icon)` | Show the app icon chosen in Settings on the home screen. Android forwards it to the bridge its host registers with `configure_launcher_icon`; iOS switches to the alternate icon sets declared in `platform/ios/project.yml`. |
| `email_font_dir()` | Platform font directory for the email (Blitz/Parley) renderer on hosts without Fontconfig; `None` when the fontique system backend provides the fonts. |
+6 -2
View File
@@ -13,15 +13,19 @@
//! - mobile home screens switch to icons bundled with the app, through the
//! platform layer.
//!
//! Flatpak can neither show a tray nor write to the host's icon theme, so the
//! choice is not offered there.
//! Flatpak can neither show a tray nor write to the host's icon theme, and
//! some mobile platforms reserve switching the home screen icon for system
//! apps, so the choice is not offered there.
use crate::{AppIconVariant, AppWindow, tray_ui::FlectarTray};
use flectar_mail_core::models;
use slint::ComponentHandle;
use std::cell::RefCell;
#[cfg(desktop)]
pub(crate) const AVAILABLE: bool = cfg!(not(feature = "flatpak"));
#[cfg(mobile)]
pub(crate) const AVAILABLE: bool = crate::platform::SWITCHES_APP_ICON;
/// Lets Settings describe where this platform shows the icon.
#[cfg(desktop)]
+3
View File
@@ -61,6 +61,9 @@ pub fn configure_launcher_icon(switch: impl Fn(&str) + Send + Sync + 'static) {
let _ = LAUNCHER_ICON.set(Box::new(switch));
}
/// Android apps may switch their launcher icon, so Settings offers the choice.
pub(crate) const SWITCHES_APP_ICON: bool = true;
pub(crate) fn show_app_icon(icon: AppIcon) {
if let Some(switch) = LAUNCHER_ICON.get() {
switch(icon.as_str());
+3
View File
@@ -73,6 +73,9 @@ pub(crate) fn install_preview_lifecycle() {
unsafe { install_pdf_lifecycle_observers() }
}
/// iOS apps may switch to alternate icons, so Settings offers the choice.
pub(crate) const SWITCHES_APP_ICON: bool = true;
/// Show the alternate icon set declared in project.yml, or the primary icon.
pub(crate) fn show_app_icon(icon: AppIcon) {
let name: Option<&CStr> = match icon {
+4 -1
View File
@@ -55,7 +55,10 @@ pub(crate) fn lower_current_thread_priority() {
pub(crate) fn install_preview_lifecycle() {}
/// Switching the home screen icon is a system API on OpenHarmony
/// (`bundleManager.enableDynamicIcon`), so the choice applies inside the app.
/// (`bundleManager.enableDynamicIcon`), so Settings does not offer the choice.
pub(crate) const SWITCHES_APP_ICON: bool = false;
/// Only the default icon reaches here; see [`SWITCHES_APP_ICON`].
pub(crate) fn show_app_icon(_icon: AppIcon) {}
/// Directory the email (Blitz/Parley) renderer loads fonts from. OpenHarmony