SBUBaseChannelViewController
@objcMembers
open class SBUBaseChannelViewController : SBUBaseViewController, SBUBaseChannelViewModelDelegate, SBUBaseChannelModuleHeaderDelegate, SBUBaseChannelModuleListDelegate, SBUBaseChannelModuleListDataSource, SBUBaseChannelModuleInputDelegate, SBUBaseChannelModuleInputDataSource, SBUBaseChannelViewModelDataSource, UIGestureRecognizerDelegate, UIViewControllerTransitioningDelegate, PHPickerViewControllerDelegate, UIImagePickerControllerDelegate, UIDocumentPickerDelegate, UIDocumentInteractionControllerDelegate, SBUSelectablePhotoViewDelegate, SBUFileViewerDelegate, SBUCommonViewModelDelegate
Undocumented
-
Undocumented
Declaration
Swift
public var baseHeaderComponent: SBUBaseChannelModule.Header?
-
Undocumented
Declaration
Swift
public var baseListComponent: SBUBaseChannelModule.List?
-
Undocumented
Declaration
Swift
public var baseInputComponent: SBUBaseChannelModule.Input?
-
To decide whether to use right bar button item or not
Declaration
Swift
public var useRightBarButtonItem: Bool { get set }
-
Undocumented
Declaration
Swift
@SBUThemeWrapper public var theme: SBUChannelTheme { get set }
-
Undocumented
Declaration
Swift
public var baseViewModel: SBUBaseChannelViewModel?
-
Undocumented
Declaration
Swift
public var channelName: String?
-
Initiates view controller to enter a channel with its URL, message list params and a specific timestamp representing a starting potint.
See the example below for params generation.
let params = SBDMessageListParams() params.includeMetaArray = true params.includeReactions = true params.includeThreadInfo = true ...
Note
The
reverse
and thepreviousResultSize
properties in theSBDMessageListParams
are set in the UIKit. Even though you set that property it will be ignored.Since
2.1.0
Declaration
Swift
required public init( channelUrl: String, startingPoint: Int64 = .max, messageListParams: SBDMessageListParams? = nil )
Parameters
channelUrl
Channel’s URL
startingPoint
A starting point timestamp to start the message list from. The default value is
Int64.max
messageListParams
SBDMessageListParams
object to be used when loading messages. -
Undocumented
Declaration
Swift
open override func loadView()
-
Undocumented
Declaration
Swift
open override func viewWillAppear(_ animated: Bool)
-
Undocumented
Declaration
Swift
open override func viewDidLoad()
-
Undocumented
Declaration
Swift
open override func viewWillDisappear(_ animated: Bool)
-
Undocumented
Declaration
Swift
open override var preferredStatusBarStyle: UIStatusBarStyle { get }
-
Creates the view model, loading initial messages from given starting point.
Note
If you want to customize the viewModel, override this functionSince
3.0.0Declaration
Swift
open func createViewModel( channel: SBDBaseChannel? = nil, channelUrl: String? = nil, messageListParams: SBDMessageListParams? = nil, startingPoint: Int64? = Int64.max, showIndicator: Bool = true )
Parameters
startingPoint
The starting point timestamp of the messages.
nil
to start from the latest.showIndicator
Whether to show loading indicator on loading the initial messages.
-
Sets up views including module components.
Important
When you override this method, please call
super.setupViews
afterconfigure
method of the component. e.g.override func setupViews() { self.baseHeaderComponent = SBUModuleSet.groupChannelModule.headerComponent() self.baseHeaderComponent?.configure(delegate: self, theme: self.theme) super.setupViews() }
Declaration
Swift
open override func setupViews()
-
Declaration
Swift
open override func setupStyles()
-
Setups scrollBottom view style.
Declaration
Swift
public func setupScrollBottomViewStyle( scrollBottomView: UIView, theme: SBUComponentTheme = SBUTheme.componentTheme )
Parameters
scrollBottomView
Scroll bottom view
theme
theme for setup
-
Updates channelTitle with channel and channelName
Since
3.0.0Declaration
Swift
public func updateChannelTitle()
-
Updates channelStatus with channel
Since
3.0.0Declaration
Swift
public func updateChannelStatus()
-
This function shows cell’s menu.
This is used when the reaction feature is activated. This function configures the menu items using the
message
object.Since
3.0.0Declaration
Swift
public func showMenuViewController(_ cell: UITableViewCell, message: SBDBaseMessage)
Parameters
cell
Message cell
message
Message object
-
This function shows cell’s menu. This is used when the reaction feature is activated.
Since
1.2.5Declaration
Swift
public func showMenuViewController( _ cell: UITableViewCell, message: SBDBaseMessage, types: [MessageMenuItem]? )
Parameters
cell
Message cell
message
Message object
types
Type array of menu items to use
-
This function shows cell’s menu.
This is used when the reaction feature is inactivated. This function configures the menu items using the
message
object.Since
3.0.0Declaration
Swift
public func showMenuModal( _ cell: UITableViewCell, indexPath: IndexPath, message: SBDBaseMessage )
Parameters
cell
Message cell
indexPath
IndexPath
message
Message object
-
This function shows cell’s menu. This is used when the reaction feature is inactivated.
Since
1.2.5Declaration
Swift
public func showMenuModal( _ cell: UITableViewCell, indexPath: IndexPath, message: SBDBaseMessage, types: [MessageMenuItem]? )
Parameters
cell
Message cell
indexPath
IndexPath
message
Message object
types
Type array of menu items to use
-
This function shows cell’s menu: retry, delete, cancel.
This is used when selected failed message.
Since
2.1.12Declaration
Swift
public func showFailedMessageMenu(message: SBDBaseMessage)
Parameters
message
Message object
-
This function shows delete message alert.
Since
3.0.0Declaration
Swift
public func showDeleteMessageMenu(message: SBDBaseMessage, oneTimetheme: SBUComponentTheme? = nil)
Parameters
message
message object to delete
oneTimetheme
One-time theme
-
Shows channel settings view controller such as
SBUChannelSettingsViewController
Declaration
Swift
open func showChannelSettings()
-
This function presents
SBUEmojiListViewController
Since
1.1.0Declaration
Swift
open func showEmojiListModal(message: SBDBaseMessage)
Parameters
message
SBDBaseMessage
object -
This function creates message menu items with cell and message.
Declaration
Swift
public func createMessageMenuTypes(_ cell: UITableViewCell, message: SBDBaseMessage) -> [MessageMenuItem]?
Parameters
cell
Sendbird’s messageCell object
message
SBDBaseMessage
objectReturn Value
message menu type array
-
This function updates new message info view’s hidden status.
Since
3.0.0Declaration
Swift
public func updateNewMessageInfo(hidden: Bool)
Parameters
hidden
hidden status
-
This function opens a file according to the file type.
Since
3.0.0Declaration
Swift
open func openFile(fileMessage: SBDFileMessage)
Parameters
fileMessage
fileMessage object
-
This function increases the new message count.
Declaration
Swift
@discardableResult public func increaseNewMessageCount() -> Bool
-
Undocumented
Declaration
Swift
open func setMessageInputViewMode(_ mode: SBUMessageInputMode, message: SBDBaseMessage? = nil)
-
If an error occurs in viewController, a message is sent through here. If necessary, override to handle errors.
Declaration
Swift
open override func errorHandler(_ message: String?, _ code: NSInteger? = nil)
Parameters
message
error message
code
error code
-
Declaration
Swift
open func baseChannelViewModel( _ viewModel: SBUBaseChannelViewModel, didChangeChannel channel: SBDBaseChannel?, withContext context: SBDMessageContext )
-
Declaration
Swift
open func baseChannelViewModel( _ viewModel: SBUBaseChannelViewModel, didReceiveNewMessage message: SBDBaseMessage, forChannel channel: SBDBaseChannel )
-
Declaration
Swift
open func baseChannelViewModel( _ viewModel: SBUBaseChannelViewModel, shouldFinishEditModeForChannel channel: SBDBaseChannel )
-
Declaration
Swift
open func baseChannelViewModel( _ viewModel: SBUBaseChannelViewModel, shouldDismissForChannel channel: SBDBaseChannel? )
-
Declaration
Swift
open func baseChannelViewModel( _ viewModel: SBUBaseChannelViewModel, didChangeMessageList messages: [SBDBaseMessage], needsToReload: Bool, initialLoad: Bool )
-
Declaration
Swift
open func baseChannelViewModel( _ viewModel: SBUBaseChannelViewModel, shouldUpdateScrollInMessageList messages: [SBDBaseMessage], forContext context: SBDMessageContext?, keepsScroll: Bool )
-
Declaration
Swift
open func baseChannelViewModel( _ viewModel: SBUBaseChannelViewModel, didUpdateReaction reaction: SBDReactionEvent, forMessage message: SBDBaseMessage )
-
Declaration
Swift
open func baseChannelModule(_ headerComponent: SBUBaseChannelModule.Header, didUpdateTitleView titleView: UIView?)
-
Declaration
Swift
open func baseChannelModule(_ headerComponent: SBUBaseChannelModule.Header, didUpdateLeftItem leftItem: UIBarButtonItem?)
-
Declaration
Swift
open func baseChannelModule(_ headerComponent: SBUBaseChannelModule.Header, didUpdateRightItem rightItem: UIBarButtonItem?)
-
Declaration
Swift
open func baseChannelModule(_ headerComponent: SBUBaseChannelModule.Header, didTapLeftItem leftItem: UIBarButtonItem)
-
Declaration
Swift
open func baseChannelModule(_ headerComponent: SBUBaseChannelModule.Header, didTapRightItem rightItem: UIBarButtonItem)
-
Declaration
Swift
open func baseChannelModule(_ listComponent: SBUBaseChannelModule.List, willDisplay cell: UITableViewCell, forRowAt indexPath: IndexPath)
-
Declaration
Swift
open func baseChannelModule(_ listComponent: SBUBaseChannelModule.List, didTapMessage message: SBDBaseMessage, forRowAt indexPath: IndexPath)
-
Declaration
Swift
open func baseChannelModule(_ listComponent: SBUBaseChannelModule.List, didLongTapMessage message: SBDBaseMessage, forRowAt indexPath: IndexPath)
-
Declaration
Swift
open func baseChannelModule(_ listComponent: SBUBaseChannelModule.List, didTapUserProfile user: SBUUser)
-
Declaration
Swift
open func baseChannelModule(_ listComponent: SBUBaseChannelModule.List, didScroll scrollView: UIScrollView)
-
Declaration
Swift
open func baseChannelModuleDidTapScrollToButton(_ listComponent: SBUBaseChannelModule.List, animated: Bool)
-
Declaration
Swift
open func baseChannelModuleDidSelectRetry(_ listComponent: SBUBaseChannelModule.List)
-
Declaration
Swift
open func baseChannelModule( _ listComponent: SBUBaseChannelModule.List, channelForTableView tableView: UITableView ) -> SBDBaseChannel?
-
Declaration
Swift
open func baseChannelModule( _ listComponent: SBUBaseChannelModule.List, sentMessagesInTableView tableView: UITableView ) -> [SBDBaseMessage]
-
Declaration
Swift
open func baseChannelModule( _ listComponent: SBUBaseChannelModule.List, fullMessagesInTableView tableView: UITableView ) -> [SBDBaseMessage]
-
Declaration
Swift
open func baseChannelModule( _ listComponent: SBUBaseChannelModule.List, hasNextInTableView tableView: UITableView ) -> Bool
-
Declaration
Swift
open func baseChannelModule( _ listComponent: SBUBaseChannelModule.List, lastSeenIndexPathIn tableView: UITableView ) -> IndexPath?
-
Declaration
Swift
open func baseChannelModule( _ listComponent: SBUBaseChannelModule.List, startingPointIn tableView: UITableView ) -> Int64?
-
Declaration
Swift
open func baseChannelModule(_ inputComponent: SBUBaseChannelModule.Input, didUpdateFrozenState isFrozen: Bool)
-
Declaration
Swift
open func baseChannelModuleDidStartTyping(_ inputComponent: SBUBaseChannelModule.Input)
-
Declaration
Swift
open func baseChannelModuleDidEndTyping(_ inputComponent: SBUBaseChannelModule.Input)
-
Declaration
Swift
open func baseChannelModule(_ inputComponent: SBUBaseChannelModule.Input, didTapSend text: String, parentMessage: SBDBaseMessage?)
-
Declaration
Swift
open func baseChannelModule(_ inputComponent: SBUBaseChannelModule.Input, didTapResource type: MediaResourceType)
-
Presents
UIDocumentPickerViewController
.Since
2.2.3Declaration
Swift
open func showDocumentPicker()
-
Undocumented
Declaration
Swift
open func showLimitedPhotoLibraryPicker()
-
Presents
UIImagePickerController
. IfSBUGlobals.UsingPHPicker
istrue
, it presentsPHPickerViewController
in iOS 14 or later.Note
If you want to use customizedPHPickerConfiguration
, please override this method.Since
2.2.3Declaration
Swift
open func showPhotoLibraryPicker()
-
Presents
UIImagePickerController
for using camera.Since
2.2.3Declaration
Swift
open func showCamera()
-
Since
3.0.0Declaration
Swift
open func showPermissionAlert()
-
Declaration
Swift
open func baseChannelModule(_ inputComponent: SBUBaseChannelModule.Input, didTapEdit text: String)
-
Declaration
Swift
open func baseChannelModule(_ inputComponent: SBUBaseChannelModule.Input, didChangeText text: String)
-
Declaration
Swift
open func baseChannelModule(_ inputComponent: SBUBaseChannelModule.Input, willChangeMode mode: SBUMessageInputMode, message: SBDBaseMessage?)
-
Declaration
Swift
open func baseChannelModule(_ inputComponent: SBUBaseChannelModule.Input, didChangeMode mode: SBUMessageInputMode, message: SBDBaseMessage?)
-
Declaration
Swift
open func baseChannelModule(_ inputComponent: SBUBaseChannelModule.Input, channelForInputView messageInputView: UIView?) -> SBDBaseChannel?
-
Declaration
Swift
open func baseChannelViewModel(_ viewModel: SBUBaseChannelViewModel, isScrollNearBottomInChannel channel: SBDBaseChannel?) -> Bool
-
Undocumented
Declaration
Swift
open func gestureRecognizer(_ gestureRecognizer: UIGestureRecognizer, shouldRecognizeSimultaneouslyWith otherGestureRecognizer: UIGestureRecognizer) -> Bool
-
Undocumented
Declaration
Swift
open func presentationController(forPresented presented: UIViewController, presenting: UIViewController?, source: UIViewController) -> UIPresentationController?
-
Undocumented
Declaration
Swift
open func imagePickerController( _ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [UIImagePickerController.InfoKey : Any])
-
Undocumented
Declaration
Swift
open func imagePickerControllerDidCancel(_ picker: UIImagePickerController)
-
Override this method to handle the
results
fromPHPickerViewController
. As defaults, it doesn’t support multi-selection and live photo.Important
To use this method, please assign self as delegate toPHPickerViewController
object.Declaration
Swift
@available(iOS 14, *) open func picker(_ picker: PHPickerViewController, didFinishPicking results: [PHPickerResult])
-
Undocumented
Declaration
Swift
open func documentPicker(_ controller: UIDocumentPickerViewController, didPickDocumentsAt urls: [URL])
-
Undocumented
Declaration
Swift
open func documentInteractionControllerViewControllerForPreview(_ controller: UIDocumentInteractionController) -> UIViewController
-
Called when the image is picked from
SBUSelectablePhotoViewController
.Declaration
Swift
open func didTapSendImageData(_ data: Data)
Parameters
data
The image data.
-
Called when the video is picked from
SBUSelectablePhotoViewController
Declaration
Swift
open func didTapSendVideoURL(_ url: URL)
Parameters
url
The URL of the video
-
Undocumented
Declaration
Swift
open func didSelectDeleteImage(message: SBDFileMessage)
-
Undocumented
Declaration
Swift
open func shouldUpdateLoadingState(_ isLoading: Bool)
-
Undocumented
Declaration
Swift
open func didReceiveError(_ error: SBDError?, isBlocker: Bool)
-
Undocumented
Declaration
Swift
public var titleView: UIView? { get set }
-
Undocumented
Declaration
Swift
public var leftBarButton: UIBarButtonItem? { get set }
-
Undocumented
Declaration
Swift
public var rightBarButton: UIBarButtonItem? { get set }
-
Undocumented
Declaration
Swift
public var messageInputView: SBUMessageInputView? { get set }
-
Undocumented
Declaration
Swift
public var tableView: UITableView { get set }
-
Undocumented
Declaration
Swift
public var channelStateBanner: UIView? { get set }
-
Undocumented
Declaration
Swift
public var emptyView: UIView? { get set }
-
Undocumented
Declaration
Swift
public var newMessageInfoView: UIView? { get set }
-
Undocumented
Declaration
Swift
public var scrollBottomView: UIView? { get set }
-
Undocumented
Declaration
Swift
public var userProfileView: UIView? { get set }
-
Undocumented
Declaration
Swift
public func reloadTableView()
-
Undocumented
Declaration
Swift
public func setEditMode(for userMessage: SBDUserMessage?)
-
This is used to messageInputView state update.
Declaration
Swift
@available(*, deprecated, renamed: "inputComponent.updateMessageInputModeState(﹚", message: "This function has been moved to `SBDBaseChannelModule.List`.") public func updateMessageInputModeState()
-
Undocumented
Declaration
Swift
@objc public var channel: SBDBaseChannel? { get }
-
Undocumented
Declaration
Swift
public var channelUrl: String? { get }
-
Undocumented
Declaration
Swift
public var startingPoint: Int64? { get }
-
Undocumented
Declaration
Swift
public var inEditingMessage: SBDUserMessage? { get }
-
Undocumented
Declaration
Swift
public var messageListParams: SBDMessageListParams { get }
-
Undocumented
Declaration
Swift
public var customizedMessageListParams: SBDMessageListParams? { get }
-
Undocumented
Declaration
Swift
public var messageList: [SBDBaseMessage] { get }
-
Undocumented
Declaration
Swift
public var fullMessageList: [SBDBaseMessage] { get }
-
This function is used to load channel information.
Declaration
Swift
@available(*, deprecated, renamed: "viewModel.loadChannel(channelUrl:messageListParams:﹚", message: "This function has been moved to `SBUBaseChannelViewModel`.") public func loadChannel(channelUrl: String, messageListParams: SBDMessageListParams? = nil)
Parameters
channelUrl
channel url
messageListParams
(Optional) The parameter to be used when getting channel information.
-
This function clears current message lists
Since
2.1.0Declaration
Swift
@available(*, deprecated, renamed: "viewModel.clearMessageList(﹚", message: "This function has been moved to `SBUBaseChannelViewModel`.") public func clearMessageList()
-
Undocumented
Declaration
Swift
public func setReaction(message: SBDBaseMessage, emojiKey: String, didSelect: Bool)
-
Undocumented
Declaration
Swift
public func updateMessagesInList(messages: [SBDBaseMessage]?, needReload: Bool)
-
Undocumented
Declaration
Swift
public func upsertMessagesInList(messages: [SBDBaseMessage]?, needUpdateNewMessage: Bool = false, needReload: Bool)
-
Undocumented
Declaration
Swift
public func deleteMessagesInList(messageIds: [Int64]?, needReload: Bool)
-
Undocumented
Declaration
Swift
public func deleteMessagesInList(messageIds: [Int64]?, excludeResendableMessages: Bool, needReload: Bool)
-
Undocumented
Declaration
Swift
public func deleteResendableMessage(_ message: SBDBaseMessage, needReload: Bool)
-
Undocumented
Declaration
Swift
public func deleteResendableMessages(requestIds: [String], needReload: Bool)
-
Undocumented
Declaration
Swift
public func sortAllMessageList(needReload: Bool)
-
Undocumented
Declaration
Swift
open func sendUserMessage(text: String)
-
Undocumented
Declaration
Swift
open func sendUserMessage(text: String, parentMessage: SBDBaseMessage? = nil)
-
Undocumented
Declaration
Swift
open func sendUserMessage(messageParams: SBDUserMessageParams, parentMessage: SBDBaseMessage? = nil)
-
Undocumented
Declaration
Swift
open func sendFileMessage(fileData: Data?, fileName: String, mimeType: String)
-
Undocumented
Declaration
Swift
open func sendFileMessage(fileData: Data?, fileName: String, mimeType: String, parentMessage: SBDBaseMessage? = nil)
-
Undocumented
Declaration
Swift
open func sendFileMessage(messageParams: SBDFileMessageParams, parentMessage: SBDBaseMessage? = nil)
-
Undocumented
Declaration
Swift
public func updateUserMessage(message: SBDUserMessage, text: String)
-
Undocumented
Declaration
Swift
public func updateUserMessage(message: SBDUserMessage, messageParams: SBDUserMessageParams)
-
Undocumented
Declaration
Swift
public func resendMessage(failedMessage: SBDBaseMessage)
-
Deletes a message with message object.
Since
1.0.9Declaration
Swift
@available(*, deprecated, renamed: "showDeleteMessageMenu(message:﹚") public func deleteMessage(message: SBDBaseMessage)
Parameters
message
SBDBaseMessage
based class object
-
Undocumented
Declaration
Swift
public func checkSameDayAsNextMessage(currentIndex: Int) -> Bool
-
Undocumented
Declaration
Swift
public func onClickSetting()
-
Undocumented
Declaration
Swift
public func setScrollBottomView(hidden: Bool?)
-
This function scrolls to bottom.
Declaration
Swift
@available(*, deprecated, renamed: "baseChannelModuleDidTapScrollToButton(_:animated:﹚", message: "This function has been moved to `SBUBaseChannelModuleListDelegate`.") public func scrollToBottom(animated: Bool)
Parameters
animated
Animated
-
This function registers keyboard notifications.
Since
3.0.0Declaration
Swift
public func registerKeyboardNotifications()
-
This functions adds the hide keyboard gesture in tableView.
Since
1.2.5Declaration
Swift
public func addGestureHideKeyboard()
-
This function changes the messageInputView bottom constraint using keyboard height.
Since
1.2.5Declaration
Swift
@objc public func keyboardWillShow(_ notification: Notification)
Parameters
notification
Notification object with keyboardFrame information
-
This function changes the messageInputView bottom constraint using keyboard height.
Since
1.2.5Declaration
Swift
@objc public func keyboardWillHide(_ notification: Notification)
Parameters
notification
Notification object with keyboardFrame information
-
This function dismisses the keyboard.
Since
1.2.5Declaration
Swift
@objc public func dismissKeyboard()