chengyanfang

init

Showing 79 changed files with 4834 additions and 0 deletions

Too many changes to show.

To preserve performance only 79 of 79+ files are displayed.

No preview for this file type
  1 +Pod::Spec.new do |s|
  2 + s.name = "HHVDoctorSDK"
  3 + s.version = "3.0.6"
  4 + s.summary = "和缓视频医生 SDK"
  5 +
  6 + s.description = <<-DESC
  7 + 和缓视频医生,连接千万用户和全科医生。
  8 + DESC
  9 +
  10 + s.homepage = "https://code.hh-medic.com/dev-client/hhsdk.ios"
  11 + s.license = "MIT"
  12 + s.author = { "chengyanfang" => "cumt_cyf@163.com" }
  13 + s.social_media_url = "https://github.com/515783034"
  14 +
  15 + s.platform = :ios, "9.0"
  16 + s.source = { :git => "http://code.hh-medic.com/hh_public/HHZKHSDK.ios.git", :tag => s.version }
  17 + s.default_subspec = 'Base'
  18 +
  19 + s.subspec 'Base' do |base|
  20 + base.vendored_frameworks = 'HHZKHSDK/*.framework'
  21 + base.resources = 'HHZKHSDK/resources/*.bundle'
  22 +
  23 + base.frameworks = 'SystemConfiguration', 'MobileCoreServices', 'AVFoundation', 'CoreTelephony', 'VideoToolbox', 'AudioToolbox', 'CoreMedia'
  24 + base.libraries = 'z', 'sqlite3.0', 'c++', 'resolv.9'
  25 + end
  26 +
  27 +end
  28 +
  29 +
No preview for this file type
No preview for this file type
No preview for this file type
  1 +// Generated by Apple Swift version 5.1 (swiftlang-1100.0.270.13 clang-1100.0.33.7)
  2 +#pragma clang diagnostic push
  3 +#pragma clang diagnostic ignored "-Wgcc-compat"
  4 +
  5 +#if !defined(__has_include)
  6 +# define __has_include(x) 0
  7 +#endif
  8 +#if !defined(__has_attribute)
  9 +# define __has_attribute(x) 0
  10 +#endif
  11 +#if !defined(__has_feature)
  12 +# define __has_feature(x) 0
  13 +#endif
  14 +#if !defined(__has_warning)
  15 +# define __has_warning(x) 0
  16 +#endif
  17 +
  18 +#if __has_include(<swift/objc-prologue.h>)
  19 +# include <swift/objc-prologue.h>
  20 +#endif
  21 +
  22 +#pragma clang diagnostic ignored "-Wauto-import"
  23 +#include <Foundation/Foundation.h>
  24 +#include <stdint.h>
  25 +#include <stddef.h>
  26 +#include <stdbool.h>
  27 +
  28 +#if !defined(SWIFT_TYPEDEFS)
  29 +# define SWIFT_TYPEDEFS 1
  30 +# if __has_include(<uchar.h>)
  31 +# include <uchar.h>
  32 +# elif !defined(__cplusplus)
  33 +typedef uint_least16_t char16_t;
  34 +typedef uint_least32_t char32_t;
  35 +# endif
  36 +typedef float swift_float2 __attribute__((__ext_vector_type__(2)));
  37 +typedef float swift_float3 __attribute__((__ext_vector_type__(3)));
  38 +typedef float swift_float4 __attribute__((__ext_vector_type__(4)));
  39 +typedef double swift_double2 __attribute__((__ext_vector_type__(2)));
  40 +typedef double swift_double3 __attribute__((__ext_vector_type__(3)));
  41 +typedef double swift_double4 __attribute__((__ext_vector_type__(4)));
  42 +typedef int swift_int2 __attribute__((__ext_vector_type__(2)));
  43 +typedef int swift_int3 __attribute__((__ext_vector_type__(3)));
  44 +typedef int swift_int4 __attribute__((__ext_vector_type__(4)));
  45 +typedef unsigned int swift_uint2 __attribute__((__ext_vector_type__(2)));
  46 +typedef unsigned int swift_uint3 __attribute__((__ext_vector_type__(3)));
  47 +typedef unsigned int swift_uint4 __attribute__((__ext_vector_type__(4)));
  48 +#endif
  49 +
  50 +#if !defined(SWIFT_PASTE)
  51 +# define SWIFT_PASTE_HELPER(x, y) x##y
  52 +# define SWIFT_PASTE(x, y) SWIFT_PASTE_HELPER(x, y)
  53 +#endif
  54 +#if !defined(SWIFT_METATYPE)
  55 +# define SWIFT_METATYPE(X) Class
  56 +#endif
  57 +#if !defined(SWIFT_CLASS_PROPERTY)
  58 +# if __has_feature(objc_class_property)
  59 +# define SWIFT_CLASS_PROPERTY(...) __VA_ARGS__
  60 +# else
  61 +# define SWIFT_CLASS_PROPERTY(...)
  62 +# endif
  63 +#endif
  64 +
  65 +#if __has_attribute(objc_runtime_name)
  66 +# define SWIFT_RUNTIME_NAME(X) __attribute__((objc_runtime_name(X)))
  67 +#else
  68 +# define SWIFT_RUNTIME_NAME(X)
  69 +#endif
  70 +#if __has_attribute(swift_name)
  71 +# define SWIFT_COMPILE_NAME(X) __attribute__((swift_name(X)))
  72 +#else
  73 +# define SWIFT_COMPILE_NAME(X)
  74 +#endif
  75 +#if __has_attribute(objc_method_family)
  76 +# define SWIFT_METHOD_FAMILY(X) __attribute__((objc_method_family(X)))
  77 +#else
  78 +# define SWIFT_METHOD_FAMILY(X)
  79 +#endif
  80 +#if __has_attribute(noescape)
  81 +# define SWIFT_NOESCAPE __attribute__((noescape))
  82 +#else
  83 +# define SWIFT_NOESCAPE
  84 +#endif
  85 +#if __has_attribute(warn_unused_result)
  86 +# define SWIFT_WARN_UNUSED_RESULT __attribute__((warn_unused_result))
  87 +#else
  88 +# define SWIFT_WARN_UNUSED_RESULT
  89 +#endif
  90 +#if __has_attribute(noreturn)
  91 +# define SWIFT_NORETURN __attribute__((noreturn))
  92 +#else
  93 +# define SWIFT_NORETURN
  94 +#endif
  95 +#if !defined(SWIFT_CLASS_EXTRA)
  96 +# define SWIFT_CLASS_EXTRA
  97 +#endif
  98 +#if !defined(SWIFT_PROTOCOL_EXTRA)
  99 +# define SWIFT_PROTOCOL_EXTRA
  100 +#endif
  101 +#if !defined(SWIFT_ENUM_EXTRA)
  102 +# define SWIFT_ENUM_EXTRA
  103 +#endif
  104 +#if !defined(SWIFT_CLASS)
  105 +# if __has_attribute(objc_subclassing_restricted)
  106 +# define SWIFT_CLASS(SWIFT_NAME) SWIFT_RUNTIME_NAME(SWIFT_NAME) __attribute__((objc_subclassing_restricted)) SWIFT_CLASS_EXTRA
  107 +# define SWIFT_CLASS_NAMED(SWIFT_NAME) __attribute__((objc_subclassing_restricted)) SWIFT_COMPILE_NAME(SWIFT_NAME) SWIFT_CLASS_EXTRA
  108 +# else
  109 +# define SWIFT_CLASS(SWIFT_NAME) SWIFT_RUNTIME_NAME(SWIFT_NAME) SWIFT_CLASS_EXTRA
  110 +# define SWIFT_CLASS_NAMED(SWIFT_NAME) SWIFT_COMPILE_NAME(SWIFT_NAME) SWIFT_CLASS_EXTRA
  111 +# endif
  112 +#endif
  113 +#if !defined(SWIFT_RESILIENT_CLASS)
  114 +# if __has_attribute(objc_class_stub)
  115 +# define SWIFT_RESILIENT_CLASS(SWIFT_NAME) SWIFT_CLASS(SWIFT_NAME) __attribute__((objc_class_stub))
  116 +# define SWIFT_RESILIENT_CLASS_NAMED(SWIFT_NAME) __attribute__((objc_class_stub)) SWIFT_CLASS_NAMED(SWIFT_NAME)
  117 +# else
  118 +# define SWIFT_RESILIENT_CLASS(SWIFT_NAME) SWIFT_CLASS(SWIFT_NAME)
  119 +# define SWIFT_RESILIENT_CLASS_NAMED(SWIFT_NAME) SWIFT_CLASS_NAMED(SWIFT_NAME)
  120 +# endif
  121 +#endif
  122 +
  123 +#if !defined(SWIFT_PROTOCOL)
  124 +# define SWIFT_PROTOCOL(SWIFT_NAME) SWIFT_RUNTIME_NAME(SWIFT_NAME) SWIFT_PROTOCOL_EXTRA
  125 +# define SWIFT_PROTOCOL_NAMED(SWIFT_NAME) SWIFT_COMPILE_NAME(SWIFT_NAME) SWIFT_PROTOCOL_EXTRA
  126 +#endif
  127 +
  128 +#if !defined(SWIFT_EXTENSION)
  129 +# define SWIFT_EXTENSION(M) SWIFT_PASTE(M##_Swift_, __LINE__)
  130 +#endif
  131 +
  132 +#if !defined(OBJC_DESIGNATED_INITIALIZER)
  133 +# if __has_attribute(objc_designated_initializer)
  134 +# define OBJC_DESIGNATED_INITIALIZER __attribute__((objc_designated_initializer))
  135 +# else
  136 +# define OBJC_DESIGNATED_INITIALIZER
  137 +# endif
  138 +#endif
  139 +#if !defined(SWIFT_ENUM_ATTR)
  140 +# if defined(__has_attribute) && __has_attribute(enum_extensibility)
  141 +# define SWIFT_ENUM_ATTR(_extensibility) __attribute__((enum_extensibility(_extensibility)))
  142 +# else
  143 +# define SWIFT_ENUM_ATTR(_extensibility)
  144 +# endif
  145 +#endif
  146 +#if !defined(SWIFT_ENUM)
  147 +# define SWIFT_ENUM(_type, _name, _extensibility) enum _name : _type _name; enum SWIFT_ENUM_ATTR(_extensibility) SWIFT_ENUM_EXTRA _name : _type
  148 +# if __has_feature(generalized_swift_name)
  149 +# define SWIFT_ENUM_NAMED(_type, _name, SWIFT_NAME, _extensibility) enum _name : _type _name SWIFT_COMPILE_NAME(SWIFT_NAME); enum SWIFT_COMPILE_NAME(SWIFT_NAME) SWIFT_ENUM_ATTR(_extensibility) SWIFT_ENUM_EXTRA _name : _type
  150 +# else
  151 +# define SWIFT_ENUM_NAMED(_type, _name, SWIFT_NAME, _extensibility) SWIFT_ENUM(_type, _name, _extensibility)
  152 +# endif
  153 +#endif
  154 +#if !defined(SWIFT_UNAVAILABLE)
  155 +# define SWIFT_UNAVAILABLE __attribute__((unavailable))
  156 +#endif
  157 +#if !defined(SWIFT_UNAVAILABLE_MSG)
  158 +# define SWIFT_UNAVAILABLE_MSG(msg) __attribute__((unavailable(msg)))
  159 +#endif
  160 +#if !defined(SWIFT_AVAILABILITY)
  161 +# define SWIFT_AVAILABILITY(plat, ...) __attribute__((availability(plat, __VA_ARGS__)))
  162 +#endif
  163 +#if !defined(SWIFT_WEAK_IMPORT)
  164 +# define SWIFT_WEAK_IMPORT __attribute__((weak_import))
  165 +#endif
  166 +#if !defined(SWIFT_DEPRECATED)
  167 +# define SWIFT_DEPRECATED __attribute__((deprecated))
  168 +#endif
  169 +#if !defined(SWIFT_DEPRECATED_MSG)
  170 +# define SWIFT_DEPRECATED_MSG(...) __attribute__((deprecated(__VA_ARGS__)))
  171 +#endif
  172 +#if __has_feature(attribute_diagnose_if_objc)
  173 +# define SWIFT_DEPRECATED_OBJC(Msg) __attribute__((diagnose_if(1, Msg, "warning")))
  174 +#else
  175 +# define SWIFT_DEPRECATED_OBJC(Msg) SWIFT_DEPRECATED_MSG(Msg)
  176 +#endif
  177 +#if !defined(IBSegueAction)
  178 +# define IBSegueAction
  179 +#endif
  180 +#if __has_feature(modules)
  181 +#if __has_warning("-Watimport-in-framework-header")
  182 +#pragma clang diagnostic ignored "-Watimport-in-framework-header"
  183 +#endif
  184 +@import ObjectiveC;
  185 +@import UIKit;
  186 +#endif
  187 +
  188 +#pragma clang diagnostic ignored "-Wproperty-attribute-mismatch"
  189 +#pragma clang diagnostic ignored "-Wduplicate-method-arg"
  190 +#if __has_warning("-Wpragma-clang-attribute")
  191 +# pragma clang diagnostic ignored "-Wpragma-clang-attribute"
  192 +#endif
  193 +#pragma clang diagnostic ignored "-Wunknown-pragmas"
  194 +#pragma clang diagnostic ignored "-Wnullability"
  195 +
  196 +#if __has_attribute(external_source_symbol)
  197 +# pragma push_macro("any")
  198 +# undef any
  199 +# pragma clang attribute push(__attribute__((external_source_symbol(language="Swift", defined_in="HHDoctor_pro",generated_declaration))), apply_to=any(function,enum,objc_interface,objc_category,objc_protocol))
  200 +# pragma pop_macro("any")
  201 +#endif
  202 +
  203 +@class UINavigationController;
  204 +
  205 +SWIFT_CLASS("_TtC12HHDoctor_pro8HHDoctor")
  206 +@interface HHDoctor : NSObject
  207 +SWIFT_CLASS_PROPERTY(@property (nonatomic, class, readonly, strong, getter=default) HHDoctor * _Nonnull default_;)
  208 ++ (HHDoctor * _Nonnull)default SWIFT_WARN_UNUSED_RESULT;
  209 +/// 初始化 SDK
  210 +/// \param sdkProductId 产品 id
  211 +///
  212 +/// \param debug 是否 debug 模式(debug 模式下控制台打印信息)
  213 +///
  214 +/// \param develop 是否是测试环境
  215 +///
  216 +/// \param title 服务名称(显示 title)
  217 +///
  218 +- (void)startWithSdkProductId:(NSString * _Nonnull)sdkProductId debug:(BOOL)debug develop:(BOOL)develop title:(NSString * _Nonnull)title;
  219 +/// 呼叫视频医生
  220 +/// \param token 当前用户的唯一标识符
  221 +///
  222 +/// \param topVC 当前导航控制器
  223 +///
  224 +/// \param finished 回调结果, String 为空表示退出成功
  225 +///
  226 +- (void)callDoctor:(NSString * _Nonnull)token topVC:(UINavigationController * _Nonnull)topVC finished:(void (^ _Nullable)(NSString * _Nullable))finished;
  227 +/// 退出登录(退出账号时请调用退出登录)
  228 +/// \param callback 回调结果, String 为空表示退出成功
  229 +///
  230 +- (void)logoutWithCallback:(void (^ _Nonnull)(NSString * _Nullable))callback;
  231 +- (nonnull instancetype)init OBJC_DESIGNATED_INITIALIZER;
  232 +@end
  233 +
  234 +
  235 +
  236 +
  237 +
  238 +
  239 +
  240 +
  241 +
  242 +
  243 +
  244 +
  245 +
  246 +#if __has_attribute(external_source_symbol)
  247 +# pragma clang attribute pop
  248 +#endif
  249 +#pragma clang diagnostic pop
  1 +#ifdef __OBJC__
  2 +#import <UIKit/UIKit.h>
  3 +#else
  4 +#ifndef FOUNDATION_EXPORT
  5 +#if defined(__cplusplus)
  6 +#define FOUNDATION_EXPORT extern "C"
  7 +#else
  8 +#define FOUNDATION_EXPORT extern
  9 +#endif
  10 +#endif
  11 +#endif
  12 +
  13 +
  14 +FOUNDATION_EXPORT double HHDoctor_proVersionNumber;
  15 +FOUNDATION_EXPORT const unsigned char HHDoctor_proVersionString[];
  16 +
No preview for this file type
  1 +// swift-interface-format-version: 1.0
  2 +// swift-compiler-version: Apple Swift version 5.1 (swiftlang-1100.0.270.13 clang-1100.0.33.7)
  3 +// swift-module-flags: -target arm64-apple-ios9.0 -enable-objc-interop -enable-library-evolution -swift-version 5 -enforce-exclusivity=checked -O -module-name HHDoctor_pro
  4 +import Foundation
  5 +@_exported import HHDoctor_pro
  6 +import Swift
  7 +import UIKit
  8 +import WebKit
  9 +import hhVDoctorSDK
  10 +@objc public class HHDoctor : ObjectiveC.NSObject {
  11 + @objc public static let `default`: HHDoctor_pro.HHDoctor
  12 + @objc public func start(sdkProductId: Swift.String, debug: Swift.Bool = true, develop: Swift.Bool = true, title: Swift.String = "视频医生")
  13 + @objc public func callDoctor(_ token: Swift.String, topVC: UIKit.UINavigationController, finished: ((Swift.String?) -> Swift.Void)? = nil)
  14 + @objc public func logout(callback: @escaping ((Swift.String?) -> Swift.Void))
  15 + @objc override dynamic public init()
  16 + @objc deinit
  17 +}
  1 +// swift-interface-format-version: 1.0
  2 +// swift-compiler-version: Apple Swift version 5.1 (swiftlang-1100.0.270.13 clang-1100.0.33.7)
  3 +// swift-module-flags: -target arm64-apple-ios9.0 -enable-objc-interop -enable-library-evolution -swift-version 5 -enforce-exclusivity=checked -O -module-name HHDoctor_pro
  4 +import Foundation
  5 +@_exported import HHDoctor_pro
  6 +import Swift
  7 +import UIKit
  8 +import WebKit
  9 +import hhVDoctorSDK
  10 +@objc public class HHDoctor : ObjectiveC.NSObject {
  11 + @objc public static let `default`: HHDoctor_pro.HHDoctor
  12 + @objc public func start(sdkProductId: Swift.String, debug: Swift.Bool = true, develop: Swift.Bool = true, title: Swift.String = "视频医生")
  13 + @objc public func callDoctor(_ token: Swift.String, topVC: UIKit.UINavigationController, finished: ((Swift.String?) -> Swift.Void)? = nil)
  14 + @objc public func logout(callback: @escaping ((Swift.String?) -> Swift.Void))
  15 + @objc override dynamic public init()
  16 + @objc deinit
  17 +}
  1 +framework module HHDoctor_pro {
  2 + umbrella header "HHDoctor_pro-umbrella.h"
  3 +
  4 + export *
  5 + module * { export * }
  6 +}
  7 +
  8 +module HHDoctor_pro.Swift {
  9 + header "HHDoctor_pro-Swift.h"
  10 + requires objc
  11 +}
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
  1 +//
  2 +// IMGroupExt.h
  3 +// IMGroupExt
  4 +//
  5 +// Created by tomzhu on 2017/1/23.
  6 +//
  7 +//
  8 +
  9 +#ifndef IMGroupExt_h
  10 +#define IMGroupExt_h
  11 +
  12 +#import "TIMComm+Group.h"
  13 +#import "TIMGroupManager+Ext.h"
  14 +
  15 +#endif /* IMGroupExt_h */
  1 +//
  2 +// IMMessageExt.h
  3 +// IMMessageExt
  4 +//
  5 +// Created by tomzhu on 2016/12/27.
  6 +//
  7 +//
  8 +
  9 +#ifndef ImSDK_h
  10 +#define ImSDK_h
  11 +
  12 +#import "TIMConversation+MsgExt.h"
  13 +#import "TIMMessage+MsgExt.h"
  14 +#import "TIMComm+MsgExt.h"
  15 +#import "TIMManager+MsgExt.h"
  16 +
  17 +#endif /* ImSDK_h */
  1 +//
  2 +// IMSdkComm.h
  3 +// ImSDK
  4 +//
  5 +// Created by bodeng on 10/12/14.
  6 +// Copyright (c) 2014 tencent. All rights reserved.
  7 +//
  8 +
  9 +#ifndef ImSDK_IMSdkComm_h
  10 +#define ImSDK_IMSdkComm_h
  11 +
  12 +@interface OMErrResp : NSObject
  13 +{
  14 + NSString* cmd; // 返回的命令字
  15 + int seq; // 请求包的seq
  16 + NSString* uin; // uin
  17 + int errCode; // 错误码
  18 + NSString* errTips; // error tips
  19 +}
  20 +
  21 +@property(nonatomic,strong) NSString* cmd;
  22 +@property(nonatomic,strong) NSString* uin;
  23 +@property(nonatomic,assign) int seq;
  24 +@property(nonatomic,assign) int errCode;
  25 +@property(nonatomic,strong) NSString* errTips;
  26 +
  27 +@end
  28 +
  29 +
  30 +/// 业务相关回调
  31 +
  32 +/**
  33 + * userid和tinyid 转换回包
  34 + * userList 存储IMUserId结构
  35 + */
  36 +@interface OMUserIdResp : NSObject{
  37 + NSArray* userList; // 用户的登录的open id
  38 +}
  39 +
  40 +
  41 +@property(nonatomic,strong) NSArray* userList;
  42 +
  43 +@end
  44 +
  45 +/**
  46 + * userid转换tinyid回调
  47 + *
  48 + * @param resp 回包结构
  49 + *
  50 + * @return 0 处理成功
  51 + */
  52 +typedef int (^OMUserIdSucc)(OMUserIdResp *resp);
  53 +
  54 +//请求回调
  55 +typedef int (^OMErr)(OMErrResp *resp);
  56 +
  57 +
  58 +/**
  59 + * 音视频回调
  60 + */
  61 +@interface OMCommandResp : NSObject{
  62 + NSData* rspbody;
  63 +}
  64 +
  65 +
  66 +@property(nonatomic,strong) NSData* rspbody;
  67 +
  68 +@end
  69 +
  70 +// relay 回调
  71 +typedef int (^OMCommandSucc)(OMCommandResp *resp);
  72 +
  73 +// request 回调
  74 +typedef void (^OMRequestSucc)(NSData * data);
  75 +typedef void (^OMRequsetFail)(int code, NSString* msg);
  76 +
  77 +/**
  78 + * UserId 结构,表示一个用户的账号信息
  79 + */
  80 +@interface IMUserId : NSObject{
  81 + NSString* uidtype; // uid 类型
  82 + unsigned int userappid;
  83 + NSString* userid; // 用户id
  84 + unsigned long long tinyid;
  85 + unsigned long long uin;
  86 +}
  87 +
  88 +@property(nonatomic,strong) NSString* uidtype;
  89 +@property(nonatomic,assign) unsigned int userappid;
  90 +@property(nonatomic,strong) NSString* userid;
  91 +@property(nonatomic,assign) unsigned long long tinyid;
  92 +@property(nonatomic,assign) unsigned long long uin;
  93 +
  94 +@end
  95 +
  96 +/**
  97 + * 一般多人音视频操作成功回调
  98 + */
  99 +typedef void (^OMMultiSucc)();
  100 +
  101 +/**
  102 + * 一般多人音视频操作失败回调
  103 + *
  104 + * @param code 错误码
  105 + * @param err 错误描述
  106 + */
  107 +typedef void (^OMMultiFail)(int code, NSString * err);
  108 +
  109 +#endif
  1 +//
  2 +// ImSDK.h
  3 +// ImSDK
  4 +//
  5 +// Created by bodeng on 24/3/15.
  6 +// Copyright (c) 2015 tencent. All rights reserved.
  7 +//
  8 +
  9 +#ifndef ImSDK_ImSDK_h
  10 +#define ImSDK_ImSDK_h
  11 +
  12 +#import "TIMComm.h"
  13 +#import "TIMManager.h"
  14 +#import "TIMMessage.h"
  15 +#import "TIMConversation.h"
  16 +#import "TIMGroupManager.h"
  17 +#import "TIMCallback.h"
  18 +#import "TIMFriendshipManager.h"
  19 +#import "IMSdkComm.h"
  20 +#import "TIMErrorCode.h"
  21 +#import "IMGroupExt.h"
  22 +#import "IMMessageExt.h"
  23 +
  24 +#endif
  1 +//
  2 +// TIMCallback.h
  3 +// ImSDK
  4 +//
  5 +// Created by bodeng on 30/3/15.
  6 +// Copyright (c) 2015 tencent. All rights reserved.
  7 +//
  8 +
  9 +#ifndef ImSDK_TIMCallback_h
  10 +#define ImSDK_TIMCallback_h
  11 +
  12 +#import "TIMComm.h"
  13 +
  14 +@class TIMMessage;
  15 +@class TIMGroupTipsElem;
  16 +@class TIMGroupInfo;
  17 +@class TIMSNSChangeInfo;
  18 +@class TIMFriendPendencyInfo;
  19 +
  20 +/**
  21 + * 连接通知回调
  22 + */
  23 +@protocol TIMConnListener <NSObject>
  24 +@optional
  25 +
  26 +/**
  27 + * 网络连接成功
  28 + */
  29 +- (void)onConnSucc;
  30 +
  31 +/**
  32 + * 网络连接失败
  33 + *
  34 + * @param code 错误码
  35 + * @param err 错误描述
  36 + */
  37 +- (void)onConnFailed:(int)code err:(NSString*)err;
  38 +
  39 +/**
  40 + * 网络连接断开(断线只是通知用户,不需要重新登陆,重连以后会自动上线)
  41 + *
  42 + * @param code 错误码
  43 + * @param err 错误描述
  44 + */
  45 +- (void)onDisconnect:(int)code err:(NSString*)err;
  46 +
  47 +
  48 +/**
  49 + * 连接中
  50 + */
  51 +- (void)onConnecting;
  52 +
  53 +@end
  54 +
  55 +
  56 +/**
  57 + * 用户在线状态通知
  58 + */
  59 +@protocol TIMUserStatusListener <NSObject>
  60 +@optional
  61 +/**
  62 + * 踢下线通知
  63 + */
  64 +- (void)onForceOffline;
  65 +
  66 +/**
  67 + * 断线重连失败
  68 + */
  69 +- (void)onReConnFailed:(int)code err:(NSString*)err;
  70 +
  71 +/**
  72 + * 用户登录的userSig过期(用户需要重新获取userSig后登录)
  73 + */
  74 +- (void)onUserSigExpired;
  75 +@end
  76 +
  77 +/**
  78 + * 页面刷新接口(如有需要未读计数刷新,会话列表刷新等)
  79 + */
  80 +@protocol TIMRefreshListener <NSObject>
  81 +@optional
  82 +/**
  83 + * 刷新会话
  84 + */
  85 +- (void)onRefresh;
  86 +
  87 +/**
  88 + * 刷新部分会话(包括多终端已读上报同步)
  89 + *
  90 + * @param conversations 会话(TIMConversation*)列表
  91 + */
  92 +- (void)onRefreshConversations:(NSArray*)conversations;
  93 +@end
  94 +
  95 +/**
  96 + * 消息回调
  97 + */
  98 +@protocol TIMMessageListener <NSObject>
  99 +@optional
  100 +/**
  101 + * 新消息回调通知
  102 + *
  103 + * @param msgs 新消息列表,TIMMessage 类型数组
  104 + */
  105 +- (void)onNewMessage:(NSArray*)msgs;
  106 +@end
  107 +
  108 +@protocol TIMMessageReceiptListener <NSObject>
  109 +@optional
  110 +/**
  111 + * 收到了已读回执
  112 + *
  113 + * @param receipts 已读回执(TIMMessageReceipt*)列表
  114 + */
  115 +- (void) onRecvMessageReceipts:(NSArray*)receipts;
  116 +@end
  117 +
  118 +/**
  119 + * 消息修改回调
  120 + */
  121 +@protocol TIMMessageUpdateListener <NSObject>
  122 +@optional
  123 +/**
  124 + * 消息修改通知
  125 + *
  126 + * @param msgs 修改的消息列表,TIMMessage 类型数组
  127 + */
  128 +- (void)onMessageUpdate:(NSArray*) msgs;
  129 +@end
  130 +
  131 +
  132 +@protocol TIMMessageRevokeListener <NSObject>
  133 +@optional
  134 +/**
  135 + * 消息撤回通知
  136 + *
  137 + * @param locator 被撤回消息的标识
  138 + */
  139 +- (void)onRevokeMessage:(TIMMessageLocator*)locator;
  140 +
  141 +@end
  142 +
  143 +/**
  144 + * 图片上传进度回调
  145 + */
  146 +@protocol TIMUploadProgressListener <NSObject>
  147 +@optional
  148 +/**
  149 + * 上传进度回调
  150 + *
  151 + * @param msg 正在上传的消息
  152 + * @param elemidx 正在上传的elem的索引
  153 + * @param taskid 任务id
  154 + * @param progress 上传进度
  155 + */
  156 +- (void)onUploadProgressCallback:(TIMMessage*)msg elemidx:(uint32_t)elemidx taskid:(uint32_t)taskid progress:(uint32_t)progress;
  157 +@end
  158 +
  159 +/**
  160 + * 群事件通知回调
  161 + */
  162 +@protocol TIMGroupEventListener <NSObject>
  163 +@optional
  164 +/**
  165 + * 群tips回调
  166 + *
  167 + * @param elem 群tips消息
  168 + */
  169 +- (void)onGroupTipsEvent:(TIMGroupTipsElem*)elem;
  170 +@end
  171 +
  172 +/**
  173 + * 好友代理事件回调
  174 + */
  175 +@protocol TIMFriendshipListener <NSObject>
  176 +@optional
  177 +
  178 +/**
  179 + * 添加好友通知
  180 + *
  181 + * @param users 好友列表(NSString*)
  182 + */
  183 +- (void)onAddFriends:(NSArray*)users;
  184 +
  185 +/**
  186 + * 删除好友通知
  187 + *
  188 + * @param identifiers 用户id列表(NSString*)
  189 + */
  190 +- (void)onDelFriends:(NSArray*)identifiers;
  191 +
  192 +/**
  193 + * 好友资料更新通知
  194 + *
  195 + * @param profiles 资料列表(TIMSNSChangeInfo *)
  196 + */
  197 +- (void)onFriendProfileUpdate:(NSArray<TIMSNSChangeInfo *> *)profiles;
  198 +
  199 +/**
  200 + * 好友申请通知
  201 + *
  202 + * @param reqs 好友申请者id列表(TIMFriendPendencyInfo *)
  203 + */
  204 +- (void)onAddFriendReqs:(NSArray<TIMFriendPendencyInfo *> *)reqs;
  205 +
  206 +@end
  207 +
  208 +#endif
  1 +//
  2 +// TIMComm+Group.h
  3 +// IMGroupExt
  4 +//
  5 +// Created by tomzhu on 2017/2/9.
  6 +//
  7 +//
  8 +
  9 +#ifndef TIMComm_Group_h
  10 +#define TIMComm_Group_h
  11 +
  12 +#import "TIMComm.h"
  13 +
  14 +@class TIMGroupPendencyMeta;
  15 +
  16 +#pragma mark - 枚举类型
  17 +
  18 +/**
  19 + * 群基本获取资料标志
  20 + */
  21 +typedef NS_ENUM(NSInteger, TIMGetGroupBaseInfoFlag) {
  22 + /**
  23 + * 不获取群组资料
  24 + */
  25 + TIM_GET_GROUP_BASE_INFO_FLAG_NONE = 0x00,
  26 + /**
  27 + * 获取群组名
  28 + */
  29 + TIM_GET_GROUP_BASE_INFO_FLAG_NAME = 0x01,
  30 + /**
  31 + * 获取创建时间
  32 + */
  33 + TIM_GET_GROUP_BASE_INFO_FLAG_CREATE_TIME = 0x01 << 1,
  34 + /**
  35 + * 获取群主id
  36 + */
  37 + TIM_GET_GROUP_BASE_INFO_FLAG_OWNER_UIN = 0x01 << 2,
  38 + /**
  39 + * (不可用)
  40 + */
  41 + TIM_GET_GROUP_BASE_INFO_FLAG_SEQ = 0x01 << 3,
  42 + /**
  43 + * 获取最近一次修改群信息时间
  44 + */
  45 + TIM_GET_GROUP_BASE_INFO_FLAG_TIME = 0x01 << 4,
  46 + /**
  47 + * (不可用)
  48 + */
  49 + TIM_GET_GROUP_BASE_INFO_FLAG_NEXT_MSG_SEQ = 0x01 << 5,
  50 + /**
  51 + * 获取最近一次发消息时间
  52 + */
  53 + TIM_GET_GROUP_BASE_INFO_FLAG_LAST_MSG_TIME = 0x01 << 6,
  54 + /**
  55 + * (不可用)
  56 + */
  57 + TIM_GET_GROUP_BASE_INFO_FLAG_APP_ID = 0x01 << 7,
  58 + /**
  59 + * 获取群成员数量
  60 + */
  61 + TIM_GET_GROUP_BASE_INFO_FLAG_MEMBER_NUM = 0x01 << 8,
  62 + /**
  63 + * 获取最大群成员数量
  64 + */
  65 + TIM_GET_GROUP_BASE_INFO_FLAG_MAX_MEMBER_NUM = 0x01 << 9,
  66 + /**
  67 + * 获取群公告
  68 + */
  69 + TIM_GET_GROUP_BASE_INFO_FLAG_NOTIFICATION = 0x01 << 10,
  70 + /**
  71 + * 获取群简介
  72 + */
  73 + TIM_GET_GROUP_BASE_INFO_FLAG_INTRODUCTION = 0x01 << 11,
  74 + /**
  75 + * 获取群头像
  76 + */
  77 + TIM_GET_GROUP_BASE_INFO_FLAG_FACE_URL = 0x01 << 12,
  78 + /**
  79 + * 获取入群类型
  80 + */
  81 + TIM_GET_GROUP_BASE_INFO_FLAG_ADD_OPTION = 0x01 << 13,
  82 + /**
  83 + * 获取群组类型
  84 + */
  85 + TIM_GET_GROUP_BASE_INFO_FLAG_GROUP_TYPE = 0x01 << 14,
  86 + /**
  87 + * 获取最后一条群消息
  88 + */
  89 + TIM_GET_GROUP_BASE_INFO_FLAG_LAST_MSG = 0x01 << 15,
  90 + /**
  91 + * 获取在线人数
  92 + */
  93 + TIM_GET_GROUP_BASE_INFO_FLAG_ONLINE_NUM = 0x01 << 16,
  94 + /**
  95 + * 获取群成员是否可见标志
  96 + */
  97 + TIM_GET_GROUP_BASE_INFO_VISIBLE = 0x01 << 17,
  98 + /**
  99 + * 获取群是否能被搜到标志
  100 + */
  101 + TIM_GET_GROUP_BASE_INFO_SEARCHABLE = 0x01 << 18,
  102 + /**
  103 + * 获取群全员禁言时间
  104 + */
  105 + TIM_GET_GROUP_BASE_INFO_ALL_SHUTUP = 0x01 << 19
  106 +};
  107 +
  108 +/**
  109 + * 群成员角色过滤方式
  110 + */
  111 +typedef NS_ENUM(NSInteger, TIMGroupMemberFilter) {
  112 + /**
  113 + * 全部成员
  114 + */
  115 + TIM_GROUP_MEMBER_FILTER_ALL = 0x00,
  116 + /**
  117 + * 群主
  118 + */
  119 + TIM_GROUP_MEMBER_FILTER_SUPER = 0x01,
  120 + /**
  121 + * 管理员
  122 + */
  123 + TIM_GROUP_MEMBER_FILTER_ADMIN = 0x02,
  124 + /**
  125 + * 普通成员
  126 + */
  127 + TIM_GROUP_MEMBER_FILTER_COMMON = 0x04,
  128 +};
  129 +
  130 +/**
  131 + * 群成员获取资料标志
  132 + */
  133 +typedef NS_ENUM(NSInteger, TIMGetGroupMemInfoFlag) {
  134 +
  135 + /**
  136 + * 入群时间
  137 + */
  138 + TIM_GET_GROUP_MEM_INFO_FLAG_JOIN_TIME = 0x01,
  139 + /**
  140 + * 消息标志
  141 + */
  142 + TIM_GET_GROUP_MEM_INFO_FLAG_MSG_FLAG = 0x01 << 1,
  143 + /**
  144 + * 角色
  145 + */
  146 + TIM_GET_GROUP_MEM_INFO_FLAG_ROLE_INFO = 0x01 << 3,
  147 + /**
  148 + * 禁言时间
  149 + */
  150 + TIM_GET_GROUP_MEM_INFO_FLAG_SHUTUP_TIME = 0x01 << 4,
  151 + /**
  152 + * 群名片
  153 + */
  154 + TIM_GET_GROUP_MEM_INFO_FLAG_NAME_CARD = 0x01 << 5,
  155 +};
  156 +
  157 +/**
  158 + * 群组操作结果
  159 + */
  160 +typedef NS_ENUM(NSInteger, TIMGroupMemberStatus) {
  161 + /**
  162 + * 操作失败
  163 + */
  164 + TIM_GROUP_MEMBER_STATUS_FAIL = 0,
  165 +
  166 + /**
  167 + * 操作成功
  168 + */
  169 + TIM_GROUP_MEMBER_STATUS_SUCC = 1,
  170 +
  171 + /**
  172 + * 无效操作,加群时已经是群成员,移除群组时不在群内
  173 + */
  174 + TIM_GROUP_MEMBER_STATUS_INVALID = 2,
  175 +
  176 + /**
  177 + * 等待处理,邀请入群时等待对方处理
  178 + */
  179 + TIM_GROUP_MEMBER_STATUS_PENDING = 3,
  180 +};
  181 +
  182 +typedef NS_ENUM(NSInteger, TIMGroupPendencyGetType) {
  183 + /**
  184 + * 申请入群
  185 + */
  186 + TIM_GROUP_PENDENCY_GET_TYPE_JOIN = 0x0,
  187 + /**
  188 + * 邀请入群
  189 + */
  190 + TIM_GROUP_PENDENCY_GET_TYPE_INVITE = 0x1,
  191 +};
  192 +
  193 +typedef NS_ENUM(NSInteger, TIMGroupPendencyHandleStatus) {
  194 + /**
  195 + * 未处理
  196 + */
  197 + TIM_GROUP_PENDENCY_HANDLE_STATUS_UNHANDLED = 0,
  198 + /**
  199 + * 被他人处理
  200 + */
  201 + TIM_GROUP_PENDENCY_HANDLE_STATUS_OTHER_HANDLED = 1,
  202 + /**
  203 + * 被用户处理
  204 + */
  205 + TIM_GROUP_PENDENCY_HANDLE_STATUS_OPERATOR_HANDLED = 2,
  206 +};
  207 +
  208 +typedef NS_ENUM(NSInteger, TIMGroupPendencyHandleResult) {
  209 + /**
  210 + * 拒绝申请
  211 + */
  212 + TIM_GROUP_PENDENCY_HANDLE_RESULT_REFUSE = 0,
  213 + /**
  214 + * 同意申请
  215 + */
  216 + TIM_GROUP_PENDENCY_HANDLE_RESULT_AGREE = 1,
  217 +};
  218 +
  219 +#pragma mark - block回调
  220 +
  221 +/**
  222 + * 群成员列表回调
  223 + *
  224 + * @param members 群成员列表,成员类型 TIMGroupMemberInfo
  225 + */
  226 +typedef void (^TIMGroupMemberSucc)(NSArray * members);
  227 +
  228 +/**
  229 + * 群列表回调
  230 + *
  231 + * @param arr 群列表,成员类型 TIMGroupInfo
  232 + */
  233 +typedef void (^TIMGroupListSucc)(NSArray * arr);
  234 +
  235 +/**
  236 + * 本人群组内成员信息回调
  237 + *
  238 + * @param selfInfo 本人成员信息
  239 + */
  240 +typedef void (^TIMGroupSelfSucc)(TIMGroupMemberInfo * selfInfo);
  241 +
  242 +/**
  243 + * 群接受消息选项回调
  244 + *
  245 + * @param opt 群接受消息选项
  246 + */
  247 +typedef void (^TIMGroupReciveMessageOptSucc)(TIMGroupReceiveMessageOpt opt);
  248 +
  249 +/**
  250 + * 群成员列表回调(分页使用)
  251 + *
  252 + * @param members 群成员(TIMGroupMemberInfo*)列表
  253 + */
  254 +typedef void (^TIMGroupMemberSuccV2)(uint64_t nextSeq, NSArray * members);
  255 +
  256 +/**
  257 + * 群搜索回调
  258 + *
  259 + * @param totalNum 搜索结果的总数
  260 + * @param groups 请求的群列表片段
  261 + */
  262 +typedef void (^TIMGroupSearchSucc)(uint64_t totalNum, NSArray * groups);
  263 +
  264 +/**
  265 + * 获取群组未决请求列表成功
  266 + *
  267 + * @param meta 未决请求元信息
  268 + * @param pendencies 未决请求列表(TIMGroupPendencyItem)数组
  269 + */
  270 +typedef void (^TIMGetGroupPendencyListSucc)(TIMGroupPendencyMeta * meta, NSArray * pendencies);
  271 +
  272 +#pragma mark - 基本类型
  273 +
  274 +/**
  275 + * 创建群参数
  276 + */
  277 +@interface TIMCreateGroupInfo : TIMCodingModel
  278 +
  279 +/**
  280 + * 群组Id,nil则使用系统默认Id
  281 + */
  282 +@property(nonatomic,strong) NSString* group;
  283 +
  284 +/**
  285 + * 群名
  286 + */
  287 +@property(nonatomic,strong) NSString* groupName;
  288 +
  289 +/**
  290 + * 群类型:Private,Public,ChatRoom,AVChatRoom,BChatRoom
  291 + */
  292 +@property(nonatomic,strong) NSString* groupType;
  293 +
  294 +/**
  295 + * 是否设置入群选项,Private类型群组请设置为false
  296 + */
  297 +@property(nonatomic,assign) BOOL setAddOpt;
  298 +
  299 +/**
  300 + * 入群选项
  301 + */
  302 +@property(nonatomic,assign) TIMGroupAddOpt addOpt;
  303 +
  304 +/**
  305 + * 最大成员数,填0则系统使用默认值
  306 + */
  307 +@property(nonatomic,assign) uint32_t maxMemberNum;
  308 +
  309 +/**
  310 + * 群公告
  311 + */
  312 +@property(nonatomic,strong) NSString* notification;
  313 +
  314 +/**
  315 + * 群简介
  316 + */
  317 +@property(nonatomic,strong) NSString* introduction;
  318 +
  319 +/**
  320 + * 群头像
  321 + */
  322 +@property(nonatomic,strong) NSString* faceURL;
  323 +
  324 +/**
  325 + * 自定义字段集合,key是NSString*类型,value是NSData*类型
  326 + */
  327 +@property(nonatomic,strong) NSDictionary* customInfo;
  328 +
  329 +/**
  330 + * 创建成员(TIMCreateGroupMemberInfo*)列表
  331 + */
  332 +@property(nonatomic,strong) NSArray* membersInfo;
  333 +
  334 +@end
  335 +
  336 +/**
  337 + * 未决请求选项
  338 + */
  339 +@interface TIMGroupPendencyOption : TIMCodingModel
  340 +
  341 +/**
  342 + * 拉取的起始时间 0:拉取最新的
  343 + */
  344 +@property(nonatomic,assign) uint64_t timestamp;
  345 +
  346 +/**
  347 + * 每页的数量
  348 + */
  349 +@property(nonatomic,assign) uint32_t numPerPage;
  350 +@end
  351 +
  352 +/**
  353 + * 未决请求元信息
  354 + */
  355 +@interface TIMGroupPendencyMeta : TIMCodingModel
  356 +
  357 +/**
  358 + * 下一次拉取的起始时间戳
  359 + */
  360 +@property(nonatomic,assign) uint64_t nextStartTime;
  361 +
  362 +/**
  363 + * 已读时间戳大小
  364 + */
  365 +@property(nonatomic,assign) uint64_t readTimeSeq;
  366 +
  367 +/**
  368 + * 未决未读数
  369 + */
  370 +@property(nonatomic,assign) uint32_t unReadCnt;
  371 +
  372 +@end
  373 +
  374 +/**
  375 + * 创建群组时的成员信息
  376 + */
  377 +@interface TIMCreateGroupMemberInfo : TIMCodingModel
  378 +
  379 +/**
  380 + * 被操作成员
  381 + */
  382 +@property(nonatomic,strong) NSString* member;
  383 +
  384 +/**
  385 + * 成员类型
  386 + */
  387 +@property(nonatomic,assign) TIMGroupMemberRole role;
  388 +
  389 +/**
  390 + * 自定义字段集合,key是NSString*类型,value是NSData*类型
  391 + */
  392 +@property(nonatomic,strong) NSDictionary* customInfo;
  393 +
  394 +@end
  395 +
  396 +/**
  397 + * 成员操作返回值
  398 + */
  399 +@interface TIMGroupMemberResult : NSObject
  400 +
  401 +/**
  402 + * 被操作成员
  403 + */
  404 +@property(nonatomic,strong) NSString* member;
  405 +/**
  406 + * 返回状态
  407 + */
  408 +@property(nonatomic,assign) TIMGroupMemberStatus status;
  409 +
  410 +@end
  411 +
  412 +/**
  413 + * 未决申请
  414 + */
  415 +@interface TIMGroupPendencyItem : TIMCodingModel
  416 +
  417 +/**
  418 + * 相关群组id
  419 + */
  420 +@property(nonatomic,strong) NSString* groupId;
  421 +
  422 +/**
  423 + * 请求者id,请求加群:请求者,邀请加群:邀请人
  424 + */
  425 +@property(nonatomic,strong) NSString* fromUser;
  426 +
  427 +/**
  428 + * 判决者id,请求加群:0,邀请加群:被邀请人
  429 + */
  430 +@property(nonatomic,strong) NSString* toUser;
  431 +
  432 +/**
  433 + * 未决添加时间
  434 + */
  435 +@property(nonatomic,assign) uint64_t addTime;
  436 +
  437 +/**
  438 + * 未决请求类型
  439 + */
  440 +@property(nonatomic,assign) TIMGroupPendencyGetType getType;
  441 +
  442 +/**
  443 + * 已决标志
  444 + */
  445 +@property(nonatomic,assign) TIMGroupPendencyHandleStatus handleStatus;
  446 +
  447 +/**
  448 + * 已决结果
  449 + */
  450 +@property(nonatomic,assign) TIMGroupPendencyHandleResult handleResult;
  451 +
  452 +/**
  453 + * 申请或邀请附加信息
  454 + */
  455 +@property(nonatomic,strong) NSString* requestMsg;
  456 +
  457 +/**
  458 + * 审批信息:同意或拒绝信息
  459 + */
  460 +@property(nonatomic,strong) NSString* handledMsg;
  461 +
  462 +
  463 +/**
  464 + * 同意申请
  465 + *
  466 + * @param msg 同意理由,选填
  467 + * @param succ 成功回调
  468 + * @param fail 失败回调,返回错误码和错误描述
  469 + */
  470 +-(void) accept:(NSString*)msg succ:(TIMSucc)succ fail:(TIMFail)fail;
  471 +
  472 +/**
  473 + * 拒绝申请
  474 + *
  475 + * @param msg 拒绝理由,选填
  476 + * @param succ 成功回调
  477 + * @param fail 失败回调,返回错误码和错误描述
  478 + */
  479 +-(void) refuse:(NSString*)msg succ:(TIMSucc)succ fail:(TIMFail)fail;
  480 +
  481 +
  482 +/**
  483 + * 用户自己的id
  484 + */
  485 +@property(nonatomic,strong) NSString* selfIdentifier;
  486 +
  487 +@end
  488 +
  489 +#endif /* TIMComm_Group_h */
  1 +//
  2 +// TIMComm+MsgExt.h
  3 +// IMMessageExt
  4 +//
  5 +// Created by tomzhu on 2017/1/11.
  6 +//
  7 +//
  8 +
  9 +#ifndef TIMComm_MsgExt_h
  10 +#define TIMComm_MsgExt_h
  11 +
  12 +#import <Foundation/Foundation.h>
  13 +#import "TIMComm.h"
  14 +
  15 +@class TIMSendToUsersDetailInfo;
  16 +
  17 +#pragma mark - 枚举类型
  18 +
  19 +typedef NS_ENUM(NSInteger, TIM_SNS_SYSTEM_TYPE){
  20 + /**
  21 + * 增加好友消息
  22 + */
  23 + TIM_SNS_SYSTEM_ADD_FRIEND = 0x01,
  24 + /**
  25 + * 删除好友消息
  26 + */
  27 + TIM_SNS_SYSTEM_DEL_FRIEND = 0x02,
  28 + /**
  29 + * 增加好友申请
  30 + */
  31 + TIM_SNS_SYSTEM_ADD_FRIEND_REQ = 0x03,
  32 + /**
  33 + * 删除未决申请
  34 + */
  35 + TIM_SNS_SYSTEM_DEL_FRIEND_REQ = 0x04,
  36 + /**
  37 + * 黑名单添加
  38 + */
  39 + TIM_SNS_SYSTEM_ADD_BLACKLIST = 0x05,
  40 + /**
  41 + * 黑名单删除
  42 + */
  43 + TIM_SNS_SYSTEM_DEL_BLACKLIST = 0x06,
  44 + /**
  45 + * 未决已读上报
  46 + */
  47 + TIM_SNS_SYSTEM_PENDENCY_REPORT = 0x07,
  48 + /**
  49 + * 关系链资料变更
  50 + */
  51 + TIM_SNS_SYSTEM_SNS_PROFILE_CHANGE = 0x08,
  52 + /**
  53 + * 推荐数据增加
  54 + */
  55 + TIM_SNS_SYSTEM_ADD_RECOMMEND = 0x09,
  56 + /**
  57 + * 推荐数据删除
  58 + */
  59 + TIM_SNS_SYSTEM_DEL_RECOMMEND = 0x0a,
  60 + /**
  61 + * 已决增加
  62 + */
  63 + TIM_SNS_SYSTEM_ADD_DECIDE = 0x0b,
  64 + /**
  65 + * 已决删除
  66 + */
  67 + TIM_SNS_SYSTEM_DEL_DECIDE = 0x0c,
  68 + /**
  69 + * 推荐已读上报
  70 + */
  71 + TIM_SNS_SYSTEM_RECOMMEND_REPORT = 0x0d,
  72 + /**
  73 + * 已决已读上报
  74 + */
  75 + TIM_SNS_SYSTEM_DECIDE_REPORT = 0x0e,
  76 +
  77 +
  78 +};
  79 +
  80 +/**
  81 + * 资料变更
  82 + */
  83 +typedef NS_ENUM(NSInteger, TIM_PROFILE_SYSTEM_TYPE){
  84 + /**
  85 + 好友资料变更
  86 + */
  87 + TIM_PROFILE_SYSTEM_FRIEND_PROFILE_CHANGE = 0x01,
  88 +};
  89 +
  90 +#pragma mark - block回调
  91 +
  92 +typedef void (^TIMSendToUsersFail)(int code, NSString *err, TIMSendToUsersDetailInfo *detailInfo);
  93 +
  94 +#pragma mark - 基本类型
  95 +
  96 +/**
  97 + * 发送消息给多用户的失败回调信息
  98 + */
  99 +@interface TIMSendToUsersDetailInfo : NSObject
  100 +/**
  101 + * 发送消息成功的目标用户数
  102 + */
  103 +@property(nonatomic,assign) uint32_t succCnt;
  104 +/**
  105 + * 发送消息失败的目标用户数
  106 + */
  107 +@property(nonatomic,assign) uint32_t failCnt;
  108 +/**
  109 + * 失败信息(TIMSendToUsersErrInfo*)列表
  110 + */
  111 +@property(nonatomic,strong) NSArray *errInofs;
  112 +@end
  113 +
  114 +/**
  115 + * 发送消息给多用户的失败信息
  116 + */
  117 +@interface TIMSendToUsersErrInfo : NSObject
  118 +/**
  119 + * 发送消息失败的目标用户id
  120 + */
  121 +@property(nonatomic,strong) NSString *identifier;
  122 +/**
  123 + * 错误码
  124 + */
  125 +@property(nonatomic,assign) int code;
  126 +/**
  127 + * 错误描述
  128 + */
  129 +@property(nonatomic,strong) NSString *err;
  130 +@end
  131 +
  132 +/**
  133 + * 关系链变更详细信息
  134 + */
  135 +@interface TIMSNSChangeInfo : NSObject
  136 +
  137 +/**
  138 + * 用户 identifier
  139 + */
  140 +@property(nonatomic,strong) NSString * identifier;
  141 +
  142 +/**
  143 + * 用户昵称
  144 + */
  145 +@property(nonatomic,strong) NSString * nickname;
  146 +
  147 +/**
  148 + * 申请添加时有效,添加理由
  149 + */
  150 +@property(nonatomic,strong) NSString * wording;
  151 +
  152 +/**
  153 + * 申请时填写,添加来源
  154 + */
  155 +@property(nonatomic,strong) NSString * source;
  156 +
  157 +
  158 +/**
  159 + * 备注 type=TIM_SNS_SYSTEM_SNS_PROFILE_CHANGE 有效
  160 + */
  161 +@property(nonatomic,strong) NSString * remark;
  162 +
  163 +@end
  164 +
  165 +#endif /* TIMComm_MsgExt_h */
  1 +//
  2 +// TIMComm.h
  3 +// ImSDK
  4 +//
  5 +// Created by bodeng on 29/1/15.
  6 +// Copyright (c) 2015 tencent. All rights reserved.
  7 +//
  8 +
  9 +#ifndef ImSDK_TIMComm_h
  10 +#define ImSDK_TIMComm_h
  11 +
  12 +#import <Foundation/Foundation.h>
  13 +
  14 +#define ERR_IMSDK_KICKED_BY_OTHERS 6208
  15 +
  16 +@protocol TIMConnListener;
  17 +@protocol TIMUserStatusListener;
  18 +@protocol TIMRefreshListener;
  19 +@protocol TIMMessageReceiptListener;
  20 +@protocol TIMMessageUpdateListener;
  21 +@protocol TIMMessageRevokeListener;
  22 +@protocol TIMUploadProgressListener;
  23 +@protocol TIMGroupEventListener;
  24 +@protocol TIMFriendshipListener;
  25 +//@protocol TIMGroupListener;
  26 +@class TIMMessage;
  27 +@class TIMImageElem;
  28 +@class TIMConversation;
  29 +@class TIMAPNSConfig;
  30 +@class TIMUserProfile;
  31 +@class TIMFriend;
  32 +@class TIMGroupInfoOption;
  33 +@class TIMGroupMemberInfoOption;
  34 +@class TIMFriendProfileOption;
  35 +@class TIMFriendResult;
  36 +
  37 +#pragma mark - 枚举类型
  38 +
  39 +/**
  40 + * 网络连接状态
  41 + */
  42 +typedef NS_ENUM(NSInteger, TIMNetworkStatus) {
  43 + /**
  44 + * 已连接
  45 + */
  46 + TIM_NETWORK_STATUS_CONNECTED = 1,
  47 + /**
  48 + * 链接断开
  49 + */
  50 + TIM_NETWORK_STATUS_DISCONNECTED = 2,
  51 +};
  52 +
  53 +
  54 +/**
  55 + * 日志级别
  56 + */
  57 +typedef NS_ENUM(NSInteger, TIMLogLevel) {
  58 + /**
  59 + * 不输出任何 sdk log
  60 + */
  61 + TIM_LOG_NONE = 0,
  62 + /**
  63 + * 输出 DEBUG,INFO,WARNING,ERROR 级别的 log
  64 + */
  65 + TIM_LOG_DEBUG = 3,
  66 + /**
  67 + * 输出 INFO,WARNING,ERROR 级别的 log
  68 + */
  69 + TIM_LOG_INFO = 4,
  70 + /**
  71 + * 输出 WARNING,ERROR 级别的 log
  72 + */
  73 + TIM_LOG_WARN = 5,
  74 + /**
  75 + * 输出 ERROR 级别的 log
  76 + */
  77 + TIM_LOG_ERROR = 6,
  78 +};
  79 +
  80 +/**
  81 + * 会话类型:
  82 + * C2C 双人聊天
  83 + * GROUP 群聊
  84 + */
  85 +typedef NS_ENUM(NSInteger, TIMConversationType) {
  86 + /**
  87 + * C2C 类型
  88 + */
  89 + TIM_C2C = 1,
  90 +
  91 + /**
  92 + * 群聊 类型
  93 + */
  94 + TIM_GROUP = 2,
  95 +
  96 + /**
  97 + * 系统消息
  98 + */
  99 + TIM_SYSTEM = 3,
  100 +};
  101 +
  102 +/**
  103 + * 消息状态
  104 + */
  105 +typedef NS_ENUM(NSInteger, TIMMessageStatus){
  106 + /**
  107 + * 消息发送中
  108 + */
  109 + TIM_MSG_STATUS_SENDING = 1,
  110 + /**
  111 + * 消息发送成功
  112 + */
  113 + TIM_MSG_STATUS_SEND_SUCC = 2,
  114 + /**
  115 + * 消息发送失败
  116 + */
  117 + TIM_MSG_STATUS_SEND_FAIL = 3,
  118 + /**
  119 + * 消息被删除
  120 + */
  121 + TIM_MSG_STATUS_HAS_DELETED = 4,
  122 + /**
  123 + * 导入到本地的消息
  124 + */
  125 + TIM_MSG_STATUS_LOCAL_STORED = 5,
  126 + /**
  127 + * 被撤销的消息
  128 + */
  129 + TIM_MSG_STATUS_LOCAL_REVOKED = 6,
  130 +};
  131 +
  132 +/**
  133 + * 消息优先级标识
  134 + */
  135 +typedef NS_ENUM(NSInteger, TIMMessagePriority) {
  136 + /**
  137 + * 高优先级,一般为红包或者礼物消息
  138 + */
  139 + TIM_MSG_PRIORITY_HIGH = 1,
  140 + /**
  141 + * 普通优先级,普通消息
  142 + */
  143 + TIM_MSG_PRIORITY_NORMAL = 2,
  144 + /**
  145 + * 低优先级,一般为点赞消息
  146 + */
  147 + TIM_MSG_PRIORITY_LOW = 3,
  148 + /**
  149 + * 最低优先级,一般为后台下发的成员进退群通知
  150 + */
  151 + TIM_MSG_PRIORITY_LOWEST = 4,
  152 +};
  153 +
  154 +/**
  155 + * 图片压缩选项
  156 + */
  157 +typedef NS_ENUM(NSInteger, TIM_IMAGE_COMPRESS_TYPE){
  158 + /**
  159 + * 原图(不压缩)
  160 + */
  161 + TIM_IMAGE_COMPRESS_ORIGIN = 0x00,
  162 + /**
  163 + * 高压缩率:图片较小,默认值
  164 + */
  165 + TIM_IMAGE_COMPRESS_HIGH = 0x01,
  166 + /**
  167 + * 低压缩:高清图发送(图片较大)
  168 + */
  169 + TIM_IMAGE_COMPRESS_LOW = 0x02,
  170 +};
  171 +
  172 +/**
  173 + * 图片类型
  174 + */
  175 +typedef NS_ENUM(NSInteger, TIM_IMAGE_TYPE){
  176 + /**
  177 + * 原图
  178 + */
  179 + TIM_IMAGE_TYPE_ORIGIN = 0x01,
  180 + /**
  181 + * 缩略图
  182 + */
  183 + TIM_IMAGE_TYPE_THUMB = 0x02,
  184 + /**
  185 + * 大图
  186 + */
  187 + TIM_IMAGE_TYPE_LARGE = 0x04,
  188 +};
  189 +
  190 +/**
  191 + * 图片格式
  192 + */
  193 +typedef NS_ENUM(NSInteger, TIM_IMAGE_FORMAT){
  194 + /**
  195 + * JPG 格式
  196 + */
  197 + TIM_IMAGE_FORMAT_JPG = 0x1,
  198 + /**
  199 + * GIF 格式
  200 + */
  201 + TIM_IMAGE_FORMAT_GIF = 0x2,
  202 + /**
  203 + * PNG 格式
  204 + */
  205 + TIM_IMAGE_FORMAT_PNG = 0x3,
  206 + /**
  207 + * BMP 格式
  208 + */
  209 + TIM_IMAGE_FORMAT_BMP = 0x4,
  210 + /**
  211 + * 未知格式
  212 + */
  213 + TIM_IMAGE_FORMAT_UNKNOWN = 0xff,
  214 +};
  215 +
  216 +/**
  217 + * 登录状态
  218 + */
  219 +typedef NS_ENUM(NSInteger, TIMLoginStatus) {
  220 + /**
  221 + * 已登陆
  222 + */
  223 + TIM_STATUS_LOGINED = 1,
  224 +
  225 + /**
  226 + * 登陆中
  227 + */
  228 + TIM_STATUS_LOGINING = 2,
  229 +
  230 + /**
  231 + * 无登陆
  232 + */
  233 + TIM_STATUS_LOGOUT = 3,
  234 +};
  235 +
  236 +/**
  237 + * 群组成员是否可见
  238 + */
  239 +typedef NS_ENUM(NSInteger, TIMGroupMemberVisibleType) {
  240 + /**
  241 + * 未知
  242 + */
  243 + TIM_GROUP_MEMBER_VISIBLE_UNKNOWN = 0x00,
  244 + /**
  245 + * 群组成员不可见
  246 + */
  247 + TIM_GROUP_MEMBER_VISIBLE_NO = 0x01,
  248 + /**
  249 + * 群组成员可见
  250 + */
  251 + TIM_GROUP_MEMBER_VISIBLE_YES = 0x02,
  252 +};
  253 +
  254 +/**
  255 + * 群组是否能被搜到
  256 + */
  257 +typedef NS_ENUM(NSInteger, TIMGroupSearchableType) {
  258 + /**
  259 + * 未知
  260 + */
  261 + TIM_GROUP_SEARCHABLE_UNKNOWN = 0x00,
  262 + /**
  263 + * 群组不能被搜到
  264 + */
  265 + TIM_GROUP_SEARCHABLE_NO = 0x01,
  266 + /**
  267 + * 群组能被搜到
  268 + */
  269 + TIM_GROUP_SEARCHABLE_YES = 0x02,
  270 +};
  271 +
  272 +/**
  273 + * 加群选项
  274 + */
  275 +typedef NS_ENUM(NSInteger, TIMGroupAddOpt) {
  276 + /**
  277 + * 禁止加群
  278 + */
  279 + TIM_GROUP_ADD_FORBID = 0,
  280 +
  281 + /**
  282 + * 需要管理员审批
  283 + */
  284 + TIM_GROUP_ADD_AUTH = 1,
  285 +
  286 + /**
  287 + * 任何人可以加入
  288 + */
  289 + TIM_GROUP_ADD_ANY = 2,
  290 +};
  291 +
  292 +/**
  293 + * 群组提示类型
  294 + */
  295 +typedef NS_ENUM(NSInteger, TIMGroupTipsType){
  296 + /**
  297 + * 成员加入
  298 + */
  299 + TIM_GROUP_TIPS_JOIN = 1,
  300 + /**
  301 + * 成员离开
  302 + */
  303 + TIM_GROUP_TIPS_QUIT = 2,
  304 + /**
  305 + * 成员被踢
  306 + */
  307 + TIM_GROUP_TIPS_KICK = 3,
  308 + /**
  309 + * 成员设置管理员
  310 + */
  311 + TIM_GROUP_TIPS_SET_ADMIN = 4,
  312 + /**
  313 + * 成员取消管理员
  314 + */
  315 + TIM_GROUP_TIPS_CANCEL_ADMIN = 5,
  316 +};
  317 +
  318 +/**
  319 + * 群消息接受选项
  320 + */
  321 +typedef NS_ENUM(NSInteger, TIMGroupReceiveMessageOpt) {
  322 + /**
  323 + * 接收消息
  324 + */
  325 + TIM_GROUP_RECEIVE_MESSAGE = 0,
  326 + /**
  327 + * 不接收消息,服务器不进行转发
  328 + */
  329 + TIM_GROUP_NOT_RECEIVE_MESSAGE = 1,
  330 + /**
  331 + * 接受消息,不进行 iOS APNs 推送
  332 + */
  333 + TIM_GROUP_RECEIVE_NOT_NOTIFY_MESSAGE = 2,
  334 +};
  335 +
  336 +/**
  337 + * 群 Tips 类型
  338 + */
  339 +typedef NS_ENUM(NSInteger, TIM_GROUP_TIPS_TYPE){
  340 + /**
  341 + * 邀请加入群 (opUser & groupName & userList)
  342 + */
  343 + TIM_GROUP_TIPS_TYPE_INVITE = 0x01,
  344 + /**
  345 + * 退出群 (opUser & groupName & userList)
  346 + */
  347 + TIM_GROUP_TIPS_TYPE_QUIT_GRP = 0x02,
  348 + /**
  349 + * 踢出群 (opUser & groupName & userList)
  350 + */
  351 + TIM_GROUP_TIPS_TYPE_KICKED = 0x03,
  352 + /**
  353 + * 设置管理员 (opUser & groupName & userList)
  354 + */
  355 + TIM_GROUP_TIPS_TYPE_SET_ADMIN = 0x04,
  356 + /**
  357 + * 取消管理员 (opUser & groupName & userList)
  358 + */
  359 + TIM_GROUP_TIPS_TYPE_CANCEL_ADMIN = 0x05,
  360 + /**
  361 + * 群资料变更 (opUser & groupName & introduction & notification & faceUrl & owner)
  362 + */
  363 + TIM_GROUP_TIPS_TYPE_INFO_CHANGE = 0x06,
  364 + /**
  365 + * 群成员资料变更 (opUser & groupName & memberInfoList)
  366 + */
  367 + TIM_GROUP_TIPS_TYPE_MEMBER_INFO_CHANGE = 0x07,
  368 +};
  369 +
  370 +/**
  371 + * 群变更信息 Tips 类型
  372 + */
  373 +typedef NS_ENUM(NSInteger, TIM_GROUP_INFO_CHANGE_TYPE){
  374 + /**
  375 + * 群名修改
  376 + */
  377 + TIM_GROUP_INFO_CHANGE_GROUP_NAME = 0x01,
  378 + /**
  379 + * 群简介修改
  380 + */
  381 + TIM_GROUP_INFO_CHANGE_GROUP_INTRODUCTION = 0x02,
  382 + /**
  383 + * 群公告修改
  384 + */
  385 + TIM_GROUP_INFO_CHANGE_GROUP_NOTIFICATION = 0x03,
  386 + /**
  387 + * 群头像修改
  388 + */
  389 + TIM_GROUP_INFO_CHANGE_GROUP_FACE = 0x04,
  390 + /**
  391 + * 群主变更
  392 + */
  393 + TIM_GROUP_INFO_CHANGE_GROUP_OWNER = 0x05,
  394 +};
  395 +
  396 +/**
  397 + * 群系统消息类型
  398 + */
  399 +typedef NS_ENUM(NSInteger, TIM_GROUP_SYSTEM_TYPE){
  400 + /**
  401 + * 申请加群请求(只有管理员会收到)
  402 + */
  403 + TIM_GROUP_SYSTEM_ADD_GROUP_REQUEST_TYPE = 0x01,
  404 + /**
  405 + * 申请加群被同意(只有申请人能够收到)
  406 + */
  407 + TIM_GROUP_SYSTEM_ADD_GROUP_ACCEPT_TYPE = 0x02,
  408 + /**
  409 + * 申请加群被拒绝(只有申请人能够收到)
  410 + */
  411 + TIM_GROUP_SYSTEM_ADD_GROUP_REFUSE_TYPE = 0x03,
  412 + /**
  413 + * 被管理员踢出群(只有被踢的人能够收到)
  414 + */
  415 + TIM_GROUP_SYSTEM_KICK_OFF_FROM_GROUP_TYPE = 0x04,
  416 + /**
  417 + * 群被解散(全员能够收到)
  418 + */
  419 + TIM_GROUP_SYSTEM_DELETE_GROUP_TYPE = 0x05,
  420 + /**
  421 + * 创建群消息(创建者能够收到)
  422 + */
  423 + TIM_GROUP_SYSTEM_CREATE_GROUP_TYPE = 0x06,
  424 + /**
  425 + * 邀请入群通知(被邀请者能够收到)
  426 + */
  427 + TIM_GROUP_SYSTEM_INVITED_TO_GROUP_TYPE = 0x07,
  428 + /**
  429 + * 主动退群(主动退群者能够收到)
  430 + */
  431 + TIM_GROUP_SYSTEM_QUIT_GROUP_TYPE = 0x08,
  432 + /**
  433 + * 设置管理员(被设置者接收)
  434 + */
  435 + TIM_GROUP_SYSTEM_GRANT_ADMIN_TYPE = 0x09,
  436 + /**
  437 + * 取消管理员(被取消者接收)
  438 + */
  439 + TIM_GROUP_SYSTEM_CANCEL_ADMIN_TYPE = 0x0a,
  440 + /**
  441 + * 群已被回收(全员接收)
  442 + */
  443 + TIM_GROUP_SYSTEM_REVOKE_GROUP_TYPE = 0x0b,
  444 + /**
  445 + * 邀请入群请求(被邀请者接收)
  446 + */
  447 + TIM_GROUP_SYSTEM_INVITE_TO_GROUP_REQUEST_TYPE = 0x0c,
  448 + /**
  449 + * 邀请加群被同意(只有发出邀请者会接收到)
  450 + */
  451 + TIM_GROUP_SYSTEM_INVITE_TO_GROUP_ACCEPT_TYPE = 0x0d,
  452 + /**
  453 + * 邀请加群被拒绝(只有发出邀请者会接收到)
  454 + */
  455 + TIM_GROUP_SYSTEM_INVITE_TO_GROUP_REFUSE_TYPE = 0x0e,
  456 + /**
  457 + * 用户自定义通知(默认全员接收)
  458 + */
  459 + TIM_GROUP_SYSTEM_CUSTOM_INFO = 0xff,
  460 +};
  461 +
  462 +/**
  463 + * 推送规则
  464 + */
  465 +typedef NS_ENUM(NSInteger, TIMOfflinePushFlag) {
  466 + /**
  467 + * 按照默认规则进行推送
  468 + */
  469 + TIM_OFFLINE_PUSH_DEFAULT = 0,
  470 + /**
  471 + * 不进行推送
  472 + */
  473 + TIM_OFFLINE_PUSH_NO_PUSH = 1,
  474 +};
  475 +
  476 +/**
  477 + * 安卓离线推送模式
  478 + */
  479 +typedef NS_ENUM(NSInteger, TIMAndroidOfflinePushNotifyMode) {
  480 + /**
  481 + * 通知栏消息
  482 + */
  483 + TIM_ANDROID_OFFLINE_PUSH_NOTIFY_MODE_NOTIFICATION = 0x00,
  484 + /**
  485 + * 不弹窗,由应用自行处理
  486 + */
  487 + TIM_ANDROID_OFFLINE_PUSH_NOTIFY_MODE_CUSTOM = 0x01,
  488 +};
  489 +
  490 +/**
  491 + * 群成员角色
  492 + */
  493 +typedef NS_ENUM(NSInteger, TIMGroupMemberRole) {
  494 + /**
  495 + * 未定义(没有获取该字段)
  496 + */
  497 + TIM_GROUP_MEMBER_UNDEFINED = 0,
  498 +
  499 + /**
  500 + * 群成员
  501 + */
  502 + TIM_GROUP_MEMBER_ROLE_MEMBER = 200,
  503 +
  504 + /**
  505 + * 群管理员
  506 + */
  507 + TIM_GROUP_MEMBER_ROLE_ADMIN = 300,
  508 +
  509 + /**
  510 + * 群主
  511 + */
  512 + TIM_GROUP_MEMBER_ROLE_SUPER = 400,
  513 +};
  514 +
  515 +/**
  516 + * 好友验证方式
  517 + */
  518 +typedef NS_ENUM(NSInteger, TIMFriendAllowType) {
  519 + /**
  520 + * 同意任何用户加好友
  521 + */
  522 + TIM_FRIEND_ALLOW_ANY = 0,
  523 +
  524 + /**
  525 + * 需要验证
  526 + */
  527 + TIM_FRIEND_NEED_CONFIRM = 1,
  528 +
  529 + /**
  530 + * 拒绝任何人加好友
  531 + */
  532 + TIM_FRIEND_DENY_ANY = 2,
  533 +};
  534 +
  535 +/**
  536 + * 性别
  537 + */
  538 +typedef NS_ENUM(NSInteger, TIMGender) {
  539 + /**
  540 + * 未知性别
  541 + */
  542 + TIM_GENDER_UNKNOWN = 0,
  543 + /**
  544 + * 男性
  545 + */
  546 + TIM_GENDER_MALE = 1,
  547 + /**
  548 + * 女性
  549 + */
  550 + TIM_GENDER_FEMALE = 2,
  551 +
  552 +};
  553 +
  554 +
  555 +#pragma mark - block 回调
  556 +
  557 +/**
  558 + * 获取消息回调
  559 + *
  560 + * @param msgs 消息列表
  561 + */
  562 +typedef void (^TIMGetMsgSucc)(NSArray * msgs);
  563 +
  564 +/**
  565 + * 一般操作成功回调
  566 + */
  567 +typedef void (^TIMSucc)(void);
  568 +
  569 +/**
  570 + * 操作失败回调
  571 + *
  572 + * @param code 错误码
  573 + * @param msg 错误描述,配合错误码使用,如果问题建议打印信息定位
  574 + */
  575 +typedef void (^TIMFail)(int code, NSString * msg);
  576 +
  577 +/**
  578 + * 进度毁掉
  579 + *
  580 + * @param curSize 已下载大小
  581 + * @param totalSize 总大小
  582 + */
  583 +typedef void (^TIMProgress)(NSInteger curSize, NSInteger totalSize);
  584 +
  585 +/**
  586 + * 登陆成功回调
  587 + */
  588 +typedef void (^TIMLoginSucc)(void);
  589 +
  590 +/**
  591 + * 获取资源
  592 + *
  593 + * @param data 资源二进制
  594 + */
  595 +typedef void (^TIMGetResourceSucc)(NSData * data);
  596 +
  597 +/**
  598 + * 日志回调
  599 + *
  600 + * @param lvl 输出的日志级别
  601 + * @param msg 日志内容
  602 + */
  603 +typedef void (^TIMLogFunc)(TIMLogLevel lvl, NSString * msg);
  604 +
  605 +/**
  606 + * 上传图片成功回调
  607 + *
  608 + * @param elem 上传图片成功后 elem
  609 + */
  610 +typedef void (^TIMUploadImageSucc)(TIMImageElem * elem);
  611 +
  612 +/**
  613 + * APNs 推送配置更新成功回调
  614 + *
  615 + * @param config 配置
  616 + */
  617 +typedef void (^TIMAPNSConfigSucc)(TIMAPNSConfig* config);
  618 +
  619 +/**
  620 + * 群创建成功
  621 + *
  622 + * @param groupId 群组 Id
  623 + */
  624 +typedef void (^TIMCreateGroupSucc)(NSString * groupId);
  625 +
  626 +/**
  627 + * 好友列表
  628 + *
  629 + * @param friends 好友列表
  630 + */
  631 +typedef void (^TIMFriendArraySucc)(NSArray<TIMFriend *> *friends);
  632 +
  633 +/**
  634 + * 获取资料回调
  635 + *
  636 + * @param profile 资料
  637 + */
  638 +typedef void (^TIMGetProfileSucc)(TIMUserProfile * profile);
  639 +
  640 +/**
  641 + * 获取资料回调
  642 + *
  643 + * @param profiles 资料
  644 + */
  645 +typedef void (^TIMUserProfileArraySucc)(NSArray<TIMUserProfile *> *profiles);
  646 +
  647 +/**
  648 + * 好友操作回调
  649 + *
  650 + * @param result 资料
  651 + */
  652 +typedef void (^TIMFriendResultSucc)(TIMFriendResult *result);
  653 +
  654 +/**
  655 + * 好友操作回调
  656 + *
  657 + * @param results 资料
  658 + */
  659 +typedef void (^TIMFriendResultArraySucc)(NSArray<TIMFriendResult *> *results);
  660 +
  661 +#pragma mark - 基本类型
  662 +
  663 +/// 实现 NSCoding 协议
  664 +@interface TIMCodingModel : NSObject <NSCoding>
  665 +
  666 +///读取实例变量,并把这些数据写到 coder 中去,序列化数据
  667 +- (void)encodeWithCoder:(NSCoder *)encoder;
  668 +
  669 +///从 coder 中读取数据,保存到相应的变量中,即反序列化数据
  670 +- (id)initWithCoder:(NSCoder *)decoder;
  671 +
  672 +@end
  673 +
  674 +/// 初始化 SDK 配置信息
  675 +@interface TIMSdkConfig : NSObject
  676 +
  677 +///用户标识接入 SDK 的应用 ID,必填
  678 +@property(nonatomic,assign) int sdkAppId;
  679 +
  680 +///用户的账号类型,必填
  681 +@property(nonatomic,strong) NSString * accountType;
  682 +
  683 +///禁用 crash 上报,默认上报 (方法已废弃,客户需要自己集成 Crash 上报逻辑)
  684 +@property(nonatomic,assign) BOOL disableCrashReport DEPRECATED_ATTRIBUTE;
  685 +
  686 +///禁止在控制台打印 log
  687 +@property(nonatomic,assign) BOOL disableLogPrint;
  688 +
  689 +///本地写 log 文件的等级,默认 DEBUG 等级
  690 +@property(nonatomic,assign) TIMLogLevel logLevel;
  691 +
  692 +///log 文件路径,不设置时为默认路径
  693 +@property(nonatomic,strong) NSString * logPath;
  694 +
  695 +///回调给 log 函数的 log 等级,默认 DEBUG 等级
  696 +@property(nonatomic,assign) TIMLogLevel logFuncLevel;
  697 +
  698 +///log 监听函数
  699 +@property(nonatomic,copy) TIMLogFunc logFunc;
  700 +
  701 +///消息数据库路径,不设置时为默认路径
  702 +@property(nonatomic,strong) NSString * dbPath;
  703 +
  704 +///网络监听器
  705 +@property(nonatomic,strong) id<TIMConnListener> connListener;
  706 +
  707 +@end
  708 +
  709 +/// 设置用户配置信息
  710 +@interface TIMUserConfig : NSObject
  711 +
  712 +///禁用本地存储(暂未实现)
  713 +//@property(nonatomic,assign) BOOL disableStorage;
  714 +
  715 +///禁止消息已读自动上报,一旦禁用自动上报,需要开发者显式调用 setReadMessage ,详情请参考官网文档 [未读消息计数](https://cloud.tencent.com/document/product/269/9151)
  716 +@property(nonatomic,assign) BOOL disableAutoReport;
  717 +
  718 +///开启 C2C 已读回执,只针对 C2C 消息生效,用户开启已读回执功能后,对方调用 setReadMessage 时会同步已读信息到本客户端,您可以在 TIMMessageReceiptListener 监听消息已读回执
  719 +@property(nonatomic,assign) BOOL enableReadReceipt;
  720 +
  721 +///不开启最近联系人(暂未实现)
  722 +//@property(nonatomic,assign) BOOL disableRecnetContact;
  723 +
  724 +///不通过 onNewMessage: 抛出最近联系人的最后一条消息(暂未实现)
  725 +//@property(nonatomic,assign) BOOL disableRecentContactNotify;
  726 +
  727 +///设置默认拉取的群组资料
  728 +@property(nonatomic,strong) TIMGroupInfoOption * groupInfoOpt;
  729 +
  730 +///设置默认拉取的群成员资料
  731 +@property(nonatomic,strong) TIMGroupMemberInfoOption * groupMemberInfoOpt;
  732 +
  733 +///关系链参数
  734 +@property(nonatomic,strong) TIMFriendProfileOption * friendProfileOpt;
  735 +
  736 +///用户登录状态监听器
  737 +@property(nonatomic,strong) id<TIMUserStatusListener> userStatusListener;
  738 +
  739 +///会话刷新监听器(未读计数、已读同步)
  740 +@property(nonatomic,strong) id<TIMRefreshListener> refreshListener;
  741 +
  742 +///消息已读回执监听器
  743 +@property(nonatomic,strong) id<TIMMessageReceiptListener> messageReceiptListener;
  744 +
  745 +///消息 svr 重写监听器
  746 +@property(nonatomic,strong) id<TIMMessageUpdateListener> messageUpdateListener;
  747 +
  748 +///消息撤回监听器
  749 +@property(nonatomic,strong) id<TIMMessageRevokeListener> messageRevokeListener;
  750 +
  751 +///文件上传进度监听器
  752 +@property(nonatomic,strong) id<TIMUploadProgressListener> uploadProgressListener;
  753 +
  754 +///群组事件通知监听器
  755 +@property(nonatomic,strong) id<TIMGroupEventListener> groupEventListener;
  756 +
  757 +///关系链数据本地缓存监听器
  758 +@property(nonatomic,strong) id<TIMFriendshipListener> friendshipListener;
  759 +
  760 +@end
  761 +
  762 +/// 登陆参数
  763 +@interface TIMLoginParam : NSObject
  764 +
  765 +///用户名
  766 +@property(nonatomic,strong) NSString* identifier;
  767 +
  768 +///鉴权 Token
  769 +@property(nonatomic,strong) NSString* userSig;
  770 +
  771 +///App 用户使用 OAuth 授权体系分配的 Appid
  772 +@property(nonatomic,strong) NSString* appidAt3rd;
  773 +
  774 +
  775 +@end
  776 +
  777 +/// APNs 配置
  778 +@interface TIMAPNSConfig : NSObject
  779 +
  780 +///是否开启推送:0-不进行设置 1-开启推送 2-关闭推送
  781 +@property(nonatomic,assign) uint32_t openPush;
  782 +
  783 +///C2C 消息声音,不设置传入 nil
  784 +@property(nonatomic,strong) NSString * c2cSound;
  785 +
  786 +///Group 消息声音,不设置传入 nil
  787 +@property(nonatomic,strong) NSString * groupSound;
  788 +
  789 +///Video 音视频邀请声音,不设置传入 nil
  790 +@property(nonatomic,strong) NSString * videoSound;
  791 +
  792 +@end
  793 +
  794 +/// SetToken 参数
  795 +@interface TIMTokenParam : NSObject
  796 +
  797 +///获取的客户端 Token 信息
  798 +@property(nonatomic,strong) NSData* token;
  799 +
  800 +///业务 ID,传递证书时分配
  801 +@property(nonatomic,assign) uint32_t busiId;
  802 +
  803 +@end
  804 +
  805 +/// 切后台参数
  806 +@interface TIMBackgroundParam : NSObject
  807 +
  808 +///C2C 未读计数
  809 +@property(nonatomic,assign) int c2cUnread;
  810 +
  811 +///群未读计数
  812 +@property(nonatomic,assign) int groupUnread;
  813 +
  814 +@end
  815 +
  816 +/// 消息定位
  817 +@interface TIMMessageLocator : NSObject
  818 +
  819 +///所属会话的 id
  820 +@property(nonatomic,strong) NSString * sessId;
  821 +
  822 +///所属会话的类型
  823 +@property(nonatomic,assign) TIMConversationType sessType;
  824 +
  825 +///消息序列号
  826 +@property(nonatomic,assign) uint64_t seq;
  827 +
  828 +///消息随机码
  829 +@property(nonatomic,assign) uint64_t rand;
  830 +
  831 +///消息时间戳
  832 +@property(nonatomic,assign) time_t time;
  833 +
  834 +///是否本人消息
  835 +@property(nonatomic,assign) BOOL isSelf;
  836 +
  837 +///是否来自撤销通知
  838 +@property(nonatomic,assign) BOOL isFromRevokeNotify;
  839 +
  840 +@end
  841 +
  842 +/// 已读回执
  843 +@interface TIMMessageReceipt : NSObject
  844 +
  845 +///已读回执对应的会话(目前只支持 C2C 会话)
  846 +@property(nonatomic,strong) TIMConversation * conversation;
  847 +
  848 +///收到已读回执时,这个时间戳之前的消息都已读
  849 +@property(nonatomic,assign) time_t timestamp;
  850 +@end
  851 +
  852 +/// Android 离线推送配置
  853 +@interface TIMAndroidOfflinePushConfig : NSObject
  854 +
  855 +///离线推送时展示标签
  856 +@property(nonatomic,strong) NSString * title;
  857 +
  858 +///Android 离线 Push 时声音字段信息
  859 +@property(nonatomic,strong) NSString * sound;
  860 +
  861 +///离线推送时通知形式
  862 +@property(nonatomic,assign) TIMAndroidOfflinePushNotifyMode notifyMode;
  863 +
  864 +@end
  865 +
  866 +/// iOS 离线推送配置
  867 +@interface TIMIOSOfflinePushConfig : NSObject
  868 +
  869 +///离线 Push 时声音字段信息
  870 +@property(nonatomic,strong) NSString * sound;
  871 +
  872 +///忽略 badge 计数
  873 +@property(nonatomic,assign) BOOL ignoreBadge;
  874 +
  875 +@end
  876 +
  877 +/// 群组内的本人信息
  878 +@interface TIMGroupSelfInfo : NSObject
  879 +
  880 +///加入群组时间
  881 +@property(nonatomic,assign) uint32_t joinTime;
  882 +
  883 +///群组中的角色
  884 +@property(nonatomic,assign) TIMGroupMemberRole role;
  885 +
  886 +///群组消息接收选项
  887 +@property(nonatomic,assign) TIMGroupReceiveMessageOpt recvOpt;
  888 +
  889 +///群组中的未读消息数
  890 +@property(nonatomic,assign) uint32_t unReadMessageNum;
  891 +
  892 +@end
  893 +
  894 +/// 群资料信息
  895 +@interface TIMGroupInfo : TIMCodingModel
  896 +
  897 +///群组 Id
  898 +@property(nonatomic,strong) NSString* group;
  899 +
  900 +///群名
  901 +@property(nonatomic,strong) NSString* groupName;
  902 +
  903 +///群创建人/管理员
  904 +@property(nonatomic,strong) NSString * owner;
  905 +
  906 +///群类型:Private,Public,ChatRoom
  907 +@property(nonatomic,strong) NSString* groupType;
  908 +
  909 +///群创建时间
  910 +@property(nonatomic,assign) uint32_t createTime;
  911 +
  912 +///最近一次群资料修改时间
  913 +@property(nonatomic,assign) uint32_t lastInfoTime;
  914 +
  915 +///最近一次发消息时间
  916 +@property(nonatomic,assign) uint32_t lastMsgTime;
  917 +
  918 +///最大成员数
  919 +@property(nonatomic,assign) uint32_t maxMemberNum;
  920 +
  921 +///群成员数量
  922 +@property(nonatomic,assign) uint32_t memberNum;
  923 +
  924 +///入群类型
  925 +@property(nonatomic,assign) TIMGroupAddOpt addOpt;
  926 +
  927 +///群公告
  928 +@property(nonatomic,strong) NSString* notification;
  929 +
  930 +///群简介
  931 +@property(nonatomic,strong) NSString* introduction;
  932 +
  933 +///群头像
  934 +@property(nonatomic,strong) NSString* faceURL;
  935 +
  936 +///最后一条消息
  937 +@property(nonatomic,strong) TIMMessage* lastMsg;
  938 +
  939 +///在线成员数量
  940 +@property(nonatomic,assign) uint32_t onlineMemberNum;
  941 +
  942 +///群组是否被搜索类型
  943 +@property(nonatomic,assign) TIMGroupSearchableType isSearchable;
  944 +
  945 +///群组成员可见类型
  946 +@property(nonatomic,assign) TIMGroupMemberVisibleType isMemberVisible;
  947 +
  948 +///是否全员禁言
  949 +@property(nonatomic,assign) BOOL allShutup;
  950 +
  951 +///群组中的本人信息
  952 +@property(nonatomic,strong) TIMGroupSelfInfo* selfInfo;
  953 +
  954 +///自定义字段集合,key 是 NSString* 类型,value 是 NSData* 类型
  955 +@property(nonatomic,strong) NSDictionary* customInfo;
  956 +
  957 +@end
  958 +
  959 +/// 事件上报信息
  960 +@interface TIMEventReportItem : NSObject
  961 +
  962 +///事件 id
  963 +@property(nonatomic,assign) uint32_t event;
  964 +
  965 +///错误码
  966 +@property(nonatomic,assign) uint32_t code;
  967 +
  968 +///错误描述
  969 +@property(nonatomic,strong) NSString * desc;
  970 +
  971 +///事件延迟(单位 ms)
  972 +@property(nonatomic,assign) uint32_t delay;
  973 +
  974 +@end
  975 +
  976 +/// 获取某个群组资料
  977 +@interface TIMGroupInfoOption : NSObject
  978 +
  979 +///需要获取的群组信息标志(TIMGetGroupBaseInfoFlag),默认为0xffffff
  980 +@property(nonatomic,assign) uint64_t groupFlags;
  981 +
  982 +///需要获取群组资料的自定义信息(NSString*)列表
  983 +@property(nonatomic,strong) NSArray * groupCustom;
  984 +
  985 +@end
  986 +
  987 +/// 需要某个群成员资料
  988 +@interface TIMGroupMemberInfoOption : NSObject
  989 +
  990 +///需要获取的群成员标志(TIMGetGroupMemInfoFlag),默认为0xffffff
  991 +@property(nonatomic,assign) uint64_t memberFlags;
  992 +
  993 +///需要获取群成员资料的自定义信息(NSString*)列表
  994 +@property(nonatomic,strong) NSArray * memberCustom;
  995 +
  996 +@end
  997 +
  998 +/// 群成员资料
  999 +@interface TIMGroupMemberInfo : TIMCodingModel
  1000 +
  1001 +///成员
  1002 +@property(nonatomic,strong) NSString* member;
  1003 +
  1004 +///群名片
  1005 +@property(nonatomic,strong) NSString* nameCard;
  1006 +
  1007 +///加入群组时间
  1008 +@property(nonatomic,assign) time_t joinTime;
  1009 +
  1010 +///成员类型
  1011 +@property(nonatomic,assign) TIMGroupMemberRole role;
  1012 +
  1013 +///禁言结束时间(时间戳)
  1014 +@property(nonatomic,assign) uint32_t silentUntil;
  1015 +
  1016 +///自定义字段集合,key 是 NSString*类型,value 是 NSData*类型
  1017 +@property(nonatomic,strong) NSDictionary* customInfo;
  1018 +
  1019 +@end
  1020 +
  1021 +///资料与关系链
  1022 +@interface TIMFriendProfileOption : NSObject
  1023 +
  1024 +///关系链最大缓存时间(默认缓存一天;获取资料和关系链超过缓存时间,将自动向服务器发起请求)
  1025 +@property NSInteger expiredSeconds;
  1026 +
  1027 +@end
  1028 +
  1029 +///用户资料
  1030 +@interface TIMUserProfile : TIMCodingModel
  1031 +
  1032 +///用户 identifier
  1033 +@property(nonatomic,strong) NSString* identifier;
  1034 +
  1035 +///用户昵称
  1036 +@property(nonatomic,strong) NSString* nickname;
  1037 +
  1038 +///好友验证方式
  1039 +@property(nonatomic,assign) TIMFriendAllowType allowType;
  1040 +
  1041 +///用户头像
  1042 +@property(nonatomic,strong) NSString* faceURL;
  1043 +
  1044 +///用户签名
  1045 +@property(nonatomic,strong) NSData* selfSignature;
  1046 +
  1047 +///用户性别
  1048 +@property(nonatomic,assign) TIMGender gender;
  1049 +
  1050 +///用户生日
  1051 +@property(nonatomic,assign) uint32_t birthday;
  1052 +
  1053 +///用户区域
  1054 +@property(nonatomic,strong) NSData* location;
  1055 +
  1056 +///用户语言
  1057 +@property(nonatomic,assign) uint32_t language;
  1058 +
  1059 +///等级
  1060 +@property(nonatomic,assign) uint32_t level;
  1061 +
  1062 +///角色
  1063 +@property(nonatomic,assign) uint32_t role;
  1064 +
  1065 +///自定义字段集合,key 是 NSString 类型,value 是 NSData 类型或者 NSNumber 类型(key 值按照后台配置的字符串传入)
  1066 +@property(nonatomic,strong) NSDictionary* customInfo;
  1067 +
  1068 +@end
  1069 +
  1070 +/**
  1071 + * 好友
  1072 + */
  1073 +@interface TIMFriend : TIMCodingModel
  1074 +
  1075 +/**
  1076 + * 好友identifier
  1077 + */
  1078 +@property(nonatomic,strong) NSString *identifier;
  1079 +
  1080 +/**
  1081 + * 好友备注(最大96字节,获取自己资料时,该字段为空)
  1082 + */
  1083 +@property(nonatomic,strong) NSString *remark;
  1084 +
  1085 +/**
  1086 + * 分组名称 NSString* 列表
  1087 + */
  1088 +@property(nonatomic,strong) NSArray *groups;
  1089 +
  1090 +/**
  1091 + * 申请时的添加理由
  1092 + */
  1093 +@property(nonatomic,strong) NSString *addWording;
  1094 +
  1095 +/**
  1096 + * 申请时的添加来源
  1097 + */
  1098 +@property(nonatomic,strong) NSString *addSource;
  1099 +
  1100 +/**
  1101 + * 添加时间
  1102 + */
  1103 +@property(nonatomic,assign) uint64_t addTime;
  1104 +
  1105 +///自定义字段集合,key 是 NSString 类型,value 是 NSData 类型或者 NSNumber 类型(key 值按照后台配置的字符串传入)
  1106 +@property(nonatomic,strong) NSDictionary* customInfo;
  1107 +
  1108 +///好友资料
  1109 +@property(nonatomic,strong) TIMUserProfile *profile;
  1110 +
  1111 +@end
  1112 +
  1113 +#endif
  1 +//
  2 +// TIMConversation+MsgExt.h
  3 +// IMMessageExt
  4 +//
  5 +// Created by tomzhu on 2016/12/27.
  6 +//
  7 +//
  8 +
  9 +#ifndef TIMConversation_h
  10 +#define TIMConversation_h
  11 +
  12 +#import "TIMConversation.h"
  13 +#import "TIMMessage+MsgExt.h"
  14 +
  15 +@interface TIMConversation (MsgExt)
  16 +
  17 +/**
  18 + * 保存会话消息
  19 + *
  20 + * 保存消息到消息列表,这里只保存在本地。
  21 + *
  22 + * @param msg 消息体
  23 + * @param sender 发送方
  24 + * @param isReaded 是否已读,如果发送方是自己,默认已读
  25 + *
  26 + * @return 0:成功;1:失败
  27 + */
  28 +- (int)saveMessage:(TIMMessage*)msg sender:(NSString*)sender isReaded:(BOOL)isReaded;
  29 +
  30 +/**
  31 + * 获取会话漫游消息
  32 + *
  33 + * 1. 登录后可以获取漫游消息,单聊和群聊消息免费漫游7天,用户有额外消息漫游需求时,可前往 [IM 控制台](https://console.cloud.tencent.com/avc) -> 功能配置 -> 消息 ->消息漫游时长 购买,具体资费请参考 [价格说明](https://cloud.tencent.com/document/product/269/11673)。
  34 + * 2. 如果本地消息全部都是连续的,则不会通过网络获取,如果本地消息不连续,会通过网络获取断层消息。
  35 + * 3. 对于图片、语音等资源类消息,消息体只会包含描述信息,需要通过额外的接口下载数据,详情请参考 [消息收发](https://cloud.tencent.com/document/product/269/9150)中的 "消息解析" 部分文档。
  36 + *
  37 + * @param count 获取数量
  38 + * @param last 上次最后一条消息,如果 last 为 nil,从最新的消息开始读取
  39 + * @param succ 成功时回调
  40 + * @param fail 失败时回调
  41 + *
  42 + * @return 0:本次操作成功;1:本次操作失败
  43 + */
  44 +- (int)getMessage:(int)count last:(TIMMessage*)last succ:(TIMGetMsgSucc)succ fail:(TIMFail)fail;
  45 +
  46 +/**
  47 + * 向前获取会话漫游消息
  48 + *
  49 + * 调用方式和 getMessage 一样,区别是 getMessage 获取的是时间更老的消息,主要用于下拉 Tableview 刷新消息数据,getMessageForward 获取的是时间更新的消息,主要用于上拉 Tableview 刷新消息数据。
  50 + *
  51 + * @param count 获取数量
  52 + * @param last 上次最后一条消息,如果 last 为 nil,从最新的消息开始读取
  53 + * @param succ 成功时回调
  54 + * @param fail 失败时回调
  55 + *
  56 + * @return 0:本次操作成功;1:本次操作失败
  57 + */
  58 +- (int)getMessageForward:(int)count last:(TIMMessage*)last succ:(TIMGetMsgSucc)succ fail:(TIMFail)fail;
  59 +
  60 +/**
  61 + * 获取本地会话消息
  62 + *
  63 + * 1. 对于单聊,登录后可以获取本地缓存消息
  64 + * 2. 对于群组,开启最近联系人漫游(登录之后 SDK 默认开启,可以通过 TIMUserConfig 里面的 disableRecnetContact 关闭)的情况下,登录后只能获取最近一条消息,可通过 getMessage 获取漫游消息
  65 + *
  66 + * @param count 获取数量
  67 + * @param last 上次最后一条消息
  68 + * @param succ 成功时回调
  69 + * @param fail 失败时回调
  70 + *
  71 + * @return 0:本次操作成功;1:本次操作失败
  72 + */
  73 +- (int)getLocalMessage:(int)count last:(TIMMessage*)last succ:(TIMGetMsgSucc)succ fail:(TIMFail)fail;
  74 +
  75 +/**
  76 + * 获取指定会话消息
  77 + *
  78 + * @param locators 消息定位符(TIMMessageLocator)数组
  79 + * @param succ 成功时回调
  80 + * @param fail 失败时回调
  81 + *
  82 + * @return 0:本次操作成功;1:本次操作失败
  83 + */
  84 +- (int)findMessages:(NSArray*)locators succ:(TIMGetMsgSucc)succ fail:(TIMFail)fail;
  85 +
  86 +/**
  87 + * 撤回消息
  88 + *
  89 + * 1. 仅 C2C 和 GROUP 会话有效、onlineMessage 无效、AVChatRoom 和 BChatRoom 无效。
  90 + * 2. 可以在 TIMUserConfig 设置的 TIMMessageRevokeListener 监听 onRevokeMessage 消息撤回回调。
  91 + * 3. 遍历本地消息列表,如果消息的 respondsToLocator 函数返回 YES,则是对应的消息,您可以在 UI 上执行删除操作,具体可以参考 TMessageController.h 里面的 onRevokeMessage 回调的实现。
  92 + *
  93 + * @param msg 被撤回的消息
  94 + * @param succ 成功时回调
  95 + * @param fail 失败时回调
  96 + *
  97 + * @return 0:本次操作成功;1:本次操作失败
  98 + */
  99 +- (int)revokeMessage:(TIMMessage*)msg succ:(TIMSucc)succ fail:(TIMFail)fail;
  100 +
  101 +/**
  102 + * 同步群的消息撤回通知
  103 + *
  104 + * 针对群组,断线重连后,如果用户处于群组聊天界面,需要业务端主动同步该群组会话的消息撤回通知。其他场景不需要主动同步消息撤回通知。
  105 + *
  106 + * @param succ 成功时回调,同步的通知会通过 TIMMessageRevokeListener 抛出
  107 + * @param fail 失败时回调
  108 + *
  109 + * @return 0 本次操作成功
  110 + */
  111 +- (int)syncRevokeNotify:(TIMSucc)succ fail:(TIMFail)fail;
  112 +
  113 +/**
  114 + * 删除本地会话消息
  115 + *
  116 + * 可以在保留会话同时删除本地的会话消息。
  117 + *
  118 + * @param succ 成功时回调
  119 + * @param fail 失败时回调
  120 + *
  121 + * @return 0 本次操作成功
  122 + */
  123 +- (int)deleteLocalMessage:(TIMSucc)succ fail:(TIMFail)fail;
  124 +
  125 +/**
  126 + * 设置已读消息
  127 + *
  128 + * 1. 如果在 TIMUserConfig 关闭了自动已读上报(设置 disableAutoReport 为 YES),这里需要显示调用 setReadMessage ,消息的已读状态才会改变。
  129 + * 2. 如果在 TIMUserConfig 开启了消息回执(设置 enableReadReceipt 为 YES),收消息的用户需要显示调用 setReadMessage ,发消息的用户才能通过 TIMMessageReceiptListener 监听到消息的已读回执。
  130 + * 3. 如果您需要设置单条消息的已读状态,请使用 TIMMessage+MsgExt.h 中的 setCustomInt 自定义字段接口设置,通过 customInt 获取,需要注意的是,这个接口设置的字段只在本地保存,如果切换了终端,或则 APP 被卸载,这个值都会失效。
  131 + *
  132 + * @param readed 会话内最近一条已读的消息,nil 表示上报最新消息
  133 + *
  134 + * @param succ 成功时回调
  135 + * @param fail 失败时回调
  136 + *
  137 + * @return 0 表示成功
  138 + */
  139 +- (int)setReadMessage:(TIMMessage*)readed succ:(TIMSucc)succ fail:(TIMFail)fail;
  140 +
  141 +/**
  142 + * 获取会话的未读计数
  143 + *
  144 + * 1. 单终端,未卸载 APP 的情况下,您可以通过当前接口获取准确的未读计数。
  145 + * 2. 如果需要在多终端或则程序 APP 卸载重装后未读计数依然准确,请设置 TIMUserConfig 的 disableAutoReport 为 YES,然后显示调用 setReadMessage。详情请参考 [未读消息计数](https://cloud.tencent.com/document/product/269/9151)
  146 + *
  147 + * @return 返回未读计数
  148 + */
  149 +- (int)getUnReadMessageNum;
  150 +
  151 +/**
  152 + * 获取最后一条消息
  153 + *
  154 + * @return 最后一条消息
  155 + */
  156 +- (TIMMessage*)getLastMsg;
  157 +
  158 +/**
  159 + * 将消息导入本地数据库
  160 + *
  161 + * @param msgs 消息(TIMMessage*)列表
  162 + *
  163 + * @return 0:成功;1:失败
  164 + */
  165 +- (int)importMessages:(NSArray*)msgs;
  166 +
  167 +/**
  168 + * 设置会话草稿
  169 + *
  170 + * UI 展示最近联系人列表时,时常会展示用户的草稿内容,ImSDK 提供了设置和获取草稿的接口,用户可以通过此接口设置会话的草稿信息。草稿信息会存本地数据库,重新登录后依然可以获取。
  171 + *
  172 + * @param draft 草稿内容,详情请参考 TIMMessage+MsgExt.h 里面的 TIMMessageDraft 定义
  173 + *
  174 + * @return 0:成功;1:失败
  175 + */
  176 +- (int)setDraft:(TIMMessageDraft*)draft;
  177 +
  178 +/**
  179 + * 获取会话草稿
  180 + *
  181 + * @return 草稿内容,没有草稿返回 nil
  182 + */
  183 +- (TIMMessageDraft*)getDraft;
  184 +
  185 +/**
  186 + * 禁用本会话的存储(暂未实现)
  187 + *
  188 + * 1. 需要 initSdk 之后调用
  189 + * 2. 只对当前初始化有效,重启后需要重新设置
  190 + */
  191 +- (void)disableStorage;
  192 +
  193 +@end
  194 +
  195 +#endif /* TIMConversation_h */
  1 +//
  2 +// TIMConversation.h
  3 +// ImSDK
  4 +//
  5 +// Created by bodeng on 28/1/15.
  6 +// Copyright (c) 2015 tencent. All rights reserved.
  7 +//
  8 +
  9 +#ifndef ImSDK_TIMConversation_h
  10 +#define ImSDK_TIMConversation_h
  11 +
  12 +#import "TIMComm.h"
  13 +#import "TIMCallback.h"
  14 +
  15 +@class TIMMessage;
  16 +
  17 +/**
  18 + * 会话
  19 + */
  20 +@interface TIMConversation : NSObject
  21 +
  22 +/**
  23 + * 发送消息
  24 + *
  25 + * TIMMessage 由多个 TIMElem 组成,每个 TIMElem 可以是文本和图片,也就是说每一条消息可包含多个文本和多张图片。详情请参考官网文档 [消息收发](https://cloud.tencent.com/document/product/269/9150)
  26 + *
  27 + * @param msg 消息体
  28 + * @param succ 发送成功时回调
  29 + * @param fail 发送失败时回调
  30 + *
  31 + * @return 0:操作成功;1:操作失败
  32 + */
  33 +- (int)sendMessage:(TIMMessage*)msg succ:(TIMSucc)succ fail:(TIMFail)fail;
  34 +
  35 +/**
  36 + * 发送在线消息(服务器不保存消息)
  37 + *
  38 + * 1. 对于某些场景,需要发送在线消息,即用户在线时收到消息,如果用户不在线,下次登录也不会看到消息,可用于通知类消息,这种消息不会进行存储,也不会计入未读计数。发送接口与 sendMessage 类似。
  39 + * 2. 暂不支持 AVChatRoom 和 BChatRoom 类型。
  40 + *
  41 + * @param msg 消息体
  42 + * @param succ 成功回调
  43 + * @param fail 失败回调
  44 + *
  45 + * @return 0:操作成功;1:操作失败
  46 + */
  47 +- (int)sendOnlineMessage:(TIMMessage*)msg succ:(TIMSucc)succ fail:(TIMFail)fail;
  48 +
  49 +/**
  50 + * 获取会话人
  51 + *
  52 + * C2C:对方账号;Group:群组Id。
  53 + *
  54 + * 对同一个 C2C 会话或则群聊会话,getReceiver 获取的会话人都是固定的,C2C 获取的是对方账号,Group 获取的是群组 Id。
  55 + *
  56 + * @return 会话人
  57 + */
  58 +- (NSString*)getReceiver;
  59 +
  60 +/**
  61 + * 获取群名称
  62 + *
  63 + * 获取群名称,只有群会话有效。
  64 + *
  65 + * @return 群名称
  66 + */
  67 +- (NSString*)getGroupName;
  68 +
  69 +/**
  70 + * 获取会话类型
  71 + *
  72 + * @return 会话类型
  73 + */
  74 +- (TIMConversationType)getType;
  75 +
  76 +/**
  77 + * 获取自己的 id
  78 + *
  79 + * @return 用户 id
  80 + */
  81 +- (NSString*)getSelfIdentifier;
  82 +
  83 +@end
  84 +
  85 +
  86 +#endif
  1 +//
  2 +// TIMErrorCode.h
  3 +// ImSDK
  4 +//
  5 +// Created by jameskhdeng on 2018/11/23.
  6 +// Copyright © 2018 tencent. All rights reserved.
  7 +//
  8 +
  9 +#ifndef TIMErrorCode_h
  10 +#define TIMErrorCode_h
  11 +
  12 +enum ERROR_CODE {
  13 + ERR_SUCC = 0,
  14 + ERR_PARSE_RESPONSE_FAILED = 6001, //解析响应失败
  15 + ERR_SERIALIZE_REQ_FAILED = 6002, //序列化请求失败
  16 + ERR_NO_SUCC_RESULT = 6003, //批量操作无成功结果
  17 + ERR_INVALID_CONVERSATION = 6004, //IM: 无效会话
  18 + ERR_LOADMSG_FAILED = 6005, //IM: 加载本地消息存储失败
  19 + ERR_FILE_TRANS_AUTH_FAILED = 6006, //IM: 文件传输 - 鉴权失败
  20 + ERR_FILE_TRANS_NO_SERVER = 6007, //IM: 文件传输 - 获取svr失败
  21 + ERR_FILE_TRANS_UPLOAD_FAILED = 6008, //IM: 文件传输 - 上传失败
  22 + ERR_FILE_TRANS_DOWNLOAD_FAILED = 6009, //IM: 文件传输 - 下载失败
  23 + ERR_HTTP_REQ_FAILED = 6010, //HTTP请求失败
  24 + ERR_TO_USER_INVALID = 6011, //IM: 无效接收方
  25 + ERR_REQUEST_TIMEOUT = 6012, //请求超时
  26 + ERR_SDK_NOT_INITIALIZED = 6013, //SDK未初始化
  27 + ERR_SDK_NOT_LOGGED_IN = 6014, //SDK未登录
  28 + ERR_IN_PROGESS = 6015, //执行中
  29 + ERR_INVALID_MSG_ELEM = 6016, //IM: 无效消息elem
  30 + ERR_INVALID_PARAMETERS = 6017, //API参数无效
  31 + ERR_INIT_CORE_FAIL = 6018, //INIT CORE模块失败
  32 + ERR_DATABASE_OPERATE_FAILED = 6019, //本地数据库操作失败
  33 + ERR_EXPIRED_SESSION_NODE = 6020, //SessionNode为null
  34 + ERR_INVALID_SDK_OBJECT = 6021, //无效的imsdk对象,例如用户自己生成TIMImage,或内部赋值错误导致的sdk对象无效
  35 + ERR_IO_OPERATION_FAILED = 6022, //本地IO操作失败
  36 + ERR_LOGGED_OUT_BEFORE_LOGIN_FINISHED = 6023, //在登录完成前进行了登出(在登录时返回)
  37 + ERR_TLSSDK_NOT_INITIALIZED = 6024, //tlssdk未初始化
  38 + ERR_TLSSDK_USER_NOT_FOUND = 6025, //TLSSDK没有找到相应的用户信息
  39 + ERR_NO_PREVIOUS_LOGIN = 6026, //自动登陆时并没有登陆过该用户
  40 +
  41 + ERR_BIND_FAIL_UNKNOWN = 6100, //QALSDK未知原因BIND失败
  42 + ERR_BIND_FAIL_NO_SSOTICKET = 6101, //缺少SSO票据
  43 + ERR_BIND_FAIL_REPEATD_BIND = 6102, //重复BIND
  44 + ERR_BIND_FAIL_TINYID_NULL = 6103, //tiny为空
  45 + ERR_BIND_FAIL_GUID_NULL = 6104, //guid为空
  46 + ERR_BIND_FAIL_UNPACK_REGPACK_FAILED = 6105, //解注册包失败
  47 + ERR_BIND_FAIL_REG_TIMEOUT = 6106, //注册超时
  48 + ERR_BIND_FAIL_ISBINDING = 6107, //正在bind操作中
  49 +
  50 + ERR_PACKET_FAIL_UNKNOWN = 6120, //发包未知错误
  51 + ERR_PACKET_FAIL_REQ_NO_NET = 6121, //发送请求包时没有网络,处理时转换成ERR_REQ_NO_NET_ON_REQ
  52 + ERR_PACKET_FAIL_RESP_NO_NET = 6122, //发送回复包时没有网络,处理时转换成ERR_REQ_NO_NET_ON_RSP
  53 + ERR_PACKET_FAIL_REQ_NO_AUTH = 6123, //发送请求包时没有权限
  54 + ERR_PACKET_FAIL_SSO_ERR = 6124, //SSO错误
  55 + ERR_PACKET_FAIL_REQ_TIMEOUT = 6125, //请求超时,处理时转化成ERR_REQUEST_TIMEOUT
  56 + ERR_PACKET_FAIL_RESP_TIMEOUT = 6126, //回复超时,处理时转化成ERR_REQUEST_TIMEOUT
  57 + ERR_PACKET_FAIL_REQ_ON_RESEND = 6127, //
  58 + ERR_PACKET_FAIL_RESP_NO_RESEND = 6128, //
  59 + ERR_PACKET_FAIL_FLOW_SAVE_FILTERED = 6129, //
  60 + ERR_PACKET_FAIL_REQ_OVER_LOAD = 6130, //
  61 + ERR_PACKET_FAIL_LOGIC_ERR = 6131,
  62 +
  63 + ERR_FRIENDSHIP_PROXY_NOT_SYNCED = 6150, // proxy_manager没有完成svr数据同步
  64 + ERR_FRIENDSHIP_PROXY_SYNCING = 6151, // proxy_manager正在进行svr数据同步
  65 + ERR_FRIENDSHIP_PROXY_SYNCED_FAIL = 6152, // proxy_manager同步失败
  66 + ERR_FRIENDSHIP_PROXY_LOCAL_CHECK_ERR = 6153, // proxy_manager请求参数,在本地检查不合法
  67 +
  68 + ERR_GROUP_INVALID_FIELD = 6160, // group assistant请求字段中包含非预设字段
  69 + ERR_GROUP_STORAGE_DISABLED = 6161, // group assistant群资料本地存储没有开启
  70 + ERR_LOADGRPINFO_FAILED = 6162, // failed to load groupinfo from storage
  71 +
  72 + ERR_REQ_NO_NET_ON_REQ = 6200, // 请求的时候没有网络
  73 + ERR_REQ_NO_NET_ON_RSP = 6201, // 响应的时候没有网络
  74 + ERR_SERIVCE_NOT_READY = 6205, // QALSDK服务未就绪
  75 + ERR_USER_SIG_EXPIRED = 6206, // 票据过期
  76 + ERR_LOGIN_AUTH_FAILED = 6207, // 账号认证失败(tinyid转换失败)
  77 + ERR_LOGIN_KICKED_OFF_BY_OTHER = 6208, // 账号被踢
  78 + ERR_NEVER_CONNECT_AFTER_LAUNCH = 6209, // 在应用启动后没有尝试联网
  79 +
  80 + ERR_REQ_FAILED = 6210, // QAL执行失败
  81 + ERR_REQ_INVALID_REQ = 6211, // 请求非法,toMsgService非法
  82 + ERR_REQ_OVERLOADED = 6212, // 请求队列満
  83 + ERR_REQ_KICK_OFF = 6213, // 已经被其他终端踢了
  84 + ERR_REQ_SERVICE_SUSPEND = 6214, // 服务被暂停
  85 + ERR_REQ_INVALID_SIGN = 6215, // SSO签名错误
  86 + ERR_REQ_INVALID_COOKIE = 6216, // SSO cookie无效
  87 + ERR_LOGIN_TLS_RSP_PARSE_FAILED = 6217, // 登录时TLS回包校验,包体长度错误
  88 + ERR_LOGIN_OPENMSG_TIMEOUT = 6218, // 登录时OPENSTATSVC向OPENMSG上报状态超时
  89 + ERR_LOGIN_OPENMSG_RSP_PARSE_FAILED = 6219, // 登录时OPENSTATSVC向OPENMSG上报状态时解析回包失败
  90 + ERR_LOGIN_TLS_DECRYPT_FAILED = 6220, // 登录时TLS解密失败
  91 + ERR_WIFI_NEED_AUTH = 6221, // wifi需要认证
  92 +
  93 + ERR_USER_CANCELED = 6222, // 用户已取消
  94 +
  95 + ERR_REVOKE_TIME_LIMIT_EXCEED = 6223, //消息撤回超过了时间限制(默认2分钟)
  96 + ERR_LACK_UGC_EXT = 6224, // 缺少UGC扩展包
  97 + ERR_AUTOLOGIN_NEED_USERSIG = 6226, //自动登录,本地票据过期,需要userSig手动登录
  98 +
  99 +
  100 + ERR_REQ_CONTENT_ATTACK = 80001, // 消息内容安全打击
  101 +
  102 + ERR_LOGIN_SIG_EXPIRE = 70001, // 登陆返回,票据过期
  103 +
  104 + ERR_SDK_HAD_INITIALIZED = 90001, // SDK 已经初始化无需重复初始化
  105 + ERR_OPENBDH_BASE = 115000, // openbdh 错误码基
  106 +};
  107 +
  108 +#endif /* TIMErrorCode_h */
  1 +//
  2 +// TIMFriendshipDefine.h
  3 +// imsdk
  4 +//
  5 +// Created by annidyfeng on 2019/3/7.
  6 +// Copyright © 2019年 Tencent. All rights reserved.
  7 +//
  8 +
  9 +#ifndef TIMFriendshipDefine_h
  10 +#define TIMFriendshipDefine_h
  11 +
  12 +#import "ImSDK.h"
  13 +
  14 +@class TIMFriendMetaInfo;
  15 +@class TIMFriendPendencyResponse;
  16 +@class TIMFriendPendencyItem;
  17 +@class TIMFriendFutureMeta;
  18 +@class TIMFriendGroup;
  19 +
  20 +#pragma mark - 枚举类型
  21 +
  22 +/**
  23 + * 好友操作状态
  24 + */
  25 +typedef NS_ENUM(NSInteger, TIMFriendStatus) {
  26 + /**
  27 + * 操作成功
  28 + */
  29 + TIM_FRIEND_STATUS_SUCC = 0,
  30 +
  31 + /**
  32 + * 加好友、响应好友时有效:自己的好友数已达系统上限
  33 + */
  34 + TIM_ADD_FRIEND_STATUS_SELF_FRIEND_FULL = 30010,
  35 +
  36 + /**
  37 + * 更新好友分组时有效:分组已达系统上限
  38 + */
  39 + TIM_UPDATE_FRIEND_GROUP_STATUS_MAX_GROUPS_EXCEED = 30011,
  40 +
  41 + /**
  42 + * 加好友、响应好友时有效:对方的好友数已达系统上限
  43 + */
  44 + TIM_ADD_FRIEND_STATUS_THEIR_FRIEND_FULL = 30014,
  45 +
  46 + /**
  47 + * 加好友时有效:被加好友在自己的黑名单中
  48 + */
  49 + TIM_ADD_FRIEND_STATUS_IN_SELF_BLACK_LIST = 30515,
  50 +
  51 + /**
  52 + * 加好友时有效:被加好友设置为禁止加好友
  53 + */
  54 + TIM_ADD_FRIEND_STATUS_FRIEND_SIDE_FORBID_ADD = 30516,
  55 +
  56 + /**
  57 + * 加好友时有效:已被被添加好友设置为黑名单
  58 + */
  59 + TIM_ADD_FRIEND_STATUS_IN_OTHER_SIDE_BLACK_LIST = 30525,
  60 +
  61 + /**
  62 + * 加好友时有效:对方好友列表已满
  63 + */
  64 + TIM_ADD_FRIEND_STATUS_OTHER_SIDE_FRIEND_LIST_FULL = 30535,
  65 +
  66 + /**
  67 + * 加好友时有效:等待好友审核同意
  68 + */
  69 + TIM_ADD_FRIEND_STATUS_PENDING = 30539,
  70 +
  71 + /**
  72 + * 删除好友时有效:删除好友时对方不是好友
  73 + */
  74 + TIM_DEL_FRIEND_STATUS_NO_FRIEND = 31704,
  75 +
  76 + /**
  77 + * 响应好友申请时有效:对方没有申请过好友
  78 + */
  79 + TIM_RESPONSE_FRIEND_STATUS_NO_REQ = 30614,
  80 +
  81 + /**
  82 + * 添加黑名单有效:已经在黑名单了
  83 + */
  84 + TIM_ADD_BLACKLIST_FRIEND_STATUS_IN_BLACK_LIST = 31307,
  85 +
  86 + /**
  87 + * 删除黑名单有效:用户不在黑名单里
  88 + */
  89 + TIM_DEL_BLACKLIST_FRIEND_STATUS_NOT_IN_BLACK_LIST = 31503,
  90 +
  91 + /**
  92 + * 创建好友分组时有效:没有拉到SDKAppId
  93 + */
  94 + TIM_ADD_FRIEND_GROUP_STATUS_GET_SDKAPPID_FAILED = 32207,
  95 +
  96 + /**
  97 + * 创建好友分组时有效:要加入到好友分组中的用户不是好友
  98 + */
  99 + TIM_ADD_FRIEND_GROUP_STATUS_NOT_FRIEND = 32216,
  100 +
  101 + /**
  102 + * 更新好友分组时有效:没有拉到SDKAppId
  103 + */
  104 + TIM_UPDATE_FRIEND_GROUP_STATUS_GET_SDKAPPID_FAILED = 32511,
  105 +
  106 + /**
  107 + * 更新好友分组时有效:要加入到好友分组中的用户不是好友
  108 + */
  109 + TIM_UPDATE_FRIEND_GROUP_STATUS_ADD_NOT_FRIEND = 32518,
  110 +
  111 + /**
  112 + * 更新好友分组时有效:要加入到好友分组中的好友已经在分组中
  113 + */
  114 + TIM_UPDATE_FRIEND_GROUP_STATUS_ADD_ALREADY_IN_GROUP = 32519,
  115 +
  116 + /**
  117 + * 更新好友分组时有效:要从好友分组中删除的好友不在好友分组中
  118 + */
  119 + TIM_UPDATE_FRIEND_GROUP_STATUS_DEL_NOT_IN_GROUP = 32520,
  120 +
  121 +
  122 +};
  123 +
  124 +typedef NS_ENUM(NSInteger, TIMDelFriendType) {
  125 + /**
  126 + * 删除单向好友
  127 + */
  128 + TIM_FRIEND_DEL_SINGLE = 1,
  129 +
  130 + /**
  131 + * 删除双向好友
  132 + */
  133 + TIM_FRIEND_DEL_BOTH = 2,
  134 +};
  135 +
  136 +typedef NS_ENUM(NSInteger, TIMPendencyType) {
  137 + /**
  138 + * 别人发给我的
  139 + */
  140 + TIM_PENDENCY_COME_IN = 1,
  141 +
  142 + /**
  143 + * 我发给别人的
  144 + */
  145 + TIM_PENDENCY_SEND_OUT = 2,
  146 +
  147 + /**
  148 + * 别人发给我的 和 我发给别人的。仅拉取时有效
  149 + */
  150 + TIM_PENDENCY_BOTH = 3,
  151 +};
  152 +
  153 +/**
  154 + * 推荐好友类型
  155 + */
  156 +typedef NS_ENUM(NSInteger, TIMFutureFriendType) {
  157 + /**
  158 + * 收到的未决请求
  159 + */
  160 + TIM_FUTURE_FRIEND_PENDENCY_IN_TYPE = 0x1,
  161 +
  162 + /**
  163 + * 发出去的未决请求
  164 + */
  165 + TIM_FUTURE_FRIEND_PENDENCY_OUT_TYPE = 0x2,
  166 +
  167 + /**
  168 + * 推荐好友
  169 + */
  170 + TIM_FUTURE_FRIEND_RECOMMEND_TYPE = 0x4,
  171 +
  172 + /**
  173 + * 已决好友
  174 + */
  175 + TIM_FUTURE_FRIEND_DECIDE_TYPE = 0x8,
  176 +};
  177 +
  178 +/**
  179 + * 翻页选项
  180 + */
  181 +typedef NS_ENUM(NSInteger, TIMPageDirectionType) {
  182 + /**
  183 + * 向上翻页
  184 + */
  185 + TIM_PAGE_DIRECTION_UP_TYPE = 1,
  186 +
  187 + /**
  188 + * 向下翻页
  189 + */
  190 + TIM_PAGE_DIRECTION_DOWN_TYPE = 2,
  191 +};
  192 +
  193 +/**
  194 + * 好友检查类型
  195 + */
  196 +typedef NS_ENUM(NSInteger,TIMFriendCheckType) {
  197 + /**
  198 + * 单向好友
  199 + */
  200 + TIM_FRIEND_CHECK_TYPE_UNIDIRECTION = 0x1,
  201 + /**
  202 + * 互为好友
  203 + */
  204 + TIM_FRIEND_CHECK_TYPE_BIDIRECTION = 0x2,
  205 +};
  206 +
  207 +/**
  208 + * 好友关系类型
  209 + */
  210 +typedef NS_ENUM(NSInteger,TIMFriendRelationType) {
  211 + /**
  212 + * 不是好友
  213 + */
  214 + TIM_FRIEND_RELATION_TYPE_NONE = 0x0,
  215 + /**
  216 + * 对方在我的好友列表中
  217 + */
  218 + TIM_FRIEND_RELATION_TYPE_MY_UNI = 0x1,
  219 + /**
  220 + * 我在对方的好友列表中
  221 + */
  222 + TIM_FRIEND_RELATION_TYPE_OTHER_UNI = 0x2,
  223 + /**
  224 + * 互为好友
  225 + */
  226 + TIM_FRIEND_RELATION_TYPE_BOTH = 0x3,
  227 +};
  228 +
  229 +typedef NS_ENUM(NSInteger, TIMFriendResponseType) {
  230 + /**
  231 + * 同意加好友(建立单向好友)
  232 + */
  233 + TIM_FRIEND_RESPONSE_AGREE = 0,
  234 +
  235 + /**
  236 + * 同意加好友并加对方为好友(建立双向好友)
  237 + */
  238 + TIM_FRIEND_RESPONSE_AGREE_AND_ADD = 1,
  239 +
  240 + /**
  241 + * 拒绝对方好友请求
  242 + */
  243 + TIM_FRIEND_RESPONSE_REJECT = 2,
  244 +};
  245 +
  246 +#pragma mark - block回调
  247 +
  248 +/**
  249 + * 获取好友列表回调
  250 + *
  251 + * @param meta 好友元信息
  252 + * @param friends 好友列表 TIMUserProfile* 数组,只包含需要的字段
  253 + */
  254 +typedef void (^TIMGetFriendListByPageSucc)(TIMFriendMetaInfo * meta, NSArray * friends);
  255 +
  256 +/**
  257 + * 获取未决请求列表成功
  258 + *
  259 + * @param pendencyResponse 未决请求元信息
  260 + */
  261 +typedef void (^TIMGetFriendPendencyListSucc)(TIMFriendPendencyResponse *pendencyResponse);
  262 +
  263 +/**
  264 + * 群搜索回调
  265 + *
  266 + * @param totalNum 搜索结果的总数
  267 + * @param users 请求的用户列表片段
  268 + */
  269 +typedef void (^TIMUserSearchSucc)(uint64_t totalNum, NSArray * users);
  270 +
  271 +/**
  272 + * 好友分组列表
  273 + *
  274 + * @param groups 好友分组(TIMFriendGroup*)列表
  275 + */
  276 +typedef void (^TIMFriendGroupArraySucc)(NSArray<TIMFriendGroup *> * groups);
  277 +
  278 +/**
  279 + * 好友关系检查回调
  280 + *
  281 + * @param results TIMCheckFriendResult列表
  282 + */
  283 +typedef void (^TIMFriendCheckSucc)(NSArray* results);
  284 +
  285 +#pragma mark - 基本类型
  286 +
  287 +/**
  288 + * 加好友请求
  289 + */
  290 +@interface TIMFriendRequest : TIMCodingModel
  291 +
  292 +/**
  293 + * 用户identifier(必填)
  294 + */
  295 +@property (nonatomic,strong) NSString* identifier;
  296 +
  297 +/**
  298 + * 备注(备注最大96字节)
  299 + */
  300 +@property (nonatomic,strong) NSString* remark;
  301 +
  302 +/**
  303 + * 请求说明(最大120字节)
  304 + */
  305 +@property (nonatomic,strong) NSString* addWording;
  306 +
  307 +/**
  308 + * 添加来源
  309 + * 来源需要添加“AddSource_Type_”前缀
  310 + */
  311 +@property (nonatomic,strong) NSString* addSource;
  312 +
  313 +/**
  314 + * 分组
  315 + */
  316 +@property (nonatomic,strong) NSString* group;
  317 +
  318 +@end
  319 +
  320 +/**
  321 + * 未决请求
  322 + */
  323 +@interface TIMFriendPendencyItem : TIMCodingModel
  324 +
  325 +/**
  326 + * 用户标识
  327 + */
  328 +@property(nonatomic,strong) NSString* identifier;
  329 +/**
  330 + * 增加时间
  331 + */
  332 +@property(nonatomic,assign) uint64_t addTime;
  333 +/**
  334 + * 来源
  335 + */
  336 +@property(nonatomic,strong) NSString* addSource;
  337 +/**
  338 + * 加好友附言
  339 + */
  340 +@property(nonatomic,strong) NSString* addWording;
  341 +
  342 +/**
  343 + * 加好友昵称
  344 + */
  345 +@property(nonatomic,strong) NSString* nickname;
  346 +
  347 +/**
  348 + * 未决请求类型
  349 + */
  350 +@property(nonatomic,assign) TIMPendencyType type;
  351 +
  352 +@end
  353 +
  354 +/**
  355 + * 未决推送
  356 + */
  357 +@interface TIMFriendPendencyInfo : TIMCodingModel
  358 +/**
  359 + * 用户标识
  360 + */
  361 +@property(nonatomic,strong) NSString* identifier;
  362 +/**
  363 + * 来源
  364 + */
  365 +@property(nonatomic,strong) NSString* addSource;
  366 +/**
  367 + * 加好友附言
  368 + */
  369 +@property(nonatomic,strong) NSString* addWording;
  370 +
  371 +/**
  372 + * 加好友昵称
  373 + */
  374 +@property(nonatomic,strong) NSString* nickname;
  375 +@end
  376 +
  377 +/**
  378 + * 未决请求信息
  379 + */
  380 +@interface TIMFriendPendencyRequest : TIMCodingModel
  381 +
  382 +/**
  383 + * 序列号,未决列表序列号
  384 + * 建议客户端保存seq和未决列表,请求时填入server返回的seq
  385 + * 如果seq是server最新的,则不返回数据
  386 + */
  387 +@property(nonatomic,assign) uint64_t seq;
  388 +
  389 +/**
  390 + * 翻页时间戳,只用来翻页,server返回0时表示没有更多数据,第一次请求填0
  391 + * 特别注意的是,如果server返回的seq跟填入的seq不同,翻页过程中,需要使用客户端原始seq请求,直到数据请求完毕,才能更新本地seq
  392 + */
  393 +@property(nonatomic,assign) uint64_t timestamp;
  394 +
  395 +/**
  396 + * 每页的数量,即本次请求最多返回都个数据
  397 + */
  398 +@property(nonatomic,assign) uint64_t numPerPage;
  399 +
  400 +/**
  401 + * 未决请求拉取类型
  402 + */
  403 +@property(nonatomic,assign) TIMPendencyType type;
  404 +
  405 +@end
  406 +
  407 +/**
  408 + * 未决返回信息
  409 + */
  410 +@interface TIMFriendPendencyResponse : TIMCodingModel
  411 +
  412 +/**
  413 + * 本次请求的未决列表序列号
  414 + */
  415 +@property(nonatomic,assign) uint64_t seq;
  416 +
  417 +/**
  418 + * 本次请求的翻页时间戳
  419 + */
  420 +@property(nonatomic,assign) uint64_t timestamp;
  421 +
  422 +/**
  423 + * 未决请求未读数量
  424 + */
  425 +@property(nonatomic,assign) uint64_t unreadCnt;
  426 +
  427 +/**
  428 + * 未决数据
  429 + */
  430 +@property NSArray<TIMFriendPendencyItem *> * pendencies;
  431 +
  432 +@end
  433 +
  434 +
  435 +
  436 +/**
  437 + * 好友元信息
  438 + */
  439 +@interface TIMFriendMetaInfo : TIMCodingModel
  440 +
  441 +/**
  442 + * 时间戳,需要保存,下次拉取时传入,增量更新使用
  443 + */
  444 +@property(nonatomic,assign) uint64_t timestamp;
  445 +/**
  446 + * 序列号,需要保存,下次拉取时传入,增量更新使用
  447 + */
  448 +@property(nonatomic,assign) uint64_t infoSeq;
  449 +/**
  450 + * 分页信息,无需保存,返回为0时结束,非0时传入再次拉取,第一次拉取时传0
  451 + */
  452 +@property(nonatomic,assign) uint64_t nextSeq;
  453 +/**
  454 + * 覆盖:为TRUE时需要重设timestamp, infoSeq, nextSeq为0,清除客户端存储,重新拉取资料
  455 + */
  456 +@property(nonatomic,assign) BOOL recover;
  457 +
  458 +@end
  459 +
  460 +/**
  461 + * 好友分组信息
  462 + */
  463 +@interface TIMFriendGroup : TIMCodingModel
  464 +/**
  465 + * 好友分组名称
  466 + */
  467 +@property(nonatomic,strong) NSString* name;
  468 +
  469 +/**
  470 + * 分组成员数量
  471 + */
  472 +@property(nonatomic,assign) uint64_t userCnt;
  473 +
  474 +/**
  475 + * 分组成员identifier列表
  476 + */
  477 +@property(nonatomic,strong) NSArray* friends;
  478 +
  479 +@end
  480 +
  481 +/**
  482 + * 好友关系检查
  483 + */
  484 +@interface TIMFriendCheckInfo : NSObject
  485 +/**
  486 + * 检查用户的id列表(NSString*)
  487 + */
  488 +@property(nonatomic,strong) NSArray* users;
  489 +
  490 +/**
  491 + * 检查类型
  492 + */
  493 +@property(nonatomic,assign) TIMFriendCheckType checkType;
  494 +
  495 +@end
  496 +
  497 +@interface TIMCheckFriendResult : NSObject
  498 +/**
  499 + * 用户id
  500 + */
  501 +@property(nonatomic,strong) NSString* identifier;
  502 +/**
  503 + * 返回状态
  504 + */
  505 +@property(nonatomic,assign) TIMFriendStatus status;
  506 +/**
  507 + * 检查结果
  508 + */
  509 +@property(nonatomic,assign) TIMFriendRelationType resultType;
  510 +
  511 +@end
  512 +
  513 +@interface TIMFriendResult : NSObject
  514 +
  515 +/**
  516 + * 用户Id
  517 + */
  518 +@property NSString* identifier;
  519 +
  520 +/**
  521 + * 返回码
  522 + */
  523 +@property NSInteger result_code;
  524 +
  525 +/**
  526 + * 返回信息
  527 + */
  528 +@property NSString *result_info;
  529 +
  530 +@end
  531 +
  532 +/**
  533 + * 响应好友请求
  534 + */
  535 +@interface TIMFriendResponse : NSObject
  536 +
  537 +/**
  538 + * 响应类型
  539 + */
  540 +@property(nonatomic,assign) TIMFriendResponseType responseType;
  541 +
  542 +/**
  543 + * 用户identifier
  544 + */
  545 +@property(nonatomic,strong) NSString* identifier;
  546 +
  547 +/**
  548 + * 备注好友(可选,如果要加对方为好友)。备注最大96字节
  549 + */
  550 +@property(nonatomic,strong) NSString* remark;
  551 +
  552 +@end
  553 +
  554 +
  555 +/**
  556 + * 好友分组信息扩展
  557 + */
  558 +@interface TIMFriendGroupWithProfiles : TIMFriendGroup
  559 +/**
  560 + * 好友资料(TIMUserProfile*)列表
  561 + */
  562 +@property(nonatomic,strong) NSArray* profiles;
  563 +@end
  564 +
  565 +// 用户资料KEY
  566 +
  567 +/**
  568 + * 昵称
  569 + * 值类型: NSString
  570 + */
  571 +extern NSString *const TIMProfileTypeKey_Nick;
  572 +/**
  573 + * 头像
  574 + * 值类型: NSString
  575 + */
  576 +extern NSString *const TIMProfileTypeKey_FaceUrl;
  577 +/**
  578 + * 好友申请
  579 + * 值类型: NSNumber [TIM_FRIEND_ALLOW_ANY,TIM_FRIEND_NEED_CONFIRM,TIM_FRIEND_DENY_ANY]
  580 + */
  581 +extern NSString *const TIMProfileTypeKey_AllowType;
  582 +/**
  583 + * 性别
  584 + * 值类型: NSNumber [TIM_GENDER_UNKNOWN,TIM_GENDER_MALE,TIM_GENDER_FEMALE]
  585 + */
  586 +extern NSString *const TIMProfileTypeKey_Gender;
  587 +/**
  588 + * 生日
  589 + * 值类型: NSNumber
  590 + */
  591 +extern NSString *const TIMProfileTypeKey_Birthday;
  592 +/**
  593 + * 位置
  594 + * 值类型: NSString
  595 + */
  596 +extern NSString *const TIMProfileTypeKey_Location;
  597 +/**
  598 + * 语言
  599 + * 值类型: NSNumber
  600 + */
  601 +extern NSString *const TIMProfileTypeKey_Language;
  602 +/**
  603 + * 等级
  604 + * 值类型: NSNumber
  605 + */
  606 +extern NSString *const TIMProfileTypeKey_Level;
  607 +/**
  608 + * 角色
  609 + * 值类型: NSNumber
  610 + */
  611 +extern NSString *const TIMProfileTypeKey_Role;
  612 +/**
  613 + * 签名
  614 + * 值类型: NSString
  615 + */
  616 +extern NSString *const TIMProfileTypeKey_SelfSignature;
  617 +/**
  618 + * 自定义字段前缀
  619 + * 值类型: [NSString,NSData|NSNumber]
  620 + * @note 当设置自定义字的值NSString对象时,后台会将其转为UTF8保存在数据库中。由于部分用户迁移资料时可能不是UTF8类型,所以在获取资料时,统一返回NSData类型。
  621 + */
  622 +extern NSString *const TIMProfileTypeKey_Custom_Prefix;
  623 +
  624 +// 好友资料KEY
  625 +
  626 +/**
  627 + * 备注
  628 + * 值类型: NSString
  629 + */
  630 +extern NSString *const TIMFriendTypeKey_Remark;
  631 +/**
  632 + * 分组
  633 + * 值类型: [NSArray]
  634 + */
  635 +extern NSString *const TIMFriendTypeKey_Group;
  636 +/**
  637 + * 自定义字段前缀
  638 + * 值类型: [NSString,NSData|NSNumber]
  639 + */
  640 +extern NSString *const TIMFriendTypeKey_Custom_Prefix;
  641 +#endif /* TIMFriendshipDefine_h */
  642 +
  1 +//
  2 +// TIMFriendshipManager.h
  3 +// imsdk
  4 +//
  5 +// Created by annidyfeng on 2019/3/7.
  6 +// Copyright © 2019年 Tencent. All rights reserved.
  7 +//
  8 +
  9 +#ifndef TIMFriendshipManager_h
  10 +#define TIMFriendshipManager_h
  11 +
  12 +#import "TIMComm.h"
  13 +#import "TIMFriendshipDefine.h"
  14 +
  15 +@interface TIMFriendshipManager : NSObject
  16 +/**
  17 + * 获取好友管理器实例
  18 + *
  19 + * @return 管理器实例
  20 + */
  21 ++ (TIMFriendshipManager*)sharedInstance;
  22 +
  23 +/**
  24 + * 设置自己的资料
  25 + *
  26 + * @param values 需要更新的属性,可一次更新多个字段. 参见 TIMFriendshipDefine.h 的 TIMProfileTypeKey_XXX
  27 + * @param succ 成功回调
  28 + * @param fail 失败回调
  29 + *
  30 + * @return 0 发送请求成功
  31 + */
  32 +- (int)modifySelfProfile:(NSDictionary<NSString *, id> *)values succ:(TIMSucc)succ fail:(TIMFail)fail;
  33 +
  34 +/**
  35 + * 获取自己的资料
  36 + *
  37 + * @param succ 成功回调,返回 TIMUserProfile
  38 + * @param fail 失败回调
  39 + *
  40 + * @return 0 发送请求成功
  41 + */
  42 +- (int)getSelfProfile:(TIMGetProfileSucc)succ fail:(TIMFail)fail;
  43 +
  44 +/**
  45 + * 获取指定用户资料
  46 + *
  47 + * @param identifiers 用户id,非好友的用户也可以
  48 + * @prarm forceUpdate 强制从后台拉取
  49 + * @param succ 成功回调
  50 + * @param fail 失败回调
  51 + *
  52 + * @return 0 发送请求成功
  53 + */
  54 +- (int)getUsersProfile:(NSArray<NSString *> *)identifiers forceUpdate:(BOOL)forceUpdate succ:(TIMUserProfileArraySucc)succ fail:(TIMFail)fail;
  55 +
  56 +/**
  57 + * 获取好友列表
  58 + *
  59 + * @param succ 成功回调,返回好友(TIMFriend)列表
  60 + * @param fail 失败回调
  61 + *
  62 + * @return 0 发送请求成功
  63 + */
  64 +-(int)getFriendList:(TIMFriendArraySucc)succ fail:(TIMFail)fail;
  65 +
  66 +
  67 +/**
  68 + * 添加好友
  69 + *
  70 + * @param request 添加好友请求
  71 + * @param succ 成功回调(TIMFriendResult)
  72 + * @param fail 失败回调
  73 + *
  74 + * @return 0 发送请求成功
  75 + */
  76 +- (int)addFriend:(TIMFriendRequest *)request succ:(TIMFriendResultSucc)succ fail:(TIMFail)fail;
  77 +
  78 +/**
  79 + * 响应对方好友邀请
  80 + *
  81 + * @param response 响应请求
  82 + * @param succ 成功回调
  83 + * @param fail 失败回调
  84 + *
  85 + * @return 0 发送请求成功
  86 + */
  87 +- (int)doResponse:(TIMFriendResponse *)response succ:(TIMFriendResultSucc)succ fail:(TIMFail)fail;
  88 +
  89 +/**
  90 + * 删除好友
  91 + *
  92 + * @param identifiers 好友id
  93 + * @param delType 删除类型(单向好友、双向好友)
  94 + * @param succ 成功回调([TIMFriendResult])
  95 + * @param fail 失败回调
  96 + *
  97 + * @return 0 发送请求成功
  98 + */
  99 +- (int)deleteFriends:(NSArray *)identifiers delType:(TIMDelFriendType)delType succ:(TIMFriendResultArraySucc)succ fail:(TIMFail)fail;
  100 +
  101 +/**
  102 + * 修改好友
  103 + *
  104 + * @param identifier 好友id
  105 + * @param values 需要更新的属性,可一次更新多个字段. 参见 TIMFriendshipDefine.h 的 TIMFriendTypeKey_XXX
  106 + * @param succ 成功回调
  107 + * @param fail 失败回调
  108 + *
  109 + * @return 0 发送请求成功
  110 + */
  111 +- (int)modifyFriend:(NSString *)identifier values:(NSDictionary<NSString *, id> *)values succ:(TIMSucc)succ fail:(TIMFail)fail;
  112 +
  113 +/**
  114 + * 未决列表请求
  115 + *
  116 + * @param pendencyRequest 请求信息,详细参考TIMFriendPendencyRequest
  117 + * @param succ 成功回调
  118 + * @param fail 失败回调
  119 + *
  120 + * @return 0 发送请求成功
  121 + */
  122 +- (int)getPendencyList:(TIMFriendPendencyRequest *)pendencyRequest succ:(TIMGetFriendPendencyListSucc)succ fail:(TIMFail)fail;
  123 +
  124 +/**
  125 + * 未决删除
  126 + *
  127 + * @param type 未决好友类型
  128 + * @param identifiers 要删除的未决列表
  129 + * @param succ 成功回调
  130 + * @param fail 失败回调
  131 + *
  132 + * @return 0 发送请求成功
  133 + */
  134 +- (int)deletePendency:(TIMPendencyType)type users:(NSArray *)identifiers succ:(TIMSucc)succ fail:(TIMFail)fail;
  135 +
  136 +/**
  137 + * 未决已读上报
  138 + *
  139 + * @param timestamp 已读时间戳,此时间戳以前的消息都将置为已读
  140 + * @param succ 成功回调
  141 + * @param fail 失败回调
  142 + *
  143 + * @return 0 发送请求成功
  144 + */
  145 +- (int)pendencyReport:(uint64_t)timestamp succ:(TIMSucc)succ fail:(TIMFail)fail;
  146 +
  147 +/**
  148 + * 获取黑名单列表
  149 + *
  150 + * @param succ 成功回调,返回NSString*列表
  151 + * @param fail 失败回调
  152 + *
  153 + * @return 0 发送请求成功
  154 + */
  155 +- (int)getBlackList:(TIMFriendArraySucc)succ fail:(TIMFail)fail;
  156 +
  157 +/**
  158 + * 添加用户到黑名单
  159 + *
  160 + * @param identifiers 用户列表
  161 + * @param succ 成功回调
  162 + * @param fail 失败回调
  163 + *
  164 + * @return 0 发送请求成功
  165 + */
  166 +- (int)addBlackList:(NSArray *)identifiers succ:(TIMFriendResultArraySucc)succ fail:(TIMFail)fail;
  167 +
  168 +/**
  169 + * 把用户从黑名单中删除
  170 + *
  171 + * @param identifiers 用户列表
  172 + * @param succ 成功回调
  173 + * @param fail 失败回调
  174 + *
  175 + * @return 0 发送请求成功
  176 + */
  177 +- (int)deleteBlackList:(NSArray *)identifiers succ:(TIMFriendResultArraySucc)succ fail:(TIMFail)fail;
  178 +
  179 +/**
  180 + * 新建好友分组
  181 + *
  182 + * @param groupNames 分组名称列表,必须是当前不存在的分组
  183 + * @param identifiers 要添加到分组中的好友
  184 + * @param succ 成功回调
  185 + * @param fail 失败回调
  186 + *
  187 + * @return 0 发送请求成功
  188 + */
  189 +- (int)createFriendGroup:(NSArray *)groupNames users:(NSArray *)identifiers succ:(TIMFriendResultArraySucc)succ fail:(TIMFail)fail;
  190 +
  191 +/**
  192 + * 获取指定的好友分组信息
  193 + *
  194 + * @param groupNames 要获取信息的好友分组名称列表,传入nil获得所有分组信息
  195 + * @param succ 成功回调,返回 TIMFriendGroup* 列表
  196 + * @param fail 失败回调
  197 + *
  198 + * @return 0 发送请求成功
  199 + */
  200 +- (int)getFriendGroups:(NSArray *)groupNames succ:(TIMFriendGroupArraySucc)succ fail:(TIMFail)fail;
  201 +
  202 +/**
  203 + * 删除好友分组
  204 + *
  205 + * @param groupNames 要删除的好友分组名称列表
  206 + * @param succ 成功回调
  207 + * @param fail 失败回调
  208 + *
  209 + * @return 0 发送请求成功
  210 + */
  211 +- (int)deleteFriendGroup:(NSArray *)groupNames succ:(TIMSucc)succ fail:(TIMFail)fail;
  212 +
  213 +/**
  214 + * 修改好友分组的名称
  215 + *
  216 + * @param oldName 原来的分组名称
  217 + * @param newName 新的分组名称
  218 + * @param succ 成功回调
  219 + * @param fail 失败回调
  220 + *
  221 + * @return 0 发送请求成功
  222 + */
  223 +- (int)renameFriendGroup:(NSString*)oldName newName:(NSString*)newName succ:(TIMSucc)succ fail:(TIMFail)fail;
  224 +
  225 +/**
  226 + * 添加好友到一个好友分组
  227 + *
  228 + * @param groupName 好友分组名称
  229 + * @param identifiers 要添加到分组中的好友
  230 + * @param succ 成功回调
  231 + * @param fail 失败回调
  232 + *
  233 + * @return 0 发送请求成功
  234 + */
  235 +- (int)addFriendsToFriendGroup:(NSString *)groupName users:(NSArray *)identifiers succ:(TIMFriendResultArraySucc)succ fail:(TIMFail)fail;
  236 +
  237 +/**
  238 + * 从好友分组中删除好友
  239 + *
  240 + * @param groupName 好友分组名称
  241 + * @param identifiers 要移出分组的好友
  242 + * @param succ 成功回调
  243 + * @param fail 失败回调
  244 + *
  245 + * @return 0 发送请求成功
  246 + */
  247 +- (int)deleteFriendsFromFriendGroup:(NSString *)groupName users:(NSArray *)identifiers succ:(TIMFriendResultArraySucc)succ fail:(TIMFail)fail;
  248 +@end
  249 +
  250 +#endif /* TIMFriendshipManager_h */
  1 +//
  2 +// TIMGroupManager+Ext.h
  3 +// IMGroupExt
  4 +//
  5 +// Created by tomzhu on 2017/2/9.
  6 +//
  7 +//
  8 +
  9 +#ifndef TIMGroupManager_Ext_h
  10 +#define TIMGroupManager_Ext_h
  11 +
  12 +#import "TIMGroupManager.h"
  13 +#import "TIMComm+Group.h"
  14 +
  15 +@interface TIMGroupManager (Ext)
  16 +
  17 +/**
  18 + * 创建私有群
  19 + *
  20 + * 创建者默认加入群组,无需显式指定,群组类型形态请参考官网文档 [群组形态介绍](https://cloud.tencent.com/document/product/269/1502#.E7.BE.A4.E7.BB.84.E5.BD.A2.E6.80.81.E4.BB.8B.E7.BB.8D)
  21 + *
  22 + * @param members 群成员,NSString* 数组
  23 + * @param groupName 群名
  24 + * @param succ 成功回调 groupId
  25 + * @param fail 失败回调
  26 + *
  27 + * @return 0:成功;1:失败
  28 + */
  29 +- (int)createPrivateGroup:(NSArray*)members groupName:(NSString*)groupName succ:(TIMCreateGroupSucc)succ fail:(TIMFail)fail;
  30 +
  31 +/**
  32 + * 创建公开群
  33 + *
  34 + * 创建者默认加入群组,无需显式指定,群组类型形态请参考官网文档 [群组形态介绍](https://cloud.tencent.com/document/product/269/1502#.E7.BE.A4.E7.BB.84.E5.BD.A2.E6.80.81.E4.BB.8B.E7.BB.8D)
  35 + *get
  36 + * @param members 群成员,NSString* 数组
  37 + * @param groupName 群名
  38 + * @param succ 成功回调 groupId
  39 + * @param fail 失败回调
  40 + *
  41 + * @return 0:成功;1:失败
  42 + */
  43 +- (int)createPublicGroup:(NSArray*)members groupName:(NSString*)groupName succ:(TIMCreateGroupSucc)succ fail:(TIMFail)fail;
  44 +
  45 +/**
  46 + * 创建聊天室
  47 + *
  48 + * 创建者默认加入群组,无需显式指定,群组类型形态请参考官网文档 [群组形态介绍](https://cloud.tencent.com/document/product/269/1502#.E7.BE.A4.E7.BB.84.E5.BD.A2.E6.80.81.E4.BB.8B.E7.BB.8D)
  49 + *
  50 + * @param members 群成员,NSString* 数组
  51 + * @param groupName 群名
  52 + * @param succ 成功回调 groupId
  53 + * @param fail 失败回调
  54 + *
  55 + * @return 0:成功;1:失败
  56 + */
  57 +- (int)createChatRoomGroup:(NSArray*)members groupName:(NSString*)groupName succ:(TIMCreateGroupSucc)succ fail:(TIMFail)fail;
  58 +
  59 +/**
  60 + * 创建音视频聊天室(可支持超大群,详情可参考wiki文档)
  61 + *
  62 + * 创建者默认加入群组,无需显式指定,群组类型形态请参考官网文档 [群组形态介绍](https://cloud.tencent.com/document/product/269/1502#.E7.BE.A4.E7.BB.84.E5.BD.A2.E6.80.81.E4.BB.8B.E7.BB.8D)
  63 + *
  64 + * @param groupName 群名
  65 + * @param succ 成功回调 groupId
  66 + * @param fail 失败回调
  67 + *
  68 + * @return 0:成功;1:失败
  69 + */
  70 +- (int)createAVChatRoomGroup:(NSString*)groupName succ:(TIMCreateGroupSucc)succ fail:(TIMFail)fail;
  71 +
  72 +/**
  73 + * 创建自定义群组
  74 + *
  75 + * 在创建群组时,除了设置默认的成员以及群名外,还可以设置如群公告、群简介等字段。
  76 + *
  77 + * @param groupInfo 群组信息,详情请参考 TIMComm+Group.h 里面的 TIMCreateGroupInfo 定义
  78 + * @param succ 成功回调 groupId
  79 + * @param fail 失败回调
  80 + *
  81 + * @return 0:成功;1:失败
  82 + */
  83 +- (int)createGroup:(TIMCreateGroupInfo*)groupInfo succ:(TIMCreateGroupSucc)succ fail:(TIMFail)fail;
  84 +
  85 +/**
  86 + * 邀请好友入群
  87 + *
  88 + * 1. 只有私有群可以拉用户入群。
  89 + * 2. 直播大群:不能邀请用户入群。
  90 + * 3. 不允许群成员邀请他人入群,但创建群时可以直接拉人入群。
  91 + *
  92 + * @param group 群组Id
  93 + * @param members 要加入的成员列表(NSString* 类型数组)
  94 + * @param succ 成功回调
  95 + * @param fail 失败回调
  96 + *
  97 + * @return 0:成功;1:失败
  98 + */
  99 +- (int)inviteGroupMember:(NSString*)group members:(NSArray*)members succ:(TIMGroupMemberSucc)succ fail:(TIMFail)fail;
  100 +
  101 +/**
  102 + * 删除群成员
  103 + *
  104 + * 1. 私有群:只有创建者可删除群组成员。
  105 + * 2. 公开群、聊天室:只有管理员和群主可以踢人。
  106 + * 3. 对于直播大群:不能踢人。
  107 + *
  108 + * @param group 群组Id
  109 + * @param reason 删除原因
  110 + * @param members 要删除的成员列表
  111 + * @param succ 成功回调
  112 + * @param fail 失败回调
  113 + *
  114 + * @return 0:成功;1:失败
  115 + */
  116 +- (int)deleteGroupMemberWithReason:(NSString*)group reason:(NSString*)reason members:(NSArray*)members succ:(TIMGroupMemberSucc)succ fail:(TIMFail)fail;
  117 +
  118 +/**
  119 + * 获取群公开信息(暂未实现)
  120 + *
  121 + * 任意用户可以获取群公开资料,只能获取公开信息。
  122 + *
  123 + * @param groups 群组Id
  124 + * @param succ 成功回调
  125 + * @param fail 失败回调
  126 + *
  127 + * @return 0:成功;1:失败
  128 + */
  129 +- (int)getGroupPublicInfo:(NSArray*)groups succ:(TIMGroupListSucc)succ fail:(TIMFail)fail;
  130 +
  131 +/**
  132 + * 获取群列表
  133 + *
  134 + * 1. 可以获取自己所加入的群列表。
  135 + * 2. 只能获得加入的部分直播大群的列表。
  136 + *
  137 + * @param succ 成功回调,NSArray 列表为 TIMGroupInfo,结构体只包含 group\groupName\groupType\faceUrl\allShutup\selfInfo 信息
  138 + * @param fail 失败回调
  139 + *
  140 + * @return 0:成功;1:失败
  141 + */
  142 +- (int)getGroupList:(TIMGroupListSucc)succ fail:(TIMFail)fail;
  143 +
  144 +/**
  145 + * 获取群信息
  146 + *
  147 + * 1. 获取群组资料接口只能由群成员调用,非群成员无法通过此方法获取资料,需要调用 getGroupPublicInfo 获取资料。
  148 + * 2. 默认拉取基本资料,如果想要拉取自定义字段,首先要通过 [IM 控制台](https://console.cloud.tencent.com/avc) -> 功能配置 -> 群维度自定义字段 配置相关的 key 和权限,然后在 initSDK 的时候把生成的 key 设置在 IMGroupInfoOption 里面的 groupCustom 字段。需要注意的是,只有对自定义字段 value 做了赋值或则修改,才能拉取到自定义字段。
  149 + *
  150 + * @param succ 成功回调,不包含 selfInfo信息
  151 + * @param fail 失败回调
  152 + *
  153 + * @return 0:成功;1:失败
  154 + */
  155 +- (int)getGroupInfo:(NSArray*)groups succ:(TIMGroupListSucc)succ fail:(TIMFail)fail;
  156 +
  157 +/**
  158 + * 获取本人在群组内的成员信息
  159 + *
  160 + * 默认拉取基本资料,如果想要拉取自定义字段,请参考 getGroupInfo
  161 + *
  162 + * @param group 群组Id
  163 + * @param succ 成功回调,返回信息
  164 + * @param fail 失败回调
  165 + *
  166 + * @return 0:成功;1:失败
  167 + */
  168 +- (int)getGroupSelfInfo:(NSString*)group succ:(TIMGroupSelfSucc)succ fail:(TIMFail)fail;
  169 +
  170 +/**
  171 + * 获取接受消息选项
  172 + *
  173 + * @param group 群组Id
  174 + * @param succ 成功回调, TIMGroupReceiveMessageOpt 0:接收消息;1:不接收消息,服务器不进行转发;2:接受消息,不进行 iOS APNs 推送
  175 + * @param fail 失败回调
  176 + *
  177 + * @return 0:成功;1:失败
  178 + */
  179 +- (int)getReciveMessageOpt:(NSString*)group succ:(TIMGroupReciveMessageOptSucc)succ fail:(TIMFail)fail;
  180 +
  181 +/**
  182 + * 获取群成员列表
  183 + *
  184 + * 1. 获取群内成员列表,默认拉取内置字段,但不拉取自定义字段,如果想要拉取自定义字段,首先要通过 [IM 控制台](https://console.cloud.tencent.com/avc) -> 功能配置 -> 群维度自定义字段 配置相关的 key 和权限,然后在 initSDK 的时候把生成的 key 设置在 IMGroupInfoOption 里面的 groupCustom 字段。需要注意的是,只有对自定义字段的 value 做了赋值或则修改,才能拉取到自定义字段。
  185 + * 2. 任何群组类型:都可以获取成员列表。
  186 + * 3. 直播大群:只能拉取部分成员(包括群主、管理员和部分成员)。
  187 + *
  188 + * @param group 群组Id
  189 + * @param succ 成功回调(TIMGroupMemberInfo列表)
  190 + * @param fail 失败回调
  191 + *
  192 + * @return 0:成功;1:失败
  193 + */
  194 +- (int)getGroupMembers:(NSString*)group succ:(TIMGroupMemberSucc)succ fail:(TIMFail)fail;
  195 +
  196 +/**
  197 + * 获取群组指定成员的信息
  198 + *
  199 + * 获取群组指定成员的信息,需要设置群成员 members,其他限制参考 getGroupMembers
  200 + *
  201 + * @param group 群组Id
  202 + * @param members 成员Id(NSString*)列表
  203 + * @param succ 成功回调(TIMGroupMemberInfo列表)
  204 + * @param fail 失败回调
  205 + *
  206 + * @return 0:成功;1:失败
  207 + */
  208 +- (int)getGroupMembersInfo:(NSString*)group members:(NSArray*)members succ:(TIMGroupMemberSucc)succ fail:(TIMFail)fail;
  209 +
  210 +/**
  211 + * 获取指定类型的成员列表(支持按字段拉取,分页)
  212 + *
  213 + * @param group 群组Id:(NSString*) 列表
  214 + * @param filter 群成员角色过滤方式
  215 + * @param flags 拉取资料标志
  216 + * @param custom 要获取的自定义key(NSString*)列表
  217 + * @param nextSeq 分页拉取标志,第一次拉取填0,回调成功如果 nextSeq 不为零,需要分页,传入再次拉取,直至为0
  218 + * @param succ 成功回调
  219 + * @param fail 失败回调
  220 + * @return 0:成功;1:失败
  221 + */
  222 +- (int)getGroupMembers:(NSString*)group ByFilter:(TIMGroupMemberFilter)filter flags:(TIMGetGroupMemInfoFlag)flags custom:(NSArray*)custom nextSeq:(uint64_t)nextSeq succ:(TIMGroupMemberSuccV2)succ fail:(TIMFail)fail;
  223 +
  224 +/**
  225 + * 修改群名
  226 + *
  227 + * 1. 公开群、聊天室和直播大群:只有群主或者管理员可以修改群名。
  228 + * 2. 私有群:任何人可修改群名。
  229 + *
  230 + * @param group 群组Id
  231 + * @param groupName 新群名
  232 + * @param succ 成功回调
  233 + * @param fail 失败回调
  234 + *
  235 + * @return 0:成功;1:失败
  236 + */
  237 +- (int)modifyGroupName:(NSString*)group groupName:(NSString*)groupName succ:(TIMSucc)succ fail:(TIMFail)fail;
  238 +
  239 +/**
  240 + * 修改群简介
  241 + *
  242 + * 1. 公开群、聊天室、直播大群:只有群主或者管理员可以修改群简介。
  243 + * 2. 私有群:任何人可修改群简介。
  244 + *
  245 + * @param group 群组Id
  246 + * @param introduction 群简介(最长120字节)
  247 + * @param succ 成功回调
  248 + * @param fail 失败回调
  249 + *
  250 + * @return 0:成功;1:失败
  251 + */
  252 +- (int)modifyGroupIntroduction:(NSString*)group introduction:(NSString*)introduction succ:(TIMSucc)succ fail:(TIMFail)fail;
  253 +
  254 +/**
  255 + * 修改群公告
  256 + *
  257 + * 1. 公开群、聊天室、直播大群:只有群主或者管理员可以修改群公告。
  258 + * 2. 私有群:任何人可修改群公告。
  259 + *
  260 + * @param group 群组Id
  261 + * @param notification 群公告(最长150字节)
  262 + * @param succ 成功回调
  263 + * @param fail 失败回调
  264 + *
  265 + * @return 0:成功;1:失败
  266 + */
  267 +- (int)modifyGroupNotification:(NSString*)group notification:(NSString*)notification succ:(TIMSucc)succ fail:(TIMFail)fail;
  268 +
  269 +/**
  270 + * 修改群头像
  271 + *
  272 + * 1. 公开群、聊天室、直播大群:只有群主或者管理员可以修改群头像。
  273 + * 2. 私有群:任何人可修改群头像。
  274 + *
  275 + * @param group 群组Id
  276 + * @param url 群头像地址(最长100字节)
  277 + * @param succ 成功回调
  278 + * @param fail 失败回调
  279 + *
  280 + * @return 0:成功;1:失败
  281 + */
  282 +- (int)modifyGroupFaceUrl:(NSString*)group url:(NSString*)url succ:(TIMSucc)succ fail:(TIMFail)fail;
  283 +
  284 +/**
  285 + * 修改加群选项
  286 + *
  287 + * 1. 公开群、聊天室、直播大群:只有群主或者管理员可以修改加群选项。
  288 + * 2. 私有群:只能通过邀请加入群组,不能主动申请加入某个群组。
  289 + *
  290 + * @param group 群组Id
  291 + * @param opt 加群选项,详见 TIMGroupAddOpt
  292 + * @param succ 成功回调
  293 + * @param fail 失败回调
  294 + *
  295 + * @return 0:成功;1:失败
  296 + */
  297 +- (int)modifyGroupAddOpt:(NSString*)group opt:(TIMGroupAddOpt)opt succ:(TIMSucc)succ fail:(TIMFail)fail;
  298 +
  299 +/**
  300 + * 修改群自定义字段集合
  301 + *
  302 + * 通过 [IM 控制台](https://console.cloud.tencent.com/avc) -> 功能配置 -> 群维度自定义字段 配置相关的 key 和权限。
  303 + *
  304 + * @param group 群组Id
  305 + * @param customInfo 自定义字段集合,key 是 NSString* 类型,value 是 NSData* 类型
  306 + * @param succ 成功回调
  307 + * @param fail 失败回调
  308 + *
  309 + * @return 0:成功;1:失败
  310 + */
  311 +- (int)modifyGroupCustomInfo:(NSString*)group customInfo:(NSDictionary*)customInfo succ:(TIMSucc)succ fail:(TIMFail)fail;
  312 +
  313 +/**
  314 + * 转让群给新群主
  315 + *
  316 + * 1. 只有群主才有权限进行群转让操作。
  317 + * 2. 直播大群不能进行群转让操作。
  318 + *
  319 + * @param group 群组Id
  320 + * @param identifier 新的群主Id
  321 + * @param succ 成功回调
  322 + * @param fail 失败回调
  323 + *
  324 + * @return 0:成功;1:失败
  325 + */
  326 +- (int)modifyGroupOwner:(NSString*)group user:(NSString*)identifier succ:(TIMSucc)succ fail:(TIMFail)fail;
  327 +
  328 +/**
  329 + * 修改接受消息选项
  330 + *
  331 + * 默认情况下,公开群和私有群是接收并离线推送群消息,聊天室和直播大群是接收但不离线推送群消息。
  332 + *
  333 + * @param group 群组Id
  334 + * @param opt 接受消息选项,详见 TIMGroupReceiveMessageOpt
  335 + * @param succ 成功回调
  336 + * @param fail 失败回调
  337 + *
  338 + * @return 0:成功;1:失败
  339 + */
  340 +- (int)modifyReciveMessageOpt:(NSString*)group opt:(TIMGroupReceiveMessageOpt)opt succ:(TIMSucc)succ fail:(TIMFail)fail;
  341 +
  342 +/**
  343 + * 修改群成员角色
  344 + *
  345 + * 1. 群主、管理员:可以进行对群成员的身份进行修改。
  346 + * 2. 直播大群:不支持修改用户群内身份。
  347 + *
  348 + * @param group 群组Id
  349 + * @param identifier 被修改角色的用户identifier
  350 + * @param role 角色(注意:不能修改为群主),详见 TIMGroupMemberRole
  351 + * @param succ 成功回调
  352 + * @param fail 失败回调
  353 + *
  354 + * @return 0:成功;1:失败
  355 + */
  356 +- (int)modifyGroupMemberInfoSetRole:(NSString*)group user:(NSString*)identifier role:(TIMGroupMemberRole)role succ:(TIMSucc)succ fail:(TIMFail)fail;
  357 +
  358 +/**
  359 + * 禁言用户
  360 + *
  361 + * 只有管理员或群主能够调用
  362 + *
  363 + * @param group 群组Id
  364 + * @param identifier 被禁言的用户identifier
  365 + * @param stime 禁言时间
  366 + * @param succ 成功回调
  367 + * @param fail 失败回调
  368 + *
  369 + * @return 0:成功;1:失败
  370 + */
  371 +- (int)modifyGroupMemberInfoSetSilence:(NSString*)group user:(NSString*)identifier stime:(uint32_t)stime succ:(TIMSucc)succ fail:(TIMFail)fail;
  372 +
  373 +/**
  374 + * 修改群名片
  375 + *
  376 + * 只有本人、管理员或群主能够调用
  377 + *
  378 + * @param group 群组Id
  379 + * @param identifier 被操作用户identifier
  380 + * @param nameCard 群名片
  381 + * @param succ 成功回调
  382 + * @param fail 失败回调
  383 + *
  384 + * @return 0:成功;1:失败
  385 + */
  386 +- (int)modifyGroupMemberInfoSetNameCard:(NSString*)group user:(NSString*)identifier nameCard:(NSString*)nameCard succ:(TIMSucc)succ fail:(TIMFail)fail;
  387 +
  388 +/**
  389 + * 修改群成员自定义字段集合
  390 + *
  391 + * 通过 [IM 控制台](https://console.cloud.tencent.com/avc) -> 功能配置 -> 群成员维度自定义字段 配置相关的 key 和权限。
  392 + *
  393 + * @param group 群组 Id
  394 + * @param identifier 被操作用户 identifier
  395 + * @param customInfo 自定义字段集合,key 是 NSString* 类型,value 是 NSData* 类型
  396 + * @param succ 成功回调
  397 + * @param fail 失败回调
  398 + *
  399 + * @return 0:成功;1:失败
  400 + */
  401 +- (int)modifyGroupMemberInfoSetCustomInfo:(NSString*)group user:(NSString*)identifier customInfo:(NSDictionary*)customInfo succ:(TIMSucc)succ fail:(TIMFail)fail;
  402 +
  403 +/**
  404 + * 修改群组是否可被搜索属性
  405 + *
  406 + * @param group 群组Id
  407 + * @param searchable 是否能被搜索
  408 + * @param succ 成功回调
  409 + * @param fail 失败回调
  410 + *
  411 + * @return 0:成功;1:失败
  412 + */
  413 +- (int)modifyGroupSearchable:(NSString*)group searchable:(BOOL)searchable succ:(TIMSucc)succ fail:(TIMFail)fail;
  414 +
  415 +/**
  416 + * 修改群组成员是否可见属性
  417 + *
  418 + * @param group 群组Id
  419 + * @param visible 是否可见
  420 + * @param succ 成功回调
  421 + * @param fail 失败回调
  422 + *
  423 + * @return 0:成功;1:失败
  424 + */
  425 +- (int)modifyGroupMemberVisible:(NSString*)group visible:(BOOL)visible succ:(TIMSucc)succ fail:(TIMFail)fail;
  426 +
  427 +/**
  428 + * 修改群组全员禁言属性
  429 + *
  430 + * 1. 群主、管理员:有权限进行全员禁言的操作。
  431 + * 2. 所有群组类型:都支持全员禁言的操作。
  432 + *
  433 + * @param group 群组Id
  434 + * @param shutup 是否禁言
  435 + * @param succ 成功回调
  436 + * @param fail 失败回调
  437 + *
  438 + * @return 0:成功;1:失败
  439 + */
  440 +- (int)modifyGroupAllShutup:(NSString*)group shutup:(BOOL)shutup succ:(TIMSucc)succ fail:(TIMFail)fail;
  441 +
  442 +/**
  443 + * 获取群组未决列表
  444 + *
  445 + * 1. 群未决消息泛指所有需要审批的群相关的操作(例如:加群待审批,拉人入群待审批等等)。即便审核通过或者拒绝后,该条信息也可通过此接口拉回,拉回的信息中有已决标志
  446 + * 2. 审批人:有权限拉取相关信息,如果 UserA 申请加入群 GroupA,则群管理员可获取此未决相关信息,UserA 因为没有审批权限,不需要拉取未决信息。如果 AdminA 拉 UserA 进去 GroupA,则 UserA 可以拉取此未决相关信息,因为该未决信息待 UserA 审批。
  447 + *
  448 + * @param option 未决参数配置
  449 + * @param succ 成功回调,返回未决列表
  450 + * @param fail 失败回调
  451 + *
  452 + * @return 0:成功;1:失败
  453 + */
  454 +- (int)getPendencyFromServer:(TIMGroupPendencyOption*)option succ:(TIMGetGroupPendencyListSucc)succ fail:(TIMFail)fail;
  455 +
  456 +/**
  457 + * 群未决已读上报
  458 + *
  459 + * 对于未决信息,SDK 可对其和之前的所有未决信息上报已读。上报已读后,仍然可以拉取到这些未决信息,但可通过对已读时戳的判断判定未决信息是否已读。
  460 + *
  461 + * @param timestamp 上报已读时间戳
  462 + * @param succ 成功回调
  463 + * @param fail 失败回调
  464 + *
  465 + * @return 0:成功;1:失败
  466 + */
  467 +- (int)pendencyReport:(uint64_t)timestamp succ:(TIMSucc)succ fail:(TIMFail)fail;
  468 +
  469 +/**
  470 + * 获取用户所在群组信息(暂未实现)
  471 + *
  472 + * 开启本地缓存后有效
  473 + *
  474 + * @param groups 群组id(NSString*)列表,nil时返回群组列表
  475 + *
  476 + * @return 群组信息(TIMGroupInfo*)列表,assistant未同步时返回nil
  477 + */
  478 +- (NSArray*)getGroupInfo:(NSArray*)groups;
  479 +
  480 +@end
  481 +
  482 +#endif /* TIMGroupManager_Ext_h */
  1 +//
  2 +// TIMGroupManager.h
  3 +// ImSDK
  4 +//
  5 +// Created by bodeng on 17/3/15.
  6 +// Copyright (c) 2015 tencent. All rights reserved.
  7 +//
  8 +
  9 +#ifndef ImSDK_TIMGroupManager_h
  10 +#define ImSDK_TIMGroupManager_h
  11 +
  12 +#import "TIMComm.h"
  13 +
  14 +
  15 +@interface TIMGroupManager : NSObject
  16 +
  17 +/**
  18 + * 获取群管理器实例
  19 + *
  20 + * @return 管理器实例
  21 + */
  22 ++ (TIMGroupManager*)sharedInstance;
  23 +
  24 +/**
  25 + * 创建群组
  26 + *
  27 + * 1. 默认创建群组时,IM 通讯云服务器会生成一个唯一的 ID,该 ID 将以 @TGS# 开头,且保证在 App 中唯一,以便后续操作。
  28 + * 2. 如果用户需要自定义群组 ID,在创建时可指定 ID,自定义群组 ID 必须为可打印 ASCII 字符(0x20-0x7e),最长 48 个字节,且前缀不能为 @TGS#(避免与默认分配的群组 ID 混淆)
  29 + *
  30 + * @param type 群类型,Private,Public,ChatRoom,AVChatRoom
  31 + * @param groupId 自定义群组 ID,为空时系统自动分配
  32 + * @param groupName 群组名称
  33 + * @param succ 成功回调
  34 + * @param fail 失败回调
  35 + *
  36 + * @return 0:成功;1:失败
  37 + */
  38 +- (int)createGroup:(NSString*)type groupId:(NSString*)groupId groupName:(NSString*)groupName succ:(TIMCreateGroupSucc)succ fail:(TIMFail)fail;
  39 +
  40 +/**
  41 + * 解散群组
  42 + *
  43 + * 1. 私有群:任何人都无法解散群组
  44 + * 2. 公开群、聊天室、直播大群:群主可以解散群组。
  45 + *
  46 + * @param group 群组Id
  47 + * @param succ 成功回调
  48 + * @param fail 失败回调
  49 + *
  50 + * @return 0:成功;1:失败
  51 + */
  52 +- (int)deleteGroup:(NSString*)group succ:(TIMSucc)succ fail:(TIMFail)fail;
  53 +
  54 +/**
  55 + * 申请加群
  56 + *
  57 + * 1. 私有群:不能由用户主动申请入群。
  58 + * 2. 公开群、聊天室:可以主动申请进入。
  59 + * 3. 直播大群:可以任意加入群组。
  60 + * 4. 如果群组设置为需要审核,申请入群后管理员和群主会收到申请入群系统消息 TIMGroupSystemElem,判断 TIMGroupSystemElem 的 Type 类型如果是 TIM_GROUP_SYSTEM_ADD_GROUP_REQUEST_TYPE ,调用消息的 accept 接口同意入群,申请人会收到同意入群的消息 TIMGroupSystemElem(Type:TIM_GROUP_SYSTEM_ADD_GROUP_ACCEPT_TYPE),调用 refuse 接口拒绝入群,申请人会收到拒绝入群的消息 TIMGroupSystemElem(Type:TIM_GROUP_SYSTEM_ADD_GROUP_REFUSE_TYPE)。
  61 + * 5. 如果群主设置为任何人可加入,则直接入群成功。
  62 + *
  63 + * @param group 申请加入的群组Id
  64 + * @param msg 申请消息
  65 + * @param succ 成功回调(申请成功等待审批)
  66 + * @param fail 失败回调
  67 + *
  68 + * @return 0:成功;1:失败
  69 + */
  70 +- (int)joinGroup:(NSString*)group msg:(NSString*)msg succ:(TIMSucc)succ fail:(TIMFail)fail;
  71 +
  72 +/**
  73 + * 主动退出群组
  74 + *
  75 + * 1. 私有群:全员可退出群组。
  76 + * 2. 公开群、聊天室、直播大群:群主不能退出。
  77 + * 3. 当用户主动退出群组时,该用户会收到退群消息 TIMGroupSystemElem(Type:TIM_GROUP_SYSTEM_QUIT_GROUP_TYPE),只有退群的用户自己可以收到。当用户调用 QuitGroup 时成功回调返回,表示已退出成功,此消息主要为了多终端同步,其他终端可以作为更新群列表的时机,本终端可以选择忽略。
  78 + *
  79 + * @param group 群组Id
  80 + * @param succ 成功回调
  81 + * @param fail 失败回调
  82 + *
  83 + * @return 0:成功;1:失败
  84 + */
  85 +- (int)quitGroup:(NSString*)group succ:(TIMSucc)succ fail:(TIMFail)fail;
  86 +
  87 +@end
  88 +
  89 +#endif
  1 +//
  2 +// TIMManager+MsgExt.h
  3 +// IMMessageExt
  4 +//
  5 +// Created by tomzhu on 2017/1/11.
  6 +//
  7 +//
  8 +
  9 +#ifndef TIMManager_MsgExt_h
  10 +#define TIMManager_MsgExt_h
  11 +
  12 +#import "TIMManager.h"
  13 +#import "TIMComm+MsgExt.h"
  14 +
  15 +@class TIMMessage;
  16 +
  17 +@interface TIMManager (MsgExt)
  18 +
  19 +/**
  20 + * 发送消息给多个用户
  21 + *
  22 + * @param msg 发送的消息
  23 + * @param users 目标用户的id列表
  24 + * @param succ 成功回调
  25 + * @param fail 失败回调
  26 + *
  27 + * @return 0 发送成功
  28 + */
  29 +- (int)sendMessage:(TIMMessage*)msg toUsers:(NSArray*)users succ:(TIMSucc)succ fail:(TIMSendToUsersFail)fail;
  30 +
  31 +/**
  32 + * 获取会话(TIMConversation*)列表
  33 + *
  34 + * @return 会话列表
  35 + */
  36 +- (NSArray*)getConversationList;
  37 +
  38 +/**
  39 + * 删除会话
  40 + *
  41 + * @param type 会话类型,TIM_C2C:表示单聊;TIM_GROUP:表示群聊
  42 + * @param receiver 用户 identifier 或者群组 Id
  43 + *
  44 + * @return TRUE:删除成功;FALSE:删除失败
  45 + */
  46 +- (BOOL)deleteConversation:(TIMConversationType)type receiver:(NSString*)receiver;
  47 +
  48 +/**
  49 + * 删除会话和消息
  50 + *
  51 + * 这里只是删除本地消息,通过 getMessage 会拉取到漫游消息,所以存在删除消息成功,但是拉取到消息的情况,取决于是否重新从漫游拉回到本地。如果不需要拉取漫游,可以通过 getLocalMessage 获取本地消息,或者只通过 getMessage 拉取指定条数(如未读条数数量)的消息。
  52 + *
  53 + * @param type 会话类型,TIM_C2C:表示单聊;TIM_GROUP:表示群聊
  54 + * @param receiver 用户identifier 或者 群组 Id
  55 + *
  56 + * @return TRUE:删除成功;FALSE:删除失败
  57 + */
  58 +- (BOOL)deleteConversationAndMessages:(TIMConversationType)type receiver:(NSString*)receiver;
  59 +
  60 +/**
  61 + * 获取会话数量
  62 + *
  63 + * @return 会话数量
  64 + */
  65 +- (int)conversationCount;
  66 +
  67 +/**
  68 + * 初始化存储(暂未实现)
  69 + *
  70 + * 仅查看历史消息时使用,如果要收发消息等操作,如login成功,不需要调用此函数
  71 + *
  72 + * @param param 登陆参数(userSig 不用填写)
  73 + * @param succ 成功回调,收到回调时,可以获取会话列表和消息
  74 + * @param fail 失败回调
  75 + *
  76 + * @return 0:请求成功;1:失败
  77 + */
  78 +- (int)initStorage:(TIMLoginParam*)param succ:(TIMLoginSucc)succ fail:(TIMFail)fail;
  79 +
  80 +@end
  81 +
  82 +
  83 +#endif /* TIMManager_MsgExt_h */
  1 +//
  2 +// TIMManager.h
  3 +// ImSDK
  4 +//
  5 +// Created by bodeng on 28/1/15.
  6 +// Copyright (c) 2015 tencent. All rights reserved.
  7 +//
  8 +
  9 +#ifndef ImSDK_TIMManager_h
  10 +#define ImSDK_TIMManager_h
  11 +
  12 +#import "TIMComm.h"
  13 +#import "TIMCallback.h"
  14 +
  15 +@class TIMGroupManager;
  16 +@class TIMFriendshipManager;
  17 +
  18 +/////////////////////////////////////////////////////////
  19 +/// Tencent 开放 SDK API
  20 +/////////////////////////////////////////////////////////
  21 +
  22 +/**
  23 + * 通讯管理
  24 + */
  25 +@interface TIMManager : NSObject
  26 +
  27 +/////////////////////////////////////////////////////////////////////////////////
  28 +//
  29 +// (一)初始化相关接口函数
  30 +//
  31 +/////////////////////////////////////////////////////////////////////////////////
  32 +
  33 +/// @name 初始化相关接口
  34 +/// @{
  35 +/**
  36 + * 1.1 获取管理器实例 TIMManager
  37 + *
  38 + * @return 管理器实例
  39 + */
  40 ++ (TIMManager*)sharedInstance;
  41 +
  42 +/**
  43 + * 1.2 初始化 SDK,设置全局配置信息
  44 + *
  45 + * 初始化 SDK 需要设置 TIMSdkConfig 信息,TIMSdkConfig 主要包含 sdkAppId 和 accountType 设置、Log 相关逻辑设置、数据库存储路径设置、网络监听设置等,其中 sdkAppId 和 accountType 的获取请参考官网文档 [跑通Demo(iOS与Mac)](https://cloud.tencent.com/document/product/269/32674)。
  46 + *
  47 + * @param config 配置信息,全局有效,详情请参考 TIMComm.h 中的 TIMSdkConfig 定义
  48 + *
  49 + * @return 0:成功;1:失败,config 为 nil
  50 + */
  51 +- (int)initSdk:(TIMSdkConfig*)config;
  52 +
  53 +/**
  54 + * 1.3 获取全局配置信息
  55 + *
  56 + * 获取初始化 SDK 时候设置的 TIMSdkConfig,方便客户在上层做相关业务逻辑。
  57 + *
  58 + * @return 全局配置,详情请参考 TIMComm.h 中的 TIMSdkConfig 定义
  59 + */
  60 +- (TIMSdkConfig*)getGlobalConfig;
  61 +
  62 +/**
  63 + * 1.4 设置用户配置信息
  64 + *
  65 + * 1. setUserConfig 要在 initSdk 之后,login 之前,主要用来开启/关闭自动已读上报和已读回执,设置默认拉取的群组资料,群成员资料字段,监听用户登录状态、会话刷新、消息已读回执、文件上传进度、群组事件通知。
  66 + * 2. 自动已读上报默认是开启的,当客户端收到一条未读消息后,Server 默认会删除这条未读消息,切换终端以后无法看到之前终端已经拉回的未读消息,如果需要多终端情况下仍然会有未读,请设置 TIMUserConfig 中的 disableAutoReport 为 YES,一旦禁用自动上报,开发者需要显式调用 setReadMessage,详情请参考官方文档 [未读消息计数](https://cloud.tencent.com/document/product/269/9151)。
  67 + * 3. C2C 已读回执默认是关闭的,如果需要开启,请设置 TIMUserConfig 中的 enableReadReceipt 为 YES,收到消息的用户需要显式调用 setReadMessage,发消息的用户才能通过 TIMMessageReceiptListener 监听到消息的已读回执。
  68 + * 4. 当您获取群资料的时候,默认只能拉取内置字段,如果想要拉取自定义字段,首先要通过 [IM 控制台](https://console.cloud.tencent.com/avc) -> 功能配置 -> 群维度自定义字段 配置相关的 key 和权限,然后把生成的 key 设置在 IMGroupInfoOption 里面的 groupCustom 字段。需要注意的是,只有对自定义字段 value 做了赋值或则修改,才能拉取到自定义字段。
  69 + * 5. 当您获取群成员资料的时候,默认只能拉取内置字段,如果想要拉取自定义字段,首先要通过 [IM 控制台](https://console.cloud.tencent.com/avc) -> 功能配置 -> 群成员维度自定义字段配置相关的 key 和权限,然后把生成的 key 设置在 TIMGroupMemberInfoOption 里面的 memberCustom 字段。需要注意的是,只有对自定义字段的 value 做了赋值或则修改,才能拉取到自定义字段。
  70 + *
  71 + * @param config 配置信息,对当前 TIMManager 有效,详情请参考 TIMComm.h 中的 TIMUserConfig 定义
  72 + *
  73 + * @return 0:成功;1:失败,config 为 nil
  74 + */
  75 +- (int)setUserConfig:(TIMUserConfig*)config;
  76 +
  77 +/**
  78 + * 1.5 获取用户配置信息
  79 + *
  80 + * 获取设置的用户配置信息 TIMSdkConfig,方便客户在上层做相关业务逻辑。
  81 + *
  82 + * @return 当前 manager 绑定用户的配置,详情请参考 TIMComm.h 中的 TIMUserConfig 定义
  83 + */
  84 +- (TIMUserConfig*)getUserConfig;
  85 +
  86 +/**
  87 + * 1.6 添加消息监听(重复添加无效)
  88 + *
  89 + * 添加消息监听后,会在 TIMMessageListener 的 onNewMessage 收到回调消息,消息内容通过参数 TIMMessage 传递,通过 TIMMessage 可以获取消息和相关会话的详细信息,如消息文本,语音数据,图片等。详细可参阅 [消息解析](https://cloud.tencent.com/document/product/269/9150#.E6.B6.88.E6.81.AF.E8.A7.A3.E6.9E.90) 部分。
  90 + *
  91 + * @param listener 回调,详情请参考 TIMCallback.h 中的 TIMMessageListener 定义
  92 + *
  93 + * @return 0:成功;1:失败,listener 为 nil
  94 + */
  95 +- (int)addMessageListener:(id<TIMMessageListener>)listener;
  96 +
  97 +/**
  98 + * 1.7 移除消息监听
  99 + *
  100 + * @param listener 回调,详情请参考 TIMCallback.h 中的 TIMMessageListener 定义
  101 + *
  102 + * @return 0:成功;1:失败,listener 为 nil
  103 + */
  104 +- (int)removeMessageListener:(id<TIMMessageListener>)listener;
  105 +
  106 +/// @}
  107 +
  108 +/////////////////////////////////////////////////////////////////////////////////
  109 +//
  110 +// (二)登录相关接口
  111 +//
  112 +/////////////////////////////////////////////////////////////////////////////////
  113 +
  114 +/// @name 登录相关接口
  115 +/// @{
  116 +/**
  117 + * 2.1 登录
  118 + *
  119 + * 1. 登录需要设置用户名 identifier 和用户签名 userSig,userSig 的生成请参考官网文档 [UserSig 后台 API](https://cloud.tencent.com/document/product/269/32688)。
  120 + * 2. 如果 userSig 过期,登录会返回 ERR_USER_SIG_EXPIRED:6206 错误码,收到错误码后请生成新的 userSig 重新登录。
  121 + * 3. 用户在线情况下被踢,会在 TIMUserConfig 里面配置的 TIMUserStatusListener 监听器获取 onForceOffline 回调,收到回调后可以选择重新登录。
  122 + * 4. 用户离线状态下被踢,由于此时用户不在线,无法感知此事件,为了显式提醒用户,用户重新登录时,会返回 ERR_IMSDK_KICKED_BY_OTHERS:6208 错误码,表明之前被踢,如果需要把对方踢下线,再次调用 login 强制上线,更多详情请参考 [用户状态变更](https://cloud.tencent.com/document/product/269/9148#5.-.E7.94.A8.E6.88.B7.E7.8A.B6.E6.80.81.E5.8F.98.E6.9B.B4)。
  123 + *
  124 + * @param param 登陆参数,详情请参考 TIMComm.h 中的 TIMLoginParam 定义
  125 + * @param succ 成功回调,详情请参考 TIMComm.h 中的 TIMLoginSucc 定义
  126 + * @param fail 失败回调,详情请参考 TIMComm.h 中的 TIMFail 定义
  127 + *
  128 + * @return 0:成功;1:失败,请检查 param 参数是否正常
  129 + */
  130 +- (int)login: (TIMLoginParam*)param succ:(TIMLoginSucc)succ fail:(TIMFail)fail;
  131 +
  132 +/**
  133 + * 2.2 自动登录
  134 + *
  135 + * 1. 首次登陆之后,SDK 会把登陆信息存在在本地,下次登陆即可调用自动登录
  136 + * 2. 如果用户之前没有登录过,或则 APP 被卸载过,自动登录会报 ERR_NO_PREVIOUS_LOGIN:6026 错误,这个时候请调用 login 接口重新登录。
  137 + *
  138 + * @param param 登陆参数( userSig 不用填),详情请参考 TIMComm.h 中的 TIMLoginParam 定义
  139 + * @param succ 成功回调,详情请参考 TIMComm.h 中的 TIMLoginSucc 定义
  140 + * @param fail 失败回调,详情请参考 TIMComm.h 中的 TIMFail 定义
  141 + *
  142 + * @return 0:成功;1:失败,请检查 param 参数是否正常
  143 + */
  144 +- (int)autoLogin:(TIMLoginParam*)param succ:(TIMLoginSucc)succ fail:(TIMFail)fail;
  145 +
  146 +/**
  147 + * 2.3 登出
  148 + *
  149 + * 退出登录,如果切换账号,需要 logout 回调成功或者失败后才能再次 login,否则 login 可能会失败。
  150 + *
  151 + * @param succ 成功回调,登出成功
  152 + * @param fail 失败回调,返回错误吗和错误信息
  153 + *
  154 + * @return 0:发送登出包成功,等待回调;1:失败
  155 + */
  156 +- (int)logout:(TIMLoginSucc)succ fail:(TIMFail)fail;
  157 +
  158 +/**
  159 + * 2.4 获取当前登陆的用户
  160 + *
  161 + * @return 如果登陆返回用户的 identifier,如果未登录返回 nil
  162 + */
  163 +- (NSString*)getLoginUser;
  164 +
  165 +/**
  166 + * 2.5 获取当前登录状态
  167 + *
  168 + * @return 登录状态,详情请参考 TIMComm.h 中的 TIMLoginStatus 定义
  169 + */
  170 +- (TIMLoginStatus)getLoginStatus;
  171 +
  172 +/// @}
  173 +
  174 +/////////////////////////////////////////////////////////////////////////////////
  175 +//
  176 +// (三)获取会话管理器
  177 +//
  178 +/////////////////////////////////////////////////////////////////////////////////
  179 +/// @name 获取会话管理器
  180 +/// @{
  181 +/**
  182 + * 获取会话管理器
  183 + *
  184 + * TIMConversation 负责会话相关操作,包含发送消息、获取会话消息缓存、获取未读计数等。
  185 + *
  186 + * @param type 会话类型,TIM_C2C:单聊;TIM_GROUP:群聊;TIM_SYSTEM:系统会话
  187 + * @param receiver 会话接收者,C2C:为对方用户;identifier;GROUP:群组 Id;SYSTEM:@""
  188 + *
  189 + * @return 会话对象,详情请参考 TIMConversation.h 里面的 TIMConversation 定义
  190 + */
  191 +- (TIMConversation*)getConversation:(TIMConversationType)type receiver:(NSString*)receiver;
  192 +
  193 +/// @}
  194 +
  195 +/////////////////////////////////////////////////////////////////////////////////
  196 +//
  197 +// (四)获取群管理器
  198 +//
  199 +/////////////////////////////////////////////////////////////////////////////////
  200 +/// @name 获取群管理器
  201 +/// @{
  202 +/**
  203 + * 获取群管理器
  204 + *
  205 + * TIMGroupManager 负责创建群、增删成员、以及修改群资料等
  206 + *
  207 + * @return 群管理器,详情请参考 TIMGroupManager.h 中的 TIMGroupManager 定义
  208 + */
  209 +- (TIMGroupManager*)groupManager;
  210 +
  211 +/// @}
  212 +
  213 +/////////////////////////////////////////////////////////////////////////////////
  214 +//
  215 +// (五)获取好友管理器
  216 +//
  217 +/////////////////////////////////////////////////////////////////////////////////
  218 +///@name 获取好友管理器
  219 +/// @{
  220 +/**
  221 + * 获取好友管理器
  222 + *
  223 + * TIMFriendshipManager 负责加好友,删除好友,查询好友列表等
  224 + *
  225 + * @return 好友管理器,详情请参考 TIMFriendshipManager.h 中的 TIMFriendshipManager 定义
  226 + */
  227 +- (TIMFriendshipManager*)friendshipManager;
  228 +
  229 +/// @}
  230 +
  231 +/////////////////////////////////////////////////////////////////////////////////
  232 +//
  233 +// (六)设置 APNs 推送
  234 +//
  235 +/////////////////////////////////////////////////////////////////////////////////
  236 +/// @name 设置 APNs 推送
  237 +/// @{
  238 +/**
  239 + * 6.1. 设置客户端 Token 和证书 busiId
  240 + *
  241 + * 1. token 是向苹果后台请求 DeviceToken,具体实现请参考 appdelegate.h 里面的 registNotification。
  242 + * 2. busiId 是向 IM 控制台上传 iOS 证书(p.12)生成的,具体步骤请参考 [离线推送](https://cloud.tencent.com/document/product/269/9154)。
  243 + *
  244 + * @param token 详情请参考 TIMComm.h 中的 TIMTokenParam 定义
  245 + * @param succ 成功回调,详情请参考 TIMComm.h 中的 TIMSucc 定义
  246 + * @param fail 失败回调,详情请参考 TIMComm.h 中的 TIMFail 定义
  247 + *
  248 + * @return 0:成功;1:失败,token 参数异常
  249 + */
  250 +- (int)setToken:(TIMTokenParam*)token succ:(TIMSucc)succ fail:(TIMFail)fail;
  251 +
  252 +/**
  253 + * 6.2. 设置推送声音
  254 + *
  255 + * 不同用户可能想使用不同的推送声音,TIMAPNSConfig 提供了设置用户声音的字段,可实现单聊声音、群组声音的设置,也可在用户级别设置是否开启推送。
  256 + *
  257 + * @param config APNS 配置,详情请参考 TIMComm.h 中的 TIMAPNSConfig 定义
  258 + * @param succ 成功回调,详情请参考 TIMComm.h 中的 TIMSucc 定义
  259 + * @param fail 失败回调,详情请参考 TIMComm.h 中的 TIMFail 定义
  260 + *
  261 + * @return 0:成功;1:失败,config 参数异常
  262 + */
  263 +- (int)setAPNS:(TIMAPNSConfig*)config succ:(TIMSucc)succ fail:(TIMFail)fail;
  264 +
  265 +/**
  266 + * 6.3. 获取推送声音设置
  267 + *
  268 + * @param succ 成功回调,返回配置信息,详情请参考 TIMComm.h 中的 TIMAPNSConfigSucc 定义
  269 + * @param fail 失败回调,详情请参考 TIMComm.h 中的 TIMFail 定义
  270 + *
  271 + * @return 0:成功;1:失败
  272 + */
  273 +- (int)getAPNSConfig:(TIMAPNSConfigSucc)succ fail:(TIMFail)fail;
  274 +
  275 +/**
  276 + * 6.4. APP 进后台
  277 + *
  278 + * APP 进后台的时候需要主动调用 doBackground ,这个时候后台知道 APP 的状态,之后的消息会下发推送通知。
  279 + *
  280 + * @param param 上报参数,详情请参考 TIMComm.h 中的 TIMBackgroundParam 定义
  281 + * @param succ 成功时回调,详情请参考 TIMComm.h 中的 TIMSucc 定义
  282 + * @param fail 失败时回调,详情请参考 TIMComm.h 中的 TIMFail 定义
  283 + *
  284 + * @return 0:成功;1:失败
  285 + */
  286 +- (int)doBackground:(TIMBackgroundParam*)param succ:(TIMSucc)succ fail:(TIMFail)fail;
  287 +
  288 +
  289 +/**
  290 + * 6.5. APP 进后台
  291 + *
  292 + * APP 进前台的时候需要主动调用 doForeground。
  293 + *
  294 + * @param succ 成功时回调,详情请参考 TIMComm.h 中的 TIMSucc 定义
  295 + * @param fail 失败时回调,详情请参考 TIMComm.h 中的 TIMFail 定义
  296 + *
  297 + * @return 0:成功;1:失败
  298 + */
  299 +- (int)doForeground:(TIMSucc)succ fail:(TIMFail)fail;
  300 +
  301 +/// @}
  302 +
  303 +/////////////////////////////////////////////////////////////////////////////////
  304 +//
  305 +// (七)多账号登录接口
  306 +//
  307 +/////////////////////////////////////////////////////////////////////////////////
  308 +///@name 多账号登录接口
  309 +/// @{
  310 +/**
  311 + * 创建新的管理器类型(多用户登陆时使用,否则可直接调用 sharedInstance)
  312 + *
  313 + * @return 管理器实例
  314 + */
  315 ++ (TIMManager*)newManager;
  316 +
  317 +/**
  318 + * 获取管理器类型(多用户登陆时使用,否则可直接调用 sharedInstance)
  319 + *
  320 + * @param identifier 用户 identifier
  321 + *
  322 + * @return 对应管理器类型,如果没有创建过,返回 nil
  323 + */
  324 ++ (TIMManager*)getManager:(NSString*)identifier;
  325 +
  326 +/**
  327 + * 销毁管理器(多用户登陆时使用,否则可直接调用 sharedInstance)
  328 + *
  329 + * @param manager 需要销毁的管理器
  330 + */
  331 ++ (void)deleteManager:(TIMManager*)manager;
  332 +
  333 +/// @}
  334 +
  335 +/////////////////////////////////////////////////////////////////////////////////
  336 +//
  337 +// (八)调试相关接口
  338 +//
  339 +/////////////////////////////////////////////////////////////////////////////////
  340 +/// @name 调试相关接口
  341 +/// @{
  342 +/**
  343 + * 获取网络状态
  344 + *
  345 + * @return 网络状态,详情请参考 TIMComm.h 中的 TIMNetworkStatus 定义
  346 + */
  347 +- (TIMNetworkStatus)networkStatus;
  348 +
  349 +/**
  350 + * 设置环境(暂未实现)
  351 + *
  352 + * 在 InitSdk 之前调用,注意:除非是 IM 工作人员指定要求设置,否则不需要调用此接口
  353 + *
  354 + * @param env 0:正式环境(默认);1:测试环境
  355 + *
  356 + */
  357 +- (void)setEnv:(int)env;
  358 +
  359 +/**
  360 + * 获取环境类型(暂未实现)
  361 + *
  362 + * @return env 0:正式环境(默认);1:测试环境
  363 + *
  364 + */
  365 +- (int)getEnv;
  366 +
  367 +/**
  368 + * 获取版本号
  369 + *
  370 + * @return 返回版本号,字符串表示,例如 v1.1.1
  371 + */
  372 +- (NSString*)GetVersion;
  373 +
  374 +/**
  375 + * 打印日志,通过 ImSDK 提供的日志功能打印日志
  376 + *
  377 + * @param level 日志级别,详情请参考 TIMComm.h 中的 TIMLogLevel 定义
  378 + * @param tag 模块 tag
  379 + * @param msg 要输出的日志内容
  380 + */
  381 +- (void)log:(TIMLogLevel)level tag:(NSString*)tag msg:(NSString*)msg;
  382 +
  383 +/**
  384 + * 获取日志文件路径
  385 + */
  386 +- (NSString*)getLogPath;
  387 +
  388 +/**
  389 + * 是否开启 sdk 日志打印
  390 + *
  391 + * @return YES:允许 log 打印;NO:不允许 log 打印
  392 + */
  393 +- (BOOL)getIsLogPrintEnabled;
  394 +
  395 +/**
  396 + * 获取日志级别
  397 + *
  398 + * @return 返回日志级别,详情请参考 TIMComm.h 中的 TIMLogLevel 定义
  399 + */
  400 +-(TIMLogLevel) getLogLevel;
  401 +
  402 +///@}
  403 +
  404 +/////////////////////////////////////////////////////////////////////////////////
  405 +//
  406 +// (九)废弃接口
  407 +//
  408 +/////////////////////////////////////////////////////////////////////////////////
  409 +/// @name 废弃接口
  410 +/// @{
  411 +/**
  412 + * 获取联网SDK的版本号 (方法已废弃, SDK 不再依赖 QAL 库)
  413 + *
  414 + * @return 返回版本号
  415 + */
  416 +- (NSString*)GetQALVersion;
  417 +
  418 +///@}
  419 +@end
  420 +#endif