RaPla parser is now aware of recurring events

- Also some small improvements and basic implementation of Notifications
This commit is contained in:
2021-04-07 13:26:37 +02:00
committed by Patrick Müller
parent 805495fb81
commit 02cd3a0db9
10 changed files with 359 additions and 56 deletions
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<model type="com.apple.IDECoreDataModeler.DataModel" documentVersion="1.0" lastSavedToolsVersion="17709" systemVersion="20D62" minimumToolsVersion="Automatic" sourceLanguage="Swift" usedWithCloudKit="YES" userDefinedModelVersionIdentifier="">
<model type="com.apple.IDECoreDataModeler.DataModel" documentVersion="1.0" lastSavedToolsVersion="17709" systemVersion="20E5172i" minimumToolsVersion="Automatic" sourceLanguage="Swift" usedWithCloudKit="YES" userDefinedModelVersionIdentifier="">
<entity name="Lecturer" representedClassName="Lecturer" syncable="YES">
<attribute name="email" optional="YES" attributeType="String"/>
<attribute name="name" optional="YES" attributeType="String"/>
@@ -20,10 +20,11 @@
<attribute name="course" optional="YES" attributeType="String"/>
<attribute name="director" optional="YES" attributeType="String"/>
<attribute name="name" optional="YES" attributeType="String"/>
<attribute name="raplaLink" optional="YES" attributeType="String"/>
</entity>
<elements>
<element name="Lecturer" positionX="-351" positionY="99" width="128" height="74"/>
<element name="RaPlaEvent" positionX="-271.3642578125" positionY="83.64776611328125" width="128" height="164"/>
<element name="User" positionX="-428.6358032226562" positionY="2.067169189453125" width="128" height="74"/>
<element name="User" positionX="-428.6358032226562" positionY="2.067169189453125" width="128" height="89"/>
</elements>
</model>
+22 -10
View File
@@ -10,7 +10,7 @@ import CoreData
struct PersistenceController {
// Singleton
static let shared = PersistenceController()
// Cloud Kit container
let container: NSPersistentCloudKitContainer
@@ -20,7 +20,7 @@ struct PersistenceController {
return self.container.viewContext
}
}
// MARK: - Constructor
init(inMemory: Bool = false) {
container = NSPersistentCloudKitContainer(name: "DHBW_Service")
@@ -31,15 +31,15 @@ struct PersistenceController {
if let error = error as NSError? {
// Replace this implementation with code to handle the error appropriately.
// fatalError() causes the application to generate a crash log and terminate. You should not use this function in a shipping application, although it may be useful during development.
/*
Typical reasons for an error here include:
* The parent directory does not exist, cannot be created, or disallows writing.
* The persistent store is not accessible, due to permissions or data protection when the device is locked.
* The device is out of space.
* The store could not be migrated to the current model version.
Check the error message to determine what the actual problem was.
*/
Typical reasons for an error here include:
* The parent directory does not exist, cannot be created, or disallows writing.
* The persistent store is not accessible, due to permissions or data protection when the device is locked.
* The device is out of space.
* The store could not be migrated to the current model version.
Check the error message to determine what the actual problem was.
*/
fatalError("Unresolved error \(error), \(error.userInfo)")
}
})
@@ -90,6 +90,18 @@ struct PersistenceController {
normalEvent2.category = "Lehrveranstaltung"
examEvent.category = "Prüfung"
let lecturer1 = Lecturer(context: PersistenceController.shared.context)
let lecturer2 = Lecturer(context: PersistenceController.shared.context)
lecturer1.name = "Mustermann, Prof. Dr."
lecturer1.email = "mustermann@dhbw-karlsruhe.de"
lecturer2.name = "Musterfrau, Prof. Dr."
lecturer2.email = "musterfrau@dhbw-karlsruhe.de"
normalEvent1.addToLecturers(lecturer1)
normalEvent2.addToLecturers(lecturer2)
examEvent.addToLecturers(lecturer1)
examEvent.addToLecturers(lecturer2)
var currentDate = Date()
currentDate.addTimeInterval(1*60*60);normalEvent1.startDate = currentDate
currentDate.addTimeInterval(1*60*60);normalEvent2.startDate = currentDate