mirror of
https://github.com/Vendicated/Vencord.git
synced 2025-02-24 15:35:11 +00:00
fix logic for win11 detection
This commit is contained in:
parent
600e750437
commit
e506d76e76
1 changed files with 16 additions and 18 deletions
|
@ -48,6 +48,21 @@ type KeysOfType<Object, Type> = {
|
||||||
|
|
||||||
|
|
||||||
function VencordSettings() {
|
function VencordSettings() {
|
||||||
|
/*
|
||||||
|
we need to detect win11 for background material,
|
||||||
|
which is not supported by win 10
|
||||||
|
https://learn.microsoft.com/en-us/microsoft-edge/web-platform/how-to-detect-win11#sample-code-for-detecting-windows-11
|
||||||
|
*/
|
||||||
|
const [isWindows11, , isWindows11Pending] = useAwaiter(async () => {
|
||||||
|
if (
|
||||||
|
!navigator?.userAgentData ||
|
||||||
|
navigator?.userAgentData?.platform !== "Windows"
|
||||||
|
) return false;
|
||||||
|
|
||||||
|
const ua = await navigator.userAgentData.getHighEntropyValues(["platformVersion"]);
|
||||||
|
const majorPlatformVersion = parseInt(ua?.platformVersion?.split(".")[0]!, 10);
|
||||||
|
return majorPlatformVersion >= 13;
|
||||||
|
}, { fallbackValue: false });
|
||||||
const [settingsDir, , settingsDirPending] = useAwaiter(VencordNative.settings.getSettingsDir, {
|
const [settingsDir, , settingsDirPending] = useAwaiter(VencordNative.settings.getSettingsDir, {
|
||||||
fallbackValue: "Loading..."
|
fallbackValue: "Loading..."
|
||||||
});
|
});
|
||||||
|
@ -58,24 +73,6 @@ function VencordSettings() {
|
||||||
const isWindows = navigator.platform.toLowerCase().startsWith("win");
|
const isWindows = navigator.platform.toLowerCase().startsWith("win");
|
||||||
const isMac = navigator.platform.toLowerCase().startsWith("mac");
|
const isMac = navigator.platform.toLowerCase().startsWith("mac");
|
||||||
const needsVibrancySettings = IS_DISCORD_DESKTOP && isMac;
|
const needsVibrancySettings = IS_DISCORD_DESKTOP && isMac;
|
||||||
|
|
||||||
/*
|
|
||||||
we need to detect win11 for background material,
|
|
||||||
which is not supported by win 10
|
|
||||||
https://learn.microsoft.com/en-us/microsoft-edge/web-platform/how-to-detect-win11#sample-code-for-detecting-windows-11
|
|
||||||
*/
|
|
||||||
let isWindows11 = false;
|
|
||||||
navigator?.userAgentData?.getHighEntropyValues(["platformVersion"])
|
|
||||||
.then(ua => {
|
|
||||||
if (isWindows) {
|
|
||||||
const majorPlatformVersion = parseInt(
|
|
||||||
ua?.platformVersion?.split(".")[0]!
|
|
||||||
);
|
|
||||||
if (majorPlatformVersion >= 13) {
|
|
||||||
isWindows11 = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
const needsBackgroundMaterial = IS_DISCORD_DESKTOP && isWindows11;
|
const needsBackgroundMaterial = IS_DISCORD_DESKTOP && isWindows11;
|
||||||
|
|
||||||
const Switches: Array<false | {
|
const Switches: Array<false | {
|
||||||
|
@ -285,6 +282,7 @@ function VencordSettings() {
|
||||||
serialize={identity} />
|
serialize={identity} />
|
||||||
</>}
|
</>}
|
||||||
|
|
||||||
|
|
||||||
<Forms.FormSection className={Margins.top16} title="Vencord Notifications" tag="h5">
|
<Forms.FormSection className={Margins.top16} title="Vencord Notifications" tag="h5">
|
||||||
<Flex>
|
<Flex>
|
||||||
<Button onClick={openNotificationSettingsModal}>
|
<Button onClick={openNotificationSettingsModal}>
|
||||||
|
|
Loading…
Add table
Reference in a new issue