From b4d09b5005ca8341900838a6bf78ad2eb3712ae8 Mon Sep 17 00:00:00 2001 From: georgejecook Date: Mon, 14 Aug 2023 20:05:51 +0200 Subject: [PATCH] chore: minor fixes --- .vscode/launch.json | 3 ++ scripts/maestro-ropm-hook.js | 32 +++++++++++++++++++ .../AdvancedAnimationExampleScreen.bs | 4 +-- .../source/debug-screens/TextInputScreen.bs | 1 + .../debug-screens/list/DisneyHeroScreen.bs | 4 +-- 5 files changed, 40 insertions(+), 4 deletions(-) create mode 100644 scripts/maestro-ropm-hook.js diff --git a/.vscode/launch.json b/.vscode/launch.json index 08067cba..fccee37f 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -10,6 +10,7 @@ "name": "Test", "stopOnEntry": false, "preLaunchTask": "build-test", + "rendezvousTracking": false, "envFile": "${workspaceFolder}/.vscode/.env", "host": "${env:ROKU_DEV_TARGET}", "password": "${env:ROKU_DEVPASSWORD}", @@ -29,6 +30,7 @@ "request": "launch", "name": "Sample App", "preLaunchTask": "sample-app", + "rendezvousTracking": false, "internalConsoleOptions": "neverOpen", "envFile": "${workspaceFolder}/.vscode/.env", "host": "${env:ROKU_DEV_TARGET}", @@ -49,6 +51,7 @@ "name": "OPEN TEST FILES", "stopOnEntry": false, "preLaunchTask": "build-tdd", + "rendezvousTracking": false, "enableDebugProtocol": true, "envFile": "${workspaceFolder}/.vscode/.env", "host": "${env:ROKU_DEV_TARGET}", diff --git a/scripts/maestro-ropm-hook.js b/scripts/maestro-ropm-hook.js new file mode 100644 index 00000000..e8c88cf2 --- /dev/null +++ b/scripts/maestro-ropm-hook.js @@ -0,0 +1,32 @@ +/* eslint-disable github/array-foreach */ +/* eslint-disable @typescript-eslint/no-var-requires */ +/* eslint-disable @typescript-eslint/no-require-imports */ +const fs = require('fs-extra'); +const path = require('path'); + +function fixPackagePath(sourceDir) { + try { + // eslint-disable-next-line @typescript-eslint/no-unsafe-argument + fs.readdirSync(sourceDir).forEach((file) => { + // eslint-disable-next-line @typescript-eslint/no-unsafe-argument + const filePath = path.join(sourceDir, file); + if (fs.statSync(filePath).isDirectory()) { + fixPackagePath(filePath); + } else if (filePath.endsWith('.xml') || filePath.endsWith('.brs') || filePath.endsWith('.d.bs')) { + let text = fs.readFileSync(filePath, 'utf8'); + let r = /\/roku_modules\/undefined\/bslib/gim; + text = text.replace( + r, + '/roku_modules/rokucommunity_bslib/bslib' + ); + r = /\/roku_modules\/undefined/gim; + text = text.replace(r, '/roku_modules/maestro'); + + fs.writeFileSync(filePath, text); + } + }); + } catch (e) { } +} + +let sourceDir = path.join(__dirname, '..', 'src', 'components', 'roku_modules'); +fixPackagePath(sourceDir); diff --git a/src-ml-test-app/source/debug-screens/AdvancedAnimationExampleScreen.bs b/src-ml-test-app/source/debug-screens/AdvancedAnimationExampleScreen.bs index 905af238..111f748a 100644 --- a/src-ml-test-app/source/debug-screens/AdvancedAnimationExampleScreen.bs +++ b/src-ml-test-app/source/debug-screens/AdvancedAnimationExampleScreen.bs @@ -36,7 +36,7 @@ class AdvancedAnimationExampleScreen extends mv.BaseScreen blendColor: "#0000aa" opacity: 0 size: [60, 60] - uri: "pkg:/images/button-circle.png" + uri: "pkg:/images/backgrounds/button-circle.png" }, { id: "labelBackground" @@ -66,7 +66,7 @@ class AdvancedAnimationExampleScreen extends mv.BaseScreen translation: [340, 0] blendColor: "#0000aa" size: [60, 60] - uri: "pkg:/images/button-circle.png" + uri: "pkg:/images/backgrounds/button-circle.png" }, ] } diff --git a/src-ml-test-app/source/debug-screens/TextInputScreen.bs b/src-ml-test-app/source/debug-screens/TextInputScreen.bs index 8fda625b..da4154d7 100644 --- a/src-ml-test-app/source/debug-screens/TextInputScreen.bs +++ b/src-ml-test-app/source/debug-screens/TextInputScreen.bs @@ -7,6 +7,7 @@ import "pkg:/source/view/KeyboardDialogUtils.bs" @node("TextInputScreen", "mv_BaseScreen") class TextInputScreen extends mv.BaseScreen + '+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ '++ Views '+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ diff --git a/src-ml-test-app/source/debug-screens/list/DisneyHeroScreen.bs b/src-ml-test-app/source/debug-screens/list/DisneyHeroScreen.bs index fe2f0363..8353c189 100644 --- a/src-ml-test-app/source/debug-screens/list/DisneyHeroScreen.bs +++ b/src-ml-test-app/source/debug-screens/list/DisneyHeroScreen.bs @@ -51,7 +51,7 @@ class DisneyHeroScreen extends mv.BaseScreen }) mioc.setInstance("list", m.list) m.loadingIndicator = m.createSGNode("LoadingIndicator", m.top, "loadingIndicator", { - isActive: true + isActive: false width: 1920 height: 1080 backgroundVisible: false @@ -79,7 +79,7 @@ class DisneyHeroScreen extends mv.BaseScreen timer.log("makeData") m.setFocus(m.loadingIndicator) content@.appendChildren(items) - m.list.content = content + m.list@.setContent(content) timer.log("set content") if m.list.state = "rendered" m.onListRenderState("rendered")