mirror of
https://github.com/storytold/craft-libs.git
synced 2026-11-18 01:22:49 +00:00
Merge branch 'red/p2fw' into fw/mac1
This commit is contained in:
@@ -117,11 +117,15 @@ impl NoticeCenter {
|
||||
NoticeCenter { window: WindowKey::main(), timeout: Some(toast::TIMEOUT) }
|
||||
}
|
||||
|
||||
/// Posts `notice` to the center's window in the running viewport; `None` when its dismiss key is in `silenced`.
|
||||
/// Posts `notice` to the center's window in the running viewport; `None` when its dismiss key is in `silenced`, and
|
||||
/// in a measuring run, which posts nothing and tracks nothing (the real run posts it).
|
||||
pub fn post(&self, ctx: &Context, notice: &PostedNotice, silenced: &[String]) -> Option<ToastId> {
|
||||
if notice.dismiss_key.as_ref().is_some_and(|key| silenced.contains(key)) {
|
||||
return None;
|
||||
}
|
||||
if !crate::runtime::measure::effect(ctx, "notices::post") {
|
||||
return None;
|
||||
}
|
||||
let politeness = if notice.tone == Tone::Bad { Politeness::Assertive } else { Politeness::Polite };
|
||||
let timeout = if notice.sticky { None } else { self.timeout };
|
||||
let mut card = Toast::new(Label::Empty).title(notice.title.clone()).lines(notice.lines.clone());
|
||||
|
||||
Reference in New Issue
Block a user