eco-access-specifications 2.0.1
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/Component/LogComponent.js +65 -0
- package/Utils/LogUtil.js +75 -0
- package/base/CommandQueue.js +80 -0
- package/base/Utils.js +12 -0
- package/eco-track-report/TrackUtil.js +26 -0
- package/eco-track-report/index.js +16 -0
- package/global.js +18 -0
- package/index.js +5 -0
- package/index.min.js +1 -0
- package/main/EcoService.js +59 -0
- package/main/log.js +15 -0
- package/main/require.js +59 -0
- package/main/specMethod.js +11 -0
- package/package.json +11 -0
- package/page/LogPage.js +135 -0
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
|
3
|
+
function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
|
|
4
|
+
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
5
|
+
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
6
|
+
function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); }
|
|
7
|
+
function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
|
|
8
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
9
|
+
function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }
|
|
10
|
+
function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); }
|
|
11
|
+
function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
|
|
12
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
13
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
14
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
15
|
+
import React, { Component } from 'react';
|
|
16
|
+
import { BackAndroid, BackHandler, Dimensions, PixelRatio, Platform } from 'react-native';
|
|
17
|
+
var BaseComponent = /*#__PURE__*/function (_React$Component) {
|
|
18
|
+
function BaseComponent(props) {
|
|
19
|
+
var _this;
|
|
20
|
+
_classCallCheck(this, BaseComponent);
|
|
21
|
+
_this = _callSuper(this, BaseComponent, [props]);
|
|
22
|
+
_defineProperty(_this, "mScreenWidth", Dimensions.get('window').width);
|
|
23
|
+
_defineProperty(_this, "mScreenHeight", Dimensions.get('window').height);
|
|
24
|
+
// 最小显示单位
|
|
25
|
+
_defineProperty(_this, "mOnePixel", (PixelRatio.get() == 3 ? 2 : 1) / PixelRatio.get());
|
|
26
|
+
// 返回 ;//return true 表示返回上一页 false 表示跳出RN
|
|
27
|
+
_defineProperty(_this, "onBackClicked", function () {
|
|
28
|
+
// 默认 表示跳出RN
|
|
29
|
+
return false;
|
|
30
|
+
});
|
|
31
|
+
return _this;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* return 當前分辨率下的數值
|
|
36
|
+
* @param {*} size 375标注图下的值
|
|
37
|
+
*/
|
|
38
|
+
_inherits(BaseComponent, _React$Component);
|
|
39
|
+
return _createClass(BaseComponent, [{
|
|
40
|
+
key: "getSize",
|
|
41
|
+
value: function getSize(size) {
|
|
42
|
+
return parseInt(this.mScreenWidth * size / 360);
|
|
43
|
+
}
|
|
44
|
+
}, {
|
|
45
|
+
key: "componentWillMount",
|
|
46
|
+
value: function componentWillMount() {
|
|
47
|
+
if (Platform.OS === 'android') {
|
|
48
|
+
BackHandler.addEventListener("back", this.onBackClicked);
|
|
49
|
+
} else {}
|
|
50
|
+
}
|
|
51
|
+
}, {
|
|
52
|
+
key: "componentWillUnmount",
|
|
53
|
+
value: function componentWillUnmount() {
|
|
54
|
+
if (Platform.OS === 'android') {
|
|
55
|
+
BackHandler.removeEventListener("back", this.onBackClicked);
|
|
56
|
+
} else {
|
|
57
|
+
// this.propstManger.addLengeData(this.props.navigator.getCurrentRoutes().length);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}, {
|
|
61
|
+
key: "addLog",
|
|
62
|
+
value: function addLog(string) {}
|
|
63
|
+
}]);
|
|
64
|
+
}(React.Component);
|
|
65
|
+
export default BaseComponent;
|
package/Utils/LogUtil.js
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
|
3
|
+
function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
|
|
4
|
+
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
5
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
6
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
7
|
+
import { appName, Service, Device } from '../global';
|
|
8
|
+
var logArray = [];
|
|
9
|
+
var UnitUtil = /*#__PURE__*/function () {
|
|
10
|
+
function UnitUtil() {
|
|
11
|
+
_classCallCheck(this, UnitUtil);
|
|
12
|
+
}
|
|
13
|
+
return _createClass(UnitUtil, null, [{
|
|
14
|
+
key: "setLogInfo",
|
|
15
|
+
value: function setLogInfo(logInfo) {
|
|
16
|
+
// 只写到本地
|
|
17
|
+
this.logOnAll(logInfo); // 写入米家log
|
|
18
|
+
logArray.push({
|
|
19
|
+
time: new Date().getTime(),
|
|
20
|
+
logInfo: logInfo
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
}, {
|
|
24
|
+
key: "getLogInfo",
|
|
25
|
+
value: function getLogInfo() {
|
|
26
|
+
return logArray;
|
|
27
|
+
}
|
|
28
|
+
}, {
|
|
29
|
+
key: "logOnAll",
|
|
30
|
+
value: function logOnAll() {
|
|
31
|
+
for (var _len = arguments.length, message = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
32
|
+
message[_key] = arguments[_key];
|
|
33
|
+
}
|
|
34
|
+
// 可以上传日志到后端,方便监控线上用户
|
|
35
|
+
var content = message.join(" ");
|
|
36
|
+
if (appName === 'miot') {
|
|
37
|
+
Service.smarthome.reportLog(Device.model, content);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}, {
|
|
41
|
+
key: "logDebug",
|
|
42
|
+
value: function logDebug() {}
|
|
43
|
+
/**
|
|
44
|
+
* 时间转换
|
|
45
|
+
* @param dateTime
|
|
46
|
+
* @param fmt
|
|
47
|
+
* @returns {*|string}
|
|
48
|
+
*/
|
|
49
|
+
}, {
|
|
50
|
+
key: "dateFormat",
|
|
51
|
+
value: function dateFormat(dateTime, fmt) {
|
|
52
|
+
var date = new Date(dateTime);
|
|
53
|
+
fmt = fmt || 'yyyy-MM-dd';
|
|
54
|
+
var o = {
|
|
55
|
+
"M+": date.getMonth() + 1,
|
|
56
|
+
// 月份
|
|
57
|
+
"d+": date.getDate(),
|
|
58
|
+
// 日
|
|
59
|
+
"h+": date.getHours(),
|
|
60
|
+
// 小时
|
|
61
|
+
"m+": date.getMinutes(),
|
|
62
|
+
// 分
|
|
63
|
+
"s+": date.getSeconds(),
|
|
64
|
+
// 秒
|
|
65
|
+
"q+": Math.floor((date.getMonth() + 3) / 3),
|
|
66
|
+
// 季度
|
|
67
|
+
"S": date.getMilliseconds() // 毫秒
|
|
68
|
+
};
|
|
69
|
+
if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, "".concat(date.getFullYear()).substr(4 - RegExp.$1.length));
|
|
70
|
+
for (var k in o) if (new RegExp("(".concat(k, ")")).test(fmt)) fmt = fmt.replace(RegExp.$1, RegExp.$1.length == 1 ? o[k] : "00".concat(o[k]).substr("".concat(o[k]).length));
|
|
71
|
+
return fmt;
|
|
72
|
+
}
|
|
73
|
+
}]);
|
|
74
|
+
}();
|
|
75
|
+
export { UnitUtil as default };
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator["return"] && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, "catch": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
|
|
3
|
+
function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
|
|
4
|
+
function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
|
|
5
|
+
import { Device } from '../global.js';
|
|
6
|
+
import { addLog } from "../main/log.js";
|
|
7
|
+
var createCommandQueue = function createCommandQueue(specMethod) {
|
|
8
|
+
var commandArray = [];
|
|
9
|
+
var callback = null;
|
|
10
|
+
var isProcessing = false;
|
|
11
|
+
var _checkAndExecute = /*#__PURE__*/function () {
|
|
12
|
+
var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
13
|
+
var command, result;
|
|
14
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
15
|
+
while (1) switch (_context.prev = _context.next) {
|
|
16
|
+
case 0:
|
|
17
|
+
if (!(isProcessing || commandArray.length === 0)) {
|
|
18
|
+
_context.next = 2;
|
|
19
|
+
break;
|
|
20
|
+
}
|
|
21
|
+
return _context.abrupt("return");
|
|
22
|
+
case 2:
|
|
23
|
+
isProcessing = true;
|
|
24
|
+
command = commandArray.shift();
|
|
25
|
+
_context.prev = 4;
|
|
26
|
+
_context.next = 7;
|
|
27
|
+
return specMethod[command.specWay](Device.mac, JSON.stringify(command.entity));
|
|
28
|
+
case 7:
|
|
29
|
+
result = _context.sent;
|
|
30
|
+
addLog("spec\u6307\u4EE4\u54CD\u5E94\u6210\u529F\u2705:".concat(JSON.stringify(result)));
|
|
31
|
+
callback({
|
|
32
|
+
type: command.specWay,
|
|
33
|
+
result: result
|
|
34
|
+
});
|
|
35
|
+
_context.next = 16;
|
|
36
|
+
break;
|
|
37
|
+
case 12:
|
|
38
|
+
_context.prev = 12;
|
|
39
|
+
_context.t0 = _context["catch"](4);
|
|
40
|
+
addLog("spec\u274C\u5931\u8D25:".concat(JSON.stringify(_context.t0)));
|
|
41
|
+
callback({
|
|
42
|
+
type: command.specWay,
|
|
43
|
+
error: _context.t0
|
|
44
|
+
});
|
|
45
|
+
case 16:
|
|
46
|
+
isProcessing = false;
|
|
47
|
+
_checkAndExecute();
|
|
48
|
+
case 18:
|
|
49
|
+
case "end":
|
|
50
|
+
return _context.stop();
|
|
51
|
+
}
|
|
52
|
+
}, _callee, null, [[4, 12]]);
|
|
53
|
+
}));
|
|
54
|
+
return function checkAndExecute() {
|
|
55
|
+
return _ref.apply(this, arguments);
|
|
56
|
+
};
|
|
57
|
+
}();
|
|
58
|
+
var add = function add(command) {
|
|
59
|
+
commandArray.push(command);
|
|
60
|
+
_checkAndExecute();
|
|
61
|
+
};
|
|
62
|
+
var remove = function remove(commandIndex) {
|
|
63
|
+
if (commandIndex >= 0 && commandIndex < commandArray.length) {
|
|
64
|
+
commandArray.splice(commandIndex, 1);
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
var clear = function clear() {
|
|
68
|
+
commandArray = [];
|
|
69
|
+
};
|
|
70
|
+
var listeners = function listeners(cb) {
|
|
71
|
+
callback = cb;
|
|
72
|
+
};
|
|
73
|
+
return {
|
|
74
|
+
add: add,
|
|
75
|
+
listeners: listeners,
|
|
76
|
+
remove: remove,
|
|
77
|
+
clear: clear
|
|
78
|
+
};
|
|
79
|
+
};
|
|
80
|
+
export default createCommandQueue;
|
package/base/Utils.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
var nowDateString = function nowDateString() {
|
|
2
|
+
var now = new Date();
|
|
3
|
+
var year = now.getFullYear();
|
|
4
|
+
var month = (now.getMonth() + 1).toString().padStart(2, '0');
|
|
5
|
+
var day = now.getDate().toString().padStart(2, '0');
|
|
6
|
+
var hour = now.getHours().toString().padStart(2, '0');
|
|
7
|
+
var minute = now.getMinutes().toString().padStart(2, '0');
|
|
8
|
+
var second = now.getSeconds().toString().padStart(2, '0');
|
|
9
|
+
var millisecond = now.getMilliseconds().toString().padStart(4, '0');
|
|
10
|
+
return "".concat(year, "-").concat(month, "-").concat(day, " ").concat(hour, ":").concat(minute, ":").concat(second, ":").concat(millisecond);
|
|
11
|
+
};
|
|
12
|
+
export { nowDateString };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Service } from '../global';
|
|
2
|
+
export default class TrackUtil {
|
|
3
|
+
/**
|
|
4
|
+
* oneTrack report event
|
|
5
|
+
* 如果params为空,表示直接使用配置信息上报
|
|
6
|
+
* 如果params为数组,表示从打点位置直接调用,需要匹配到配置信息中上报
|
|
7
|
+
* 如果params为map,表示从传统打点中调用过来,需要把信息加到配置信息中上报
|
|
8
|
+
* */
|
|
9
|
+
static async oneTrackReport(eventKeyName, params = {}, allTrackPoints) {
|
|
10
|
+
let resParms = {};
|
|
11
|
+
const eventName = allTrackPoints[eventKeyName].name;
|
|
12
|
+
resParms = {
|
|
13
|
+
...allTrackPoints[eventKeyName],
|
|
14
|
+
...params
|
|
15
|
+
};
|
|
16
|
+
delete resParms.name;
|
|
17
|
+
console.log(resParms);
|
|
18
|
+
if (resParms && eventName && resParms.tip) {
|
|
19
|
+
// 添加通用信息
|
|
20
|
+
Service.smarthome.reportEvent(eventName, resParms);
|
|
21
|
+
console.log("onetrack done: ", eventName, resParms);
|
|
22
|
+
} else {
|
|
23
|
+
console.error("onetrack failed: ", eventKeyName);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import TrackUtil from './TrackUtil';
|
|
2
|
+
let allTrackObj = {};
|
|
3
|
+
const allTrackPoints = data => {
|
|
4
|
+
allTrackObj = data;
|
|
5
|
+
};
|
|
6
|
+
const oneTrackReport = (name, params = {}, commonParams = {}) => {
|
|
7
|
+
if (!allTrackObj[name]) {
|
|
8
|
+
throw new Error(`没有匹配到${name}这个key,请确定字符串拼写正确`);
|
|
9
|
+
}
|
|
10
|
+
const allParams = {
|
|
11
|
+
...params,
|
|
12
|
+
...commonParams
|
|
13
|
+
};
|
|
14
|
+
TrackUtil.oneTrackReport(name, allParams, allTrackObj);
|
|
15
|
+
};
|
|
16
|
+
export { oneTrackReport, allTrackPoints };
|
package/global.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { bleSpec } from './main/specMethod';
|
|
2
|
+
var appName = '';
|
|
3
|
+
var Device = {};
|
|
4
|
+
var Service = {};
|
|
5
|
+
var addLog = function addLog() {};
|
|
6
|
+
var Bluetooth = {};
|
|
7
|
+
var localLog = function localLog() {};
|
|
8
|
+
var bleSpecQueue = function bleSpecQueue() {};
|
|
9
|
+
var initSpecifications = function initSpecifications(data) {
|
|
10
|
+
appName = data.name;
|
|
11
|
+
Device = data.Device;
|
|
12
|
+
localLog = data.localLog;
|
|
13
|
+
Service = data.Service;
|
|
14
|
+
addLog = data.addLog;
|
|
15
|
+
Bluetooth = data.Bluetooth;
|
|
16
|
+
bleSpecQueue = bleSpec(Bluetooth); // 初始化蓝牙队列
|
|
17
|
+
};
|
|
18
|
+
export { appName, Device, Service, initSpecifications, addLog, Bluetooth, bleSpecQueue, localLog };
|
package/index.js
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { initSpecifications, bleSpecQueue } from "./global.js";
|
|
2
|
+
import EcoService from "./main/EcoService.js";
|
|
3
|
+
import { addLog, LogPage } from "./main/log.js";
|
|
4
|
+
import { oneTrackReport, allTrackPoints } from './eco-track-report/index.js';
|
|
5
|
+
export { LogPage, addLog, bleSpecQueue, initSpecifications, EcoService, oneTrackReport, allTrackPoints };
|
package/index.min.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{bleSpec}from"./main/specMethod";var appName="",Device={},Service={},addLog=function(){},Bluetooth={},localLog=function(){},bleSpecQueue=function(){},initSpecifications=function(e){appName=e.name,Device=e.Device,localLog=e.localLog,Service=e.Service,addLog=e.addLog,bleSpecQueue=bleSpec(Bluetooth=e.Bluetooth)};import{initSpecifications,bleSpecQueue}from"./global.js";import EcoService from"./main/EcoService.js";import{addLog,LogPage}from"./main/log.js";import{oneTrackReport,allTrackPoints}from"./eco-track-report/index.js";export{appName,Device,Service,initSpecifications,addLog,Bluetooth,bleSpecQueue,localLog,LogPage,addLog,bleSpecQueue,initSpecifications,EcoService,oneTrackReport,allTrackPoints};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator["return"] && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, "catch": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
|
|
3
|
+
function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
|
|
4
|
+
function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
|
|
5
|
+
import { Service } from '../global.js';
|
|
6
|
+
import { nowDateString } from '../base/Utils.js';
|
|
7
|
+
import { addLog } from "./log.js";
|
|
8
|
+
var log = function log(path, params, success, failure, logLevel) {
|
|
9
|
+
var string;
|
|
10
|
+
if (logLevel === 3) {
|
|
11
|
+
return;
|
|
12
|
+
} else if (logLevel === 2) {
|
|
13
|
+
string = "[ApiRequest] : \u2705Success." + "\n\u8BF7\u6C42\u8DEF\u5F84: ".concat(path) + "\n\u8BF7\u6C42\u53C2\u6570: ".concat(JSON.stringify(params));
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
var header = nowDateString();
|
|
17
|
+
if (success != undefined) {
|
|
18
|
+
string = "[ApiRequest] : \u2705Success." + "\n\u8BF7\u6C42\u8DEF\u5F84: ".concat(path) + "\n\u8BF7\u6C42\u53C2\u6570: ".concat(JSON.stringify(params)) + "\n\u54CD\u5E94\u7ED3\u679C: ".concat(JSON.stringify(success));
|
|
19
|
+
addLog("".concat(header, " : ").concat(string));
|
|
20
|
+
} else {
|
|
21
|
+
string = "[ApiRequest] : \u274CFailure." + "\n\u8BF7\u6C42\u8DEF\u5F84: ".concat(path) + "\n\u8BF7\u6C42\u53C2\u6570: ".concat(JSON.stringify(params)) + "\n\u54CD\u5E94\u7ED3\u679C: ".concat(JSON.stringify(failure));
|
|
22
|
+
addLog("".concat(header, " : ").concat(string));
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* 发起网络请求
|
|
27
|
+
* @param {*} path 请求路径
|
|
28
|
+
* @param {*} params 请求参数
|
|
29
|
+
* @param {*} logLevel 日志等级
|
|
30
|
+
*/
|
|
31
|
+
var ecoService = /*#__PURE__*/function () {
|
|
32
|
+
var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(path, params, logLevel) {
|
|
33
|
+
var res;
|
|
34
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
35
|
+
while (1) switch (_context.prev = _context.next) {
|
|
36
|
+
case 0:
|
|
37
|
+
_context.prev = 0;
|
|
38
|
+
_context.next = 3;
|
|
39
|
+
return Service.callSmartHomeAPI(path, params);
|
|
40
|
+
case 3:
|
|
41
|
+
res = _context.sent;
|
|
42
|
+
log(path, params, res, undefined, logLevel);
|
|
43
|
+
return _context.abrupt("return", res);
|
|
44
|
+
case 8:
|
|
45
|
+
_context.prev = 8;
|
|
46
|
+
_context.t0 = _context["catch"](0);
|
|
47
|
+
log(path, params, undefined, _context.t0, logLevel);
|
|
48
|
+
throw _context.t0;
|
|
49
|
+
case 12:
|
|
50
|
+
case "end":
|
|
51
|
+
return _context.stop();
|
|
52
|
+
}
|
|
53
|
+
}, _callee, null, [[0, 8]]);
|
|
54
|
+
}));
|
|
55
|
+
return function ecoService(_x, _x2, _x3) {
|
|
56
|
+
return _ref.apply(this, arguments);
|
|
57
|
+
};
|
|
58
|
+
}();
|
|
59
|
+
export default ecoService;
|
package/main/log.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import LogUtil from "../Utils/LogUtil";
|
|
2
|
+
import LogPage from "../page/LogPage";
|
|
3
|
+
import { localLog, appName, Device } from "../global";
|
|
4
|
+
var addLog = function addLog(string) {
|
|
5
|
+
var data = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : undefined;
|
|
6
|
+
if (data) {
|
|
7
|
+
LogUtil.setLogInfo("log->".concat(string).concat(JSON.stringify(data)));
|
|
8
|
+
} else {
|
|
9
|
+
LogUtil.setLogInfo("log->".concat(string));
|
|
10
|
+
}
|
|
11
|
+
if (appName === 'miwear-rn-plugin') {
|
|
12
|
+
localLog(Device.model, "[ECO-rn]->".concat(string));
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
export { addLog, LogPage };
|
package/main/require.js
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator["return"] && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, "catch": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
|
|
3
|
+
function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
|
|
4
|
+
function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
|
|
5
|
+
import { Service } from '../global.js';
|
|
6
|
+
import { nowDateString } from '../base/Utils.js';
|
|
7
|
+
import { addLog } from "./log.js";
|
|
8
|
+
var log = function log(path, params, success, failure, logLevel) {
|
|
9
|
+
var string;
|
|
10
|
+
if (logLevel === 3) {
|
|
11
|
+
return;
|
|
12
|
+
} else if (logLevel === 2) {
|
|
13
|
+
string = "[ApiRequest] : \u2705Success." + "\n\u8BF7\u6C42\u8DEF\u5F84: ".concat(path) + "\n\u8BF7\u6C42\u53C2\u6570: ".concat(JSON.stringify(params));
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
var header = nowDateString();
|
|
17
|
+
if (success != undefined) {
|
|
18
|
+
string = "[ApiRequest] : \u2705Success." + "\n\u8BF7\u6C42\u8DEF\u5F84: ".concat(path) + "\n\u8BF7\u6C42\u53C2\u6570: ".concat(JSON.stringify(params)) + "\n\u54CD\u5E94\u7ED3\u679C: ".concat(JSON.stringify(success));
|
|
19
|
+
addLog("".concat(header, " : ").concat(string));
|
|
20
|
+
} else {
|
|
21
|
+
string = "[ApiRequest] : \u274CFailure." + "\n\u8BF7\u6C42\u8DEF\u5F84: ".concat(path) + "\n\u8BF7\u6C42\u53C2\u6570: ".concat(JSON.stringify(params)) + "\n\u54CD\u5E94\u7ED3\u679C: ".concat(JSON.stringify(failure));
|
|
22
|
+
addLog("".concat(header, " : ").concat(string));
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* 发起网络请求
|
|
27
|
+
* @param {*} path 请求路径
|
|
28
|
+
* @param {*} params 请求参数
|
|
29
|
+
* @param {*} logLevel 日志等级
|
|
30
|
+
*/
|
|
31
|
+
var EcoService = /*#__PURE__*/function () {
|
|
32
|
+
var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(path, params, logLevel) {
|
|
33
|
+
var res;
|
|
34
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
35
|
+
while (1) switch (_context.prev = _context.next) {
|
|
36
|
+
case 0:
|
|
37
|
+
_context.prev = 0;
|
|
38
|
+
_context.next = 3;
|
|
39
|
+
return Service.callSmartHomeAPI(path, params);
|
|
40
|
+
case 3:
|
|
41
|
+
res = _context.sent;
|
|
42
|
+
log(path, params, res, undefined, logLevel);
|
|
43
|
+
return _context.abrupt("return", res);
|
|
44
|
+
case 8:
|
|
45
|
+
_context.prev = 8;
|
|
46
|
+
_context.t0 = _context["catch"](0);
|
|
47
|
+
log(path, params, undefined, _context.t0, logLevel);
|
|
48
|
+
throw _context.t0;
|
|
49
|
+
case 12:
|
|
50
|
+
case "end":
|
|
51
|
+
return _context.stop();
|
|
52
|
+
}
|
|
53
|
+
}, _callee, null, [[0, 8]]);
|
|
54
|
+
}));
|
|
55
|
+
return function EcoService(_x, _x2, _x3) {
|
|
56
|
+
return _ref.apply(this, arguments);
|
|
57
|
+
};
|
|
58
|
+
}();
|
|
59
|
+
export default EcoService;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import CommandQueue from '../base/CommandQueue';
|
|
2
|
+
var bleSpec = function bleSpec(Bluetooth) {
|
|
3
|
+
var _Bluetooth$spec, _Bluetooth$spec2, _Bluetooth$spec3;
|
|
4
|
+
var bleSpecMethod = {
|
|
5
|
+
doAction: Bluetooth === null || Bluetooth === void 0 || (_Bluetooth$spec = Bluetooth.spec) === null || _Bluetooth$spec === void 0 ? void 0 : _Bluetooth$spec.doAction.bind(Bluetooth),
|
|
6
|
+
setPropertiesValue: Bluetooth === null || Bluetooth === void 0 || (_Bluetooth$spec2 = Bluetooth.spec) === null || _Bluetooth$spec2 === void 0 ? void 0 : _Bluetooth$spec2.setPropertiesValue.bind(Bluetooth),
|
|
7
|
+
getPropertiesValue: Bluetooth === null || Bluetooth === void 0 || (_Bluetooth$spec3 = Bluetooth.spec) === null || _Bluetooth$spec3 === void 0 ? void 0 : _Bluetooth$spec3.getPropertiesValue.bind(Bluetooth)
|
|
8
|
+
};
|
|
9
|
+
return CommandQueue(bleSpecMethod);
|
|
10
|
+
};
|
|
11
|
+
export { bleSpec };
|
package/package.json
ADDED
package/page/LogPage.js
ADDED
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
|
+
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
|
5
|
+
function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
|
|
6
|
+
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
7
|
+
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
8
|
+
function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); }
|
|
9
|
+
function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
|
|
10
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
|
|
11
|
+
function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }
|
|
12
|
+
function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); }
|
|
13
|
+
function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
|
|
14
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
15
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
16
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
17
|
+
import LogComponent from "../Component/LogComponent";
|
|
18
|
+
import React from "react";
|
|
19
|
+
import { Platform, ScrollView, Text, View } from "react-native";
|
|
20
|
+
import LogUtil from "../Utils/LogUtil";
|
|
21
|
+
import { NavigationBar } from "mhui-rn";
|
|
22
|
+
var LogPage = /*#__PURE__*/function (_LogComponent) {
|
|
23
|
+
function LogPage(props) {
|
|
24
|
+
var _this;
|
|
25
|
+
_classCallCheck(this, LogPage);
|
|
26
|
+
_this = _callSuper(this, LogPage, [props]);
|
|
27
|
+
// this.fileName = appName + 'log.text';
|
|
28
|
+
_this.state = {
|
|
29
|
+
logInfo: []
|
|
30
|
+
};
|
|
31
|
+
return _this;
|
|
32
|
+
}
|
|
33
|
+
_inherits(LogPage, _LogComponent);
|
|
34
|
+
return _createClass(LogPage, [{
|
|
35
|
+
key: "componentWillMount",
|
|
36
|
+
value: function componentWillMount() {
|
|
37
|
+
var logInfoArray = LogUtil.getLogInfo();
|
|
38
|
+
// this.newFile(logInfoArray);
|
|
39
|
+
this.setState({
|
|
40
|
+
logInfo: logInfoArray
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
// async newFile(log = '日志文件') {
|
|
44
|
+
// Service.smarthome.reportLog(Device.model, this.arrayToLogString(log));
|
|
45
|
+
// await Host.file.writeFile(this.fileName, this.arrayToLogString(log));
|
|
46
|
+
// this.saveFileToPhotosAlbum();
|
|
47
|
+
// // this.readFile();
|
|
48
|
+
// }
|
|
49
|
+
// async readFile() {
|
|
50
|
+
// const filecontent = await Host.file.readFile(this.fileName);
|
|
51
|
+
// console.log(filecontent, '日志读取内容');
|
|
52
|
+
// }
|
|
53
|
+
// async saveFileToPhotosAlbum() {
|
|
54
|
+
// await Host.file.saveFileToPhotosAlbum(this.fileName);
|
|
55
|
+
// this.onShowToast('日志文件已存储到本地');
|
|
56
|
+
// }
|
|
57
|
+
}, {
|
|
58
|
+
key: "objectToLogString",
|
|
59
|
+
value: function objectToLogString(item) {
|
|
60
|
+
var dateTime = LogUtil.dateFormat(new Date(parseInt(item.time)), 'yyyy-MM-dd hh:mm:ss');
|
|
61
|
+
var text = "".concat(dateTime, "\uFF1A").concat(item.logInfo);
|
|
62
|
+
// 将对象转换成字符串
|
|
63
|
+
return text + '\n';
|
|
64
|
+
}
|
|
65
|
+
}, {
|
|
66
|
+
key: "arrayToLogString",
|
|
67
|
+
value: function arrayToLogString(arr) {
|
|
68
|
+
var _this2 = this;
|
|
69
|
+
// 将数组元素转换成字符串并拼接成一行
|
|
70
|
+
var text = arr.map(function (item) {
|
|
71
|
+
return _this2.objectToLogString(item);
|
|
72
|
+
}).join('\n ');
|
|
73
|
+
return text;
|
|
74
|
+
}
|
|
75
|
+
}, {
|
|
76
|
+
key: "render",
|
|
77
|
+
value: function render() {
|
|
78
|
+
var _this3 = this;
|
|
79
|
+
return /*#__PURE__*/React.createElement(View, {
|
|
80
|
+
style: {
|
|
81
|
+
flex: 1
|
|
82
|
+
}
|
|
83
|
+
}, /*#__PURE__*/React.createElement(NavigationBar, {
|
|
84
|
+
title: '日志',
|
|
85
|
+
type: NavigationBar.TYPE.LIGHT,
|
|
86
|
+
left: [{
|
|
87
|
+
key: 'back',
|
|
88
|
+
onPress: function onPress(_) {
|
|
89
|
+
return _this3.props.navigation.goBack();
|
|
90
|
+
}
|
|
91
|
+
}]
|
|
92
|
+
}), /*#__PURE__*/React.createElement(ScrollView, null, this.state.logInfo.map(function (item, index) {
|
|
93
|
+
return _this3._itemView(item, index);
|
|
94
|
+
})));
|
|
95
|
+
}
|
|
96
|
+
}, {
|
|
97
|
+
key: "_itemView",
|
|
98
|
+
value: function _itemView(item, index) {
|
|
99
|
+
var dateTime = LogUtil.dateFormat(new Date(parseInt(item.time)), 'yyyy-MM-dd hh:mm:ss');
|
|
100
|
+
return /*#__PURE__*/React.createElement(View, {
|
|
101
|
+
key: index,
|
|
102
|
+
style: {
|
|
103
|
+
padding: 10
|
|
104
|
+
}
|
|
105
|
+
}, /*#__PURE__*/React.createElement(Text, {
|
|
106
|
+
style: _objectSpread({
|
|
107
|
+
color: '#333',
|
|
108
|
+
fontSize: 14
|
|
109
|
+
}, Platform.select({
|
|
110
|
+
ios: {},
|
|
111
|
+
android: {
|
|
112
|
+
fontFamily: ''
|
|
113
|
+
}
|
|
114
|
+
}))
|
|
115
|
+
}, dateTime + ':', /*#__PURE__*/React.createElement(Text, {
|
|
116
|
+
style: _objectSpread({
|
|
117
|
+
color: '#000000',
|
|
118
|
+
fontSize: 14
|
|
119
|
+
}, Platform.select({
|
|
120
|
+
ios: {},
|
|
121
|
+
android: {
|
|
122
|
+
fontFamily: ''
|
|
123
|
+
}
|
|
124
|
+
}))
|
|
125
|
+
}, item.logInfo)));
|
|
126
|
+
}
|
|
127
|
+
}]);
|
|
128
|
+
}(LogComponent);
|
|
129
|
+
_defineProperty(LogPage, "navigationOptions", function (_ref) {
|
|
130
|
+
var navigation = _ref.navigation;
|
|
131
|
+
return {
|
|
132
|
+
header: null
|
|
133
|
+
};
|
|
134
|
+
});
|
|
135
|
+
export { LogPage as default };
|