mirror of
https://github.com/pybricks/pybricks-code.git
synced 2026-09-12 17:45:22 +00:00
drop FirmwareSagaContext
This context is not exclusive to the firmware sagas.
This commit is contained in:
@@ -6,7 +6,6 @@ import {
|
||||
FirmwareReaderError,
|
||||
FirmwareReaderErrorCode,
|
||||
} from '@pybricks/firmware';
|
||||
import { mock } from 'jest-mock-extended';
|
||||
import JSZip from 'jszip';
|
||||
import { AsyncSaga } from '../../test';
|
||||
import {
|
||||
|
||||
+1
-11
@@ -65,16 +65,6 @@ import {
|
||||
flashFirmware,
|
||||
} from './actions';
|
||||
|
||||
/**
|
||||
* Function that returns the next unused message ID.
|
||||
*/
|
||||
type NextMessageIdFunc = () => number;
|
||||
|
||||
/**
|
||||
* Partial saga context type for context used in the firmware sagas.
|
||||
*/
|
||||
export type FirmwareSagaContext = { nextMessageId: NextMessageIdFunc };
|
||||
|
||||
const firmwareZipMap = new Map<HubType, string>([
|
||||
[HubType.CityHub, cityHubZip],
|
||||
[HubType.TechnicHub, technicHubZip],
|
||||
@@ -305,7 +295,7 @@ function* handleFlashFirmware(action: ReturnType<typeof flashFirmware>): Generat
|
||||
return;
|
||||
}
|
||||
|
||||
const nextMessageId = yield* getContext<NextMessageIdFunc>('nextMessageId');
|
||||
const nextMessageId = yield* getContext<() => number>('nextMessageId');
|
||||
|
||||
const infoAction = yield* put(infoRequest(nextMessageId()));
|
||||
const { info } = yield* all({
|
||||
|
||||
+4
-3
@@ -10,7 +10,7 @@ import editor from './editor/sagas';
|
||||
import errorLog from './error-log/sagas';
|
||||
import explorer from './explorer/sagas';
|
||||
import fileStorage from './fileStorage/sagas';
|
||||
import flashFirmware, { FirmwareSagaContext } from './firmware/sagas';
|
||||
import flashFirmware from './firmware/sagas';
|
||||
import hub from './hub/sagas';
|
||||
import lwp3BootloaderProtocol from './lwp3-bootloader/sagas';
|
||||
import lwp3BootloaderBle from './lwp3-bootloader/sagas-ble';
|
||||
@@ -42,6 +42,7 @@ export default function* (): Generator {
|
||||
/**
|
||||
* Combined type for all saga contexts.
|
||||
*/
|
||||
export type RootSagaContext = FirmwareSagaContext &
|
||||
NotificationSagaContext &
|
||||
export type RootSagaContext = {
|
||||
nextMessageId: () => number;
|
||||
} & NotificationSagaContext &
|
||||
TerminalSagaContext;
|
||||
|
||||
Reference in New Issue
Block a user