Skip to content
This repository has been archived by the owner on Jun 26, 2022. It is now read-only.

Commit

Permalink
turn predictive break times on, and turn off normal break timer if (#140
Browse files Browse the repository at this point in the history
)

predictive break timer is on
  • Loading branch information
jcblw authored Sep 2, 2019
1 parent 343ceb0 commit 28afe63
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
9 changes: 7 additions & 2 deletions src/components/background-app/break-alarm/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import { useEffect, useCallback } from 'react'
import { upsertAlarm } from '../../../background/alarm/util'
import { ALARM_KEY, THREE_HOURS } from '../../../constants'
import {
ALARM_KEY,
THREE_HOURS,
PREDICTED_BREAK_TIMES_FEATURE,
} from '../../../constants'
import { useHeartBeat } from '../../../hooks/use-heart-beat'
import { useStorage } from '../../../hooks/use-storage-background'
import { alarms } from '../../../lib/extension'
Expand All @@ -11,8 +15,9 @@ export const BreakAlarm = () => {

// callbacks
const addBreakAlarm = useCallback(() => {
if (PREDICTED_BREAK_TIMES_FEATURE) return
const delayInMinutes = msToMinutes(THREE_HOURS)
return upsertAlarm(ALARM_KEY, { delayInMinutes })
upsertAlarm(ALARM_KEY, { delayInMinutes })
}, [])
const removeBreakAlarm = useCallback(() => {
alarms.clear(ALARM_KEY)
Expand Down
2 changes: 1 addition & 1 deletion src/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export const SET_STORAGE = 'SET_STORAGE'
export const SCREEN_TIME_FEATURE = true
export const BREAK_TIMER_FEATURE = true
export const SUBSCRIBE_FEATURE = true
export const PREDICTED_BREAK_TIMES_FEATURE = false
export const PREDICTED_BREAK_TIMES_FEATURE = true

// Upsell modals
export const MAX_BREAKTIMER_MODAL = 'breakTimerMax'
Expand Down

0 comments on commit 28afe63

Please sign in to comment.