mirror of
https://github.com/flectar/mail.git
synced 2026-11-11 17:57:54 +00:00
ohos: hide the app icon choice
This commit is contained in:
1 parent
f9ace0e1b1
commit
b07038b024
5 files changed
+17
-3
No files matched your search
@@ -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
@@ -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)]
|
||||
|
||||
@@ -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());
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in new issue
Block a user