Skip to content

Commit

Permalink
Bug fixes for the AlanButton: improve NO_VOICE_SUPPORT message, fix b…
Browse files Browse the repository at this point in the history
…ug with drag-n-drop on mobile, fix bug with button timeout
  • Loading branch information
annmirosh committed Dec 17, 2020
1 parent a44e1d9 commit 8520d04
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 26 deletions.
48 changes: 24 additions & 24 deletions dist/alan_lib.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,11 @@
_handleQueue();
};

ns.playCommand = function(command) {
audioQueue.push({event: command});
_handleQueue();
};

ns.playEvent = function(event) {
audioQueue.push({event: event});
_handleQueue();
Expand Down Expand Up @@ -586,7 +591,7 @@ function alanBtn(options) {

// Error messages
var MIC_BLOCKED_MSG = 'Access to the microphone was blocked. Please allow it to use Alan';
var NO_VOICE_SUPPORT_IN_BROWSER_MSG = 'Your browser doesn’t support voice input. To use voice, try it in the Chrome, Safari, or Firefox desktop browser window. If you think your browser supports voice input, please send the Debug info below to [email protected]. ' + getDebugInfo();
var NO_VOICE_SUPPORT_IN_BROWSER_MSG = 'Your browser doesn’t support voice input. If you think your browser supports voice input, please send the Debug info below to [email protected]. ' + getDebugInfo();
var NOT_SECURE_ORIGIN_MSG = 'Audio is allowed only on the secure connection: make sure that your connection protocol is under https, file or http with localhost. Now you are running with "' + window.location.protocol + '" protocol and "' + window.location.hostname + '" hostname';
var LOW_VOLUME_MSG = 'Low volume level';
var OFFLINE_MSG = 'You\'re offline';
Expand Down Expand Up @@ -1854,7 +1859,7 @@ function alanBtn(options) {
showSpeach2TextPanel();
}

if (data && data.web && data.web.timeout ) {
if (data && data.web && data.web.timeout !== undefined ) {
turnOffTimeout = data.web.timeout;
setTurnOffVoiceTimeout();
}
Expand Down Expand Up @@ -2349,41 +2354,37 @@ function alanBtn(options) {
function getDebugInfo() {
var info = '\nDebug Info:\n';

info += 'getUserMedia - ';
info += 'getUserMedia: ';
info += navigator.getUserMedia ? 'true' : 'false';
info += '\n';
info += ' ';

info += 'mediaDevices.getUserMedia - ';
info += '(mediaDevices.getUserMedia: ';
info += (navigator.mediaDevices && navigator.mediaDevices.getUserMedia) ? 'true' : 'false';
info += '\n';
info += ', ';

info += 'webkitGetUserMedia - ';
info += 'webkit: ';
info += navigator.webkitGetUserMedia ? 'true' : 'false';
info += '\n';
info += ', ';

info += 'mozGetUserMedia - ';
info += 'moz: ';
info += navigator.mozGetUserMedia ? 'true' : 'false';
info += '\n';
info += ', ';

info += 'msGetUserMedia - ';
info += 'ms: ';
info += navigator.msGetUserMedia ? 'true' : 'false';
info += '\n';
info += '), ';

info += 'AudioContext - ';
info += 'AudioContext: ';
info += window.AudioContext ? 'true' : 'false';
info += '\n';
info += ' ';

info += 'webkitAudioContext - ';
info += '(webkit: ';
info += window.webkitAudioContext ? 'true' : 'false';
info += '\n';
info += ', ';

info += 'mozAudioContext - ';
info += 'moz: ';
info += window.mozAudioContext ? 'true' : 'false';
info += '\n';

info += 'mobile - ';
info += /Android|webOS|iPhone|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);
info += '\n';
info += '), ';

info += 'userAgent - ';
info += navigator.userAgent;
Expand Down Expand Up @@ -2525,9 +2526,8 @@ function alanBtn(options) {
}

function onMouseDown(e) {
console.info('onMouseDown', e);
var posInfo = e.touches ? e.touches[0] : e;
if (!dndBackAnimFinished || e.buttons !== 1) return;
if (!dndBackAnimFinished || (e.buttons !== undefined && e.buttons !== 1)) return;
dndIsDown = true;
rootEl.style.transition = '0ms';
if (!dndSideBtnPos) {
Expand Down
2 changes: 1 addition & 1 deletion dist/alan_lib.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@alan-ai/alan-sdk-web",
"version": "1.8.5",
"version": "1.8.6",
"description": "Alan Web SDK: a lightweight JavaScript library for adding a voice experience to your website or web application",
"keywords": [
"alan sdk web",
Expand Down

0 comments on commit 8520d04

Please sign in to comment.