Event Delegate

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.

Event Delegate Name

Description

Listens to general event changes in the application

Listens to UI-related events in Room List View when UI implementation type is used

Listens to UI-related events in Chat Room View when UI implementation type is used

Listens to UI-related events in Chat Profile View when UI implementation type is used

Listens to UI-related events in My Account View when UI implementation type is used

Listens to custom keyboard-related events when UI implementation type is used

Listens to events when a new/updated message is received by the application

Listens to changes to chat room's state in the room list

Listens to chat room status events such as typing events and online status

Listens to contact related events such as block or unblock contact

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

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

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

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

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

To use custom keyboard in the chat room, return a list of TapCustomKeyboardItemModel on the setCustomKeyboardItemsForSender: method in this delegate. See the example below:

Method Name

Invoked When

customKeyboardItemTappedWithRoom:

sender:

recipient:

keyboardItem:

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

Method Name

Invoked When

tapTalkDidReceiveNewMessage:

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

Method Name
Invoked When

tapTalkDidMuteChatRoom:

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

Method Name

Invoked When

tapTalkDidStartTypingWithUser:roomID:

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

Method Name

Invoked When

tapTalkDidBlockContact:

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

Last updated

Was this helpful?