For the complete documentation index, see llms.txt. This page is also available as Markdown.

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.

ViewController.m
// For version 3.0.0 and above
#import "PowerTalk.h"

// For versions below 3.0.0
#import <TapTalk/TapTalk.h>

//Add TapTalkDelegate declaration
@interface ViewController () <TapTalkDelegate>

@end
  
@implementation ViewController
  
- (void)viewDidLoad {
    // Set TapTalk delegate to current view controller
    [[TapTalk sharedInstance] setDelegate:self];
}

#pragma mark - TapTalkDelegate

- (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];
}

- (void)userLogout {
    // User has logged out
}
  
@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.

userLogout

User has logged out and all user data has been cleared from local storage

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:

Method Name

Invoked When

tapTalkAccountButtonTapped:

currentShownNavigationController:

My account button in the top left side of room list view is tapped by active user.

tapTalkNewChatButtonTapped:

currentShownNavigationController:

New Chat button in the top right side of room list view is tapped by active user.

tapTalkCloseRoomListButtonTapped:

currentShownNavigationController:

Close room list button is tapped by active user.

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:

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.

tapTalkChatRoomDidShowMessageSelection:selectedMessages:

Active user starts selecting messages and multiple message selection (e.g. forward) is shown in active chat room.

tapTalkChatRoomDidHideMessageSelection

Multiple message selection is hidden or cancelled by active user.

tapTalkReportMessageButtonDidTapped:message:currentShownNavigationController:

Active user selects Report Message from a message bubble's long press menu.

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:

Method Name

Invoked When

reportUserButtonDidTapped:room:user:

Active user taps Report User button in another user's profile page.

reportGroupButtonDidTapped:room:

Active user taps Report Group button in a chat group's profile page.

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:

Method Name

Invoked When

tapTalkDeleteAccountButtonTapped:currentShownNavigationController:

Active user taps Delete Account button in their own account's profile page.

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.

To use custom keyboard in the chat room, return a list of TapCustomKeyboardItemModel on the setCustomKeyboardItemsForRoom: 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.

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.

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.

Method Name

Invoked When

tapTalkDidReceiveUpdatedChatRoomData:recipientUser:

An updated chat room data was received through socket message. Returns the room data and user data for personal room.

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.

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.

Last updated