Tauri: Fix badge centering (#6690)
This commit is contained in:
parent
6908e40e0f
commit
d32d1b3328
@ -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<OwnProps> = ({ isForAppBadge }) => {
|
||||
useFolderManagerForUnreadCounters();
|
||||
const unreadNotificationsCount = getAllNotificationsCount();
|
||||
const UnreadCounter = ({ isForAppBadge }: OwnProps) => {
|
||||
const unreadCounters = useFolderManagerForUnreadCounters();
|
||||
const unreadNotificationsCount = unreadCounters[ALL_FOLDER_ID]?.notificationsCount || 0;
|
||||
|
||||
const lang = useLang();
|
||||
|
||||
|
||||
2
tauri/Cargo.lock
generated
2
tauri/Cargo.lock
generated
@ -5653,7 +5653,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "telegram_air"
|
||||
version = "2.9.4"
|
||||
version = "2.9.5"
|
||||
dependencies = [
|
||||
"ab_glyph",
|
||||
"cocoa",
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "telegram_air"
|
||||
version = "2.9.4"
|
||||
version = "2.9.5"
|
||||
description = "Telegram Air"
|
||||
authors = ["Alexander Zinchuk"]
|
||||
license = "GPLv3"
|
||||
|
||||
@ -121,10 +121,7 @@ pub fn generate_counter_png(size: u32, count: i32, is_muted: bool) -> Vec<u8> {
|
||||
|
||||
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,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user