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
b7e198f2
Unverified
Commit
b7e198f2
authored
Dec 17, 2016
by
Daniel Dahan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
development: removed Reminders for release
parent
0d811800
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
0 additions
and
407 deletions
+0
-407
Material.xcodeproj/project.pbxproj
+0
-20
Sources/iOS/Reminders/Reminders.swift
+0
-305
Sources/iOS/RemindersController.swift
+0
-82
No files found.
Material.xcodeproj/project.pbxproj
View file @
b7e198f2
...
...
@@ -7,10 +7,6 @@
objects
=
{
/* Begin PBXBuildFile section */
9617B0741DFCA74500410F8F
/* Reminders.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
9617B0731DFCA74500410F8F
/* Reminders.swift */
;
};
9617B07A1DFCA80A00410F8F
/* RemindersController.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
9617B0791DFCA80A00410F8F
/* RemindersController.swift */
;
};
9617B07B1DFCA8CF00410F8F
/* Reminders.swift in Headers */
=
{
isa
=
PBXBuildFile
;
fileRef
=
9617B0731DFCA74500410F8F
/* Reminders.swift */
;
settings
=
{
ATTRIBUTES
=
(
Public
,
);
};
};
9617B07C1DFCA8CF00410F8F
/* RemindersController.swift in Headers */
=
{
isa
=
PBXBuildFile
;
fileRef
=
9617B0791DFCA80A00410F8F
/* RemindersController.swift */
;
settings
=
{
ATTRIBUTES
=
(
Public
,
);
};
};
9617B07D1DFCA8CF00410F8F
/* Application.swift in Headers */
=
{
isa
=
PBXBuildFile
;
fileRef
=
961E6BDE1DDA2A95004E6C93
/* Application.swift */
;
settings
=
{
ATTRIBUTES
=
(
Public
,
);
};
};
9617B07E1DFCA8CF00410F8F
/* Card.swift in Headers */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96BCB75D1CB40DC500C806FE
/* Card.swift */
;
settings
=
{
ATTRIBUTES
=
(
Public
,
);
};
};
9617B07F1DFCA8CF00410F8F
/* ImageCard.swift in Headers */
=
{
isa
=
PBXBuildFile
;
fileRef
=
96BCB7621CB40DC500C806FE
/* ImageCard.swift */
;
settings
=
{
ATTRIBUTES
=
(
Public
,
);
};
};
...
...
@@ -220,8 +216,6 @@
/* Begin PBXFileReference section */
961276621DCD8B1800A7D920
/* CharacterAttribute.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
CharacterAttribute.swift
;
sourceTree
=
"<group>"
;
};
9617B0731DFCA74500410F8F
/* Reminders.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
name
=
Reminders.swift
;
path
=
Reminders/Reminders.swift
;
sourceTree
=
"<group>"
;
};
9617B0791DFCA80A00410F8F
/* RemindersController.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
RemindersController.swift
;
sourceTree
=
"<group>"
;
};
961DED451DCC40C500F425B6
/* Editor.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
Editor.swift
;
sourceTree
=
"<group>"
;
};
961DED4A1DCC546100F425B6
/* EditorController.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
EditorController.swift
;
sourceTree
=
"<group>"
;
};
961E6BDE1DDA2A95004E6C93
/* Application.swift */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.swift
;
path
=
Application.swift
;
sourceTree
=
"<group>"
;
};
...
...
@@ -375,15 +369,6 @@
name
=
TextField
;
sourceTree
=
"<group>"
;
};
9617B0721DFCA71C00410F8F
/* Reminders */
=
{
isa
=
PBXGroup
;
children
=
(
9617B0731DFCA74500410F8F
/* Reminders.swift */
,
9617B0791DFCA80A00410F8F
/* RemindersController.swift */
,
);
name
=
Reminders
;
sourceTree
=
"<group>"
;
};
961DED441DCC40AC00F425B6
/* Editor */
=
{
isa
=
PBXGroup
;
children
=
(
...
...
@@ -603,7 +588,6 @@
96BCB7571CB40DC500C806FE
/* iOS */
=
{
isa
=
PBXGroup
;
children
=
(
9617B0721DFCA71C00410F8F
/* Reminders */
,
961E6BDD1DDA2A7E004E6C93
/* Application */
,
96264BE41D833C8400576F37
/* Bar */
,
962DDD081D6FBBD0001C307C
/* BottomTabBar */
,
...
...
@@ -906,8 +890,6 @@
9697F7C51D8F2573004741EC
/* MenuItem.swift in Headers */
,
9697F7CB1D8F2573004741EC
/* Snackbar.swift in Headers */
,
9697F7CC1D8F2573004741EC
/* SnackbarController.swift in Headers */
,
9617B07B1DFCA8CF00410F8F
/* Reminders.swift in Headers */
,
9617B07C1DFCA8CF00410F8F
/* RemindersController.swift in Headers */
,
9617B07D1DFCA8CF00410F8F
/* Application.swift in Headers */
,
9617B07E1DFCA8CF00410F8F
/* Card.swift in Headers */
,
9617B07F1DFCA8CF00410F8F
/* ImageCard.swift in Headers */
,
...
...
@@ -1167,7 +1149,6 @@
965E80EA1DD4C55200D61E4B
/* Material+UIFont.swift in Sources */
,
965E80EB1DD4C55200D61E4B
/* Material+UIImage.swift in Sources */
,
965E80EC1DD4C55200D61E4B
/* Material+Array.swift in Sources */
,
9617B07A1DFCA80A00410F8F
/* RemindersController.swift in Sources */
,
965E80ED1DD4C55200D61E4B
/* Material+UIWindow.swift in Sources */
,
965E80E41DD4C53300D61E4B
/* PulseView.swift in Sources */
,
965E80E51DD4C53300D61E4B
/* MotionPulse.swift in Sources */
,
...
...
@@ -1188,7 +1169,6 @@
965E80D31DD4C50600D61E4B
/* Device.swift in Sources */
,
965E80FD1DD4D59500D61E4B
/* Toolbar.swift in Sources */
,
965E80D41DD4C50600D61E4B
/* Divider.swift in Sources */
,
9617B0741DFCA74500410F8F
/* Reminders.swift in Sources */
,
965E80D51DD4C50600D61E4B
/* Grid.swift in Sources */
,
965E80D61DD4C50600D61E4B
/* HeightPreset.swift in Sources */
,
961E6BDF1DDA2A95004E6C93
/* Application.swift in Sources */
,
...
...
Sources/iOS/Reminders/Reminders.swift
deleted
100644 → 0
View file @
0d811800
/*
* Copyright (C) 2015 - 2016, Daniel Dahan and CosmicMind, Inc. <http://cosmicmind.io>.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* * Neither the name of CosmicMind nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
import
EventKit
@objc(RemindersAuthorizationStatus)
public
enum
RemindersAuthorizationStatus
:
Int
{
case
authorized
case
denied
}
@objc(RemindersDelegate)
public
protocol
RemindersDelegate
{
/**
A delegation method that is executed when the Reminder status is updated.
- Parameter reminders: A reference to the Reminder.
- Parameter status: A reference to the ReminderAuthorizationStatus.
*/
@objc
optional
func
reminders
(
reminders
:
Reminders
,
status
:
RemindersAuthorizationStatus
)
/**
A delegation method that is executed when Reminders is authorized.
- Parameter reminders: A reference to the Reminders.
*/
@objc
optional
func
reminders
(
authorized
reminders
:
Reminders
)
/**
A delegation method that is executed when Reminders is denied.
- Parameter reminders: A reference to the Reminders.
*/
@objc
optional
func
reminders
(
denied
reminders
:
Reminders
)
/**
A delegation method that is executed when a new Reminders list is created
- Parameter reminders: A reference to the Reminders.
- Parameter list: A reference to the calendar created
- Parameter created: A boolean describing if the operation succeeded or not.
*/
@objc
optional
func
reminders
(
reminders
:
Reminders
,
list
:
EKCalendar
,
created
:
Bool
)
/**
A delegation method that is executed when a new Reminders list is created
- Parameter reminders: A reference to the Reminder.
- Parameter list: A reference to the calendar created
- Parameter deleted: A boolean describing if the operation succeeded or not.
*/
@objc
optional
func
reminders
(
reminders
:
Reminders
,
list
:
EKCalendar
,
deleted
:
Bool
)
/**
A delegation method that is executed when a new Reminders list is created
- Parameter reminders: A reference to the Reminder.
- Parameter created: A boolean describing if the operation succeeded or not.
*/
@objc
optional
func
reminders
(
reminders
:
Reminders
,
created
:
Bool
)
/**
A delegation method that is executed when a new Reminders list is created
- Parameter reminders: A reference to the Reminder.
- Parameter deleted: A boolean describing if the operation succeeded or not.
*/
@objc
optional
func
reminders
(
reminders
:
Reminders
,
deleted
:
Bool
)
}
@objc(Reminders)
open
class
Reminders
:
NSObject
{
/// The current ReminderAuthorizationStatus.
public
var
authorizationStatus
:
RemindersAuthorizationStatus
{
return
.
authorized
==
EKEventStore
.
authorizationStatus
(
for
:
.
reminder
)
?
.
authorized
:
.
denied
}
/// A reference to the eventStore.
internal
lazy
var
eventStore
=
EKEventStore
()
/// A reference to a RemindersDelegate.
open
weak
var
delegate
:
RemindersDelegate
?
open
func
requestAuthorization
(
_
completion
:
((
RemindersAuthorizationStatus
)
->
Void
)?
=
nil
)
{
eventStore
.
requestAccess
(
to
:
.
reminder
)
{
[
weak
self
,
completion
=
completion
]
(
permission
,
_
)
in
DispatchQueue
.
main
.
async
{
[
weak
self
,
completion
=
completion
]
in
guard
let
s
=
self
else
{
return
}
if
permission
{
s
.
delegate
?
.
reminders
?(
reminders
:
s
,
status
:
.
authorized
)
s
.
delegate
?
.
reminders
?(
authorized
:
s
)
completion
?(
.
authorized
)
}
else
{
s
.
delegate
?
.
reminders
?(
reminders
:
s
,
status
:
.
denied
)
s
.
delegate
?
.
reminders
?(
denied
:
s
)
completion
?(
.
denied
)
}
}
}
}
}
// List CRUD operations
extension
Reminders
{
/**
A method for creating new Reminder lists
- Parameter list title: the name of the list
- Parameter completion: optional completion call back
*/
public
func
create
(
list
title
:
String
,
completion
:
((
Bool
,
Error
?)
->
Void
)?
=
nil
)
{
DispatchQueue
.
global
(
qos
:
.
default
)
.
async
{
[
weak
self
,
completion
=
completion
]
in
guard
let
s
=
self
else
{
return
}
let
list
=
EKCalendar
(
for
:
.
reminder
,
eventStore
:
s
.
eventStore
)
list
.
title
=
title
for
source
in
s
.
eventStore
.
sources
{
if
.
local
==
source
.
sourceType
{
list
.
source
=
source
var
created
=
false
var
error
:
Error
?
do
{
try
s
.
eventStore
.
saveCalendar
(
list
,
commit
:
true
)
created
=
true
}
catch
let
e
{
error
=
e
}
DispatchQueue
.
main
.
async
{
[
weak
self
,
completion
=
completion
]
in
guard
let
s
=
self
else
{
return
}
s
.
delegate
?
.
reminders
?(
reminders
:
s
,
list
:
list
,
created
:
created
)
completion
?(
created
,
error
)
}
}
}
}
}
/**
A method for deleting existing Reminder lists
- Parameter list identifier: the name of the list
- Parameter completion: optional completion call back
*/
public
func
delete
(
list
identifier
:
String
,
completion
:
((
Bool
,
Error
?)
->
Void
)?
=
nil
)
{
DispatchQueue
.
global
(
qos
:
.
default
)
.
async
{
[
weak
self
,
completion
=
completion
]
in
guard
let
s
=
self
else
{
return
}
guard
let
list
=
s
.
eventStore
.
calendar
(
withIdentifier
:
identifier
)
else
{
return
}
var
deleted
=
false
var
error
:
Error
?
do
{
try
s
.
eventStore
.
removeCalendar
(
list
,
commit
:
true
)
deleted
=
true
}
catch
let
e
{
error
=
e
}
DispatchQueue
.
main
.
async
{
[
weak
self
,
completion
=
completion
]
in
guard
let
s
=
self
else
{
return
}
s
.
delegate
?
.
reminders
?(
reminders
:
s
,
list
:
list
,
deleted
:
deleted
)
completion
?(
deleted
,
error
)
}
}
}
/**
A method for retrieving reminder lists
- Parameter completion: completion call back
*/
public
func
fetchLists
(
completion
:
([
EKCalendar
])
->
Void
)
{
completion
(
eventStore
.
calendars
(
for
:
.
reminder
))
}
}
// Reminder list CRUD operations
extension
Reminders
{
/**
A method for retrieving reminders from an optionally existing list.
if the list does not exist the reminders will be retrieved from the default reminders list
- Parameter list: An optional EKCalendar.
- Parameter completion: completion call back
*/
public
func
fetchReminders
(
list
:
EKCalendar
,
completion
:
@escaping
([
EKReminder
])
->
Void
)
{
var
lists
=
[
EKCalendar
]()
lists
.
append
(
list
)
eventStore
.
fetchReminders
(
matching
:
eventStore
.
predicateForReminders
(
in
:
lists
),
completion
:
{
[
completion
=
completion
]
(
reminders
)
in
DispatchQueue
.
main
.
async
{
[
completion
=
completion
]
in
completion
(
reminders
??
[])
}
})
}
// FIX ME: Should we use the calendar identifier here instead of the title for finding the right cal?
/**
A method for adding a new reminder to an optionally existing list.
if the list does not exist it will be added to the default reminders list.
- Parameter completion: optional completion call back
*/
public
func
create
(
title
:
String
,
dateComponents
:
DateComponents
,
in
list
:
EKCalendar
?
=
nil
,
completion
:
((
Error
?)
->
Void
)?
=
nil
)
{
var
reminderCal
=
[
EKCalendar
]()
if
list
!=
nil
{
fetchLists
(
completion
:
{
(
calendars
)
in
for
calendar
in
calendars
{
if
calendar
.
title
==
list
!.
title
{
reminderCal
.
append
(
calendar
)
}
}
})
}
let
reminder
=
EKReminder
(
eventStore
:
eventStore
)
reminder
.
title
=
title
reminder
.
dueDateComponents
=
dateComponents
reminder
.
calendar
=
reminderCal
.
last
!
var
created
:
Bool
=
false
var
error
:
Error
?
do
{
try
eventStore
.
save
(
reminder
,
commit
:
true
)
created
=
true
}
catch
let
e
{
error
=
e
}
DispatchQueue
.
main
.
async
{
[
weak
self
]
in
guard
let
s
=
self
else
{
return
}
s
.
delegate
?
.
reminders
?(
reminders
:
s
,
created
:
created
)
if
let
c
=
completion
{
c
(
error
)
}
}
}
// FIX ME: Should we use the calendar identifier here instead of the title for finding the right cal?
/**
A method for adding a new reminder to an optionally existing list.
if the list does not exist it will be added to the default reminders list.
- Parameter completion: optional completion call back
*/
public
func
delete
(
reminder
:
EKReminder
,
completion
:
((
Error
?)
->
Void
)?
=
nil
)
{
var
deleted
:
Bool
=
false
var
error
:
Error
?
do
{
try
eventStore
.
remove
(
reminder
,
commit
:
true
)
deleted
=
true
}
catch
let
e
{
error
=
e
}
DispatchQueue
.
main
.
async
{
[
weak
self
]
in
guard
let
s
=
self
else
{
return
}
s
.
delegate
?
.
reminders
?(
reminders
:
s
,
deleted
:
deleted
)
if
let
c
=
completion
{
c
(
error
)
}
}
}
}
Sources/iOS/RemindersController.swift
deleted
100644 → 0
View file @
0d811800
/*
* Copyright (C) 2015 - 2016, Daniel Dahan and CosmicMind, Inc. <http://cosmicmind.io>.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* * Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* * Neither the name of CosmicMind nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
import
UIKit
extension
UIViewController
{
/**
A convenience property that provides access to the RemindersController.
This is the recommended method of accessing the RemindersController
through child UIViewControllers.
*/
public
var
remindersController
:
RemindersController
?
{
var
viewController
:
UIViewController
?
=
self
while
nil
!=
viewController
{
if
viewController
is
RemindersController
{
return
viewController
as?
RemindersController
}
viewController
=
viewController
?
.
parent
}
return
nil
}
}
open
class
RemindersController
:
UIViewController
{
/// A reference to a Reminder.
open
let
reminders
=
Reminders
()
open
override
func
viewDidLoad
()
{
super
.
viewDidLoad
()
prepare
()
}
/**
Prepares the view instance when intialized. When subclassing,
it is recommended to override the prepareView method
to initialize property values and other setup operations.
The super.prepareView method should always be called immediately
when subclassing.
*/
open
func
prepare
()
{
view
.
clipsToBounds
=
true
view
.
backgroundColor
=
Color
.
white
view
.
contentScaleFactor
=
Screen
.
scale
prepareReminders
()
}
}
extension
RemindersController
{
/// Prepares the reminders.
fileprivate
func
prepareReminders
()
{
reminders
.
delegate
=
self
}
}
extension
RemindersController
:
RemindersDelegate
{}
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