Skip to content

Commit 56f83de

Browse files
authored
Merge pull request smartdevicelink#513 from smartdevicelink/master
Merge master into develop
2 parents 809f48c + f371912 commit 56f83de

16 files changed

+3183
-3593
lines changed

examples/node/hello-sdl/AppClient.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,11 +105,11 @@ class AppClient {
105105
this._isButtonSubscriptionRequested = false;
106106
}
107107

108-
_onConnected () {
108+
async _onConnected () {
109109
this._managersReady = true;
110110
this._checkReadyState();
111111
const screenManager = this._sdlManager.getScreenManager();
112-
112+
113113
// add menus
114114
const menuListener = new SDL.manager.screen.menu.MenuSelectionListener()
115115
.setOnTriggered(triggerSource => {

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,10 @@ class _ScreenManagerBase extends _SubManagerBase {
7777
this._choiceSetManagerBase.start(),
7878
this._menuManagerBase.start(),
7979
]);
80+
81+
_ScreenManagerBase._softButtonIDBySoftButtonManager = new Set();
82+
_ScreenManagerBase._softButtonIDByAlertManager = new Set();
83+
8084
this._transitionToState(_SubManagerBase.READY);
8185
await super.start();
8286
}
@@ -743,9 +747,6 @@ _ManagerLocation._MAP = Object.freeze({
743747

744748
_ScreenManagerBase._ManagerLocation = _ManagerLocation;
745749

746-
_ScreenManagerBase._softButtonIDBySoftButtonManager = new Set();
747-
_ScreenManagerBase._softButtonIDByAlertManager = new Set();
748-
749750
const SOFT_BUTTON_ID_NOT_SET_VALUE = -1;
750751
const SOFT_BUTTON_ID_MIN_VALUE = 0;
751752
const SOFT_BUTTON_ID_MAX_VALUE = 10000;

lib/js/src/manager/screen/_TextAndGraphicUpdateOperation.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,8 @@ class _TextAndGraphicUpdateOperation extends _Task {
6666
* The method that causes the task to run.
6767
* @param {_Task} task - The task instance
6868
*/
69-
onExecute (task) {
70-
this._start();
69+
async onExecute (task) {
70+
await this._start();
7171
}
7272
/**
7373
* If the task is not canceled, starts to assemble the show

lib/js/src/manager/screen/choiceset/_PreloadPresentChoicesOperation.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -468,7 +468,7 @@ class _PreloadPresentChoicesOperation extends _Task {
468468
console.error('PreloadChoicesOperation: Error uploading choice cell artworks');
469469
}
470470

471-
return uploadResults.includes(false);
471+
return !uploadResults.includes(false);
472472
}
473473

474474
/**
@@ -710,14 +710,15 @@ class _PreloadPresentChoicesOperation extends _Task {
710710
return;
711711
}
712712

713+
// detach the OnKeyboardInput listener at the end
714+
this._lifecycleManager.removeRpcListener(FunctionID.OnKeyboardInput, this._keyboardRpcListener);
715+
713716
if (this._updatedKeyboardProperties) {
714717
this._currentState = _PreloadPresentChoicesOperationState.RESETTING_KEYBOARD_PROPERTIES;
715718
// We need to reset the keyboard properties
716719
const setGlobalProperties = new SetGlobalProperties()
717720
.setKeyboardProperties(this._originalKeyboardProperties);
718721

719-
// detach the OnKeyboardInput listener at the end
720-
this._lifecycleManager.removeRpcListener(FunctionID.OnKeyboardInput, this._keyboardRpcListener);
721722
const response = await this._lifecycleManager.sendRpcResolve(setGlobalProperties);
722723

723724
if (response.getSuccess()) {

lib/js/src/manager/screen/menu/_MenuConfigurationUpdateOperation.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ class _MenuConfigurationUpdateOperation extends _Task {
5353
* The method that causes the task to run.
5454
* @param {_Task} task - The task instance
5555
*/
56-
onExecute (task) {
57-
this._start();
56+
async onExecute (task) {
57+
await this._start();
5858
}
5959

6060
/**

lib/js/src/manager/screen/menu/_MenuManagerBase.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ class _MenuManagerBase extends _SubManagerBase {
303303
_updateMenuReplaceOperationsWithNewCurrentMenu () {
304304
this._taskQueue.forEach(task => {
305305
if (task.getName() === 'MenuReplaceOperation') {
306-
task.setCurrentMenu(this._currentMenuCells);
306+
task._setCurrentMenu(this._currentMenuCells);
307307
}
308308
});
309309
}
@@ -325,7 +325,7 @@ class _MenuManagerBase extends _SubManagerBase {
325325
_updateMenuReplaceOperationsWithNewMenuConfiguration () {
326326
this._taskQueue.forEach(task => {
327327
if (task.getName() === 'MenuReplaceOperation') {
328-
task.setMenuConfiguration(this._currentMenuConfiguration);
328+
task._setMenuConfiguration(this._currentMenuConfiguration);
329329
}
330330
});
331331
}

lib/js/src/manager/screen/menu/_MenuReplaceOperation.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,8 @@ class _MenuReplaceOperation extends _Task {
6767
* The method that causes the task to run.
6868
* @param {_Task} task - The task instance
6969
*/
70-
onExecute (task) {
71-
this._start();
70+
async onExecute (task) {
71+
await this._start();
7272
}
7373

7474
/**

lib/js/src/manager/screen/menu/_MenuReplaceUtilities.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -342,6 +342,10 @@ class _MenuReplaceUtilities {
342342
const shouldCellIncludeSecondaryImage = cell.getSecondaryArtwork() !== null && cell.getSecondaryArtwork().getImageRPC() !== null && _MenuReplaceUtilities.shouldCellIncludeSecondaryImageFromCell(cell, fileManager, windowCapability);
343343
const secondaryIcon = shouldCellIncludeSecondaryImage ? cell.getSecondaryArtwork().getImageRPC() : null;
344344

345+
if (Array.isArray(cell.getVoiceCommands()) && cell.getVoiceCommands().length > 0) {
346+
console.warn('MenuManagerBase - Setting voice commands for submenu cells is not supported. The voice commands will not be set.');
347+
}
348+
345349
let submenuLayout = null;
346350
const availableMenuLayouts = windowCapability !== null ? windowCapability.getMenuLayoutsAvailable() : null;
347351
if (cell.getSubMenuLayout() !== null && availableMenuLayouts !== null && availableMenuLayouts.includes(cell.getSubMenuLayout())) {

lib/js/src/manager/screen/menu/_MenuShowOperation.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ class _MenuShowOperation extends _Task {
4949
* The method that causes the task to run.
5050
* @param {_Task} task - The task instance
5151
*/
52-
onExecute (task) {
53-
this._start();
52+
async onExecute (task) {
53+
await this._start();
5454
}
5555

5656
/**

lib/js/src/manager/screen/utils/_PresentAlertOperation.js

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,10 @@ class _PresentAlertOperation extends _Task {
6464
this._isAlertPresented = false;
6565
this._alertSoftButtonClearListener = alertSoftButtonClearListener;
6666

67-
this._alertView.canceledListener = function () {
67+
this._alertView.canceledListener = () => {
6868
this.cancelAlert();
6969
};
70+
alertView.canceledListener = this._alertView.canceledListener;
7071
}
7172

7273
/**
@@ -257,7 +258,7 @@ class _PresentAlertOperation extends _Task {
257258
*/
258259
async cancelAlert () {
259260
if (this.getState() === _Task.FINISHED) {
260-
console.logInfo('This operation has already finished so it can not be canceled');
261+
console.log('This operation has already finished so it can not be canceled');
261262
return;
262263
} else if (this.getState() === _Task.CANCELED) {
263264
console.log('This operation has already been canceled. It will be finished at some point during the operation.');
@@ -266,12 +267,17 @@ class _PresentAlertOperation extends _Task {
266267
if (this._lifecycleManager !== null && this._lifecycleManager.getSdlMsgVersion() !== null && this._lifecycleManager.getSdlMsgVersion().getMajorVersion() < 6) {
267268
console.log('Attempting to cancel this operation in-progress; if the alert is already presented on the module, it cannot be dismissed.');
268269
this.switchStates(_Task.CANCELED);
270+
return;
269271
} else if (!this._isAlertPresented) {
270272
console.log('Alert has not yet been sent to the module. Alert will not be shown.');
273+
this.switchStates(_Task.CANCELED);
274+
return;
271275
}
272276
console.log('Canceling the presented alert');
273277

274-
const cancelInteraction = new CancelInteraction(FunctionID.Alert, this._cancelId);
278+
const cancelInteraction = new CancelInteraction()
279+
.setFunctionIDParam(FunctionID.Alert)
280+
.setCancelID(this._cancelId);
275281
const response = await this._lifecycleManager.sendRpcResolve(cancelInteraction);
276282
if (!response.getSuccess()) {
277283
console.log(`Error canceling the presented alert: ${response.getInfo()}`);

0 commit comments

Comments
 (0)