@zeppos/zeus-cli 1.6.4 → 1.6.6
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/bin/main.js +12 -1
- package/modules/create.js +3 -0
- package/modules/version.js +5 -1
- package/package.json +2 -2
- package/private-modules/zeppos-app-utils/dist/modules/create/index.js +3 -2
- package/private-modules/zeppos-app-utils/dist/modules/fetchDevices.js +44 -35
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/calories/_package.json +17 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/calories/app.js +27 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/calories/app.json +52 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/calories/assets/gt.r/consume.png +0 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/calories/assets/gt.r/food/beer.png +0 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/calories/assets/gt.r/food/cake.png +0 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/calories/assets/gt.r/food/chocolate.png +0 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/calories/assets/gt.r/food/coffee.png +0 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/calories/assets/gt.r/food/cookies.png +0 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/calories/assets/gt.r/food/ham.png +0 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/calories/assets/gt.r/food/hamburger.png +0 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/calories/assets/gt.r/food/ice cream.png +0 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/calories/assets/gt.r/food/pizza.png +0 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/calories/assets/gt.r/food/sausage.png +0 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/calories/assets/gt.r/icon.png +0 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/calories/assets/gt.r/multiply.png +0 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/calories/assets/gt.r/selected.png +0 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/calories/assets/gt.r/unselected.png +0 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/calories/assets/gt.s/consume.png +0 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/calories/assets/gt.s/food/beer.png +0 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/calories/assets/gt.s/food/cake.png +0 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/calories/assets/gt.s/food/chocolate.png +0 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/calories/assets/gt.s/food/coffee.png +0 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/calories/assets/gt.s/food/cookies.png +0 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/calories/assets/gt.s/food/ham.png +0 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/calories/assets/gt.s/food/hamburger.png +0 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/calories/assets/gt.s/food/ice cream.png +0 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/calories/assets/gt.s/food/pizza.png +0 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/calories/assets/gt.s/food/sausage.png +0 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/calories/assets/gt.s/icon.png +0 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/calories/assets/gt.s/multiply.png +0 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/calories/assets/gt.s/selected.png +0 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/calories/assets/gt.s/unselected.png +0 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/calories/global.d.ts +1 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/calories/jsconfig.json +9 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/calories/page/gt/food-list.js +107 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/calories/page/gt/food-list.r.layout.js +48 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/calories/page/gt/food-list.s.layout.js +33 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/calories/page/gt/index.js +127 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/calories/page/gt/index.r.layout.js +110 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/calories/page/gt/index.s.layout.js +98 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/calories/page/i18n/en-US.po +42 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/calories/page/i18n/zh-CN.po +42 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/calories/utils/constants.js +62 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/calories/utils/storage.js +40 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/empty/_package.json +14 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/empty/app-side/i18n/en-US.po +2 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/empty/app-side/index.js +13 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/empty/app.js +10 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/empty/app.json +60 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/empty/assets/default.b/icon.png +0 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/empty/assets/default.r/icon.png +0 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/empty/assets/default.s/icon.png +0 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/empty/global.d.ts +1 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/empty/jsconfig.json +9 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/empty/page/i18n/en-US.po +2 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/empty/page/index.b.layout.js +6 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/empty/page/index.js +7 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/empty/page/index.r.layout.js +6 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/empty/page/index.s.layout.js +6 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/empty/setting/i18n/en-US.po +2 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/empty/setting/index.js +7 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/fetch-api/_package.json +17 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/fetch-api/app-side/i18n/en-US.po +2 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/fetch-api/app-side/index.js +56 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/fetch-api/app.js +14 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/fetch-api/app.json +51 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/fetch-api/assets/common.r/icon.png +0 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/fetch-api/assets/common.s/icon.png +0 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/fetch-api/global.d.ts +1 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/fetch-api/jsconfig.json +9 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/fetch-api/page/i18n/en-US.po +2 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/fetch-api/page/index.js +45 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/fetch-api/page/index.r.layout.js +32 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/fetch-api/page/index.s.layout.js +32 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/fetch-api/utils/config/constants.js +2 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/fetch-api/utils/config/device.js +2 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/hello-world/_package.json +17 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/hello-world/app.js +10 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/hello-world/app.json +51 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/hello-world/assets/gt.r/icon.png +0 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/hello-world/assets/gt.r/image/logo.png +0 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/hello-world/assets/gt.s/icon.png +0 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/hello-world/assets/gt.s/image/logo.png +0 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/hello-world/global.d.ts +1 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/hello-world/jsconfig.json +9 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/hello-world/page/gt/home/index.page.js +17 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/hello-world/page/gt/home/index.page.r.layout.js +19 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/hello-world/page/gt/home/index.page.s.layout.js +19 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/hello-world/page/i18n/en-US.po +2 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/hello-world/page/i18n/zh-CN.po +2 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/hello-world/utils/index.js +3 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/showcase/_package.json +17 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/showcase/app.js +16 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/showcase/app.json +71 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/showcase/assets/default.b/icon.png +0 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/showcase/assets/default.r/icon.png +0 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/showcase/assets/default.r/images/icons/ic_moon.png +0 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/showcase/assets/default.s/icon.png +0 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/showcase/global.d.ts +1 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/showcase/jsconfig.json +9 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/showcase/page/TC/TC_01/index.js +205 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/showcase/page/TC/TC_01/index.r.layout.js +106 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/showcase/page/TC/TC_02/index.js +88 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/showcase/page/TC/TC_02/index.r.layout.js +74 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/showcase/page/TC/TC_03/index.js +98 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/showcase/page/TC/TC_03/index.r.layout.js +80 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/showcase/page/i18n/en-US.po +2 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/showcase/page/index.js +53 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/showcase/page/index.r.layout.js +75 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/todo-list/.prettierrc.js +6 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/todo-list/_package.json +17 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/todo-list/app-side/index.js +47 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/todo-list/app.js +17 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/todo-list/app.json +55 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/todo-list/assets/gt.r/add.png +0 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/todo-list/assets/gt.r/delete.png +0 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/todo-list/assets/gt.r/icon.png +0 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/todo-list/assets/gt.s/add.png +0 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/todo-list/assets/gt.s/delete.png +0 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/todo-list/assets/gt.s/icon.png +0 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/todo-list/global.d.ts +1 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/todo-list/jsconfig.json +9 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/todo-list/page/home/index.page.js +177 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/todo-list/page/home/index.page.r.layout.js +112 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/todo-list/page/home/index.page.s.layout.js +112 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/todo-list/page/i18n/en-US.po +21 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/todo-list/setting/i18n/en-US.po +5 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/todo-list/setting/index.js +143 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/todo-list/utils/constants.js +3 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/todo-list/utils/fs.js +34 -0
- package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/todo-list/utils/index.js +38 -0
- package/private-modules/zeppos-app-utils/package.json +1 -1
package/bin/main.js
CHANGED
|
@@ -50,7 +50,7 @@ var pre_check_1 = require("../utils/pre-check");
|
|
|
50
50
|
var index_1 = require("../index");
|
|
51
51
|
var zeppos_app_utils_1 = require("zeppos-app-utils");
|
|
52
52
|
var tools_1 = require("../utils/tools");
|
|
53
|
-
var login = zeppos_app_utils_1.modules.login, logout = zeppos_app_utils_1.modules.logout, status = zeppos_app_utils_1.modules.status, modulesConfig = zeppos_app_utils_1.modules.config,
|
|
53
|
+
var login = zeppos_app_utils_1.modules.login, logout = zeppos_app_utils_1.modules.logout, status = zeppos_app_utils_1.modules.status, modulesConfig = zeppos_app_utils_1.modules.config, devicesData = zeppos_app_utils_1.modules.fetchDevices;
|
|
54
54
|
var context = {};
|
|
55
55
|
var yargsCmdBuilderFunc = function (cmdName, useProxy, yargs) {
|
|
56
56
|
if (useProxy === void 0) { useProxy = false; }
|
|
@@ -59,6 +59,17 @@ var yargsCmdBuilderFunc = function (cmdName, useProxy, yargs) {
|
|
|
59
59
|
return index_1.yargsCmdBuilders[cmdName](yargs);
|
|
60
60
|
}
|
|
61
61
|
};
|
|
62
|
+
var fetchDevices = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
63
|
+
var zeusVer;
|
|
64
|
+
return __generator(this, function (_a) {
|
|
65
|
+
switch (_a.label) {
|
|
66
|
+
case 0:
|
|
67
|
+
zeusVer = (0, index_1.zeusCurrentVersion)();
|
|
68
|
+
return [4, devicesData(zeusVer)];
|
|
69
|
+
case 1: return [2, _a.sent()];
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
}); };
|
|
62
73
|
var proxy = function (args) { return __awaiter(void 0, void 0, void 0, function () {
|
|
63
74
|
var res;
|
|
64
75
|
return __generator(this, function (_a) {
|
package/modules/create.js
CHANGED
|
@@ -104,6 +104,9 @@ var inquirerFunc = function (args, _a) {
|
|
|
104
104
|
{
|
|
105
105
|
name: 'OS 3.0 API (Build products can run on devices with OS 3.0 and above)',
|
|
106
106
|
value: 'v3'
|
|
107
|
+
}, {
|
|
108
|
+
name: 'OS 4.0 API (Build products can run on devices with OS 4.0 and above)',
|
|
109
|
+
value: 'v4'
|
|
107
110
|
}];
|
|
108
111
|
if (isWatchFace) {
|
|
109
112
|
options = options.slice(0, 2);
|
package/modules/version.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var _a;
|
|
3
3
|
exports.__esModule = true;
|
|
4
|
-
exports.version = void 0;
|
|
4
|
+
exports.zeusCurrentVersion = exports.version = void 0;
|
|
5
5
|
var node_child_process_1 = require("node:child_process");
|
|
6
6
|
var appUtilPkg = require('zeppos-app-utils/package.json');
|
|
7
7
|
var zeusVersion = require('../package.json').version;
|
|
@@ -34,3 +34,7 @@ function version() {
|
|
|
34
34
|
].join('\n');
|
|
35
35
|
}
|
|
36
36
|
exports.version = version;
|
|
37
|
+
function zeusCurrentVersion() {
|
|
38
|
+
return zeusVersion;
|
|
39
|
+
}
|
|
40
|
+
exports.zeusCurrentVersion = zeusCurrentVersion;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zeppos/zeus-cli",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.6",
|
|
4
4
|
"description": "zeus mini-program tools",
|
|
5
5
|
"main": "index.ts",
|
|
6
6
|
"author": "zepp",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"qrcode-terminal": "^0.12.0",
|
|
22
22
|
"vorpal": "^1.12.0",
|
|
23
23
|
"yargs": "^17.7.2",
|
|
24
|
-
"@zeppos/zpm": "^3.1.
|
|
24
|
+
"@zeppos/zpm": "^3.1.4",
|
|
25
25
|
"axios": "^1.7.7",
|
|
26
26
|
"chalk": "^4.1.2",
|
|
27
27
|
"chokidar": "^3.6.0",
|
|
@@ -117,7 +117,8 @@ var createX = function (cwdPath, args, func, beforeFiles) {
|
|
|
117
117
|
v1: (0, path_1.resolve)(templateDir, './os1.0'),
|
|
118
118
|
v2: (0, path_1.resolve)(templateDir, './os2.0'),
|
|
119
119
|
v3: (0, path_1.resolve)(templateDir, './os3.0'),
|
|
120
|
-
'v3.5': (0, path_1.resolve)(templateDir, './os3.5')
|
|
120
|
+
'v3.5': (0, path_1.resolve)(templateDir, './os3.5'),
|
|
121
|
+
v4: (0, path_1.resolve)(templateDir, './os4.0')
|
|
121
122
|
};
|
|
122
123
|
localTemplates = Object.keys(localTemplatesDirMap).reduce(function (temps, osVersion) {
|
|
123
124
|
var dir = localTemplatesDirMap[osVersion];
|
|
@@ -131,7 +132,7 @@ var createX = function (cwdPath, args, func, beforeFiles) {
|
|
|
131
132
|
};
|
|
132
133
|
return temps;
|
|
133
134
|
}, {});
|
|
134
|
-
allOS = ['v1', 'v2', 'v3', 'v3.5'];
|
|
135
|
+
allOS = ['v1', 'v2', 'v3', 'v3.5', 'v4'];
|
|
135
136
|
appTypes = ['watchface', 'app', 'workout-extension'];
|
|
136
137
|
genChoices = function () { return allOS.reduce(function (pre, osVersion) {
|
|
137
138
|
pre[osVersion] = [];
|
|
@@ -82,41 +82,50 @@ var fetchDevicesData = function (cdnUrl) {
|
|
|
82
82
|
});
|
|
83
83
|
});
|
|
84
84
|
};
|
|
85
|
-
var fetchDevices = function () {
|
|
86
|
-
|
|
87
|
-
return
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
85
|
+
var fetchDevices = function (currentVersion) {
|
|
86
|
+
if (currentVersion === void 0) { currentVersion = ''; }
|
|
87
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
88
|
+
var localContent, generatedVersion, now, prodDevices, betaDevices;
|
|
89
|
+
return __generator(this, function (_a) {
|
|
90
|
+
switch (_a.label) {
|
|
91
|
+
case 0:
|
|
92
|
+
localContent = {};
|
|
93
|
+
if (fs_1["default"].existsSync(LOCAL_CACHE_DEVICE_PATH)) {
|
|
94
|
+
try {
|
|
95
|
+
localContent = fs_extra_1["default"].readJsonSync(LOCAL_CACHE_DEVICE_PATH);
|
|
96
|
+
}
|
|
97
|
+
catch (_e) { }
|
|
94
98
|
}
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
99
|
+
generatedVersion = (0, lodash_1.get)(localContent, 'version') || '';
|
|
100
|
+
if (generatedVersion === '' || generatedVersion !== currentVersion) {
|
|
101
|
+
fs_extra_1["default"].removeSync(LOCAL_CACHE_DEVICE_PATH);
|
|
102
|
+
localContent = {};
|
|
103
|
+
}
|
|
104
|
+
now = Date.now().valueOf();
|
|
105
|
+
if (!!((0, lodash_1.get)(localContent, 'expiredTime') > now)) return [3, 3];
|
|
106
|
+
logger_1.logger.log(chalk_1["default"].hex('#DB8C41')('Updating devices, waiting ...'));
|
|
107
|
+
return [4, fetchDevicesData(serverPath)];
|
|
108
|
+
case 1:
|
|
109
|
+
prodDevices = _a.sent();
|
|
110
|
+
return [4, fetchDevicesData(serverPathBeta)];
|
|
111
|
+
case 2:
|
|
112
|
+
betaDevices = _a.sent();
|
|
113
|
+
if (!(0, lodash_1.isEmpty)(prodDevices) || !(0, lodash_1.isEmpty)(betaDevices)) {
|
|
114
|
+
fs_extra_1["default"].writeJsonSync(LOCAL_CACHE_DEVICE_PATH, {
|
|
115
|
+
devices: prodDevices,
|
|
116
|
+
devices_beta: [],
|
|
117
|
+
expiredTime: now + 3 * dayMS,
|
|
118
|
+
version: currentVersion
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
else {
|
|
122
|
+
return [2, {}];
|
|
123
|
+
}
|
|
124
|
+
return [3, 4];
|
|
125
|
+
case 3: return [2, {}];
|
|
126
|
+
case 4: return [2];
|
|
127
|
+
}
|
|
128
|
+
});
|
|
120
129
|
});
|
|
121
|
-
}
|
|
130
|
+
};
|
|
122
131
|
exports.fetchDevices = fetchDevices;
|
package/private-modules/zeppos-app-utils/dist/public/template/os4.0/app/calories/_package.json
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "calories",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "",
|
|
5
|
+
"main": "app.js",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
|
8
|
+
},
|
|
9
|
+
"author": "",
|
|
10
|
+
"license": "ISC",
|
|
11
|
+
"devDependencies": {
|
|
12
|
+
"@zeppos/device-types": "^3.0.0"
|
|
13
|
+
},
|
|
14
|
+
"dependencies": {
|
|
15
|
+
"@zeppos/zml": "^0.0.38"
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { log as Logger } from "@zos/utils";
|
|
2
|
+
import LocalStorage from "./utils/storage";
|
|
3
|
+
|
|
4
|
+
const logger = Logger.getLogger("calories-app");
|
|
5
|
+
const fileName = "calorie_data.txt";
|
|
6
|
+
|
|
7
|
+
App({
|
|
8
|
+
globalData: {
|
|
9
|
+
foodType: "chocolate",
|
|
10
|
+
localStorage: null,
|
|
11
|
+
},
|
|
12
|
+
onCreate() {
|
|
13
|
+
try {
|
|
14
|
+
this.globalData.localStorage = new LocalStorage(fileName);
|
|
15
|
+
const { foodType = "chocolate" } = this.globalData.localStorage.get();
|
|
16
|
+
this.globalData.foodType = foodType;
|
|
17
|
+
} catch (e) {
|
|
18
|
+
logger.log("--->e:", e);
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
|
|
22
|
+
onDestroy() {
|
|
23
|
+
this.globalData.localStorage.set({
|
|
24
|
+
foodType: getApp()._options.globalData.foodType,
|
|
25
|
+
});
|
|
26
|
+
},
|
|
27
|
+
});
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
{
|
|
2
|
+
"configVersion": "v3",
|
|
3
|
+
"app": {
|
|
4
|
+
"appId": 20001,
|
|
5
|
+
"appName": "Calories",
|
|
6
|
+
"appType": "app",
|
|
7
|
+
"version": {
|
|
8
|
+
"code": 1,
|
|
9
|
+
"name": "1.0.0"
|
|
10
|
+
},
|
|
11
|
+
"icon": "icon.png",
|
|
12
|
+
"vender": "zepp",
|
|
13
|
+
"description": "calories application"
|
|
14
|
+
},
|
|
15
|
+
"permissions": [
|
|
16
|
+
"data:os.device.info",
|
|
17
|
+
"device:os.local_storage",
|
|
18
|
+
"data:user.hd.calorie"
|
|
19
|
+
],
|
|
20
|
+
"runtime": {
|
|
21
|
+
"apiVersion": {
|
|
22
|
+
"compatible": "4.0",
|
|
23
|
+
"target": "4.0",
|
|
24
|
+
"minVersion": "4.0"
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
"targets": {
|
|
28
|
+
"gt": {
|
|
29
|
+
"module": {
|
|
30
|
+
"page": {
|
|
31
|
+
"pages": ["page/gt/index", "page/gt/food-list"]
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
"platforms": [
|
|
35
|
+
{
|
|
36
|
+
"st": "r",
|
|
37
|
+
"dw": 480
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
"st": "s",
|
|
41
|
+
"dw": 390
|
|
42
|
+
}
|
|
43
|
+
]
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
"i18n": {
|
|
47
|
+
"en-US": {
|
|
48
|
+
"appName": "Calories"
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
"defaultLanguage": "en-US"
|
|
52
|
+
}
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/// <reference path="node_modules/@zeppos/device-types/dist/index.d.ts" />
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import * as hmUI from "@zos/ui";
|
|
2
|
+
import { back } from "@zos/router";
|
|
3
|
+
import { log as Logger, px } from "@zos/utils";
|
|
4
|
+
|
|
5
|
+
import {
|
|
6
|
+
COMMON_TITLE_TEXT,
|
|
7
|
+
FOOD_LIST_Y,
|
|
8
|
+
FOOD_LIST_ITEM_MARGIN,
|
|
9
|
+
FOOD_LIST_ITEM_HEIGHT,
|
|
10
|
+
FOOD_LIST_RADIOGROUP,
|
|
11
|
+
FOOD_LIST_RADIO_ITEM,
|
|
12
|
+
FOOD_LIST_RADIO_ITEM_TEXT,
|
|
13
|
+
} from "zosLoader:./food-list.[pf].layout.js";
|
|
14
|
+
import { FOOD_CALORIES, isSquare } from "../../utils/constants";
|
|
15
|
+
const logger = Logger.getLogger("calories");
|
|
16
|
+
const globalData = getApp()._options.globalData;
|
|
17
|
+
|
|
18
|
+
Page({
|
|
19
|
+
state: {
|
|
20
|
+
activeIndex: -1,
|
|
21
|
+
isFinishInit: false,
|
|
22
|
+
radioGroup: null,
|
|
23
|
+
radioButtonsArray: [],
|
|
24
|
+
},
|
|
25
|
+
onInit() {
|
|
26
|
+
logger.log("onInit");
|
|
27
|
+
},
|
|
28
|
+
setPrograms(index) {
|
|
29
|
+
this.state.activeIndex = index;
|
|
30
|
+
globalData.foodType = FOOD_CALORIES[index].type;
|
|
31
|
+
back();
|
|
32
|
+
},
|
|
33
|
+
buildTitle() {
|
|
34
|
+
!isSquare && hmUI.createWidget(hmUI.widget.TEXT, COMMON_TITLE_TEXT);
|
|
35
|
+
},
|
|
36
|
+
buildFoodList() {
|
|
37
|
+
let activeIndex = 0;
|
|
38
|
+
const radioGroup = hmUI.createWidget(hmUI.widget.RADIO_GROUP, {
|
|
39
|
+
...FOOD_LIST_RADIOGROUP,
|
|
40
|
+
check_func: (group, index, checked) => {
|
|
41
|
+
if (checked) {
|
|
42
|
+
this.state.isFinishInit && this.setPrograms(index);
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
this.state.radioGroup = radioGroup;
|
|
48
|
+
|
|
49
|
+
for (let index = 0; index < FOOD_CALORIES.length; index++) {
|
|
50
|
+
this.buildRadioButton(index);
|
|
51
|
+
this.buildRadioText(index);
|
|
52
|
+
activeIndex =
|
|
53
|
+
FOOD_CALORIES[index].type === globalData.foodType ? index : activeIndex;
|
|
54
|
+
}
|
|
55
|
+
this.state.activeIndex = activeIndex;
|
|
56
|
+
this.initRadioGroup();
|
|
57
|
+
},
|
|
58
|
+
buildElement() {
|
|
59
|
+
this.buildTitle();
|
|
60
|
+
this.buildFoodList();
|
|
61
|
+
},
|
|
62
|
+
buildRadioButton(index) {
|
|
63
|
+
const radio = this.state.radioGroup.createWidget(hmUI.widget.STATE_BUTTON, {
|
|
64
|
+
...FOOD_LIST_RADIO_ITEM.styles,
|
|
65
|
+
y: px(index * (FOOD_LIST_ITEM_HEIGHT + FOOD_LIST_ITEM_MARGIN)),
|
|
66
|
+
});
|
|
67
|
+
this.state.radioButtonsArray.push(radio);
|
|
68
|
+
},
|
|
69
|
+
buildRadioText(index) {
|
|
70
|
+
const text = hmUI.createWidget(hmUI.widget.TEXT, {
|
|
71
|
+
...FOOD_LIST_RADIO_ITEM_TEXT,
|
|
72
|
+
y: px(
|
|
73
|
+
FOOD_LIST_Y + index * (FOOD_LIST_ITEM_HEIGHT + FOOD_LIST_ITEM_MARGIN)
|
|
74
|
+
),
|
|
75
|
+
text: `${FOOD_CALORIES[index].name[0].toUpperCase()}${FOOD_CALORIES[
|
|
76
|
+
index
|
|
77
|
+
].name.slice(1)}`,
|
|
78
|
+
});
|
|
79
|
+
text.addEventListener(hmUI.event.SELECT, () => {
|
|
80
|
+
this.state.radioGroup.setProperty(
|
|
81
|
+
hmUI.prop.CHECKED,
|
|
82
|
+
this.state.radioButtonsArray[index]
|
|
83
|
+
);
|
|
84
|
+
});
|
|
85
|
+
},
|
|
86
|
+
initRadioGroup() {
|
|
87
|
+
this.state.radioGroup.setProperty(
|
|
88
|
+
hmUI.prop.INIT,
|
|
89
|
+
this.state.radioButtonsArray[0]
|
|
90
|
+
);
|
|
91
|
+
this.state.radioGroup.setProperty(
|
|
92
|
+
hmUI.prop.CHECKED,
|
|
93
|
+
this.state.radioButtonsArray[this.state.activeIndex]
|
|
94
|
+
);
|
|
95
|
+
this.state.isFinishInit = true;
|
|
96
|
+
},
|
|
97
|
+
build() {
|
|
98
|
+
this.buildElement();
|
|
99
|
+
},
|
|
100
|
+
onReady() {},
|
|
101
|
+
|
|
102
|
+
onShow() {},
|
|
103
|
+
|
|
104
|
+
onHide() {},
|
|
105
|
+
|
|
106
|
+
onDestroy() {},
|
|
107
|
+
});
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import * as hmUI from "@zos/ui";
|
|
2
|
+
import { getText } from "@zos/i18n";
|
|
3
|
+
import { px } from "@zos/utils";
|
|
4
|
+
|
|
5
|
+
import { DEVICE_WIDTH } from "../../utils/constants";
|
|
6
|
+
|
|
7
|
+
export const COMMON_TITLE_TEXT = {
|
|
8
|
+
text: getText("calories"),
|
|
9
|
+
x: px(96),
|
|
10
|
+
y: px(40),
|
|
11
|
+
w: DEVICE_WIDTH - 2 * px(96),
|
|
12
|
+
h: px(46),
|
|
13
|
+
color: 0xffffff,
|
|
14
|
+
text_size: px(36),
|
|
15
|
+
align_h: hmUI.align.CENTER_H,
|
|
16
|
+
align_v: hmUI.align.CENTER_V,
|
|
17
|
+
text_style: hmUI.text_style.WRAP,
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export const FOOD_LIST_Y = px(178);
|
|
21
|
+
export const FOOD_LIST_ITEM_MARGIN = px(64);
|
|
22
|
+
export const FOOD_LIST_ITEM_HEIGHT = px(64);
|
|
23
|
+
export const FOOD_LIST_RADIOGROUP = {
|
|
24
|
+
select_src: "selected.png",
|
|
25
|
+
unselect_src: "unselected.png",
|
|
26
|
+
x: px(44),
|
|
27
|
+
y: px(FOOD_LIST_Y),
|
|
28
|
+
w: -1,
|
|
29
|
+
h: -1,
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export const FOOD_LIST_RADIO_ITEM = {
|
|
33
|
+
x: 0,
|
|
34
|
+
y: 0,
|
|
35
|
+
w: px(FOOD_LIST_ITEM_HEIGHT),
|
|
36
|
+
h: px(FOOD_LIST_ITEM_HEIGHT),
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
export const FOOD_LIST_RADIO_ITEM_TEXT = {
|
|
40
|
+
x: px(120),
|
|
41
|
+
y: 0,
|
|
42
|
+
w: px(360),
|
|
43
|
+
h: px(64),
|
|
44
|
+
color: 0xffffff,
|
|
45
|
+
text_size: px(32),
|
|
46
|
+
align_h: hmUI.align.LEFT,
|
|
47
|
+
align_v: hmUI.align.CENTER_V,
|
|
48
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import * as hmUI from "@zos/ui";
|
|
2
|
+
import { px } from "@zos/utils";
|
|
3
|
+
|
|
4
|
+
export const COMMON_TITLE_TEXT = null;
|
|
5
|
+
export const FOOD_LIST_Y = px(96);
|
|
6
|
+
export const FOOD_LIST_ITEM_MARGIN = px(60);
|
|
7
|
+
export const FOOD_LIST_ITEM_HEIGHT = px(52);
|
|
8
|
+
export const FOOD_LIST_RADIOGROUP = {
|
|
9
|
+
select_src: "selected.png",
|
|
10
|
+
unselect_src: "unselected.png",
|
|
11
|
+
x: px(30),
|
|
12
|
+
y: FOOD_LIST_Y,
|
|
13
|
+
w: -1,
|
|
14
|
+
h: -1,
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export const FOOD_LIST_RADIO_ITEM = {
|
|
18
|
+
x: 0,
|
|
19
|
+
y: FOOD_LIST_Y,
|
|
20
|
+
w: FOOD_LIST_ITEM_HEIGHT,
|
|
21
|
+
h: FOOD_LIST_ITEM_HEIGHT,
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export const FOOD_LIST_RADIO_ITEM_TEXT = {
|
|
25
|
+
x: px(106),
|
|
26
|
+
y: px(97),
|
|
27
|
+
w: px(254),
|
|
28
|
+
h: FOOD_LIST_ITEM_HEIGHT,
|
|
29
|
+
color: 0xffffff,
|
|
30
|
+
text_size: px(32),
|
|
31
|
+
align_h: hmUI.align.LEFT,
|
|
32
|
+
align_v: hmUI.align.CENTER_V,
|
|
33
|
+
};
|