revert: Revert auto write user configuration (#558)
This commit is contained in:
committed by
László Monda
parent
c7baa00720
commit
a8108b9abf
@@ -90,7 +90,6 @@
|
|||||||
"server:web": "lerna exec --scope uhk-web npm start",
|
"server:web": "lerna exec --scope uhk-web npm start",
|
||||||
"server:electron": "lerna exec --scope uhk-web npm run server:renderer",
|
"server:electron": "lerna exec --scope uhk-web npm run server:renderer",
|
||||||
"electron": "lerna exec --scope uhk-agent npm start",
|
"electron": "lerna exec --scope uhk-agent npm start",
|
||||||
"electron:auto-write-config": "lerna exec --scope uhk-agent npm run auto-write-config",
|
|
||||||
"standard-version": "standard-version",
|
"standard-version": "standard-version",
|
||||||
"pack": "node ./scripts/release.js",
|
"pack": "node ./scripts/release.js",
|
||||||
"sprites": "node ./scripts/generate-svg-sprites",
|
"sprites": "node ./scripts/generate-svg-sprites",
|
||||||
|
|||||||
@@ -36,7 +36,6 @@
|
|||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "electron ./dist/electron-main.js",
|
"start": "electron ./dist/electron-main.js",
|
||||||
"auto-write-config": "electron ./dist/electron-main.js --auto-write-config",
|
|
||||||
"build": "webpack && npm run install:build-deps && npm run build:usb && npm run download-firmware && npm run copy-blhost",
|
"build": "webpack && npm run install:build-deps && npm run build:usb && npm run download-firmware && npm run copy-blhost",
|
||||||
"build:usb": "electron-rebuild -w node-hid -p -m ./dist",
|
"build:usb": "electron-rebuild -w node-hid -p -m ./dist",
|
||||||
"install:build-deps": "cd ./dist && npm i",
|
"install:build-deps": "cd ./dist && npm i",
|
||||||
|
|||||||
@@ -21,8 +21,7 @@ import * as isDev from 'electron-is-dev';
|
|||||||
import { CommandLineInputs } from './models/command-line-inputs';
|
import { CommandLineInputs } from './models/command-line-inputs';
|
||||||
|
|
||||||
const optionDefinitions = [
|
const optionDefinitions = [
|
||||||
{name: 'addons', type: Boolean},
|
{name: 'addons', type: Boolean}
|
||||||
{name: 'auto-write-config', type: Boolean}
|
|
||||||
];
|
];
|
||||||
|
|
||||||
const options: CommandLineInputs = commandLineArgs(optionDefinitions);
|
const options: CommandLineInputs = commandLineArgs(optionDefinitions);
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
export interface CommandLineInputs {
|
export interface CommandLineInputs {
|
||||||
addons?: boolean;
|
addons?: boolean;
|
||||||
'auto-write-config'?: boolean;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,8 +25,7 @@ export class AppService extends MainServiceBase {
|
|||||||
|
|
||||||
const response: AppStartInfo = {
|
const response: AppStartInfo = {
|
||||||
commandLineArgs: {
|
commandLineArgs: {
|
||||||
addons: this.options.addons || false,
|
addons: this.options.addons || false
|
||||||
autoWriteConfig: this.options['auto-write-config'] || false
|
|
||||||
},
|
},
|
||||||
deviceConnected: this.uhkHidDeviceService.deviceConnected(),
|
deviceConnected: this.uhkHidDeviceService.deviceConnected(),
|
||||||
hasPermission: this.uhkHidDeviceService.hasPermission()
|
hasPermission: this.uhkHidDeviceService.hasPermission()
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
export interface CommandLineArgs {
|
export interface CommandLineArgs {
|
||||||
addons: boolean;
|
addons: boolean;
|
||||||
autoWriteConfig: boolean;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,8 +23,8 @@ import {
|
|||||||
} from '../actions/app';
|
} from '../actions/app';
|
||||||
import { AppRendererService } from '../../services/app-renderer.service';
|
import { AppRendererService } from '../../services/app-renderer.service';
|
||||||
import { AppUpdateRendererService } from '../../services/app-update-renderer.service';
|
import { AppUpdateRendererService } from '../../services/app-update-renderer.service';
|
||||||
import { ActionTypes as DeviceActions, ConnectionStateChangedAction, SaveToKeyboardSuccessAction } from '../actions/device';
|
import { ConnectionStateChangedAction } from '../actions/device';
|
||||||
import { AppState, autoWriteUserConfiguration, runningInElectron } from '../index';
|
import { AppState, runningInElectron } from '../index';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class ApplicationEffects {
|
export class ApplicationEffects {
|
||||||
@@ -71,15 +71,6 @@ export class ApplicationEffects {
|
|||||||
.map(action => action.payload)
|
.map(action => action.payload)
|
||||||
.mergeMap((action: Action) => [action, new DismissUndoNotificationAction()]);
|
.mergeMap((action: Action) => [action, new DismissUndoNotificationAction()]);
|
||||||
|
|
||||||
@Effect({dispatch: false}) saveToKeyboardSuccess$ = this.actions$
|
|
||||||
.ofType<SaveToKeyboardSuccessAction>(DeviceActions.SAVE_TO_KEYBOARD_SUCCESS)
|
|
||||||
.withLatestFrom(this.store.select(autoWriteUserConfiguration))
|
|
||||||
.do(([action, autoWriteUserConfig]) => {
|
|
||||||
if (autoWriteUserConfig) {
|
|
||||||
this.appRendererService.exit();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
@Effect({dispatch: false}) openUrlInNewWindow$ = this.actions$
|
@Effect({dispatch: false}) openUrlInNewWindow$ = this.actions$
|
||||||
.ofType<OpenUrlInNewWindowAction>(ActionTypes.OPEN_URL_IN_NEW_WINDOW)
|
.ofType<OpenUrlInNewWindowAction>(ActionTypes.OPEN_URL_IN_NEW_WINDOW)
|
||||||
.withLatestFrom(this.store.select(runningInElectron))
|
.withLatestFrom(this.store.select(runningInElectron))
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ import {
|
|||||||
|
|
||||||
import { DataStorageRepositoryService } from '../../services/datastorage-repository.service';
|
import { DataStorageRepositoryService } from '../../services/datastorage-repository.service';
|
||||||
import { DefaultUserConfigurationService } from '../../services/default-user-configuration.service';
|
import { DefaultUserConfigurationService } from '../../services/default-user-configuration.service';
|
||||||
import { AppState, autoWriteUserConfiguration, getPrevUserConfiguration, getUserConfiguration } from '../index';
|
import { AppState, getPrevUserConfiguration, getUserConfiguration } from '../index';
|
||||||
import { KeymapAction, KeymapActions, MacroAction, MacroActions } from '../actions';
|
import { KeymapAction, KeymapActions, MacroAction, MacroActions } from '../actions';
|
||||||
import {
|
import {
|
||||||
DismissUndoNotificationAction,
|
DismissUndoNotificationAction,
|
||||||
@@ -43,7 +43,7 @@ import {
|
|||||||
ShowNotificationAction,
|
ShowNotificationAction,
|
||||||
UndoLastAction
|
UndoLastAction
|
||||||
} from '../actions/app';
|
} from '../actions/app';
|
||||||
import { SaveConfigurationAction, ShowSaveToKeyboardButtonAction } from '../actions/device';
|
import { ShowSaveToKeyboardButtonAction } from '../actions/device';
|
||||||
import { DeviceRendererService } from '../../services/device-renderer.service';
|
import { DeviceRendererService } from '../../services/device-renderer.service';
|
||||||
import { UndoUserConfigData } from '../../models/undo-user-config-data';
|
import { UndoUserConfigData } from '../../models/undo-user-config-data';
|
||||||
import { UploadFileData } from '../../models/upload-file-data';
|
import { UploadFileData } from '../../models/upload-file-data';
|
||||||
@@ -197,18 +197,6 @@ export class UserConfigEffects {
|
|||||||
saveAs(blob, 'UserConfiguration.bin');
|
saveAs(blob, 'UserConfiguration.bin');
|
||||||
});
|
});
|
||||||
|
|
||||||
@Effect() loadUserConfigurationSuccess$ = this.actions$
|
|
||||||
.ofType(ActionTypes.LOAD_USER_CONFIG_SUCCESS)
|
|
||||||
.withLatestFrom(this.store.select(autoWriteUserConfiguration))
|
|
||||||
.switchMap(([action, autoWriteUserConfig]) => {
|
|
||||||
this.logService.debug('[UserConfigEffect] LOAD_USER_CONFIG_SUCCESS', {autoWriteUserConfig});
|
|
||||||
if (autoWriteUserConfig) {
|
|
||||||
return Observable.of(new SaveConfigurationAction());
|
|
||||||
} else {
|
|
||||||
return Observable.empty();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
@Effect() loadUserConfigurationFromFile$ = this.actions$
|
@Effect() loadUserConfigurationFromFile$ = this.actions$
|
||||||
.ofType<LoadUserConfigurationFromFileAction>(ActionTypes.LOAD_USER_CONFIGURATION_FROM_FILE)
|
.ofType<LoadUserConfigurationFromFileAction>(ActionTypes.LOAD_USER_CONFIGURATION_FROM_FILE)
|
||||||
.map(action => action.payload)
|
.map(action => action.payload)
|
||||||
|
|||||||
@@ -44,7 +44,6 @@ export const getDeviceName = createSelector(getUserConfiguration, fromUserConfig
|
|||||||
export const appState = (state: AppState) => state.app;
|
export const appState = (state: AppState) => state.app;
|
||||||
|
|
||||||
export const showAddonMenu = createSelector(appState, fromApp.showAddonMenu);
|
export const showAddonMenu = createSelector(appState, fromApp.showAddonMenu);
|
||||||
export const autoWriteUserConfiguration = createSelector(appState, fromApp.autoWriteUserConfiguration);
|
|
||||||
export const getUndoableNotification = createSelector(appState, fromApp.getUndoableNotification);
|
export const getUndoableNotification = createSelector(appState, fromApp.getUndoableNotification);
|
||||||
export const getPrevUserConfiguration = createSelector(appState, fromApp.getPrevUserConfiguration);
|
export const getPrevUserConfiguration = createSelector(appState, fromApp.getPrevUserConfiguration);
|
||||||
export const runningInElectron = createSelector(appState, fromApp.runningInElectron);
|
export const runningInElectron = createSelector(appState, fromApp.runningInElectron);
|
||||||
|
|||||||
@@ -12,7 +12,6 @@ import { getVersions } from '../../util';
|
|||||||
export interface State {
|
export interface State {
|
||||||
started: boolean;
|
started: boolean;
|
||||||
showAddonMenu: boolean;
|
showAddonMenu: boolean;
|
||||||
autoWriteUserConfiguration: boolean;
|
|
||||||
undoableNotification?: Notification;
|
undoableNotification?: Notification;
|
||||||
navigationCountAfterNotification: number;
|
navigationCountAfterNotification: number;
|
||||||
prevUserConfig?: UserConfiguration;
|
prevUserConfig?: UserConfiguration;
|
||||||
@@ -25,7 +24,6 @@ export interface State {
|
|||||||
export const initialState: State = {
|
export const initialState: State = {
|
||||||
started: false,
|
started: false,
|
||||||
showAddonMenu: false,
|
showAddonMenu: false,
|
||||||
autoWriteUserConfiguration: false,
|
|
||||||
navigationCountAfterNotification: 0,
|
navigationCountAfterNotification: 0,
|
||||||
runningInElectron: runInElectron(),
|
runningInElectron: runInElectron(),
|
||||||
configLoading: true,
|
configLoading: true,
|
||||||
@@ -44,8 +42,7 @@ export function reducer(state = initialState, action: Action & { payload: any })
|
|||||||
case ActionTypes.APPLY_COMMAND_LINE_ARGS: {
|
case ActionTypes.APPLY_COMMAND_LINE_ARGS: {
|
||||||
return {
|
return {
|
||||||
...state,
|
...state,
|
||||||
showAddonMenu: action.payload.addons,
|
showAddonMenu: action.payload.addons
|
||||||
autoWriteUserConfiguration: action.payload.autoWriteConfig
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -124,7 +121,6 @@ export function reducer(state = initialState, action: Action & { payload: any })
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const showAddonMenu = (state: State) => state.showAddonMenu;
|
export const showAddonMenu = (state: State) => state.showAddonMenu;
|
||||||
export const autoWriteUserConfiguration = (state: State) => state.autoWriteUserConfiguration;
|
|
||||||
export const getUndoableNotification = (state: State) => state.undoableNotification;
|
export const getUndoableNotification = (state: State) => state.undoableNotification;
|
||||||
export const getPrevUserConfiguration = (state: State) => state.prevUserConfig;
|
export const getPrevUserConfiguration = (state: State) => state.prevUserConfig;
|
||||||
export const runningInElectron = (state: State) => state.runningInElectron;
|
export const runningInElectron = (state: State) => state.runningInElectron;
|
||||||
|
|||||||
Reference in New Issue
Block a user