feat: allow 8.4.3 firmware features (#845)
* feat: allow 8.4.3 firmware features * feat: remove "layer-double-tap" command line argument
This commit is contained in:
committed by
László Monda
parent
84b6c33c54
commit
10cd06c70b
@@ -14,7 +14,7 @@ import 'rxjs/add/operator/combineLatest';
|
||||
|
||||
import { saveAs } from 'file-saver';
|
||||
|
||||
import { allowLayerDoubleTap, AppState, getKeyboardLayout } from '../../../store';
|
||||
import { layerDoubleTapSupported, AppState, getKeyboardLayout } from '../../../store';
|
||||
import { getKeymap, getKeymaps, getUserConfiguration } from '../../../store/reducers/user-configuration';
|
||||
import { KeyboardLayout } from '../../../keyboard/keyboard-layout.enum';
|
||||
import { KeymapActions } from '../../../store/actions';
|
||||
@@ -51,7 +51,7 @@ export class KeymapEditComponent {
|
||||
.map((keymaps: Keymap[]) => keymaps.length > 1);
|
||||
|
||||
this.keyboardLayout$ = store.select(getKeyboardLayout);
|
||||
this.allowLayerDoubleTap$ = store.select(allowLayerDoubleTap);
|
||||
this.allowLayerDoubleTap$ = store.select(layerDoubleTapSupported);
|
||||
}
|
||||
|
||||
downloadKeymap() {
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
></macro-header>
|
||||
<macro-list
|
||||
[macro]="macro"
|
||||
[macroPlaybackSupported]="macroPlaybackSupported$ | async"
|
||||
(add)="addAction($event.macroId, $event.action)"
|
||||
(edit)="editAction($event.macroId, $event.index, $event.action)"
|
||||
(delete)="deleteAction($event.macroId, $event.index, $event.action)"
|
||||
|
||||
@@ -3,11 +3,12 @@ import { ActivatedRoute } from '@angular/router';
|
||||
import { Store } from '@ngrx/store';
|
||||
import { Macro, MacroAction } from 'uhk-common';
|
||||
|
||||
import { Observable } from 'rxjs/Observable';
|
||||
import { Subscription } from 'rxjs/Subscription';
|
||||
import 'rxjs/add/operator/pluck';
|
||||
|
||||
import { MacroActions } from '../../../store/actions';
|
||||
import { AppState } from '../../../store';
|
||||
import { AppState, macroPlaybackSupported } from '../../../store';
|
||||
import { getMacro } from '../../../store/reducers/user-configuration';
|
||||
|
||||
@Component({
|
||||
@@ -22,6 +23,7 @@ export class MacroEditComponent implements OnDestroy {
|
||||
macro: Macro;
|
||||
isNew: boolean;
|
||||
macroId: number;
|
||||
macroPlaybackSupported$: Observable<boolean>;
|
||||
|
||||
private subscription: Subscription;
|
||||
constructor(private store: Store<AppState>, public route: ActivatedRoute) {
|
||||
@@ -37,6 +39,7 @@ export class MacroEditComponent implements OnDestroy {
|
||||
});
|
||||
|
||||
this.isNew = this.route.snapshot.params['empty'] === 'new';
|
||||
this.macroPlaybackSupported$ = this.store.select(macroPlaybackSupported);
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<div class="row list-container">
|
||||
<div class="col-xs-10 col-xs-offset-1 list-group">
|
||||
<p><i>Please note that macro playback is not implemented yet. You can create macros, but they won't have any effect until firmware support is implemented. We're working on this.</i></p>
|
||||
<p *ngIf="!macroPlaybackSupported"><i>Please note that macro playback is not implemented yet. You can create macros, but they won't have any effect until firmware support is implemented. We're working on this.</i></p>
|
||||
<div class="macro-actions-container" [dragula]="'macroActions'" [dragulaModel]="macro.macroActions">
|
||||
<macro-item *ngFor="let macroAction of macro.macroActions; let macroActionIndex = index"
|
||||
[macroAction]="macroAction"
|
||||
|
||||
@@ -35,6 +35,7 @@ import { MacroItemComponent } from '../item';
|
||||
})
|
||||
export class MacroListComponent {
|
||||
@Input() macro: Macro;
|
||||
@Input() macroPlaybackSupported: boolean;
|
||||
@ViewChildren(forwardRef(() => MacroItemComponent)) macroItems: QueryList<MacroItemComponent>;
|
||||
|
||||
@Output() add = new EventEmitter();
|
||||
|
||||
@@ -42,6 +42,7 @@
|
||||
></mouse-tab>
|
||||
<macro-tab #tab *ngSwitchCase="tabName.Macro" class="popover-content"
|
||||
[defaultKeyAction]="defaultKeyAction"
|
||||
[macroPlaybackSupported]="macroPlaybackSupported$ | async"
|
||||
(validAction)="setKeyActionValidState($event)"
|
||||
></macro-tab>
|
||||
<keymap-tab #tab *ngSwitchCase="tabName.Keymap" class="popover-content"
|
||||
|
||||
@@ -32,7 +32,7 @@ import {
|
||||
|
||||
import { Tab } from './tab';
|
||||
|
||||
import { AppState } from '../../store';
|
||||
import { AppState, macroPlaybackSupported } from '../../store';
|
||||
import { getKeymaps } from '../../store/reducers/user-configuration';
|
||||
import { KeyActionRemap } from '../../models/key-action-remap';
|
||||
import { RemapInfo } from '../../models/remap-info';
|
||||
@@ -147,6 +147,7 @@ export class PopoverComponent implements OnChanges {
|
||||
text: 'None'
|
||||
}
|
||||
];
|
||||
macroPlaybackSupported$: Observable<boolean>;
|
||||
|
||||
private readonly currentKeymap$ = new BehaviorSubject<Keymap>(undefined);
|
||||
|
||||
@@ -158,6 +159,7 @@ export class PopoverComponent implements OnChanges {
|
||||
.map(([keymaps, currentKeymap]: [Keymap[], Keymap]) =>
|
||||
keymaps.filter((keymap: Keymap) => currentKeymap.abbreviation !== keymap.abbreviation)
|
||||
);
|
||||
this.macroPlaybackSupported$ = store.select(macroPlaybackSupported);
|
||||
}
|
||||
|
||||
ngOnChanges(change: SimpleChanges) {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<span> No macros are available to choose from. Create a macro first! </span>
|
||||
</ng-template>
|
||||
<ng-template [ngIf]="macroOptions.length > 0">
|
||||
<p><i>Please note that macro playback is not implemented yet. You can bind macros, but they won't have any effect until firmware support is implemented. We're working on this.</i></p>
|
||||
<p *ngIf="!macroPlaybackSupported"><i>Please note that macro playback is not implemented yet. You can bind macros, but they won't have any effect until firmware support is implemented. We're working on this.</i></p>
|
||||
<div class="macro-selector">
|
||||
<b> Play macro: </b>
|
||||
<ngx-select [items]="macroOptions"
|
||||
|
||||
@@ -17,6 +17,7 @@ import { SelectOptionData } from '../../../../models/select-option-data';
|
||||
})
|
||||
export class MacroTabComponent extends Tab implements OnInit, OnChanges, OnDestroy {
|
||||
@Input() defaultKeyAction: KeyAction;
|
||||
@Input() macroPlaybackSupported: boolean;
|
||||
|
||||
macros: Macro[];
|
||||
macroOptions: Array<SelectOptionData>;
|
||||
|
||||
@@ -2,7 +2,7 @@ import { createSelector } from 'reselect';
|
||||
import { ActionReducerMap, MetaReducer } from '@ngrx/store';
|
||||
import { RouterReducerState, routerReducer } from '@ngrx/router-store';
|
||||
import { storeFreeze } from 'ngrx-store-freeze';
|
||||
import { Keymap, UserConfiguration } from 'uhk-common';
|
||||
import { HardwareModules, Keymap, UserConfiguration } from 'uhk-common';
|
||||
|
||||
import * as fromUserConfig from './reducers/user-configuration';
|
||||
import * as fromPreset from './reducers/preset';
|
||||
@@ -14,6 +14,7 @@ import * as fromSelectors from './reducers/selectors';
|
||||
import { initProgressButtonState } from './reducers/progress-button-state';
|
||||
import { environment } from '../../environments/environment';
|
||||
import { RouterStateUrl } from './router-util';
|
||||
import { isVersionGte } from '../util';
|
||||
|
||||
// State interface for the application
|
||||
export interface AppState {
|
||||
@@ -45,7 +46,6 @@ export const getUserConfiguration = (state: AppState) => state.userConfiguration
|
||||
export const appState = (state: AppState) => state.app;
|
||||
|
||||
export const showAddonMenu = createSelector(appState, fromApp.showAddonMenu);
|
||||
export const allowLayerDoubleTap = createSelector(appState, fromApp.allowLayerDoubleTap);
|
||||
export const getUndoableNotification = createSelector(appState, fromApp.getUndoableNotification);
|
||||
export const getPrevUserConfiguration = createSelector(appState, fromApp.getPrevUserConfiguration);
|
||||
export const runningInElectron = createSelector(appState, fromApp.runningInElectron);
|
||||
@@ -113,3 +113,13 @@ export const getSideMenuPageState = createSelector(
|
||||
);
|
||||
|
||||
export const getRouterState = (state: AppState) => state.router;
|
||||
|
||||
export const macroPlaybackSupported = createSelector(getHardwareModules, (hardwareModules: HardwareModules): boolean => {
|
||||
return isVersionGte(hardwareModules.rightModuleInfo.firmwareVersion, '8.4.3');
|
||||
});
|
||||
export const layerDoubleTapSupported = createSelector(
|
||||
getHardwareModules,
|
||||
(hardwareModules: HardwareModules): boolean => {
|
||||
return isVersionGte(hardwareModules.rightModuleInfo.firmwareVersion, '8.4.3');
|
||||
}
|
||||
);
|
||||
|
||||
@@ -171,7 +171,6 @@ export function reducer(state = initialState, action: Action & { payload: any })
|
||||
}
|
||||
|
||||
export const showAddonMenu = (state: State) => state.commandLineArgs.addons;
|
||||
export const allowLayerDoubleTap = (state: State) => state.commandLineArgs.layerDoubleTap;
|
||||
export const getUndoableNotification = (state: State) => state.undoableNotification;
|
||||
export const getPrevUserConfiguration = (state: State) => state.prevUserConfig;
|
||||
export const runningInElectron = (state: State) => state.runningInElectron;
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import * as semver from 'semver';
|
||||
import { VersionInformation } from 'uhk-common';
|
||||
|
||||
const collectVersions = (): VersionInformation => {
|
||||
@@ -20,3 +21,11 @@ export const getVersions = (): VersionInformation => {
|
||||
}
|
||||
return versions;
|
||||
};
|
||||
|
||||
export const isVersionGte = (v1: string, v2: string): boolean => {
|
||||
if (!v1) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return semver.gte(v1, v2);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user