The iOS SDK provides event delegates to listen to various events on the client app. Through these event delegates, TapTalk.io notifies the client app of events that happen on your app. You will need to register the delegate objects to receive event callbacks from TapTalk.io.
Listens to room list view controller lifecycle methods such as viewDidLoad, viewWillAppear, and many more.
TapTalkDelegate
General events such as notifications will be notified through TapTalkDelegate. A TapTalkDelegate instance is required when initializing TapTalk.
Note: Make sure to add #import <TapTalk/TapTalk.h> before registering the delegate
ViewController.m
//ViewController.m
#import <TapTalk/TapTalk.h>
//Add TapTalkDelegate declaration
@interface ViewController () <TapTalkDelegate>
@end
@implementation ViewController
- (void)function {
//Set TapTalk delegate to current
[[TapTalk sharedInstance] setDelegate:self];
}
#pragma mark - Delegate
#pragma mark TapTalk
- (void)tapTalkRefreshTokenExpired {
//Authentication is needed
}
- (void)tapTalkDidTappedNotificationWithMessage:(TAPMessageModel *_Nonnull)message fromActiveController:(nullable UIViewController *)currentActiveController {
//Handle tapped notification message
}
- (void)tapTalkUnreadChatRoomBadgeCountUpdated:(NSInteger)numberOfUnreadRooms {
// Returns number of unread messages from the application
}
- (void)tapTalkDidRequestRemoteNotification {
//Register for remote notification
[[UIApplication sharedApplication] registerForRemoteNotifications];
}
@end
Method Name
Invoked When
tapTalkRefreshTokenExpired
User's refresh token has expired. Authentication with a new auth ticket is required.
tapTalkUnreadChatRoomBadgeCountUpdated:
The number of unread messages in the application is updated. Returns the number of unread messages from the application.
Call method updateApplicationBadgeCount to update unread badge counter. You can see the function explanation in General section page.
tapTalkDidTappedNotificationWithMessage:
fromActiveController:
User tapped the notification.
tapTalkDidRequestRemoteNotification
TapTalk.io needs to request for push notification, usually client needs to add[UIApplication sharedApplication] registerForRemoteNotifications]inside the method.
TapUIRoomListDelegate
TapUIRoomListDelegate listens to UI-related events in Room List View when UI implementation type is used. You can register a TapUIRoomListDelegate instance in your application through the TapUI class as follows:
Note: Make sure to add #import <TapTalk/TapUI.h> before registering the delegate
ViewController.m
//ViewController.m
#import <TapTalk/TapUI.h>
//Add TapUIDelegate declaration
@interface ViewController () <TapUIRoomListDelegate>
@end
@implementation ViewController
- (void)function {
//Set TapUI delegate to current
[[TapUI sharedInstance] setRoomListDelegate:self];
}
#pragma mark - Delegates
#pragma mark TapUIRoomList
// Called when user click the profile button on the top right side of group chat room page.
- (void)tapTalkAccountButtonTapped:(UIViewController *)currentViewController
currentShownNavigationController:(UINavigationController *)currentNavigationController {
}
@end
Method Name
Invoked When
tapTalkAccountButtonTapped:
currentShownNavigationController:
My account button in top left room list view is tapped by active user.
tapTalkUnreadChatRoomBadgeCountUpdated:
TapUIChatRoomDelegate
TapUIChatRoomDelegate listens to UI-related events in Chat Room View when UI implementation type is used. You can register a TapUIChatRoomDelegate instance in your application through the TapUI class as follows:
Note: Make sure to add #import <TapTalk/TapUI.h> before registering the delegate
ViewController.m
//ViewController.m
#import <TapTalk/TapUI.h>
//Add TapUIDelegate declaration
@interface ViewController () <TapUIChatRoomDelegate>
@end
@implementation ViewController
- (void)function {
//Set TapUI delegate to current
[[TapUI sharedInstance] setChatRoomDelegate:self];
}
#pragma mark - Delegates
#pragma mark TapUIChatRoom
// Called when a chat room is opened.
- (void)tapTalkChatRoomDidOpen:(TAPRoomModel *)room
currentViewController:(UIViewController *)currentViewController
currentShownNavigationController:(UINavigationController *)currentNavigationController {
}
// Called when a chat room is closed.
- (void)tapTalkChatRoomDidClose:(TAPRoomModel *)room
currentViewController:(UIViewController *)currentViewController
currentShownNavigationController:(UINavigationController *)currentNavigationController {
}
// Called when active user sends any message to a chat room.
- (void)tapTalkActiveUserDidSendMessage:(TAPMessageModel *)message
room:(TAPRoomModel *)room
currentViewController:(UIViewController *)currentViewController
currentShownNavigationController:(UINavigationController *)currentNavigationController {
}
// Called when user click the profile button on the top right side of the personal chat room view.
- (void)tapTalkChatRoomProfileButtonTapped:(UIViewController *)currentViewController
otherUser:(TAPUserModel *)otherUser
room:(TAPRoomModel *)room
currentShownNavigationController:(UINavigationController *)currentNavigationController {
}
// Called when user click the profile button on the top right side of the group chat room view.
- (void)tapTalkGroupChatRoomProfileButtonTapped:(UIViewController *)currentViewController
room:(TAPRoomModel *)room
currentShownNavigationController:(UINavigationController *)currentNavigationController {
}
// Called when user click the profile button on user in group.
- (void)tapTalkGroupMemberAvatarTappedWithRoom:(TAPRoomModel *)room
user:(TAPUserModel *)user
currentShownNavigationController:(UINavigationController *)currentNavigationController {
}
// Called when user click mention in the bubble chat.
- (void)tapTalkUserMentionTappedWithRoom:(TAPRoomModel *)room
mentionedUser:(TAPUserModel *)mentionedUser
isRoomParticipant:(BOOL)isRoomParticipant
message:(TAPMessageModel *)message
currentViewController:(UIViewController *)currentViewController
currentShownNavigationController:(UINavigationController *)currentNavigationController {
}
// Called when user click the quote view that appears in the chat bubble.
- (void)tapTalkMessageQuoteTappedWithUserInfo:(NSDictionary *)userInfo {
}
@end
Method Name
Invoked When
tapTalkChatRoomDidOpen:
A chat room is opened. Returns the opened room, current shown view controller, and current shown navigation controller.
tapTalkChatRoomDidClose:
A chat room is closed. Returns the closed room, current shown view controller, and current shown navigation controller.
tapTalkActiveUserDidSendMessage:
Active user sends any message to a chat room. Message may not yet be delivered to the room when this happens. Returned message is temporary and the values will be updated through socket once the message is delivered.
tapTalkChatRoomProfileButtonTapped:
My account button in top left room list view is tapped by active user.
tapTalkUnreadChatRoomBadgeCountUpdated:
tapTalkGroupChatRoomProfileButtonTapped:
Profile button in a group chat room is tapped by active user. Returns the current shown navigation controller.
tapTalkGroupMemberAvatarTappedWithRoom:
A group member's profile picture on a message bubble in group chat room is tapped by active user. Returns the current shown navigation controller.
tapTalkUserMentionTappedWithRoom:
mentionedUser:
isRoomParticipant:
message:
currentViewController:
currentShownNavigationController:
Mention in bubble chat is tapped by active user. Returns current room, mentioned user data, boolean indicating the user is in group participant or not, message data, current shown view controller, and current shown navigation controller.
tapTalkMessageQuoteTappedWithUserInfo:
A quote inside a message bubble in a chat room is tapped by active user. Returns tapped message, and userInfo.
UserInfo is a dictionary object embedded inside a message containing data specified by client, and is generally null when not specified.
TapUIChatProfileDelegate
TapUIChatProfileDelegate listens to UI-related events in Chat Profile View when UI implementation type is used. You can register a TapUIChatProfileDelegate instance in your application through the TapUI class as follows:
Note: Make sure to add #import <TapTalk/TapUI.h> before registering the delegate
ViewController.m
//ViewController.m
#import <TapTalk/TapUI.h>
//Add TapUIDelegate declaration
@interface ViewController () <TapUIChatProfileDelegate>
@end
@implementation ViewController
- (void)function {
//Set TapUI delegate to current
[[TapUI sharedInstance] setChatProfileDelegate:self];
}
#pragma mark - Delegates
#pragma mark TapUIChatProfileDelegate
// Called when user tapped Report User button in user profile
- (void)reportUserButtonDidTapped:(UIViewController *)currentViewController
room:(TAPRoomModel *)room
user:(TAPUserModel *)reportedUser {
}
// Called when user tapped Report Group button in group profile
- (void)reportGroupButtonDidTapped:(UIViewController *)currentViewController
room:(TAPRoomModel *)room {
}
@end
TapUIMyAccountDelegate
TapUIMyAccountDelegate listens to UI-related events in My Account View when UI implementation type is used. You can register a TapUIMyAccountDelegate instance in your application through the TapUI class as follows:
Note: Make sure to add #import <TapTalk/TapUI.h> before registering the delegate
ViewController.m
//ViewController.m
#import <TapTalk/TapUI.h>
//Add TapUIDelegate declaration
@interface ViewController () <TapUIMyAccountDelegate>
@end
@implementation ViewController
- (void)function {
//Set TapUI delegate to current
[[TapUI sharedInstance] setMyAccountDelegate:self];
}
#pragma mark - Delegates
#pragma mark TapUIMyAccountDelegate
// Called when user tapped Delete Account button in my account page
- (void)tapTalkDeleteAccountButtonTapped:(UIViewController *)currentViewController
currentShownNavigationController:(UINavigationController *)currentNavigationController {
}
@end
TapUICustomKeyboardDelegate
TapUICustomKeyboardDelegate bridges the custom keyboard-related events between TapTalk.io and the client app when UI implementation type is used. TapTalk.io will request custom keyboard items from the client app through this listener when a chat room is opened by the user. TapUICustomKeyboardDelegate can be implemented using the TapUI class.
Note: Make sure to add #import <TapTalk/TapUI.h> before registering the delegate
ViewController.m
//ViewController.m
#import <TapTalk/TapUI.h>
//Add TapUIChatProfileDelegate declaration
@interface ViewController () <TapUICustomKeyboardDelegate>
@end
@implementation ViewController
- (void)function {
//Set TapUI delegate to current
[[TapUI sharedInstance] setCustomKeyboardDelegate:self];
}
#pragma mark - Delegates
#pragma mark TapUICustomKeyboard
- (void)customKeyboardItemTappedWithRoom:(TAPRoomModel * _Nonnull)room
sender:(TAPUserModel * _Nonnull)sender
recipient:(TAPUserModel * _Nullable)recipient
keyboardItem:(TAPCustomKeyboardItemModel * _Nonnull)keyboardItem {
//Do an action when user taps a custom keyboard item
}
- (NSArray<TAPCustomKeyboardItemModel *> *)setCustomKeyboardItemsForRoom:(TAPRoomModel * _Nonnull)room sender:(TAPUserModel * _Nonnull)sender recipient:(TAPUserModel * _Nullable)recipient {
//Set custom keyboard option items
//Return items here if you wish to use custom keyboard in chat room
return [NSArray array];
}
@end
To use custom keyboard in the chat room, return a list of TapCustomKeyboardItemModel on the setCustomKeyboardItemsForSender: method in this delegate. See the example below:
A custom keyboard item in a chat room is tapped by the user. Returns custom keyboard item, room, sender user, and recipient user (only for personal chat room)
setCustomKeyboardItemsForRoom:sender:recipient:
Chat room is opened. TapTalk.io will request custom keyboard items from the client app to be displayed in the chat room. Returns room, sender user, and the recipient user (only for personal chat room)
TAPCoreMessageManagerDelegate
TAPCoreMessageManagerDelegate listens to events when a new/updated message is received by the application. TAPCoreMessageManagerDelegate can be registered through the TapCoreMessageManager class.
Note: Make sure to add #import <TapTalk/TapCoreMessageManager.h> before registering the delegate
A new message is received. Returns the newly received message.
tapTalkDidReceiveUpdatedMessage:
An updated message is received. Returns the newly received message.
tapTalkDidDeleteMessage:
A message is deleted. Returns the deleted message.
TAPCoreRoomListManagerDelegate
Changes to a chat room's state, such as pin and mute events are notified through TapCoreRoomListListener. An instance of TapCoreRoomListListener can be registered from the TapCoreRoomListManager class.
Note: Make sure to add #import <TapTalk/TAPCoreRoomListManager.h>before registering the delegate
The active user muted a chat room. Returns the room ID and mute expiry time of the muted room.
tapTalkDidUnmuteChatRoom:
The active user unmuted a chat room. Returns the room ID of the unmuted room.
tapTalkDidPinChatRoom:
The active user pinned a chat room. Returns the room ID of the pinned room.
tapTalkDidUnpinChatRoom:
The active user unpinned a chat room. Returns the room ID of the unpinned room.
tapTalkDidDeleteChatRoom:
The active user deleted a chat room. Returns the room ID of the deleted room.
TAPCoreChatRoomManagerDelegate
Room status events such as typing events and online status are notified through TAPCoreChatRoomManagerDelegate. An instance of TAPCoreChatRoomManagerDelegate can be registered from the TapCoreChatRoomManager class.
Note: Make sure to add #import <TapTalk/TapCoreChatRoomManager.h>before registering the delegate
Another user starts typing a message in a chat room. Returns the room ID and typing user.
tapTalkDidStopTypingWithUser:roomID:
Another user stops typing a message in a chat room. Returns the room ID and typing user.
tapTalkDidReceiveOnlineStatus:
Another user comes online or offline. Returns the updated user, online status, and the updated user's last active time stamp.
TAPCoreContactManagerDelegate
Contact related events such as block/unblock are notified through TAPCoreContactManagerDelegate. An instance of TAPCoreContactManagerDelegate can be registered from the TapCoreContactManager class.
Note: Make sure to add #import <TapTalk/TapCoreContactManager.h>before registering the delegate
Active user blocks another user. Returns the blocked user.
tapTalkDidUnblockContact:
Active user unblocks another user. Returns the unblocked user.
TapUIRoomListViewControllerLifecycleDelegate
Room list view controller lifecycle events such as loadView, viewDidLoad, viewWillAppear and others are notified through TAPRoomListViewControllerLifecycleDelegate.
Note: Make sure to add #import <TapTalk/TapUI.h>before registering the delegate