mirror of
https://github.com/infinilabs/coco-app.git
synced 2025-12-16 19:47:43 +01:00
refactor: replacing the open method (#340)
This commit is contained in:
@@ -1,5 +1,4 @@
|
|||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import { open } from "@tauri-apps/plugin-shell";
|
|
||||||
|
|
||||||
import { hide_coco } from "@/commands";
|
import { hide_coco } from "@/commands";
|
||||||
import platformAdapter from "./platformAdapter";
|
import platformAdapter from "./platformAdapter";
|
||||||
@@ -67,9 +66,8 @@ export const OpenURLWithBrowser = async (url: string) => {
|
|||||||
if (!url) return;
|
if (!url) return;
|
||||||
if (IsTauri()) {
|
if (IsTauri()) {
|
||||||
try {
|
try {
|
||||||
await open(url);
|
await platformAdapter.openExternal(url);
|
||||||
await hide_coco();
|
await hide_coco();
|
||||||
await platformAdapter.invokeBackend("hide_coco");
|
|
||||||
console.log("URL opened in default browser");
|
console.log("URL opened in default browser");
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("Failed to open URL:", error);
|
console.error("Failed to open URL:", error);
|
||||||
|
|||||||
Reference in New Issue
Block a user