Skip to content

Commit 46c7c57

Browse files
author
mmolotov
authored
Merge pull request #3 from mmolotov/develop
v 1.0.1
2 parents f1a6362 + 1e1840e commit 46c7c57

7 files changed

Lines changed: 25 additions & 29 deletions

File tree

app.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"appType": "app",
77
"version": {
88
"code": 1,
9-
"name": "1.0.0"
9+
"name": "1.0.1"
1010
},
1111
"icon": "icon.png",
1212
"vender": "zepp",

page/create_timer/create_timer.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {push} from '@zos/router'
1+
import {replace} from '@zos/router'
22

33
import {CONSTANTS, getText} from '../common'
44
import CreateNewTimerPage from './create_timer_template'
@@ -8,6 +8,6 @@ CreateNewTimerPage({
88
pageKey: 'create.timer',
99
confirmHandler: function (timer) {
1010
getApp()._options.globalData.timerModel.timer = timer
11-
push({url: CONSTANTS.pages.SELECT_INTERVAL})
11+
replace({url: CONSTANTS.pages.SELECT_INTERVAL})
1212
}
1313
})

page/create_timer/create_timer_template.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import {back} from '@zos/router'
21
import {Vibrator, VIBRATOR_SCENE_SHORT_LIGHT} from '@zos/sensor'
32
import {localStorage} from '@zos/storage'
43
import {createWidget, deleteWidget, event, prop, widget} from '@zos/ui'
@@ -23,9 +22,6 @@ function CreateNewTimerPage(args) {
2322

2423
Page({
2524
onInit() {
26-
if (getApp()._options.globalData.openMain) {
27-
back()
28-
}
2925
},
3026
build() {
3127
this.hh = localStorage.getItem(`${pageKey}.hh`) ? localStorage.getItem(`${pageKey}.hh`) : 0

page/select_predefined/select_interval.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,13 @@ const standardTimers = [
1919
]
2020

2121
SelectPredefinedTimerPage({
22-
header: getText(CONSTANTS.i18n.SELECT_INTERVAL_HEADER),
23-
timersList: standardTimers,
24-
addButtonLink: CONSTANTS.pages.CREATE_INTERVAL,
25-
timerHandler: function (button) {
22+
header: getText(CONSTANTS.i18n.SELECT_INTERVAL_HEADER),
23+
timersList: standardTimers,
24+
timerHandler: function (button) {
2625
getApp()._options.globalData.timerModel.interval = button.getProperty(prop.DATASET).timer
2726
replace({url: CONSTANTS.pages.TIMER_PROGRESS})
27+
},
28+
addButtonHandler: function () {
29+
replace({url: CONSTANTS.pages.CREATE_INTERVAL})
2830
}
2931
})

page/select_predefined/select_predefined_template.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import {Vibrator, VIBRATOR_SCENE_SHORT_LIGHT} from '@zos/sensor'
22
import {createWidget, event, prop, widget} from '@zos/ui'
3-
import {push} from '@zos/router'
43

54
import {CONSTANTS, getText} from '../common'
65
import {COMMON, SELECT_PREDEFINED} from '../style/style'
@@ -13,12 +12,11 @@ function SelectPredefinedTimerPage(args) {
1312
addButtonStyle = COMMON.STANDARD_BOTTOM_BUTTON_STYLE(CONSTANTS.img.PLUS, CONSTANTS.img.PLUS_PRESSED),
1413
timerHandler,
1514
timersList,
16-
addButtonLink
15+
addButtonHandler
1716
} = args
1817

1918
Page({
2019
onInit() {
21-
getApp()._options.globalData.openMain = false
2220
},
2321

2422
build() {
@@ -60,7 +58,7 @@ function SelectPredefinedTimerPage(args) {
6058
const addButton = createWidget(widget.BUTTON, addButtonStyle)
6159
addButton.addEventListener(event.CLICK_DOWN, (e) => {
6260
this.doVibro()
63-
push({url: addButtonLink})
61+
addButtonHandler()
6462
})
6563
}
6664
})

page/select_predefined/select_timer.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,14 @@ const standardTimers = [
1818
]
1919

2020
SelectPredefinedTimerPage({
21-
header: getText(CONSTANTS.i18n.SELECT_TIMER_HEADER),
22-
timersList: standardTimers,
23-
addButtonLink: CONSTANTS.pages.CREATE_TIMER,
24-
timerHandler: function (button) {
21+
header: getText(CONSTANTS.i18n.SELECT_TIMER_HEADER),
22+
timersList: standardTimers,
23+
timerHandler: function (button) {
2524
getApp()._options.globalData.timerModel.timer = button.getProperty(prop.DATASET).timer
2625
push({url: CONSTANTS.pages.SELECT_INTERVAL})
26+
},
27+
addButtonHandler: function () {
28+
push({url: CONSTANTS.pages.CREATE_TIMER})
2729
}
2830
})
2931

page/timer_progress/timer_progress.js

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import {back} from '@zos/router'
22
import {createWidget, deleteWidget, prop, widget} from '@zos/ui'
3-
import {Time, Vibrator, VIBRATOR_SCENE_TIMER} from '@zos/sensor'
3+
import {Time, Vibrator, VIBRATOR_SCENE_DURATION_LONG, VIBRATOR_SCENE_SHORT_LIGHT, VIBRATOR_SCENE_TIMER} from '@zos/sensor'
44
import {pausePalmScreenOff, resetPalmScreenOff} from '@zos/display'
55

66
import {CONSTANTS, getText, zeroPad} from '../common'
@@ -59,7 +59,7 @@ Page({
5959
this.startBlinkInterval()
6060
this.createStopButton()
6161
this.deleteAdditionalButtons()
62-
this.doVibro()
62+
this.doVibro(VIBRATOR_SCENE_TIMER)
6363
} else {
6464
this.notifyOnInterval(remainingSeconds)
6565
}
@@ -82,7 +82,7 @@ Page({
8282
if (this.lastReminder) {
8383
const now = this.time.getTime()
8484
if (now - this.lastReminder >= this.interval.valueSeconds * CONSTANTS.seconds.mili) {
85-
this.doVibro()
85+
this.doVibro(VIBRATOR_SCENE_DURATION_LONG)
8686
this.switchTimerDisplayColor(true)
8787
this.lastReminder = now
8888
} else {
@@ -124,32 +124,30 @@ Page({
124124
}
125125
},
126126

127-
doVibro() {
127+
doVibro(scene = VIBRATOR_SCENE_SHORT_LIGHT) {
128128
this.vibro.stop()
129-
this.vibro.setMode(VIBRATOR_SCENE_TIMER)
129+
this.vibro.setMode(scene)
130130
this.vibro.start()
131131
},
132132

133133
createStopButton() {
134134
return createWidget(widget.BUTTON,
135135
COMMON.STANDARD_BOTTOM_BUTTON_STYLE_ACTION(CONSTANTS.img.STOP, CONSTANTS.img.STOP_PRESSED, (arg) => {
136-
getApp()._options.globalData.openMain = true
137136
back()
138137
}))
139138
},
140139

141140
createCancelButton() {
142141
return createWidget(widget.BUTTON, TIMER_PROGRESS.CANCEL_BUTTON((arg) => {
143-
this.doVibro()
144-
getApp()._options.globalData.openMain = true
142+
this.doVibro(VIBRATOR_SCENE_SHORT_LIGHT)
145143
back()
146144
}))
147145
},
148146

149147
createPauseButton() {
150148
return createWidget(widget.BUTTON,
151149
TIMER_PROGRESS.PAUSE_RESUME_BUTTON(CONSTANTS.img.PAUSE, CONSTANTS.img.PAUSE_PRESSED, (button) => {
152-
this.doVibro()
150+
this.doVibro(VIBRATOR_SCENE_SHORT_LIGHT)
153151
this.stopProcesses()
154152
this.pause = this.time.getTime()
155153
this.resumeButton = this.createResumeButton()
@@ -160,7 +158,7 @@ Page({
160158
createResumeButton() {
161159
return createWidget(widget.BUTTON,
162160
TIMER_PROGRESS.PAUSE_RESUME_BUTTON(CONSTANTS.img.RESUME, CONSTANTS.img.RESUME_PRESSED, (button) => {
163-
this.doVibro()
161+
this.doVibro(VIBRATOR_SCENE_SHORT_LIGHT)
164162
const pauseTime = this.time.getTime() - this.pause
165163
this.end += pauseTime
166164
this.lastReminder += pauseTime

0 commit comments

Comments
 (0)