Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,9 @@
"dependencies": {
"@bufbuild/protobuf": "^2.2.5",
"@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",
"@meshtastic/transport-web-bluetooth": "npm:@jsr/meshtastic__transport-web-bluetooth",
"@meshtastic/transport-web-serial": "npm:@jsr/meshtastic__transport-web-serial",
"@meshtastic/transport-http": "npm:@jsr/meshtastic__transport-http@0.2.1",
"@meshtastic/transport-web-bluetooth": "npm:@jsr/meshtastic__transport-web-bluetooth@0.1.2",
"@meshtastic/transport-web-serial": "npm:@jsr/meshtastic__transport-web-serial@0.2.1",
"@noble/curves": "^1.9.0",
"@radix-ui/react-accordion": "^1.2.8",
"@radix-ui/react-checkbox": "^1.2.3",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ describe.skip("UnsafeRolesDialog", () => {

it("renders the dialog when open is true", () => {
renderWithProviders(
<UnsafeRolesDialog open={true} onOpenChange={vi.fn()} />,
<UnsafeRolesDialog open onOpenChange={vi.fn()} />,
);

const dialog = screen.getByRole("dialog");
Expand All @@ -52,7 +52,7 @@ describe.skip("UnsafeRolesDialog", () => {

it("displays the correct links", () => {
renderWithProviders(
<UnsafeRolesDialog open={true} onOpenChange={vi.fn()} />,
<UnsafeRolesDialog open onOpenChange={vi.fn()} />,
);

const docLink = screen.getByRole("link", {
Expand All @@ -74,7 +74,7 @@ describe.skip("UnsafeRolesDialog", () => {

it("does not allow confirmation until checkbox is checked", () => {
renderWithProviders(
<UnsafeRolesDialog open={true} onOpenChange={vi.fn()} />,
<UnsafeRolesDialog open onOpenChange={vi.fn()} />,
);

const confirmButton = screen.getByRole("button", { name: /confirm/i });
Expand All @@ -90,7 +90,7 @@ describe.skip("UnsafeRolesDialog", () => {
it("emits the correct event when closing via close button", () => {
const eventSpy = vi.spyOn(eventBus, "emit");
renderWithProviders(
<UnsafeRolesDialog open={true} onOpenChange={vi.fn()} />,
<UnsafeRolesDialog open onOpenChange={vi.fn()} />,
);

const dismissButton = screen.getByRole("button", { name: /close/i });
Expand All @@ -104,7 +104,7 @@ describe.skip("UnsafeRolesDialog", () => {
it("emits the correct event when dismissing", () => {
const eventSpy = vi.spyOn(eventBus, "emit");
renderWithProviders(
<UnsafeRolesDialog open={true} onOpenChange={vi.fn()} />,
<UnsafeRolesDialog open onOpenChange={vi.fn()} />,
);

const dismissButton = screen.getByRole("button", { name: /dismiss/i });
Expand All @@ -118,7 +118,7 @@ describe.skip("UnsafeRolesDialog", () => {
it("emits the correct event when confirming", () => {
const eventSpy = vi.spyOn(eventBus, "emit");
renderWithProviders(
<UnsafeRolesDialog open={true} onOpenChange={vi.fn()} />,
<UnsafeRolesDialog open onOpenChange={vi.fn()} />,
);

const checkbox = screen.getByRole("checkbox");
Expand Down
15 changes: 7 additions & 8 deletions src/components/PageComponents/Connect/BLE.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@ import { useAppStore } from "@core/stores/appStore.ts";
import { useDeviceStore } from "@core/stores/deviceStore.ts";
import { subscribeAll } from "@core/subscriptions.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 { useMessageStore } from "../../../core/stores/messageStore/index.ts";
import { useMessageStore } from "@core/stores/messageStore/index.ts";
import { useTranslation } from "react-i18next";

export const BLE = (
Expand All @@ -30,15 +31,13 @@ export const BLE = (

const onConnect = async (bleDevice: BluetoothDevice) => {
const id = randId();
const transport = await TransportWebBluetooth.createFromDevice(bleDevice);
const device = addDevice(id);
const connection = new MeshDevice(transport, id);
connection.configure();
setSelectedDevice(id);
const connection = new BleConnection(id);
await connection.connect({
device: bleDevice,
});
device.addConnection(connection);
subscribeAll(device, connection, messageStore);

closeDialog();
};

Expand Down Expand Up @@ -71,7 +70,7 @@ export const BLE = (
onClick={async () => {
await navigator.bluetooth
.requestDevice({
filters: [{ services: [ServiceUuid] }],
filters: [{ services: [TransportWebBluetooth.ServiceUuid] }],
})
.then((device) => {
const exists = bleDevices.findIndex((d) => d.id === device.id);
Expand Down
2 changes: 1 addition & 1 deletion src/components/PageComponents/Messages/MessageItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {
MessageState,
useMessageStore,
} 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 { useTranslation } from "react-i18next";
// import { MessageActionsMenu } from "@components/PageComponents/Messages/MessageActionsMenu.tsx"; // TODO: Uncomment when actions menu is implemented
Expand Down
10 changes: 3 additions & 7 deletions src/core/dto/PacketToMessageDTO.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
import type { Types } from "@meshtastic/js";
import {
Message,
MessageState,
MessageType,
} from "../stores/messageStore/index.ts";

import type { Types } from "@meshtastic/core";
import { MessageState, MessageType } from "@core/stores/messageStore/index.ts";
import { Message } from "@core/stores/messageStore/types.ts";
class PacketToMessageDTO {
channel: Types.ChannelNumber;
to: number;
Expand Down
2 changes: 1 addition & 1 deletion src/pages/Messages.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ export const MessagesPage = () => {
} else {
console.warn("sendText completed but messageId is undefined");
}
} catch (e: any) {
} catch (e: unknown) {
console.error("Failed to send message:", e);
const failedId = messageId ?? randId();
if (chatType === MessageType.Broadcast) {
Expand Down
Loading