@enact/webos 3.4.9-experimental-3 → 3.4.9-experimental-7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -0
- package/{build/LS2Request → LS2Request}/LS2Request.d.ts +0 -0
- package/LS2Request/LS2Request.js +228 -173
- package/LS2Request/tests/LS2Request-specs.js +85 -95
- package/{build/application → application}/application.d.ts +0 -0
- package/application/application.js +92 -70
- package/{build/deviceinfo → deviceinfo}/deviceinfo.d.ts +0 -0
- package/deviceinfo/deviceinfo.js +78 -62
- package/{build/index.d.ts → index.d.ts} +0 -0
- package/index.js +1 -0
- package/{build/keyboard → keyboard}/keyboard.d.ts +0 -0
- package/keyboard/keyboard.js +11 -4
- package/package.json +2 -2
- package/{build/platform → platform}/platform.d.ts +0 -0
- package/platform/platform.js +67 -65
- package/{build/pmloglib → pmloglib}/pmloglib.d.ts +0 -0
- package/pmloglib/pmloglib.js +116 -86
- package/speech/VoiceControlDecorator.js +99 -42
- package/{build/speech → speech}/index.d.ts +0 -0
- package/speech/index.js +23 -15
- package/speech/readAlert.js +78 -60
- package/build/CHANGELOG.md +0 -603
- package/build/LS2Request/LS2Request.js +0 -239
- package/build/LS2Request/package.json +0 -3
- package/build/LS2Request/tests/LS2Request-specs.js +0 -85
- package/build/README.md +0 -22
- package/build/application/application.js +0 -150
- package/build/application/package.json +0 -3
- package/build/deviceinfo/deviceinfo.js +0 -114
- package/build/deviceinfo/package.json +0 -3
- package/build/index.js +0 -2
- package/build/keyboard/keyboard.js +0 -27
- package/build/keyboard/package.json +0 -3
- package/build/package-lock.json +0 -221
- package/build/package.json +0 -33
- package/build/platform/package.json +0 -3
- package/build/platform/platform.js +0 -105
- package/build/pmloglib/package.json +0 -3
- package/build/pmloglib/pmloglib.js +0 -241
- package/build/speech/VoiceControlDecorator.js +0 -152
- package/build/speech/index.js +0 -23
- package/build/speech/package.json +0 -3
- package/build/speech/readAlert.js +0 -96
- package/docs/index.md +0 -8
- package/docs/luna-service-api.md +0 -35
- package/docs/webos-features.md +0 -37
package/pmloglib/pmloglib.js
CHANGED
|
@@ -1,4 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.perfLog = exports.debug = exports.info = exports.notice = exports.warning = exports.error = exports.critical = exports.alert = exports.emergency = void 0;
|
|
7
|
+
|
|
1
8
|
/* eslint-disable no-console */
|
|
9
|
+
|
|
2
10
|
/**
|
|
3
11
|
* Provides a wrapper around PmLogLib logging API
|
|
4
12
|
*
|
|
@@ -13,47 +21,53 @@
|
|
|
13
21
|
* @exports debug
|
|
14
22
|
* @exports perfLog
|
|
15
23
|
*/
|
|
16
|
-
|
|
17
24
|
// Log level constants
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
// Log function stringifies and escapes keyVals, and passes to PmLogString
|
|
30
|
-
const log = (level, messageId, keyVals, freeText) => {
|
|
31
|
-
if (typeof window !== 'undefined' && window.PalmSystem) {
|
|
32
|
-
if (keyVals && !isObject(keyVals)) {
|
|
33
|
-
level = levelError;
|
|
34
|
-
keyVals = {msgid: messageId};
|
|
35
|
-
messageId = 'MISMATCHED_FMT';
|
|
36
|
-
freeText = null;
|
|
37
|
-
console.warn('webOSLog called with invalid format: keyVals must be an object');
|
|
38
|
-
}
|
|
39
|
-
if (!messageId && level !== levelDebug) {
|
|
40
|
-
console.warn('webOSLog called with invalid format: messageId was empty');
|
|
41
|
-
}
|
|
42
|
-
if (keyVals) {
|
|
43
|
-
keyVals = JSON.stringify(keyVals);
|
|
44
|
-
}
|
|
45
|
-
if (window.PalmSystem.PmLogString) {
|
|
46
|
-
if (level === levelDebug) { // debug only accepts 2 arguments
|
|
47
|
-
window.PalmSystem.PmLogString(level, null, null, freeText);
|
|
48
|
-
} else {
|
|
49
|
-
window.PalmSystem.PmLogString(level, messageId, keyVals, freeText);
|
|
50
|
-
}
|
|
51
|
-
} else {
|
|
52
|
-
console.error('Unable to send log: PmLogString not found in this version of PalmSystem');
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
};
|
|
25
|
+
var levelEmergency = 0;
|
|
26
|
+
var levelAlert = 1;
|
|
27
|
+
var levelCritical = 2;
|
|
28
|
+
var levelError = 3;
|
|
29
|
+
var levelWarning = 4;
|
|
30
|
+
var levelNotice = 5;
|
|
31
|
+
var levelInfo = 6;
|
|
32
|
+
var levelDebug = 7;
|
|
33
|
+
|
|
34
|
+
var isObject = function isObject(obj) {
|
|
35
|
+
return !!obj && typeof obj === 'object' && Object.prototype.toString.call(obj) !== '[object Array]';
|
|
36
|
+
}; // Log function stringifies and escapes keyVals, and passes to PmLogString
|
|
56
37
|
|
|
38
|
+
|
|
39
|
+
var log = function log(level, messageId, keyVals, freeText) {
|
|
40
|
+
if (typeof window !== 'undefined' && window.PalmSystem) {
|
|
41
|
+
if (keyVals && !isObject(keyVals)) {
|
|
42
|
+
level = levelError;
|
|
43
|
+
keyVals = {
|
|
44
|
+
msgid: messageId
|
|
45
|
+
};
|
|
46
|
+
messageId = 'MISMATCHED_FMT';
|
|
47
|
+
freeText = null;
|
|
48
|
+
console.warn('webOSLog called with invalid format: keyVals must be an object');
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
if (!messageId && level !== levelDebug) {
|
|
52
|
+
console.warn('webOSLog called with invalid format: messageId was empty');
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
if (keyVals) {
|
|
56
|
+
keyVals = JSON.stringify(keyVals);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
if (window.PalmSystem.PmLogString) {
|
|
60
|
+
if (level === levelDebug) {
|
|
61
|
+
// debug only accepts 2 arguments
|
|
62
|
+
window.PalmSystem.PmLogString(level, null, null, freeText);
|
|
63
|
+
} else {
|
|
64
|
+
window.PalmSystem.PmLogString(level, messageId, keyVals, freeText);
|
|
65
|
+
}
|
|
66
|
+
} else {
|
|
67
|
+
console.error('Unable to send log: PmLogString not found in this version of PalmSystem');
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
};
|
|
57
71
|
/**
|
|
58
72
|
* Logs with PmLogLib at the "emergency" level.
|
|
59
73
|
*
|
|
@@ -65,10 +79,11 @@ const log = (level, messageId, keyVals, freeText) => {
|
|
|
65
79
|
* @memberof webos/pmloglib
|
|
66
80
|
* @public
|
|
67
81
|
*/
|
|
68
|
-
const emergency = (messageId, keyVals, freeText) => {
|
|
69
|
-
log(levelEmergency, messageId, keyVals, freeText);
|
|
70
|
-
};
|
|
71
82
|
|
|
83
|
+
|
|
84
|
+
var emergency = function emergency(messageId, keyVals, freeText) {
|
|
85
|
+
log(levelEmergency, messageId, keyVals, freeText);
|
|
86
|
+
};
|
|
72
87
|
/**
|
|
73
88
|
* Logs with PmLogLib at the "alert" level.
|
|
74
89
|
*
|
|
@@ -80,10 +95,13 @@ const emergency = (messageId, keyVals, freeText) => {
|
|
|
80
95
|
* @memberof webos/pmloglib
|
|
81
96
|
* @public
|
|
82
97
|
*/
|
|
83
|
-
const alert = (messageId, keyVals, freeText) => {
|
|
84
|
-
log(levelAlert, messageId, keyVals, freeText);
|
|
85
|
-
};
|
|
86
98
|
|
|
99
|
+
|
|
100
|
+
exports.emergency = emergency;
|
|
101
|
+
|
|
102
|
+
var alert = function alert(messageId, keyVals, freeText) {
|
|
103
|
+
log(levelAlert, messageId, keyVals, freeText);
|
|
104
|
+
};
|
|
87
105
|
/**
|
|
88
106
|
* Logs with PmLogLib at the "critical" level.
|
|
89
107
|
*
|
|
@@ -95,10 +113,13 @@ const alert = (messageId, keyVals, freeText) => {
|
|
|
95
113
|
* @memberof webos/pmloglib
|
|
96
114
|
* @public
|
|
97
115
|
*/
|
|
98
|
-
const critical = (messageId, keyVals, freeText) => {
|
|
99
|
-
log(levelCritical, messageId, keyVals, freeText);
|
|
100
|
-
};
|
|
101
116
|
|
|
117
|
+
|
|
118
|
+
exports.alert = alert;
|
|
119
|
+
|
|
120
|
+
var critical = function critical(messageId, keyVals, freeText) {
|
|
121
|
+
log(levelCritical, messageId, keyVals, freeText);
|
|
122
|
+
};
|
|
102
123
|
/**
|
|
103
124
|
* Logs with PmLogLib at the "error" level.
|
|
104
125
|
*
|
|
@@ -110,10 +131,13 @@ const critical = (messageId, keyVals, freeText) => {
|
|
|
110
131
|
* @memberof webos/pmloglib
|
|
111
132
|
* @public
|
|
112
133
|
*/
|
|
113
|
-
const error = (messageId, keyVals, freeText) => {
|
|
114
|
-
log(levelError, messageId, keyVals, freeText);
|
|
115
|
-
};
|
|
116
134
|
|
|
135
|
+
|
|
136
|
+
exports.critical = critical;
|
|
137
|
+
|
|
138
|
+
var error = function error(messageId, keyVals, freeText) {
|
|
139
|
+
log(levelError, messageId, keyVals, freeText);
|
|
140
|
+
};
|
|
117
141
|
/**
|
|
118
142
|
* Logs with PmLogLib at the "warning" level.
|
|
119
143
|
*
|
|
@@ -125,10 +149,13 @@ const error = (messageId, keyVals, freeText) => {
|
|
|
125
149
|
* @memberof webos/pmloglib
|
|
126
150
|
* @public
|
|
127
151
|
*/
|
|
128
|
-
const warning = (messageId, keyVals, freeText) => {
|
|
129
|
-
log(levelWarning, messageId, keyVals, freeText);
|
|
130
|
-
};
|
|
131
152
|
|
|
153
|
+
|
|
154
|
+
exports.error = error;
|
|
155
|
+
|
|
156
|
+
var warning = function warning(messageId, keyVals, freeText) {
|
|
157
|
+
log(levelWarning, messageId, keyVals, freeText);
|
|
158
|
+
};
|
|
132
159
|
/**
|
|
133
160
|
* Logs with PmLogLib at the "notice" level.
|
|
134
161
|
*
|
|
@@ -140,10 +167,13 @@ const warning = (messageId, keyVals, freeText) => {
|
|
|
140
167
|
* @memberof webos/pmloglib
|
|
141
168
|
* @public
|
|
142
169
|
*/
|
|
143
|
-
const notice = (messageId, keyVals, freeText) => {
|
|
144
|
-
log(levelNotice, messageId, keyVals, freeText);
|
|
145
|
-
};
|
|
146
170
|
|
|
171
|
+
|
|
172
|
+
exports.warning = warning;
|
|
173
|
+
|
|
174
|
+
var notice = function notice(messageId, keyVals, freeText) {
|
|
175
|
+
log(levelNotice, messageId, keyVals, freeText);
|
|
176
|
+
};
|
|
147
177
|
/**
|
|
148
178
|
* Logs with PmLogLib at the "info" level.
|
|
149
179
|
*
|
|
@@ -155,10 +185,13 @@ const notice = (messageId, keyVals, freeText) => {
|
|
|
155
185
|
* @memberof webos/pmloglib
|
|
156
186
|
* @public
|
|
157
187
|
*/
|
|
158
|
-
const info = (messageId, keyVals, freeText) => {
|
|
159
|
-
log(levelInfo, messageId, keyVals, freeText);
|
|
160
|
-
};
|
|
161
188
|
|
|
189
|
+
|
|
190
|
+
exports.notice = notice;
|
|
191
|
+
|
|
192
|
+
var info = function info(messageId, keyVals, freeText) {
|
|
193
|
+
log(levelInfo, messageId, keyVals, freeText);
|
|
194
|
+
};
|
|
162
195
|
/**
|
|
163
196
|
* Logs with PmLogLib at the "debug" level.
|
|
164
197
|
*
|
|
@@ -168,10 +201,13 @@ const info = (messageId, keyVals, freeText) => {
|
|
|
168
201
|
* @memberof webos/pmloglib
|
|
169
202
|
* @public
|
|
170
203
|
*/
|
|
171
|
-
const debug = (freeText) => {
|
|
172
|
-
log(levelDebug, '', '', freeText);
|
|
173
|
-
};
|
|
174
204
|
|
|
205
|
+
|
|
206
|
+
exports.info = info;
|
|
207
|
+
|
|
208
|
+
var debug = function debug(freeText) {
|
|
209
|
+
log(levelDebug, '', '', freeText);
|
|
210
|
+
};
|
|
175
211
|
/**
|
|
176
212
|
* Places a time-stamped performance log entry into the system log using the `PmLogInfoWithClock()`
|
|
177
213
|
* method.
|
|
@@ -184,28 +220,22 @@ const debug = (freeText) => {
|
|
|
184
220
|
* @memberof webos/pmloglib
|
|
185
221
|
* @public
|
|
186
222
|
*/
|
|
187
|
-
const perfLog = (messageId, perfType, perfGroup) => {
|
|
188
|
-
if (typeof window !== 'undefined' && window.PalmSystem) {
|
|
189
|
-
if (!messageId) {
|
|
190
|
-
console.warn('PmLogInfoWithClock called with invalid format: messageId was empty');
|
|
191
|
-
}
|
|
192
|
-
if (window.PalmSystem.PmLogInfoWithClock) {
|
|
193
|
-
window.PalmSystem.PmLogInfoWithClock(messageId, perfType ? perfType : '',
|
|
194
|
-
perfGroup ? perfGroup : '');
|
|
195
|
-
} else {
|
|
196
|
-
console.error('Unable to send log: PmLogInfoWithClock not found in this version of PalmSystem');
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
};
|
|
200
223
|
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
224
|
+
|
|
225
|
+
exports.debug = debug;
|
|
226
|
+
|
|
227
|
+
var perfLog = function perfLog(messageId, perfType, perfGroup) {
|
|
228
|
+
if (typeof window !== 'undefined' && window.PalmSystem) {
|
|
229
|
+
if (!messageId) {
|
|
230
|
+
console.warn('PmLogInfoWithClock called with invalid format: messageId was empty');
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
if (window.PalmSystem.PmLogInfoWithClock) {
|
|
234
|
+
window.PalmSystem.PmLogInfoWithClock(messageId, perfType ? perfType : '', perfGroup ? perfGroup : '');
|
|
235
|
+
} else {
|
|
236
|
+
console.error('Unable to send log: PmLogInfoWithClock not found in this version of PalmSystem');
|
|
237
|
+
}
|
|
238
|
+
}
|
|
211
239
|
};
|
|
240
|
+
|
|
241
|
+
exports.perfLog = perfLog;
|
|
@@ -1,7 +1,45 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.VoiceControlDecorator = exports["default"] = void 0;
|
|
7
|
+
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
|
|
10
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
|
+
|
|
12
|
+
var _reactDom = require("react-dom");
|
|
13
|
+
|
|
14
|
+
var _hoc = _interopRequireDefault(require("@enact/core/hoc"));
|
|
15
|
+
|
|
16
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
17
|
+
|
|
18
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
|
|
19
|
+
|
|
20
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
21
|
+
|
|
22
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
23
|
+
|
|
24
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
25
|
+
|
|
26
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
27
|
+
|
|
28
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
|
29
|
+
|
|
30
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
31
|
+
|
|
32
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
33
|
+
|
|
34
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
35
|
+
|
|
36
|
+
function _possibleConstructorReturn(self, call) { if (call && (typeof call === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
|
|
37
|
+
|
|
38
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
39
|
+
|
|
40
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
|
|
41
|
+
|
|
42
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
5
43
|
|
|
6
44
|
/**
|
|
7
45
|
* VoiceControlDecorator is a higher-order component that adds a callback for voice event
|
|
@@ -54,42 +92,61 @@ import hoc from '@enact/core/hoc';
|
|
|
54
92
|
* @hoc
|
|
55
93
|
* @public
|
|
56
94
|
*/
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
* @type {Function}
|
|
66
|
-
* @required
|
|
67
|
-
* @public
|
|
68
|
-
*/
|
|
69
|
-
onVoice: PropTypes.func.isRequired
|
|
70
|
-
};
|
|
71
|
-
|
|
72
|
-
componentDidMount () {
|
|
73
|
-
this.node = findDOMNode(this); // eslint-disable-line
|
|
74
|
-
if (this.node && !(this.node.hasAttribute('data-webos-voice-event-target') || this.node.hasAttribute('data-webos-voice-intent'))) {
|
|
75
|
-
this.node = this.node.querySelector('[data-webos-voice-event-target]') || this.node.querySelector('[data-webos-voice-intent]');
|
|
76
|
-
}
|
|
77
|
-
if (this.node) this.node.addEventListener('webOSVoice', this.props.onVoice);
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
componentWillUnmount () {
|
|
81
|
-
if (this.node) this.node.removeEventListener('webOSVoice', this.props.onVoice);
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
render () {
|
|
85
|
-
const props = {...this.props};
|
|
86
|
-
delete props.onVoice;
|
|
87
|
-
return (<Wrapped {...props} />);
|
|
88
|
-
}
|
|
89
|
-
};
|
|
90
|
-
});
|
|
95
|
+
var VoiceControlDecorator = (0, _hoc["default"])(function (config, Wrapped) {
|
|
96
|
+
var _class, _temp;
|
|
97
|
+
|
|
98
|
+
// eslint-disable-line no-unused-vars
|
|
99
|
+
return _temp = _class = /*#__PURE__*/function (_React$Component) {
|
|
100
|
+
_inherits(_class, _React$Component);
|
|
101
|
+
|
|
102
|
+
var _super = _createSuper(_class);
|
|
91
103
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
104
|
+
function _class() {
|
|
105
|
+
_classCallCheck(this, _class);
|
|
106
|
+
|
|
107
|
+
return _super.apply(this, arguments);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
_createClass(_class, [{
|
|
111
|
+
key: "componentDidMount",
|
|
112
|
+
value: function componentDidMount() {
|
|
113
|
+
this.node = (0, _reactDom.findDOMNode)(this); // eslint-disable-line
|
|
114
|
+
|
|
115
|
+
if (this.node && !(this.node.hasAttribute('data-webos-voice-event-target') || this.node.hasAttribute('data-webos-voice-intent'))) {
|
|
116
|
+
this.node = this.node.querySelector('[data-webos-voice-event-target]') || this.node.querySelector('[data-webos-voice-intent]');
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
if (this.node) this.node.addEventListener('webOSVoice', this.props.onVoice);
|
|
120
|
+
}
|
|
121
|
+
}, {
|
|
122
|
+
key: "componentWillUnmount",
|
|
123
|
+
value: function componentWillUnmount() {
|
|
124
|
+
if (this.node) this.node.removeEventListener('webOSVoice', this.props.onVoice);
|
|
125
|
+
}
|
|
126
|
+
}, {
|
|
127
|
+
key: "render",
|
|
128
|
+
value: function render() {
|
|
129
|
+
var props = _objectSpread({}, this.props);
|
|
130
|
+
|
|
131
|
+
delete props.onVoice;
|
|
132
|
+
return /*#__PURE__*/_react["default"].createElement(Wrapped, props);
|
|
133
|
+
}
|
|
134
|
+
}]);
|
|
135
|
+
|
|
136
|
+
return _class;
|
|
137
|
+
}(_react["default"].Component), _class.displayName = 'VoiceControlDecorator', _class.propTypes =
|
|
138
|
+
/** @lends webos/speech.VoiceControlDecorator.prototype */
|
|
139
|
+
{
|
|
140
|
+
/**
|
|
141
|
+
* Callback to be executed when a wrapped element's `data-webos-voice-intent` is activated.
|
|
142
|
+
*
|
|
143
|
+
* @type {Function}
|
|
144
|
+
* @required
|
|
145
|
+
* @public
|
|
146
|
+
*/
|
|
147
|
+
onVoice: _propTypes["default"].func.isRequired
|
|
148
|
+
}, _temp;
|
|
149
|
+
});
|
|
150
|
+
exports.VoiceControlDecorator = VoiceControlDecorator;
|
|
151
|
+
var _default = VoiceControlDecorator;
|
|
152
|
+
exports["default"] = _default;
|
|
File without changes
|
package/speech/index.js
CHANGED
|
@@ -1,15 +1,23 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "readAlert", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function get() {
|
|
9
|
+
return _readAlert["default"];
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
Object.defineProperty(exports, "VoiceControlDecorator", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function get() {
|
|
15
|
+
return _VoiceControlDecorator["default"];
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
var _readAlert = _interopRequireDefault(require("./readAlert"));
|
|
20
|
+
|
|
21
|
+
var _VoiceControlDecorator = _interopRequireDefault(require("./VoiceControlDecorator"));
|
|
22
|
+
|
|
23
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
package/speech/readAlert.js
CHANGED
|
@@ -1,53 +1,70 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.readAlert = exports["default"] = void 0;
|
|
5
7
|
|
|
6
|
-
|
|
8
|
+
var _LS2Request = _interopRequireDefault(require("../LS2Request"));
|
|
7
9
|
|
|
8
|
-
|
|
9
|
-
if (audioGuidanceEnabled === null) {
|
|
10
|
-
new LS2Request().send({
|
|
11
|
-
service: 'luna://com.webos.settingsservice',
|
|
12
|
-
method: 'getSystemSettings',
|
|
13
|
-
subscribe: true,
|
|
14
|
-
parameters: {
|
|
15
|
-
'keys': ['audioGuidance'],
|
|
16
|
-
'category': 'option'
|
|
17
|
-
},
|
|
18
|
-
onSuccess: function (res) {
|
|
19
|
-
if (res && res.settings.audioGuidance === 'on') {
|
|
20
|
-
audioGuidanceEnabled = true;
|
|
21
|
-
resolve();
|
|
22
|
-
return;
|
|
23
|
-
}
|
|
10
|
+
var _platform = require("../platform");
|
|
24
11
|
|
|
25
|
-
|
|
26
|
-
reject();
|
|
27
|
-
},
|
|
28
|
-
onFailure: function (err) {
|
|
29
|
-
reject('Failed to get system AudioGuidance settings: ' + JSON.stringify(err));
|
|
30
|
-
}
|
|
31
|
-
});
|
|
32
|
-
} else if (audioGuidanceEnabled) {
|
|
33
|
-
resolve();
|
|
34
|
-
} else {
|
|
35
|
-
reject();
|
|
36
|
-
}
|
|
37
|
-
});
|
|
12
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
38
13
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
14
|
+
/* eslint-disable no-console */
|
|
15
|
+
var audioGuidanceEnabled = null;
|
|
16
|
+
|
|
17
|
+
var checkAudioGuidance = function checkAudioGuidance() {
|
|
18
|
+
return new Promise(function (resolve, reject) {
|
|
19
|
+
if (audioGuidanceEnabled === null) {
|
|
20
|
+
new _LS2Request["default"]().send({
|
|
21
|
+
service: 'luna://com.webos.settingsservice',
|
|
22
|
+
method: 'getSystemSettings',
|
|
23
|
+
subscribe: true,
|
|
24
|
+
parameters: {
|
|
25
|
+
'keys': ['audioGuidance'],
|
|
26
|
+
'category': 'option'
|
|
27
|
+
},
|
|
28
|
+
onSuccess: function onSuccess(res) {
|
|
29
|
+
if (res && res.settings.audioGuidance === 'on') {
|
|
30
|
+
audioGuidanceEnabled = true;
|
|
31
|
+
resolve();
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
50
34
|
|
|
35
|
+
audioGuidanceEnabled = false;
|
|
36
|
+
reject();
|
|
37
|
+
},
|
|
38
|
+
onFailure: function onFailure(err) {
|
|
39
|
+
reject('Failed to get system AudioGuidance settings: ' + JSON.stringify(err));
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
} else if (audioGuidanceEnabled) {
|
|
43
|
+
resolve();
|
|
44
|
+
} else {
|
|
45
|
+
reject();
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
var readAlertMessage = function readAlertMessage(string, clear) {
|
|
51
|
+
return function () {
|
|
52
|
+
return new Promise(function (resolve, reject) {
|
|
53
|
+
new _LS2Request["default"]().send({
|
|
54
|
+
service: 'luna://com.webos.service.tts',
|
|
55
|
+
method: 'speak',
|
|
56
|
+
parameters: {
|
|
57
|
+
'text': string,
|
|
58
|
+
'clear': clear
|
|
59
|
+
},
|
|
60
|
+
onSuccess: resolve,
|
|
61
|
+
onFailure: function onFailure(err) {
|
|
62
|
+
reject('Failed to readAlertMessage: ' + JSON.stringify(err));
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
});
|
|
66
|
+
};
|
|
67
|
+
};
|
|
51
68
|
/**
|
|
52
69
|
* Read alert text when accessibility audio guidance is enabled.
|
|
53
70
|
*
|
|
@@ -58,21 +75,22 @@ const readAlertMessage = (string, clear) => () => new Promise((resolve, reject)
|
|
|
58
75
|
* @memberof webos/speech
|
|
59
76
|
* @public
|
|
60
77
|
*/
|
|
61
|
-
const readAlert = (string, clear = true) => {
|
|
62
|
-
if (platform.tv) {
|
|
63
|
-
checkAudioGuidance()
|
|
64
|
-
.then(readAlertMessage(string, clear))
|
|
65
|
-
.catch(message => {
|
|
66
|
-
if (message) {
|
|
67
|
-
console.error(`Failed to readAlert: ${message}`);
|
|
68
|
-
}
|
|
69
|
-
});
|
|
70
|
-
} else {
|
|
71
|
-
console.warn('Platform doesn\'t support TTS api.');
|
|
72
|
-
}
|
|
73
|
-
};
|
|
74
78
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
79
|
+
|
|
80
|
+
var readAlert = function readAlert(string) {
|
|
81
|
+
var clear = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
82
|
+
|
|
83
|
+
if (_platform.platform.tv) {
|
|
84
|
+
checkAudioGuidance().then(readAlertMessage(string, clear))["catch"](function (message) {
|
|
85
|
+
if (message) {
|
|
86
|
+
console.error("Failed to readAlert: ".concat(message));
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
} else {
|
|
90
|
+
console.warn('Platform doesn\'t support TTS api.');
|
|
91
|
+
}
|
|
78
92
|
};
|
|
93
|
+
|
|
94
|
+
exports.readAlert = readAlert;
|
|
95
|
+
var _default = readAlert;
|
|
96
|
+
exports["default"] = _default;
|