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
6137bc0b
Commit
6137bc0b
authored
Jan 10, 2018
by
Sebastián Katzer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Scheduling notifications with repeat is triggered at wrong date [fixes #1493]
parent
108905cc
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
7 deletions
+22
-7
APPNotificationOptions.m
src/ios/APPNotificationOptions.m
+22
-7
No files found.
src/ios/APPNotificationOptions.m
View file @
6137bc0b
...
@@ -25,6 +25,9 @@
...
@@ -25,6 +25,9 @@
@import
CoreLocation
;
@import
CoreLocation
;
@import
UserNotifications
;
@import
UserNotifications
;
// Maps these crap where Sunday is the 1st day of the week
static
NSInteger
WEEKDAYS
[
8
]
=
{
0
,
2
,
3
,
4
,
5
,
6
,
7
,
1
};
@interface
APPNotificationOptions
()
@interface
APPNotificationOptions
()
// The dictionary which contains all notification properties
// The dictionary which contains all notification properties
...
@@ -421,9 +424,7 @@
...
@@ -421,9 +424,7 @@
*/
*/
-
(
UNCalendarNotificationTrigger
*
)
triggerWithDateMatchingComponents
:
(
BOOL
)
repeats
-
(
UNCalendarNotificationTrigger
*
)
triggerWithDateMatchingComponents
:
(
BOOL
)
repeats
{
{
NSCalendar
*
cal
=
[[
NSCalendar
alloc
]
NSCalendar
*
cal
=
[
self
calendarWithMondayAsFirstDay
];
initWithCalendarIdentifier
:
NSCalendarIdentifierGregorian
];
NSDateComponents
*
date
=
[
cal
components
:[
self
repeatInterval
]
NSDateComponents
*
date
=
[
cal
components
:[
self
repeatInterval
]
fromDate
:[
self
triggerDate
]];
fromDate
:[
self
triggerDate
]];
...
@@ -440,9 +441,7 @@
...
@@ -440,9 +441,7 @@
*/
*/
-
(
UNCalendarNotificationTrigger
*
)
triggerWithCustomDateMatchingComponents
-
(
UNCalendarNotificationTrigger
*
)
triggerWithCustomDateMatchingComponents
{
{
NSCalendar
*
cal
=
[[
NSCalendar
alloc
]
NSCalendar
*
cal
=
[
self
calendarWithMondayAsFirstDay
];
initWithCalendarIdentifier
:
NSCalendarIdentifierGregorian
];
NSDateComponents
*
date
=
[
self
customDateComponents
];
NSDateComponents
*
date
=
[
self
customDateComponents
];
date
.
calendar
=
cal
;
date
.
calendar
=
cal
;
...
@@ -548,7 +547,7 @@
...
@@ -548,7 +547,7 @@
date
.
day
=
value
;
date
.
day
=
value
;
}
else
}
else
if
([
key
isEqualToString
:
@"weekday"
])
{
if
([
key
isEqualToString
:
@"weekday"
])
{
date
.
weekday
=
value
;
date
.
weekday
=
WEEKDAYS
[
value
]
;
}
else
}
else
if
([
key
isEqualToString
:
@"weekdayOrdinal"
])
{
if
([
key
isEqualToString
:
@"weekdayOrdinal"
])
{
date
.
weekdayOrdinal
=
value
;
date
.
weekdayOrdinal
=
value
;
...
@@ -829,4 +828,20 @@
...
@@ -829,4 +828,20 @@
return
0
;
return
0
;
}
}
/**
* Instance if a calendar where the monday is the first day of the week.
*
* @return [ NSCalendar* ]
*/
-
(
NSCalendar
*
)
calendarWithMondayAsFirstDay
{
NSCalendar
*
cal
=
[[
NSCalendar
alloc
]
initWithCalendarIdentifier
:
NSCalendarIdentifierISO8601
];
cal
.
firstWeekday
=
2
;
cal
.
minimumDaysInFirstWeek
=
1
;
return
cal
;
}
@end
@end
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