DPGodChat 0.3.2

DPGodChat 0.3.2

OuyangMumu 维护。



 
依赖项
AFNetworking>= 0
MJExtension>= 0
MJRefresh>= 0
Masonry>= 0
SDWebImage>= 0
HelpDesk>= 0
Hyphenate>= 0
 

DPGodChat 0.3.2

DPGodChat

CI Status Version License Platform

示例

要运行示例项目,首先克隆仓库,然后从 Example 目录运行 pod install

需求

安装

DPGodChat 通过 CocoaPods 提供。要安装它,只需将以下行添加到您的 Podfile 中:

pod 'DPGodChat'

作者

[email protected], [email protected]

使用

唤起客服聊天原生界面

image.png

#import <ChatFramework/GCChatViewController.h>
#import <ChatFramework/GodChatSDK.h>

[[GCSessionManager shareSessionManager] presentGodCallViewControllerWithUsername:@"" password:@"" animated:YES];

网页发起视频聊天

image.png

#import <ChatFramework/GodChatSDK.h>

注册js监听事件
WKWebViewConfiguration *config = [[WKWebViewConfiguration alloc] init];
        [config.userContentController addScriptMessageHandler:self name:@"videoChat"];


/** 通过网页返回的方法名调用我们写的方法 */
- (void)userContentController:(WKUserContentController *)userContentController didReceiveScriptMessage:(WKScriptMessage *)message {
    if ([message.name isEqualToString:@"videoChat"]) {
        [self videoChat:message.body];
    }
}


- (void)videoChat:(NSDictionary *)params {
    NSLog(@"videoChat");   
    [[GCSessionManager shareSessionManager] presentGodCallViewControllerWithUsername:params[@"username"] token:params[@"token"] animated:YES];
    [[GCSessionManager shareSessionManager] presentGodCallViewControllerWithAnimated:YES];
}


- (void)dealloc
{
    if (_wkWebView)
    {
        [_wkWebView.configuration.userContentController removeScriptMessageHandlerForName:@"videoChat"];
    }
}
        

License

DPGodChat 在MIT许可下可用。更多信息请参阅LICENSE文件。