import { Capacitor } from "@capacitor/core";
import { getPlatforms } from "@ionic/vue";

export function usePlatform() {
  const platforms = getPlatforms();

  // 优先检测浏览器环境
  if (platforms.includes("desktop") || platforms.includes("mobileweb")) {
    return "browser";
  }

  // 检测原生环境
  if (Capacitor.isNativePlatform()) {
    if (platforms.includes("ios")) {
      return "ios";
    }

    if (platforms.includes("android")) {
      return "android";
    }
  }

  return "browser";
}
