Skip to content

Commit

Permalink
Merge pull request #468 from smartdevicelink/release/1.4.0_RC
Browse files Browse the repository at this point in the history
1.4.0 Release
  • Loading branch information
renonick87 authored Jun 30, 2021
2 parents d95afc9 + a184f8f commit 44891de
Show file tree
Hide file tree
Showing 29 changed files with 1,676 additions and 1,802 deletions.
14 changes: 3 additions & 11 deletions examples/node/hello-sdl/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 examples/node/hello-sdl/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"main": "index.js",
"dependencies": {
"esm": "^3.2.25",
"ws": "^7.2.0"
"ws": "^7.4.6"
},
"devDependencies": {},
"scripts": {
Expand Down
11 changes: 10 additions & 1 deletion lib/js/src/manager/SystemCapabilityManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -732,7 +732,16 @@ class SystemCapabilityManager extends _SubManagerBase {
if (defaultMainWindow.getImageFields() !== null && defaultMainWindow.getImageFields() !== undefined) {
convertedCapabilities.setImageFields(defaultMainWindow.getImageFields());
}
convertedCapabilities.setTemplatesAvailable(defaultMainWindow.getTemplatesAvailable());

// Ford Sync bug returning incorrect template name for "NON-MEDIA" https://github.com/smartdevicelink/sdl_javascript_suite/issues/450
const templatesAvailable = defaultMainWindow.getTemplatesAvailable() !== null ? defaultMainWindow.getTemplatesAvailable() : [];
for (let index = 0; index < templatesAvailable.length; index++) {
if (templatesAvailable[index] === 'NON_MEDIA') {
templatesAvailable[index] = 'NON-MEDIA';
break;
}
}
convertedCapabilities.setTemplatesAvailable(templatesAvailable);
convertedCapabilities.setNumCustomPresetsAvailable(defaultMainWindow.getNumCustomPresetsAvailable());
convertedCapabilities.setMediaClockFormats([]); // mandatory field but allows empty array
// if there are imageTypes in the response, we must assume graphics are supported
Expand Down
24 changes: 20 additions & 4 deletions lib/js/src/manager/file/_FileManagerBase.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import { ListFiles } from './../../rpc/messages/ListFiles.js';
import { DeleteFile } from './../../rpc/messages/DeleteFile.js';
import { _SubManagerBase } from '../_SubManagerBase.js';
import { Version } from './../../util/Version.js';

class _FileManagerBase extends _SubManagerBase {
/**
Expand Down Expand Up @@ -217,18 +218,33 @@ class _FileManagerBase extends _SubManagerBase {
* @returns {Boolean} - Whether file has been uploaded to core (true) or not (false)
*/
hasUploadedFile (sdlFile) {
// this method's logic is more related to the iOS library than the Java library
// https://github.com/smartdevicelink/sdl_ios/issues/827 - Older versions of Core had a bug where list files would cache incorrectly.
const rpcMsgVersion = this._lifecycleManager.getSdlMsgVersion();
const rpcVersion = new Version()
.setMajor(rpcMsgVersion.getMajorVersion())
.setMinor(rpcMsgVersion.getMinorVersion())
.setPatch(rpcMsgVersion.getPatchVersion());

const filename = sdlFile.getName();
const isPersistent = sdlFile.isPersistent();
const remoteFiles = this._remoteFiles;
const ephemeralFiles = this._uploadedEphemeralFileNames;
const isInRemoteFiles = remoteFiles.indexOf(filename) !== -1;
const isInEphemeralFiles = ephemeralFiles.indexOf(filename) !== -1;

if (isPersistent) {
return isInRemoteFiles;
} else { // if it is not persistent it must be listed in both remote and ephemeral files.
return isInRemoteFiles && isInEphemeralFiles;
if (new Version(4, 4, 0).isNewerThan(rpcVersion) === 1) {
if (isPersistent) {
return isInRemoteFiles;
} else { // if it is not persistent it must be listed in both remote and ephemeral files.
return isInRemoteFiles && isInEphemeralFiles;
}
} else if (isInRemoteFiles) {
// If not connected to a system where the bug presents itself, we can trust the `remoteFileNames`
return true;
}

return false;
}


Expand Down
3 changes: 3 additions & 0 deletions lib/js/src/manager/file/filetypes/SdlArtwork.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,9 @@ class SdlArtwork extends SdlFile {
* @returns {SdlArtwork} - A reference to this instance to support method chaining.
*/
setType (fileType) {
if (fileType === undefined) {
return this;
}
if (fileType === null || fileType === FileType.GRAPHIC_JPEG || fileType === FileType.GRAPHIC_PNG
|| fileType === FileType.GRAPHIC_BMP) {
super.setType(fileType);
Expand Down
24 changes: 24 additions & 0 deletions lib/js/src/manager/lifecycle/_LifecycleManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ import { SdlMsgVersion } from '../../rpc/structs/SdlMsgVersion.js';
import { FunctionID } from '../../rpc/enums/FunctionID.js';
import { _ServiceType } from '../../protocol/enums/_ServiceType.js';
import { SystemInfo } from '../../util/SystemInfo.js';
import { AppHMIType } from '../../rpc/enums/AppHMIType.js';
import { PredefinedLayout } from '../../rpc/enums/PredefinedLayout.js';

/**
* This class should also be marked private and behind the SdlManager API
Expand Down Expand Up @@ -93,6 +95,8 @@ class _LifecycleManager {
this._registerAppInterfaceResponse = null;

this._didCheckSystemInfo = false;
this._lastDisplayLayoutRequestTemplate = null;
this._initialMediaCapabilities = null;
}

/**
Expand Down Expand Up @@ -162,6 +166,7 @@ class _LifecycleManager {
return;
}

this.fixIncorrectDisplayCapabilities(rpcMessage);
const functionID = FunctionID.valueForKey(rpcMessage.getFunctionId()); // this is the number value
const listenerArray = this._rpcListeners.get(functionID);
if (Array.isArray(listenerArray)) {
Expand Down Expand Up @@ -315,6 +320,10 @@ class _LifecycleManager {
if (rpcMessage.getCorrelationId() === null || rpcMessage.getCorrelationId() === undefined) {
rpcMessage.setCorrelationId(++this._maxCorrelationId);
}
// Ford Sync bug returning incorrect display capabilities (https://github.com/smartdevicelink/sdl_javascript_suite/issues/446). Save the next desired layout type to the update capabilities when the SetDisplayLayout response is received
if (rpcMessage.getFunctionId() === FunctionID.keyForValue(FunctionID.SetDisplayLayout)) {
this._lastDisplayLayoutRequestTemplate = rpcMessage.getDisplayLayout();
}
this.addRpcListener(FunctionID.valueForKey(rpcMessage.getFunctionId()), listener);
// listen for GenericResponse as well, in the case of interacting with older head units
this.addRpcListener(FunctionID.GenericResponse, listener);
Expand Down Expand Up @@ -440,6 +449,18 @@ class _LifecycleManager {
return true;
}

/**
* When a SetDisplayLayout response is received and the desired layout type is MEDIA, use the initial media capabilities
* See Ford Sync bug returning incorrect display capabilities (https://github.com/smartdevicelink/sdl_javascript_suite/issues/446).
* @param {RpcMessage} rpc - an RPC Message
*/
fixIncorrectDisplayCapabilities (rpc) {
if (MessageType.response === rpc.getMessageType() && rpc.getFunctionId() === FunctionID.keyForValue(FunctionID.SetDisplayLayout) &&
this._initialMediaCapabilities !== null && this._lastDisplayLayoutRequestTemplate === PredefinedLayout.MEDIA) {
rpc.setDisplayCapabilities(this._initialMediaCapabilities);
}
}


/* *******************************************************************************************************
********************************** INTERNAL - RPC LISTENERS !! START !! *********************************
Expand Down Expand Up @@ -531,6 +552,9 @@ class _LifecycleManager {
this.sendRpcResolve(new UnregisterAppInterface());
this._cleanProxy();
}
if (this._lifecycleConfig.getAppTypes().includes(AppHMIType.MEDIA)) {
this._initialMediaCapabilities = registerAppInterfaceResponse.getDisplayCapabilities();
}
}

// parse RAI for system capabilities
Expand Down
9 changes: 4 additions & 5 deletions lib/js/src/manager/screen/_ScreenManagerBase.js
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,7 @@ class _ScreenManagerBase extends _SubManagerBase {
}

/**
* Get the currently set voice commands
* Gets the voice commands set as part of the last initiated update operation
* @returns {VoiceCommand[]} - a List of Voice Command objects
*/
getVoiceCommands () {
Expand Down Expand Up @@ -545,11 +545,10 @@ class _ScreenManagerBase extends _SubManagerBase {
async commit () {
this._softButtonManager.setBatchUpdates(false);
this._textAndGraphicManager.setBatchUpdates(false);
// order matters!
const success1 = await this._softButtonManager.update();
const success2 = await this._textAndGraphicManager.update();

return success1 && success2;
const success = await this._textAndGraphicManager.update();

return success;
}

/**
Expand Down
Loading

0 comments on commit 44891de

Please sign in to comment.