Skip to content

Commit 4be0a79

Browse files
peter-sandersonszymonlesisz
authored andcommitted
feat(suite): add bluetooth reducer
1 parent e6abf4a commit 4be0a79

File tree

5 files changed

+15
-2
lines changed

5 files changed

+15
-2
lines changed

packages/suite/package.json

+1
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
"@solana/kit": "^2.0.0",
3030
"@suite-common/analytics": "workspace:*",
3131
"@suite-common/assets": "workspace:*",
32+
"@suite-common/bluetooth": "workspace:*",
3233
"@suite-common/connect-init": "workspace:*",
3334
"@suite-common/device-authenticity": "workspace:*",
3435
"@suite-common/fiat-services": "workspace:*",

packages/suite/src/reducers/store.ts

+4
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import { isCodesignBuild } from '@trezor/env-utils';
1515
import { mergeDeepObject } from '@trezor/utils';
1616
import { prepareTokenDefinitionsReducer } from '@suite-common/token-definitions';
1717
import { prepareFirmwareReducer } from '@suite-common/firmware';
18+
import { prepareBluetoothReducerCreator } from '@suite-common/bluetooth';
1819
import { accountsActions } from '@suite-common/wallet-core';
1920

2021
import suiteMiddlewares from 'src/middlewares/suite';
@@ -34,9 +35,11 @@ import type { PreloadStoreAction } from 'src/support/suite/preloadStore';
3435

3536
import { desktopReducer } from './desktop';
3637
import { extraDependencies } from '../support/extraDependencies';
38+
import { BluetoothDevice } from '@trezor/transport-bluetooth';
3739

3840
const firmwareReducer = prepareFirmwareReducer(extraDependencies);
3941
const tokenDefinitionsReducer = prepareTokenDefinitionsReducer(extraDependencies);
42+
const bluetoothReducer = prepareBluetoothReducerCreator<BluetoothDevice>()(extraDependencies);
4043

4144
const rootReducer = combineReducers({
4245
...suiteReducers,
@@ -47,6 +50,7 @@ const rootReducer = combineReducers({
4750
backup: backupReducers,
4851
desktop: desktopReducer,
4952
tokenDefinitions: tokenDefinitionsReducer,
53+
bluetooth: bluetoothReducer,
5054
});
5155

5256
export type AppState = ReturnType<typeof rootReducer>;

packages/suite/src/types/suite/index.ts

+5-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import type { Store as ReduxStore } from 'redux';
22
import type { ThunkAction as TAction, ThunkDispatch } from 'redux-thunk';
33

44
import { analyticsActions } from '@suite-common/analytics';
5+
import { bluetoothActions } from '@suite-common/bluetooth';
56
import { deviceAuthenticityActions } from '@suite-common/device-authenticity';
67
import { firmwareActions } from '@suite-common/firmware';
78
import { addLog } from '@suite-common/logger';
@@ -59,6 +60,7 @@ type DiscoveryAction = ReturnType<(typeof discoveryActions)[keyof typeof discove
5960
type DeviceAuthenticityAction = ReturnType<
6061
(typeof deviceAuthenticityActions)[keyof typeof deviceAuthenticityActions]
6162
>;
63+
type BluetoothAction = ReturnType<(typeof bluetoothActions)[keyof typeof bluetoothActions]>;
6264

6365
// all actions from all apps used to properly type Dispatch.
6466
export type Action =
@@ -85,7 +87,8 @@ export type Action =
8587
| DiscoveryAction
8688
| DeviceAction
8789
| DeviceAuthenticityAction
88-
| ReturnType<typeof addLog>;
90+
| ReturnType<typeof addLog>
91+
| BluetoothAction;
8992

9093
export type ThunkAction = TAction<any, AppState, any, Action>;
9194

@@ -113,6 +116,7 @@ export type ForegroundAppProps = {
113116
export type ToastNotificationVariant = 'success' | 'info' | 'warning' | 'error' | 'transparent';
114117

115118
export { TorStatus } from '@trezor/suite-desktop-api/src/enums';
119+
116120
export interface TorBootstrap {
117121
current: number;
118122
total: number;

packages/suite/tsconfig.json

+3
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@
1616
"path": "../../suite-common/analytics"
1717
},
1818
{ "path": "../../suite-common/assets" },
19+
{
20+
"path": "../../suite-common/bluetooth"
21+
},
1922
{
2023
"path": "../../suite-common/connect-init"
2124
},

yarn.lock

+2-1
Original file line numberDiff line numberDiff line change
@@ -9358,7 +9358,7 @@ __metadata:
93589358
languageName: unknown
93599359
linkType: soft
93609360

9361-
"@suite-common/bluetooth@workspace:suite-common/bluetooth":
9361+
"@suite-common/bluetooth@workspace:*, @suite-common/bluetooth@workspace:suite-common/bluetooth":
93629362
version: 0.0.0-use.local
93639363
resolution: "@suite-common/bluetooth@workspace:suite-common/bluetooth"
93649364
dependencies:
@@ -12589,6 +12589,7 @@ __metadata:
1258912589
"@solana/kit": "npm:^2.0.0"
1259012590
"@suite-common/analytics": "workspace:*"
1259112591
"@suite-common/assets": "workspace:*"
12592+
"@suite-common/bluetooth": "workspace:*"
1259212593
"@suite-common/connect-init": "workspace:*"
1259312594
"@suite-common/device-authenticity": "workspace:*"
1259412595
"@suite-common/fiat-services": "workspace:*"

0 commit comments

Comments
 (0)