Skip to content

Commit 001114f

Browse files
Remove deprecated methods (#3821)
1 parent b281b23 commit 001114f

File tree

50 files changed

+81
-1298
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+81
-1298
lines changed

Examples/YouTubeClone/ChatClient.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ extension ChatClient {
1818
components.messageListVC = YTLiveChatMessageListViewController.self
1919
components.messageComposerVC = YTChatComposerViewController.self
2020
components.messageComposerView = YTChatMessageComposerView.self
21-
components.scrollToLatestMessageButton = YTScrollToLatestMessageButton.self
21+
components.scrollToBottomButton = YTScrollToLatestMessageButton.self
2222
components.sendButton = YTSendButton.self
2323
components.inputMessageView = YTInputChatMessageView.self
2424

Examples/YouTubeClone/ScrollToLatestMessageButton/YTScrollToLatestMessageButton.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import StreamChatUI
77
import UIKit
88

99
/// A button which appears at the bottom of the chat list when the user is not viewing the latest messages. Tapping on this button scrolls to the latest messages.
10-
final class YTScrollToLatestMessageButton: ScrollToLatestMessageButton {
10+
final class YTScrollToLatestMessageButton: ScrollToBottomButton {
1111
override func setUpAppearance() {
1212
// Customise the appearance to make it look like the YouTube scroll to bottom button
1313
tintColor = .white

Examples/YouTubeClone/YTLiveChatViewController.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ final class YTLiveChatMessageListViewController: ChatMessageListVC {
2424
override func setUpLayout() {
2525
super.setUpLayout()
2626
NSLayoutConstraint.activate([
27-
scrollToLatestMessageButton.centerXAnchor.constraint(equalTo: view.layoutMarginsGuide.centerXAnchor),
28-
scrollToLatestMessageButton.widthAnchor.constraint(equalToConstant: 30),
29-
scrollToLatestMessageButton.heightAnchor.constraint(equalToConstant: 30)
27+
scrollToBottomButton.centerXAnchor.constraint(equalTo: view.layoutMarginsGuide.centerXAnchor),
28+
scrollToBottomButton.widthAnchor.constraint(equalToConstant: 30),
29+
scrollToBottomButton.heightAnchor.constraint(equalToConstant: 30)
3030
])
3131

3232
dateOverlayView.removeFromSuperview()

Sources/StreamChat/APIClient/Endpoints/Payloads/RawJSON.swift

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -337,14 +337,3 @@ extension RawJSON {
337337
}
338338
}
339339
}
340-
341-
// MARK: Deprecations
342-
343-
public extension RawJSON {
344-
@available(*, deprecated, message: "dictionaryValue property should be used instead.")
345-
func dictionary(with value: RawJSON?, forKey key: String) -> RawJSON? {
346-
guard case var .dictionary(content) = self else { return nil }
347-
content[key] = value
348-
return .dictionary(content)
349-
}
350-
}

Sources/StreamChat/ChatClient.swift

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -477,13 +477,6 @@ public class ChatClient: @unchecked Sendable {
477477
authenticationRepository.setToken(token: token, completeTokenWaiters: true)
478478
}
479479

480-
/// Disconnects the chat client from the chat servers. No further updates from the servers
481-
/// are received.
482-
@available(*, deprecated, message: "Use the asynchronous version of `disconnect` for increased safety")
483-
public func disconnect() {
484-
disconnect {}
485-
}
486-
487480
/// Disconnects the chat client from the chat servers. No further updates from the servers
488481
/// are received.
489482
public func disconnect(completion: @escaping @MainActor() -> Void) {
@@ -506,12 +499,6 @@ public class ChatClient: @unchecked Sendable {
506499
}
507500
}
508501
}
509-
510-
/// Disconnects the chat client from the chat servers and removes all the local data related.
511-
@available(*, deprecated, message: "Use the asynchronous version of `logout` for increased safety")
512-
public func logout() {
513-
logout {}
514-
}
515502

516503
/// Disconnects the chat client from the chat servers and removes all the local data related.
517504
/// - Parameters:

Sources/StreamChat/Config/ChatClientConfig.swift

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -81,20 +81,6 @@ public struct ChatClientConfig: Sendable {
8181
/// **Warning**: There should be at max 1 active client at the same time, else it can lead to undefined behavior.
8282
public var isClientInActiveMode: Bool
8383

84-
/// If set to `true` the `ChatClient` will automatically establish a web-socket
85-
/// connection to listen to the updates when `refreshToken` is called.
86-
///
87-
/// If set to `false` the connection won't be established automatically
88-
/// but has to be initiated manually by calling `connect`.
89-
///
90-
/// Is `true` by default.
91-
@available(
92-
*,
93-
deprecated,
94-
message: "This flag has no effect anymore. The flow for setting and for connecting the user has been unified to the `connectUser` set of methods."
95-
)
96-
public var shouldConnectAutomatically = true
97-
9884
/// If set to `true`, the `ChatClient` will try to stay connected while app is backgrounded.
9985
/// If set to `false`, websocket disconnects immediately when app is backgrounded.
10086
///

Sources/StreamChat/Config/Token.swift

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,6 @@ public struct Token: Decodable, Equatable, ExpressibleByStringLiteral, Sendable
1010
public let userId: UserId
1111
public let expiration: Date?
1212

13-
@available(
14-
*,
15-
deprecated,
16-
17-
message: "It is not a good practice to check expiration client side since the user can change the device's time."
18-
)
19-
public var isExpired: Bool {
20-
expiration.map { $0 < Date() } ?? false
21-
}
22-
2313
/// Created a new `Token` instance.
2414
/// - Parameter value: The JWT string value. It must be in valid format and contain `user_id` in payload.
2515
public init(stringLiteral value: StringLiteralType) {

Sources/StreamChat/Controllers/ChannelController/ChannelController.swift

Lines changed: 0 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -2101,80 +2101,6 @@ extension ClientError {
21012101
final class ChannelFeatureDisabled: ClientError, @unchecked Sendable {}
21022102
}
21032103

2104-
// MARK: - Deprecations
2105-
2106-
public extension ChatChannelController {
2107-
/// Indicates whether the channel has typing events enabled.
2108-
@available(*, deprecated, message: "`channel.canSendTypingEvents` should be used instead.")
2109-
var areTypingEventsEnabled: Bool {
2110-
channel?.canSendTypingEvents == true
2111-
}
2112-
2113-
/// Indicates whether the channel has reactions enabled.
2114-
@available(*, deprecated, message: "`channel.canSendReaction` should be used instead.")
2115-
var areReactionsEnabled: Bool {
2116-
channel?.canSendReaction == true
2117-
}
2118-
2119-
/// Indicates whether the channel has replies enabled.
2120-
@available(*, deprecated, message: "`channel.canSendReply` should be used instead.")
2121-
var areRepliesEnabled: Bool {
2122-
channel?.canSendReply == true
2123-
}
2124-
2125-
/// Indicates whether the channel has quotes enabled.
2126-
@available(*, deprecated, message: "`channel.canQuoteMessage` should be used instead.")
2127-
var areQuotesEnabled: Bool {
2128-
channel?.canQuoteMessage == true
2129-
}
2130-
2131-
/// Indicates whether the channel has read events enabled.
2132-
@available(*, deprecated, message: "`channel.canReceiveReadEvents` should be used instead.")
2133-
var areReadEventsEnabled: Bool {
2134-
channel?.canReceiveReadEvents == true
2135-
}
2136-
2137-
/// Indicates whether the channel supports uploading files/images.
2138-
@available(*, deprecated, message: "`channel.canUploadFile should be used instead.")
2139-
var areUploadsEnabled: Bool {
2140-
channel?.canUploadFile == true
2141-
}
2142-
}
2143-
2144-
public extension ChatChannelController {
2145-
/// Uploads the given file to CDN and returns the file URL.
2146-
/// - Parameters:
2147-
/// - localFileURL: Local URL of the file.
2148-
/// - progress: Upload progress callback
2149-
/// - completion: Completion to be called when upload finishes, or errors.
2150-
@available(*, deprecated, message: "use uploadAttachment() instead.")
2151-
func uploadFile(
2152-
localFileURL: URL,
2153-
progress: (@Sendable(Double) -> Void)? = nil,
2154-
completion: @escaping @MainActor(Result<URL, Error>) -> Void
2155-
) {
2156-
uploadAttachment(localFileURL: localFileURL, type: .file, progress: progress) { result in
2157-
completion(result.map(\.remoteURL))
2158-
}
2159-
}
2160-
2161-
/// Uploads the given image to CDN and returns the file URL.
2162-
/// - Parameters:
2163-
/// - localFileURL: Local URL of the image.
2164-
/// - progress: Upload progress callback
2165-
/// - completion: Completion to be called when upload finishes, or errors.
2166-
@available(*, deprecated, message: "use uploadAttachment() instead.")
2167-
func uploadImage(
2168-
localFileURL: URL,
2169-
progress: (@Sendable(Double) -> Void)? = nil,
2170-
completion: @escaping @MainActor(Result<URL, Error>) -> Void
2171-
) {
2172-
uploadAttachment(localFileURL: localFileURL, type: .image, progress: progress) { result in
2173-
completion(result.map(\.remoteURL))
2174-
}
2175-
}
2176-
}
2177-
21782104
public extension ChatChannel {
21792105
func lastReadMessageId(userId: UserId) -> MessageId? {
21802106
guard let currentUserRead = reads.first(where: {

Sources/StreamChat/Controllers/ChannelListController/ChannelListController.swift

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -189,15 +189,6 @@ public class ChatChannelListController: DataController, DelegateCallable, DataSt
189189
}
190190
}
191191

192-
@available(*, deprecated, message: "Please use `markAllRead` available in `CurrentChatUserController`")
193-
public func markAllRead(completion: (@MainActor(Error?) -> Void)? = nil) {
194-
worker.markAllRead { error in
195-
self.callback {
196-
completion?(error)
197-
}
198-
}
199-
}
200-
201192
// MARK: - Internal
202193

203194
func refreshLoadedChannels(completion: @escaping @Sendable(Result<Set<ChannelId>, Error>) -> Void) {

Sources/StreamChat/Controllers/CurrentUserController/CurrentUserController.swift

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -754,16 +754,3 @@ public extension CurrentChatUserController {
754754
set { multicastDelegate.set(mainDelegate: newValue) }
755755
}
756756
}
757-
758-
// MARK: - Deprecations
759-
760-
public extension CurrentChatUserController {
761-
@available(
762-
*,
763-
deprecated,
764-
message: "use addDevice(_pushDevice:) instead. This deprecated function doesn't correctly support multiple push providers."
765-
)
766-
func addDevice(token: Data, pushProvider: PushProvider = .apn, completion: (@Sendable(Error?) -> Void)? = nil) {
767-
addDevice(.apn(token: token), completion: completion)
768-
}
769-
}

0 commit comments

Comments
 (0)