compat: add support for WebView down to version 92, closes #2139 (#2145)

This commit is contained in:
Huang Xin
2025-10-01 01:14:35 +08:00
committed by GitHub
parent 2230741779
commit cdd274e5ca
15 changed files with 118 additions and 43 deletions
+4
View File
@@ -38,3 +38,7 @@ export function hexToOklch(hexColor: string): string {
export const getContrastOklch = (hexColor: string): string => {
return tinycolor(hexColor).isDark() ? '100% 0 0' : '0% 0 0';
};
export const getContrastHex = (hex: string): string => {
return tinycolor(hex).isDark() ? '#FFFFFF' : '#000000';
};
+7 -1
View File
@@ -1,6 +1,6 @@
import { AppService } from '@/types/system';
export const parseWebViewVersion = (appService: AppService | null): string => {
export const parseWebViewInfo = (appService: AppService | null): string => {
const ua = navigator.userAgent;
if (appService?.isAndroidApp) {
@@ -63,3 +63,9 @@ export const parseWebViewVersion = (appService: AppService | null): string => {
return 'Unknown';
}
};
export const parseWebViewVersion = (appService: AppService | null): number => {
const webViewInfo = parseWebViewInfo(appService);
const versionMatch = webViewInfo.match(/([0-9]+)\./);
return versionMatch ? parseFloat(versionMatch[1]!) : 0;
};