bug fixes

This commit is contained in:
2021-11-12 12:05:44 -03:00
parent 5ad9a1581c
commit 65f81a0dbc
4 changed files with 35 additions and 3 deletions

2
netlify.toml Normal file
View File

@@ -0,0 +1,2 @@
[build]
command = CI= npm run build

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.8 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@@ -30,9 +30,27 @@ const MainPomodoroTimer = (props) => {
const [velocity, setVelocity] = useState(1) const [velocity, setVelocity] = useState(1)
const [notificationPermission, setNotificationPermission] = useState('')
const setTimeStyle = () => setTimeStyleExternal(props, setMinutes, setSeconds, setBreakTime, setActualStyle, breakTime) const setTimeStyle = () => setTimeStyleExternal(props, setMinutes, setSeconds, setBreakTime, setActualStyle, breakTime)
const getPermisionDesktopNotification = async () => {
let permission = await Notification.requestPermission();
if (permission === 'granted') {
await setNotificationPermission(true)
} else {
setNotificationPermission(false)
}
}
React.useEffect (() => { React.useEffect (() => {
if (actualStyle !== props.style) { if (actualStyle !== props.style) {
setTimeStyle() setTimeStyle()
@@ -45,6 +63,8 @@ const MainPomodoroTimer = (props) => {
setControlKonamiCode(false) setControlKonamiCode(false)
} }
getPermisionDesktopNotification()
}) })
const startTimer = () => { const startTimer = () => {
@@ -168,6 +188,13 @@ const MainPomodoroTimer = (props) => {
playAudio('work') playAudio('work')
if (notificationPermission) {
new Notification('Pomodoro ended');
}
if (restCounter !== 3){ if (restCounter !== 3){
setTimeout( () => { setTimeout( () => {
@@ -222,6 +249,11 @@ const MainPomodoroTimer = (props) => {
playAudio('rest') playAudio('rest')
if (notificationPermission) {
new Notification('Rest ended');
}
setTimeout( () => { setTimeout( () => {
if (restCounter === 4) { if (restCounter === 4) {

View File

@@ -1,5 +1,3 @@
import React from 'react'
const detectKeys = (setKonamiCodeActive) => { const detectKeys = (setKonamiCodeActive) => {
let secuencie = [] let secuencie = []