Listener / Delegate

This is a notifier for ChannelIO events.

This document tell you about listener / delegate's functions.

You can use this interface like this

ChannelIO.setListener(new ChannelPluginListener() {
  // code
});
ChannelIO.delegate = self
[ChannelIO setDelegate:self];

onShowMessenger

Called when messenger screen is appreared.
Generally called when user click channel button, call ChannelIO.showMessenger, ChannelIO.openChat

void onShowMessenger();
func onShowMessenger() {
}
- (void)onShowMessenger { 
}
ChannelIO.onShowMessenger(() => { });

onHideMessenger

Called when messenger screen is hidden.
Generally called when user click close button, call ChannelIO.hideMessenger, ChannelIO.sleep, ChannelIO.shutdown etc...

void onHideMessenger();
func onHideMessenger() {
}
- (void)onHideMessenger {
}
ChannelIO.onHideMessenger(() => { });

onChatCreated

Called when the user success creates a chat.

void onChatCreated(String chatId);
func onChatCreated(chatId: String) {
}
- (void)onChatCreatedWithChatId:(NSString *)chatId { 
}
ChannelIO.onChatCreated((chatId) => { });

onBadgeChanged

Called when badge count is changed.

Use initial badge count by BootCallback > User.alert

void onBadgeChanged(int count);
func onBadgeChanged(alert: Int) {
}
- (void)onBadgeChangedWithAlert:(NSInteger)alert { 
}
ChannelIO.onBadgeChanged((count) => { });

onFollowUpChanged

Called when followup contact changed by user interaction (follow up form, change in settings)
This method is not called by ChannelIO.updateUser

Map's values can be null

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

onUrlClicked

Called when user click url in chat, link buttons.
return true to block redirect by ChannelIO

boolean onUrlClicked(String url);

@Override
public boolean onUrlClicked(String url) {
  // SDK do not action when return true
  return true;
}
func onUrlClicked(url: URL) -> Bool {
	// SDK do not action when return true
	return true
}
- (BOOL)onUrlClickedWithUrl:(NSURL *)url {
  // SDK do not action when return true
  return YES;
}
let handleUrl = true;

ChannelIO.onUrlClicked((url, next) => {
	if (!handleUrl) {
		// Use this function if you want to open web view
		next();
	}
});

onPopupDataReceived

Called when popup data is received.
Generally called when manager talked, marketing message incomming.

See more about PopupData

void onPopupDataReceived(PopupData popupData)
func onPopupDataReceived(event: PopupData) {
}
- (void)onPopupDataReceivedWithEvent:(PopupData *)event {
}
ChannelIO.onPopupDataReceived((popupData) => { });

onPushNotificationClicked

Android

Called when user click push notification

@Override
public boolean onPushNotificationClicked(String chatId) {
  // SDK do not action when return true
  return true;
}