Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
Material
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Dmitriy Stepanets
Material
Commits
50a60baf
Unverified
Commit
50a60baf
authored
May 17, 2017
by
Daniel Dahan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
development: added change notification to Events API
parent
f506ed9b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
31 deletions
+11
-31
Sources/iOS/Events/Events.swift
+11
-31
No files found.
Sources/iOS/Events/Events.swift
View file @
50a60baf
...
@@ -57,6 +57,13 @@ public protocol EventsDelegate {
...
@@ -57,6 +57,13 @@ public protocol EventsDelegate {
optional
func
events
(
events
:
Events
,
status
:
EventsReminderAuthorizationStatus
)
optional
func
events
(
events
:
Events
,
status
:
EventsReminderAuthorizationStatus
)
/**
/**
A delegation method that is fired when changes to the event store occur.
- Parameter events: A reference to the Events instance.
*/
@objc
optional
func
eventsShouldRefresh
(
events
:
Events
)
/**
A delegation method that is executed when events authorization is authorized.
A delegation method that is executed when events authorization is authorized.
- Parameter events: A reference to the Events instance.
- Parameter events: A reference to the Events instance.
*/
*/
...
@@ -98,13 +105,6 @@ public protocol EventsDelegate {
...
@@ -98,13 +105,6 @@ public protocol EventsDelegate {
optional
func
events
(
events
:
Events
,
removedCalendar
calendar
:
EKCalendar
,
error
:
Error
?)
optional
func
events
(
events
:
Events
,
removedCalendar
calendar
:
EKCalendar
,
error
:
Error
?)
/**
/**
A notification that is executed when a calendar has been changed, locally
or remotely.
*/
@objc
optional
func
events
(
events
:
Events
,
changeNotificationForCalendar
calendar
:
EKCalendar
)
/**
A delegation method that is executed when a new reminder is created.
A delegation method that is executed when a new reminder is created.
- Parameter events: A reference to the Events instance.
- Parameter events: A reference to the Events instance.
- Parameter createdReminder reminder: An optional reference to the reminder created.
- Parameter createdReminder reminder: An optional reference to the reminder created.
...
@@ -130,14 +130,6 @@ public protocol EventsDelegate {
...
@@ -130,14 +130,6 @@ public protocol EventsDelegate {
*/
*/
@objc
@objc
optional
func
events
(
events
:
Events
,
removedReminder
reminder
:
EKReminder
,
error
:
Error
?)
optional
func
events
(
events
:
Events
,
removedReminder
reminder
:
EKReminder
,
error
:
Error
?)
/**
A notification that is executed when a reminder has been changed, locally
or remotely.
*/
@objc
optional
func
events
(
events
:
Events
,
changeNotificationForReminder
reminder
:
EKReminder
)
}
}
@objc(Events)
@objc(Events)
...
@@ -198,30 +190,18 @@ open class Events: NSObject {
...
@@ -198,30 +190,18 @@ open class Events: NSObject {
extension
Events
{
extension
Events
{
/// Prepares the notification handlers.
/// Prepares the notification handlers.
fileprivate
func
prepareNotification
()
{
fileprivate
func
prepareNotification
()
{
NotificationCenter
.
default
.
addObserver
(
self
,
selector
:
#selector(
handle
Reminder
Change(_:)
)
,
name
:
NSNotification
.
Name
.
EKEventStoreChanged
,
object
:
eventStore
)
NotificationCenter
.
default
.
addObserver
(
self
,
selector
:
#selector(
handle
EventStore
Change(_:)
)
,
name
:
NSNotification
.
Name
.
EKEventStoreChanged
,
object
:
eventStore
)
}
}
}
}
extension
Events
{
extension
Events
{
/**
/**
Handler for
notification
changes.
Handler for
event store
changes.
- Parameter _ notification: A Notification.
- Parameter _ notification: A Notification.
*/
*/
@objc
@objc
fileprivate
func
handleReminderChange
(
_
notification
:
Notification
)
{
fileprivate
func
handleEventStoreChange
(
_
notification
:
Notification
)
{
for
(
_
,
v
)
in
cacheForCalendars
{
delegate
?
.
eventsShouldRefresh
?(
events
:
self
)
if
v
.
refresh
()
{
v
.
reset
()
delegate
?
.
events
?(
events
:
self
,
changeNotificationForCalendar
:
v
)
}
}
for
(
_
,
v
)
in
cacheForReminders
{
if
v
.
refresh
()
{
v
.
reset
()
delegate
?
.
events
?(
events
:
self
,
changeNotificationForReminder
:
v
)
}
}
}
}
}
}
...
...
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