import { defineBoot } from "#q-app/wrappers";
import { Capacitor } from "@capacitor/core";
import { StatusBar, Style } from "@capacitor/status-bar";
import { Keyboard } from "@capacitor/keyboard";

export default defineBoot(async () => {
  if (!Capacitor.isNativePlatform()) return;

  await StatusBar.setOverlaysWebView({ overlay: false });
  await StatusBar.setStyle({ style: Style.Dark });
  await StatusBar.setBackgroundColor({ color: "#661d75" });

  Keyboard.addListener("keyboardWillShow", () => {
    document.body.style.height = "auto";
  });
  Keyboard.addListener("keyboardWillHide", () => {
    document.body.style.height = "";
  });
});
