Skip to content

Commit

Permalink
style: fix tslint issues on staging2
Browse files Browse the repository at this point in the history
  • Loading branch information
blackxored committed Nov 29, 2018
1 parent 128be48 commit 5e752d7
Show file tree
Hide file tree
Showing 7 changed files with 86 additions and 79 deletions.
20 changes: 9 additions & 11 deletions app/components/widgets/SpinWheel.vue.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
import { Component, Prop, Watch } from 'vue-property-decorator';
import {
SpinWheelService,
ISpinWheelData
} from 'services/widgets/settings/spin-wheel';
import { SpinWheelService, ISpinWheelData } from 'services/widgets/settings/spin-wheel';

import WidgetEditor from 'components/windows/WidgetEditor.vue';
import WidgetSettings from './WidgetSettings.vue';
Expand All @@ -18,11 +15,10 @@ import ValidatedForm from 'components/shared/inputs/ValidatedForm.vue';
WidgetEditor,
VFormGroup,
ValidatedForm,
...inputComponents
}
...inputComponents,
},
})
export default class SpinWheel extends WidgetSettings<ISpinWheelData, SpinWheelService> {

get metadata() {
return this.service.getMetadata(this.sectionOptions);
}
Expand All @@ -35,7 +31,7 @@ export default class SpinWheel extends WidgetSettings<ISpinWheelData, SpinWheelS
{ value: 'border', label: $t('Border') },
{ value: 'ticker', label: $t('Ticker') },
{ value: 'image', label: $t('Center Image') },
{ value: 'source', label: $t('Source') }
{ value: 'source', label: $t('Source') },
];

clearCategories() {
Expand All @@ -49,7 +45,9 @@ export default class SpinWheel extends WidgetSettings<ISpinWheelData, SpinWheelS
}

removeCategory(prize: string) {
this.wData.settings.categories = this.wData.settings.categories.filter((cat) => cat.prize !== prize);
this.wData.settings.categories = this.wData.settings.categories.filter(
cat => cat.prize !== prize,
);
this.save();
}

Expand All @@ -58,13 +56,13 @@ export default class SpinWheel extends WidgetSettings<ISpinWheelData, SpinWheelS
}

removeSection(key: string) {
this.wData.settings.sections = this.wData.settings.sections.filter((sect) => sect.key !== key);
this.wData.settings.sections = this.wData.settings.sections.filter(sect => sect.key !== key);
this.save();
}

moveSection(key: string, idxMod: number) {
const sections = this.wData.settings.sections;
const idx = sections.findIndex((sect) => sect.key === key);
const idx = sections.findIndex(sect => sect.key === key);
[sections[idx], sections[idx + idxMod]] = [sections[idx + idxMod], sections[idx]];
this.save();
}
Expand Down
13 changes: 4 additions & 9 deletions app/components/widgets/inputs/NumberListInput.vue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,15 @@ import { Multiselect } from 'vue-multiselect';
import { IListMetadata, IListOption } from 'components/shared/inputs/index';
import { BaseInput } from 'components/shared/inputs/BaseInput';

interface IMultiselectListOption{
interface IMultiselectListOption {
description: string;
value: number;
}

@Component({
components: { Multiselect }
components: { Multiselect },
})

export default class ListInput extends BaseInput<number, IListMetadata<number>> {

@Prop()
readonly value: number;

Expand All @@ -26,7 +24,6 @@ export default class ListInput extends BaseInput<number, IListMetadata<number>>
@Prop({ default: 'Select Option' })
readonly placeholder: string;


onInputHandler(option: IMultiselectListOption) {
if (option) {
this.emitInput(option.value);
Expand All @@ -38,8 +35,8 @@ export default class ListInput extends BaseInput<number, IListMetadata<number>>
const options = super.getOptions();
return {
...options,
allowEmpty: !!options.allowEmpty // undefined value is not working for vue-multiselect
}
allowEmpty: !!options.allowEmpty, // undefined value is not working for vue-multiselect
};
}

get currentMultiselectValue() {
Expand All @@ -53,7 +50,6 @@ export default class ListInput extends BaseInput<number, IListMetadata<number>>
return options[0];
}


get multiselectOptions(): IMultiselectListOption[] {
return this.options.options.map(item => {
return { value: item.value, description: item.title };
Expand All @@ -63,5 +59,4 @@ export default class ListInput extends BaseInput<number, IListMetadata<number>>
get selectedOption(): IListOption<number> {
return this.options.options.find(option => option.value === this.value);
}

}
44 changes: 23 additions & 21 deletions app/services/hardware/hardware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import uuid from 'uuid/v4';
export enum EDeviceType {
audioInput = 'audioInput',
audioOutput = 'audioOutput',
videoInput = 'videoInput'
videoInput = 'videoInput',
}

export interface IDevice {
Expand All @@ -20,10 +20,9 @@ export interface IHardwareServiceState {
}

export class HardwareService extends StatefulService<IHardwareServiceState> {

static initialState: IHardwareServiceState = {
devices: [],
dshowDevices: []
dshowDevices: [],
};

init() {
Expand Down Expand Up @@ -53,47 +52,50 @@ export class HardwareService extends StatefulService<IHardwareServiceState> {
const obsAudioOutput = obs.InputFactory.create('wasapi_output_capture', uuid());
const obsVideoInput = obs.InputFactory.create('dshow_input', uuid());

(obsAudioInput.properties.get('device_id') as obs.IListProperty).details.items
.forEach((item: { name: string, value: string}) => {
(obsAudioInput.properties.get('device_id') as obs.IListProperty).details.items.forEach(
(item: { name: string; value: string }) => {
devices.push({
id: item.value,
description: item.name,
type: EDeviceType.audioInput
type: EDeviceType.audioInput,
});
});
},
);

(obsAudioOutput.properties.get('device_id') as obs.IListProperty).details.items
.forEach((item: { name: string, value: string}) => {
(obsAudioOutput.properties.get('device_id') as obs.IListProperty).details.items.forEach(
(item: { name: string; value: string }) => {
devices.push({
id: item.value,
description: item.name,
type: EDeviceType.audioOutput
type: EDeviceType.audioOutput,
});
});
},
);

(obsVideoInput.properties.get('video_device_id') as obs.IListProperty).details.items
.forEach((item: { name: string, value: string}) => {
(obsVideoInput.properties.get('video_device_id') as obs.IListProperty).details.items.forEach(
(item: { name: string; value: string }) => {
dshowDevices.push({
id: item.value,
description: item.name,
type: EDeviceType.videoInput
type: EDeviceType.videoInput,
});
});

},
);

(obsVideoInput.properties.get('audio_device_id') as obs.IListProperty).details.items
.forEach((item: { name: string, value: string}) => {
(obsVideoInput.properties.get('audio_device_id') as obs.IListProperty).details.items.forEach(
(item: { name: string; value: string }) => {
dshowDevices.push({
id: item.value,
description: item.name,
type: EDeviceType.audioInput
type: EDeviceType.audioInput,
});
});
},
);

obsAudioInput.release();
obsAudioOutput.release();
obsVideoInput.release();
return { devices, dshowDevices};
return { devices, dshowDevices };
}

@mutation()
Expand Down
29 changes: 13 additions & 16 deletions app/services/prefabs/prefabs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
Source,
SourcesService,
TPropertiesManager,
TSourceType
TSourceType,
} from 'services/sources';
import { ScenesService, TSceneNode, TSceneNodeType } from 'services/scenes';
import { Inject } from '../../util/injector';
Expand All @@ -16,18 +16,17 @@ import Utils from '../utils';
import Vue from 'vue';

interface IPrefabSourceCreateOptions {
name: string,
description?: string,
type: TSourceType,
settings: Dictionary<TObsValue>,
createOptions: ISourceCreateOptions,
name: string;
description?: string;
type: TSourceType;
settings: Dictionary<TObsValue>;
createOptions: ISourceCreateOptions;
}

interface IPrefabSource extends IPrefabSourceCreateOptions {
id: string;
}


interface IPrefab {
id: string;
name: string;
Expand All @@ -49,10 +48,9 @@ interface IPrefabAddToSceneOptions {
* Allows to add pre-configured items to scene
*/
export class PrefabsService extends PersistentStatefulService<IPrefabsServiceState> {

static defaultState: IPrefabsServiceState = {
version: 1,
prefabs: {}
prefabs: {},
};

@Inject() private sourcesService: SourcesService;
Expand All @@ -67,8 +65,8 @@ export class PrefabsService extends PersistentStatefulService<IPrefabsServiceSta
settings: source.getSettings(),
createOptions: {
propertiesManager: source.getPropertiesManagerType(),
propertiesManagerSettings: source.getPropertiesManagerSettings()
}
propertiesManagerSettings: source.getPropertiesManagerSettings(),
},
});
}

Expand All @@ -85,9 +83,9 @@ export class PrefabsService extends PersistentStatefulService<IPrefabsServiceSta
sources: {
[id]: {
...prefabSourceModel,
id
}
}
id,
},
},
};
this.REGISTER_PREFAB(prefabModel);
return this.getPrefab(id);
Expand Down Expand Up @@ -135,7 +133,6 @@ export class PrefabsService extends PersistentStatefulService<IPrefabsServiceSta
}
}


@ServiceHelper()
export class Prefab implements IPrefab {
readonly id: string;
Expand Down Expand Up @@ -164,7 +161,7 @@ export class Prefab implements IPrefab {
options.name || prefabSourceModel.name,
prefabSourceModel.type,
prefabSourceModel.settings,
prefabSourceModel.createOptions
prefabSourceModel.createOptions,
);
return scene.addSource(source.sourceId);
}
Expand Down
17 changes: 12 additions & 5 deletions app/services/sources/sources.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@ import * as fs from 'fs';
import Vue from 'vue';
import { Subject } from 'rxjs/Subject';
import { cloneDeep } from 'lodash';
import { IObsListOption, setupConfigurableDefaults, TObsValue } from 'components/obs/inputs/ObsInput';
import {
IObsListOption,
setupConfigurableDefaults,
TObsValue,
} from 'components/obs/inputs/ObsInput';
import { StatefulService, mutation } from 'services/stateful-service';
import * as obs from '../../../obs-api';
import electron from 'electron';
Expand Down Expand Up @@ -266,7 +270,9 @@ export class SourcesService extends StatefulService<ISourcesState> implements IS
// setup default settings
if (type === 'browser_source') {
if (resolvedSettings.shutdown === void 0) resolvedSettings.shutdown = true;
if (resolvedSettings.url === void 0) resolvedSettings.url = 'https://streamlabs.com/browser-source';
if (resolvedSettings.url === void 0) {
resolvedSettings.url = 'https://streamlabs.com/browser-source';
}
}

if (type === 'text_gdiplus') {
Expand All @@ -279,9 +285,10 @@ export class SourcesService extends StatefulService<ISourcesState> implements IS
// resolve the device id by the device name here
if (!['device_id', 'video_device_id', 'audio_device_id'].includes(propName)) return;

const device = type === 'dshow_input' ?
this.hardwareService.getDshowDeviceByName(settings[propName]) :
this.hardwareService.getDeviceByName(settings[propName]);
const device =
type === 'dshow_input'
? this.hardwareService.getDshowDeviceByName(settings[propName])
: this.hardwareService.getDeviceByName(settings[propName]);

if (!device) return;
resolvedSettings[propName] = device.id;
Expand Down
Loading

0 comments on commit 5e752d7

Please sign in to comment.