Chat Room and Messages - TapUI

You can use these methods when implementing your app with TapUI to open a chat room when UI implementation type is used.

Note: You can get TapTalk.io current view controller or navigation controller to integrate to your current view controller by using getCurrentTapTalkActiveViewController method.

Create Personal Chat Room with User Model

#import <TapTalk/TapUI.h>

[TapUI sharedInstance] createRoomWithOtherUser:OTHER_USER success:^[(TapUIChatViewController * _Nonnull chatViewController) {
   
   //You can choose to present or push view controller using this code
   //Present room list view
   [self presentViewController:chatViewController animated:YES completion:^{
     //completion
   }];

   //Push room list view
   [self.navigationController pushViewController:chatViewController animated:YES];
  
}];

Parameters OTHER_USER: (TAPUserModel) recipient user model that will be shown

Create Personal Chat Room with TapTalk.io User ID

#import <TapTalk/TapUI.h>

[[TapUI sharedInstance] createRoomWithUserID:USER_ID prefilledText:PREFILLED_TEXT customQuoteTitle:CUSTOM_QUOTE_TITLE customQuoteContent:CUSTOM_QUOTE_CONTENT customQuoteImageURLString:CUSTOM_QUOTE_IMAGE_URL_STRING userInfo:USER_INFO success:^(TapUIChatViewController * _Nonnull chatViewController) {
  //Success open room
  
  //You can choose to present or push view controller using this code
    //Present room list view
    [self presentViewController:chatViewController animated:YES completion:^{
    //completion    
    }];

    //Push room list view
    [self.navigationController pushViewController:chatViewController animated:YES];
  
} failure:^(NSError * _Nonnull error) {
  //Failed open room
  
}];

Parameters USER_ID: (String) TapTalk.io user ID PREFILLED_TEXT: (String) prefilled text of message CUSTOM_QUOTE_TITLE: (String) title of custom quote data CUSTOM_QUOTE_CONTENT: (String) content / subtitle of custom quote data CUSTOM_QUOTE_IMAGE_URL_STRING: (String) image url string of custom quote image USER_INFO: (String) client-specified data or details of the custom quote

Create Personal Chat Room with Client User ID

#import <TapTalk/TapUI.h>

[[TapUI sharedInstance] createRoomWithXCUserID:XC_USER_ID prefilledText:PREFILLED_TEXT customQuoteTitle:CUSTOM_QUOTE_TITLE customQuoteContent:CUSTOM_QUOTE_CONTENT customQuoteImageURLString:CUSTOM_QUOTE_IMAGE_URL_STRING userInfo:USER_INFO success:^(TapUIChatViewController * _Nonnull chatViewController) {
  //Success open room
  
  //You can choose to present or push view controller using this code
    //Present room list view
    [self presentViewController:chatViewController animated:YES completion:^{
    //completion
    }];

    //Push room list view
    [self.navigationController pushViewController:chatViewController animated:YES];
  
} failure:^(NSError * _Nonnull error) {
  //Failed open room
  
}];

Parameters XC_USER_ID: (String) client user ID PREFILLED_TEXT: (String) prefilled text of message CUSTOM_QUOTE_TITLE: (String) title of custom quote data CUSTOM_QUOTE_CONTENT: (String) content / subtitle of custom quote data CUSTOM_QUOTE_IMAGE_URL_STRING: (String) image url string of custom quote image USER_INFO: (String) client-specified data or details of the custom quote

Create Room with Room Model

#import <TapTalk/TapUI.h>

[[TapUI sharedInstance] createRoomWithRoom:ROOM success:^(TapUIChatViewController * _Nonnull chatViewController) {
   //You can choose to present or push view controller using this code
   //Present room list view
   [self presentViewController:chatViewController animated:YES completion:^{
     //completion
   }];

   //Push room list view
   [self.navigationController pushViewController:chatViewController animated:YES];
}];

Parameters ROOM: (TAPRoomModel) recipient room data model

#import <TapTalk/TapUI.h>

[[TapUI sharedInstance] createRoomWithRoom:ROOM customQuoteTitle:CUSTOM_QUOTE_TITLE customQuoteContent:CUSTOM_QUOTE_CONTENT customQuoteImageURLString:CUSTOM_QUOTE_IMAGE_URL_STRING userInfo:USER_INFO success:^(TapUIChatViewController * _Nonnull chatViewController) {

   //You can choose to present or push view controller using this code
   //Present room list view
   [self presentViewController:chatViewController animated:YES completion:^{
     //completion
   }];

   //Push room list view
   [self.navigationController pushViewController:chatViewController animated:YES];

}];

Parameters ROOM: (TAPRoomModel) recipient room data model CUSTOM_QUOTE_TITLE: (String) title of custom quote data CUSTOM_QUOTE_CONTENT: (String) content / subtitle of custom quote data CUSTOM_QUOTE_IMAGE_URL_STRING: (String) image url string of custom quote image USER_INFO: (String) client-specified data or details of the custom quote

Create Room with Room Model & Scroll to Selected Message

#import <TapTalk/TapUI.h>

[[TapUI sharedInstance] createRoomWithRoom:ROOM scrollToMessageWithLocalID:MESSAGE_LOCAL_ID] success:^(TapUIChatViewController * _Nonnull chatViewController) {
   //You can choose to present or push view controller using this code
   //Present room list view
   [self presentViewController:chatViewController animated:YES completion:^{
      //completion
   }];

   //Push room list view
   [self.navigationController pushViewController:chatViewController animated:YES];
}];

Parameters ROOM: (TAPRoomModel) recipient room data model MESSAGE_LOCAL_ID: (String) scrolls the view to the message with the specified local ID when the chat room is opened

Create Saved Messages Chat Room

#import <TapTalk/TapUI.h>

[[TapUI sharedInstance] createSavedMessagesChatRoom:^(TapUIChatViewController * _Nonnull chatViewController) {
  //Success open room
  
  //You can choose to present or push view controller using this code
    //Present room list view
    [self presentViewController:chatViewController animated:YES completion:^{
    //completion    
    }];

    //Push room list view
    [self.navigationController pushViewController:chatViewController animated:YES];
  
} failure:^(NSError * _Nonnull error) {
  //Failed open room
}];

Last updated