Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
cordova-plugin-local-notifications
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Nabil Sadki
cordova-plugin-local-notifications
Commits
6eddc7dc
Commit
6eddc7dc
authored
Oct 01, 2017
by
Sebastián Katzer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
trigger.every enhancements (Windows)
parent
320e32f4
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
42 deletions
+19
-42
Every.cs
...onProxy/LocalNotificationProxy/LocalNotification/Every.cs
+14
-37
Trigger.cs
...Proxy/LocalNotificationProxy/LocalNotification/Trigger.cs
+5
-5
No files found.
src/windows/LocalNotificationProxy/LocalNotificationProxy/LocalNotification/Every.cs
View file @
6eddc7dc
...
@@ -30,58 +30,33 @@ namespace LocalNotificationProxy.LocalNotification
...
@@ -30,58 +30,33 @@ namespace LocalNotificationProxy.LocalNotification
/// <summary>
/// <summary>
/// Gets or sets the minute.
/// Gets or sets the minute.
/// </summary>
/// </summary>
public
int
Minute
{
get
;
set
;
}
public
int
?
Minute
{
get
;
set
;
}
/// <summary>
/// <summary>
/// Gets or sets the hour.
/// Gets or sets the hour.
/// </summary>
/// </summary>
public
int
Hour
{
get
;
set
;
}
public
int
?
Hour
{
get
;
set
;
}
/// <summary>
/// <summary>
/// Gets or sets the day.
/// Gets or sets the day.
/// </summary>
/// </summary>
public
int
Day
{
get
;
set
;
}
public
int
?
Day
{
get
;
set
;
}
/// <summary>
/// <summary>
/// Gets or sets the month.
/// Gets or sets the month.
/// </summary>
/// </summary>
public
int
Month
{
get
;
set
;
}
public
int
?
Month
{
get
;
set
;
}
/// <summary>
/// <summary>
/// Gets or sets the year.
/// Gets or sets the year.
/// </summary>
/// </summary>
public
int
Year
{
get
;
set
;
}
public
int
?
Year
{
get
;
set
;
}
/// <summary>
/// Gets a value indicating whether the minute is not fix.
/// </summary>
internal
bool
MinuteIsVariable
{
get
=>
this
.
Minute
==
0
;
}
/// <summary>
/// Gets a value indicating whether the hour is not fix.
/// </summary>
internal
bool
HourIsVariable
{
get
=>
this
.
Hour
==
0
;
}
/// <summary>
/// Gets a value indicating whether the day is not fix.
/// </summary>
internal
bool
DayIsVariable
{
get
=>
this
.
Day
==
0
;
}
/// <summary>
/// Gets a value indicating whether the month is not fix.
/// </summary>
internal
bool
MonthIsVariable
{
get
=>
this
.
Month
==
0
;
}
/// <summary>
/// Gets a value indicating whether the year is not fix.
/// </summary>
internal
bool
YearIsVariable
{
get
=>
this
.
Year
==
0
;
}
/// <summary>
/// <summary>
/// Gets the interval as a string representation.
/// Gets the interval as a string representation.
/// </summary>
/// </summary>
/// <returns>year, month, ...</returns>
/// <returns>year, month, ...</returns>
internal
string
Interval
{
get
=>
Intervals
[
Array
.
IndexOf
(
this
.
ToArray
(),
0
)
+
1
];
}
internal
string
Interval
{
get
=>
Intervals
[
Array
.
IndexOf
(
this
.
ToArray
(),
null
)
+
1
];
}
/// <summary>
/// <summary>
/// Converts the date time components into a datetime object.
/// Converts the date time components into a datetime object.
...
@@ -92,20 +67,22 @@ namespace LocalNotificationProxy.LocalNotification
...
@@ -92,20 +67,22 @@ namespace LocalNotificationProxy.LocalNotification
var
p
=
this
.
ToArray
();
var
p
=
this
.
ToArray
();
var
today
=
DateTime
.
Today
;
var
today
=
DateTime
.
Today
;
p
[
2
]
=
this
.
DayIsVariable
?
today
.
Day
:
this
.
Day
;
p
[
0
]
=
this
.
Minute
.
GetValueOrDefault
();
p
[
3
]
=
this
.
MonthIsVariable
?
today
.
Month
:
this
.
Month
;
p
[
1
]
=
this
.
Hour
.
GetValueOrDefault
();
p
[
4
]
=
this
.
YearIsVariable
?
today
.
Year
:
this
.
Year
;
p
[
2
]
=
this
.
Day
.
GetValueOrDefault
(
today
.
Day
);
p
[
3
]
=
this
.
Month
.
GetValueOrDefault
(
today
.
Month
);
p
[
4
]
=
this
.
Year
.
GetValueOrDefault
(
today
.
Year
);
return
new
DateTime
(
p
[
4
]
,
p
[
3
],
p
[
2
],
p
[
1
],
p
[
0
]
,
0
);
return
new
DateTime
(
p
[
4
]
.
Value
,
p
[
3
].
Value
,
p
[
2
].
Value
,
p
[
1
].
Value
,
p
[
0
].
Value
,
0
);
}
}
/// <summary>
/// <summary>
/// Gets an array of all date parts to construct a datetime instance.
/// Gets an array of all date parts to construct a datetime instance.
/// </summary>
/// </summary>
/// <returns>[min, hour, day, month, year]</returns>
/// <returns>[min, hour, day, month, year]</returns>
private
int
[]
ToArray
()
private
int
?
[]
ToArray
()
{
{
return
new
int
[]
{
this
.
Minute
,
this
.
Hour
,
this
.
Day
,
this
.
Month
,
this
.
Year
};
return
new
int
?
[]
{
this
.
Minute
,
this
.
Hour
,
this
.
Day
,
this
.
Month
,
this
.
Year
};
}
}
}
}
}
}
src/windows/LocalNotificationProxy/LocalNotificationProxy/LocalNotification/Trigger.cs
View file @
6eddc7dc
...
@@ -191,7 +191,7 @@ namespace LocalNotificationProxy.LocalNotification
...
@@ -191,7 +191,7 @@ namespace LocalNotificationProxy.LocalNotification
case
"minute"
:
case
"minute"
:
case
"hour"
:
case
"hour"
:
case
"day"
:
case
"day"
:
if
(
every
.
YearIsVariabl
e
)
if
(
!
every
.
Year
.
HasValu
e
)
{
{
return
date
.
AddYears
(
now
.
Year
-
date
.
Year
+
1
);
return
date
.
AddYears
(
now
.
Year
-
date
.
Year
+
1
);
}
}
...
@@ -207,11 +207,11 @@ namespace LocalNotificationProxy.LocalNotification
...
@@ -207,11 +207,11 @@ namespace LocalNotificationProxy.LocalNotification
{
{
case
"minute"
:
case
"minute"
:
case
"hour"
:
case
"hour"
:
if
(
every
.
MonthIsVariabl
e
)
if
(
!
every
.
Month
.
HasValu
e
)
{
{
return
date
.
AddMonths
(
now
.
Month
-
date
.
Month
+
1
);
return
date
.
AddMonths
(
now
.
Month
-
date
.
Month
+
1
);
}
}
else
if
(
every
.
YearIsVariabl
e
)
else
if
(
!
every
.
Year
.
HasValu
e
)
{
{
return
date
.
AddYears
(
now
.
Year
-
date
.
Year
+
1
);
return
date
.
AddYears
(
now
.
Year
-
date
.
Year
+
1
);
}
}
...
@@ -228,11 +228,11 @@ namespace LocalNotificationProxy.LocalNotification
...
@@ -228,11 +228,11 @@ namespace LocalNotificationProxy.LocalNotification
switch
(
every
.
Interval
)
switch
(
every
.
Interval
)
{
{
case
"minute"
:
case
"minute"
:
if
(
every
.
DayIsVariabl
e
)
if
(
!
every
.
Day
.
HasValu
e
)
{
{
return
date
.
AddDays
(
now
.
Day
-
date
.
Day
+
1
);
return
date
.
AddDays
(
now
.
Day
-
date
.
Day
+
1
);
}
}
else
if
(
every
.
MonthIsVariabl
e
)
else
if
(
!
every
.
Month
.
HasValu
e
)
{
{
return
date
.
AddMonths
(
now
.
Month
-
date
.
Month
+
1
);
return
date
.
AddMonths
(
now
.
Month
-
date
.
Month
+
1
);
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment