refactor: remove Android typography fix and associated styles from ClientNonUIFeatures
This commit is contained in:
@@ -35,11 +35,9 @@ import {
|
||||
isTauri,
|
||||
isElectron,
|
||||
isCapacitorNative,
|
||||
applyAndroidTypographyFix,
|
||||
sendNotification,
|
||||
setupNotificationTapListener,
|
||||
} from '../../utils/tauri';
|
||||
import '../../styles/android-typography.css';
|
||||
import { setPaarrotNavigate, initPaarrotAPI } from '../../paarrot-api';
|
||||
import {
|
||||
startBackgroundSync,
|
||||
@@ -86,14 +84,6 @@ function EmojiStyleFeature() {
|
||||
return null;
|
||||
}
|
||||
|
||||
function AndroidTypographyFeature() {
|
||||
useEffect(() => {
|
||||
applyAndroidTypographyFix();
|
||||
}, []);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
function PageZoomFeature() {
|
||||
const [pageZoom] = useSetting(settingsAtom, 'pageZoom');
|
||||
|
||||
@@ -694,7 +684,6 @@ export function ClientNonUIFeatures({ children }: ClientNonUIFeaturesProps) {
|
||||
return (
|
||||
<>
|
||||
<EmojiStyleFeature />
|
||||
<AndroidTypographyFeature />
|
||||
<PageZoomFeature />
|
||||
<FaviconUpdater />
|
||||
<InviteNotifications />
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
/*
|
||||
* Android WebView renders Inter Variable with broken word/letter spacing.
|
||||
* Applied when html.android-capacitor is set (see applyAndroidTypographyFix).
|
||||
*/
|
||||
html.android-capacitor body {
|
||||
letter-spacing: normal;
|
||||
word-spacing: normal;
|
||||
}
|
||||
@@ -256,31 +256,14 @@ export const isCapacitorAndroid = (): boolean => {
|
||||
};
|
||||
|
||||
/**
|
||||
* Android WebView mishandles Inter Variable — swap to static Inter / system fonts.
|
||||
* Android WebView: keep emoji fonts out of the body text stack and use system UI fonts.
|
||||
*/
|
||||
export const applyAndroidTypographyFix = (): void => {
|
||||
if (!isCapacitorAndroid()) return;
|
||||
|
||||
const root = document.documentElement;
|
||||
root.classList.add('android-capacitor');
|
||||
|
||||
void (async () => {
|
||||
try {
|
||||
await import('@fontsource/inter/400.css');
|
||||
await import('@fontsource/inter/500.css');
|
||||
await import('@fontsource/inter/600.css');
|
||||
root.style.setProperty(
|
||||
'--font-secondary',
|
||||
`'Inter', system-ui, Roboto, 'Noto Sans', var(--font-emoji), sans-serif`
|
||||
);
|
||||
} catch (err) {
|
||||
console.warn('[applyAndroidTypographyFix] Falling back to system font:', err);
|
||||
root.style.setProperty(
|
||||
'--font-secondary',
|
||||
`system-ui, Roboto, 'Noto Sans', var(--font-emoji), sans-serif`
|
||||
);
|
||||
}
|
||||
})();
|
||||
root.style.setProperty('--font-secondary', 'system-ui, Roboto, "Noto Sans", sans-serif');
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user