Remove deprecated meshtastic/js dependency (#638)
* Remove deprecated meshtastic/js dependency * Bump dependency version * Fix linting --------- Co-authored-by: philon- <philon-@users.noreply.github.com>
This commit is contained in:
co-authored by
philon-
parent
828e5d0903
commit
4275bdd0c0
+3
-4
@@ -36,10 +36,9 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@bufbuild/protobuf": "^2.2.5",
|
"@bufbuild/protobuf": "^2.2.5",
|
||||||
"@meshtastic/core": "npm:@jsr/meshtastic__core@2.6.2",
|
"@meshtastic/core": "npm:@jsr/meshtastic__core@2.6.2",
|
||||||
"@meshtastic/js": "npm:@jsr/meshtastic__js@2.6.0-0",
|
"@meshtastic/transport-http": "npm:@jsr/meshtastic__transport-http@0.2.1",
|
||||||
"@meshtastic/transport-http": "npm:@jsr/meshtastic__transport-http",
|
"@meshtastic/transport-web-bluetooth": "npm:@jsr/meshtastic__transport-web-bluetooth@0.1.2",
|
||||||
"@meshtastic/transport-web-bluetooth": "npm:@jsr/meshtastic__transport-web-bluetooth",
|
"@meshtastic/transport-web-serial": "npm:@jsr/meshtastic__transport-web-serial@0.2.1",
|
||||||
"@meshtastic/transport-web-serial": "npm:@jsr/meshtastic__transport-web-serial",
|
|
||||||
"@noble/curves": "^1.9.0",
|
"@noble/curves": "^1.9.0",
|
||||||
"@radix-ui/react-accordion": "^1.2.8",
|
"@radix-ui/react-accordion": "^1.2.8",
|
||||||
"@radix-ui/react-checkbox": "^1.2.3",
|
"@radix-ui/react-checkbox": "^1.2.3",
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ describe.skip("UnsafeRolesDialog", () => {
|
|||||||
|
|
||||||
it("renders the dialog when open is true", () => {
|
it("renders the dialog when open is true", () => {
|
||||||
renderWithProviders(
|
renderWithProviders(
|
||||||
<UnsafeRolesDialog open={true} onOpenChange={vi.fn()} />,
|
<UnsafeRolesDialog open onOpenChange={vi.fn()} />,
|
||||||
);
|
);
|
||||||
|
|
||||||
const dialog = screen.getByRole("dialog");
|
const dialog = screen.getByRole("dialog");
|
||||||
@@ -52,7 +52,7 @@ describe.skip("UnsafeRolesDialog", () => {
|
|||||||
|
|
||||||
it("displays the correct links", () => {
|
it("displays the correct links", () => {
|
||||||
renderWithProviders(
|
renderWithProviders(
|
||||||
<UnsafeRolesDialog open={true} onOpenChange={vi.fn()} />,
|
<UnsafeRolesDialog open onOpenChange={vi.fn()} />,
|
||||||
);
|
);
|
||||||
|
|
||||||
const docLink = screen.getByRole("link", {
|
const docLink = screen.getByRole("link", {
|
||||||
@@ -74,7 +74,7 @@ describe.skip("UnsafeRolesDialog", () => {
|
|||||||
|
|
||||||
it("does not allow confirmation until checkbox is checked", () => {
|
it("does not allow confirmation until checkbox is checked", () => {
|
||||||
renderWithProviders(
|
renderWithProviders(
|
||||||
<UnsafeRolesDialog open={true} onOpenChange={vi.fn()} />,
|
<UnsafeRolesDialog open onOpenChange={vi.fn()} />,
|
||||||
);
|
);
|
||||||
|
|
||||||
const confirmButton = screen.getByRole("button", { name: /confirm/i });
|
const confirmButton = screen.getByRole("button", { name: /confirm/i });
|
||||||
@@ -90,7 +90,7 @@ describe.skip("UnsafeRolesDialog", () => {
|
|||||||
it("emits the correct event when closing via close button", () => {
|
it("emits the correct event when closing via close button", () => {
|
||||||
const eventSpy = vi.spyOn(eventBus, "emit");
|
const eventSpy = vi.spyOn(eventBus, "emit");
|
||||||
renderWithProviders(
|
renderWithProviders(
|
||||||
<UnsafeRolesDialog open={true} onOpenChange={vi.fn()} />,
|
<UnsafeRolesDialog open onOpenChange={vi.fn()} />,
|
||||||
);
|
);
|
||||||
|
|
||||||
const dismissButton = screen.getByRole("button", { name: /close/i });
|
const dismissButton = screen.getByRole("button", { name: /close/i });
|
||||||
@@ -104,7 +104,7 @@ describe.skip("UnsafeRolesDialog", () => {
|
|||||||
it("emits the correct event when dismissing", () => {
|
it("emits the correct event when dismissing", () => {
|
||||||
const eventSpy = vi.spyOn(eventBus, "emit");
|
const eventSpy = vi.spyOn(eventBus, "emit");
|
||||||
renderWithProviders(
|
renderWithProviders(
|
||||||
<UnsafeRolesDialog open={true} onOpenChange={vi.fn()} />,
|
<UnsafeRolesDialog open onOpenChange={vi.fn()} />,
|
||||||
);
|
);
|
||||||
|
|
||||||
const dismissButton = screen.getByRole("button", { name: /dismiss/i });
|
const dismissButton = screen.getByRole("button", { name: /dismiss/i });
|
||||||
@@ -118,7 +118,7 @@ describe.skip("UnsafeRolesDialog", () => {
|
|||||||
it("emits the correct event when confirming", () => {
|
it("emits the correct event when confirming", () => {
|
||||||
const eventSpy = vi.spyOn(eventBus, "emit");
|
const eventSpy = vi.spyOn(eventBus, "emit");
|
||||||
renderWithProviders(
|
renderWithProviders(
|
||||||
<UnsafeRolesDialog open={true} onOpenChange={vi.fn()} />,
|
<UnsafeRolesDialog open onOpenChange={vi.fn()} />,
|
||||||
);
|
);
|
||||||
|
|
||||||
const checkbox = screen.getByRole("checkbox");
|
const checkbox = screen.getByRole("checkbox");
|
||||||
|
|||||||
@@ -5,9 +5,10 @@ import { useAppStore } from "@core/stores/appStore.ts";
|
|||||||
import { useDeviceStore } from "@core/stores/deviceStore.ts";
|
import { useDeviceStore } from "@core/stores/deviceStore.ts";
|
||||||
import { subscribeAll } from "@core/subscriptions.ts";
|
import { subscribeAll } from "@core/subscriptions.ts";
|
||||||
import { randId } from "@core/utils/randId.ts";
|
import { randId } from "@core/utils/randId.ts";
|
||||||
import { BleConnection, ServiceUuid } from "@meshtastic/js";
|
import { TransportWebBluetooth } from "@meshtastic/transport-web-bluetooth";
|
||||||
|
import { MeshDevice } from "@meshtastic/core";
|
||||||
import { useCallback, useEffect, useState } from "react";
|
import { useCallback, useEffect, useState } from "react";
|
||||||
import { useMessageStore } from "../../../core/stores/messageStore/index.ts";
|
import { useMessageStore } from "@core/stores/messageStore/index.ts";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
|
|
||||||
export const BLE = (
|
export const BLE = (
|
||||||
@@ -30,15 +31,13 @@ export const BLE = (
|
|||||||
|
|
||||||
const onConnect = async (bleDevice: BluetoothDevice) => {
|
const onConnect = async (bleDevice: BluetoothDevice) => {
|
||||||
const id = randId();
|
const id = randId();
|
||||||
|
const transport = await TransportWebBluetooth.createFromDevice(bleDevice);
|
||||||
const device = addDevice(id);
|
const device = addDevice(id);
|
||||||
|
const connection = new MeshDevice(transport, id);
|
||||||
|
connection.configure();
|
||||||
setSelectedDevice(id);
|
setSelectedDevice(id);
|
||||||
const connection = new BleConnection(id);
|
|
||||||
await connection.connect({
|
|
||||||
device: bleDevice,
|
|
||||||
});
|
|
||||||
device.addConnection(connection);
|
device.addConnection(connection);
|
||||||
subscribeAll(device, connection, messageStore);
|
subscribeAll(device, connection, messageStore);
|
||||||
|
|
||||||
closeDialog();
|
closeDialog();
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -71,7 +70,7 @@ export const BLE = (
|
|||||||
onClick={async () => {
|
onClick={async () => {
|
||||||
await navigator.bluetooth
|
await navigator.bluetooth
|
||||||
.requestDevice({
|
.requestDevice({
|
||||||
filters: [{ services: [ServiceUuid] }],
|
filters: [{ services: [TransportWebBluetooth.ServiceUuid] }],
|
||||||
})
|
})
|
||||||
.then((device) => {
|
.then((device) => {
|
||||||
const exists = bleDevices.findIndex((d) => d.id === device.id);
|
const exists = bleDevices.findIndex((d) => d.id === device.id);
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ import {
|
|||||||
MessageState,
|
MessageState,
|
||||||
useMessageStore,
|
useMessageStore,
|
||||||
} from "@core/stores/messageStore/index.ts";
|
} from "@core/stores/messageStore/index.ts";
|
||||||
import { Protobuf, Types } from "@meshtastic/js";
|
import { Protobuf, Types } from "@meshtastic/core";
|
||||||
import { Message } from "@core/stores/messageStore/types.ts";
|
import { Message } from "@core/stores/messageStore/types.ts";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
// import { MessageActionsMenu } from "@components/PageComponents/Messages/MessageActionsMenu.tsx"; // TODO: Uncomment when actions menu is implemented
|
// import { MessageActionsMenu } from "@components/PageComponents/Messages/MessageActionsMenu.tsx"; // TODO: Uncomment when actions menu is implemented
|
||||||
|
|||||||
@@ -1,10 +1,6 @@
|
|||||||
import type { Types } from "@meshtastic/js";
|
import type { Types } from "@meshtastic/core";
|
||||||
import {
|
import { MessageState, MessageType } from "@core/stores/messageStore/index.ts";
|
||||||
Message,
|
import { Message } from "@core/stores/messageStore/types.ts";
|
||||||
MessageState,
|
|
||||||
MessageType,
|
|
||||||
} from "../stores/messageStore/index.ts";
|
|
||||||
|
|
||||||
class PacketToMessageDTO {
|
class PacketToMessageDTO {
|
||||||
channel: Types.ChannelNumber;
|
channel: Types.ChannelNumber;
|
||||||
to: number;
|
to: number;
|
||||||
|
|||||||
@@ -140,7 +140,7 @@ export const MessagesPage = () => {
|
|||||||
} else {
|
} else {
|
||||||
console.warn("sendText completed but messageId is undefined");
|
console.warn("sendText completed but messageId is undefined");
|
||||||
}
|
}
|
||||||
} catch (e: any) {
|
} catch (e: unknown) {
|
||||||
console.error("Failed to send message:", e);
|
console.error("Failed to send message:", e);
|
||||||
const failedId = messageId ?? randId();
|
const failedId = messageId ?? randId();
|
||||||
if (chatType === MessageType.Broadcast) {
|
if (chatType === MessageType.Broadcast) {
|
||||||
|
|||||||
Reference in New Issue
Block a user