-
-
Notifications
You must be signed in to change notification settings - Fork 279
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: prepare for usage of connectionStatus from ipc
- Loading branch information
1 parent
c832a6a
commit 633b19d
Showing
18 changed files
with
317 additions
and
259 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
packages/suite/src/actions/bluetooth/bluetoothDisconnectDeviceThunk.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { BLUETOOTH_PREFIX } from '@suite-common/bluetooth'; | ||
import { createThunk } from '@suite-common/redux-utils'; | ||
import { notificationsActions } from '@suite-common/toast-notifications'; | ||
import { bluetoothIpc } from '@trezor/transport-bluetooth'; | ||
|
||
type BluetoothDisconnectDeviceThunkResult = { | ||
success: boolean; | ||
}; | ||
|
||
export const bluetoothDisconnectDeviceThunk = createThunk< | ||
BluetoothDisconnectDeviceThunkResult, | ||
{ id: string }, | ||
void | ||
>( | ||
`${BLUETOOTH_PREFIX}/bluetoothConnectDeviceThunk`, | ||
async ({ id }, { fulfillWithValue, dispatch }) => { | ||
const result = await bluetoothIpc.disconnectDevice(id); | ||
|
||
if (!result.success) { | ||
dispatch( | ||
notificationsActions.addToast({ | ||
type: 'error', | ||
error: result.error, | ||
}), | ||
); | ||
} | ||
|
||
return fulfillWithValue({ success: result.success }); | ||
}, | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
75 changes: 62 additions & 13 deletions
75
packages/suite/src/components/suite/bluetooth/BluetoothDeviceItem.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.