Delegates
ChannelPluginDelegate
is a protocol that one can implement to get called delegate methods.
onChangeBadge
Notify when badge count (unread count for a guest) has been changed
parameter | type | description |
---|---|---|
count | Int | represents current badge count |
public class MyApp : ChannelPluginDelegate {
//set ChannelIO.delegate = self somewhere
func onChangeBadge(count: Int) {
//do something with count
}
}
@interface MyApp : UIViewController <ChannelPluginDelegate>
@end
@implementation MyApp
//set ChannelIO.delegate = self somewhere
- (void)onChangeBadgeWithCount:(NSInteger)count {
// do something with count
}
@end
onChangeProfile
Notify when a guest profile has been changed. The parameter provides both profile key and its value. This method can be used when you want to sync updated guest data into your database.
parameter | type | description |
---|---|---|
key | String | a profile key |
key | Any? | a profile value |
public class MyApp : ChannelDelegate {
//set ChannelIO.delegate = self somewhere
func onChangeProfile(key: String, value: Any?) {
// sync your database with key and value
}
}
@interface MyApp : UIViewController <ChannelDelegate>
@end
@implementation MyApp
//set ChannelIO.delegate = self somewhere
- (void)onChangeProfileWithKey:(NSString *)key value:(id)value {
// sync your database with key and value
}
@end
onClickChatLink
Notify when a link within a message is clicked. Return true if you want to handle an URL, otherwise false for default behavior. If this delegate method is not implemented or return false, ChannelIO treats it as a normal URL link and attempts to open in Safari.
parameter | type | description |
---|---|---|
url | URL | a url that has been clicked |
public class MyApp : ChannelDelegate {
//set ChannelIO.delegate = self somewhere
func onClickChatLink(url: URL) -> Bool {
// do something with url
return false
}
}
@interface MyApp : UIViewController <ChannelDelegate>
@end
@implementation MyApp
//set ChannelIO.delegate = self somewhere
- (BOOL)onClickChatLinkWithUrl:(NSURL *url) {
// do something with url
return NO;
}
@end
onReceivePush
Notify when a guest gets notification from Channel. Parameter event
contains the necessary information to display in-app push view. This method is useful when you want to customize the in-app push view.
parameter | type | description |
---|---|---|
userChat | PushEvent | a object that contains push information |
public class MyApp : ChannelPluginDelegate {
//set ChannelPlugin.delegate = self somewhere
func onReceivePush(with event: PushEvent) {
}
}
@interface MyApp : UIViewController <ChannelPluginDelegate>
@end
@implementation MyApp
//set ChannelIO.delegate = self somewhere
- (void)onRecivePushWithPushEvent:(PushEvent *)event {
}
@end
willShowMessenger
Notify when channel plugin's user chat list is about to show in the view.
public class MyApp : ChannelPluginDelegate {
//set ChannelIO.delegate = self somewhere
func willShowMessenger() {
}
}
@interface MyApp : UIViewController <ChannelPluginDelegate>
@end
@implementation MyApp
//set ChannelIO.delegate = self somewhere
- (BOOL)willShowMessenger {
}
@end
willHideMessenger
Notify when channel plugin's user chat list is about to hide from the view.
public class MyApp : ChannelPluginDelegate {
//set ChannelPlugin.delegate = self somewhere
func willHideMessenger() {
}
}
@interface MyApp : UIViewController <ChannelPluginDelegate>
@end
@implementation MyApp
//set ChannelPlugin.delegate = self somewhere
- (BOOL)willHideMessenger {
}
@end
Updated 4 months ago