Skip to content

Commit

Permalink
Added checkbox to enable/disable peer Roku device (#164)
Browse files Browse the repository at this point in the history
  • Loading branch information
lvcabral authored Nov 12, 2024
1 parent 64d64a4 commit 5c40f85
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 25 deletions.
11 changes: 8 additions & 3 deletions src/helpers/roku.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* Licensed under the MIT License. See LICENSE in the repository root for license information.
*--------------------------------------------------------------------------------------------*/
import { app, BrowserWindow, ipcMain } from "electron";
import { getPeerRoku, getSyncControl } from "./settings";
import { getPeerRoku } from "./settings";
import request from "postman-request";

let sendECPKeys = false;
Expand Down Expand Up @@ -35,6 +35,9 @@ export async function runOnPeerRoku(fileData) {
const window = BrowserWindow.fromId(1);
const device = getPeerRoku();
sendECPKeys = false;
if (!device.deploy) {
return;
}
if (isValidIP(device.ip)) {
try {
// Press home button twice to ensure we are on the home screen
Expand Down Expand Up @@ -72,7 +75,7 @@ export async function runOnPeerRoku(fileData) {
message = `Identical to previous version, starting "dev" app...`;
postEcpRequest(device, "/launch/dev");
}
sendECPKeys = getSyncControl();
sendECPKeys = device.syncControl;
}
window.webContents.send("console", message, isError);
}
Expand All @@ -84,8 +87,10 @@ export async function runOnPeerRoku(fileData) {
true
);
}
} else if (device?.ip?.length) {
} else if (device.ip?.length) {
window.webContents.send("console", `Invalid peer Roku IP address: ${device.ip}`, true);
} else {
window.webContents.send("console", `Missing peer Roku IP address!`, true);
}
}

Expand Down
24 changes: 16 additions & 8 deletions src/helpers/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -512,10 +512,21 @@ export function getSettings(window) {
label: "Peer Roku Device",
fields: [
{
label: "Device IP (default: empty)",
key: "deploy",
type: "checkbox",
options: [
{
label: "Deploy App to peer Roku device",
value: "enabled",
},
],
help: "If enabled, the simulator will side load the app on the peer Roku device in parallel",
},
{
label: "Device IP Address",
key: "ip",
type: "text",
help: "Roku IP to deploy the app in parallel with the simulator, if empty disable the feature",
help: "IP Address assigned to the peer Roku device",
},
{
label: "Installer Password (default: rokudev)",
Expand All @@ -532,7 +543,7 @@ export function getSettings(window) {
value: "enabled",
},
],
help: "If enabled, the simulator will replicate all control key strokes on the peer Roku device",
help: "If enabled, the simulator will replicate all pressed control keys on the peer Roku device",
},
],
},
Expand Down Expand Up @@ -774,17 +785,14 @@ export function setSimulatorOption(key, enable, menuId) {

export function getPeerRoku() {
return {
deploy: settings.value("peerRoku.deploy")?.includes("enabled") || false,
ip: settings.value("peerRoku.ip"),
username: "rokudev",
password: settings.value("peerRoku.password"),
syncControl: settings.value("peerRoku.syncControl")?.includes("enabled") || false,
}
}

export function getSyncControl() {
return settings.value("peerRoku.syncControl")?.includes("enabled") || false;

}

export function setLocaleId(locale) {
const window = BrowserWindow.fromId(1);
setPreference("localization.locale", locale);
Expand Down
42 changes: 28 additions & 14 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,16 @@
"@jridgewell/gen-mapping" "^0.3.5"
"@jridgewell/trace-mapping" "^0.3.24"

"@babel/code-frame@^7.0.0", "@babel/code-frame@^7.25.7":
"@babel/code-frame@^7.0.0":
version "7.26.0"
resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.26.0.tgz#9374b5cd068d128dac0b94ff482594273b1c2815"
integrity sha512-INCKxTtbXtcNbUZ3YXutwMpEleqttcswhAdee7dhuoVrD2cnuc3PqtERBtxkX5nziX9vnBL8WXmSGwv8CuPV6g==
dependencies:
"@babel/helper-validator-identifier" "^7.25.9"
js-tokens "^4.0.0"
picocolors "^1.0.0"

"@babel/code-frame@^7.25.7":
version "7.25.7"
resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.25.7.tgz#438f2c524071531d643c6f0188e1e28f130cebc7"
integrity sha512-0xZJFNE5XMpENsgfHYTw8FbX4kv53mFLn2i3XPoq69LyhYSCBJtitaHx9QnsVTrsogI4Z3+HtEfZ2/GFPOtf5g==
Expand Down Expand Up @@ -195,10 +204,10 @@
resolved "https://registry.yarnpkg.com/@babel/helper-string-parser/-/helper-string-parser-7.25.7.tgz#d50e8d37b1176207b4fe9acedec386c565a44a54"
integrity sha512-CbkjYdsJNHFk8uqpEkpCvRs3YRp9tY6FmFY7wLMSYuGYkrdUi7r2lc4/wqsvlHoMznX3WJ9IP8giGPq68T/Y6g==

"@babel/helper-validator-identifier@^7.25.7":
version "7.25.7"
resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.25.7.tgz#77b7f60c40b15c97df735b38a66ba1d7c3e93da5"
integrity sha512-AM6TzwYqGChO45oiuPqwL2t20/HdMC1rTPAesnBCgPCSF1x3oN9MVUwQV2iyz4xqWrctwK5RNC8LV22kaQCNYg==
"@babel/helper-validator-identifier@^7.25.7", "@babel/helper-validator-identifier@^7.25.9":
version "7.25.9"
resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.25.9.tgz#24b64e2c3ec7cd3b3c547729b8d16871f22cbdc7"
integrity sha512-Ed61U6XJc3CVRfkERJWDz4dJwKe7iLmmJsbOGu9wSloNSFttHV0I8g6UAgb7qnK5ly5bGLPd4oXZlxCdANBOWQ==

"@babel/helper-validator-option@^7.25.7":
version "7.25.7"
Expand All @@ -223,11 +232,11 @@
"@babel/types" "^7.25.7"

"@babel/highlight@^7.25.7":
version "7.25.7"
resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.25.7.tgz#20383b5f442aa606e7b5e3043b0b1aafe9f37de5"
integrity sha512-iYyACpW3iW8Fw+ZybQK+drQre+ns/tKpXbNESfrhNnPLIklLbXr7MYJ6gPEd0iETGLOK+SxMjVvKb/ffmk+FEw==
version "7.25.9"
resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.25.9.tgz#8141ce68fc73757946f983b343f1231f4691acc6"
integrity sha512-llL88JShoCsth8fF8R4SJnIn+WLvR6ccFxu1H3FlMhDontdcmZWf2HgIZ7AIqV3Xcck1idlohrN4EUBQz6klbw==
dependencies:
"@babel/helper-validator-identifier" "^7.25.7"
"@babel/helper-validator-identifier" "^7.25.9"
chalk "^2.4.2"
js-tokens "^4.0.0"
picocolors "^1.0.0"
Expand Down Expand Up @@ -1898,10 +1907,10 @@ browserslist@^4.21.10, browserslist@^4.23.3, browserslist@^4.24.0:
node-releases "^2.0.18"
update-browserslist-db "^1.1.0"

brs-engine@^1.7.0:
version "1.7.0"
resolved "https://registry.yarnpkg.com/brs-engine/-/brs-engine-1.7.0.tgz#19902cd9de034b63c398ce9ddc4c9ce8248b61c0"
integrity sha512-msA43ceCynejfbriDjiLxj7TsPsg3tGl5ugZZ+h7RtpQPgRubsa8KXAE8kckVmPDNSPO+JhURHNjDYhOpJ9HYw==
brs-engine@^1.7.1:
version "1.7.2"
resolved "https://registry.yarnpkg.com/brs-engine/-/brs-engine-1.7.2.tgz#d7abceb9c0fa5419210eff50f50854136261c390"
integrity sha512-KZBrdrZcTGXpU+pM4jLXjyIW/BfQAM69bD2+qvJJoVudI8RpLdkZG1s9+TF+jZAYEPPqxJuBXB15mnxdkJTHBg==
dependencies:
"@msgpack/msgpack" "^2.8.0"
canvas "^2.11.2"
Expand Down Expand Up @@ -5248,7 +5257,12 @@ performance-now@^2.1.0:
resolved "https://registry.yarnpkg.com/performance-now/-/performance-now-2.1.0.tgz#6309f4e0e5fa913ec1c69307ae364b4b377c9e7b"
integrity sha512-7EAHlyLHI56VEIdK57uwHdHKIaAGbnXPiw0yWbarQZOKaKpvUIgW0jWRVLiatnM+XXlSwsanIBH/hzGMJulMow==

picocolors@^1.0.0, picocolors@^1.1.0:
picocolors@^1.0.0:
version "1.1.1"
resolved "https://registry.yarnpkg.com/picocolors/-/picocolors-1.1.1.tgz#3d321af3eab939b083c8f929a1d12cda81c26b6b"
integrity sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==

picocolors@^1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/picocolors/-/picocolors-1.1.0.tgz#5358b76a78cde483ba5cef6a9dc9671440b27d59"
integrity sha512-TQ92mBOW0l3LeMeyLV6mzy/kWr8lkd/hp3mTg7wYK7zJhuBStmGMBG0BdeDZS/dZx1IukaX6Bk11zcln25o1Aw==
Expand Down

0 comments on commit 5c40f85

Please sign in to comment.