diff --git a/Artemis.xcodeproj/project.pbxproj b/Artemis.xcodeproj/project.pbxproj
index 40019371..5b14c4e0 100644
--- a/Artemis.xcodeproj/project.pbxproj
+++ b/Artemis.xcodeproj/project.pbxproj
@@ -475,7 +475,6 @@
"$(inherited)",
"@executable_path/Frameworks",
);
- MARKETING_VERSION = 1.3.1;
OTHER_LDFLAGS = "";
PRODUCT_BUNDLE_IDENTIFIER = de.tum.cit.ase.artemis;
PRODUCT_NAME = "$(TARGET_NAME)";
@@ -505,7 +504,6 @@
"$(inherited)",
"@executable_path/Frameworks",
);
- MARKETING_VERSION = 1.3.1;
OTHER_LDFLAGS = "";
PRODUCT_BUNDLE_IDENTIFIER = de.tum.cit.ase.artemis;
PRODUCT_NAME = "$(TARGET_NAME)";
diff --git a/Artemis.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/Artemis.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved
index dfc00784..fb8536dc 100644
--- a/Artemis.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved
+++ b/Artemis.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved
@@ -14,8 +14,8 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/ls1intum/artemis-ios-core-modules",
"state" : {
- "revision" : "c5ad034195a126f616ed7e5e6b71a57472a120d4",
- "version" : "14.5.0"
+ "revision" : "dc9ddaf88a726ed1fc454e865b21bc1b4fb0c343",
+ "version" : "14.5.2"
}
},
{
diff --git a/Artemis/Supporting/Info.plist b/Artemis/Supporting/Info.plist
index 0fdaf737..be536268 100644
--- a/Artemis/Supporting/Info.plist
+++ b/Artemis/Supporting/Info.plist
@@ -21,7 +21,7 @@
CFBundlePackageType
$(PRODUCT_BUNDLE_PACKAGE_TYPE)
CFBundleShortVersionString
- 1.3.1
+ 1.3.2
CFBundleVersion
1
ITSAppUsesNonExemptEncryption
diff --git a/ArtemisKit/Package.swift b/ArtemisKit/Package.swift
index 607fe366..5f4503d2 100644
--- a/ArtemisKit/Package.swift
+++ b/ArtemisKit/Package.swift
@@ -20,7 +20,7 @@ let package = Package(
dependencies: [
.package(url: "https://github.com/Kelvas09/EmojiPicker.git", from: "1.0.0"),
.package(url: "https://github.com/ls1intum/apollon-ios-module", .upToNextMajor(from: "1.0.2")),
- .package(url: "https://github.com/ls1intum/artemis-ios-core-modules", .upToNextMajor(from: "14.5.0")),
+ .package(url: "https://github.com/ls1intum/artemis-ios-core-modules", .upToNextMajor(from: "14.5.2")),
.package(url: "https://github.com/mac-cain13/R.swift.git", from: "7.0.0")
],
targets: [
diff --git a/ArtemisKit/Sources/Messages/Models/Schema/SchemaV1.swift b/ArtemisKit/Sources/Messages/Models/Schema/SchemaV1.swift
index 36d705cf..c4a1b552 100644
--- a/ArtemisKit/Sources/Messages/Models/Schema/SchemaV1.swift
+++ b/ArtemisKit/Sources/Messages/Models/Schema/SchemaV1.swift
@@ -41,7 +41,7 @@ enum SchemaV1: VersionedSchema {
@Model
final class Course {
- var server: Server
+ var server: Server?
@Attribute(.unique)
var courseId: Int
@@ -60,7 +60,7 @@ enum SchemaV1: VersionedSchema {
@Model
final class Conversation {
- var course: Course
+ var course: Course?
@Attribute(.unique)
var conversationId: Int
diff --git a/ArtemisKit/Sources/Messages/Repositories/MessagesRepository.swift b/ArtemisKit/Sources/Messages/Repositories/MessagesRepository.swift
index e923881f..88ea99e0 100644
--- a/ArtemisKit/Sources/Messages/Repositories/MessagesRepository.swift
+++ b/ArtemisKit/Sources/Messages/Repositories/MessagesRepository.swift
@@ -78,7 +78,7 @@ extension MessagesRepository {
log.verbose("begin")
try purge(host: host)
let predicate = #Predicate { course in
- course.server.host == host
+ course.server?.host == host
&& course.courseId == courseId
}
return try container.mainContext.fetch(FetchDescriptor(predicate: predicate)).first
@@ -100,9 +100,13 @@ extension MessagesRepository {
log.verbose("begin")
try purge(host: host)
let predicate = #Predicate { conversation in
- conversation.course.server.host == host
- && conversation.course.courseId == courseId
- && conversation.conversationId == conversationId
+ if let course = conversation.course {
+ course.server?.host == host
+ && course.courseId == courseId
+ && conversation.conversationId == conversationId
+ } else {
+ false
+ }
}
return try container.mainContext.fetch(FetchDescriptor(predicate: predicate)).first
}
@@ -116,7 +120,7 @@ extension MessagesRepository {
log.verbose("begin")
let conversation = try fetchConversation(host: host, courseId: courseId, conversationId: conversationId)
?? insertConversation(host: host, courseId: courseId, conversationId: conversationId, messageDraft: "")
- try touch(server: conversation.course.server)
+ try touch(server: conversation.course?.server)
let message = ConversationOfflineMessageModel(conversation: conversation, date: date, text: text)
container.mainContext.insert(message)
return message
@@ -128,9 +132,13 @@ extension MessagesRepository {
log.verbose("begin")
try purge(host: host)
let predicate = #Predicate { message in
- message.conversation.course.server.host == host
- && message.conversation.course.courseId == courseId
- && message.conversation.conversationId == conversationId
+ if let course = message.conversation.course {
+ course.server?.host == host
+ && course.courseId == courseId
+ && message.conversation.conversationId == conversationId
+ } else {
+ false
+ }
}
return try container.mainContext.fetch(FetchDescriptor(predicate: predicate, sortBy: [SortDescriptor(\.date)]))
}
@@ -146,7 +154,7 @@ extension MessagesRepository {
log.verbose("begin")
let conversation = try fetchConversation(host: host, courseId: courseId, conversationId: conversationId)
?? insertConversation(host: host, courseId: courseId, conversationId: conversationId, messageDraft: "")
- try touch(server: conversation.course.server)
+ try touch(server: conversation.course?.server)
let message = MessageModel(conversation: conversation, messageId: messageId, answerMessageDraft: answerMessageDraft)
container.mainContext.insert(message)
return message
@@ -156,10 +164,14 @@ extension MessagesRepository {
log.verbose("begin")
try purge(host: host)
let predicate = #Predicate { message in
- message.conversation.course.server.host == host
- && message.conversation.course.courseId == courseId
- && message.conversation.conversationId == conversationId
- && message.messageId == messageId
+ if let course = message.conversation.course {
+ course.server?.host == host
+ && course.courseId == courseId
+ && message.conversation.conversationId == conversationId
+ && message.messageId == messageId
+ } else {
+ false
+ }
}
return try container.mainContext.fetch(FetchDescriptor(predicate: predicate)).first
}
@@ -174,7 +186,7 @@ extension MessagesRepository {
log.verbose("begin")
let message = try fetchMessage(host: host, courseId: courseId, conversationId: conversationId, messageId: messageId)
?? insertMessage(host: host, courseId: courseId, conversationId: conversationId, messageId: messageId, answerMessageDraft: "")
- try touch(server: message.conversation.course.server)
+ try touch(server: message.conversation.course?.server)
let answer = MessageOfflineAnswerModel(message: message, date: date, text: text)
container.mainContext.insert(answer)
return answer
@@ -186,10 +198,14 @@ extension MessagesRepository {
log.verbose("begin")
try purge(host: host)
let predicate = #Predicate { answer in
- answer.message.conversation.course.server.host == host
- && answer.message.conversation.course.courseId == courseId
- && answer.message.conversation.conversationId == conversationId
- && answer.message.messageId == messageId
+ if let course = answer.message.conversation.course {
+ course.server?.host == host
+ && course.courseId == courseId
+ && answer.message.conversation.conversationId == conversationId
+ && answer.message.messageId == messageId
+ } else {
+ false
+ }
}
return try container.mainContext.fetch(FetchDescriptor(predicate: predicate, sortBy: [SortDescriptor(\.date)]))
}
@@ -200,9 +216,9 @@ extension MessagesRepository {
// - Cache Invalidation
- func touch(server: ServerModel) throws {
+ func touch(server: ServerModel?) throws {
log.verbose("begin")
- server.lastAccessDate = .now
+ server?.lastAccessDate = .now
}
func purge(host: String) throws {