David Lechner
07a03d4ea7
drop FirmwareSagaContext
...
This context is not exclusive to the firmware sagas.
2022-03-26 16:10:28 -05:00
David Lechner
c158e4f0e2
editor: add editorGetValue() saga
...
This is another step towards removing the 'editor' context.
2022-03-26 13:44:55 -05:00
David Lechner
5dd61fa4c3
toolbar/buttons: consolidate buttons
2022-03-25 15:54:04 -05:00
David Lechner
9f254f035f
i18n: use babel-loader plugin
2022-03-25 15:54:04 -05:00
David Lechner
46faff981d
toolbar: add label to buttons
...
This improves accessability by letting us get buttons by the label.
2022-03-16 15:24:48 -05:00
David Lechner
7726dbe01d
settings: convert hubName to react hook
2022-03-15 17:25:20 -05:00
David Lechner
861ea34d86
settings: convert flashCurrentProgram to react hook
2022-03-15 16:54:49 -05:00
David Lechner
8e4045449c
src: use prop unpacking pattern
...
This makes the code a bit shorter by not having to use `props.` all of
the time. Also make everything VoidFunctionComponent while we are
touching this.
2022-03-12 16:07:31 -06:00
David Lechner
31fb3b9e4c
test: drop state from AsyncSaga constructor params
...
This uses the real rootReducer to populate the initial state in the test
AsyncSaga. This way we don't have to populate default values. Since it
isn't used often, we can omit the parameter and just call the updateState()
method after creating the object if modifications are needed.
2022-03-11 16:04:09 -06:00
David Lechner
569217d5dc
editor: don't put editor in redux store
...
The redux store should not have non-serializable objects like the editor
in it.
2022-03-02 18:56:47 -06:00
David Lechner
994540e263
actions: fix missed refactoring
...
Missed some renames when refactoring that weren't picked up locally
for some reason.
2022-02-26 12:55:49 -06:00
David Lechner
a9f4eaa32d
actions: simplify usage of Matchable
...
This removes use of the pseudo-internal toString() function and also
removes extraneous uses of ReturnType<>. Also, a new when() method
is added to simplify additional uses.
2022-02-26 12:43:10 -06:00
David Lechner
9641898a75
actions: refactor actions
...
The pattern we were using for actions required actions to be defined in
three places, an enum member containing the type string, an type
definition and a function. This combines all three of these into one by
using a helper function based on the ideas from [1].
[1]: https://phryneas.de/redux-typescript-no-discriminating-union
2022-02-25 17:58:30 -06:00
David Lechner
cf8744a6cd
actions: drop typed dispatch
...
This doesn't provide much benefit and is just one more rule to remember,
so we can do without it.
2022-02-24 17:16:52 -06:00
David Lechner
54ec447061
actions: added typed useDispatch() hook
2021-12-27 18:01:51 -06:00
David Lechner
8d26f768bf
reducers: use typed useSelector hook
...
This refactors the code to use a typed useSelector() hook.
2021-12-27 17:48:41 -06:00
David Lechner
f1f6b2076d
firmware: convert FlashButton to function
2021-12-27 12:38:50 -06:00
David Lechner
ae40c2f540
firmware: flash custom hub name
...
This adds support for customizing the hub name when flashing firmware.
Fixes: https://github.com/pybricks/support/issues/52
2021-11-19 20:48:06 -06:00
David Lechner
e7d44ea9a9
src/utils: add ensureError() function
...
Typescript v4.4 no longer assumes that the error in catch is an Error
object [1]. This adds a helper function to ensure that caught errors
at least match the Error interface. If not, it creates a new Error
object with the value as the message.
[1]: https://devblogs.microsoft.com/typescript/announcing-typescript-4-4-beta/#using-unknown-in-catch-variables
2021-08-30 13:06:01 -05:00
David Lechner
b7b3522f78
Merge remote-tracking branch 'origin/master' into dlech
2021-08-13 10:46:01 -05:00
David Lechner
7ddeed58b7
firmware: validate checksum while flashing
...
Since we are using the checksum message for throttling flash speed
anyway, we can validate the checksum during the flash process to
catch errors earlier.
Issue: https://github.com/pybricks/support/issues/433
2021-08-13 10:40:49 -05:00
David Lechner
ce8f59e0c2
firmware: fix flashing on Android
...
Hubs that don't use the minimum chunk size will fail on Android since
it defaults to the smallest possible MTU.
Issue: https://github.com/pybricks/support/issues/403
2021-08-12 15:55:24 -05:00
David Lechner
1279370fc8
Fix firmware flash button not disabled while connecting
...
We were using the wrong state variable to detect when BLE is disconnected.
We care about the BLE connection state, not the hub runtime state here.
Issue: https://github.com/pybricks/support/issues/315#issuecomment-841486591
2021-05-17 12:44:30 -05:00
David Lechner
956b6f3c96
firmware: add windows BLE hacks
...
This works around some issues that have been observed on a specific
Windows computer.
Issue: https://github.com/pybricks/support/issues/256
2021-05-16 16:18:34 -05:00
David Lechner
ec6753c314
yarn lint
...
rules seem to have changed a bit after upgrading packages
2021-05-11 12:45:43 -05:00
David Lechner
0d89f8daad
Disable flash button when hub is connected.
...
Fixes: https://github.com/pybricks/support/issues/299
2021-04-12 10:34:59 -05:00
David Lechner
b7061f63b4
add tests for firmware reducers
2021-02-01 10:26:05 -06:00
David Lechner
e5073399a0
drop explicit state interfaces
...
This could cause subtle bugs like the one fixed here where license
was renamed to licenses.
2021-02-01 10:26:05 -06:00
David Lechner
0c20e52a45
don't allow optional args in actions
...
This can lead to subtle bugs.
Fixes firmware flash button not working.
2021-02-01 10:26:05 -06:00
David Lechner
6f204a65f6
reorganize src/ directory
...
Makes for much less scrolling/jumping around.
https://redux.js.org/style-guide/style-guide#structure-files-as-feature-folders-or-ducks
2021-02-01 10:26:05 -06:00