GUAC-1053: Unless overridden, default to "text" input mode if platform likely lacks a physical keyboard.

This commit is contained in:
Michael Jumper
2015-04-19 22:19:09 -07:00
parent 0785db0953
commit 21d3e4550b

View File

@@ -58,7 +58,7 @@ angular.module('settings').factory('preferenceService', ['$injector',
*
* @type String
*/
inputMethod : 'none'
inputMethod : null
};
@@ -88,6 +88,17 @@ angular.module('settings').factory('preferenceService', ['$injector',
}
catch (ignore) {}
// Choose reasonable default input method based on best-guess at platform
if (service.preferences.inputMethod === null) {
// Use text input by default if platform likely lacks physical keyboard
if (/android|ipad|iphone/i.test(navigator.userAgent))
service.preferences.inputMethod = 'text';
else
service.preferences.inputMethod = 'none';
}
// Persist settings when window is unloaded
$window.addEventListener('unload', service.save);