* VRFS-1788 - adding simple 'loop detection' logic

This commit is contained in:
Seth Call 2014-06-15 21:42:57 -05:00
parent 526dc3a512
commit f1bb30ea0d
2 changed files with 30 additions and 11 deletions

View File

@ -31,6 +31,7 @@
var vuOptions = null;
var faderHeight = null;
var startingState = null;
var resettedOnInvalidDevice = false; // this is set to true when we clear chat, and set to false when the user interacts in anyway
function defaultReuse() {
suppressChange(function(){
@ -45,12 +46,22 @@
function onInvalidAudioDevice(e, data) {
logger.debug("voice_chat_helper: onInvalidAudioDevice")
if(resettedOnInvalidDevice) {
// we've already tried to clear the audio device, and the user hasn't interacted, but still we are getting this event
// we can't keep taking action, so stop
logger.error("voice_chat_helper: onInvalidAudioDevice: ignoring event because we have already tried to handle it");
return;
}
resettedOnInvalidDevice = true;
$selectedChatInput = null;
// you can't do this in the event callback; it hangs the app indefinitely, and somehow 'sticks' the mic input into bad state until reboot
setTimeout(function() {
context.jamClient.FTUEClearChatInput();
context.jamClient.TrackSetChatEnable(true);
var result = context.jamClient.TrackSaveAssignments();
if(!result || result.length == 0) {
context.JK.Banner.showAlert('It appears the selected chat input is not functioning. Please try another chat input.');
}
@ -61,6 +72,7 @@
}
function beforeShow() {
userInteracted();
renderNoVolume();
context.JK.onBackendEvent(ALERT_NAMES.AUDIO_DEVICE_NOT_PRESENT, 'voice_chat_helper', onInvalidAudioDevice);
registerVuCallbacks();
@ -70,6 +82,10 @@
jamClient.FTUERegisterVUCallbacks('', '', '');
}
function userInteracted() {
resettedOnInvalidDevice = false;
}
function reset(forceDisabledChat) {
$selectedChatInput = null;
@ -98,12 +114,13 @@
$selectedChatInput = $chatInput;
$selectedChatInput.attr('checked', 'checked');
}
$chat.hide(); // we'll show it once it's styled with iCheck
//$chat.hide(); // we'll show it once it's styled with iCheck
$chatInputs.append($chat);
});
var $radioButtons = $chatInputs.find('input[name="chat-device"]');
context.JK.checkbox($radioButtons).on('ifChecked', function(e) {
userInteracted();
var $input = $(e.currentTarget);
$selectedChatInput = $input; // for use in handleNext
if(saveImmediate) {
@ -136,13 +153,6 @@
disableChatButtonsUI();
}
$chatInputs.find('.chat-input').show().on('click', function() {
// obnoxious; remove soon XXX
// if(!isChatEnabled()) {
// context.JK.prodBubble($parent.find('.use-chat-input h3'), 'chat-not-enabled', {}, { positions:['left']});
// }
})
renderVolumes();
startingState = getCurrentState();
@ -246,8 +256,18 @@
$reuseAudioInputRadio.closest('.iradio_minimal').css('position', 'absolute');
$useChatInputRadio.closest('.iradio_minimal').css('position', 'absolute');
$reuseAudioInputRadio.on('ifChecked', function() { if(!ignoreICheckEvent) disableChat(true) });
$useChatInputRadio.on('ifChecked', function() { if(!ignoreICheckEvent) enableChat(true) });
$reuseAudioInputRadio.on('ifChecked', function() {
if(!ignoreICheckEvent) {
userInteracted();
disableChat(true);
}
});
$useChatInputRadio.on('ifChecked', function() {
if(!ignoreICheckEvent) {
userInteracted();
enableChat(true)
}
});
}
// gets the state of the UI

View File

@ -248,7 +248,6 @@
}
})
logger.debug("chatInputs:", chatInputs)
return chatInputs;
}