Skip to content

Commit 612a8c1

Browse files
Added moderation events for warning and blur (#986)
1 parent d76af16 commit 612a8c1

File tree

5 files changed

+125
-0
lines changed

5 files changed

+125
-0
lines changed

Sources/StreamVideo/CallState.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,10 @@ public class CallState: ObservableObject {
308308
break
309309
case .typeCallUserFeedbackSubmittedEvent:
310310
break
311+
case .typeCallModerationBlurEvent:
312+
break
313+
case .typeCallModerationWarningEvent:
314+
break
311315
}
312316
}
313317

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
//
2+
// Copyright © 2025 Stream.io Inc. All rights reserved.
3+
//
4+
5+
import Foundation
6+
7+
public final class CallModerationBlurEvent: @unchecked Sendable, Event, Codable, JSONEncodable, Hashable, WSCallEvent {
8+
public var callCid: String
9+
public var createdAt: Date
10+
public var custom: [String: RawJSON]
11+
public var type: String = "call.moderation_blur"
12+
public var userId: String
13+
14+
public init(callCid: String, createdAt: Date, custom: [String: RawJSON], userId: String) {
15+
self.callCid = callCid
16+
self.createdAt = createdAt
17+
self.custom = custom
18+
self.userId = userId
19+
}
20+
21+
public enum CodingKeys: String, CodingKey, CaseIterable {
22+
case callCid = "call_cid"
23+
case createdAt = "created_at"
24+
case custom
25+
case type
26+
case userId = "user_id"
27+
}
28+
29+
public static func == (lhs: CallModerationBlurEvent, rhs: CallModerationBlurEvent) -> Bool {
30+
lhs.callCid == rhs.callCid &&
31+
lhs.createdAt == rhs.createdAt &&
32+
lhs.custom == rhs.custom &&
33+
lhs.type == rhs.type &&
34+
lhs.userId == rhs.userId
35+
}
36+
37+
public func hash(into hasher: inout Hasher) {
38+
hasher.combine(callCid)
39+
hasher.combine(createdAt)
40+
hasher.combine(custom)
41+
hasher.combine(type)
42+
hasher.combine(userId)
43+
}
44+
}
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
//
2+
// Copyright © 2025 Stream.io Inc. All rights reserved.
3+
//
4+
5+
import Foundation
6+
7+
public final class CallModerationWarningEvent: @unchecked Sendable, Event, Codable, JSONEncodable, Hashable, WSCallEvent {
8+
public var callCid: String
9+
public var createdAt: Date
10+
public var custom: [String: RawJSON]
11+
public var message: String
12+
public var type: String = "call.moderation_warning"
13+
public var userId: String
14+
15+
public init(callCid: String, createdAt: Date, custom: [String: RawJSON], message: String, userId: String) {
16+
self.callCid = callCid
17+
self.createdAt = createdAt
18+
self.custom = custom
19+
self.message = message
20+
self.userId = userId
21+
}
22+
23+
public enum CodingKeys: String, CodingKey, CaseIterable {
24+
case callCid = "call_cid"
25+
case createdAt = "created_at"
26+
case custom
27+
case message
28+
case type
29+
case userId = "user_id"
30+
}
31+
32+
public static func == (lhs: CallModerationWarningEvent, rhs: CallModerationWarningEvent) -> Bool {
33+
lhs.callCid == rhs.callCid &&
34+
lhs.createdAt == rhs.createdAt &&
35+
lhs.custom == rhs.custom &&
36+
lhs.message == rhs.message &&
37+
lhs.type == rhs.type &&
38+
lhs.userId == rhs.userId
39+
}
40+
41+
public func hash(into hasher: inout Hasher) {
42+
hasher.combine(callCid)
43+
hasher.combine(createdAt)
44+
hasher.combine(custom)
45+
hasher.combine(message)
46+
hasher.combine(type)
47+
hasher.combine(userId)
48+
}
49+
}

Sources/StreamVideo/OpenApi/generated/Models/VideoEvent.swift

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ public enum VideoEvent: Codable, Hashable {
3737
case typeCallMemberUpdatedEvent(CallMemberUpdatedEvent)
3838
case typeCallMemberUpdatedPermissionEvent(CallMemberUpdatedPermissionEvent)
3939
case typeCallMissedEvent(CallMissedEvent)
40+
case typeCallModerationBlurEvent(CallModerationBlurEvent)
41+
case typeCallModerationWarningEvent(CallModerationWarningEvent)
4042
case typeCallNotificationEvent(CallNotificationEvent)
4143
case typePermissionRequestEvent(PermissionRequestEvent)
4244
case typeUpdatedCallPermissionsEvent(UpdatedCallPermissionsEvent)
@@ -120,6 +122,10 @@ public enum VideoEvent: Codable, Hashable {
120122
return value.type
121123
case let .typeCallMissedEvent(value):
122124
return value.type
125+
case let .typeCallModerationBlurEvent(value):
126+
return value.type
127+
case let .typeCallModerationWarningEvent(value):
128+
return value.type
123129
case let .typeCallNotificationEvent(value):
124130
return value.type
125131
case let .typePermissionRequestEvent(value):
@@ -237,6 +243,10 @@ public enum VideoEvent: Codable, Hashable {
237243
return value
238244
case let .typeCallMissedEvent(value):
239245
return value
246+
case let .typeCallModerationBlurEvent(value):
247+
return value
248+
case let .typeCallModerationWarningEvent(value):
249+
return value
240250
case let .typeCallNotificationEvent(value):
241251
return value
242252
case let .typePermissionRequestEvent(value):
@@ -355,6 +365,10 @@ public enum VideoEvent: Codable, Hashable {
355365
try container.encode(value)
356366
case let .typeCallMissedEvent(value):
357367
try container.encode(value)
368+
case let .typeCallModerationBlurEvent(value):
369+
try container.encode(value)
370+
case let .typeCallModerationWarningEvent(value):
371+
try container.encode(value)
358372
case let .typeCallNotificationEvent(value):
359373
try container.encode(value)
360374
case let .typePermissionRequestEvent(value):
@@ -497,6 +511,12 @@ public enum VideoEvent: Codable, Hashable {
497511
} else if dto.type == "call.missed" {
498512
let value = try container.decode(CallMissedEvent.self)
499513
self = .typeCallMissedEvent(value)
514+
} else if dto.type == "call.moderation_blur" {
515+
let value = try container.decode(CallModerationBlurEvent.self)
516+
self = .typeCallModerationBlurEvent(value)
517+
} else if dto.type == "call.moderation_warning" {
518+
let value = try container.decode(CallModerationWarningEvent.self)
519+
self = .typeCallModerationWarningEvent(value)
500520
} else if dto.type == "call.notification" {
501521
let value = try container.decode(CallNotificationEvent.self)
502522
self = .typeCallNotificationEvent(value)

StreamVideo.xcodeproj/project.pbxproj

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1311,6 +1311,8 @@
13111311
845C09952C10A7D700F725B3 /* SessionTimer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 845C09902C0E0B7600F725B3 /* SessionTimer.swift */; };
13121312
845C09972C11AAA200F725B3 /* RejectCallRequest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 845C09962C11AAA100F725B3 /* RejectCallRequest.swift */; };
13131313
845E31062A7121D6004DC470 /* BroadcastObserver_Tests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 845E31052A7121D6004DC470 /* BroadcastObserver_Tests.swift */; };
1314+
8464FBA92EB3832000933768 /* CallModerationBlurEvent.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8464FBA72EB3832000933768 /* CallModerationBlurEvent.swift */; };
1315+
8464FBAA2EB3832000933768 /* CallModerationWarningEvent.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8464FBA82EB3832000933768 /* CallModerationWarningEvent.swift */; };
13141316
8468821328DFA448003BA9EE /* UnsecureRepository.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8468821228DFA448003BA9EE /* UnsecureRepository.swift */; };
13151317
8469593229BB3D7500134EA0 /* SignalServer_Tests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8469593129BB3D7500134EA0 /* SignalServer_Tests.swift */; };
13161318
8469593429BB5CE200134EA0 /* HTTPConfig.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8469593329BB5CE200134EA0 /* HTTPConfig.swift */; };
@@ -2884,6 +2886,8 @@
28842886
845C09922C0E1BF900F725B3 /* DemoSessionTimerView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DemoSessionTimerView.swift; sourceTree = "<group>"; };
28852887
845C09962C11AAA100F725B3 /* RejectCallRequest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RejectCallRequest.swift; sourceTree = "<group>"; };
28862888
845E31052A7121D6004DC470 /* BroadcastObserver_Tests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BroadcastObserver_Tests.swift; sourceTree = "<group>"; };
2889+
8464FBA72EB3832000933768 /* CallModerationBlurEvent.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CallModerationBlurEvent.swift; sourceTree = "<group>"; };
2890+
8464FBA82EB3832000933768 /* CallModerationWarningEvent.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CallModerationWarningEvent.swift; sourceTree = "<group>"; };
28872891
8468821228DFA448003BA9EE /* UnsecureRepository.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UnsecureRepository.swift; sourceTree = "<group>"; };
28882892
8469593129BB3D7500134EA0 /* SignalServer_Tests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SignalServer_Tests.swift; sourceTree = "<group>"; };
28892893
8469593329BB5CE200134EA0 /* HTTPConfig.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HTTPConfig.swift; sourceTree = "<group>"; };
@@ -7164,6 +7168,8 @@
71647168
84DC383E29ADFCFC00946713 /* Models */ = {
71657169
isa = PBXGroup;
71667170
children = (
7171+
8464FBA72EB3832000933768 /* CallModerationBlurEvent.swift */,
7172+
8464FBA82EB3832000933768 /* CallModerationWarningEvent.swift */,
71677173
8438AB042E5F3A2900BA834F /* AppEventResponse.swift */,
71687174
8438AB052E5F3A2900BA834F /* FileUploadConfig.swift */,
71697175
84DD68F22E5F24A9001A1DF5 /* AppUpdatedEvent.swift */,
@@ -8444,6 +8450,8 @@
84448450
8478EB13288A054B00525538 /* VideoConfig.swift in Sources */,
84458451
841BAA372BD15CDE000C73E4 /* Coordinates.swift in Sources */,
84468452
8492B875290808AE00006649 /* StreamVideoEnvironment.swift in Sources */,
8453+
8464FBA92EB3832000933768 /* CallModerationBlurEvent.swift in Sources */,
8454+
8464FBAA2EB3832000933768 /* CallModerationWarningEvent.swift in Sources */,
84478455
841BAA492BD15CDE000C73E4 /* CollectUserFeedbackRequest.swift in Sources */,
84488456
406583902B877A0500B4F979 /* ImageBackgroundVideoFilter.swift in Sources */,
84498457
8454A3192AAB374B00A012C6 /* CallStatsReport.swift in Sources */,

0 commit comments

Comments
 (0)