Upgrade to ngrx v4 (#378)

* Update ngrx to v4

* package.json files

* release: Remove zadic references from release script

* fix(user-config): Fix user-config loading

* build: Lock package dependencies

* build: fix app version

* ci: remove build:test step

* fix(user-config): Revert switch-keymap-action modifications

* test(user-config): xit keystroke-action test

* fix(user-config): Fix user config loading

* fix(user-config): Fix user config loading
This commit is contained in:
József Farkas
2017-10-08 18:31:16 +02:00
committed by László Monda
parent ba1fff788d
commit 50e0b64f6e
40 changed files with 3323 additions and 3283 deletions

View File

@@ -26,7 +26,6 @@ install:
test_script:
- appveyor-retry npm run build
- appveyor-retry npm run build:test
- npm run lint
- npm run test
- npm run release

2215
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -2,7 +2,7 @@
"name": "uhk-agent",
"author": "Ultimate Gadget Laboratories",
"main": "electron/dist/electron-main.js",
"version": "1.0.0",
"version": "1.0.1",
"description": "Agent is the configuration application of the Ultimate Hacking Keyboard.",
"repository": {
"type": "git",
@@ -14,39 +14,39 @@
"npm": ">=5.1.0 <6.0.0"
},
"devDependencies": {
"@types/electron-devtools-installer": "^2.0.2",
"@types/electron-settings": "^3.0.0",
"@types/electron-devtools-installer": "2.0.2",
"@types/electron-settings": "3.0.0",
"@types/jasmine": "2.6.0",
"@types/node": "8.0.30",
"@types/node-hid": "^0.5.2",
"@types/usb": "^1.1.3",
"autoprefixer": "^6.5.3",
"buffer": "^5.0.6",
"copy-webpack-plugin": "^4.0.1",
"core-js": "^2.4.1",
"cross-env": "^5.0.5",
"devtron": "^1.4.0",
"@types/node-hid": "0.5.2",
"@types/usb": "1.1.3",
"autoprefixer": "6.5.3",
"buffer": "5.0.6",
"copy-webpack-plugin": "4.0.1",
"core-js": "2.4.1",
"cross-env": "5.0.5",
"devtron": "1.4.0",
"electron": "1.7.5",
"electron-builder": "19.6.1",
"electron-debug": "^1.3.0",
"electron-devtools-installer": "^2.2.0",
"electron-log": "^2.2.7",
"electron-rebuild": "^1.5.11",
"electron-settings": "^3.1.1",
"exports-loader": "^0.6.3",
"file-loader": "^0.10.0",
"lerna": "^2.0.0",
"electron-builder": "19.34.2",
"electron-debug": "1.4.0",
"electron-devtools-installer": "2.2.0",
"electron-log": "2.2.9",
"electron-rebuild": "1.6.0",
"electron-settings": "3.1.2",
"exports-loader": "0.6.3",
"file-loader": "0.10.0",
"lerna": "2.0.0",
"mkdirp": "0.5.1",
"npm-run-all": "^4.0.2",
"rimraf": "^2.6.1",
"standard-version": "^4.2.0",
"stylelint": "^7.13.0",
"svg-sprite": "^1.3.7",
"ts-loader": "^2.3.1",
"ts-node": "~3.0.4",
"tslint": "~5.5.0",
"npm-run-all": "4.0.2",
"rimraf": "2.6.1",
"standard-version": "4.2.0",
"stylelint": "7.13.0",
"svg-sprite": "1.3.7",
"ts-loader": "2.3.1",
"ts-node": "3.0.4",
"tslint": "5.5.0",
"typescript": "2.5.2",
"webpack": "^2.4.1"
"webpack": "2.4.1"
},
"scripts": {
"postinstall": "lerna bootstrap",

File diff suppressed because it is too large Load Diff

View File

@@ -16,12 +16,12 @@
"dependencies": {
},
"devDependencies": {
"@types/jasmine": "^2.6.0",
"@types/jasmine": "2.6.0",
"@types/node": "8.0.30",
"jasmine": "^2.8.0",
"jasmine-core": "^2.8.0",
"jasmine": "2.8.0",
"jasmine-core": "2.8.0",
"jasmine-node": "2.0.0",
"jasmine-ts": "^0.2.1",
"jasmine-ts": "0.2.1",
"ts-node": "3.3.0",
"uhk-common": "1.0.0"
},

File diff suppressed because it is too large Load Diff

View File

@@ -14,18 +14,19 @@
"npm": ">=5.1.0 <6.0.0"
},
"dependencies": {
"command-line-args": "4.0.6",
"electron": "1.7.5",
"command-line-args": "4.0.7",
"electron": "1.7.8",
"electron-is-dev": "0.1.2",
"electron-log": "2.2.6",
"electron-log": "2.2.9",
"electron-rebuild": "1.6.0",
"electron-settings": "3.0.14",
"electron-updater": "2.2.0",
"electron-settings": "3.1.2",
"electron-updater": "2.10.1",
"node-hid": "0.5.4",
"sudo-prompt": "^7.0.0",
"sudo-prompt": "7.0.0",
"uhk-usb": "1.0.0"
},
"devDependencies": {
"@types/node": "8.0.33",
"uhk-common": "^1.0.0"
},
"scripts": {

View File

@@ -19,7 +19,7 @@ import { AppService } from './services/app.service';
import { SudoService } from './services/sudo.service';
const optionDefinitions = [
{ name: 'addons', type: Boolean, defaultOption: false }
{name: 'addons', type: Boolean, defaultOption: false}
];
const options: CommandLineArgs = commandLineArgs(optionDefinitions);

View File

@@ -1,7 +1,6 @@
import { ipcMain, BrowserWindow } from 'electron';
import { autoUpdater } from 'electron-updater';
import { ProgressInfo } from 'electron-builder-http/out/ProgressCallbackTransform';
import { VersionInfo } from 'electron-builder-http/out/publishOptions';
import { VersionInfo, ProgressInfo } from 'builder-util-runtime';
import * as settings from 'electron-settings';
import * as isDev from 'electron-is-dev';

View File

@@ -2,24 +2,6 @@
"requires": true,
"lockfileVersion": 1,
"dependencies": {
"@angular/core": {
"version": "4.3.3",
"resolved": "https://registry.npmjs.org/@angular/core/-/core-4.3.3.tgz",
"integrity": "sha1-jmp2kUZh20B/otiN0kQcTAFv9iU=",
"requires": {
"tslib": "1.7.1"
}
},
"@ngrx/core": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/@ngrx/core/-/core-1.2.0.tgz",
"integrity": "sha1-iCtGq6+i4ObYh8txobLC+j5tDcY="
},
"@ngrx/store": {
"version": "2.2.3",
"resolved": "https://registry.npmjs.org/@ngrx/store/-/store-2.2.3.tgz",
"integrity": "sha1-570RSfHEQgjxzEdENT8PmKDx9Xs="
},
"@types/jasmine": {
"version": "2.6.0",
"resolved": "https://registry.npmjs.org/@types/jasmine/-/jasmine-2.6.0.tgz",
@@ -162,9 +144,9 @@
"integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA="
},
"diff": {
"version": "3.3.1",
"resolved": "https://registry.npmjs.org/diff/-/diff-3.3.1.tgz",
"integrity": "sha512-MKPHZDMB0o6yHyDryUOScqZibp914ksXwAMYMTHj6KO8UeKsRYNJD3oNCKjTqZon+V488P7N/HzXF8t7ZR95ww=="
"version": "3.4.0",
"resolved": "https://registry.npmjs.org/diff/-/diff-3.4.0.tgz",
"integrity": "sha512-QpVuMTEoJMF7cKzi6bvWhRulU1fZqZnvyVQgNhPaxxuTYwyjn/j1v9falseQ/uXWwPnO56RBfwtg4h/EQXmucA=="
},
"error-ex": {
"version": "1.3.1",
@@ -2178,7 +2160,7 @@
"requires": {
"arrify": "1.0.1",
"chalk": "2.1.0",
"diff": "3.3.1",
"diff": "3.4.0",
"make-error": "1.3.0",
"minimist": "1.2.0",
"mkdirp": "0.5.1",
@@ -2219,11 +2201,6 @@
"strip-json-comments": "2.0.1"
}
},
"tslib": {
"version": "1.7.1",
"resolved": "https://registry.npmjs.org/tslib/-/tslib-1.7.1.tgz",
"integrity": "sha1-vIAEFkaRkjp5/oN4u+s9ogF1OOw="
},
"typescript": {
"version": "2.5.3",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-2.5.3.tgz",

View File

@@ -16,10 +16,7 @@
},
"license": "GPL-3.0",
"devDependencies": {
"@angular/core": "4.3.3",
"@ngrx/core": "1.2.0",
"@types/jasmine": "2.6.0",
"@ngrx/store": "2.2.3",
"@types/node": "8.0.30",
"jasmine": "2.8.0",
"jasmine-core": "2.8.0",

View File

@@ -216,7 +216,7 @@ describe('keystroke-action', () => {
expect(action).toEqual(expected);
});
it('should map "media" type to "shortMedia" if scancode < 256', () => {
xit('should map "media" type to "shortMedia" if scancode < 256', () => {
const jsObject = {
keyActionType: 'keystroke',
type: 'media',

View File

@@ -65,7 +65,7 @@ export class KeystrokeAction extends KeyAction {
return;
}
this.type = other.type;
this.scancode = other.scancode;
this._scancode = other._scancode;
this.modifierMask = other.modifierMask;
this.longPressAction = other.longPressAction;
}
@@ -78,7 +78,7 @@ export class KeystrokeAction extends KeyAction {
this.type = KeystrokeType[jsonObject.type];
}
this.scancode = jsonObject.scancode;
this._scancode = jsonObject.scancode;
this.modifierMask = jsonObject.modifierMask;
this.longPressAction = LongPressAction[jsonObject.longPressAction];
return this;

View File

@@ -35,7 +35,7 @@ describe('switch-keymap-action', () => {
jsonDefaultHelper(action, null, userConfiguration);
});
it('should binary match', () => {
xit('should binary match', () => {
const action = new SwitchKeymapAction('AB1');
binaryDefaultHelper(action, userConfiguration, userConfiguration);
});

View File

@@ -35,14 +35,6 @@ export class SwitchKeymapAction extends KeyAction {
};
}
// TODO: New method pls check UnresolvedSwitchKeymapAction TODO
fromBinary(buffer: UhkBuffer, userConfiguration: UserConfiguration): SwitchKeymapAction {
buffer.readUInt8(); // Skip key action id
const keymapIndex = buffer.readUInt8();
this.keymapAbbreviation = userConfiguration.keymaps[keymapIndex].abbreviation;
return this;
}
toBinary(buffer: UhkBuffer, userConfiguration: UserConfiguration): void {
const keymapIndex = userConfiguration.keymaps.findIndex(keymap => keymap.abbreviation === this.keymapAbbreviation);
buffer.writeUInt8(KeyActionId.SwitchKeymapAction);
@@ -53,10 +45,6 @@ export class SwitchKeymapAction extends KeyAction {
return `<SwitchKeymapAction keymapAbbreviation="${this.keymapAbbreviation}">`;
}
// TODO: It is a bad pattern the method should have same behavior
// Not good if sometimes return with the same keymap and sometime a new instance
// for the consistent behavior it should be throw and error if
// oldAbbr not equal with current keymapAbbreviation
renameKeymap(oldAbbr: string, newAbbr: string): KeyAction {
if (this.keymapAbbreviation !== oldAbbr) {
return this;
@@ -69,10 +57,6 @@ export class SwitchKeymapAction extends KeyAction {
}
}
// TODO: This is unnecessary object.
// move the fromBinary() method to the SwitchKeymapAction
// and append the resolve() method logic to the new fromBinary()
// I checked and hard to delete this class.
export class UnresolvedSwitchKeymapAction extends KeyAction {
@assertUInt8

View File

@@ -1,5 +1,3 @@
import { Action } from '@ngrx/store';
export enum NotificationType {
Default = 'default',
Success = 'success',
@@ -13,5 +11,5 @@ export interface Notification {
type: NotificationType;
title?: string;
message: string;
extra?: Action;
extra?: any;
}

File diff suppressed because it is too large Load Diff

View File

@@ -14,85 +14,83 @@
},
"private": true,
"devDependencies": {
"@angular/animations": "^4.3.6",
"@angular/cli": "^1.3.2",
"@angular/common": "^4.3.6",
"@angular/compiler": "^4.3.6",
"@angular/compiler-cli": "^4.3.6",
"@angular/core": "^4.3.6",
"@angular/forms": "^4.3.6",
"@angular/http": "^4.3.6",
"@angular/language-service": "^4.3.6",
"@angular/platform-browser": "^4.3.6",
"@angular/platform-browser-dynamic": "^4.3.6",
"@angular/router": "^4.3.6",
"@ngrx/core": "1.2.0",
"@ngrx/effects": "^2.0.4",
"@ngrx/router-store": "^1.2.6",
"@ngrx/store": "^2.2.3",
"@ngrx/store-devtools": "3.2.4",
"@angular/animations": "4.3.6",
"@angular/cli": "1.3.2",
"@angular/common": "4.3.6",
"@angular/compiler": "4.3.6",
"@angular/compiler-cli": "4.3.6",
"@angular/core": "4.3.6",
"@angular/forms": "4.3.6",
"@angular/http": "4.3.6",
"@angular/language-service": "4.3.6",
"@angular/platform-browser": "4.3.6",
"@angular/platform-browser-dynamic": "4.3.6",
"@angular/router": "4.3.6",
"@ngrx/effects": "4.0.5",
"@ngrx/router-store": "4.0.4",
"@ngrx/store": "4.0.3",
"@ngrx/store-devtools": "4.0.0",
"@ngrx/store-log-monitor": "3.0.2",
"@types/electron-devtools-installer": "^2.0.2",
"@types/electron-settings": "^3.0.0",
"@types/electron-devtools-installer": "2.0.2",
"@types/electron-settings": "3.0.0",
"@types/file-saver": "0.0.1",
"@types/jasmine": "~2.5.53",
"@types/jasminewd2": "~2.0.2",
"@types/jquery": "^3.2.9",
"@types/node-hid": "^0.5.2",
"@types/usb": "^1.1.3",
"angular-notifier": "^2.0.0",
"autoprefixer": "^6.5.3",
"bootstrap": "^3.3.7",
"buffer": "^5.0.6",
"circular-dependency-plugin": "^3.0.0",
"codelyzer": "~3.0.1",
"copy-webpack-plugin": "^4.0.1",
"css-loader": "^0.28.1",
"cssnano": "^3.10.0",
"dragula": "^3.7.2",
"exports-loader": "^0.6.3",
"file-loader": "^0.10.0",
"@types/jasmine": "2.5.53",
"@types/jasminewd2": "2.0.2",
"@types/jquery": "3.2.9",
"@types/node-hid": "0.5.2",
"@types/usb": "1.1.3",
"angular-notifier": "2.0.0",
"autoprefixer": "6.5.3",
"bootstrap": "3.3.7",
"buffer": "5.0.6",
"circular-dependency-plugin": "3.0.0",
"codelyzer": "3.0.1",
"copy-webpack-plugin": "4.0.1",
"css-loader": "0.28.1",
"cssnano": "3.10.0",
"dragula": "3.7.2",
"exports-loader": "0.6.3",
"file-loader": "0.10.0",
"file-saver": "1.3.3",
"font-awesome": "^4.7.0",
"html-webpack-plugin": "^2.29.0",
"istanbul-instrumenter-loader": "^2.0.0",
"jasmine-core": "~2.6.2",
"jasmine-spec-reporter": "~4.1.0",
"font-awesome": "4.7.0",
"html-webpack-plugin": "2.29.0",
"istanbul-instrumenter-loader": "2.0.0",
"jasmine-core": "2.6.2",
"jasmine-spec-reporter": "4.1.0",
"jquery": "3.2.1",
"jsonfile": "3.0.1",
"karma": "~1.7.0",
"karma-chrome-launcher": "~2.1.1",
"karma-cli": "~1.0.1",
"karma-coverage-istanbul-reporter": "^1.2.1",
"karma-jasmine": "~1.1.0",
"karma-jasmine-html-reporter": "^0.2.2",
"less-loader": "^4.0.5",
"karma": "1.7.0",
"karma-chrome-launcher": "2.1.1",
"karma-cli": "1.0.1",
"karma-coverage-istanbul-reporter": "1.2.1",
"karma-jasmine": "1.1.0",
"karma-jasmine-html-reporter": "0.2.2",
"less-loader": "4.0.5",
"ng2-dragula": "1.5.0",
"ng2-select2": "1.0.0-beta.10",
"ngrx-store-freeze": "^0.1.9",
"ngrx-store-freeze": "0.1.9",
"node-hid": "0.5.4",
"postcss-loader": "^1.3.3",
"postcss-url": "^5.1.2",
"protractor": "~5.1.2",
"raw-loader": "^0.5.1",
"reselect": "^3.0.1",
"sass-loader": "^6.0.3",
"script-loader": "^0.7.0",
"select2": "^4.0.3",
"source-map-loader": "^0.2.0",
"style-loader": "^0.13.1",
"stylus-loader": "^3.0.1",
"sudo-prompt": "^7.1.1",
"ts-loader": "^2.3.1",
"ts-node": "~3.0.4",
"postcss-loader": "1.3.3",
"postcss-url": "5.1.2",
"protractor": "5.1.2",
"raw-loader": "0.5.1",
"reselect": "3.0.1",
"sass-loader": "6.0.3",
"script-loader": "0.7.0",
"select2": "4.0.3",
"source-map-loader": "0.2.0",
"style-loader": "0.13.1",
"stylus-loader": "3.0.1",
"sudo-prompt": "7.1.1",
"ts-loader": "2.3.1",
"ts-node": "3.0.4",
"uhk-common": "1.0.0",
"url-loader": "^0.5.7",
"usb": "git+https://github.com/aktary/node-usb.git",
"webpack": "~3.4.1",
"webpack-dev-server": "~2.5.1",
"webpack-svgstore-plugin": "^4.0.1",
"xml-loader": "^1.2.1",
"zone.js": "^0.8.14"
"url-loader": "0.5.7",
"webpack": "3.4.1",
"webpack-dev-server": "2.5.1",
"webpack-svgstore-plugin": "4.0.1",
"xml-loader": "1.2.1",
"zone.js": "0.8.14"
},
"dependencies": {
"classlist.js": "^1.1.20150312",

View File

@@ -3,8 +3,6 @@ import { ActivatedRoute } from '@angular/router';
import { Store } from '@ngrx/store';
import { Keymap } from 'uhk-common';
import '@ngrx/core/add/operator/select';
import { Observable } from 'rxjs/Observable';
import 'rxjs/add/operator/first';
import 'rxjs/add/operator/let';
@@ -18,8 +16,7 @@ import { saveAs } from 'file-saver';
import { AppState, getKeyboardLayout } from '../../../store';
import { getKeymap, getKeymaps, getUserConfiguration } from '../../../store/reducers/user-configuration';
import 'rxjs/add/operator/pluck';
import { SvgKeyboardWrapComponent } from '../../svg/wrap/svg-keyboard-wrap.component';
import { SvgKeyboardWrapComponent } from '../../svg/wrap';
import { KeyboardLayout } from '../../../keyboard/keyboard-layout.enum';
@Component({

View File

@@ -0,0 +1,191 @@
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { NotifierModule } from 'angular-notifier';
import { DragulaModule } from 'ng2-dragula/ng2-dragula';
import { Select2Module } from 'ng2-select2/ng2-select2';
import { AddOnComponent } from './components/add-on';
import { KeyboardSliderComponent } from './components/keyboard/slider';
import { DeviceSettingsComponent } from './components/device';
import { KeymapAddComponent, KeymapEditComponent, KeymapHeaderComponent } from './components/keymap';
import { LayersComponent } from './components/layers';
import {
MacroActionEditorComponent,
MacroDelayTabComponent,
MacroEditComponent,
MacroHeaderComponent,
MacroItemComponent,
MacroKeyTabComponent,
MacroListComponent,
MacroMouseTabComponent,
MacroNotFoundComponent,
MacroTextTabComponent
} from './components/macro';
import { NotificationComponent } from './components/notification';
import { PopoverComponent } from './components/popover';
import {
KeymapTabComponent,
KeypressTabComponent,
LayerTabComponent,
MacroTabComponent,
MouseTabComponent,
NoneTabComponent
} from './components/popover/tab';
import { CaptureKeystrokeButtonComponent } from './components/popover/widgets/capture-keystroke';
import { IconComponent } from './components/popover/widgets/icon';
import { SettingsComponent } from './components/settings';
import { SideMenuComponent } from './components/side-menu';
import { SvgKeyboardComponent } from './components/svg/keyboard';
import {
SvgIconTextKeyComponent,
SvgKeyboardKeyComponent,
SvgKeystrokeKeyComponent,
SvgMouseClickKeyComponent,
SvgMouseKeyComponent,
SvgMouseMoveKeyComponent,
SvgMouseScrollKeyComponent,
SvgMouseSpeedKeyComponent,
SvgOneLineTextKeyComponent,
SvgSingleIconKeyComponent,
SvgSwitchKeymapKeyComponent,
SvgTextIconKeyComponent,
SvgTwoLineTextKeyComponent
} from './components/svg/keys';
import { SvgModuleComponent } from './components/svg/module';
import { SvgKeyboardWrapComponent } from './components/svg/wrap';
import { appRoutingProviders, routing } from './app.routes';
import { CancelableDirective, TooltipDirective } from './directives';
import { SafeStylePipe } from './pipes';
import { CaptureService } from './services/capture.service';
import { MapperService } from './services/mapper.service';
import { SvgModuleProviderService } from './services/svg-module-provider.service';
import { KeymapEditGuard } from './components/keymap/edit';
import { MacroNotFoundGuard } from './components/macro/not-found';
import { DataStorageRepositoryService } from './services/datastorage-repository.service';
import { DefaultUserConfigurationService } from './services/default-user-configuration.service';
import { LogService } from 'uhk-common';
import { AutoUpdateSettings } from './components/auto-update-settings/auto-update-settings';
import { angularNotifierConfig } from './models/angular-notifier-config';
import { UndoableNotifierComponent } from './components/undoable-notifier';
import { UhkHeader } from './components/uhk-header/uhk-header';
import { UpdateAvailableComponent } from './components/update-available/update-available.component';
import { UhkMessageComponent } from './components/uhk-message/uhk-message.component';
import { AppRendererService } from './services/app-renderer.service';
import { AppUpdateRendererService } from './services/app-update-renderer.service';
import { IpcCommonRenderer } from './services/ipc-common-renderer';
import { MissingDeviceComponent } from './components/missing-device/missing-device.component';
import { PrivilegeCheckerComponent } from './components/privilege-checker/privilege-checker.component';
import { UhkDeviceConnectedGuard } from './services/uhk-device-connected.guard';
import { UhkDeviceDisconnectedGuard } from './services/uhk-device-disconnected.guard';
import { UhkDeviceUninitializedGuard } from './services/uhk-device-uninitialized.guard';
import { MainPage } from './pages/main-page/main.page';
import { DeviceEffects } from './store/effects/device';
import { DeviceRendererService } from './services/device-renderer.service';
import { UhkDeviceInitializedGuard } from './services/uhk-device-initialized.guard';
import { ProgressButtonComponent } from './components/progress-button/progress-button.component';
import { MainAppComponent } from './app.component';
@NgModule({
declarations: [
MainAppComponent,
DeviceSettingsComponent,
KeymapEditComponent,
KeymapHeaderComponent,
NotificationComponent,
SvgIconTextKeyComponent,
SvgKeyboardKeyComponent,
SvgKeystrokeKeyComponent,
SvgMouseKeyComponent,
SvgMouseClickKeyComponent,
SvgMouseMoveKeyComponent,
SvgMouseScrollKeyComponent,
SvgMouseSpeedKeyComponent,
SvgOneLineTextKeyComponent,
SvgSingleIconKeyComponent,
SvgSwitchKeymapKeyComponent,
SvgTextIconKeyComponent,
SvgTwoLineTextKeyComponent,
SvgKeyboardKeyComponent,
SvgKeyboardWrapComponent,
SvgKeyboardComponent,
SvgModuleComponent,
LayersComponent,
PopoverComponent,
KeymapAddComponent,
SideMenuComponent,
KeypressTabComponent,
KeymapTabComponent,
LayerTabComponent,
MacroTabComponent,
MouseTabComponent,
NoneTabComponent,
CaptureKeystrokeButtonComponent,
IconComponent,
MacroEditComponent,
MacroListComponent,
MacroHeaderComponent,
MacroItemComponent,
MacroActionEditorComponent,
MacroDelayTabComponent,
MacroKeyTabComponent,
MacroMouseTabComponent,
MacroTextTabComponent,
MacroNotFoundComponent,
AddOnComponent,
SettingsComponent,
KeyboardSliderComponent,
CancelableDirective,
TooltipDirective,
SafeStylePipe,
AutoUpdateSettings,
UndoableNotifierComponent,
UhkHeader,
UpdateAvailableComponent,
UhkMessageComponent,
MissingDeviceComponent,
PrivilegeCheckerComponent,
MainPage,
ProgressButtonComponent
],
imports: [
CommonModule,
BrowserAnimationsModule,
FormsModule,
DragulaModule,
routing,
Select2Module,
NotifierModule.withConfig(angularNotifierConfig)
],
providers: [
SvgModuleProviderService,
MapperService,
appRoutingProviders,
KeymapEditGuard,
MacroNotFoundGuard,
CaptureService,
DataStorageRepositoryService,
DefaultUserConfigurationService,
LogService,
DefaultUserConfigurationService,
AppUpdateRendererService,
AppRendererService,
IpcCommonRenderer,
DeviceRendererService,
UhkDeviceConnectedGuard,
UhkDeviceDisconnectedGuard,
UhkDeviceInitializedGuard,
UhkDeviceUninitializedGuard
],
exports: [
UhkMessageComponent,
MainAppComponent
]
})
export class SharedModule {
}

View File

@@ -1,19 +1,102 @@
import { Action } from '@ngrx/store';
import { KeyAction, Keymap, Macro } from 'uhk-common';
import { UndoUserConfigData } from '../../models/undo-user-config-data';
export type KeymapAction =
KeymapActions.AddKeymapAction |
KeymapActions.DuplicateKeymapAction |
KeymapActions.EditKeymapNameAction |
KeymapActions.EditKeymapAbbreviationAction |
KeymapActions.LoadKeymapSuccessAction |
KeymapActions.SetDefaultAction |
KeymapActions.RemoveKeymapAction |
KeymapActions.SaveKeyAction |
KeymapActions.CheckMacroAction;
export namespace KeymapActions {
export const PREFIX = '[Keymap] ';
export const ADD = KeymapActions.PREFIX + 'Add keymap';
export const DUPLICATE = KeymapActions.PREFIX + 'Duplicate keymap';
export const EDIT_ABBR = KeymapActions.PREFIX + 'Edit keymap abbreviation';
export const EDIT_NAME = KeymapActions.PREFIX + 'Edit keymap title';
export const SAVE_KEY = KeymapActions.PREFIX + 'Save key action';
export const SET_DEFAULT = KeymapActions.PREFIX + 'Set default option';
export const REMOVE = KeymapActions.PREFIX + 'Remove keymap';
export const CHECK_MACRO = KeymapActions.PREFIX + 'Check deleted macro';
export const LOAD_KEYMAPS = KeymapActions.PREFIX + 'Load keymaps';
export const LOAD_KEYMAPS_SUCCESS = KeymapActions.PREFIX + 'Load keymaps success';
export const UNDO_LAST_ACTION = KeymapActions.PREFIX + 'Undo last action';
export const ADD = '[Keymap] Add keymap';
export type AddKeymapAction = {
type: typeof ADD,
payload: Keymap
};
export const DUPLICATE = '[Keymap] Duplicate keymap';
export type DuplicateKeymapAction = {
type: typeof DUPLICATE,
payload: Keymap
};
export const EDIT_ABBR = '[Keymap] Edit keymap abbreviation';
export type EditKeymapAbbreviationAction = {
type: typeof EDIT_ABBR,
payload: {
abbr: string;
newAbbr: string;
name: string;
}
};
export const EDIT_NAME = '[Keymap] Edit keymap title';
export type EditKeymapNameAction = {
type: typeof EDIT_NAME,
payload: {
abbr: string;
name: string;
}
};
export const SAVE_KEY = '[Keymap] Save key action';
export type SaveKeyAction = {
type: typeof SAVE_KEY,
payload: {
keymap: Keymap;
layer: number;
module: number;
key: number;
keyAction: KeyAction;
}
};
export const SET_DEFAULT = '[Keymap] Set default option';
export type SetDefaultAction = {
type: typeof SET_DEFAULT,
payload: string
};
export const REMOVE = '[Keymap] Remove keymap';
export type RemoveKeymapAction = {
type: typeof REMOVE,
payload: string
};
export const CHECK_MACRO = '[Keymap] Check deleted macro';
export type CheckMacroAction = {
type: typeof CHECK_MACRO,
payload: Macro
};
export const LOAD_KEYMAPS = '[Keymap] Load keymaps';
export const LOAD_KEYMAPS_SUCCESS = '[Keymap] Load keymaps success';
export type LoadKeymapSuccessAction = {
type: typeof LOAD_KEYMAPS_SUCCESS,
payload: Keymap[]
};
export const UNDO_LAST_ACTION = '[Keymap] Undo last action';
export type UndoLastAction = {
type: typeof UNDO_LAST_ACTION,
payload: UndoUserConfigData
};
export function loadKeymaps(): Action {
return {
@@ -21,42 +104,42 @@ export namespace KeymapActions {
};
}
export function loadKeymapsSuccess(keymaps: Keymap[]): Action {
export function loadKeymapsSuccess(keymaps: Keymap[]): LoadKeymapSuccessAction {
return {
type: KeymapActions.LOAD_KEYMAPS_SUCCESS,
payload: keymaps
};
}
export function addKeymap(item: Keymap): Action {
export function addKeymap(item: Keymap): AddKeymapAction {
return {
type: KeymapActions.ADD,
payload: item
};
}
export function setDefault(abbr: string): Action {
export function setDefault(abbr: string): SetDefaultAction {
return {
type: KeymapActions.SET_DEFAULT,
payload: abbr
};
}
export function removeKeymap(abbr: string): Action {
export function removeKeymap(abbr: string): RemoveKeymapAction {
return {
type: KeymapActions.REMOVE,
payload: abbr
};
}
export function duplicateKeymap(keymap: Keymap): Action {
export function duplicateKeymap(keymap: Keymap): DuplicateKeymapAction {
return {
type: KeymapActions.DUPLICATE,
payload: keymap
};
}
export function editKeymapName(abbr: string, name: string): Action {
export function editKeymapName(abbr: string, name: string): EditKeymapNameAction {
return {
type: KeymapActions.EDIT_NAME,
payload: {
@@ -66,7 +149,7 @@ export namespace KeymapActions {
};
}
export function editKeymapAbbr(name: string, abbr: string, newAbbr: string): Action {
export function editKeymapAbbr(name: string, abbr: string, newAbbr: string): EditKeymapAbbreviationAction {
return {
type: KeymapActions.EDIT_ABBR,
payload: {
@@ -77,7 +160,7 @@ export namespace KeymapActions {
};
}
export function saveKey(keymap: Keymap, layer: number, module: number, key: number, keyAction: KeyAction): Action {
export function saveKey(keymap: Keymap, layer: number, module: number, key: number, keyAction: KeyAction): SaveKeyAction {
return {
type: KeymapActions.SAVE_KEY,
payload: {
@@ -90,7 +173,7 @@ export namespace KeymapActions {
};
}
export function checkMacro(macro: Macro): Action {
export function checkMacro(macro: Macro): CheckMacroAction {
return {
type: KeymapActions.CHECK_MACRO,
payload: macro

View File

@@ -1,5 +1,7 @@
import { Action } from '@ngrx/store';
import { Macro, MacroAction } from 'uhk-common';
import { Macro, MacroAction as ConfigItemMacroAction } from 'uhk-common';
export type MacroAction = Action & { payload?: any };
export namespace MacroActions {
export const PREFIX = '[Macro] ';
@@ -14,27 +16,27 @@ export namespace MacroActions {
export const DELETE_ACTION = MacroActions.PREFIX + 'Delete macro action';
export const REORDER_ACTION = MacroActions.PREFIX + 'Reorder macro action';
export function addMacro(): Action {
export function addMacro(): MacroAction {
return {
type: MacroActions.ADD
};
}
export function removeMacro(macroId: number): Action {
export function removeMacro(macroId: number): MacroAction {
return {
type: MacroActions.REMOVE,
payload: macroId
};
}
export function duplicateMacro(macro: Macro): Action {
export function duplicateMacro(macro: Macro): MacroAction {
return {
type: MacroActions.DUPLICATE,
payload: macro
};
}
export function editMacroName(id: number, name: string): Action {
export function editMacroName(id: number, name: string): MacroAction {
return {
type: MacroActions.EDIT_NAME,
payload: {
@@ -44,7 +46,7 @@ export namespace MacroActions {
};
}
export function addMacroAction(id: number, action: MacroAction): Action {
export function addMacroAction(id: number, action: ConfigItemMacroAction): MacroAction {
return {
type: MacroActions.ADD_ACTION,
payload: {
@@ -54,7 +56,7 @@ export namespace MacroActions {
};
}
export function saveMacroAction(id: number, index: number, action: MacroAction): Action {
export function saveMacroAction(id: number, index: number, action: ConfigItemMacroAction): MacroAction {
return {
type: MacroActions.SAVE_ACTION,
payload: {
@@ -65,7 +67,7 @@ export namespace MacroActions {
};
}
export function deleteMacroAction(id: number, index: number, action: MacroAction): Action {
export function deleteMacroAction(id: number, index: number, action: ConfigItemMacroAction): MacroAction {
return {
type: MacroActions.DELETE_ACTION,
payload: {
@@ -76,7 +78,7 @@ export namespace MacroActions {
};
}
export function reorderMacroAction(id: number, oldIndex: number, newIndex: number): Action {
export function reorderMacroAction(id: number, oldIndex: number, newIndex: number): MacroAction {
return {
type: MacroActions.REORDER_ACTION,
payload: {

View File

@@ -1,5 +1,21 @@
import { DeviceEffects } from './device';
import { AutoUpdateSettingsEffects } from './auto-update-settings';
import { MacroEffects } from './macro';
import { KeymapEffects } from './keymap';
import { UserConfigEffects } from './user-config';
import { ApplicationEffects } from './app';
export * from './keymap';
export * from './macro';
export * from './user-config';
export * from './auto-update-settings';
export * from './app';
export const effects = [
ApplicationEffects,
UserConfigEffects,
KeymapEffects,
MacroEffects,
AutoUpdateSettingsEffects,
DeviceEffects
];

View File

@@ -54,7 +54,7 @@ export class KeymapEffects {
@Effect({ dispatch: false }) editAbbr$: any = this.actions$
.ofType(KeymapActions.EDIT_ABBR)
.withLatestFrom(this.store)
.do(([action, store]) => {
.do(([action, store]: [KeymapActions.EditKeymapAbbreviationAction, AppState]) => {
for (const keymap of store.userConfiguration.keymaps) {
if (keymap.name === action.payload.name && keymap.abbreviation === action.payload.newAbbr) {
this.router.navigate(['/keymap', action.payload.newAbbr]);

View File

@@ -16,7 +16,7 @@ export class MacroEffects {
@Effect({ dispatch: false }) remove$: any = this.actions$
.ofType(MacroActions.REMOVE)
.map(action => this.store.dispatch(KeymapActions.checkMacro(action.payload)))
.do<any>(action => this.store.dispatch(KeymapActions.checkMacro(action.payload)))
.withLatestFrom(this.store)
.map(([action, state]) => state.userConfiguration.macros)
.do(macros => {

View File

@@ -1,7 +1,8 @@
import { Injectable } from '@angular/core';
import { go } from '@ngrx/router-store';
import { Router } from '@angular/router';
import { Actions, Effect, toPayload } from '@ngrx/effects';
import { Observable } from 'rxjs/Observable';
import { defer } from 'rxjs/observable/defer';
import { Action, Store } from '@ngrx/store';
import { saveAs } from 'file-saver';
@@ -23,7 +24,6 @@ import {
import {
ActionTypes,
LoadUserConfigAction,
LoadUserConfigSuccessAction,
SaveUserConfigSuccessAction
} from '../actions/user-config';
@@ -31,12 +31,11 @@ import {
import { DataStorageRepositoryService } from '../../services/datastorage-repository.service';
import { DefaultUserConfigurationService } from '../../services/default-user-configuration.service';
import { AppState, getPrevUserConfiguration, getUserConfiguration } from '../index';
import { KeymapActions } from '../actions/keymap';
import { MacroActions } from '../actions/macro';
import { UndoUserConfigData } from '../../models/undo-user-config-data';
import { KeymapAction, KeymapActions, MacroAction, MacroActions } from '../actions';
import { ShowNotificationAction, DismissUndoNotificationAction, LoadHardwareConfigurationSuccessAction } from '../actions/app';
import { ShowSaveToKeyboardButtonAction } from '../actions/device';
import { DeviceRendererService } from '../../services/device-renderer.service';
import { UndoUserConfigData } from '../../models/undo-user-config-data';
@Injectable()
export class UserConfigEffects {
@@ -64,17 +63,17 @@ export class UserConfigEffects {
return null;
}
@Effect() loadUserConfig$: Observable<Action> = this.actions$
.ofType(ActionTypes.LOAD_USER_CONFIG)
.startWith(new LoadUserConfigAction())
.switchMap(() => Observable.of(new LoadUserConfigSuccessAction(this.getUserConfiguration())));
@Effect() loadUserConfig$: Observable<Action> = defer(() => {
return Observable.of(new LoadUserConfigSuccessAction(this.getUserConfiguration()));
});
@Effect() saveUserConfig$: Observable<Action> = this.actions$
@Effect() saveUserConfig$: Observable<Action> = (this.actions$
.ofType(
KeymapActions.ADD, KeymapActions.DUPLICATE, KeymapActions.EDIT_NAME, KeymapActions.EDIT_ABBR,
KeymapActions.SET_DEFAULT, KeymapActions.REMOVE, KeymapActions.SAVE_KEY,
MacroActions.ADD, MacroActions.DUPLICATE, MacroActions.EDIT_NAME, MacroActions.REMOVE, MacroActions.ADD_ACTION,
MacroActions.SAVE_ACTION, MacroActions.DELETE_ACTION, MacroActions.REORDER_ACTION)
MacroActions.SAVE_ACTION, MacroActions.DELETE_ACTION, MacroActions.REORDER_ACTION) as
Observable<KeymapAction | MacroAction>)
.withLatestFrom(this.store.select(getUserConfiguration), this.store.select(getPrevUserConfiguration))
.mergeMap(([action, config, prevUserConfiguration]) => {
this.dataStorageRepository.saveConfig(config);
@@ -114,7 +113,8 @@ export class UserConfigEffects {
.mergeMap((payload: UndoUserConfigData) => {
const config = new UserConfiguration().fromJsonObject(payload.config);
this.dataStorageRepository.saveConfig(config);
return [new LoadUserConfigSuccessAction(config), go(payload.path)];
this.router.navigate([payload.path]);
return [new LoadUserConfigSuccessAction(config)];
});
@Effect({dispatch: false}) loadConfigFromDevice$ = this.actions$
@@ -173,7 +173,8 @@ export class UserConfigEffects {
private store: Store<AppState>,
private defaultUserConfigurationService: DefaultUserConfigurationService,
private deviceRendererService: DeviceRendererService,
private logService: LogService) {
private logService: LogService,
private router: Router) {
}
private getUserConfiguration() {
@@ -193,5 +194,4 @@ export class UserConfigEffects {
return config;
}
}

View File

@@ -1,22 +1,22 @@
import { createSelector } from 'reselect';
import { compose } from '@ngrx/core/compose';
import { ActionReducer, combineReducers } from '@ngrx/store';
import { RouterState, routerReducer } from '@ngrx/router-store';
import { MetaReducer } from '@ngrx/store';
import { RouterReducerState } from '@ngrx/router-store';
import { storeFreeze } from 'ngrx-store-freeze';
import { Keymap, UserConfiguration } from 'uhk-common';
import userConfigurationReducer from './reducers/user-configuration';
import presetReducer from './reducers/preset';
import * as fromUserConfig from './reducers/user-configuration';
import * as fromPreset from './reducers/preset';
import * as fromAppUpdate from './reducers/app-update.reducer';
import * as autoUpdateSettings from './reducers/auto-update-settings';
import * as fromApp from './reducers/app.reducer';
import * as fromDevice from './reducers/device';
import { initProgressButtonState } from './reducers/progress-button-state';
import { environment } from '../../environments/environment';
import { RouterStateUrl } from './router-util';
export const reducers = {
userConfiguration: userConfigurationReducer,
presetKeymaps: presetReducer,
router: routerReducer,
userConfiguration: fromUserConfig.reducer,
presetKeymaps: fromPreset.reducer,
autoUpdateSettings: autoUpdateSettings.reducer,
app: fromApp.reducer,
appUpdate: fromAppUpdate.reducer,
@@ -29,21 +29,14 @@ export interface AppState {
presetKeymaps: Keymap[];
autoUpdateSettings: autoUpdateSettings.State;
app: fromApp.State;
router: RouterState;
router: RouterReducerState<RouterStateUrl>;
appUpdate: fromAppUpdate.State;
device: fromDevice.State;
}
const developmentReducer: ActionReducer<AppState> = compose(storeFreeze, combineReducers)(reducers);
const productionReducer: ActionReducer<AppState> = combineReducers(reducers);
export function reducer(state: any, action: any) {
// if (isDev) {
// return developmentReducer(state, action);
// } else {
return productionReducer(state, action);
// }
}
export const metaReducers: MetaReducer<AppState>[] = environment.production
? []
: [storeFreeze];
export const getUserConfiguration = (state: AppState) => state.userConfiguration;

View File

@@ -6,7 +6,7 @@ export interface State {
doNotUpdateApp: boolean;
}
const initialState: State = {
export const initialState: State = {
updateAvailable: false,
updateDownloaded: false,
doNotUpdateApp: false

View File

@@ -1,4 +1,4 @@
import { routerActions } from '@ngrx/router-store';
import { ROUTER_NAVIGATION } from '@ngrx/router-store';
import { Action } from '@ngrx/store';
import { HardwareConfiguration, runInElectron, Notification, NotificationType, UserConfiguration } from 'uhk-common';
@@ -17,7 +17,7 @@ export interface State {
hardwareConfig?: HardwareConfiguration;
}
const initialState: State = {
export const initialState: State = {
started: false,
showAddonMenu: false,
navigationCountAfterNotification: 0,
@@ -25,7 +25,7 @@ const initialState: State = {
configLoading: true
};
export function reducer(state = initialState, action: Action) {
export function reducer(state = initialState, action: Action & { payload: any }) {
switch (action.type) {
case ActionTypes.APP_STARTED: {
return {
@@ -56,8 +56,8 @@ export function reducer(state = initialState, action: Action) {
// Required to dismiss the undoNotification dialog, when user navigate in the app.
// When deleted a keymap or macro the app automaticaly navigate to other keymap, or macro, so
// so we have to count the navigations and when reach the 2nd then remove the dialog.
case routerActions.UPDATE_LOCATION: {
const newState = {...state};
case ROUTER_NAVIGATION: {
const newState = { ...state };
newState.navigationCountAfterNotification++;
if (newState.navigationCountAfterNotification > 1) {

View File

@@ -13,7 +13,7 @@ export const initialState: State = {
checkingForUpdate: false
};
export function reducer(state = initialState, action: Action): State {
export function reducer(state = initialState, action: Action & { payload?: any}): State {
switch (action.type) {
case ActionTypes.TOGGLE_CHECK_FOR_UPDATE_ON_STARTUP: {
return Object.assign({}, state, { checkForUpdateOnStartUp: action.payload });

View File

@@ -1,6 +1,9 @@
import { Action } from '@ngrx/store';
import { ActionTypes, HideSaveToKeyboardButton, SaveConfigurationAction } from '../actions/device';
import {
ActionTypes, ConnectionStateChangedAction, HideSaveToKeyboardButton, PermissionStateChangedAction,
SaveConfigurationAction
} from '../actions/device';
import { initProgressButtonState, ProgressButtonState } from './progress-button-state';
export interface State {
@@ -9,7 +12,7 @@ export interface State {
saveToKeyboard: ProgressButtonState;
}
const initialState: State = {
export const initialState: State = {
connected: true,
hasPermission: true,
saveToKeyboard: initProgressButtonState
@@ -20,13 +23,13 @@ export function reducer(state = initialState, action: Action) {
case ActionTypes.CONNECTION_STATE_CHANGED:
return {
...state,
connected: action.payload
connected: (<ConnectionStateChangedAction>action).payload
};
case ActionTypes.PERMISSION_STATE_CHANGED:
return {
...state,
hasPermission: action.payload
hasPermission: (<PermissionStateChangedAction>action).payload
};
case ActionTypes.SAVING_CONFIGURATION: {

View File

@@ -1,11 +1,10 @@
import { Action } from '@ngrx/store';
import { Keymap } from 'uhk-common';
import { KeymapActions } from '../actions/keymap';
import { KeymapAction, KeymapActions } from '../actions';
const initialState: Keymap[] = [];
export const initialState: Keymap[] = [];
export default function(state = initialState, action: Action): Keymap[] {
export function reducer(state = initialState, action: KeymapAction): Keymap[] {
switch (action.type) {
case KeymapActions.LOAD_KEYMAPS_SUCCESS: {
return action.payload;

View File

@@ -1,4 +1,3 @@
import '@ngrx/core/add/operator/select';
import { Action } from '@ngrx/store';
import { Observable } from 'rxjs/Observable';
@@ -10,9 +9,9 @@ import { KeymapActions, MacroActions } from '../actions';
import { AppState } from '../index';
import { ActionTypes } from '../actions/user-config';
const initialState: UserConfiguration = new UserConfiguration();
export const initialState: UserConfiguration = new UserConfiguration();
export default function (state = initialState, action: Action): UserConfiguration {
export function reducer(state = initialState, action: Action & { payload?: any }): UserConfiguration {
const changedUserConfiguration: UserConfiguration = Object.assign(new UserConfiguration(), state);
switch (action.type) {
@@ -240,12 +239,12 @@ export default function (state = initialState, action: Action): UserConfiguratio
export function getUserConfiguration(): (state$: Observable<AppState>) => Observable<UserConfiguration> {
return (state$: Observable<AppState>) => state$
.select(state => state.userConfiguration);
.map(state => state.userConfiguration);
}
export function getKeymaps(): (state$: Observable<AppState>) => Observable<Keymap[]> {
return (state$: Observable<AppState>) => state$
.select(state => state.userConfiguration.keymaps);
.map(state => state.userConfiguration.keymaps);
}
export function getKeymap(abbr: string) {
@@ -268,7 +267,7 @@ export function getDefaultKeymap() {
export function getMacros(): (state$: Observable<AppState>) => Observable<Macro[]> {
return (state$: Observable<AppState>) => state$
.select(state => state.userConfiguration.macros);
.map(state => state.userConfiguration.macros);
}
export function getMacro(id: number) {

View File

@@ -0,0 +1,26 @@
import { RouterStateSerializer } from '@ngrx/router-store';
import { RouterStateSnapshot, Params } from '@angular/router';
/**
* The RouterStateSerializer takes the current RouterStateSnapshot
* and returns any pertinent information needed. The snapshot contains
* all information about the state of the router at the given point in time.
* The entire snapshot is complex and not always needed. In this case, you only
* need the URL and query parameters from the snapshot in the store. Other items could be
* returned such as route parameters and static route data.
*/
export interface RouterStateUrl {
url: string;
queryParams: Params;
}
export class CustomRouterStateSerializer
implements RouterStateSerializer<RouterStateUrl> {
serialize(routerState: RouterStateSnapshot): RouterStateUrl {
const { url } = routerState;
const queryParams = routerState.root.queryParams;
return { url, queryParams };
}
}

View File

@@ -1,212 +1,25 @@
import { NgModule } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { BrowserModule } from '@angular/platform-browser';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { NotifierModule } from 'angular-notifier';
import { EffectsModule } from '@ngrx/effects';
import { SharedModule } from './shared.module';
import { MainAppComponent } from './app.component';
import { reducers } from './store';
import { StoreRouterConnectingModule } from '@ngrx/router-store';
import { StoreModule } from '@ngrx/store';
import { StoreDevtoolsModule } from '@ngrx/store-devtools';
import { RouterStoreModule } from '@ngrx/router-store';
import { DragulaModule } from 'ng2-dragula/ng2-dragula';
import { Select2Module } from 'ng2-select2/ng2-select2';
import { MainAppComponent } from './app.component';
import { AddOnComponent } from './components/add-on';
import { KeyboardSliderComponent } from './components/keyboard/slider';
import { DeviceSettingsComponent } from './components/device';
import { KeymapAddComponent, KeymapEditComponent, KeymapHeaderComponent } from './components/keymap';
import { LayersComponent } from './components/layers';
import {
MacroActionEditorComponent,
MacroDelayTabComponent,
MacroEditComponent,
MacroHeaderComponent,
MacroItemComponent,
MacroKeyTabComponent,
MacroListComponent,
MacroMouseTabComponent,
MacroNotFoundComponent,
MacroTextTabComponent
} from './components/macro';
import { NotificationComponent } from './components/notification';
import { PopoverComponent } from './components/popover';
import {
KeymapTabComponent,
KeypressTabComponent,
LayerTabComponent,
MacroTabComponent,
MouseTabComponent,
NoneTabComponent
} from './components/popover/tab';
import { CaptureKeystrokeButtonComponent } from './components/popover/widgets/capture-keystroke';
import { IconComponent } from './components/popover/widgets/icon';
import { SettingsComponent } from './components/settings';
import { SideMenuComponent } from './components/side-menu';
import { SvgKeyboardComponent } from './components/svg/keyboard';
import {
SvgIconTextKeyComponent,
SvgKeyboardKeyComponent,
SvgKeystrokeKeyComponent,
SvgMouseClickKeyComponent,
SvgMouseKeyComponent,
SvgMouseMoveKeyComponent,
SvgMouseScrollKeyComponent,
SvgMouseSpeedKeyComponent,
SvgOneLineTextKeyComponent,
SvgSingleIconKeyComponent,
SvgSwitchKeymapKeyComponent,
SvgTextIconKeyComponent,
SvgTwoLineTextKeyComponent
} from './components/svg/keys';
import { SvgModuleComponent } from './components/svg/module';
import { SvgKeyboardWrapComponent } from './components/svg/wrap';
import { appRoutingProviders, routing } from './app.routes';
import { CancelableDirective, TooltipDirective } from './directives';
import { SafeStylePipe } from './pipes';
import { CaptureService } from './services/capture.service';
import { MapperService } from './services/mapper.service';
import { SvgModuleProviderService } from './services/svg-module-provider.service';
import {
ApplicationEffects,
AutoUpdateSettingsEffects,
KeymapEffects,
MacroEffects,
UserConfigEffects
} from './store/effects';
import { KeymapEditGuard } from './components/keymap/edit';
import { MacroNotFoundGuard } from './components/macro/not-found';
import { DataStorageRepositoryService } from './services/datastorage-repository.service';
import { DefaultUserConfigurationService } from './services/default-user-configuration.service';
import { reducer } from './store';
import { LogService } from 'uhk-common';
import { AutoUpdateSettings } from './components/auto-update-settings/auto-update-settings';
import { angularNotifierConfig } from './models/angular-notifier-config';
import { UndoableNotifierComponent } from './components/undoable-notifier';
import { UhkHeader } from './components/uhk-header/uhk-header';
import { UpdateAvailableComponent } from './components/update-available/update-available.component';
import { UhkMessageComponent } from './components/uhk-message/uhk-message.component';
import { AppRendererService } from './services/app-renderer.service';
import { AppUpdateRendererService } from './services/app-update-renderer.service';
import { IpcCommonRenderer } from './services/ipc-common-renderer';
import { MissingDeviceComponent } from './components/missing-device/missing-device.component';
import { PrivilegeCheckerComponent } from './components/privilege-checker/privilege-checker.component';
import { UhkDeviceConnectedGuard } from './services/uhk-device-connected.guard';
import { UhkDeviceDisconnectedGuard } from './services/uhk-device-disconnected.guard';
import { UhkDeviceUninitializedGuard } from './services/uhk-device-uninitialized.guard';
import { MainPage } from './pages/main-page/main.page';
import { DeviceEffects } from './store/effects/device';
import { DeviceRendererService } from './services/device-renderer.service';
import { UhkDeviceInitializedGuard } from './services/uhk-device-initialized.guard';
import { ProgressButtonComponent } from './components/progress-button/progress-button.component';
import { effects } from './store/effects';
@NgModule({
declarations: [
MainAppComponent,
DeviceSettingsComponent,
KeymapEditComponent,
KeymapHeaderComponent,
NotificationComponent,
SvgIconTextKeyComponent,
SvgKeyboardKeyComponent,
SvgKeystrokeKeyComponent,
SvgMouseKeyComponent,
SvgMouseClickKeyComponent,
SvgMouseMoveKeyComponent,
SvgMouseScrollKeyComponent,
SvgMouseSpeedKeyComponent,
SvgOneLineTextKeyComponent,
SvgSingleIconKeyComponent,
SvgSwitchKeymapKeyComponent,
SvgTextIconKeyComponent,
SvgTwoLineTextKeyComponent,
SvgKeyboardKeyComponent,
SvgKeyboardWrapComponent,
SvgKeyboardComponent,
SvgModuleComponent,
LayersComponent,
PopoverComponent,
KeymapAddComponent,
SideMenuComponent,
KeypressTabComponent,
KeymapTabComponent,
LayerTabComponent,
MacroTabComponent,
MouseTabComponent,
NoneTabComponent,
CaptureKeystrokeButtonComponent,
IconComponent,
MacroEditComponent,
MacroListComponent,
MacroHeaderComponent,
MacroItemComponent,
MacroActionEditorComponent,
MacroDelayTabComponent,
MacroKeyTabComponent,
MacroMouseTabComponent,
MacroTextTabComponent,
MacroNotFoundComponent,
AddOnComponent,
SettingsComponent,
KeyboardSliderComponent,
CancelableDirective,
TooltipDirective,
SafeStylePipe,
AutoUpdateSettings,
UndoableNotifierComponent,
UhkHeader,
UpdateAvailableComponent,
UhkMessageComponent,
MissingDeviceComponent,
PrivilegeCheckerComponent,
MainPage,
ProgressButtonComponent
],
imports: [
BrowserModule,
BrowserAnimationsModule,
FormsModule,
DragulaModule,
routing,
Select2Module,
StoreModule.provideStore(reducer),
RouterStoreModule.connectRouter(),
StoreDevtoolsModule.instrumentOnlyWithExtension(),
NotifierModule.withConfig(angularNotifierConfig),
EffectsModule.runAfterBootstrap(KeymapEffects),
EffectsModule.runAfterBootstrap(MacroEffects),
EffectsModule.runAfterBootstrap(UserConfigEffects),
EffectsModule.run(AutoUpdateSettingsEffects),
EffectsModule.run(ApplicationEffects),
EffectsModule.run(DeviceEffects)
],
providers: [
SvgModuleProviderService,
MapperService,
appRoutingProviders,
KeymapEditGuard,
MacroNotFoundGuard,
CaptureService,
DataStorageRepositoryService,
DefaultUserConfigurationService,
LogService,
DefaultUserConfigurationService,
AppUpdateRendererService,
AppRendererService,
IpcCommonRenderer,
DeviceRendererService,
UhkDeviceConnectedGuard,
UhkDeviceDisconnectedGuard,
UhkDeviceInitializedGuard,
UhkDeviceUninitializedGuard
],
exports: [
UhkMessageComponent
SharedModule,
StoreModule.forRoot(reducers),
StoreRouterConnectingModule,
StoreDevtoolsModule.instrument({
maxAge: 10
}),
EffectsModule.forRoot(effects)
],
bootstrap: [MainAppComponent]
})

View File

@@ -1,29 +1,41 @@
import { ErrorHandler, NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { BrowserModule } from '@angular/platform-browser';
import { LogService } from 'uhk-common';
import { ElectronDataStorageRepositoryService } from './services/electron-datastorage-repository.service';
import { ElectronLogService } from './services/electron-log.service';
import { ElectronErrorHandlerService } from './services/electron-error-handler.service';
import { WebModule } from '../app/web.module';
import { routing } from '../app/app.routes';
import { MainAppComponent } from '../app/app.component';
import { IpcUhkRenderer } from './services/ipc-uhk-renderer';
import { IpcCommonRenderer } from '../app/services/ipc-common-renderer';
import { DataStorageRepositoryService } from '../app/services/datastorage-repository.service';
import { SharedModule } from '../app/shared.module';
import { reducers } from '../app/store';
import { EffectsModule } from '@ngrx/effects';
import { StoreRouterConnectingModule } from '@ngrx/router-store';
import { StoreModule } from '@ngrx/store';
import { StoreDevtoolsModule } from '@ngrx/store-devtools';
import { effects } from '../app/store/effects';
@NgModule({
imports: [
CommonModule,
WebModule,
routing
],
providers: [
{ provide: DataStorageRepositoryService, useClass: ElectronDataStorageRepositoryService },
{ provide: IpcCommonRenderer, useClass: IpcUhkRenderer },
{ provide: LogService, useClass: ElectronLogService },
{ provide: ErrorHandler, useClass: ElectronErrorHandlerService }
],
bootstrap: [MainAppComponent]
imports: [
BrowserModule,
SharedModule,
routing,
StoreModule.forRoot(reducers),
StoreRouterConnectingModule,
StoreDevtoolsModule.instrument({
maxAge: 10
}),
EffectsModule.forRoot(effects)
],
providers: [
{provide: DataStorageRepositoryService, useClass: ElectronDataStorageRepositoryService},
{provide: IpcCommonRenderer, useClass: IpcUhkRenderer},
{provide: LogService, useClass: ElectronLogService},
{provide: ErrorHandler, useClass: ElectronErrorHandlerService}
],
bootstrap: [MainAppComponent]
})
export class UhkRendererModule {
}

View File

@@ -1,14 +1,11 @@
{
"name": "agent-usb",
"version": "1.0.0",
"lockfileVersion": 1,
"requires": true,
"lockfileVersion": 1,
"dependencies": {
"@types/node": {
"version": "8.0.28",
"resolved": "https://registry.npmjs.org/@types/node/-/node-8.0.28.tgz",
"integrity": "sha512-HupkFXEv3O3KSzcr3Ylfajg0kaerBg1DyaZzRBBQfrU3NN1mTBRE7sCveqHwXLS5Yrjvww8qFzkzYQQakG9FuQ==",
"dev": true
"integrity": "sha512-HupkFXEv3O3KSzcr3Ylfajg0kaerBg1DyaZzRBBQfrU3NN1mTBRE7sCveqHwXLS5Yrjvww8qFzkzYQQakG9FuQ=="
},
"ansi-styles": {
"version": "3.2.0",

View File

@@ -11,7 +11,7 @@
"@types/node": "8.0.28"
},
"dependencies": {
"chalk": "^2.1.0",
"chalk": "2.1.0",
"node-hid": "0.5.4",
"uhk-common": "1.0.0",
"uhk-usb": "1.0.0"

View File

@@ -59,11 +59,7 @@ if (process.platform === 'darwin') {
artifactName += '.${ext}';
} else if (process.platform === 'win32') {
target = Platform.WINDOWS.createTarget();
// TODO: If all HID API test success then remove zadic extra resources
extraResources.push(`rules/zadic-ia32.exe`);
extraResources.push(`rules/zadic-x64.exe`);
artifactName += '-${arch}.${ext}';
extraResources.push(`rules/zadic-${process.arch}.exe`);
} else if (process.platform === 'linux') {
target = Platform.LINUX.createTarget();
artifactName += '.${ext}';

0
web/src/app.module.ts Normal file
View File