Messaging UI - Straas/Straas-iOS-sdk GitHub Wiki

Overview

StraaS iOS Messaging UI is built on StraaS-iOS-sdk/Examples. We made Messaging UI by using SlackTextViewController and SDWebImage to establish StraaS Chatroom UI.

Use Chatroom as Messaging UI

Be sure to fill up our SDK credential and read Installation.

After 0.9.0-UI version.

You may use our default messaging UI by make an instance viewController directly. For example, if you want to make a default chatroom UI . You just need the following code

    //with sticker input view
    ChatStickerExampleViewController * controller = [ChatStickerExampleViewController new];
    [controller connectToChatWithJWT:self.JWT chatroomName:self.chatroomName connectionOptions:self.chatroomConnectionOptions];

    //without sticker input view
    ChatViewController * controller = [ChatViewController new];
    [controller connectToChatWithJWT:self.JWT chatroomName:self.chatroomName connectionOptions:self.chatroomConnectionOptions];

Only needs this two lines of code would return you an StraaS messaging UI with the chat you want to connect.

You can make some basic customizations by set the property of ChatViewConntroller and its super class SlackTextViewController. For example:

//Change the textInputButtonImage
ChatViewController * viewController = [ChatViewController new];
viewController.textInputButtonImage = [UIImage imageNamed:<#name#>];

//Change the stickerViewShowingHeight
ChatStickerViewController * viewController = [ChatStickerViewController new];
viewController.stickerViewShowingHeight = 100;

Since ChatViewController is subclass of SLKTextViewController, you may change its property to customize too! For more infomation, refer to SlackTextViewController.

You may do more customize by subclassing our messaging UI default class ChatViewController or ChatStickerViewController. By subclassing, you may do extra task when a callback or function is being called.

For more information, you may refer our ChatStickerExampleViewController and ChatExampleViewController viewController to see how to fulfill your needs by this feature.

Before 0.9.0-UI version.

  1. set JWT & chatroomName and connectionOptions by your business logic when new a ChatStickerViewController object.
  2. present ChatStickerViewController

If you use UINavigationController to enter example Chatroom, the code may seem like

    - (void)eventToEnterChatroom {
    ChatStickerViewController * chatStickerViewController =
    [ChatStickerViewController chatStickerViewControllerWithJWT:self.JWT
                                                   chatroomName:self.chatroomName
                                              connectionOptions:self.connectionOptions];

    [self.navigationController pushViewController:chatStickerViewController animated:YES];
  }

then you will enter ChatStickerViewController with your JWT & chatroomName and connectionOptions!

Custom Messaging UI

Since iOS Chatroom UI is open source, you can do whatever you want to customize your message UI.

You may get more informations about how to customize on SlackTextViewController since we use this library as base to build our Chatroom UI.

Customize your language files

If you are using Messaging UI, and it happens that you have your own language files, please copy strings that will be used in our sample from Localizable.string(Eng) or Localizable.string(Zh) and paste onto yours. If you don't have your own language files, you can just use ours without any additional setting or change.

Update to latest Message UI

If you've forked our repository, it is free to do any customized change about your own message UI. To keep updated, you just need to pull our StraaS-iOS-sdk master branch to your forked one. After solving some conflicts, you can enjoy the latest version of message UI with your own customization.

Update ChatViewController to have sticker input feature

This chapter shows how to update your existing message UI to have sticker input view if you don't have this feature yet.

  1. Pull the latest version example.
  2. copy ChatRoom directory in VideoChat to your project.

NOTE: If you've made modifications to our example, you should resolve the conflicts may be caused. 3. Use ChatStickerViewController as the main ViewController to build your message UI instead of using ChatViewController.

Then, build your project, you should have the message UI with stickerInputView. If still don't work, please pull our example to see how it work.

⚠️ **GitHub.com Fallback** ⚠️