This page describes delegate of ChannelIO iOS SDK (hereafter referred to as SDK).

The delegate allows receiving event callbacks from the SDK. To do this, make sure that the delegate isn’t nil. An example is:

class ViewController: ChannelPlguinDelegate {

  override func viewDidLoad() {
    ...
    ChannelIO.delegate = self
    ...
  }
}
[ChannelIO setDelegate:self];

onShowMessenger

Invoked when the Messenger is shown. Examples are the following:

  • calls showMessenger
  • calls openChat
  • When the user opens messenger through Channel button
class ViewController: ChannelIOPluginDelegate {

  func onShowMessenger() {
   ...

  }
}
- (void)onShowMessenger { 
}

onHideMessenger

Invoked when the messenger is hidden. Examples are the following:

  • calls hideMessenger
  • calls sleep
  • calls shutdown
  • When the user closes messenger explicitly, such as by clicking the X button.
class ViewController: ChannelIOPluginDelegate {

  func onHideMessenger() {
   ...
  }
}
- (void)onHideMessenger {
}

onChatCreated

Invoked when SDK completes creating a new chat. Examples are the following:

  • Explicit creating chat by the user such as by click a new Chat button
  • calls openChat with chatId = nil
class ViewController: ChannelIOPluginDelegate {

  func onChatCreated(chatId: String) {
   ...
  }
}
- (void)onChatCreatedWithChatId:(NSString *)chatId { 
}

onBadgeChanged

Invoked when the count of the user’s badge is changed. Examples are the following:

  • boot
  • When user received the messages or marketing message
class ViewController: ChannelIOPluginDelegate {

  func onBadgeChanged(alert: Int) {
   ...
  }
}
- (void)onBadgeChangedWithAlert:(NSInteger)alert { 
}

onFollowUpChanged

Invoked when Followup information is changed by the user.
It is not called by ChannelIO.updateUser. Values in dictionaries are nullable.

class ViewController: ChannelIOPluginDelegate {

  func onFollowUpChanged(data: [String : Any]) {
   ...
  }
}
- (void)onFollowUpChangedWithData:(NSDictionary<NSString *,id> *)data {
}

onUrlClicked

Invoked when the user clicks a link in the chat or clicks the link button.
If this method returns true, URL redirection performed by the SDK will not work.

class ViewController: ChannelIOPluginDelegate {

  func onUrlClicked(url: URL) -> Bool {
   ...
  }
}
- (BOOL)onUrlClickedWithUrl:(NSURL *)url {
  // SDK do not action when return true
  return YES;
}

onPopupDataReceived

Invoked when receiving In-app message popup. Examples are the following:

  • receive the message from manager
  • receive marketing message

See the PopupData documentation for details on the events that are parameters of this function.

class ViewController: ChannelIOPluginDelegate {

  func onPopupDataReceived(event: PopupData) {
   ...
  }
}
- (void)onPopupDataReceivedWithEvent:(PopupData *)event {
}