mirror of
https://github.com/signalapp/Signal-Desktop.git
synced 2026-05-08 08:58:38 +01:00
Switch to qrcode-generator library
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
// Copyright 2022 Signal Messenger, LLC
|
||||
// SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
import { useEffect, useState } from 'react';
|
||||
|
||||
export function useDevicePixelRatio(): number {
|
||||
const [result, setResult] = useState(window.devicePixelRatio);
|
||||
|
||||
useEffect(() => {
|
||||
const update = () => {
|
||||
setResult(window.devicePixelRatio);
|
||||
};
|
||||
|
||||
update();
|
||||
|
||||
const mediaQuery = window.matchMedia(
|
||||
`screen and (resolution: ${result}dppx)`
|
||||
);
|
||||
mediaQuery.addEventListener('change', update);
|
||||
|
||||
return () => {
|
||||
mediaQuery.removeEventListener('change', update);
|
||||
};
|
||||
}, [result]);
|
||||
|
||||
return result;
|
||||
}
|
||||
Reference in New Issue
Block a user