diff --git a/src/components/common/UnreadCounter.tsx b/src/components/common/UnreadCounter.tsx index 33f71b857..8b4e2eec7 100644 --- a/src/components/common/UnreadCounter.tsx +++ b/src/components/common/UnreadCounter.tsx @@ -1,8 +1,7 @@ -import type { FC } from '../../lib/teact/teact'; import { memo, useEffect } from '../../lib/teact/teact'; +import { ALL_FOLDER_ID } from '../../config'; import { updateAppBadge } from '../../util/appBadge'; -import { getAllNotificationsCount } from '../../util/folderManager'; import { formatIntegerCompact } from '../../util/textFormat'; import { useFolderManagerForUnreadCounters } from '../../hooks/useFolderManager'; @@ -12,9 +11,9 @@ interface OwnProps { isForAppBadge?: boolean; } -const UnreadCounter: FC = ({ isForAppBadge }) => { - useFolderManagerForUnreadCounters(); - const unreadNotificationsCount = getAllNotificationsCount(); +const UnreadCounter = ({ isForAppBadge }: OwnProps) => { + const unreadCounters = useFolderManagerForUnreadCounters(); + const unreadNotificationsCount = unreadCounters[ALL_FOLDER_ID]?.notificationsCount || 0; const lang = useLang(); diff --git a/tauri/Cargo.lock b/tauri/Cargo.lock index e0fd62b0f..18a76dfba 100644 --- a/tauri/Cargo.lock +++ b/tauri/Cargo.lock @@ -5653,7 +5653,7 @@ dependencies = [ [[package]] name = "telegram_air" -version = "2.9.4" +version = "2.9.5" dependencies = [ "ab_glyph", "cocoa", diff --git a/tauri/Cargo.toml b/tauri/Cargo.toml index a6cd5d1da..06e0795ab 100644 --- a/tauri/Cargo.toml +++ b/tauri/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "telegram_air" -version = "2.9.4" +version = "2.9.5" description = "Telegram Air" authors = ["Alexander Zinchuk"] license = "GPLv3" diff --git a/tauri/src/tray/badge.rs b/tauri/src/tray/badge.rs index c081c9381..e6bbbca62 100644 --- a/tauri/src/tray/badge.rs +++ b/tauri/src/tray/badge.rs @@ -121,10 +121,7 @@ pub fn generate_counter_png(size: u32, count: i32, is_muted: bool) -> Vec { if let (Some(text), Some(font), Some(scale)) = (text, font, scale) { let x = edge_space as f32 + ((badge_width as f32 - text_width as f32) / 2.0).ceil(); - - let baseline_offset = scale.y * 0.15; - let y = edge_space as f32 - + ((badge_height as f32 - text_height as f32) / 2.0 - baseline_offset).ceil(); + let y = edge_space as f32 + ((badge_height as f32 - text_height as f32) / 2.0).ceil(); draw_text_mut( &mut img,