Add keyboard shortcut for enabling the USB stack test mode of the firmware. Resolves #735.
This commit is contained in:
@@ -7,6 +7,7 @@ import { Action, Store } from '@ngrx/store';
|
||||
import 'rxjs/add/operator/last';
|
||||
|
||||
import { DoNotUpdateAppAction, UpdateAppAction } from './store/actions/app-update.action';
|
||||
import { EnableUsbStackTestAction } from './store/actions/device';
|
||||
import {
|
||||
AppState,
|
||||
getShowAppUpdateAvailable,
|
||||
@@ -64,6 +65,16 @@ export class MainAppComponent implements OnDestroy {
|
||||
this.clickedOnProgressButton(this.saveToKeyboardState.action);
|
||||
event.preventDefault();
|
||||
}
|
||||
|
||||
if (event.shiftKey &&
|
||||
event.ctrlKey &&
|
||||
event.altKey &&
|
||||
event.metaKey &&
|
||||
event.key === '|' &&
|
||||
!event.defaultPrevented) {
|
||||
this.enableUsbStackTest();
|
||||
event.preventDefault();
|
||||
}
|
||||
}
|
||||
|
||||
updateApp() {
|
||||
@@ -77,4 +88,8 @@ export class MainAppComponent implements OnDestroy {
|
||||
clickedOnProgressButton(action: Action) {
|
||||
return this.store.dispatch(action);
|
||||
}
|
||||
|
||||
enableUsbStackTest() {
|
||||
this.store.dispatch(new EnableUsbStackTestAction());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,6 +50,10 @@ export class DeviceRendererService {
|
||||
this.ipcRenderer.send(IpcEvents.device.recoveryDevice);
|
||||
}
|
||||
|
||||
enableUsbStackTest(): void {
|
||||
this.ipcRenderer.send(IpcEvents.device.enableUsbStackTest);
|
||||
}
|
||||
|
||||
private registerEvents(): void {
|
||||
this.ipcRenderer.on(IpcEvents.device.deviceConnectionStateChanged, (event: string, arg: DeviceConnectionState) => {
|
||||
this.dispachStoreAction(new ConnectionStateChangedAction(arg));
|
||||
|
||||
@@ -28,7 +28,8 @@ export const ActionTypes = {
|
||||
HAS_BACKUP_USER_CONFIGURATION: type(PREFIX + 'Store backup user configuration'),
|
||||
RESTORE_CONFIGURATION_FROM_BACKUP: type(PREFIX + 'Restore configuration from backup'),
|
||||
RESTORE_CONFIGURATION_FROM_BACKUP_SUCCESS: type(PREFIX + 'Restore configuration from backup success'),
|
||||
RECOVERY_DEVICE: type(PREFIX + 'Recovery device')
|
||||
RECOVERY_DEVICE: type(PREFIX + 'Recovery device'),
|
||||
ENABLE_USB_STACK_TEST: type(PREFIX + 'USB stack test')
|
||||
};
|
||||
|
||||
export class SetPrivilegeOnLinuxAction implements Action {
|
||||
@@ -144,6 +145,10 @@ export class RecoveryDeviceAction implements Action {
|
||||
type = ActionTypes.RECOVERY_DEVICE;
|
||||
}
|
||||
|
||||
export class EnableUsbStackTestAction implements Action {
|
||||
type = ActionTypes.ENABLE_USB_STACK_TEST;
|
||||
}
|
||||
|
||||
export type Actions
|
||||
= SetPrivilegeOnLinuxAction
|
||||
| SetPrivilegeOnLinuxReplyAction
|
||||
@@ -166,4 +171,5 @@ export type Actions
|
||||
| HasBackupUserConfigurationAction
|
||||
| RestoreUserConfigurationFromBackupSuccessAction
|
||||
| RecoveryDeviceAction
|
||||
| EnableUsbStackTestAction
|
||||
;
|
||||
|
||||
@@ -23,6 +23,7 @@ import {
|
||||
import {
|
||||
ActionTypes,
|
||||
ConnectionStateChangedAction,
|
||||
EnableUsbStackTestAction,
|
||||
HideSaveToKeyboardButton,
|
||||
RecoveryDeviceAction,
|
||||
ResetUserConfigurationAction,
|
||||
@@ -230,6 +231,10 @@ export class DeviceEffects {
|
||||
.ofType<RecoveryDeviceAction>(ActionTypes.RECOVERY_DEVICE)
|
||||
.do(() => this.deviceRendererService.recoveryDevice());
|
||||
|
||||
@Effect({dispatch: false}) enableUsbStackTest$ = this.actions$
|
||||
.ofType<EnableUsbStackTestAction>(ActionTypes.ENABLE_USB_STACK_TEST)
|
||||
.do(() => this.deviceRendererService.enableUsbStackTest());
|
||||
|
||||
constructor(private actions$: Actions,
|
||||
private router: Router,
|
||||
private deviceRendererService: DeviceRendererService,
|
||||
|
||||
Reference in New Issue
Block a user