From 8104aea157767b6ba997f3500e68f9f18f034a08 Mon Sep 17 00:00:00 2001 From: Mihai Blaga Date: Fri, 8 Mar 2024 16:46:22 +0100 Subject: [PATCH 1/3] fix styling for tv --- packages/app-harness/src/app/index.tsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/app-harness/src/app/index.tsx b/packages/app-harness/src/app/index.tsx index dc8019169f..342809e275 100644 --- a/packages/app-harness/src/app/index.tsx +++ b/packages/app-harness/src/app/index.tsx @@ -1,5 +1,5 @@ import React, { useEffect, useState } from 'react'; -import { Button, Image, ScrollView, Text, View } from 'react-native'; +import { Button, Image, ScrollView, Text, View, Dimensions } from 'react-native'; import { OrientationLocker, PORTRAIT, LANDSCAPE } from '../components/OrientationLocker'; import { NewModuleButton } from '../components/NewModuleButton'; import { SplashScreen } from '../components/SplashScreen'; @@ -20,8 +20,10 @@ const App = () => { }; }, []); + const { height } = Dimensions.get('window'); + return ( - + Date: Fri, 8 Mar 2024 22:09:54 +0100 Subject: [PATCH 2/3] move requiredfiles logic, fixed ui on tv --- packages/app-harness/src/app/index.tsx | 6 ++-- packages/app-harness/src/styles/index.ts | 9 ++++- packages/sdk-tizen/src/deviceManager.ts | 34 +++++------------- packages/sdk-tizen/src/runner.ts | 46 +++++++++++------------- packages/sdk-webos/src/runner.ts | 7 ++-- 5 files changed, 43 insertions(+), 59 deletions(-) diff --git a/packages/app-harness/src/app/index.tsx b/packages/app-harness/src/app/index.tsx index 342809e275..b6ed356f5e 100644 --- a/packages/app-harness/src/app/index.tsx +++ b/packages/app-harness/src/app/index.tsx @@ -1,5 +1,5 @@ import React, { useEffect, useState } from 'react'; -import { Button, Image, ScrollView, Text, View, Dimensions } from 'react-native'; +import { Button, Image, ScrollView, Text, View } from 'react-native'; import { OrientationLocker, PORTRAIT, LANDSCAPE } from '../components/OrientationLocker'; import { NewModuleButton } from '../components/NewModuleButton'; import { SplashScreen } from '../components/SplashScreen'; @@ -20,10 +20,8 @@ const App = () => { }; }, []); - const { height } = Dimensions.get('window'); - return ( - + >) // } // }; -export const runTizenSimOrDevice = async ( - c: RnvContext, - buildCoreWebpackProject?: (c: RnvContext) => Promise -) => { - const { hosted } = c.program; - const { target, engine } = c.runtime; +export const runTizenSimOrDevice = async (c: RnvContext) => { + const { target } = c.runtime; const { platform } = c; if (!platform) return; - // const platformConfig = c.buildConfig.platforms?.[platform]; - const bundleAssets = getConfigProp(c, platform, 'bundleAssets'); - const isHosted = hosted ?? !bundleAssets; - const isLightningEngine = engine?.config.id === 'engine-lightning'; - if (!bundleAssets && !hosted) { - // console.log('RUN WEINRE'); - } - - // if (!platformConfig) { - // throw new Error( - // `runTizen: ${chalk().grey(platform)} not defined in your ${chalk().bold(c.paths.appConfig.config)}` - // ); - // } - const appName = getConfigProp(c, platform, 'appName'); if (!appName) { @@ -323,6 +308,7 @@ export const runTizenSimOrDevice = async ( const tDir = getPlatformProjectDir(c)!; const tBuild = path.join(tDir, 'build'); + const intermediate = path.join(tDir, 'intermediate'); const tOut = path.join(tDir, 'output'); const tId = getConfigProp(c, platform, 'id'); const certProfile = getConfigProp(c, platform, 'certificateProfile') || DEFAULTS.certificateProfile; @@ -375,12 +361,8 @@ Please create one and then edit the default target from ${c.paths.workspace.dir} const continueLaunching = async () => { let hasDevice = false; - if (!isLightningEngine && buildCoreWebpackProject) { - // lightning engine handles the build and packaging - !isHosted && (await buildCoreWebpackProject(c)); - await execCLI(c, CLI_TIZEN, `build-web -- ${tDir} -out ${tBuild}`); - await execCLI(c, CLI_TIZEN, `package -- ${tBuild} -s ${certProfile} -t wgt -o ${tOut}`); - } + await execCLI(c, CLI_TIZEN, `build-web -- ${tBuild} -out ${intermediate}`); + await execCLI(c, CLI_TIZEN, `package -- ${intermediate} -s ${certProfile} -t wgt -o ${tOut}`); try { const packageID = platform === 'tizenwatch' || platform === 'tizenmobile' ? tId.split('.')[0] : tId; diff --git a/packages/sdk-tizen/src/runner.ts b/packages/sdk-tizen/src/runner.ts index 2ad5f1e277..2c1bc0da60 100644 --- a/packages/sdk-tizen/src/runner.ts +++ b/packages/sdk-tizen/src/runner.ts @@ -94,14 +94,16 @@ export const configureTizenGlobal = (c: RnvContext) => // } }); -const _runTizenSimOrDevice = async (c: RnvContext) => { - try { - await runTizenSimOrDevice(c, buildCoreWebpackProject); - } catch (e) { - // TODO: Capture different errors and react accordingly - return Promise.reject(e); - } - return true; +const _copyRequiredFiles = (c: RnvContext) => { + const tDir = getPlatformProjectDir(c)!; + const tBuild = path.join(tDir, 'build'); + + const requiredFiles = ['.project', '.tproject', 'config.xml', 'icon.png']; + + requiredFiles.map((requiredFile) => { + const requiredFilePath = path.join(tDir, requiredFile); + copyFileSync(requiredFilePath, path.join(tBuild, requiredFile)); + }); }; export const runTizen = async (c: RnvContext, target?: string) => { @@ -111,7 +113,8 @@ export const runTizen = async (c: RnvContext, target?: string) => { if (!platform) return; - const isHosted = hosted && !getConfigProp(c, platform, 'bundleAssets'); + const bundleAssets = getConfigProp(c, platform, 'bundleAssets') === true; + const isHosted = hosted && !bundleAssets; if (isHosted) { const isPortActive = await checkPortInUse(c, platform, c.runtime.port); @@ -119,16 +122,14 @@ export const runTizen = async (c: RnvContext, target?: string) => { const resetCompleted = await confirmActiveBundler(c); c.runtime.skipActiveServerCheck = !resetCompleted; } + logDefault('runTizen', `target:${target} hosted:${!!isHosted}`); + return; } - logDefault('runTizen', `target:${target} hosted:${!!isHosted}`); - if (isHosted) return; - - const bundleAssets = getConfigProp(c, platform, 'bundleAssets') === true; - if (bundleAssets) { await buildCoreWebpackProject(c); - await _runTizenSimOrDevice(c); + _copyRequiredFiles(c); + await runTizenSimOrDevice(c); } else { const isPortActive = await checkPortInUse(c, platform, c.runtime.port); const isWeinreEnabled = REMOTE_DEBUGGER_ENABLED_PLATFORMS.includes(platform) && !bundleAssets && !hosted; @@ -140,7 +141,7 @@ export const runTizen = async (c: RnvContext, target?: string) => { )} is not running. Starting it up for you...` ); waitForHost(c, '') - .then(() => _runTizenSimOrDevice(c)) + .then(() => runTizenSimOrDevice(c)) .catch(logError); await runWebpackServer(c, isWeinreEnabled); } else { @@ -148,11 +149,11 @@ export const runTizen = async (c: RnvContext, target?: string) => { if (resetCompleted) { waitForHost(c, '') - .then(() => _runTizenSimOrDevice(c)) + .then(() => runTizenSimOrDevice(c)) .catch(logError); await runWebpackServer(c, isWeinreEnabled); } else { - await _runTizenSimOrDevice(c); + await runTizenSimOrDevice(c); } } } @@ -169,18 +170,13 @@ export const buildTizenProject = async (c: RnvContext) => { const tDir = getPlatformProjectDir(c)!; await buildCoreWebpackProject(c); + if (!c.program.hosted) { + _copyRequiredFiles(c); const tOut = path.join(tDir, 'output'); const tIntermediate = path.join(tDir, 'intermediate'); const tBuild = path.join(tDir, 'build'); - const requiredFiles = ['.project', '.tproject', 'config.xml', 'icon.png']; - - requiredFiles.map((requiredFile) => { - const requiredFilePath = path.join(tDir, requiredFile); - copyFileSync(requiredFilePath, path.join(tBuild, requiredFile)); - }); - await execCLI(c, CLI_TIZEN, `build-web -- ${tBuild} -out ${tIntermediate}`); await execCLI(c, CLI_TIZEN, `package -- ${tIntermediate} -s ${certProfile} -t wgt -o ${tOut}`); diff --git a/packages/sdk-webos/src/runner.ts b/packages/sdk-webos/src/runner.ts index f2de7e7b76..f952e9de51 100644 --- a/packages/sdk-webos/src/runner.ts +++ b/packages/sdk-webos/src/runner.ts @@ -40,7 +40,10 @@ export const runWebOS = async (c: RnvContext) => { const { target } = c.runtime; const { platform } = c; - const isHosted = hosted && !getConfigProp(c, platform, 'bundleAssets'); + if (!platform) return; + + const bundleAssets = getConfigProp(c, platform, 'bundleAssets') === true; + const isHosted = hosted && !bundleAssets; if (isHosted) { const isPortActive = await checkPortInUse(c, platform, c.runtime.port); @@ -52,8 +55,6 @@ export const runWebOS = async (c: RnvContext) => { return; } - const bundleAssets = getConfigProp(c, platform, 'bundleAssets') === true; - const env = getConfigProp(c, platform, 'environment'); if (env !== 'production') { process.env.RNV_INJECTED_WEBPACK_SCRIPTS = `${ From cb2cf9ef386e75365541a8360cc1124f3b636756 Mon Sep 17 00:00:00 2001 From: Mihai Blaga Date: Mon, 11 Mar 2024 16:21:22 +0100 Subject: [PATCH 3/3] removed screen styling, removed unused imports --- packages/app-harness/src/app/index.tsx | 2 +- packages/app-harness/src/styles/index.ts | 9 +-------- packages/sdk-tizen/src/deviceManager.ts | 3 --- 3 files changed, 2 insertions(+), 12 deletions(-) diff --git a/packages/app-harness/src/app/index.tsx b/packages/app-harness/src/app/index.tsx index b6ed356f5e..dc8019169f 100644 --- a/packages/app-harness/src/app/index.tsx +++ b/packages/app-harness/src/app/index.tsx @@ -21,7 +21,7 @@ const App = () => { }, []); return ( - +