From 57ecb08709bf35c2cf6dac881ff11a5f3528e1fd Mon Sep 17 00:00:00 2001 From: YarikMamykin Date: Wed, 22 Apr 2020 01:54:54 +0300 Subject: [PATCH 01/11] Fix PerformInteraction + ScrollableMessage response --- app/model/sdl/Abstract/Model.js | 137 +++++++++++++++++++++++++++++++- 1 file changed, 134 insertions(+), 3 deletions(-) diff --git a/app/model/sdl/Abstract/Model.js b/app/model/sdl/Abstract/Model.js index 6f5acfa0b..a9ea853f1 100644 --- a/app/model/sdl/Abstract/Model.js +++ b/app/model/sdl/Abstract/Model.js @@ -973,6 +973,23 @@ SDL.SDLModel = Em.Object.extend({ request.params, messageRequestId ); } + if(request.params.softButtons) { + var imageList = []; + for(var i = 0; i < request.params.softButtons.length; i++) { + if(request.params.softButtons[i].image) { + imageList.push(request.params.softButtons[i].image.value); + } + } + var callback = function(failed) { + if(failed) { + FFW.UI.sendUIResult( + SDL.SDLModel.data.resultCode.WARNINGS, + request.id, + request.method, "Requested image(s) not found"); + } + }; + SDL.SDLModel.validateImages(request.id, callback, imageList); + } return true; } else { FFW.UI.sendError(SDL.SDLModel.data.resultCode.REJECTED, request.id, @@ -1011,6 +1028,92 @@ SDL.SDLModel = Em.Object.extend({ } }, + /** + * List of images(paths to images) to check. + */ + imageCheckList: {}, + + /** + * @function validateImages + * @description Checks if image exists by path provided in request data + * @param requestID - request id, to which icons belong + * @param callback - user callback after check + * @param imageList - list of paths to check + */ + validateImages: function(requestID, callback, imageList) { + if(imageList == null || imageList.length == 0) { + callback(false); + return; + } + + this.imageCheckList[requestID] = []; + const filteredImageList = imageList.filter(function(item, pos) { + return imageList.indexOf(item) == pos; + }); + + filteredImageList.forEach(image => { + this.imageCheckList[requestID].push({ + 'path': image, + 'checkResult': null + }); + }); + + for(var i = 0; i < this.imageCheckList[requestID].length; i++) { + var image = new Image(); + image.onload = function() { + for(var i = 0; i < SDL.SDLModel.imageCheckList[requestID].length; i++) { + var formattedImgPath = this.src.substring(this.src.indexOf('://') + '://'.length); + var path = SDL.SDLModel.imageCheckList[requestID][i].path; + if(path === formattedImgPath) { + SDL.SDLModel.imageCheckList[requestID][i].checkResult = true; + break; + } + } + SDL.SDLModel.finalizeImageValidation(requestID, callback); + }; + image.onerror = function() { + for(var i = 0; i < SDL.SDLModel.imageCheckList[requestID].length; i++) { + var formattedImgPath = this.src.substring(this.src.indexOf('://') + '://'.length); + var path = SDL.SDLModel.imageCheckList[requestID][i].path; + if(path === formattedImgPath) { + SDL.SDLModel.imageCheckList[requestID][i].checkResult = false; + break; + } + } + SDL.SDLModel.finalizeImageValidation(requestID, callback); + }; + image.src = this.imageCheckList[requestID][i].path; + } + }, + + /** + * @function finalizeImageValidation + * @description Collects result of images validation. + * If validation is finished - calls user callback function. + * @param callback - user callback. + */ + finalizeImageValidation: function(requestID, callback) { + var failed = false; + var BreakException = {}; + try { + SDL.SDLModel.imageCheckList[requestID].forEach(image => { + if (image.checkResult === null) { + throw BreakException; + } + if (!image.checkResult) { + failed = true; + } + }); + } catch (exception) { + if (exception == BreakException) { + return; + } + } + + delete SDL.SDLModel.imageCheckList.requestID; + callback(failed); + }, + /** * Method to call function from DeviceListView to show list of connected * devices @@ -1163,9 +1266,37 @@ SDL.SDLModel = Em.Object.extend({ SDL.InteractionChoicesView.cancelID = message.params.cancelID; - if (message.params && message.params.choiceSet == null) { - FFW.UI.sendUIResult(SDL.SDLModel.data.resultCode.SUCCESS, - message.id, 'UI.PerformInteraction'); + if (message.params && message.params.choiceSet != null) { + imageList = []; + if(message.params.vrHelp) { + for(var i = 0; i < message.params.vrHelp.length; i++) { + var image = message.params.vrHelp[i].image; + if(image) { + imageList.push(image.value); + } + } + } + if(message.params.choiceSet) { + for(var i = 0; i < message.params.choiceSet.length; i++) { + var image = message.params.choiceSet[i].image; + if(image) { + imageList.push(image.value); + } + } + } + + var callback = function(failed) { + var WARNINGS = SDL.SDLModel.data.resultCode.WARNINGS; + var SUCCESS = SDL.SDLModel.data.resultCode.SUCCESS; + + FFW.UI.sendUIResult( + failed ? WARNINGS : SUCCESS, + message.id, + message.method, + failed ? "Requested image(s) not found" : null); + } + SDL.SDLModel.validateImages(message.id, callback, imageList); + return true; } From 9ace2e5d0902bbd0fa923984613a77cacdd6703a Mon Sep 17 00:00:00 2001 From: YarikMamykin Date: Wed, 22 Apr 2020 01:57:09 +0300 Subject: [PATCH 02/11] Fix Show + SetGlobalProperties response --- ffw/UIRPC.js | 64 ++++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 57 insertions(+), 7 deletions(-) diff --git a/ffw/UIRPC.js b/ffw/UIRPC.js index e90367887..ce4a1bea5 100644 --- a/ffw/UIRPC.js +++ b/ffw/UIRPC.js @@ -244,9 +244,35 @@ FFW.UI = FFW.RPCObserver.create( return; } SDL.InfoAppsView.showAppList(); - this.sendUIResult( - SDL.SDLModel.data.resultCode.SUCCESS, request.id, request.method - ); + + imageList = []; + if(request.params.graphic) { + imageList.push(request.params.graphic.value); + } + if(request.params.secondaryGraphic) { + imageList.push(request.params.secondaryGraphic.value); + } + if(request.params.softButtons) { + for(var i = 0; i < request.params.softButtons.length; i++) { + var image = request.params.softButtons[i].image; + if(image) { + imageList.push(image.value); + } + } + } + + var callback = function(failed) { + var WARNINGS = SDL.SDLModel.data.resultCode.WARNINGS; + var SUCCESS = SDL.SDLModel.data.resultCode.SUCCESS; + + FFW.UI.sendUIResult( + failed ? WARNINGS : SUCCESS, + request.id, + request.method, + failed ? "Requested image(s) not found" : null); + } + SDL.SDLModel.validateImages(request.id, callback, imageList); + if (sendCapabilityUpdated) { let capability = SDL.SDLController.getDefaultCapabilities(request.params.windowID, request.params.appID); FFW.BasicCommunication.OnSystemCapabilityUpdated(capability); @@ -274,9 +300,31 @@ FFW.UI = FFW.RPCObserver.create( // not processed."); this.errorResponsePull[request.id] = null; // return; } } SDL.SDLModel.setProperties(request.params); - this.sendUIResult( - SDL.SDLModel.data.resultCode.SUCCESS, request.id, request.method - ); + + var imageList = []; + if(request.params.menuIcon) { + imageList.push(request.params.menuIcon.value); + } + + if(request.params.vrHelp) { + for(var i = 0; i < request.params.vrHelp.length; i++) { + if(request.params.vrHelp[i].image) { + imageList.push(request.params.vrHelp[i].image.value); + } + } + } + + var callback = function(failed) { + var WARNINGS = SDL.SDLModel.data.resultCode.WARNINGS; + var SUCCESS = SDL.SDLModel.data.resultCode.SUCCESS; + + FFW.Navigation.sendUIResult( + failed ? WARNINGS : SUCCESS, + request.id, + request.method, + failed ? "Requested image(s) not found" : null); + } + SDL.SDLModel.validateImages(request.id, callback, imageList); break; } case 'UI.AddCommand': @@ -1631,9 +1679,11 @@ FFW.UI = FFW.RPCObserver.create( 'result': { 'code': resultCode, // type (enum) from SDL protocol 'method': method, - 'info': info } }; + if(info != null) { + JSONMessage.result.info = info; + } this.sendMessage(JSONMessage); } }, From 014154ea04a64259c7b407e80a46e105268f92f9 Mon Sep 17 00:00:00 2001 From: YarikMamykin Date: Wed, 22 Apr 2020 01:58:59 +0300 Subject: [PATCH 03/11] Fix UpdateTurnList + ShowConstantTBT + SendLocation response --- app/controller/NavigationController.js | 113 +++++++++++++++++++++++-- ffw/NavigationRPC.js | 88 ++----------------- 2 files changed, 115 insertions(+), 86 deletions(-) diff --git a/app/controller/NavigationController.js b/app/controller/NavigationController.js index 87000dbd2..94c68e6c5 100644 --- a/app/controller/NavigationController.js +++ b/app/controller/NavigationController.js @@ -63,11 +63,24 @@ SDL.NavigationController = Em.Object.create( searchAddress: request.params.address } ); - FFW.Navigation.sendNavigationResult( - SDL.SDLModel.data.resultCode.SUCCESS, - request.id, - request.method - ); + + imageList = []; + if(request.params.locationImage) { + imageList.push(request.params.locationImage.value); + } + + var callback = function(failed) { + var WARNINGS = SDL.SDLModel.data.resultCode.WARNINGS; + var SUCCESS = SDL.SDLModel.data.resultCode.SUCCESS; + + FFW.Navigation.sendNavigationResult( + failed ? WARNINGS : SUCCESS, + request.id, + request.method, + failed ? "Requested image(s) not found" : null + ); + } + SDL.SDLModel.validateImages(request.id, callback, imageList); }, /** * Navigation view List Button action handler @@ -407,6 +420,94 @@ SDL.NavigationController = Em.Object.create( }, 2000 ); // Allow time for the initial map display - } + }, + + /** + * @desc Verifies if image is an PNG image, + * accordingly to file extension. + * @param imagePath - path to image + * @return {Boolean} true if image is PNG and false otherwise + */ + isPng: function(imagePath) { + const img_extension = '.png'; + var search_offset = imagePath.lastIndexOf('.'); + return imagePath.includes(img_extension, search_offset); + }, + + /** + * @desc Collects images paths from request + * and calls validation function. + * @param request - request data + */ + validateIcons: function(request) { + var params = request.params; + imageList = []; + var nonPngCounter = 0; + + if(params.turnList) { + var countList=params.turnList.length; + for(var i = 0; i < countList; i++) { + if(params.turnList[i].turnIcon) { + var iconPath = params.turnList[i].turnIcon.value; + if(!this.isPng(iconPath)) { + delete params.turnList[i].turnIcon; + nonPngCounter++; + continue; + } + imageList.push(iconPath); + } + } + } + if(params.softButtons) { + var countButtons=params.softButtons.length; + for(var i=0;i 0) { + FFW.Navigation.sendNavigationResult( + SDL.SDLModel.data.resultCode.WARNINGS, + request.id, + request.method, + ); + return; + } + + var callback = function(failed) { + var WARNINGS = SDL.SDLModel.data.resultCode.WARNINGS; + var SUCCESS = SDL.SDLModel.data.resultCode.SUCCESS; + FFW.Navigation.sendNavigationResult( + failed ? WARNINGS : SUCCESS, + request.id, + request.method, + failed ? "Requested image(s) not found" : null); + } + SDL.SDLModel.validateImages(request.id, callback, imageList); + }, } ); diff --git a/ffw/NavigationRPC.js b/ffw/NavigationRPC.js index e5fd97d13..162f01749 100644 --- a/ffw/NavigationRPC.js +++ b/ffw/NavigationRPC.js @@ -175,58 +175,6 @@ FFW.Navigation = FFW.RPCObserver.create( } } }, - isPng:function(params){ - var returnValue=true; - if(params.nextTurnIcon){ - var image = params.nextTurnIcon.value; - var search_offset = image.lastIndexOf('.'); - str='.png'; - var isPng=image.includes(str, search_offset); - if(!isPng){ - delete params.nextTurnIcon; - returnValue=false; - } - } - if(params.turnIcon){ - var image = params.turnIcon.value; - var search_offset = image.lastIndexOf('.'); - str='.png'; - var isPng=image.includes(str, search_offset); - if(!isPng){ - delete params.turnIcon; - returnValue=false; - } - } - if(params.turnList){ - var countList=params.turnList.length; - for(var i=0;i Date: Wed, 22 Apr 2020 02:00:03 +0300 Subject: [PATCH 04/11] Fix AlertManeuverPopUp response --- app/view/sdl/AlertManeuverPopUp.js | 40 +++++++++++++++++++++++++++--- 1 file changed, 37 insertions(+), 3 deletions(-) diff --git a/app/view/sdl/AlertManeuverPopUp.js b/app/view/sdl/AlertManeuverPopUp.js index e257bbab8..bbc2d7bcb 100644 --- a/app/view/sdl/AlertManeuverPopUp.js +++ b/app/view/sdl/AlertManeuverPopUp.js @@ -159,28 +159,62 @@ SDL.AlertManeuverPopUp = Em.ContainerView.create( } } }, + + /** + * @desc Defines whether icons paths verified successfully. + */ + iconsAreValid: false, + AlertManeuverActive: function(message) { this.get('softbuttons.childViews').removeObjects( this.get('softbuttons.childViews').filterProperty('softButtonID') ); var params = message.params; + var imageList = []; if (params.softButtons) { this.addSoftButtons( params.softButtons ); + for(var i = 0; i < params.softButtons.length; i++) { + if(params.softButtons[i].image) { + imageList.push(params.softButtons[i].image.value); + } + } + } + + var callback = function(failed) { + if(!failed) { + SDL.AlertManeuverPopUp.iconsAreValid = true; + } } + SDL.SDLModel.validateImages(message.id, callback, imageList); + this.set( 'activate', true ); clearTimeout( this.timer ); var self = this; this.timer = setTimeout( function() { - self.set( 'activate', false ); + self.set( 'activate', false ); + + var WARNINGS = SDL.SDLModel.data.resultCode.WARNINGS; + var SUCCESS = SDL.SDLModel.data.resultCode.SUCCESS; + + if(!SDL.AlertManeuverPopUp.iconsAreValid) { FFW.Navigation.sendNavigationResult( - SDL.SDLModel.data.resultCode.SUCCESS, + SDL.AlertManeuverPopUp.iconsAreValid ? SUCCESS : WARNINGS, message.id, - message.method + message.method, + SDL.AlertManeuverPopUp.iconsAreValid ? null : "Requested image(s) not found" ); + return; + } + + FFW.Navigation.sendNavigationResult( + SDL.SDLModel.data.resultCode.SUCCESS, + message.id, + message.method + ); }, 5000 ); } } From 5a194d20bf01377442af4ba1da30d1aadc20d195 Mon Sep 17 00:00:00 2001 From: YarikMamykin Date: Wed, 22 Apr 2020 02:07:22 +0300 Subject: [PATCH 05/11] Fix AddCommand + AddSubMenu response --- app/model/sdl/Abstract/AppModel.js | 46 +++++++++++++++++++++--------- ffw/UIRPC.js | 2 +- 2 files changed, 34 insertions(+), 14 deletions(-) diff --git a/app/model/sdl/Abstract/AppModel.js b/app/model/sdl/Abstract/AppModel.js index 89bc620f2..e0ab38e39 100644 --- a/app/model/sdl/Abstract/AppModel.js +++ b/app/model/sdl/Abstract/AppModel.js @@ -521,17 +521,26 @@ SDL.ABSAppModel = Em.Object.extend( } if(request.params.cmdIcon){ var image = request.params.cmdIcon.value; - var search_offset = image.lastIndexOf('.'); - str='.png'; - var isPng=image.includes(str, search_offset); - if(!isPng){ - FFW.UI.sendUIResult( - SDL.SDLModel.data.resultCode.WARNINGS, request.id, - request.method - ); + if(!SDL.NavigationController.isPng(image)) { + FFW.UI.sendUIResult( + SDL.SDLModel.data.resultCode.WARNINGS, request.id, + request.method); + return; + } + + var callback = function(failed) { + var WARNINGS = SDL.SDLModel.data.resultCode.WARNINGS; + var SUCCESS = SDL.SDLModel.data.resultCode.SUCCESS; + + FFW.UI.sendUIResult( + failed ? WARNINGS : SUCCESS, + request.id, + request.method, + failed ? "Requested image(s) not found" : null); + } + SDL.SDLModel.validateImages(request.id, callback, [image]); return; } - } if (request.id >= 0) { FFW.UI.sendUIResult( SDL.SDLModel.data.resultCode.SUCCESS, request.id, @@ -602,10 +611,21 @@ SDL.ABSAppModel = Em.Object.extend( SDL.SDLController.buttonsSort(parentID, this.appID); SDL.OptionsView.commands.refreshItems(); } - FFW.UI.sendUIResult( - SDL.SDLModel.data.resultCode.SUCCESS, request.id, - request.method - ); + var callback = function(failed) { + var WARNINGS = SDL.SDLModel.data.resultCode.WARNINGS; + var SUCCESS = SDL.SDLModel.data.resultCode.SUCCESS; + + FFW.UI.sendUIResult( + failed ? WARNINGS : SUCCESS, + request.id, + request.method, + failed ? "Requested image(s) not found" : null); + } + var imageList = []; + if(request.params.menuIcon) { + imageList.push(request.params.menuIcon.value); + } + SDL.SDLModel.validateImages(request.id, callback, imageList); } else { FFW.UI.sendError( SDL.SDLModel.data.resultCode.REJECTED, request.id, diff --git a/ffw/UIRPC.js b/ffw/UIRPC.js index ce4a1bea5..b2c8f9e11 100644 --- a/ffw/UIRPC.js +++ b/ffw/UIRPC.js @@ -318,7 +318,7 @@ FFW.UI = FFW.RPCObserver.create( var WARNINGS = SDL.SDLModel.data.resultCode.WARNINGS; var SUCCESS = SDL.SDLModel.data.resultCode.SUCCESS; - FFW.Navigation.sendUIResult( + FFW.Navigation.sendNavigationResult( failed ? WARNINGS : SUCCESS, request.id, request.method, From 6db7d34be80b44e1800ffb2966605ac9fe7fab82 Mon Sep 17 00:00:00 2001 From: YarikMamykin Date: Wed, 20 May 2020 23:12:44 +0300 Subject: [PATCH 06/11] Enhance image validation and fix RPCs 1. Create checkImagesInRequest function that simplifies validation of images. 2. Fix image validation for ScrollableMessage + PerformInteraction RPC --- app/model/sdl/Abstract/Model.js | 129 +++++++++++++++++++++----------- 1 file changed, 85 insertions(+), 44 deletions(-) diff --git a/app/model/sdl/Abstract/Model.js b/app/model/sdl/Abstract/Model.js index a9ea853f1..c27de5f08 100644 --- a/app/model/sdl/Abstract/Model.js +++ b/app/model/sdl/Abstract/Model.js @@ -973,23 +973,22 @@ SDL.SDLModel = Em.Object.extend({ request.params, messageRequestId ); } - if(request.params.softButtons) { - var imageList = []; - for(var i = 0; i < request.params.softButtons.length; i++) { - if(request.params.softButtons[i].image) { - imageList.push(request.params.softButtons[i].image.value); - } + + var callback = function(failed) { + if(failed) { + FFW.UI.sendUIResult(SDL.SDLModel.data.resultCode.WARNINGS, + request.id, + request.method, + "Requested image(s) not found"); } - var callback = function(failed) { - if(failed) { - FFW.UI.sendUIResult( - SDL.SDLModel.data.resultCode.WARNINGS, - request.id, - request.method, "Requested image(s) not found"); - } - }; - SDL.SDLModel.validateImages(request.id, callback, imageList); + }; + + if (!SDL.SDLModel.validateImagesInRequest(request.id, callback, [request.params.softButtons])) { + FFW.UI.sendUIResult(SDL.SDLModel.data.resultCode.WARNINGS, + request.id, + request.method); } + return true; } else { FFW.UI.sendError(SDL.SDLModel.data.resultCode.REJECTED, request.id, @@ -1033,6 +1032,53 @@ SDL.SDLModel = Em.Object.extend({ */ imageCheckList: {}, + /** + * @description Checks images in request provided inside 'objectsWithImages' param. + * @param requestID {Integer} Id of request + * @param callback {Function} User defined callback + * @param objectsWithImages {Array} Array of data structures, specific to request, + * that contain images. + * @return {Boolean} Returns true, if all images have valid extension. + * Returns false, if at least 1 image has invalid extension. + */ + validateImagesInRequest: function(requestID, callback, objectsWithImages) { + if (!Array.isArray(objectsWithImages) || + (Array.isArray(objectsWithImages) && objectsWithImages.length == 0)) { + return false; + } + + var imageList = []; + var allImagesValid = true; + + var checkExtension = function(img) { + if(!img) { + return; + } + if(img.isTemplate && !SDL.NavigationController.isPng(img.value)) { + allImagesValid = false; + return; + } + imageList.push(img.value); + } + + objectsWithImages.forEach(objWithImage => { + if(Array.isArray(objWithImage)) { + objWithImage.forEach(img => { + checkExtension(img.image); + }); + } else { + checkExtension(objWithImage); + } + }); + + if(!allImagesValid) { + return false; + } + + this.validateImages(requestID, callback, imageList); + return true; + }, + /** * @function validateImages * @description Checks if image exists by path provided in request data @@ -1266,38 +1312,33 @@ SDL.SDLModel = Em.Object.extend({ SDL.InteractionChoicesView.cancelID = message.params.cancelID; - if (message.params && message.params.choiceSet != null) { - imageList = []; - if(message.params.vrHelp) { - for(var i = 0; i < message.params.vrHelp.length; i++) { - var image = message.params.vrHelp[i].image; - if(image) { - imageList.push(image.value); - } - } - } - if(message.params.choiceSet) { - for(var i = 0; i < message.params.choiceSet.length; i++) { - var image = message.params.choiceSet[i].image; - if(image) { - imageList.push(image.value); - } - } + if (message.params && message.params.choiceSet == null) { + FFW.UI.sendUIResult(SDL.SDLModel.data.resultCode.SUCCESS, + message.id, 'UI.PerformInteraction'); + return true; + } + + var callback = function(failed) { + var WARNINGS = SDL.SDLModel.data.resultCode.WARNINGS; + var SUCCESS = SDL.SDLModel.data.resultCode.SUCCESS; + + SDL.InteractionChoicesView.imageCheckInfo.resultCode = failed ? WARNINGS : SUCCESS; + SDL.InteractionChoicesView.imageCheckInfo.info = failed ? "Requested image(s) not found" : null; + } + + var imagesToCheck = []; + imagesToCheck.push(message.params.vrHelp); + message.params.choiceSet.forEach(choice => { + if(choice.image) { + imagesToCheck.push(choice.image); } - - var callback = function(failed) { - var WARNINGS = SDL.SDLModel.data.resultCode.WARNINGS; - var SUCCESS = SDL.SDLModel.data.resultCode.SUCCESS; - - FFW.UI.sendUIResult( - failed ? WARNINGS : SUCCESS, - message.id, - message.method, - failed ? "Requested image(s) not found" : null); + if(choice.secondaryImage) { + imagesToCheck.push(choice.secondaryImage); } - SDL.SDLModel.validateImages(message.id, callback, imageList); + }); - return true; + if (!SDL.SDLModel.validateImagesInRequest(message.id, callback, imagesToCheck)) { + SDL.InteractionChoicesView.imageCheckInfo.resultCode = SDL.SDLModel.data.resultCode.WARNINGS; } SDL.SDLController.getApplicationModel(message.params.appID) From be5d0fef11fa2b401e4592bf984765c1e6bfb2bb Mon Sep 17 00:00:00 2001 From: YarikMamykin Date: Wed, 20 May 2020 23:16:06 +0300 Subject: [PATCH 07/11] Fix Show + Alert RPCs --- ffw/UIRPC.js | 35 ++++++++++++++++------------------- 1 file changed, 16 insertions(+), 19 deletions(-) diff --git a/ffw/UIRPC.js b/ffw/UIRPC.js index b2c8f9e11..0dd9b081b 100644 --- a/ffw/UIRPC.js +++ b/ffw/UIRPC.js @@ -180,6 +180,7 @@ FFW.UI = FFW.RPCObserver.create( // this.errorResponsePull[request.id].type + " type. Request was // not processed."); this.errorResponsePull[request.id] = null; // return; } } + if (SDL.SDLModel.onUIAlert(request.params, request.id)) { SDL.SDLController.onSystemContextChange(request.params.appID); } @@ -245,22 +246,6 @@ FFW.UI = FFW.RPCObserver.create( } SDL.InfoAppsView.showAppList(); - imageList = []; - if(request.params.graphic) { - imageList.push(request.params.graphic.value); - } - if(request.params.secondaryGraphic) { - imageList.push(request.params.secondaryGraphic.value); - } - if(request.params.softButtons) { - for(var i = 0; i < request.params.softButtons.length; i++) { - var image = request.params.softButtons[i].image; - if(image) { - imageList.push(image.value); - } - } - } - var callback = function(failed) { var WARNINGS = SDL.SDLModel.data.resultCode.WARNINGS; var SUCCESS = SDL.SDLModel.data.resultCode.SUCCESS; @@ -271,7 +256,14 @@ FFW.UI = FFW.RPCObserver.create( request.method, failed ? "Requested image(s) not found" : null); } - SDL.SDLModel.validateImages(request.id, callback, imageList); + + if (!SDL.SDLModel.validateImagesInRequest(request.id, callback, + [request.params.graphic, request.params.secondaryGraphic, request.params.softButtons])) { + FFW.UI.sendUIResult( + SDL.SDLModel.data.resultCode.WARNINGS, + request.id, + request.method); + } if (sendCapabilityUpdated) { let capability = SDL.SDLController.getDefaultCapabilities(request.params.windowID, request.params.appID); @@ -1852,7 +1844,7 @@ FFW.UI = FFW.RPCObserver.create( * @param {String} manualTextEntry */ interactionResponse: function(requestID, resultCode, commandID, - manualTextEntry) { + manualTextEntry, additionalInfo) { Em.Logger.log('FFW.UI.PerformInteractionResponse'); if (this.errorResponsePull[requestID] && resultCode === SDL.SDLModel.data.resultCode.SUCCESS) { @@ -1880,7 +1872,9 @@ FFW.UI = FFW.RPCObserver.create( this.errorResponsePull[requestID] = null; return; } - if (resultCode === SDL.SDLModel.data.resultCode.SUCCESS) { + + if (resultCode === SDL.SDLModel.data.resultCode.SUCCESS || + resultCode === SDL.SDLModel.data.resultCode.WARNINGS) { // send repsonse var JSONMessage = { 'jsonrpc': '2.0', @@ -1896,6 +1890,9 @@ FFW.UI = FFW.RPCObserver.create( if (manualTextEntry != null) { JSONMessage.result.manualTextEntry = manualTextEntry; } + if (additionalInfo != null || additionalInfo != '') { + JSONMessage.result.info = additionalInfo; + } } else { // send repsonse var JSONMessage = { From 590be89063870a574c31c31ced1129ba03aa4eea Mon Sep 17 00:00:00 2001 From: YarikMamykin Date: Wed, 20 May 2020 23:16:22 +0300 Subject: [PATCH 08/11] Fix AlertManeuver RPC --- app/view/sdl/AlertManeuverPopUp.js | 46 +++++++++--------------------- 1 file changed, 13 insertions(+), 33 deletions(-) diff --git a/app/view/sdl/AlertManeuverPopUp.js b/app/view/sdl/AlertManeuverPopUp.js index bbc2d7bcb..7dc97e1d1 100644 --- a/app/view/sdl/AlertManeuverPopUp.js +++ b/app/view/sdl/AlertManeuverPopUp.js @@ -160,35 +160,11 @@ SDL.AlertManeuverPopUp = Em.ContainerView.create( } }, - /** - * @desc Defines whether icons paths verified successfully. - */ - iconsAreValid: false, - AlertManeuverActive: function(message) { this.get('softbuttons.childViews').removeObjects( this.get('softbuttons.childViews').filterProperty('softButtonID') ); - var params = message.params; - var imageList = []; - if (params.softButtons) { - this.addSoftButtons( params.softButtons ); - for(var i = 0; i < params.softButtons.length; i++) { - if(params.softButtons[i].image) { - imageList.push(params.softButtons[i].image.value); - } - } - } - - var callback = function(failed) { - if(!failed) { - SDL.AlertManeuverPopUp.iconsAreValid = true; - } - } - - SDL.SDLModel.validateImages(message.id, callback, imageList); - this.set( 'activate', true ); clearTimeout( this.timer ); @@ -200,21 +176,25 @@ SDL.AlertManeuverPopUp = Em.ContainerView.create( var WARNINGS = SDL.SDLModel.data.resultCode.WARNINGS; var SUCCESS = SDL.SDLModel.data.resultCode.SUCCESS; - if(!SDL.AlertManeuverPopUp.iconsAreValid) { + var callback = function(failed) { + var errorInfo = null; + + if(failed) { + errorInfo = "Requested image(s) not found"; + } + FFW.Navigation.sendNavigationResult( - SDL.AlertManeuverPopUp.iconsAreValid ? SUCCESS : WARNINGS, + failed ? WARNINGS : SUCCESS, message.id, message.method, - SDL.AlertManeuverPopUp.iconsAreValid ? null : "Requested image(s) not found" + errorInfo ); - return; } - FFW.Navigation.sendNavigationResult( - SDL.SDLModel.data.resultCode.SUCCESS, - message.id, - message.method - ); + if(!SDL.SDLModel.validateImagesInRequest(message.id, callback, [message.params.softButtons])) { + FFW.Navigation.sendNavigationResult(WARNINGS, message.id, message.method); + } + }, 5000 ); } } From 4b156039bfb3e91f9509c66aea98e3150439b22d Mon Sep 17 00:00:00 2001 From: YarikMamykin Date: Wed, 20 May 2020 23:16:49 +0300 Subject: [PATCH 09/11] Fix SendLocation RPC --- app/controller/NavigationController.js | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/app/controller/NavigationController.js b/app/controller/NavigationController.js index 94c68e6c5..e001674ef 100644 --- a/app/controller/NavigationController.js +++ b/app/controller/NavigationController.js @@ -64,11 +64,6 @@ SDL.NavigationController = Em.Object.create( } ); - imageList = []; - if(request.params.locationImage) { - imageList.push(request.params.locationImage.value); - } - var callback = function(failed) { var WARNINGS = SDL.SDLModel.data.resultCode.WARNINGS; var SUCCESS = SDL.SDLModel.data.resultCode.SUCCESS; @@ -80,8 +75,16 @@ SDL.NavigationController = Em.Object.create( failed ? "Requested image(s) not found" : null ); } - SDL.SDLModel.validateImages(request.id, callback, imageList); + + if (!SDL.SDLModel.validateImagesInRequest(request.id, callback, [request.params.locationImage])) { + FFW.Navigation.sendNavigationResult( + SDL.SDLModel.data.resultCode.WARNINGS, + request.id, + request.method + ); + } }, + /** * Navigation view List Button action handler * Opens selected WayPoint structure From d17415d208ce9cb9b969e24fa5090d9df6539657 Mon Sep 17 00:00:00 2001 From: YarikMamykin Date: Wed, 3 Jun 2020 12:43:28 +0300 Subject: [PATCH 10/11] Fix alert RPC --- app/view/sdl/AlertPopUp.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/app/view/sdl/AlertPopUp.js b/app/view/sdl/AlertPopUp.js index bca7928ef..83b89c27d 100644 --- a/app/view/sdl/AlertPopUp.js +++ b/app/view/sdl/AlertPopUp.js @@ -274,6 +274,17 @@ SDL.AlertPopUp = Em.ContainerView.create( // popUp this.set('priority', priority); clearTimeout(this.timer); + + var callback = function(failed) { + self.reason = 'WARNINGS'; + self.message = failed ? "Requested image(s) not found" : null; + } + + if(!SDL.SDLModel.validateImagesInRequest(alertRequestId, callback, [message.alertIcon, message.softButtons])) { + self.reason = 'WARNINGS'; + self.message = null; + } + this.timer = setTimeout( function() { self.deactivate(self.reason, self.message); From bff2ac3ccfaa42a4a464e694d19ce3015fa81913 Mon Sep 17 00:00:00 2001 From: YarikMamykin Date: Thu, 4 Jun 2020 13:12:30 +0300 Subject: [PATCH 11/11] Fix PerformInteraction RPC --- app/controller/sdl/Abstract/Controller.js | 4 ++-- app/view/sdl/shared/interactionChoicesView.js | 17 ++++++++++++----- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/app/controller/sdl/Abstract/Controller.js b/app/controller/sdl/Abstract/Controller.js index 5364fc12d..02e28f3ec 100644 --- a/app/controller/sdl/Abstract/Controller.js +++ b/app/controller/sdl/Abstract/Controller.js @@ -730,11 +730,11 @@ SDL.SDLController = Em.Object.extend( * Method to sent notification ABORTED for PerformInteractionChoise */ interactionChoiseCloseResponse: function(appID, result, choiceID, - manualTextEntry) { + manualTextEntry, additionalInfo) { FFW.UI.interactionResponse( SDL.SDLController.getApplicationModel( appID - ).activeRequests.uiPerformInteraction, result, choiceID, manualTextEntry + ).activeRequests.uiPerformInteraction, result, choiceID, manualTextEntry, additionalInfo ); SDL.SDLModel.data.set('interactionData.vrHelpTitle', null); SDL.SDLModel.data.set('interactionData.vrHelp', null); diff --git a/app/view/sdl/shared/interactionChoicesView.js b/app/view/sdl/shared/interactionChoicesView.js index fc94b0546..fd3b36ec6 100644 --- a/app/view/sdl/shared/interactionChoicesView.js +++ b/app/view/sdl/shared/interactionChoicesView.js @@ -160,6 +160,12 @@ SDL.InteractionChoicesView = SDL.SDLAbstractView.create( ); } }.observes('this.input.value'), + + imageCheckInfo: { + resultCode: SDL.SDLModel.data.resultCode.SUCCESS, + info: '' + }, + /** * Activate window and set caption text * @@ -275,23 +281,24 @@ SDL.InteractionChoicesView = SDL.SDLAbstractView.create( case 'TIMED_OUT': { SDL.SDLController.interactionChoiseCloseResponse( - this.appID, SDL.SDLModel.data.resultCode['TIMED_OUT'] + this.appID, SDL.SDLModel.data.resultCode['TIMED_OUT'], + null, SDL.InteractionChoicesView.imageCheckInfo.info ); break; } case 'SUCCESS': { SDL.SDLController.interactionChoiseCloseResponse( - this.appID, SDL.SDLModel.data.resultCode.SUCCESS, choiceID, - this.input.value + this.appID, SDL.InteractionChoicesView.imageCheckInfo.resultCode, + choiceID, this.input.value,SDL.InteractionChoicesView.imageCheckInfo.info ); break; } case 'WARNINGS': { SDL.SDLController.interactionChoiseCloseResponse( - this.appID, SDL.SDLModel.data.resultCode.WARNINGS, choiceID, - this.input.value + this.appID, SDL.SDLModel.data.resultCode.WARNINGS, + choiceID, this.input.value, SDL.InteractionChoicesView.imageCheckInfo.info ); break; }