@zeppos/zeus-cli 1.3.3 → 1.3.5

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.
Files changed (173) hide show
  1. package/package.json +2 -2
  2. package/private-modules/zeppos-app-utils/dist/config/device.js +2 -443
  3. package/private-modules/zeppos-app-utils/dist/modules/create/local-app.js +1 -1
  4. package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/calories/app-widget/index.js +99 -0
  5. package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/calories/app.js +9 -15
  6. package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/calories/app.json +24 -0
  7. package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/calories/page/gts/food-list.js +4 -0
  8. package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/calories/page/gts/index.js +24 -24
  9. package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/calories/secondary-widget/index.js +139 -0
  10. package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/calories/utils/styles-gts-3.js +23 -24
  11. package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/calories/utils/styles.js +24 -24
  12. package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/empty/jsconfig.json +2 -7
  13. package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/fetch-api/pages/index.js +12 -12
  14. package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/{todo-list → fetch-api/todo-list}/app.json +8 -0
  15. package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/{todo-list → fetch-api/todo-list}/page/home/index.page.js +16 -16
  16. package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/{todo-list → fetch-api/todo-list}/page/home/index.style.js +11 -11
  17. package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/{todo-list → fetch-api/todo-list}/page/i18n/en-US.po +1 -1
  18. package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/fetch-api/todo-list/secondary-widget/index.js +160 -0
  19. package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/fetch-api/todo-list/utils/constants.js +1 -0
  20. package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/hello-world/app.json +2 -18
  21. package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/hello-world/page/gtr/home/index.page.js +5 -5
  22. package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/hello-world/page/gtr/home/index.style.js +7 -7
  23. package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/hello-world/page/gts/home/index.page.js +5 -5
  24. package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/hello-world/page/gts/home/index.style.js +6 -6
  25. package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/showcase/app.json +23 -9
  26. package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/showcase/assets/gt4/anim/animation_0.png +0 -0
  27. package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/showcase/assets/gt4/anim/animation_1.png +0 -0
  28. package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/showcase/assets/gt4/anim/animation_10.png +0 -0
  29. package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/showcase/assets/gt4/anim/animation_11.png +0 -0
  30. package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/showcase/assets/gt4/anim/animation_12.png +0 -0
  31. package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/showcase/assets/gt4/anim/animation_13.png +0 -0
  32. package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/showcase/assets/gt4/anim/animation_14.png +0 -0
  33. package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/showcase/assets/gt4/anim/animation_15.png +0 -0
  34. package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/showcase/assets/gt4/anim/animation_16.png +0 -0
  35. package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/showcase/assets/gt4/anim/animation_17.png +0 -0
  36. package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/showcase/assets/gt4/anim/animation_18.png +0 -0
  37. package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/showcase/assets/gt4/anim/animation_19.png +0 -0
  38. package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/showcase/assets/gt4/anim/animation_2.png +0 -0
  39. package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/showcase/assets/gt4/anim/animation_20.png +0 -0
  40. package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/showcase/assets/gt4/anim/animation_21.png +0 -0
  41. package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/showcase/assets/gt4/anim/animation_22.png +0 -0
  42. package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/showcase/assets/gt4/anim/animation_23.png +0 -0
  43. package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/showcase/assets/gt4/anim/animation_24.png +0 -0
  44. package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/showcase/assets/gt4/anim/animation_25.png +0 -0
  45. package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/showcase/assets/gt4/anim/animation_26.png +0 -0
  46. package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/showcase/assets/gt4/anim/animation_27.png +0 -0
  47. package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/showcase/assets/gt4/anim/animation_28.png +0 -0
  48. package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/showcase/assets/gt4/anim/animation_29.png +0 -0
  49. package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/showcase/assets/gt4/anim/animation_3.png +0 -0
  50. package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/showcase/assets/gt4/anim/animation_30.png +0 -0
  51. package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/showcase/assets/gt4/anim/animation_31.png +0 -0
  52. package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/showcase/assets/gt4/anim/animation_32.png +0 -0
  53. package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/showcase/assets/gt4/anim/animation_33.png +0 -0
  54. package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/showcase/assets/gt4/anim/animation_34.png +0 -0
  55. package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/showcase/assets/gt4/anim/animation_35.png +0 -0
  56. package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/showcase/assets/gt4/anim/animation_36.png +0 -0
  57. package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/showcase/assets/gt4/anim/animation_4.png +0 -0
  58. package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/showcase/assets/gt4/anim/animation_5.png +0 -0
  59. package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/showcase/assets/gt4/anim/animation_6.png +0 -0
  60. package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/showcase/assets/gt4/anim/animation_7.png +0 -0
  61. package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/showcase/assets/gt4/anim/animation_8.png +0 -0
  62. package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/showcase/assets/gt4/anim/animation_9.png +0 -0
  63. package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/showcase/assets/gt4/button_normal.png +0 -0
  64. package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/showcase/assets/gt4/button_press.png +0 -0
  65. package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/showcase/assets/gt4/false copy.png +0 -0
  66. package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/showcase/assets/gt4/icon copy.png +0 -0
  67. package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/showcase/assets/gt4/number-img/0.png +0 -0
  68. package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/showcase/assets/gt4/number-img/1.png +0 -0
  69. package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/showcase/assets/gt4/number-img/2.png +0 -0
  70. package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/showcase/assets/gt4/number-img/3.png +0 -0
  71. package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/showcase/assets/gt4/number-img/4.png +0 -0
  72. package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/showcase/assets/gt4/number-img/5.png +0 -0
  73. package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/showcase/assets/gt4/number-img/6.png +0 -0
  74. package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/showcase/assets/gt4/number-img/7.png +0 -0
  75. package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/showcase/assets/gt4/number-img/8.png +0 -0
  76. package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/showcase/assets/gt4/number-img/9.png +0 -0
  77. package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/showcase/assets/gt4/radio_select.png +0 -0
  78. package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/showcase/assets/gt4/select.png +0 -0
  79. package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/showcase/assets/gt4/selected.png +0 -0
  80. package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/showcase/assets/gt4/switch_off.png +0 -0
  81. package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/showcase/assets/gt4/switch_on.png +0 -0
  82. package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/showcase/assets/gt4/unselect.png +0 -0
  83. package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/showcase/assets/gt4/unselected.png +0 -0
  84. package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/showcase/assets/gt4/zeppos.png +0 -0
  85. package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/showcase/assets/raw/custom.ttf +0 -0
  86. package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/showcase/config/tree.js +76 -2
  87. package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/showcase/global.d.ts +1 -1
  88. package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/showcase/jsconfig.json +1 -1
  89. package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/showcase/page/index.js +7 -5
  90. package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/showcase/page/interaction/on_digital_crown.js +26 -0
  91. package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/showcase/page/interaction/on_key.js +32 -0
  92. package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/showcase/page/interaction/on_wrist_motion.js +27 -0
  93. package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/showcase/page/router/set_launch_app_timeout.js +32 -0
  94. package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/showcase/page/sensor/pai.js +1 -1
  95. package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/showcase/page/ui/widget/arc.js +28 -0
  96. package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/showcase/page/ui/widget/button.js +44 -0
  97. package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/showcase/page/ui/widget/checkbox_group.js +45 -0
  98. package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/showcase/page/ui/widget/circle.js +28 -0
  99. package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/showcase/page/ui/widget/cycle_image_text_list.js +43 -0
  100. package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/showcase/page/ui/widget/cycle_list.js +26 -0
  101. package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/showcase/page/ui/widget/dialog.js +32 -0
  102. package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/showcase/page/ui/widget/fill_rect.js +29 -0
  103. package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/showcase/page/ui/widget/histogram.js +76 -0
  104. package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/showcase/page/ui/widget/img.js +23 -0
  105. package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/showcase/page/ui/widget/img_anim.js +37 -0
  106. package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/showcase/page/ui/widget/page_indicator.js +32 -0
  107. package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/showcase/page/ui/widget/pick_date.js +43 -0
  108. package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/showcase/page/ui/widget/polyline.js +36 -0
  109. package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/showcase/page/ui/widget/qrcode.js +22 -0
  110. package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/showcase/page/ui/widget/radio_group.js +44 -0
  111. package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/showcase/page/ui/widget/scroll_list.js +106 -0
  112. package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/showcase/page/ui/widget/slide_switch.js +28 -0
  113. package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/showcase/page/ui/widget/stroke_rect.js +28 -0
  114. package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/showcase/page/ui/widget/text.js +51 -0
  115. package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/showcase/page/ui/widget/view_container.js +81 -0
  116. package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/showcase/utils/UI/TextByLine.js +19 -12
  117. package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/showcase/utils/UI/Title.js +2 -1
  118. package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/showcase/utils/styles.js +2 -0
  119. package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/showcase/utils/test.js +3 -2
  120. package/private-modules/zeppos-app-utils/dist/public/template/os3.0/app/calories/assets/gt.r/icon.png +0 -0
  121. package/private-modules/zeppos-app-utils/dist/public/template/os3.0/app/calories/assets/gt.s/icon.png +0 -0
  122. package/private-modules/zeppos-app-utils/dist/public/template/os3.0/app/calories/global.d.ts +1 -1
  123. package/private-modules/zeppos-app-utils/dist/public/template/os3.0/app/calories/jsconfig.json +1 -1
  124. package/private-modules/zeppos-app-utils/dist/public/template/os3.0/app/download/assets/gt.r/icon.png +0 -0
  125. package/private-modules/zeppos-app-utils/dist/public/template/os3.0/app/download/global.d.ts +1 -1
  126. package/private-modules/zeppos-app-utils/dist/public/template/os3.0/app/download/jsconfig.json +1 -1
  127. package/private-modules/zeppos-app-utils/dist/public/template/os3.0/app/empty/global.d.ts +1 -1
  128. package/private-modules/zeppos-app-utils/dist/public/template/os3.0/app/empty/jsconfig.json +1 -1
  129. package/private-modules/zeppos-app-utils/dist/public/template/os3.0/app/fetch-api/assets/common.r/icon.png +0 -0
  130. package/private-modules/zeppos-app-utils/dist/public/template/os3.0/app/fetch-api/assets/common.s/icon.png +0 -0
  131. package/private-modules/zeppos-app-utils/dist/public/template/os3.0/app/fetch-api/global.d.ts +1 -1
  132. package/private-modules/zeppos-app-utils/dist/public/template/os3.0/app/fetch-api/jsconfig.json +1 -1
  133. package/private-modules/zeppos-app-utils/dist/public/template/os3.0/app/hello-world/assets/gt.r/icon.png +0 -0
  134. package/private-modules/zeppos-app-utils/dist/public/template/os3.0/app/hello-world/assets/gt.s/icon.png +0 -0
  135. package/private-modules/zeppos-app-utils/dist/public/template/os3.0/app/hello-world/global.d.ts +1 -1
  136. package/private-modules/zeppos-app-utils/dist/public/template/os3.0/app/hello-world/jsconfig.json +1 -1
  137. package/private-modules/zeppos-app-utils/dist/public/template/os3.0/app/notification/assets/gt.r/icon.png +0 -0
  138. package/private-modules/zeppos-app-utils/dist/public/template/os3.0/app/notification/global.d.ts +1 -1
  139. package/private-modules/zeppos-app-utils/dist/public/template/os3.0/app/notification/jsconfig.json +1 -1
  140. package/private-modules/zeppos-app-utils/dist/public/template/os3.0/app/todo-list/assets/gt.r/icon.png +0 -0
  141. package/private-modules/zeppos-app-utils/dist/public/template/os3.0/app/todo-list/assets/gt.s/icon.png +0 -0
  142. package/private-modules/zeppos-app-utils/dist/public/template/os3.0/app/todo-list/global.d.ts +1 -1
  143. package/private-modules/zeppos-app-utils/dist/public/template/os3.0/app/todo-list/jsconfig.json +1 -1
  144. package/private-modules/zeppos-app-utils/package.json +1 -1
  145. package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/calories/_package.json +0 -14
  146. package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/calories/jsconfig.json +0 -14
  147. package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/calories/utils/storage.js +0 -40
  148. package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/fetch-api/_package.json +0 -14
  149. package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/fetch-api/jsconfig.json +0 -14
  150. package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/hello-world/_package.json +0 -14
  151. package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/hello-world/app-side/index.js +0 -11
  152. package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/hello-world/jsconfig.json +0 -14
  153. package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/hello-world/setting/i18n/en-US.po +0 -2
  154. package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/hello-world/setting/index.js +0 -5
  155. package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/todo-list/_package.json +0 -14
  156. package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/todo-list/jsconfig.json +0 -14
  157. package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/todo-list/utils/constants.js +0 -3
  158. package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/todo-list/utils/fs.js +0 -34
  159. /package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/{todo-list → fetch-api/todo-list}/.prettierrc.js +0 -0
  160. /package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/{todo-list → fetch-api/todo-list}/app-side/index.js +0 -0
  161. /package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/{todo-list → fetch-api/todo-list}/app.js +0 -0
  162. /package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/{todo-list → fetch-api/todo-list}/assets/gts/icon.png +0 -0
  163. /package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/{todo-list → fetch-api/todo-list}/page/home/index.page.json +0 -0
  164. /package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/{todo-list → fetch-api/todo-list}/setting/i18n/en-US.po +0 -0
  165. /package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/{todo-list → fetch-api/todo-list}/setting/index.js +0 -0
  166. /package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/{todo-list → fetch-api/todo-list}/shared/data.js +0 -0
  167. /package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/{todo-list → fetch-api/todo-list}/shared/defer.js +0 -0
  168. /package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/{todo-list → fetch-api/todo-list}/shared/device-polyfill.js +0 -0
  169. /package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/{todo-list → fetch-api/todo-list}/shared/es6-promise.js +0 -0
  170. /package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/{todo-list → fetch-api/todo-list}/shared/event.js +0 -0
  171. /package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/{todo-list → fetch-api/todo-list}/shared/message-side.js +0 -0
  172. /package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/{todo-list → fetch-api/todo-list}/shared/message.js +0 -0
  173. /package/private-modules/zeppos-app-utils/dist/public/template/os2.0/app/{todo-list → fetch-api/todo-list}/utils/index.js +0 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeppos/zeus-cli",
3
- "version": "1.3.3",
3
+ "version": "1.3.5",
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.5.1",
24
- "@zeppos/zpm": "^3.0.0",
24
+ "@zeppos/zpm": "^3.0.1",
25
25
  "axios": "^0.27.2",
26
26
  "chalk": "^4.1.2",
27
27
  "chokidar": "^3.5.3",
@@ -13,459 +13,18 @@ var __assign = (this && this.__assign) || function () {
13
13
  var __importDefault = (this && this.__importDefault) || function (mod) {
14
14
  return (mod && mod.__esModule) ? mod : { "default": mod };
15
15
  };
16
- var _a;
17
16
  exports.__esModule = true;
18
- exports.deviceInternalCodeName = exports.OSV2DeviceTargetNames = exports.OSV2Devices = exports.deviceTargets = exports.DeviceScreenType = exports.DeviceSource = exports.DevicePlatformName = exports.DeviceTarget = void 0;
17
+ exports.deviceInternalCodeName = exports.OSV2DeviceTargetNames = exports.OSV2Devices = exports.deviceTargets = exports.DeviceScreenType = void 0;
19
18
  var lodash_1 = require("lodash");
20
19
  var device_server_1 = __importDefault(require("./device-server"));
21
20
  var tools_1 = require("../tools/tools");
22
- var DeviceTarget;
23
- (function (DeviceTarget) {
24
- DeviceTarget["MADRID"] = "madrid";
25
- DeviceTarget["VERONA"] = "verona";
26
- DeviceTarget["ZURICH"] = "zurich";
27
- DeviceTarget["TEIDE"] = "teide";
28
- DeviceTarget["PROVENCE"] = "provence";
29
- DeviceTarget["BARI"] = "bari";
30
- DeviceTarget["BERLIN"] = "berlin";
31
- DeviceTarget["LILLE"] = "lille";
32
- DeviceTarget["VIENNA"] = "vienna";
33
- DeviceTarget["ANDES"] = "andes";
34
- DeviceTarget["MONACO"] = "monaco";
35
- DeviceTarget["SWIFT"] = "swift";
36
- DeviceTarget["SWORDFISH"] = "swordfishw";
37
- DeviceTarget["CHEETAH"] = "cheetahw";
38
- DeviceTarget["HANNOVER"] = "hannover";
39
- DeviceTarget["ETNA"] = "etna";
40
- DeviceTarget["ALTAI"] = "altai";
41
- })(DeviceTarget = exports.DeviceTarget || (exports.DeviceTarget = {}));
42
- var DevicePlatformName;
43
- (function (DevicePlatformName) {
44
- DevicePlatformName["MADRID"] = "gtr3-pro";
45
- DevicePlatformName["MADRIDW"] = "gtr3-pro-w";
46
- DevicePlatformName["Madrid2"] = "gtr3-pro-meilin";
47
- DevicePlatformName["VERONA"] = "gtr3";
48
- DevicePlatformName["VERONAW"] = "gtr3-w";
49
- DevicePlatformName["ZURICH"] = "gts3";
50
- DevicePlatformName["ZURICHW"] = "gts3-w";
51
- DevicePlatformName["TEIDE"] = "t-rex2";
52
- DevicePlatformName["TEIDEW"] = "t-rex2-w";
53
- DevicePlatformName["PROVENCE"] = "gts4-mini";
54
- DevicePlatformName["PROVENCEW"] = "gts4-mini-w";
55
- DevicePlatformName["BARI_NFC"] = "amazfit-band7-nfc";
56
- DevicePlatformName["BARI"] = "amazfit-band7";
57
- DevicePlatformName["BARI_W"] = "amazfit-band7-w";
58
- DevicePlatformName["BERLIN"] = "gtr4";
59
- DevicePlatformName["BERLIN_W"] = "gtr4-w";
60
- DevicePlatformName["LILLE"] = "gts4";
61
- DevicePlatformName["LILLE_W"] = "gts4-w";
62
- DevicePlatformName["VIENNA"] = "falcon";
63
- DevicePlatformName["VIENNA_W"] = "falcon-w";
64
- DevicePlatformName["ANDES"] = "t-rex-ultra";
65
- DevicePlatformName["ANDES_W"] = "t-rex-ultra-w";
66
- DevicePlatformName["MONACO"] = "monaco";
67
- DevicePlatformName["MONACO_WN"] = "monaco-wn";
68
- DevicePlatformName["MONACO_W"] = "monaco-w";
69
- DevicePlatformName["SWIFT"] = "swift";
70
- DevicePlatformName["SWIFT_W"] = "swift-w";
71
- DevicePlatformName["SWORDFISH_W"] = "swordfish-w";
72
- DevicePlatformName["CHEETAH_W"] = "cheetah-w";
73
- DevicePlatformName["HANNOVER"] = "hannover";
74
- DevicePlatformName["ETNA"] = "etna";
75
- DevicePlatformName["ETNA_W"] = "etna-w";
76
- DevicePlatformName["ALTAI"] = "altai";
77
- })(DevicePlatformName = exports.DevicePlatformName || (exports.DevicePlatformName = {}));
78
- var DeviceSource;
79
- (function (DeviceSource) {
80
- DeviceSource[DeviceSource["MADRID"] = 229] = "MADRID";
81
- DeviceSource[DeviceSource["MADRIDW"] = 230] = "MADRIDW";
82
- DeviceSource[DeviceSource["Madrid2"] = 6095106] = "Madrid2";
83
- DeviceSource[DeviceSource["VERONA"] = 226] = "VERONA";
84
- DeviceSource[DeviceSource["VERONAW"] = 227] = "VERONAW";
85
- DeviceSource[DeviceSource["ZURICH"] = 224] = "ZURICH";
86
- DeviceSource[DeviceSource["ZURICHW"] = 225] = "ZURICHW";
87
- DeviceSource[DeviceSource["TEIDE"] = 418] = "TEIDE";
88
- DeviceSource[DeviceSource["TEIDEW"] = 419] = "TEIDEW";
89
- DeviceSource[DeviceSource["PROVENCE"] = 246] = "PROVENCE";
90
- DeviceSource[DeviceSource["PROVENCEW"] = 247] = "PROVENCEW";
91
- DeviceSource[DeviceSource["BARI_NFC"] = 252] = "BARI_NFC";
92
- DeviceSource[DeviceSource["BARI"] = 253] = "BARI";
93
- DeviceSource[DeviceSource["BARI_W"] = 254] = "BARI_W";
94
- DeviceSource[DeviceSource["BERLIN"] = 7930112] = "BERLIN";
95
- DeviceSource[DeviceSource["BERLIN_W"] = 7930113] = "BERLIN_W";
96
- DeviceSource[DeviceSource["LILLE"] = 7995648] = "LILLE";
97
- DeviceSource[DeviceSource["LILLE_W"] = 7995649] = "LILLE_W";
98
- DeviceSource[DeviceSource["VIENNA"] = 414] = "VIENNA";
99
- DeviceSource[DeviceSource["VIENNA_W"] = 415] = "VIENNA_W";
100
- DeviceSource[DeviceSource["ANDES"] = 6553856] = "ANDES";
101
- DeviceSource[DeviceSource["ANDES_W"] = 6553857] = "ANDES_W";
102
- DeviceSource[DeviceSource["MONACO"] = 8519936] = "MONACO";
103
- DeviceSource[DeviceSource["MONACO_WN"] = 8519937] = "MONACO_WN";
104
- DeviceSource[DeviceSource["MONACO_W"] = 8519939] = "MONACO_W";
105
- DeviceSource[DeviceSource["SWIFT"] = 8192256] = "SWIFT";
106
- DeviceSource[DeviceSource["SWIFT_W"] = 8192257] = "SWIFT_W";
107
- DeviceSource[DeviceSource["SWORDFISH_W"] = 8257793] = "SWORDFISH_W";
108
- DeviceSource[DeviceSource["CHEETAH_W"] = 8126721] = "CHEETAH_W";
109
- DeviceSource[DeviceSource["HANNOVER"] = 8323329] = "HANNOVER";
110
- DeviceSource[DeviceSource["ETNA"] = 8388864] = "ETNA";
111
- DeviceSource[DeviceSource["ETNA_W"] = 8388865] = "ETNA_W";
112
- DeviceSource[DeviceSource["ALTAI"] = 8454401] = "ALTAI";
113
- })(DeviceSource = exports.DeviceSource || (exports.DeviceSource = {}));
114
21
  var DeviceScreenType;
115
22
  (function (DeviceScreenType) {
116
23
  DeviceScreenType["R"] = "r";
117
24
  DeviceScreenType["S"] = "s";
118
25
  DeviceScreenType["B"] = "b";
119
26
  })(DeviceScreenType = exports.DeviceScreenType || (exports.DeviceScreenType = {}));
120
- exports.deviceTargets = __assign((_a = {}, _a[DeviceTarget.MADRID] = {
121
- deviceName: 'Amazfit GTR 3 Pro',
122
- platforms: [
123
- {
124
- name: DevicePlatformName.MADRID,
125
- deviceSource: DeviceSource.MADRID
126
- },
127
- {
128
- name: DevicePlatformName.MADRIDW,
129
- deviceSource: DeviceSource.MADRIDW
130
- },
131
- {
132
- name: DevicePlatformName.Madrid2,
133
- deviceSource: DeviceSource.Madrid2
134
- },
135
- ],
136
- screen: {
137
- type: DeviceScreenType.R,
138
- width: 480,
139
- height: 480
140
- },
141
- apiLevelLimit: {
142
- min: '1.0.0',
143
- max: '1.99.99'
144
- }
145
- }, _a[DeviceTarget.VERONA] = {
146
- deviceName: 'Amazfit GTR 3',
147
- platforms: [
148
- {
149
- name: DevicePlatformName.VERONA,
150
- deviceSource: DeviceSource.VERONA
151
- },
152
- {
153
- name: DevicePlatformName.VERONAW,
154
- deviceSource: DeviceSource.VERONAW
155
- },
156
- ],
157
- screen: {
158
- type: DeviceScreenType.R,
159
- width: 454,
160
- height: 454
161
- },
162
- apiLevelLimit: {
163
- min: '1.0.0',
164
- max: '1.99.99'
165
- }
166
- }, _a[DeviceTarget.ZURICH] = {
167
- deviceName: 'Amazfit GTS 3',
168
- platforms: [
169
- {
170
- name: DevicePlatformName.ZURICH,
171
- deviceSource: DeviceSource.ZURICH
172
- },
173
- {
174
- name: DevicePlatformName.ZURICHW,
175
- deviceSource: DeviceSource.ZURICHW
176
- },
177
- ],
178
- screen: {
179
- type: DeviceScreenType.S,
180
- width: 390,
181
- height: 450
182
- },
183
- apiLevelLimit: {
184
- min: '1.0.0',
185
- max: '1.99.99'
186
- }
187
- }, _a[DeviceTarget.TEIDE] = {
188
- deviceName: 'Amazfit T-Rex 2',
189
- platforms: [
190
- {
191
- name: DevicePlatformName.TEIDE,
192
- deviceSource: DeviceSource.TEIDE
193
- },
194
- {
195
- name: DevicePlatformName.TEIDEW,
196
- deviceSource: DeviceSource.TEIDEW
197
- },
198
- ],
199
- screen: {
200
- type: DeviceScreenType.R,
201
- width: 454,
202
- height: 454
203
- },
204
- apiLevelLimit: {
205
- min: '1.0.0',
206
- max: '1.99.99'
207
- }
208
- }, _a[DeviceTarget.PROVENCE] = {
209
- deviceName: 'Amazfit GTS 4 Mini',
210
- platforms: [
211
- {
212
- name: DevicePlatformName.PROVENCE,
213
- deviceSource: DeviceSource.PROVENCE
214
- },
215
- {
216
- name: DevicePlatformName.PROVENCEW,
217
- deviceSource: DeviceSource.PROVENCEW
218
- },
219
- ],
220
- screen: {
221
- type: DeviceScreenType.S,
222
- width: 336,
223
- height: 384
224
- },
225
- apiLevelLimit: {
226
- min: '1.0.0',
227
- max: '1.99.99'
228
- }
229
- }, _a[DeviceTarget.BARI] = {
230
- deviceName: 'Amazfit Band 7',
231
- platforms: [
232
- {
233
- name: DevicePlatformName.BARI_NFC,
234
- deviceSource: DeviceSource.BARI_NFC
235
- },
236
- {
237
- name: DevicePlatformName.BARI,
238
- deviceSource: DeviceSource.BARI
239
- },
240
- {
241
- name: DevicePlatformName.BARI_W,
242
- deviceSource: DeviceSource.BARI_W
243
- },
244
- ],
245
- screen: {
246
- type: DeviceScreenType.B,
247
- width: 194,
248
- height: 368
249
- },
250
- apiLevelLimit: {
251
- min: '1.0.0',
252
- max: '1.99.99'
253
- }
254
- }, _a[DeviceTarget.BERLIN] = {
255
- deviceName: 'Amazfit GTR 4',
256
- platforms: [
257
- {
258
- name: DevicePlatformName.BERLIN,
259
- deviceSource: DeviceSource.BERLIN
260
- },
261
- {
262
- name: DevicePlatformName.BERLIN_W,
263
- deviceSource: DeviceSource.BERLIN_W
264
- },
265
- ],
266
- screen: {
267
- type: DeviceScreenType.R,
268
- width: 466,
269
- height: 466
270
- },
271
- apiLevelLimit: {
272
- min: '1.0.0',
273
- max: '2.99.99'
274
- }
275
- }, _a[DeviceTarget.LILLE] = {
276
- deviceName: 'Amazfit GTS 4',
277
- platforms: [
278
- {
279
- name: DevicePlatformName.LILLE,
280
- deviceSource: DeviceSource.LILLE
281
- },
282
- {
283
- name: DevicePlatformName.LILLE_W,
284
- deviceSource: DeviceSource.LILLE_W
285
- },
286
- ],
287
- screen: {
288
- type: DeviceScreenType.S,
289
- width: 390,
290
- height: 450
291
- },
292
- apiLevelLimit: {
293
- min: '1.0.0',
294
- max: '2.99.99'
295
- }
296
- }, _a[DeviceTarget.VIENNA] = {
297
- deviceName: 'Amazfit Falcon',
298
- platforms: [
299
- {
300
- name: DevicePlatformName.VIENNA,
301
- deviceSource: DeviceSource.VIENNA
302
- },
303
- {
304
- name: DevicePlatformName.VIENNA_W,
305
- deviceSource: DeviceSource.VIENNA_W
306
- },
307
- ],
308
- screen: {
309
- type: DeviceScreenType.R,
310
- width: 416,
311
- height: 416
312
- },
313
- apiLevelLimit: {
314
- min: '1.0.0',
315
- max: '1.99.99'
316
- }
317
- }, _a[DeviceTarget.ANDES] = {
318
- deviceName: 'Amazfit T-Rex Ultra',
319
- platforms: [
320
- {
321
- name: DevicePlatformName.ANDES,
322
- deviceSource: DeviceSource.ANDES
323
- },
324
- {
325
- name: DevicePlatformName.ANDES_W,
326
- deviceSource: DeviceSource.ANDES_W
327
- },
328
- ],
329
- screen: {
330
- type: DeviceScreenType.R,
331
- width: 454,
332
- height: 454
333
- },
334
- apiLevelLimit: {
335
- min: '1.0.0',
336
- max: '2.99.99'
337
- }
338
- }, _a[DeviceTarget.MONACO] = {
339
- deviceName: 'Amazfit Balance',
340
- platforms: [
341
- {
342
- name: DevicePlatformName.MONACO,
343
- deviceSource: DeviceSource.MONACO
344
- },
345
- {
346
- name: DevicePlatformName.MONACO_WN,
347
- deviceSource: DeviceSource.MONACO_WN
348
- },
349
- {
350
- name: DevicePlatformName.MONACO_W,
351
- deviceSource: DeviceSource.MONACO_W
352
- },
353
- ],
354
- screen: {
355
- type: DeviceScreenType.R,
356
- width: 480,
357
- height: 480
358
- },
359
- apiLevelLimit: {
360
- min: '1.0.0',
361
- max: '3.99.99'
362
- }
363
- }, _a[DeviceTarget.SWIFT] = {
364
- deviceName: 'Amazfit Cheetah (Round)',
365
- platforms: [
366
- {
367
- name: DevicePlatformName.SWIFT,
368
- deviceSource: DeviceSource.SWIFT
369
- },
370
- {
371
- name: DevicePlatformName.SWIFT_W,
372
- deviceSource: DeviceSource.SWIFT_W
373
- },
374
- ],
375
- screen: {
376
- type: DeviceScreenType.R,
377
- width: 454,
378
- height: 454
379
- },
380
- apiLevelLimit: {
381
- min: '1.0.0'
382
- }
383
- }, _a[DeviceTarget.SWORDFISH] = {
384
- deviceName: 'Amazfit Cheetah (Square)',
385
- platforms: [
386
- {
387
- name: DevicePlatformName.SWORDFISH_W,
388
- deviceSource: DeviceSource.SWORDFISH_W
389
- },
390
- ],
391
- screen: {
392
- type: DeviceScreenType.S,
393
- width: 390,
394
- height: 450
395
- },
396
- apiLevelLimit: {
397
- min: '1.0.0'
398
- }
399
- }, _a[DeviceTarget.CHEETAH] = {
400
- deviceName: 'Amazfit Cheetah Pro',
401
- platforms: [
402
- {
403
- name: DevicePlatformName.CHEETAH_W,
404
- deviceSource: DeviceSource.CHEETAH_W
405
- },
406
- ],
407
- screen: {
408
- type: DeviceScreenType.R,
409
- width: 480,
410
- height: 480
411
- },
412
- apiLevelLimit: {
413
- min: '1.0.0'
414
- }
415
- }, _a[DeviceTarget.HANNOVER] = {
416
- deviceName: 'Amazfit Active',
417
- platforms: [
418
- {
419
- name: DevicePlatformName.HANNOVER,
420
- deviceSource: DeviceSource.HANNOVER
421
- },
422
- ],
423
- screen: {
424
- type: DeviceScreenType.S,
425
- width: 390,
426
- height: 450
427
- },
428
- apiLevelLimit: {
429
- min: '1.0.0'
430
- }
431
- }, _a[DeviceTarget.ETNA] = {
432
- deviceName: 'Amazfit Active Edge',
433
- platforms: [
434
- {
435
- name: DevicePlatformName.ETNA,
436
- deviceSource: DeviceSource.ETNA
437
- },
438
- {
439
- name: DevicePlatformName.ETNA_W,
440
- deviceSource: DeviceSource.ETNA_W
441
- },
442
- ],
443
- screen: {
444
- type: DeviceScreenType.S,
445
- width: 360,
446
- height: 360
447
- },
448
- apiLevelLimit: {
449
- min: '1.0.0'
450
- }
451
- }, _a[DeviceTarget.ALTAI] = {
452
- deviceName: 'Amazfit Bip 5',
453
- platforms: [
454
- {
455
- name: DevicePlatformName.ALTAI,
456
- deviceSource: DeviceSource.ALTAI
457
- },
458
- ],
459
- screen: {
460
- type: DeviceScreenType.S,
461
- width: 320,
462
- height: 380
463
- },
464
- apiLevelLimit: {
465
- min: '1.0.0',
466
- max: '2.99.99'
467
- }
468
- }, _a), device_server_1["default"]);
27
+ exports.deviceTargets = __assign({}, device_server_1["default"]);
469
28
  exports.OSV2Devices = Object.values(exports.deviceTargets).reduce(function (targetDevices, target) {
470
29
  var _a = target.platforms, platforms = _a === void 0 ? [] : _a, _b = target.apiLevelLimit, apiLevelLimit = _b === void 0 ? {} : _b;
471
30
  var min = apiLevelLimit.min, max = apiLevelLimit.max;
@@ -67,7 +67,7 @@ var createLocalApp = function (args) { return __awaiter(void 0, void 0, void 0,
67
67
  fs_1["default"].renameSync((0, path_1.resolve)(workDir, "./_package.json"), (0, path_1.resolve)(workDir, "./package.json"));
68
68
  }
69
69
  if (fs_extra_1["default"].existsSync((0, path_1.resolve)(templateInfo.path, "./package.json")) && !fs_extra_1["default"].existsSync((0, path_1.resolve)(templateInfo.path, "./global.d.ts"))) {
70
- fs_1["default"].writeFileSync("".concat(workDir, "/global.d.ts"), '/// <reference path="node_modules/@zeppos/device-types/index.d.ts" />');
70
+ fs_1["default"].writeFileSync("".concat(workDir, "/global.d.ts"), args.OSVersion === 'v1' ? '/// <reference path="node_modules/@zeppos/device-types/index.d.ts" />' : '/// <reference path="node_modules/@zeppos/device-types/dist/index.d.ts" />');
71
71
  }
72
72
  appJsonPath = (0, path_1.resolve)(workDir, './app.json');
73
73
  appJson = fs_extra_1["default"].readJsonSync(appJsonPath);
@@ -0,0 +1,99 @@
1
+ import { getTextLayout, createWidget, widget, deleteWidget, setAppWidgetSize, getAppWidgetSize } from "@zos/ui";
2
+ import { log as Logger, px } from "@zos/utils";
3
+ import { Calorie } from "@zos/sensor";
4
+ import { getText } from "@zos/i18n";
5
+
6
+ const logger = Logger.getLogger("calories");
7
+
8
+ import {
9
+ CALORIE_TEXT,
10
+ CALORIE_TEXT_SIZE,
11
+ UNIT_TEXT,
12
+ UNIT_TEXT_SIZE,
13
+ CONSUME_ICON,
14
+ CONSUME_ICON_WIDTH,
15
+ IMGAE_CALORIES_MARIN,
16
+ CALORIES_UNIT_MARIN,
17
+ DEVICE_WIDTH,
18
+ TOTAL_CONSUME_TEXT,
19
+ } from "../utils/styles-gts-3";
20
+
21
+ AppWidget({
22
+ state: {
23
+ refreshWidgetList: [],
24
+ },
25
+
26
+ onInit() {
27
+ logger.log("===onInit===");
28
+ },
29
+
30
+ onDataRestore() {},
31
+
32
+ build() {
33
+ logger.log(getAppWidgetSize())
34
+
35
+ setAppWidgetSize({
36
+ h: px(120)
37
+ })
38
+
39
+ createWidget(widget.TEXT, TOTAL_CONSUME_TEXT);
40
+ },
41
+
42
+ onResume() {
43
+ try {
44
+ if (this.state.refreshWidgetList.length) {
45
+ this.state.refreshWidgetList.forEach((i) => {
46
+ deleteWidget(i);
47
+ });
48
+ this.state.refreshWidgetList = [];
49
+ }
50
+
51
+ this.getData();
52
+ logger.log("===onResume===");
53
+ } catch(e) {
54
+ console.log('LifeCycle Error', e)
55
+ e && e.stack && e.stack.split(/\n/).forEach((i) => console.log('error stack', i))
56
+ }
57
+ },
58
+
59
+ getData() {
60
+ const calories = new Calorie().getCurrent(); // Math.floor(Math.random() * 1000)
61
+
62
+ this.buildTopContent(calories);
63
+ },
64
+
65
+ buildTopContent(calories) {
66
+ const { width: w1 } = getTextLayout("" + calories, {
67
+ text_size: CALORIE_TEXT_SIZE,
68
+ text_width: 0,
69
+ wrapped: 0,
70
+ });
71
+ const { width: w2 } = getTextLayout(getText("unit"), {
72
+ text_size: UNIT_TEXT_SIZE,
73
+ text_width: 0,
74
+ wrapped: 0,
75
+ });
76
+
77
+ const w =
78
+ w1 + w2 + CONSUME_ICON_WIDTH + IMGAE_CALORIES_MARIN + CALORIES_UNIT_MARIN;
79
+ const x = Math.round((DEVICE_WIDTH - w) / 2);
80
+ const baseY = px(48);
81
+
82
+ const textId = createWidget(widget.TEXT, {
83
+ ...CALORIE_TEXT,
84
+ text: `${calories}`,
85
+ x: x + CONSUME_ICON_WIDTH + IMGAE_CALORIES_MARIN,
86
+ w: w1,
87
+ y: CALORIE_TEXT.y + baseY,
88
+ });
89
+ const unitId = createWidget(widget.TEXT, {
90
+ ...UNIT_TEXT,
91
+ x: x + w - w2,
92
+ w: w2,
93
+ y: UNIT_TEXT.y + baseY,
94
+ });
95
+
96
+ this.state.refreshWidgetList.push(textId, unitId);
97
+ createWidget(widget.IMG, { ...CONSUME_ICON, x, y: CONSUME_ICON.y + baseY });
98
+ },
99
+ });
@@ -1,27 +1,21 @@
1
- import { log as Logger } from "@zos/utils";
2
- import LocalStorage from "./utils/storage";
1
+ import { log as Logger } from '@zos/utils'
2
+ import { localStorage } from '@zos/storage'
3
3
 
4
- const logger = Logger.getLogger("calories-app");
5
- const fileName = "calorie_data.txt";
4
+ const logger = Logger.getLogger('calories-app')
6
5
 
7
6
  App({
8
7
  globalData: {
9
- foodType: "chocolate",
10
- localStorage: null,
8
+ foodType: '',
11
9
  },
12
10
  onCreate() {
13
11
  try {
14
- this.globalData.localStorage = new LocalStorage(fileName);
15
- const { foodType = "chocolate" } = this.globalData.localStorage.get();
16
- this.globalData.foodType = foodType;
12
+ const { foodType = 'chocolate' } = localStorage.getItem('calorie', {})
13
+ this.globalData.foodType = foodType
14
+
17
15
  } catch (e) {
18
16
  logger.log("--->e:", e);
19
17
  }
20
18
  },
21
19
 
22
- onDestroy() {
23
- this.globalData.localStorage.set({
24
- foodType: getApp()._options.globalData.foodType,
25
- });
26
- },
27
- });
20
+ onDestroy() {},
21
+ })
@@ -29,6 +29,30 @@
29
29
  "module": {
30
30
  "page": {
31
31
  "pages": ["page/gts/index", "page/gts/food-list"]
32
+ },
33
+ "secondary-widget": {
34
+ "widgets": [
35
+ {
36
+ "path": "secondary-widget/index",
37
+ "icon": "icon.png",
38
+ "name": "calories",
39
+ "runtime": {
40
+ "type": "js"
41
+ }
42
+ }
43
+ ]
44
+ },
45
+ "app-widget": {
46
+ "widgets": [
47
+ {
48
+ "path": "app-widget/index",
49
+ "icon": "icon.png",
50
+ "name": "calories",
51
+ "runtime": {
52
+ "type": "js"
53
+ }
54
+ }
55
+ ]
32
56
  }
33
57
  },
34
58
  "platforms": [
@@ -1,6 +1,7 @@
1
1
  import * as hmUI from "@zos/ui";
2
2
  import { back } from "@zos/router";
3
3
  import { log as Logger, px } from "@zos/utils";
4
+ import { localStorage } from "@zos/storage";
4
5
 
5
6
  import {
6
7
  FOOD_LIST_Y,
@@ -28,6 +29,9 @@ Page({
28
29
  setPrograms(index) {
29
30
  this.state.activeIndex = index;
30
31
  globalData.foodType = FOOD_CALORIES[index].type;
32
+ localStorage.setItem("calorie", {
33
+ foodType: globalData.foodType
34
+ });
31
35
  back();
32
36
  },
33
37
  buildFoodList() {