@@ -15,19 +15,34 @@ public enum CoursePushNotification: Codable {
15
15
case parameters
16
16
}
17
17
18
+ case addedToChannel( AddedToChannelNotification )
19
+ case channelDeleted( ChannelDeletedNotification )
18
20
case newAnnouncement( NewAnnouncementNotification )
19
21
case newAnswer( NewAnswerNotification )
20
22
case newMention( NewMentionNotification )
21
23
case newPost( NewPostNotification )
24
+ case removedFromChannel( RemovedFromChannelNotification )
22
25
case attachmentChanged( AttachmentChangedNotification )
26
+ case deregisteredFromTutorial( DeregisteredFromTutorialGroupNotification )
27
+ case duplicateTestCase( DuplicateTestCaseNotification )
23
28
case exerciseAssessed( ExerciseAssessedNotification )
24
29
case exerciseOpenForPractice( ExerciseOpenForPracticeNotification )
25
30
case exerciseUpdated( ExerciseUpdatedNotification )
31
+ case newCpcPlagiarismCase( NewCpcPlagiarismCaseNotification )
26
32
case newExercise( NewExerciseNotification )
27
33
case newManualFeedbackRequest( NewManualFeedbackRequestNotification )
34
+ case newPlagiarismCase( NewPlagiarismCaseNotification )
35
+ case plagiarismCaseVerdict( PlagiarismCaseVerdictNotification )
36
+ case programmingBuildRunUpdate( ProgrammingBuildRunUpdateNotification )
37
+ case programmingTestCasesChanged( ProgrammingTestCasesChangedNotification )
28
38
case quizStarted( QuizExerciseStartedNotification )
39
+ case registeredToTutorial( RegisteredToTutorialGroupNotification )
40
+ case tutorialAssigned( TutorialGroupAssignedNotification )
41
+ case tutorialDeleted( TutorialGroupDeletedNotification )
42
+ case tutorialUnassigned( TutorialGroupUnassignedNotification )
29
43
case unknown
30
44
45
+ // swiftlint:disable:next cyclomatic_complexity
31
46
/// Initializer for using different CodingKeys.
32
47
/// This is necessary because Notifications that aren't push notifications have a different name for `type`.
33
48
public init < Key> ( from decoder: Decoder , typeKey: Key , parametersKey: Key ) throws where Key: CodingKey {
@@ -36,18 +51,32 @@ public enum CoursePushNotification: Codable {
36
51
let decodeNotification = NotificationDecoder ( key: parametersKey, container: container)
37
52
self = switch type {
38
53
// Communication
54
+ case . addedToChannelNotification: . addedToChannel( try decodeNotification ( ) )
55
+ case . channelDeletedNotification: . channelDeleted( try decodeNotification ( ) )
39
56
case . newAnnouncementNotification: . newAnnouncement( try decodeNotification ( ) )
40
57
case . newAnswerNotification: . newAnswer( try decodeNotification ( ) )
41
58
case . newMentionNotification: . newMention( try decodeNotification ( ) )
42
59
case . newPostNotification: . newPost( try decodeNotification ( ) )
60
+ case . removedFromChannelNotification: . removedFromChannel( try decodeNotification ( ) )
43
61
// General
44
62
case . attachmentChangedNotification: . attachmentChanged( try decodeNotification ( ) )
63
+ case . deregisteredFromTutorialGroupNotification: . deregisteredFromTutorial( try decodeNotification ( ) )
64
+ case . duplicateTestCaseNotification: . duplicateTestCase( try decodeNotification ( ) )
45
65
case . exerciseAssessedNotification: . exerciseAssessed( try decodeNotification ( ) )
46
66
case . exerciseOpenForPracticeNotification: . exerciseOpenForPractice( try decodeNotification ( ) )
47
67
case . exerciseUpdatedNotification: . exerciseUpdated( try decodeNotification ( ) )
68
+ case . newCpcPlagiarismCaseNotification: . newCpcPlagiarismCase( try decodeNotification ( ) )
48
69
case . newExerciseNotification: . newExercise( try decodeNotification ( ) )
49
70
case . newManualFeedbackRequestNotification: . newManualFeedbackRequest( try decodeNotification ( ) )
71
+ case . newPlagiarismCaseNotification: . newPlagiarismCase( try decodeNotification ( ) )
72
+ case . plagiarismCaseVerdictNotification: . plagiarismCaseVerdict( try decodeNotification ( ) )
73
+ case . programmingBuildRunUpdateNotification: . programmingBuildRunUpdate( try decodeNotification ( ) )
74
+ case . programmingTestCasesChangedNotification: . programmingTestCasesChanged( try decodeNotification ( ) )
50
75
case . quizExerciseStartedNotification: . quizStarted( try decodeNotification ( ) )
76
+ case . registeredToTutorialGroupNotification: . registeredToTutorial( try decodeNotification ( ) )
77
+ case . tutorialGroupAssignedNotification: . tutorialAssigned( try decodeNotification ( ) )
78
+ case . tutorialGroupDeletedNotification: . tutorialDeleted( try decodeNotification ( ) )
79
+ case . tutorialGroupUnassignedNotification: . tutorialUnassigned( try decodeNotification ( ) )
51
80
case . unknown: . unknown
52
81
}
53
82
}
@@ -61,18 +90,26 @@ public enum CoursePushNotification: Codable {
61
90
62
91
public var displayable : DisplayableNotification ? {
63
92
switch self {
93
+ case . addedToChannel( let notification) : notification
94
+ case . channelDeleted( let notification) : notification
64
95
case . newAnnouncement( let notification) : notification
65
96
case . newAnswer( let notification) : notification
66
97
case . newMention( let notification) : notification
67
98
case . newPost( let notification) : notification
99
+ case . removedFromChannel( let notification) : notification
68
100
69
101
case . attachmentChanged( let notification) : notification
102
+ case . deregisteredFromTutorial( let notification) : notification
70
103
case . exerciseAssessed( let notification) : notification
71
104
case . exerciseOpenForPractice( let notification) : notification
72
105
case . exerciseUpdated( let notification) : notification
73
106
case . newExercise( let notification) : notification
74
107
case . newManualFeedbackRequest( let notification) : notification
75
108
case . quizStarted( let notification) : notification
109
+ case . registeredToTutorial( let notification) : notification
110
+ case . tutorialAssigned( let notification) : notification
111
+ case . tutorialDeleted( let notification) : notification
112
+ case . tutorialUnassigned( let notification) : notification
76
113
default :
77
114
nil
78
115
}
@@ -92,18 +129,32 @@ private struct NotificationDecoder<Key: CodingKey> {
92
129
93
130
public enum CourseNotificationType : String , Codable , ConstantsEnum {
94
131
// Communication
132
+ case addedToChannelNotification
133
+ case channelDeletedNotification
95
134
case newAnnouncementNotification
96
135
case newAnswerNotification
97
136
case newMentionNotification
98
137
case newPostNotification
138
+ case removedFromChannelNotification
99
139
// General
100
140
case attachmentChangedNotification
141
+ case deregisteredFromTutorialGroupNotification
142
+ case duplicateTestCaseNotification
101
143
case exerciseAssessedNotification
102
144
case exerciseOpenForPracticeNotification
103
145
case exerciseUpdatedNotification
146
+ case newCpcPlagiarismCaseNotification
104
147
case newExerciseNotification
105
148
case newManualFeedbackRequestNotification
149
+ case newPlagiarismCaseNotification
150
+ case plagiarismCaseVerdictNotification
151
+ case programmingBuildRunUpdateNotification
152
+ case programmingTestCasesChangedNotification
106
153
case quizExerciseStartedNotification
154
+ case registeredToTutorialGroupNotification
155
+ case tutorialGroupAssignedNotification
156
+ case tutorialGroupDeletedNotification
157
+ case tutorialGroupUnassignedNotification
107
158
case unknown
108
159
}
109
160
0 commit comments