From ad8fa1e31ca17b4a4b1cf1e3ab6841fe38f1182b Mon Sep 17 00:00:00 2001 From: Maksim Gavrilov Date: Mon, 11 Sep 2023 16:40:00 +0600 Subject: [PATCH 1/3] * fix screen routing --- page/create_timer/create_timer.js | 4 ++-- page/create_timer/create_timer_template.js | 4 ---- page/select_predefined/select_interval.js | 10 ++++++---- page/select_predefined/select_predefined_template.js | 6 ++---- page/select_predefined/select_timer.js | 10 ++++++---- page/timer_progress/timer_progress.js | 2 -- 6 files changed, 16 insertions(+), 20 deletions(-) diff --git a/page/create_timer/create_timer.js b/page/create_timer/create_timer.js index 1e94b31..f7eb00b 100644 --- a/page/create_timer/create_timer.js +++ b/page/create_timer/create_timer.js @@ -1,4 +1,4 @@ -import {push} from '@zos/router' +import {replace} from '@zos/router' import {CONSTANTS, getText} from '../common' import CreateNewTimerPage from './create_timer_template' @@ -8,6 +8,6 @@ CreateNewTimerPage({ pageKey: 'create.timer', confirmHandler: function (timer) { getApp()._options.globalData.timerModel.timer = timer - push({url: CONSTANTS.pages.SELECT_INTERVAL}) + replace({url: CONSTANTS.pages.SELECT_INTERVAL}) } }) diff --git a/page/create_timer/create_timer_template.js b/page/create_timer/create_timer_template.js index 79baf68..fb2247e 100644 --- a/page/create_timer/create_timer_template.js +++ b/page/create_timer/create_timer_template.js @@ -1,4 +1,3 @@ -import {back} from '@zos/router' import {Vibrator, VIBRATOR_SCENE_SHORT_LIGHT} from '@zos/sensor' import {localStorage} from '@zos/storage' import {createWidget, deleteWidget, event, prop, widget} from '@zos/ui' @@ -23,9 +22,6 @@ function CreateNewTimerPage(args) { Page({ onInit() { - if (getApp()._options.globalData.openMain) { - back() - } }, build() { this.hh = localStorage.getItem(`${pageKey}.hh`) ? localStorage.getItem(`${pageKey}.hh`) : 0 diff --git a/page/select_predefined/select_interval.js b/page/select_predefined/select_interval.js index 3d8e478..e71fee0 100644 --- a/page/select_predefined/select_interval.js +++ b/page/select_predefined/select_interval.js @@ -19,11 +19,13 @@ const standardTimers = [ ] SelectPredefinedTimerPage({ - header: getText(CONSTANTS.i18n.SELECT_INTERVAL_HEADER), - timersList: standardTimers, - addButtonLink: CONSTANTS.pages.CREATE_INTERVAL, - timerHandler: function (button) { + header: getText(CONSTANTS.i18n.SELECT_INTERVAL_HEADER), + timersList: standardTimers, + timerHandler: function (button) { getApp()._options.globalData.timerModel.interval = button.getProperty(prop.DATASET).timer replace({url: CONSTANTS.pages.TIMER_PROGRESS}) + }, + addButtonHandler: function () { + replace({url: CONSTANTS.pages.CREATE_INTERVAL}) } }) \ No newline at end of file diff --git a/page/select_predefined/select_predefined_template.js b/page/select_predefined/select_predefined_template.js index 40f4f87..bd1bf73 100644 --- a/page/select_predefined/select_predefined_template.js +++ b/page/select_predefined/select_predefined_template.js @@ -1,6 +1,5 @@ import {Vibrator, VIBRATOR_SCENE_SHORT_LIGHT} from '@zos/sensor' import {createWidget, event, prop, widget} from '@zos/ui' -import {push} from '@zos/router' import {CONSTANTS, getText} from '../common' import {COMMON, SELECT_PREDEFINED} from '../style/style' @@ -13,12 +12,11 @@ function SelectPredefinedTimerPage(args) { addButtonStyle = COMMON.STANDARD_BOTTOM_BUTTON_STYLE(CONSTANTS.img.PLUS, CONSTANTS.img.PLUS_PRESSED), timerHandler, timersList, - addButtonLink + addButtonHandler } = args Page({ onInit() { - getApp()._options.globalData.openMain = false }, build() { @@ -60,7 +58,7 @@ function SelectPredefinedTimerPage(args) { const addButton = createWidget(widget.BUTTON, addButtonStyle) addButton.addEventListener(event.CLICK_DOWN, (e) => { this.doVibro() - push({url: addButtonLink}) + addButtonHandler() }) } }) diff --git a/page/select_predefined/select_timer.js b/page/select_predefined/select_timer.js index 7efac0b..3d663cd 100644 --- a/page/select_predefined/select_timer.js +++ b/page/select_predefined/select_timer.js @@ -18,12 +18,14 @@ const standardTimers = [ ] SelectPredefinedTimerPage({ - header: getText(CONSTANTS.i18n.SELECT_TIMER_HEADER), - timersList: standardTimers, - addButtonLink: CONSTANTS.pages.CREATE_TIMER, - timerHandler: function (button) { + header: getText(CONSTANTS.i18n.SELECT_TIMER_HEADER), + timersList: standardTimers, + timerHandler: function (button) { getApp()._options.globalData.timerModel.timer = button.getProperty(prop.DATASET).timer push({url: CONSTANTS.pages.SELECT_INTERVAL}) + }, + addButtonHandler: function () { + push({url: CONSTANTS.pages.CREATE_TIMER}) } }) diff --git a/page/timer_progress/timer_progress.js b/page/timer_progress/timer_progress.js index 8902d75..de31a9b 100644 --- a/page/timer_progress/timer_progress.js +++ b/page/timer_progress/timer_progress.js @@ -133,7 +133,6 @@ Page({ createStopButton() { return createWidget(widget.BUTTON, COMMON.STANDARD_BOTTOM_BUTTON_STYLE_ACTION(CONSTANTS.img.STOP, CONSTANTS.img.STOP_PRESSED, (arg) => { - getApp()._options.globalData.openMain = true back() })) }, @@ -141,7 +140,6 @@ Page({ createCancelButton() { return createWidget(widget.BUTTON, TIMER_PROGRESS.CANCEL_BUTTON((arg) => { this.doVibro() - getApp()._options.globalData.openMain = true back() })) }, From 08d25511f0837e728c9627a6ee55ba69f07acf4e Mon Sep 17 00:00:00 2001 From: Maksim Gavrilov Date: Tue, 19 Sep 2023 10:22:12 +0600 Subject: [PATCH 2/3] * different vibro scenes on timer progress screen --- page/timer_progress/timer_progress.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/page/timer_progress/timer_progress.js b/page/timer_progress/timer_progress.js index de31a9b..91716fa 100644 --- a/page/timer_progress/timer_progress.js +++ b/page/timer_progress/timer_progress.js @@ -1,6 +1,6 @@ import {back} from '@zos/router' import {createWidget, deleteWidget, prop, widget} from '@zos/ui' -import {Time, Vibrator, VIBRATOR_SCENE_TIMER} from '@zos/sensor' +import {Time, Vibrator, VIBRATOR_SCENE_DURATION_LONG, VIBRATOR_SCENE_SHORT_LIGHT, VIBRATOR_SCENE_TIMER} from '@zos/sensor' import {pausePalmScreenOff, resetPalmScreenOff} from '@zos/display' import {CONSTANTS, getText, zeroPad} from '../common' @@ -59,7 +59,7 @@ Page({ this.startBlinkInterval() this.createStopButton() this.deleteAdditionalButtons() - this.doVibro() + this.doVibro(VIBRATOR_SCENE_TIMER) } else { this.notifyOnInterval(remainingSeconds) } @@ -82,7 +82,7 @@ Page({ if (this.lastReminder) { const now = this.time.getTime() if (now - this.lastReminder >= this.interval.valueSeconds * CONSTANTS.seconds.mili) { - this.doVibro() + this.doVibro(VIBRATOR_SCENE_DURATION_LONG) this.switchTimerDisplayColor(true) this.lastReminder = now } else { @@ -124,9 +124,9 @@ Page({ } }, - doVibro() { + doVibro(scene = VIBRATOR_SCENE_SHORT_LIGHT) { this.vibro.stop() - this.vibro.setMode(VIBRATOR_SCENE_TIMER) + this.vibro.setMode(scene) this.vibro.start() }, @@ -139,7 +139,7 @@ Page({ createCancelButton() { return createWidget(widget.BUTTON, TIMER_PROGRESS.CANCEL_BUTTON((arg) => { - this.doVibro() + this.doVibro(VIBRATOR_SCENE_SHORT_LIGHT) back() })) }, @@ -147,7 +147,7 @@ Page({ createPauseButton() { return createWidget(widget.BUTTON, TIMER_PROGRESS.PAUSE_RESUME_BUTTON(CONSTANTS.img.PAUSE, CONSTANTS.img.PAUSE_PRESSED, (button) => { - this.doVibro() + this.doVibro(VIBRATOR_SCENE_SHORT_LIGHT) this.stopProcesses() this.pause = this.time.getTime() this.resumeButton = this.createResumeButton() @@ -158,7 +158,7 @@ Page({ createResumeButton() { return createWidget(widget.BUTTON, TIMER_PROGRESS.PAUSE_RESUME_BUTTON(CONSTANTS.img.RESUME, CONSTANTS.img.RESUME_PRESSED, (button) => { - this.doVibro() + this.doVibro(VIBRATOR_SCENE_SHORT_LIGHT) const pauseTime = this.time.getTime() - this.pause this.end += pauseTime this.lastReminder += pauseTime From 1e1840ed07f736f3494988bbda243cfbce79d719 Mon Sep 17 00:00:00 2001 From: Maksim Gavrilov Date: Tue, 19 Sep 2023 10:23:30 +0600 Subject: [PATCH 3/3] * version 1.0.1 --- app.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app.json b/app.json index 89a7dd9..7861198 100644 --- a/app.json +++ b/app.json @@ -6,7 +6,7 @@ "appType": "app", "version": { "code": 1, - "name": "1.0.0" + "name": "1.0.1" }, "icon": "icon.png", "vender": "zepp",