Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
Drip
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
backup
Drip
Commits
b90fda11
Commit
b90fda11
authored
6 years ago
by
Julia Friesel
Browse files
Options
Downloads
Patches
Plain Diff
First attempt at notifying at given time
parent
3a91b5ff
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
components/app.js
+4
-1
4 additions, 1 deletion
components/app.js
components/home.js
+0
-1
0 additions, 1 deletion
components/home.js
lib/notifications.js
+27
-0
27 additions, 0 deletions
lib/notifications.js
with
31 additions
and
2 deletions
components/app.js
+
4
−
1
View file @
b90fda11
...
@@ -10,6 +10,7 @@ import Chart from './chart/chart'
...
@@ -10,6 +10,7 @@ import Chart from './chart/chart'
import
Settings
from
'
./settings
'
import
Settings
from
'
./settings
'
import
Stats
from
'
./stats
'
import
Stats
from
'
./stats
'
import
{
headerTitles
as
titles
}
from
'
./labels
'
import
{
headerTitles
as
titles
}
from
'
./labels
'
import
setupNotifications
from
'
../lib/notifications
'
const
isSymptomView
=
name
=>
Object
.
keys
(
symptomViews
).
indexOf
(
name
)
>
-
1
const
isSymptomView
=
name
=>
Object
.
keys
(
symptomViews
).
indexOf
(
name
)
>
-
1
...
@@ -60,4 +61,6 @@ export default class App extends Component {
...
@@ -60,4 +61,6 @@ export default class App extends Component {
<
/View
>
<
/View
>
)
)
}
}
}
}
\ No newline at end of file
setupNotifications
()
\ No newline at end of file
This diff is collapsed.
Click to expand it.
components/home.js
+
0
−
1
View file @
b90fda11
...
@@ -9,7 +9,6 @@ import { LocalDate } from 'js-joda'
...
@@ -9,7 +9,6 @@ import { LocalDate } from 'js-joda'
import
styles
from
'
../styles/index
'
import
styles
from
'
../styles/index
'
import
cycleModule
from
'
../lib/cycle
'
import
cycleModule
from
'
../lib/cycle
'
import
{
getOrCreateCycleDay
,
bleedingDaysSortedByDate
,
fillWithDummyData
,
deleteAll
}
from
'
../db
'
import
{
getOrCreateCycleDay
,
bleedingDaysSortedByDate
,
fillWithDummyData
,
deleteAll
}
from
'
../db
'
import
{
NotificationsAndroid
}
from
'
react-native-notifications
'
const
getCycleDayNumber
=
cycleModule
().
getCycleDayNumber
const
getCycleDayNumber
=
cycleModule
().
getCycleDayNumber
...
...
This diff is collapsed.
Click to expand it.
lib/notifications.js
0 → 100644
+
27
−
0
View file @
b90fda11
import
{
tempReminderObservable
}
from
'
../local-storage
'
import
{
LocalTime
,
ChronoUnit
}
from
'
js-joda
'
import
{
NotificationsAndroid
}
from
'
react-native-notifications
'
let
stopCheckingTheTime
=
()
=>
{}
export
default
function
setupNotifications
()
{
tempReminderObservable
(
reminder
=>
{
stopCheckingTheTime
()
if
(
reminder
.
enabled
)
{
stopCheckingTheTime
=
notifyAt
(
reminder
.
time
)
}
})
}
function
notifyAt
(
time
)
{
const
id
=
setInterval
(()
=>
{
const
now
=
LocalTime
.
now
().
truncatedTo
(
ChronoUnit
.
MINUTES
).
toString
()
if
(
now
===
time
)
{
NotificationsAndroid
.
localNotification
({
title
:
'
yo
'
,
body
:
'
much notification
'
})
}
},
60
*
1000
)
return
()
=>
clearInterval
(
id
)
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment