123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198 |
- /************************************************************
- * * Hyphenate CONFIDENTIAL
- * __________________
- * Copyright (C) 2016 Hyphenate Inc. All rights reserved.
- *
- * NOTICE: All information contained herein is, and remains
- * the property of Hyphenate Inc.
- * Dissemination of this information or reproduction of this material
- * is strictly forbidden unless prior written permission is obtained
- * from Hyphenate Inc.
- */
- //#import <UIKit/UIKit.h>
- //#import <Foundation/Foundation.h>
- //#if ENABLE_LITE == 1
- //#import <HyphenateLite/HyphenateLite.h>
- //#else
- //#import <HyphenateLite/HyphenateLite.h>
- //#endif
- /** @brief 登录状态变更的通知 */
- #define KNOTIFICATION_LOGINCHANGE @"loginStateChange"
- /** @brief 实时音视频呼叫 */
- #define KNOTIFICATION_CALL @"callOutWithChatter"
- /** @brief 关闭实时音视频 */
- #define KNOTIFICATION_CALL_CLOSE @"callControllerClose"
- /** @brief 群组消息ext的字段,用于存放被@的环信id数组 */
- #define kGroupMessageAtList @"em_at_list"
- /** @brief 群组消息ext字典中,kGroupMessageAtList字段的值,用于@所有人 */
- #define kGroupMessageAtAll @"all"
- /** @brief 注册SDK时,是否允许控制台输出log */
- #define kSDKConfigEnableConsoleLogger @"SDKConfigEnableConsoleLogger"
- /** @brief 使用的SDK是否为Lite版本(即不包含实时音视频功能) */
- #define kEaseUISDKConfigIsUseLite @"isUselibHyphenateClientSDKLite"
- @interface EaseSDKHelper : NSObject<EMClientDelegate>
- /** @brief 当前是否有imagePickerViewController弹出 */
- @property (nonatomic) BOOL isShowingimagePicker;
- /** @brief 使用的SDK是否为Lite版本(即不包含实时音视频功能) */
- @property (nonatomic) BOOL isLite;
- + (instancetype)shareHelper;
- #pragma mark - init Hyphenate
- /*!
- @method
- @brief 注册3.xSDK,注册远程通知
- @param application UIApplication对象
- @param launchOptions 启动配置(传入AppDelegate中启动回调的参数,可选)
- @param appkey 已注册的appkey
- @param apnsCertName 上传的推送证书名
- @param otherConfig 注册SDK的额外配置(此方法目前只解析了kSDKConfigEnableConsoleLogger字段)
- */
- - (void)hyphenateApplication:(UIApplication *)application
- appkey:(NSString *)appkey
- apnsCertName:(NSString *)apnsCertName;
- #pragma mark - receive remote notification
- /*!
- @method
- @brief 程序在前台收到APNs时,需要调用此方法
- @param application UIApplication
- @param userInfo 推送内容
- */
- - (void)hyphenateApplication:(UIApplication *)application
- didReceiveRemoteNotification:(NSDictionary *)userInfo;
- /// 点击登陆后的操作 - 登录环信
- /// @param username <#username description#>
- /// @param password <#password description#>
- - (void)loginEaseWithUsername:(NSString *)username
- password:(NSString *)password;
- /// 退出环信
- - (void)easeLogout;
- /*!
- @method
- @brief 构建待发送的文本消息
- @discussion 向环信id为to的用户发送文本消息
- @param text 待发送的文本信息
- @param to 消息的接收方环信id
- @param messageType 消息的聊天类型
- @param messageExt 消息的扩展属性
- @result 返回构建完成的消息
- */
- + (EMMessage *)sendTextMessage:(NSString *)text
- to:(NSString *)to
- messageType:(EMChatType)messageType
- messageExt:(NSDictionary *)messageExt;
- /*!
- @method
- @brief 构建待发送的透传消息
- @discussion 向环信id为to的用户发送透传消息
- @param action 透传消息的命令内容
- @param to 消息的接收方环信id
- @param messageType 消息的聊天类型
- @param messageExt 消息的扩展属性
- @param cmdParams 透传消息命令参数,只是为了兼容老版本,应该使用EMMessage的扩展属性来代替
- @result 返回构建完成的消息
- */
- + (EMMessage *)sendCmdMessage:(NSString *)action
- to:(NSString *)to
- messageType:(EMChatType)messageType
- messageExt:(NSDictionary *)messageExt
- cmdParams:(NSArray *)params;
- /*!
- @method
- @brief 构建待发送的位置消息
- @discussion 向环信id为to的用户发送位置消息
- @param latitude 纬度
- @param longitude 经度
- @param address 地址信息
- @param to 消息的接收方环信id
- @param messageType 消息的聊天类型
- @param messageExt 消息的扩展属性
- @result 返回构建完成的消息
- */
- + (EMMessage *)sendLocationMessageWithLatitude:(double)latitude
- longitude:(double)longitude
- address:(NSString *)address
- to:(NSString *)to
- messageType:(EMChatType)messageType
- messageExt:(NSDictionary *)messageExt;
- /*!
- @method
- @brief 构建待发送的图片消息
- @discussion 向环信id为to的用户发送图片消息
- @param imageData 图片数据(NSData对象)
- @param to 消息的接收方环信id
- @param messageType 消息的聊天类型
- @param messageExt 消息的扩展属性
- @result 返回构建完成的消息
- */
- + (EMMessage *)sendImageMessageWithImageData:(NSData *)imageData
- to:(NSString *)to
- messageType:(EMChatType)messageType
- messageExt:(NSDictionary *)messageExt;
- /*!
- @method
- @brief 构建待发送的图片消息
- @discussion 向环信id为to的用户发送图片消息
- @param image 图片(UIImage对象)
- @param to 消息的接收方环信id
- @param messageType 消息的聊天类型
- @param messageExt 消息的扩展属性
- @result 返回构建完成的消息
- */
- + (EMMessage *)sendImageMessageWithImage:(UIImage *)image
- to:(NSString *)to
- messageType:(EMChatType)messageType
- messageExt:(NSDictionary *)messageExt;
- /*!
- @method
- @brief 构建待发送的语音消息
- @discussion 向环信id为to的用户发送语音消息
- @param localPath 录制的语音文件本地路径
- @param duration 语音时长
- @param to 消息的接收方环信id
- @param messageType 消息的聊天类型
- @param messageExt 消息的扩展属性
- @result 返回构建完成的消息
- */
- + (EMMessage *)sendVoiceMessageWithLocalPath:(NSString *)localPath
- duration:(NSInteger)duration
- to:(NSString *)to
- messageType:(EMChatType)messageType
- messageExt:(NSDictionary *)messageExt;
- // 将得到的deviceToken传给SDK
- - (void)application:(UIApplication *)application
- didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken ;
- /// 获取所有会话列表
- - (NSArray*)getAllConversations;
- /// 发送消息
- /// @param aMessage <#aMessage description#>
- /// @param aProgressBlock <#aProgressBlock description#>
- /// @param aCompletionBlock <#aCompletionBlock description#>
- + (void)sendMessage:(EMMessage *)aMessage
- progress:(void (^)(int progress))aProgressBlock
- completion:(void (^)(EMMessage *message, EMError *error))aCompletionBlock;
- @end
|