Skip to content

Commit

Permalink
Merge pull request #1669 from flexn-io/fix/tizen-cant-install-app
Browse files Browse the repository at this point in the history
Fix for not being able to install app on specific Tizen TVs
  • Loading branch information
justinasRm committed Sep 17, 2024
2 parents 0ee0583 + a7e2221 commit 8d2c43b
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 9 deletions.
4 changes: 2 additions & 2 deletions packages/app-harness/appConfigs/harness/renative.json
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,8 @@
}
},
"tizen": {
"package": "NkVRhWHJST",
"id": "NkVRhWHJST.RNVanillaTV"
"package": "NkVRhWHJSX",
"id": "NkVRhWHJSX.RNVanillaTV"
},
"tizenwatch": {
"package": "cHIP2fIRQZ",
Expand Down
24 changes: 21 additions & 3 deletions packages/sdk-tizen/src/deviceManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,14 @@ export const launchTizenEmulator = async (name: string | true): Promise<boolean>
const devices_lines = devices.split('\n');

const allDownloadedEmulators = emulators.split('\n'); // all tizen, tizenwatch and tizenmobile emulators

const specificEmulators = await getSubplatformDevices(allDownloadedEmulators, c.platform as string);
const devicesArr = devices_lines.slice(1).map((line: string) => line.split(' ')[0]); // devices array with only their ip

const lines = specificEmulators.concat(devices_lines.slice(1));
const lines = specificEmulators.concat(devicesArr);

const targetsArray = lines.map((line) => ({ id: line, name: line }));

const choices = _composeDevicesString(targetsArray);

const { chosenEmulator } = await inquirerPrompt({
Expand All @@ -99,6 +102,14 @@ export const launchTizenEmulator = async (name: string | true): Promise<boolean>
}

if (name) {
const ipRegex = /^(?:\d{1,3}\.){3}\d{1,3}:\d{1,5}$/;
if (name !== true && ipRegex.test(name)) {
// if ip is chosen, real device boot should start
logInfo('Connecting to device');
c.runtime.target = name.split(':')[0];
await runTizenSimOrDevice();
return true;
}
try {
await executeAsync(
`${c.cli[CLI_TIZEN_EMULATOR]} launch --name ${name}`,
Expand Down Expand Up @@ -163,7 +174,12 @@ const getSubplatformDevices = async (allTizenEmulators: string[], neededPlatform
export const listTizenTargets = async (platform: string) => {
const emulatorsString = await execCLI(CLI_TIZEN_EMULATOR, 'list-vm');
const devicesString = await execCLI(CLI_SDB_TIZEN, 'devices');
const devicesArr = devicesString.split('\n').slice(1);
const devicesArr = devicesString
.split('\n')
.slice(1)
.map((line: string) => line.split(' ')[0]);
// turns devices string: ' List of devices attached \n192.168.0.105:26101 device UE43NU7192' to only the '192.168.0.105:26101'

const allDownloadedEmulators = emulatorsString.split('\n'); // all tizen, tizenwatch and tizenmobile emulators
const specificPlatformEmulators = await getSubplatformDevices(allDownloadedEmulators.concat(devicesArr), platform); // tizen, tizenwatch, tizenmobile - only 1 of them
let targetStr = '';
Expand Down Expand Up @@ -415,7 +431,9 @@ Please create one and then edit the default target from ${c.paths.workspace.dir}

try {
const packageID = platform === 'tizenwatch' || platform === 'tizenmobile' ? tId.split('.')[0] : tId;
await execCLI(CLI_TIZEN, `uninstall -p ${packageID} -t ${deviceID}`, { ignoreErrors: true });
await execCLI(CLI_TIZEN, `uninstall -p ${packageID} -t ${deviceID}`, {
ignoreErrors: true,
});
hasDevice = true;
} catch (e) {
if (typeof e === 'string' && e.includes('No device matching')) {
Expand Down
4 changes: 2 additions & 2 deletions packages/template-starter/appConfigs/base/renative.json
Original file line number Diff line number Diff line change
Expand Up @@ -210,8 +210,8 @@
"appName": "RNVanillaTV",
"entryFile": "index",
"certificateProfile": "RNVanillaCert",
"package": "NkVRhWHJST",
"id": "NkVRhWHJST.RNVanillaTV",
"package": "NkVRhWHJSX",
"id": "NkVRhWHJSX.RNVanillaTV",
"buildSchemes": {
"debug": {
"bundleAssets": false
Expand Down
4 changes: 2 additions & 2 deletions packages/template-starter/appConfigs/template/renative.json
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@
}
},
"tizen": {
"package": "NkVRhWHJST",
"id": "NkVRhWHJST.RNVanillaTV"
"package": "NkVRhWHJSX",
"id": "NkVRhWHJSX.RNVanillaTV"
},
"tizenwatch": {
"package": "cHIP2fIRQZ",
Expand Down

0 comments on commit 8d2c43b

Please sign in to comment.