From 60009208c0bd624cfd9571d0b2e7d66505702b82 Mon Sep 17 00:00:00 2001 From: Nuwan Date: Fri, 21 Jul 2023 18:32:40 +0530 Subject: [PATCH] fix for audio input port assignment this fix addresses the invalid input port assignment issue due to asynchronous nature of asyncjamClient method calls --- .../javascripts/wizard/gear/step_select_gear.js | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/web/app/assets/javascripts/wizard/gear/step_select_gear.js b/web/app/assets/javascripts/wizard/gear/step_select_gear.js index 0afd0f3c0..0a7741f19 100644 --- a/web/app/assets/javascripts/wizard/gear/step_select_gear.js +++ b/web/app/assets/javascripts/wizard/gear/step_select_gear.js @@ -71,6 +71,7 @@ var queueUpdateDeviceList = false; var cancelRescanFunc = null; var initialScan = false; + var skipAssertFTUEProfile = false; // returns a deviceInfo hash for the device matching the deviceId, or undefined. function findDevice(deviceId) { @@ -297,7 +298,7 @@ } async function inputChannelChanged($checkbox) { - + if (iCheckIgnore) return; await assertFTUEProfile(); @@ -1196,7 +1197,6 @@ iCheckIgnore = true; $allInputs.eq(0).iCheck('check').attr('checked', 'checked') iCheckIgnore = false; - var maxTries = 36; for(var i = 0; i < maxTries; i++) { var $assignedInputs = $inputChannels.find('input[type="checkbox"]:checked') @@ -1206,16 +1206,18 @@ break; } else { - $assignedInputs.each(function(index, item) { + $assignedInputs.each(async function(index, item) { var $node = $(item) if ($node.get(0) == firstInputDomNode) { logger.debug("skipping firstInputDomNode") } else { // the goal of this loop is to just uncheck one. once it's done that, it breaks the loop, so that assigned can be fetched again - iCheckIgnore = true; - $node.iCheck('uncheck').removeAttr('checked') - iCheckIgnore = false; + //$node.iCheck('uncheck').removeAttr('checked'); //uncheck and fires event + $node.prop('checked',false).iCheck('update'); //uncheck without firing event. + skipAssertFTUEProfile = true; + await inputChannelChanged($node); + skipAssertFTUEProfile = false; return false; } }) @@ -1327,6 +1329,7 @@ } async function assertFTUEProfile() { + if(skipAssertFTUEProfile) {return;} if(savedProfile) {return;} // once we save the profile, it's name no longer starts with FTUE var profileName = await context.jamClient.FTUEGetMusicProfileName(); if(profileName && profileName.indexOf('FTUE') != 0) {