mirror of
https://github.com/MrUnknownDE/VRCX.git
synced 2026-04-25 09:43:49 +02:00
refactor: split common until and add ut
This commit is contained in:
30
src/shared/utils/platformUtils.js
Normal file
30
src/shared/utils/platformUtils.js
Normal file
@@ -0,0 +1,30 @@
|
||||
/**
|
||||
* @param {object} unityPackages
|
||||
* @returns {{ isPC: boolean, isQuest: boolean, isIos: boolean }}
|
||||
*/
|
||||
function getAvailablePlatforms(unityPackages) {
|
||||
let isPC = false;
|
||||
let isQuest = false;
|
||||
let isIos = false;
|
||||
if (typeof unityPackages === 'object') {
|
||||
for (const unityPackage of unityPackages) {
|
||||
if (
|
||||
unityPackage.variant &&
|
||||
unityPackage.variant !== 'standard' &&
|
||||
unityPackage.variant !== 'security'
|
||||
) {
|
||||
continue;
|
||||
}
|
||||
if (unityPackage.platform === 'standalonewindows') {
|
||||
isPC = true;
|
||||
} else if (unityPackage.platform === 'android') {
|
||||
isQuest = true;
|
||||
} else if (unityPackage.platform === 'ios') {
|
||||
isIos = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return { isPC, isQuest, isIos };
|
||||
}
|
||||
|
||||
export { getAvailablePlatforms };
|
||||
Reference in New Issue
Block a user