Chat View

Creating your own tickets view is easy.  Using the API you can get a list of your tickets or community tickets and build a totally custom view.

When building a custom view, you will want to put up an R2ChatViewController when a ticket gets selected

R2ChatViewController

Objective-C

#import "R2ChatViewController.h"
...
R2ChatViewController *vc = [[R2ChatViewController alloc]init];
[self.navigationController pushViewController:vc animated:YES];

 

Swift

let vc = R2ChatViewController()
self.navigationController?.pushViewController(vc, animated: true)

Customizations

R2ChatViewController has variables to enable and disable features based on your desired functionality.

Enable & Disable the Close Button
BOOL enableClose

Setting enableClose to NO will hide the close button so that the ticket can’t be closed from the view.

ENABLE & DISABLE THE CALL BUTTON
BOOL enableCall

Setting enableCall to NO will hide the call button so that a call can’t be initiated from within the view.

ENABLE & DISABLE THE Follow BUTTON
BOOL enableFollow

Setting enableFollow to NO will hide the follow button so that the ticket can’t be followed from the view.

ENABLE & DISABLE THE Reporting Features
BOOL enableReporting

Setting enableClose to YES will show the reporting button so that the ticket can be flagged as inappropriate from the view.  This property defaults to NO.

Enabling reporting will also allow individual messages in the chat to be reported.

Change the CLOSE BUTTOn text
NSString * closeButtonText

Set this variable to customize the text on the close ticket button.

Custom Banner View

The custom banner view is an optional view that sits under the navigation bar, it is 100px tall and full width.

UIView customBannerView

Changing the View Style

ios-chat-customize

The chat view includes all the tools to fully customize the appearance of the chat view.

Change the Colors
UIColor outgoingMessageColor
UIColor incomingMessageColor

Using these properties, you can easily change the color of the messages to match your brand and color scheme.

Change the View Style

The chat view offers two different view styles out of the box.

  1. Multicolor
    The multicolor view can be seen in the center screen shot above.  In this view mode, each participant on the left hand side will have their own color for their bubble.  This way your users can easily differentiate between the people in the conversation.
  2. Avatar
    In the avatar view, each participant in the chat will have a round avatar image next to their chat bubbles.  This avatar image comes from the workbench user profiles.  If there is no image uploaded by the user, it will fall back on the user’s initials.

To change the view style, simple set the viewStyle property with one of the enums:

enum VIEWSTYLE {
    VIEWSTYLE_MULTICOLOR = 1,
    VIEWSTYLE_AVATAR = 2
};
NSInteger viewStyle