Commit 68c78436 authored by hannes's avatar hannes
Browse files

not quite finished, but at least mails show up

parent 9771f233
......@@ -51,6 +51,9 @@ struct InboxHome: View {
var body: some View {
NavigationView{
VStack{
#if DEBUG //&& false
Button(action: {PersistentDataProvider.dataProvider.resetCategories()}, label: {Text("reset")})
#endif
topSection
if controller.isHome{ whenHome }else{ whenNotHome }
}//.animation(.easeInOut)
......
......@@ -75,7 +75,7 @@
<relationship name="ccAddresses" optional="YES" toMany="YES" deletionRule="Nullify" destinationEntity="AddressRecord" inverseName="inCCField" inverseEntity="AddressRecord"/>
<relationship name="decryptionKey" optional="YES" maxCount="1" deletionRule="Nullify" destinationEntity="SecretKeyRecord" inverseName="decryptedMails" inverseEntity="SecretKeyRecord"/>
<relationship name="fromAddress" optional="YES" maxCount="1" deletionRule="Nullify" destinationEntity="AddressRecord" inverseName="inFromField" inverseEntity="AddressRecord"/>
<relationship name="inCategory" optional="YES" maxCount="1" deletionRule="Nullify" destinationEntity="CategoryRecord"/>
<relationship name="inCategory" optional="YES" toMany="YES" deletionRule="Nullify" destinationEntity="CategoryRecord"/>
<relationship name="includedAttachments" optional="YES" toMany="YES" deletionRule="Cascade" destinationEntity="AttachmentRecord" inverseName="isPartOfMail" inverseEntity="AttachmentRecord"/>
<relationship name="inFolder" optional="YES" maxCount="1" deletionRule="Nullify" destinationEntity="FolderRecord" inverseName="mailsInFolder" inverseEntity="FolderRecord"/>
<relationship name="signatureKey" optional="YES" maxCount="1" deletionRule="Nullify" destinationEntity="PublicKeyRecord" inverseName="signedMails" inverseEntity="PublicKeyRecord"/>
......
......@@ -540,6 +540,18 @@ class PersistentDataProvider {
}
func resetCategories(){
let fetchRequest = NSFetchRequest<NSFetchRequestResult>(entityName: CategoryRecord.entityName)
let deleteRequest = NSBatchDeleteRequest(fetchRequest: fetchRequest)
do {
try self.newTaskContext().execute(deleteRequest)
debugPrint("Deleted Entitie - ", CategoryRecord.entityName)
} catch let error as NSError {
debugPrint("Delete ERROR \(CategoryRecord.entityName)")
debugPrint(error)
}
}
func reset(){
persistentContainer.viewContext.reset()
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment