Skip to content

Commit 44891de

Browse files
authored
Merge pull request #468 from smartdevicelink/release/1.4.0_RC
1.4.0 Release
2 parents d95afc9 + a184f8f commit 44891de

29 files changed

+1676
-1802
lines changed

examples/node/hello-sdl/package-lock.json

Lines changed: 3 additions & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/node/hello-sdl/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"main": "index.js",
66
"dependencies": {
77
"esm": "^3.2.25",
8-
"ws": "^7.2.0"
8+
"ws": "^7.4.6"
99
},
1010
"devDependencies": {},
1111
"scripts": {

lib/js/src/manager/SystemCapabilityManager.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -732,7 +732,16 @@ class SystemCapabilityManager extends _SubManagerBase {
732732
if (defaultMainWindow.getImageFields() !== null && defaultMainWindow.getImageFields() !== undefined) {
733733
convertedCapabilities.setImageFields(defaultMainWindow.getImageFields());
734734
}
735-
convertedCapabilities.setTemplatesAvailable(defaultMainWindow.getTemplatesAvailable());
735+
736+
// Ford Sync bug returning incorrect template name for "NON-MEDIA" https://github.com/smartdevicelink/sdl_javascript_suite/issues/450
737+
const templatesAvailable = defaultMainWindow.getTemplatesAvailable() !== null ? defaultMainWindow.getTemplatesAvailable() : [];
738+
for (let index = 0; index < templatesAvailable.length; index++) {
739+
if (templatesAvailable[index] === 'NON_MEDIA') {
740+
templatesAvailable[index] = 'NON-MEDIA';
741+
break;
742+
}
743+
}
744+
convertedCapabilities.setTemplatesAvailable(templatesAvailable);
736745
convertedCapabilities.setNumCustomPresetsAvailable(defaultMainWindow.getNumCustomPresetsAvailable());
737746
convertedCapabilities.setMediaClockFormats([]); // mandatory field but allows empty array
738747
// if there are imageTypes in the response, we must assume graphics are supported

lib/js/src/manager/file/_FileManagerBase.js

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
import { ListFiles } from './../../rpc/messages/ListFiles.js';
3434
import { DeleteFile } from './../../rpc/messages/DeleteFile.js';
3535
import { _SubManagerBase } from '../_SubManagerBase.js';
36+
import { Version } from './../../util/Version.js';
3637

3738
class _FileManagerBase extends _SubManagerBase {
3839
/**
@@ -217,18 +218,33 @@ class _FileManagerBase extends _SubManagerBase {
217218
* @returns {Boolean} - Whether file has been uploaded to core (true) or not (false)
218219
*/
219220
hasUploadedFile (sdlFile) {
221+
// this method's logic is more related to the iOS library than the Java library
222+
// https://github.com/smartdevicelink/sdl_ios/issues/827 - Older versions of Core had a bug where list files would cache incorrectly.
223+
const rpcMsgVersion = this._lifecycleManager.getSdlMsgVersion();
224+
const rpcVersion = new Version()
225+
.setMajor(rpcMsgVersion.getMajorVersion())
226+
.setMinor(rpcMsgVersion.getMinorVersion())
227+
.setPatch(rpcMsgVersion.getPatchVersion());
228+
220229
const filename = sdlFile.getName();
221230
const isPersistent = sdlFile.isPersistent();
222231
const remoteFiles = this._remoteFiles;
223232
const ephemeralFiles = this._uploadedEphemeralFileNames;
224233
const isInRemoteFiles = remoteFiles.indexOf(filename) !== -1;
225234
const isInEphemeralFiles = ephemeralFiles.indexOf(filename) !== -1;
226235

227-
if (isPersistent) {
228-
return isInRemoteFiles;
229-
} else { // if it is not persistent it must be listed in both remote and ephemeral files.
230-
return isInRemoteFiles && isInEphemeralFiles;
236+
if (new Version(4, 4, 0).isNewerThan(rpcVersion) === 1) {
237+
if (isPersistent) {
238+
return isInRemoteFiles;
239+
} else { // if it is not persistent it must be listed in both remote and ephemeral files.
240+
return isInRemoteFiles && isInEphemeralFiles;
241+
}
242+
} else if (isInRemoteFiles) {
243+
// If not connected to a system where the bug presents itself, we can trust the `remoteFileNames`
244+
return true;
231245
}
246+
247+
return false;
232248
}
233249

234250

lib/js/src/manager/file/filetypes/SdlArtwork.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,9 @@ class SdlArtwork extends SdlFile {
7474
* @returns {SdlArtwork} - A reference to this instance to support method chaining.
7575
*/
7676
setType (fileType) {
77+
if (fileType === undefined) {
78+
return this;
79+
}
7780
if (fileType === null || fileType === FileType.GRAPHIC_JPEG || fileType === FileType.GRAPHIC_PNG
7881
|| fileType === FileType.GRAPHIC_BMP) {
7982
super.setType(fileType);

lib/js/src/manager/lifecycle/_LifecycleManager.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ import { SdlMsgVersion } from '../../rpc/structs/SdlMsgVersion.js';
4343
import { FunctionID } from '../../rpc/enums/FunctionID.js';
4444
import { _ServiceType } from '../../protocol/enums/_ServiceType.js';
4545
import { SystemInfo } from '../../util/SystemInfo.js';
46+
import { AppHMIType } from '../../rpc/enums/AppHMIType.js';
47+
import { PredefinedLayout } from '../../rpc/enums/PredefinedLayout.js';
4648

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

9597
this._didCheckSystemInfo = false;
98+
this._lastDisplayLayoutRequestTemplate = null;
99+
this._initialMediaCapabilities = null;
96100
}
97101

98102
/**
@@ -162,6 +166,7 @@ class _LifecycleManager {
162166
return;
163167
}
164168

169+
this.fixIncorrectDisplayCapabilities(rpcMessage);
165170
const functionID = FunctionID.valueForKey(rpcMessage.getFunctionId()); // this is the number value
166171
const listenerArray = this._rpcListeners.get(functionID);
167172
if (Array.isArray(listenerArray)) {
@@ -315,6 +320,10 @@ class _LifecycleManager {
315320
if (rpcMessage.getCorrelationId() === null || rpcMessage.getCorrelationId() === undefined) {
316321
rpcMessage.setCorrelationId(++this._maxCorrelationId);
317322
}
323+
// 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
324+
if (rpcMessage.getFunctionId() === FunctionID.keyForValue(FunctionID.SetDisplayLayout)) {
325+
this._lastDisplayLayoutRequestTemplate = rpcMessage.getDisplayLayout();
326+
}
318327
this.addRpcListener(FunctionID.valueForKey(rpcMessage.getFunctionId()), listener);
319328
// listen for GenericResponse as well, in the case of interacting with older head units
320329
this.addRpcListener(FunctionID.GenericResponse, listener);
@@ -440,6 +449,18 @@ class _LifecycleManager {
440449
return true;
441450
}
442451

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

444465
/* *******************************************************************************************************
445466
********************************** INTERNAL - RPC LISTENERS !! START !! *********************************
@@ -531,6 +552,9 @@ class _LifecycleManager {
531552
this.sendRpcResolve(new UnregisterAppInterface());
532553
this._cleanProxy();
533554
}
555+
if (this._lifecycleConfig.getAppTypes().includes(AppHMIType.MEDIA)) {
556+
this._initialMediaCapabilities = registerAppInterfaceResponse.getDisplayCapabilities();
557+
}
534558
}
535559

536560
// parse RAI for system capabilities

lib/js/src/manager/screen/_ScreenManagerBase.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -438,7 +438,7 @@ class _ScreenManagerBase extends _SubManagerBase {
438438
}
439439

440440
/**
441-
* Get the currently set voice commands
441+
* Gets the voice commands set as part of the last initiated update operation
442442
* @returns {VoiceCommand[]} - a List of Voice Command objects
443443
*/
444444
getVoiceCommands () {
@@ -545,11 +545,10 @@ class _ScreenManagerBase extends _SubManagerBase {
545545
async commit () {
546546
this._softButtonManager.setBatchUpdates(false);
547547
this._textAndGraphicManager.setBatchUpdates(false);
548-
// order matters!
549-
const success1 = await this._softButtonManager.update();
550-
const success2 = await this._textAndGraphicManager.update();
551548

552-
return success1 && success2;
549+
const success = await this._textAndGraphicManager.update();
550+
551+
return success;
553552
}
554553

555554
/**

0 commit comments

Comments
 (0)