Skip to content

Commit

Permalink
Merge pull request #196 from sendbird/luke/xcode-14
Browse files Browse the repository at this point in the history
Update for Xcode 14.1+
  • Loading branch information
luke-cha authored Apr 21, 2023
2 parents f58e10e + 9ff973d commit e537540
Show file tree
Hide file tree
Showing 15 changed files with 32 additions and 26 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
.AppleDouble
.LSOverride

# AppCode
.idea

# Icon must end with two
Icon

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ final class DeleteMessageUseCase {
}

private func subscribeToDeleteMessageDelegate() {
SendbirdChat.add(self, identifier: "[DELETE_MESSAGE_DELEGATE]")
SendbirdChat.addChannelDelegate(self, identifier: "[DELETE_MESSAGE_DELEGATE]")
}

func deleteMessage(_ message: BaseMessage, completion: @escaping (Result<Void, SBError>) -> Void) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class MarkAsReadUseCase: GroupChannelDelegate {
}

private func subscribeToGroupChannelDelegate() {
SendbirdChat.add(self, identifier: String(describing: self))
SendbirdChat.addChannelDelegate(self, identifier: String(describing: self))
}

func markAsRead() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class MentionedUserMessageCell: BasicMessageCell {
) {
configure(with: message)
let userNames: [String] = message.mentionedUsers.map {
$0.nickname ?? $0.userId
$0.nickname
}
usersLabel.text = userNames.joined(separator: ",")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class MentionedUserMessageCell: BasicMessageCell {
) {
configure(with: message)
let userNames: [String] = message.mentionedUsers.map {
$0.nickname ?? $0.userId
$0.nickname
}
usersLabel.text = userNames.joined(separator: ",")
}
Expand Down
2 changes: 1 addition & 1 deletion Apps/PollsGroupChannel/Sources/Poll/TimePicker.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ extension UIAlertController{
addAction(UIAlertAction(title: "Done", style: .cancel, handler: { action in
onDateSelected(datePicker.date)
}))
let height: NSLayoutConstraint = NSLayoutConstraint(item: view, attribute: .height, relatedBy: .equal, toItem: nil, attribute: .notAnAttribute, multiplier: 1.1, constant: 300)
let height: NSLayoutConstraint = NSLayoutConstraint(item: view!, attribute: .height, relatedBy: .equal, toItem: nil, attribute: .notAnAttribute, multiplier: 1.1, constant: 300)
view.addConstraint(height)

datePicker.translatesAutoresizingMaskIntoConstraints = false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class PushNotificationUseCase {
})
}
else {
SendbirdChat.unregisterPushToken(pushToken, completionHandler: { (response, error) in
SendbirdChat.unregisterPushToken(pushToken, completionHandler: { error in
guard error == nil else {
// Handle error.
return
Expand All @@ -52,13 +52,12 @@ class PushNotificationUseCase {
}

func unRegisterAllDevices() {
SendbirdChat.unregisterAllPushToken(completionHandler: { (response, error) in
SendbirdChat.unregisterAllPushToken(completionHandler: { error in
guard error == nil else {
// Handle error.
return
}
})

}

}
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class PushNotificationUseCase {
})
}
else {
SendbirdChat.unregisterPushToken(pushToken, completionHandler: { (response, error) in
SendbirdChat.unregisterPushToken(pushToken, completionHandler: { error in
guard error == nil else {
// Handle error.
return
Expand All @@ -52,7 +52,7 @@ class PushNotificationUseCase {
}

func unRegisterAllDevices() {
SendbirdChat.unregisterAllPushToken(completionHandler: { (response, error) in
SendbirdChat.unregisterAllPushToken(completionHandler: { error in
guard error == nil else {
// Handle error.
return
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ extension UIAlertController{
addAction(UIAlertAction(title: "Done", style: .cancel, handler: { action in
onDateSelected(datePicker.date)
}))
let height: NSLayoutConstraint = NSLayoutConstraint(item: view, attribute: .height, relatedBy: .equal, toItem: nil, attribute: .notAnAttribute, multiplier: 1.1, constant: 300)
let height: NSLayoutConstraint = NSLayoutConstraint(item: view!, attribute: .height, relatedBy: .equal, toItem: nil, attribute: .notAnAttribute, multiplier: 1.1, constant: 300)
view.addConstraint(height)

datePicker.translatesAutoresizingMaskIntoConstraints = false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ final class GroupChannelTypingIndicatorUseCase: GroupChannelDelegate {
}

private func subscribeToTypingIndicatorDelegate() {
SendbirdChat.add(self, identifier: "[TYPING_INDICATOR_DELEGATE]")
SendbirdChat.addChannelDelegate(self, identifier: "[TYPING_INDICATOR_DELEGATE]")
}

func startTyping() {
Expand Down Expand Up @@ -72,6 +72,6 @@ final class GroupChannelTypingIndicatorUseCase: GroupChannelDelegate {
}

private func getUsername(user: User) -> String {
return user.nickname ?? user.userId
return user.nickname
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class PushNotificationUseCase {
})
}
else {
SendbirdChat.unregisterPushToken(pushToken, completionHandler: { (response, error) in
SendbirdChat.unregisterPushToken(pushToken, completionHandler: { error in
guard error == nil else {
// Handle error.
return
Expand All @@ -52,7 +52,7 @@ class PushNotificationUseCase {
}

func unRegisterAllDevices() {
SendbirdChat.unregisterAllPushToken(completionHandler: { (response, error) in
SendbirdChat.unregisterAllPushToken(completionHandler: { error in
guard error == nil else {
// Handle error.
return
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class iOSTrueUseCase: NSObject {
init(channel: GroupChannel?) {
self.channel = channel
super.init()
SendbirdChat.add(self as ConnectionDelegate, identifier: "[CONNECTION_DELEGATE]")
SendbirdChat.addConnectionDelegate(self as ConnectionDelegate, identifier: "[CONNECTION_DELEGATE]")
}

func checkUserConnectionStatus() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,13 @@ open class GroupChannelUserSelectionUseCase {
open func reloadUsers() {
userListQuery = createApplicationUserListQuery()

guard let userListQuery = userListQuery, userListQuery.hasNext else { return }

guard let userListQuery = userListQuery,
userListQuery.hasNext,
userListQuery.isLoading == false else { return }

userListQuery.loadNextPage { [weak self] users, error in
guard let self = self else { return }

if let error = error {
self.delegate?.userSelectionUseCase(self, didReceiveError: error)
return
Expand All @@ -53,11 +55,13 @@ open class GroupChannelUserSelectionUseCase {
}

open func loadNextPage() {
guard let userListQuery = userListQuery, userListQuery.hasNext else { return }

guard let userListQuery = userListQuery,
userListQuery.hasNext,
userListQuery.isLoading == false else { return }

userListQuery.loadNextPage { [weak self] users, error in
guard let self = self else { return }

if let error = error {
self.delegate?.userSelectionUseCase(self, didReceiveError: error)
return
Expand Down
6 changes: 3 additions & 3 deletions Modules/CommonModule/Sources/Util/UIColor+Extension.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ public extension UIColor {
let hexString: String = hexString.trimmingCharacters(in: CharacterSet.whitespacesAndNewlines)
let scanner = Scanner(string: hexString)
if (hexString.hasPrefix("#")) {
scanner.scanLocation = 1
scanner.currentIndex = hexString.index(after: hexString.startIndex)
}
var color: UInt32 = 0
scanner.scanHexInt32(&color)
var color: UInt64 = 0
scanner.scanHexInt64(&color)
let mask = 0x000000FF
let r = Int(color >> 16) & mask
let g = Int(color >> 8) & mask
Expand Down
2 changes: 1 addition & 1 deletion Tuist/Dependencies.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import ProjectDescription

let dependencies = Dependencies(
swiftPackageManager: [
.remote(url: "https://github.com/sendbird/sendbird-chat-sdk-ios", requirement: .upToNextMinor(from: "4.2.1")),
.remote(url: "https://github.com/sendbird/sendbird-chat-sdk-ios", requirement: .upToNextMinor(from: "4.6.3")),
.remote(url: "https://github.com/onevcat/Kingfisher", requirement: .upToNextMinor(from: "7.2.0")),
],
platforms: [.iOS]
Expand Down

0 comments on commit e537540

Please sign in to comment.