mirror of
https://github.com/streetwriters/notesnook.git
synced 2025-12-16 19:57:52 +01:00
web: fix web app on Safari
This commit is contained in:
2116
apps/web/package-lock.json
generated
2116
apps/web/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
2
apps/web/src/global.d.ts
vendored
2
apps/web/src/global.d.ts
vendored
@@ -71,7 +71,7 @@ declare global {
|
|||||||
}
|
}
|
||||||
interface Window {
|
interface Window {
|
||||||
ApplePaySession?: {
|
ApplePaySession?: {
|
||||||
canMakePayments(): boolean;
|
canMakePayments(): boolean | Promise<boolean>;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,9 +22,18 @@ const FEATURE_CHECKS = {
|
|||||||
cache: false,
|
cache: false,
|
||||||
indexedDB: false,
|
indexedDB: false,
|
||||||
clonableCryptoKey: false,
|
clonableCryptoKey: false,
|
||||||
applePaySupported: !!window.ApplePaySession?.canMakePayments()
|
applePaySupported: false
|
||||||
};
|
};
|
||||||
|
|
||||||
|
async function isApplePaySupported() {
|
||||||
|
try {
|
||||||
|
FEATURE_CHECKS.applePaySupported =
|
||||||
|
!!(await window.ApplePaySession?.canMakePayments());
|
||||||
|
} catch {
|
||||||
|
FEATURE_CHECKS.applePaySupported = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async function isOPFSSupported() {
|
async function isOPFSSupported() {
|
||||||
const hasGetDirectory =
|
const hasGetDirectory =
|
||||||
"getDirectory" in window.navigator.storage &&
|
"getDirectory" in window.navigator.storage &&
|
||||||
@@ -93,7 +102,8 @@ export async function initializeFeatureChecks() {
|
|||||||
isOPFSSupported(),
|
isOPFSSupported(),
|
||||||
isCacheSupported(),
|
isCacheSupported(),
|
||||||
isIndexedDBSupported(),
|
isIndexedDBSupported(),
|
||||||
isCryptoKeyClonable()
|
isCryptoKeyClonable(),
|
||||||
|
isApplePaySupported()
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user