mirror of
https://github.com/Memo-2023/mana-monorepo.git
synced 2026-05-15 21:59:40 +02:00
Projects included: - maerchenzauber (NestJS backend + Expo mobile + SvelteKit web + Astro landing) - manacore (Expo mobile + SvelteKit web + Astro landing) - manadeck (NestJS backend + Expo mobile + SvelteKit web) - memoro (Expo mobile + SvelteKit web + Astro landing) This commit preserves the current state before monorepo restructuring. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
49 lines
No EOL
1.4 KiB
TypeScript
49 lines
No EOL
1.4 KiB
TypeScript
import { Platform } from 'react-native';
|
|
|
|
/**
|
|
* Detects if the app is running on macOS (via Mac Catalyst)
|
|
*/
|
|
export const isMacOS = (): boolean => {
|
|
// Check if running on iOS with Mac Catalyst
|
|
if (Platform.OS === 'ios') {
|
|
// @ts-ignore - isPad and isMacCatalyst are not in TypeScript definitions
|
|
const isPad = Platform.isPad;
|
|
const isMacCatalyst = Platform.isMacCatalyst;
|
|
|
|
// Mac Catalyst apps report as iOS but have special properties
|
|
if (isMacCatalyst === true) {
|
|
return true;
|
|
}
|
|
|
|
// Additional check: window dimensions on Mac are typically larger
|
|
if (typeof window !== 'undefined' && window.screen) {
|
|
const { width, height } = window.screen;
|
|
// Mac screens are typically much larger than iOS devices
|
|
if (width > 1920 || height > 1080) {
|
|
return true;
|
|
}
|
|
}
|
|
}
|
|
|
|
return false;
|
|
};
|
|
|
|
/**
|
|
* @deprecated Zeego handles platform differences internally
|
|
* Kept for backward compatibility, will be removed in future
|
|
*/
|
|
export const shouldDisableContextMenu = (): boolean => {
|
|
// Zeego handles all platform differences internally
|
|
// This function is deprecated and always returns false
|
|
return false;
|
|
};
|
|
|
|
/**
|
|
* Returns a safe platform string for logging and debugging
|
|
*/
|
|
export const getPlatformString = (): string => {
|
|
if (isMacOS()) return 'macos';
|
|
if (Platform.OS === 'ios') return 'ios';
|
|
if (Platform.OS === 'android') return 'android';
|
|
return Platform.OS;
|
|
}; |