Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update dependency @elgato/streamdeck to v1 #267

Merged
merged 4 commits into from
Oct 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 19 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"typescript-eslint": "^8.0.0"
},
"dependencies": {
"@elgato/streamdeck": "^0.3.0",
"@elgato/streamdeck": "^1.0.0",
"axios": "^1.7.2",
"chokidar": "^4.0.0",
"debounce": "^2.1.0",
Expand Down
14 changes: 14 additions & 0 deletions src/actions/atisLetter.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import {
action,
DidReceiveSettingsEvent,
JsonValue,
KeyUpEvent,
SingletonAction,
WillAppearEvent,
Expand All @@ -20,6 +21,12 @@ export class AtisLetter extends SingletonAction<AtisLetterSettings> {
// instance for use elsewhere in the code. The default title is also set
// to something useful.
onWillAppear(ev: WillAppearEvent<AtisLetterSettings>): void | Promise<void> {
// This should never happen. Typeguard to ensure the rest of the code can just use
// KeyAction.
if (!ev.action.isKey()) {
return;
}

actionManager.addAtisLetter(ev.action, ev.payload.settings);
}

Expand All @@ -35,6 +42,12 @@ export class AtisLetter extends SingletonAction<AtisLetterSettings> {
onDidReceiveSettings(
ev: DidReceiveSettingsEvent<AtisLetterSettings>
): void | Promise<void> {
// This should never happen. Typeguard to ensure the rest of the code can just use
// KeyAction.
if (!ev.action.isKey()) {
return;
}

actionManager.updateAtisLetter(ev.action, ev.payload.settings);
}

Expand Down Expand Up @@ -62,4 +75,5 @@ export interface AtisLetterSettings {
title?: string;
unavailableImagePath?: string;
updatedImagePath?: string;
[key: string]: JsonValue;
}
14 changes: 14 additions & 0 deletions src/actions/hotline.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import {
action,
DidReceiveSettingsEvent,
JsonValue,
KeyUpEvent,
SingletonAction,
WillAppearEvent,
Expand All @@ -20,6 +21,12 @@ export class Hotline extends SingletonAction<HotlineSettings> {
// instance for use elsewhere in the code. The default title is also set
// to something useful.
onWillAppear(ev: WillAppearEvent<HotlineSettings>): void | Promise<void> {
// This should never happen. Typeguard to ensure the rest of the code can just use
// KeyAction.
if (!ev.action.isKey()) {
return;
}

actionManager.addHotline(ev.action, ev.payload.settings);
}

Expand All @@ -35,6 +42,12 @@ export class Hotline extends SingletonAction<HotlineSettings> {
onDidReceiveSettings(
ev: DidReceiveSettingsEvent<HotlineSettings>
): void | Promise<void> {
// This should never happen. Typeguard to ensure the rest of the code can just use
// KeyAction.
if (!ev.action.isKey()) {
return;
}

actionManager.updateHotline(ev.action, ev.payload.settings);
}

Expand Down Expand Up @@ -66,4 +79,5 @@ export interface HotlineSettings {
showTitle?: boolean;
showHotlineCallsign?: boolean;
showPrimaryCallsign?: boolean;
[key: string]: JsonValue;
}
14 changes: 14 additions & 0 deletions src/actions/pushToTalk.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import {
action,
DidReceiveSettingsEvent,
JsonValue,
SingletonAction,
WillAppearEvent,
WillDisappearEvent,
Expand All @@ -17,6 +18,12 @@ export class PushToTalk extends SingletonAction<PushToTalkSettings> {
// instance for use elsewhere in the code. The default title is also set
// to something useful.
onWillAppear(ev: WillAppearEvent<PushToTalkSettings>): void | Promise<void> {
// This should never happen. Typeguard to ensure the rest of the code can just use
// KeyAction.
if (!ev.action.isKey()) {
return;
}

actionManager.addPushToTalk(ev.action, ev.payload.settings);
}

Expand All @@ -40,6 +47,12 @@ export class PushToTalk extends SingletonAction<PushToTalkSettings> {
onDidReceiveSettings(
ev: DidReceiveSettingsEvent<PushToTalkSettings>
): void | Promise<void> {
// This should never happen. Typeguard to ensure the rest of the code can just use
// KeyAction.
if (!ev.action.isKey()) {
return;
}

actionManager.updatePushToTalk(ev.action, ev.payload.settings);
}
}
Expand All @@ -50,4 +63,5 @@ export interface PushToTalkSettings {
notTransmittingImagePath?: string;
transmittingImagePath?: string;
showTitle?: boolean;
[key: string]: JsonValue;
}
14 changes: 14 additions & 0 deletions src/actions/stationStatus.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { ListenTo } from "@controllers/stationStatus";
import {
action,
DidReceiveSettingsEvent,
JsonValue,
KeyUpEvent,
SingletonAction,
WillAppearEvent,
Expand All @@ -21,6 +22,12 @@ export class StationStatus extends SingletonAction<StationSettings> {
// instance for use elsewhere in the code. The default title is also set
// to something useful.
onWillAppear(ev: WillAppearEvent<StationSettings>): void | Promise<void> {
// This should never happen. Typeguard to ensure the rest of the code can just use
// KeyAction.
if (!ev.action.isKey()) {
return;
}

actionManager.addStation(ev.action, ev.payload.settings);
}

Expand All @@ -36,6 +43,12 @@ export class StationStatus extends SingletonAction<StationSettings> {
onDidReceiveSettings(
ev: DidReceiveSettingsEvent<StationSettings>
): void | Promise<void> {
// This should never happen. Typeguard to ensure the rest of the code can just use
// KeyAction.
if (!ev.action.isKey()) {
return;
}

actionManager.updateStation(ev.action, ev.payload.settings);
}

Expand Down Expand Up @@ -69,4 +82,5 @@ export interface StationSettings {
showTitle?: boolean;
title?: string;
unavailableImagePath?: string;
[key: string]: JsonValue;
}
14 changes: 14 additions & 0 deletions src/actions/trackAudioStatus.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import {
action,
DidReceiveSettingsEvent,
JsonValue,
KeyUpEvent,
SingletonAction,
WillAppearEvent,
Expand All @@ -21,6 +22,12 @@ export class TrackAudioStatus extends SingletonAction<TrackAudioStatusSettings>
onWillAppear(
ev: WillAppearEvent<TrackAudioStatusSettings>
): void | Promise<void> {
// This should never happen. Typeguard to ensure the rest of the code can just use
// KeyAction.
if (!ev.action.isKey()) {
return;
}

actionManager.addTrackAudio(ev.action, ev.payload.settings);
}

Expand All @@ -34,6 +41,12 @@ export class TrackAudioStatus extends SingletonAction<TrackAudioStatusSettings>
onDidReceiveSettings(
ev: DidReceiveSettingsEvent<TrackAudioStatusSettings>
): Promise<void> | void {
// This should never happen. Typeguard to ensure the rest of the code can just use
// KeyAction.
if (!ev.action.isKey()) {
return;
}

actionManager.updateTrackAudioStatus(ev.action, ev.payload.settings);
}

Expand All @@ -57,4 +70,5 @@ export interface TrackAudioStatusSettings {
connectedImagePath?: string;
voiceConnectedImagePath?: string;
showTitle?: boolean;
[key: string]: JsonValue;
}
4 changes: 2 additions & 2 deletions src/controllers/atisLetter.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { AtisLetterSettings } from "@actions/atisLetter";
import { Action } from "@elgato/streamdeck";
import { KeyAction } from "@elgato/streamdeck";
import { Controller } from "@interfaces/controller";
import TitleBuilder from "@root/utils/titleBuilder";
import { BaseController } from "./baseController";
Expand Down Expand Up @@ -37,7 +37,7 @@ export class AtisLetterController extends BaseController {
* @param action The callsign for the action
* @param settings: The options for the action
*/
constructor(action: Action, settings: AtisLetterSettings) {
constructor(action: KeyAction, settings: AtisLetterSettings) {
super(action);
this.settings = settings;
}
Expand Down
7 changes: 3 additions & 4 deletions src/controllers/baseController.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Action } from "@elgato/streamdeck";
import { KeyAction } from "@elgato/streamdeck";
import { Controller } from "@interfaces/controller";
import svgManager from "@managers/svg";
import { handleAsyncException } from "@root/utils/handleAsyncException";
Expand All @@ -16,13 +16,13 @@ export abstract class BaseController implements Controller {
/**
* The StreamDeck action this controller manages.
*/
action: Action;
action: KeyAction;

/**
* Initializes the BaseController.
* @param action The StreamDeck icon this wraps
*/
constructor(action: Action) {
constructor(action: KeyAction) {
this.action = action;
}

Expand Down Expand Up @@ -61,7 +61,6 @@ export abstract class BaseController implements Controller {
*/
setImage(imagePath: string, replacements: object) {
const generatedSvg = svgManager.renderSvg(imagePath, replacements);

if (generatedSvg) {
this.action.setImage(generatedSvg).catch((error: unknown) => {
handleAsyncException("Unable to set state image: ", error);
Expand Down
4 changes: 2 additions & 2 deletions src/controllers/hotline.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { HotlineSettings } from "@actions/hotline";
import { Action } from "@elgato/streamdeck";
import { KeyAction } from "@elgato/streamdeck";
import { Controller } from "@interfaces/controller";
import { BaseController } from "./baseController";
import { stringOrUndefined } from "@root/utils/utils";
Expand Down Expand Up @@ -46,7 +46,7 @@ export class HotlineController extends BaseController {
* @param action The callsign for the action
* @param settings: The options for the action
*/
constructor(action: Action, settings: HotlineSettings) {
constructor(action: KeyAction, settings: HotlineSettings) {
super(action);
this.settings = settings;
}
Expand Down
4 changes: 2 additions & 2 deletions src/controllers/pushToTalk.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Action } from "@elgato/streamdeck";
import { KeyAction } from "@elgato/streamdeck";
import { Controller } from "@interfaces/controller";
import { BaseController } from "./baseController";
import { PushToTalkSettings } from "@actions/pushToTalk";
Expand Down Expand Up @@ -29,7 +29,7 @@ export class PushToTalkController extends BaseController {
* Creates a new PushToTalkController object.
* @param action The callsign for the action
*/
constructor(action: Action, settings: PushToTalkSettings) {
constructor(action: KeyAction, settings: PushToTalkSettings) {
super(action);
this.settings = settings;
}
Expand Down
4 changes: 2 additions & 2 deletions src/controllers/stationStatus.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { StationSettings } from "@actions/stationStatus";
import { Action } from "@elgato/streamdeck";
import { KeyAction } from "@elgato/streamdeck";
import { Controller } from "@interfaces/controller";
import TitleBuilder from "@root/utils/titleBuilder";
import { stringOrUndefined } from "@root/utils/utils";
Expand Down Expand Up @@ -53,7 +53,7 @@ export class StationStatusController extends BaseController {
* @param action The callsign for the action
* @param settings: The options for the action
*/
constructor(action: Action, settings: StationSettings) {
constructor(action: KeyAction, settings: StationSettings) {
super(action);

this.action = action;
Expand Down
4 changes: 2 additions & 2 deletions src/controllers/trackAudioStatus.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { TrackAudioStatusSettings } from "@actions/trackAudioStatus";
import { Action } from "@elgato/streamdeck";
import { KeyAction } from "@elgato/streamdeck";
import { Controller } from "@interfaces/controller";
import { BaseController } from "./baseController";
import TitleBuilder from "@root/utils/titleBuilder";
Expand Down Expand Up @@ -32,7 +32,7 @@ export class TrackAudioStatusController extends BaseController {
* Creates a new TrackAudioStatusController.
* @param action The StreamDeck action object
*/
constructor(action: Action, settings: TrackAudioStatusSettings) {
constructor(action: KeyAction, settings: TrackAudioStatusSettings) {
super(action);
this.settings = settings;
}
Expand Down
4 changes: 2 additions & 2 deletions src/interfaces/controller.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { Action } from "@elgato/streamdeck";
import { KeyAction } from "@elgato/streamdeck";

/**
* Interface for all actions supported by this plugin
*/
export interface Controller {
type: string;
action: Action;
action: KeyAction;
reset(): void;
refreshImage(): void;
refreshTitle(): void;
Expand Down
Loading