-
Notifications
You must be signed in to change notification settings - Fork 210
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement user block feature (#3223)
- Loading branch information
1 parent
9aa1b92
commit 1d2660f
Showing
54 changed files
with
892 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
70 changes: 70 additions & 0 deletions
70
Sources/StreamChat/APIClient/Endpoints/BlockedUserPayload.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
// | ||
// Copyright © 2024 Stream.io Inc. All rights reserved. | ||
// | ||
|
||
import Foundation | ||
|
||
/// An object describing the incoming blocking user JSON payload. | ||
struct BlockingUserPayload: Decodable, Equatable { | ||
private enum CodingKeys: String, CodingKey { | ||
case blockedUserId = "blocked_user_id" | ||
case blockedByUserId = "blocked_by_user_id" | ||
case createdAt = "created_at" | ||
} | ||
|
||
let blockedUserId: String | ||
let blockedByUserId: String | ||
let createdAt: Date | ||
} | ||
|
||
/// An object describing the incoming blocked users JSON payload. | ||
struct BlocksPayload: Decodable { | ||
private enum CodingKeys: String, CodingKey { | ||
case blockedUsers = "blocks" | ||
} | ||
|
||
/// The blocked users. | ||
let blockedUsers: [BlockPayload] | ||
} | ||
|
||
/// An object describing the incoming block JSON payload. | ||
struct BlockPayload: Decodable { | ||
private enum CodingKeys: String, CodingKey { | ||
case blockedUserId = "blocked_user_id" | ||
case userId = "user_id" | ||
case createdAt = "created_at" | ||
case blockedUser = "blocked_user" | ||
} | ||
|
||
let blockedUserId: String | ||
let userId: String | ||
let createdAt: Date | ||
let blockedUser: BlockedUserPayload | ||
} | ||
|
||
extension BlockPayload: Equatable { | ||
static func == (lhs: BlockPayload, rhs: BlockPayload) -> Bool { | ||
lhs.blockedUserId == rhs.blockedUserId | ||
&& lhs.userId == rhs.userId | ||
&& lhs.createdAt == rhs.createdAt | ||
} | ||
} | ||
|
||
/// An object describing the incoming blocked-user JSON payload. | ||
struct BlockedUserPayload: Decodable { | ||
private enum CodingKeys: String, CodingKey { | ||
case id | ||
case anon | ||
case name | ||
case role | ||
case teams | ||
case username | ||
} | ||
|
||
let id: String | ||
let anon: Bool? | ||
let name: String? | ||
let role: UserRole | ||
let teams: [TeamId] | ||
let username: String? | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.