diff --git a/ios-rongcallkit/RongCallKit.xcodeproj/xcshareddata/xcschemes/RongCallKit.xcscheme b/ios-rongcallkit/RongCallKit.xcodeproj/xcshareddata/xcschemes/RongCallKit.xcscheme index c73c9d9..58ddbbb 100644 --- a/ios-rongcallkit/RongCallKit.xcodeproj/xcshareddata/xcschemes/RongCallKit.xcscheme +++ b/ios-rongcallkit/RongCallKit.xcodeproj/xcshareddata/xcschemes/RongCallKit.xcscheme @@ -1,6 +1,6 @@ @@ -36,6 +37,7 @@ buildConfiguration = "Debug" selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" + language = "" launchStyle = "0" useCustomWorkingDirectory = "NO" ignoresPersistentStateOnLaunch = "NO" diff --git a/ios-rongcallkit/RongCallKit/AudioObserver/RCDAudioFrameObserver.h b/ios-rongcallkit/RongCallKit/AudioObserver/RCDAudioFrameObserver.h index 4e0116f..4065b22 100644 --- a/ios-rongcallkit/RongCallKit/AudioObserver/RCDAudioFrameObserver.h +++ b/ios-rongcallkit/RongCallKit/AudioObserver/RCDAudioFrameObserver.h @@ -9,18 +9,18 @@ #ifndef RCDAudioFrameObserver_hpp #define RCDAudioFrameObserver_hpp -#include -#import -#include #import +#import +#import +#import class RCDAudioFrameObserver : public agora::media::IAudioFrameObserver { -public: - static RCDAudioFrameObserver *sharedObserver(); - bool onRecordAudioFrame(agora::media::IAudioFrameObserver::AudioFrame& audioFrame); - bool onPlaybackAudioFrame(agora::media::IAudioFrameObserver::AudioFrame& audioFrame); - bool onMixedAudioFrame(agora::media::IAudioFrameObserver::AudioFrame &audioFrame); - bool onPlaybackAudioFrameBeforeMixing(unsigned int uid, agora::media::IAudioFrameObserver::AudioFrame& audioFrame); + public: + static RCDAudioFrameObserver *sharedObserver(); + bool onRecordAudioFrame(agora::media::IAudioFrameObserver::AudioFrame &audioFrame); + bool onPlaybackAudioFrame(agora::media::IAudioFrameObserver::AudioFrame &audioFrame); + bool onMixedAudioFrame(agora::media::IAudioFrameObserver::AudioFrame &audioFrame); + bool onPlaybackAudioFrameBeforeMixing(unsigned int uid, agora::media::IAudioFrameObserver::AudioFrame &audioFrame); }; #endif /* RCDAudioFrameObserver_hpp */ diff --git a/ios-rongcallkit/RongCallKit/AudioObserver/RCDAudioFrameObserver.mm b/ios-rongcallkit/RongCallKit/AudioObserver/RCDAudioFrameObserver.mm index 1ad9148..1f7d618 100644 --- a/ios-rongcallkit/RongCallKit/AudioObserver/RCDAudioFrameObserver.mm +++ b/ios-rongcallkit/RongCallKit/AudioObserver/RCDAudioFrameObserver.mm @@ -9,21 +9,22 @@ #include "RCDAudioFrameObserver.h" RCDAudioFrameObserver *RCDAudioFrameObserver::sharedObserver() { - static RCDAudioFrameObserver sharedObserver; - return &sharedObserver; + static RCDAudioFrameObserver sharedObserver; + return &sharedObserver; } -bool RCDAudioFrameObserver::onRecordAudioFrame(agora::media::IAudioFrameObserver::AudioFrame& audioFrame) { - return true; +bool RCDAudioFrameObserver::onRecordAudioFrame(agora::media::IAudioFrameObserver::AudioFrame &audioFrame) { + return true; } -bool RCDAudioFrameObserver::onPlaybackAudioFrame(agora::media::IAudioFrameObserver::AudioFrame& audioFrame) { - return true; +bool RCDAudioFrameObserver::onPlaybackAudioFrame(agora::media::IAudioFrameObserver::AudioFrame &audioFrame) { + return true; } bool RCDAudioFrameObserver::onMixedAudioFrame(agora::media::IAudioFrameObserver::AudioFrame &audioFrame) { - return true; + return true; } -bool RCDAudioFrameObserver::onPlaybackAudioFrameBeforeMixing(unsigned int uid, agora::media::IAudioFrameObserver::AudioFrame& audioFrame) { - NSString *userId = rcGetUserIdFromAgoraUID(uid); - NSLog(@"the user id is %@", userId); - return true; +bool RCDAudioFrameObserver::onPlaybackAudioFrameBeforeMixing( + unsigned int uid, agora::media::IAudioFrameObserver::AudioFrame &audioFrame) { + NSString *userId = rcGetUserIdFromAgoraUID(uid); + NSLog(@"the user id is %@", userId); + return true; } diff --git a/ios-rongcallkit/RongCallKit/Cell/RCCallDetailMessageCell.m b/ios-rongcallkit/RongCallKit/Cell/RCCallDetailMessageCell.m index 9d2ee14..5182fbe 100644 --- a/ios-rongcallkit/RongCallKit/Cell/RCCallDetailMessageCell.m +++ b/ios-rongcallkit/RongCallKit/Cell/RCCallDetailMessageCell.m @@ -15,216 +15,179 @@ @implementation RCCallDetailMessageCell + (CGSize)sizeForMessageModel:(RCMessageModel *)model withCollectionViewWidth:(CGFloat)collectionViewWidth referenceExtraHeight:(CGFloat)extraHeight { - //当为单聊时,需要显示头像,且内容区域高度小于头像高度,所以内容区域高度就是头像高度,然后加上上下10padding。 - CGFloat height = [RCIM sharedRCIM].globalMessagePortraitSize.height; - - height += extraHeight; - - return CGSizeMake(collectionViewWidth, height); + //当为单聊时,需要显示头像,且内容区域高度小于头像高度,所以内容区域高度就是头像高度,然后加上上下10padding。 + CGFloat height = [RCIM sharedRCIM].globalMessagePortraitSize.height; + + height += extraHeight; + + return CGSizeMake(collectionViewWidth, height); } - (instancetype)initWithFrame:(CGRect)frame { - self = [super initWithFrame:frame]; - if (self) { - [self initialize]; - } - return self; + self = [super initWithFrame:frame]; + if (self) { + [self initialize]; + } + return self; } - (id)initWithCoder:(NSCoder *)aDecoder { - self = [super initWithCoder:aDecoder]; - if (self) { - [self initialize]; - } - return self; + self = [super initWithCoder:aDecoder]; + if (self) { + [self initialize]; + } + return self; } - (void)initialize { - self.bubbleBackgroundView = [[UIImageView alloc] initWithFrame:CGRectZero]; - [self.messageContentView addSubview:self.bubbleBackgroundView]; - self.bubbleBackgroundView.userInteractionEnabled = YES; - UILongPressGestureRecognizer *longPress = - [[UILongPressGestureRecognizer alloc] - initWithTarget:self - action:@selector(longPressed:)]; - [self.bubbleBackgroundView addGestureRecognizer:longPress]; - - self.textLabel = [[UILabel alloc] initWithFrame:CGRectZero]; - [self.textLabel setFont:[UIFont systemFontOfSize:Text_Message_Font_Size]]; - self.textLabel.numberOfLines = 0; - [self.textLabel setLineBreakMode:NSLineBreakByWordWrapping]; - [self.textLabel setTextAlignment:NSTextAlignmentLeft]; - [self.textLabel setTextColor:[UIColor blackColor]]; - if (RC_IOS_SYSTEM_VERSION_LESS_THAN(@"7.0")) { - [self.textLabel setBackgroundColor:[UIColor clearColor]]; - } - UITapGestureRecognizer *textMessageTap = [[UITapGestureRecognizer alloc] - initWithTarget:self - action:@selector(tapTextMessage:)]; - textMessageTap.numberOfTapsRequired = 1; - textMessageTap.numberOfTouchesRequired = 1; - [self.textLabel addGestureRecognizer:textMessageTap]; - self.textLabel.userInteractionEnabled = YES; - [self.bubbleBackgroundView addSubview:self.textLabel]; - - self.mediaTypeIcon = [[UIImageView alloc] initWithFrame:CGRectZero]; - UITapGestureRecognizer *mediaTypeIconTap = [[UITapGestureRecognizer alloc] - initWithTarget:self - action:@selector(tapMediaTypeIcon:)]; - mediaTypeIconTap.numberOfTapsRequired = 1; - mediaTypeIconTap.numberOfTouchesRequired = 1; - [self.mediaTypeIcon addGestureRecognizer:mediaTypeIconTap]; - self.mediaTypeIcon.userInteractionEnabled = YES; - [self.bubbleBackgroundView addSubview:self.mediaTypeIcon]; + self.bubbleBackgroundView = [[UIImageView alloc] initWithFrame:CGRectZero]; + [self.messageContentView addSubview:self.bubbleBackgroundView]; + self.bubbleBackgroundView.userInteractionEnabled = YES; + UILongPressGestureRecognizer *longPress = + [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(longPressed:)]; + [self.bubbleBackgroundView addGestureRecognizer:longPress]; + + self.textLabel = [[UILabel alloc] initWithFrame:CGRectZero]; + [self.textLabel setFont:[UIFont systemFontOfSize:Text_Message_Font_Size]]; + self.textLabel.numberOfLines = 0; + [self.textLabel setLineBreakMode:NSLineBreakByWordWrapping]; + [self.textLabel setTextAlignment:NSTextAlignmentLeft]; + [self.textLabel setTextColor:[UIColor blackColor]]; + if (RC_IOS_SYSTEM_VERSION_LESS_THAN(@"7.0")) { + [self.textLabel setBackgroundColor:[UIColor clearColor]]; + } + UITapGestureRecognizer *textMessageTap = + [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapTextMessage:)]; + textMessageTap.numberOfTapsRequired = 1; + textMessageTap.numberOfTouchesRequired = 1; + [self.textLabel addGestureRecognizer:textMessageTap]; + self.textLabel.userInteractionEnabled = YES; + [self.bubbleBackgroundView addSubview:self.textLabel]; + + self.mediaTypeIcon = [[UIImageView alloc] initWithFrame:CGRectZero]; + UITapGestureRecognizer *mediaTypeIconTap = + [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapMediaTypeIcon:)]; + mediaTypeIconTap.numberOfTapsRequired = 1; + mediaTypeIconTap.numberOfTouchesRequired = 1; + [self.mediaTypeIcon addGestureRecognizer:mediaTypeIconTap]; + self.mediaTypeIcon.userInteractionEnabled = YES; + [self.bubbleBackgroundView addSubview:self.mediaTypeIcon]; } - (void)tapTextMessage:(UIGestureRecognizer *)gestureRecognizer { - if ([self.delegate respondsToSelector:@selector(didTapMessageCell:)]) { - [self.delegate didTapMessageCell:self.model]; - } + if ([self.delegate respondsToSelector:@selector(didTapMessageCell:)]) { + [self.delegate didTapMessageCell:self.model]; + } } - (void)tapMediaTypeIcon:(UIGestureRecognizer *)gestureRecognizer { - if ([self.delegate respondsToSelector:@selector(didTapMessageCell:)]) { - [self.delegate didTapMessageCell:self.model]; - } + if ([self.delegate respondsToSelector:@selector(didTapMessageCell:)]) { + [self.delegate didTapMessageCell:self.model]; + } } - (void)setDataModel:(RCMessageModel *)model { - [super setDataModel:model]; + [super setDataModel:model]; - [self setAutoLayout]; + [self setAutoLayout]; } - (void)setAutoLayout { - RCCallSummaryMessage *callMessage = - (RCCallSummaryMessage *)self.model.content; - if (callMessage.duration > 0) { - self.textLabel.text = [NSString - stringWithFormat:@"%@ %@", - NSLocalizedStringFromTable(@"VoIPCallTotalTime", - @"RongCloudKit", nil), - [RCCallKitUtility - getReadableStringForTime:(long)(callMessage - .duration / - 1000)]]; - } else { - self.textLabel.text = [RCCallKitUtility - getReadableStringForMessageCell:callMessage.hangupReason]; - } - - if (callMessage.mediaType == RCCallMediaVideo && - self.messageDirection == MessageDirection_RECEIVE) { - self.mediaTypeIcon.image = - [RCCallKitUtility imageFromVoIPBundle:@"voip/video_left.png"]; - } else if (callMessage.mediaType == RCCallMediaVideo && - self.messageDirection == MessageDirection_SEND) { - self.mediaTypeIcon.image = - [RCCallKitUtility imageFromVoIPBundle:@"voip/video_right.png"]; - } else if (callMessage.mediaType == RCCallMediaAudio && - self.messageDirection == MessageDirection_RECEIVE && - callMessage.duration > 0) { - self.mediaTypeIcon.image = - [RCCallKitUtility imageFromVoIPBundle:@"voip/audio_receiver_left.png"]; - } else if (callMessage.mediaType == RCCallMediaAudio && - self.messageDirection == MessageDirection_RECEIVE && - callMessage.duration <= 0) { - self.mediaTypeIcon.image = [RCCallKitUtility - imageFromVoIPBundle:@"voip/audio_receiver_up_left.png"]; - } else if (callMessage.mediaType == RCCallMediaAudio && - self.messageDirection == MessageDirection_SEND && - callMessage.duration > 0) { - self.mediaTypeIcon.image = - [RCCallKitUtility imageFromVoIPBundle:@"voip/audio_receiver_right.png"]; - } else if (callMessage.mediaType == RCCallMediaAudio && - self.messageDirection == MessageDirection_SEND && - callMessage.duration <= 0) { - self.mediaTypeIcon.image = [RCCallKitUtility - imageFromVoIPBundle:@"voip/audio_receiver_up_right.png"]; - } - - CGSize __textSize = [RCKitUtility getTextDrawingSize:self.textLabel.text font:[UIFont systemFontOfSize:Text_Message_Font_Size] constrainedSize:CGSizeMake(self.baseContentView.bounds.size.width - (10 + [RCIM sharedRCIM].globalMessagePortraitSize.width + 10) * 2 - 5 - 35, 8000)]; - __textSize = CGSizeMake(ceilf(__textSize.width), ceilf(__textSize.height)); - float maxWidth = - self.baseContentView.bounds.size.width - - (10 + [RCIM sharedRCIM].globalMessagePortraitSize.width + 10) * 2 - 5 - - 35; - if (__textSize.width > maxWidth) { - __textSize.width = maxWidth; - } - CGSize __labelSize = CGSizeMake(__textSize.width + 5, __textSize.height + 5); - - CGFloat __bubbleWidth = - __labelSize.width + 12 + 20 < 50 ? 50 : (__labelSize.width + 12 + 20); - CGFloat __bubbleHeight = - __labelSize.height + 5 + 5 < 40 ? 40 : (__labelSize.height + 5 + 5); - - CGSize __bubbleSize = CGSizeMake(__bubbleWidth, __bubbleHeight); - - CGRect messageContentViewRect = self.messageContentView.frame; - - //拉伸图片 - // CGFloat top, CGFloat left, CGFloat bottom, CGFloat right - if (MessageDirection_RECEIVE == self.messageDirection) { - messageContentViewRect.size.width = __bubbleSize.width; - messageContentViewRect.size.height = __bubbleSize.height; - self.messageContentView.frame = messageContentViewRect; - - self.bubbleBackgroundView.frame = - CGRectMake(0, 0, __bubbleSize.width + 24, __bubbleSize.height); - - self.mediaTypeIcon.frame = CGRectMake(18, 8, 24, 24); - self.textLabel.frame = - CGRectMake(CGRectGetMaxX(self.mediaTypeIcon.frame) + 4, - __bubbleHeight / 2 - __labelSize.height / 2, - __labelSize.width, __labelSize.height); - self.bubbleBackgroundView.image = - [RCKitUtility imageNamed:@"chat_from_bg_normal" - ofBundle:@"RongCloud.bundle"]; - UIImage *image = self.bubbleBackgroundView.image; - self.bubbleBackgroundView.image = [self.bubbleBackgroundView.image - resizableImageWithCapInsets:UIEdgeInsetsMake(image.size.height * 0.8, - image.size.width * 0.8, - image.size.height * 0.2, - image.size.width * 0.2)]; - } else { - messageContentViewRect.size.width = __bubbleSize.width + 24; - messageContentViewRect.size.height = __bubbleSize.height; - messageContentViewRect.origin.x = - self.baseContentView.bounds.size.width - - (messageContentViewRect.size.width + 6 + - [RCIM sharedRCIM].globalMessagePortraitSize.width + 10); - self.messageContentView.frame = messageContentViewRect; - - self.bubbleBackgroundView.frame = - CGRectMake(0, 0, __bubbleSize.width + 24, __bubbleSize.height); - self.textLabel.frame = CGRectMake(12, 20 - __labelSize.height / 2, - __labelSize.width, __labelSize.height); - self.mediaTypeIcon.frame = - CGRectMake(CGRectGetMaxX(self.textLabel.frame), 8, 24, 24); - self.bubbleBackgroundView.image = - [RCKitUtility imageNamed:@"chat_to_bg_normal" - ofBundle:@"RongCloud.bundle"]; - UIImage *image = self.bubbleBackgroundView.image; - CGRect statusFrame = self.statusContentView.frame; - statusFrame.origin.x = statusFrame.origin.x + 5; - [self.statusContentView setFrame:statusFrame]; - self.bubbleBackgroundView.image = [self.bubbleBackgroundView.image - resizableImageWithCapInsets:UIEdgeInsetsMake(image.size.height * 0.8, - image.size.width * 0.2, - image.size.height * 0.2, - image.size.width * 0.8)]; - } - // self.bubbleBackgroundView.image = image; + RCCallSummaryMessage *callMessage = (RCCallSummaryMessage *)self.model.content; + if (callMessage.duration > 0) { + self.textLabel.text = + [NSString stringWithFormat:@"%@ %@", NSLocalizedStringFromTable(@"VoIPCallTotalTime", @"RongCloudKit", nil), + [RCCallKitUtility getReadableStringForTime:(long)(callMessage.duration / 1000)]]; + } else { + self.textLabel.text = [RCCallKitUtility getReadableStringForMessageCell:callMessage.hangupReason]; + } + + if (callMessage.mediaType == RCCallMediaVideo && self.messageDirection == MessageDirection_RECEIVE) { + self.mediaTypeIcon.image = [RCCallKitUtility imageFromVoIPBundle:@"voip/video_left.png"]; + } else if (callMessage.mediaType == RCCallMediaVideo && self.messageDirection == MessageDirection_SEND) { + self.mediaTypeIcon.image = [RCCallKitUtility imageFromVoIPBundle:@"voip/video_right.png"]; + } else if (callMessage.mediaType == RCCallMediaAudio && self.messageDirection == MessageDirection_RECEIVE && + callMessage.duration > 0) { + self.mediaTypeIcon.image = [RCCallKitUtility imageFromVoIPBundle:@"voip/audio_receiver_left.png"]; + } else if (callMessage.mediaType == RCCallMediaAudio && self.messageDirection == MessageDirection_RECEIVE && + callMessage.duration <= 0) { + self.mediaTypeIcon.image = [RCCallKitUtility imageFromVoIPBundle:@"voip/audio_receiver_up_left.png"]; + } else if (callMessage.mediaType == RCCallMediaAudio && self.messageDirection == MessageDirection_SEND && + callMessage.duration > 0) { + self.mediaTypeIcon.image = [RCCallKitUtility imageFromVoIPBundle:@"voip/audio_receiver_right.png"]; + } else if (callMessage.mediaType == RCCallMediaAudio && self.messageDirection == MessageDirection_SEND && + callMessage.duration <= 0) { + self.mediaTypeIcon.image = [RCCallKitUtility imageFromVoIPBundle:@"voip/audio_receiver_up_right.png"]; + } + + CGSize __textSize = [RCKitUtility + getTextDrawingSize:self.textLabel.text + font:[UIFont systemFontOfSize:Text_Message_Font_Size] + constrainedSize:CGSizeMake(self.baseContentView.bounds.size.width - + (10 + [RCIM sharedRCIM].globalMessagePortraitSize.width + 10) * 2 - 5 - 35, + 8000)]; + __textSize = CGSizeMake(ceilf(__textSize.width), ceilf(__textSize.height)); + float maxWidth = self.baseContentView.bounds.size.width - + (10 + [RCIM sharedRCIM].globalMessagePortraitSize.width + 10) * 2 - 5 - 35; + if (__textSize.width > maxWidth) { + __textSize.width = maxWidth; + } + CGSize __labelSize = CGSizeMake(__textSize.width + 5, __textSize.height + 5); + + CGFloat __bubbleWidth = __labelSize.width + 12 + 20 < 50 ? 50 : (__labelSize.width + 12 + 20); + CGFloat __bubbleHeight = __labelSize.height + 5 + 5 < 40 ? 40 : (__labelSize.height + 5 + 5); + + CGSize __bubbleSize = CGSizeMake(__bubbleWidth, __bubbleHeight); + + CGRect messageContentViewRect = self.messageContentView.frame; + + //拉伸图片 + // CGFloat top, CGFloat left, CGFloat bottom, CGFloat right + if (MessageDirection_RECEIVE == self.messageDirection) { + messageContentViewRect.size.width = __bubbleSize.width; + messageContentViewRect.size.height = __bubbleSize.height; + self.messageContentView.frame = messageContentViewRect; + + self.bubbleBackgroundView.frame = CGRectMake(0, 0, __bubbleSize.width + 24, __bubbleSize.height); + + self.mediaTypeIcon.frame = CGRectMake(18, 8, 24, 24); + self.textLabel.frame = + CGRectMake(CGRectGetMaxX(self.mediaTypeIcon.frame) + 4, __bubbleHeight / 2 - __labelSize.height / 2, + __labelSize.width, __labelSize.height); + self.bubbleBackgroundView.image = [RCKitUtility imageNamed:@"chat_from_bg_normal" ofBundle:@"RongCloud.bundle"]; + UIImage *image = self.bubbleBackgroundView.image; + self.bubbleBackgroundView.image = [self.bubbleBackgroundView.image + resizableImageWithCapInsets:UIEdgeInsetsMake(image.size.height * 0.8, image.size.width * 0.8, + image.size.height * 0.2, image.size.width * 0.2)]; + } else { + messageContentViewRect.size.width = __bubbleSize.width + 24; + messageContentViewRect.size.height = __bubbleSize.height; + messageContentViewRect.origin.x = + self.baseContentView.bounds.size.width - + (messageContentViewRect.size.width + 6 + [RCIM sharedRCIM].globalMessagePortraitSize.width + 10); + self.messageContentView.frame = messageContentViewRect; + + self.bubbleBackgroundView.frame = CGRectMake(0, 0, __bubbleSize.width + 24, __bubbleSize.height); + self.textLabel.frame = CGRectMake(12, 20 - __labelSize.height / 2, __labelSize.width, __labelSize.height); + self.mediaTypeIcon.frame = CGRectMake(CGRectGetMaxX(self.textLabel.frame), 8, 24, 24); + self.bubbleBackgroundView.image = [RCKitUtility imageNamed:@"chat_to_bg_normal" ofBundle:@"RongCloud.bundle"]; + UIImage *image = self.bubbleBackgroundView.image; + CGRect statusFrame = self.statusContentView.frame; + statusFrame.origin.x = statusFrame.origin.x + 5; + [self.statusContentView setFrame:statusFrame]; + self.bubbleBackgroundView.image = [self.bubbleBackgroundView.image + resizableImageWithCapInsets:UIEdgeInsetsMake(image.size.height * 0.8, image.size.width * 0.2, + image.size.height * 0.2, image.size.width * 0.8)]; + } + // self.bubbleBackgroundView.image = image; } - (void)longPressed:(id)sender { - UILongPressGestureRecognizer *press = (UILongPressGestureRecognizer *)sender; - if (press.state == UIGestureRecognizerStateEnded) { - return; - } else if (press.state == UIGestureRecognizerStateBegan) { - [self.delegate didLongTouchMessageCell:self.model - inView:self.bubbleBackgroundView]; - } + UILongPressGestureRecognizer *press = (UILongPressGestureRecognizer *)sender; + if (press.state == UIGestureRecognizerStateEnded) { + return; + } else if (press.state == UIGestureRecognizerStateBegan) { + [self.delegate didLongTouchMessageCell:self.model inView:self.bubbleBackgroundView]; + } } @end diff --git a/ios-rongcallkit/RongCallKit/Cell/RCCallMultiCallUserCell.h b/ios-rongcallkit/RongCallKit/Cell/RCCallMultiCallUserCell.h index c30bf69..013a522 100644 --- a/ios-rongcallkit/RongCallKit/Cell/RCCallMultiCallUserCell.h +++ b/ios-rongcallkit/RongCallKit/Cell/RCCallMultiCallUserCell.h @@ -36,7 +36,6 @@ @param model 用户通话信息的Model @param callStatus 用户通话状态 */ -- (void)setModel:(RCCallUserCallInfoModel *)model - status:(RCCallStatus)callStatus; +- (void)setModel:(RCCallUserCallInfoModel *)model status:(RCCallStatus)callStatus; @end diff --git a/ios-rongcallkit/RongCallKit/Cell/RCCallMultiCallUserCell.m b/ios-rongcallkit/RongCallKit/Cell/RCCallMultiCallUserCell.m index 74652ff..c793cf0 100644 --- a/ios-rongcallkit/RongCallKit/Cell/RCCallMultiCallUserCell.m +++ b/ios-rongcallkit/RongCallKit/Cell/RCCallMultiCallUserCell.m @@ -7,9 +7,9 @@ // #import "RCCallMultiCallUserCell.h" +#import "RCCallKitUtility.h" #import "RCloudImageView.h" #import -#import "RCCallKitUtility.h" @interface RCCallMultiCallUserCell () @@ -20,105 +20,92 @@ @interface RCCallMultiCallUserCell () @implementation RCCallMultiCallUserCell - (id)initWithFrame:(CGRect)frame { - self = [super initWithFrame:frame]; - if (self) { - // create our image view so that is matches the height and width of this - // cell - self.headerImageView = [[RCloudImageView alloc] initWithFrame:CGRectZero]; - self.headerImageView.autoresizingMask = - UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth; - self.headerImageView.contentMode = UIViewContentModeScaleAspectFill; - self.headerImageView.clipsToBounds = YES; - - // add a white frame around the image - self.headerImageView.layer.borderWidth = 1; - self.headerImageView.layer.borderColor = [UIColor whiteColor].CGColor; - self.headerImageView.layer.cornerRadius = 4; - self.headerImageView.layer.masksToBounds = YES; - self.headerImageView.backgroundColor = [[UIColor clearColor] colorWithAlphaComponent:1.0]; - // Define how the edges of the layer are rasterized for each of the four - // edges - // (left, right, bottom, top) if the corresponding bit is set the edge will - // be antialiased - // - self.headerImageView.layer.edgeAntialiasingMask = - kCALayerLeftEdge | kCALayerRightEdge | kCALayerBottomEdge | - kCALayerTopEdge; - [self.headerImageView - setPlaceholderImage:[RCKitUtility imageNamed:@"default_portrait_msg" - ofBundle:@"RongCloud.bundle"]]; - self.headerImageView.hidden = YES; - [[self contentView] addSubview:self.headerImageView]; - - self.nameLabel = [[UILabel alloc] initWithFrame:CGRectZero]; - self.nameLabel.textColor = [UIColor whiteColor]; - self.nameLabel.textAlignment = NSTextAlignmentCenter; - self.nameLabel.backgroundColor = [UIColor clearColor]; - self.nameLabel.font = [UIFont systemFontOfSize:14]; - self.nameLabel.hidden = YES; - [[self contentView] addSubview:self.nameLabel]; - self.statusView = [[UIImageView alloc] initWithFrame:CGRectZero]; - self.statusView.hidden = YES; - [[self contentView] addSubview:self.statusView]; - - - self.contentView.backgroundColor = [UIColor clearColor]; - } - return self; + self = [super initWithFrame:frame]; + if (self) { + // create our image view so that is matches the height and width of this + // cell + self.headerImageView = [[RCloudImageView alloc] initWithFrame:CGRectZero]; + self.headerImageView.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth; + self.headerImageView.contentMode = UIViewContentModeScaleAspectFill; + self.headerImageView.clipsToBounds = YES; + + // add a white frame around the image + self.headerImageView.layer.borderWidth = 1; + self.headerImageView.layer.borderColor = [UIColor whiteColor].CGColor; + self.headerImageView.layer.cornerRadius = 4; + self.headerImageView.layer.masksToBounds = YES; + self.headerImageView.backgroundColor = [[UIColor clearColor] colorWithAlphaComponent:1.0]; + // Define how the edges of the layer are rasterized for each of the four + // edges + // (left, right, bottom, top) if the corresponding bit is set the edge will + // be antialiased + // + self.headerImageView.layer.edgeAntialiasingMask = + kCALayerLeftEdge | kCALayerRightEdge | kCALayerBottomEdge | kCALayerTopEdge; + [self.headerImageView + setPlaceholderImage:[RCKitUtility imageNamed:@"default_portrait_msg" ofBundle:@"RongCloud.bundle"]]; + self.headerImageView.hidden = YES; + [[self contentView] addSubview:self.headerImageView]; + + self.nameLabel = [[UILabel alloc] initWithFrame:CGRectZero]; + self.nameLabel.textColor = [UIColor whiteColor]; + self.nameLabel.textAlignment = NSTextAlignmentCenter; + self.nameLabel.backgroundColor = [UIColor clearColor]; + self.nameLabel.font = [UIFont systemFontOfSize:14]; + self.nameLabel.hidden = YES; + [[self contentView] addSubview:self.nameLabel]; + self.statusView = [[UIImageView alloc] initWithFrame:CGRectZero]; + self.statusView.hidden = YES; + [[self contentView] addSubview:self.statusView]; + + self.contentView.backgroundColor = [UIColor clearColor]; + } + return self; } -- (void)setModel:(RCCallUserCallInfoModel *)model - status:(RCCallStatus)callStatus { - _model = model; - self.callStatus = callStatus; - - CGFloat nameLabelHeight = 16; - CGFloat insideMargin = 5; - - if (callStatus == RCCallIncoming || callStatus == RCCallRinging || - model.profile.mediaType == RCCallMediaVideo) { - nameLabelHeight = 0; - insideMargin = 0; - } - [self resetLayout:nameLabelHeight insideMargin:insideMargin]; - - [self.headerImageView - setImageURL:[NSURL URLWithString:model.userInfo.portraitUri]]; - [self.nameLabel setText:model.userInfo.name]; - if (model.profile.callStatus == RCCallRinging || - model.profile.callStatus == RCCallDialing || model.profile.callStatus == RCCallIncoming) { - self.statusView.image = - [RCCallKitUtility imageFromVoIPBundle:@"voip/voip_connecting"]; - self.headerImageView.alpha = 0.5; - } else { - self.statusView.image = nil; - self.statusView.hidden = YES; - self.headerImageView.alpha = 1.0; - } +- (void)setModel:(RCCallUserCallInfoModel *)model status:(RCCallStatus)callStatus { + _model = model; + self.callStatus = callStatus; + + CGFloat nameLabelHeight = 16; + CGFloat insideMargin = 5; + + if (callStatus == RCCallIncoming || callStatus == RCCallRinging || model.profile.mediaType == RCCallMediaVideo) { + nameLabelHeight = 0; + insideMargin = 0; + } + [self resetLayout:nameLabelHeight insideMargin:insideMargin]; + + [self.headerImageView setImageURL:[NSURL URLWithString:model.userInfo.portraitUri]]; + [self.nameLabel setText:model.userInfo.name]; + if (model.profile.callStatus == RCCallRinging || model.profile.callStatus == RCCallDialing || + model.profile.callStatus == RCCallIncoming) { + self.statusView.image = [RCCallKitUtility imageFromVoIPBundle:@"voip/voip_connecting"]; + self.headerImageView.alpha = 0.5; + } else { + self.statusView.image = nil; + self.statusView.hidden = YES; + self.headerImageView.alpha = 1.0; + } } -- (void)resetLayout:(CGFloat)nameLabelHeight - insideMargin:(CGFloat)insideMargin { - CGFloat minLength = - MIN(self.bounds.size.width, - self.bounds.size.height - nameLabelHeight - insideMargin); - - self.headerImageView.frame = CGRectMake( - (self.bounds.size.width - minLength) / 2, 0, minLength, minLength); - self.headerImageView.hidden = NO; - - self.nameLabel.frame = - CGRectMake(0, self.bounds.size.height - nameLabelHeight, - self.bounds.size.width, nameLabelHeight); - if (nameLabelHeight > 0) { - self.nameLabel.hidden = NO; - } else { - self.nameLabel.hidden = YES; - } - - self.statusView.frame = - CGRectMake((self.bounds.size.width - 17) / 2, (self.headerImageView.frame.size.width - 4) / 2,17, 4); - self.statusView.hidden = NO; +- (void)resetLayout:(CGFloat)nameLabelHeight insideMargin:(CGFloat)insideMargin { + CGFloat minLength = MIN(self.bounds.size.width, self.bounds.size.height - nameLabelHeight - insideMargin); + + self.headerImageView.frame = CGRectMake((self.bounds.size.width - minLength) / 2, 0, minLength, minLength); + self.headerImageView.hidden = NO; + + self.nameLabel.frame = + CGRectMake(0, self.bounds.size.height - nameLabelHeight, self.bounds.size.width, nameLabelHeight); + if (nameLabelHeight > 0) { + self.nameLabel.hidden = NO; + } else { + self.nameLabel.hidden = YES; + } + + self.statusView.frame = + CGRectMake((self.bounds.size.width - 17) / 2, (self.headerImageView.frame.size.width - 4) / 2, 17, 4); + self.statusView.hidden = NO; } @end diff --git a/ios-rongcallkit/RongCallKit/Cell/RCCallSelectingMemberCell.m b/ios-rongcallkit/RongCallKit/Cell/RCCallSelectingMemberCell.m index f2ab57d..2c09149 100644 --- a/ios-rongcallkit/RongCallKit/Cell/RCCallSelectingMemberCell.m +++ b/ios-rongcallkit/RongCallKit/Cell/RCCallSelectingMemberCell.m @@ -11,47 +11,45 @@ @implementation RCCallSelectingMemberCell -- (instancetype)initWithStyle:(UITableViewCellStyle)style - reuseIdentifier:(NSString *)reuseIdentifier { - self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]; - if (self) { - self.selectedImageView = [[UIImageView alloc] init]; - self.selectedImageView.frame = CGRectMake(10, 25, 20, 20); - [self.contentView addSubview:self.selectedImageView]; - - self.headerImageView = [[RCloudImageView alloc] init]; - self.headerImageView.contentMode = UIViewContentModeScaleAspectFill; - [self.headerImageView - setPlaceholderImage:[RCKitUtility imageNamed:@"default_portrait_msg" - ofBundle:@"RongCloud.bundle"]]; - self.headerImageView.frame = CGRectMake(40, 5, 60, 60); - - self.headerImageView.layer.cornerRadius = 5; - self.headerImageView.layer.masksToBounds = YES; - - [self.contentView addSubview:self.headerImageView]; - - self.nameLabel = [[UILabel alloc] init]; - self.nameLabel.frame = CGRectMake(110, 5, self.bounds.size.width - 110, 60); - self.nameLabel.textColor = [UIColor whiteColor]; - [self.contentView addSubview:self.nameLabel]; - - self.contentView.backgroundColor = RongVoIPUIColorFromRGB(0x262e42); - } - return self; +- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier { + self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]; + if (self) { + self.selectedImageView = [[UIImageView alloc] init]; + self.selectedImageView.frame = CGRectMake(10, 25, 20, 20); + [self.contentView addSubview:self.selectedImageView]; + + self.headerImageView = [[RCloudImageView alloc] init]; + self.headerImageView.contentMode = UIViewContentModeScaleAspectFill; + [self.headerImageView + setPlaceholderImage:[RCKitUtility imageNamed:@"default_portrait_msg" ofBundle:@"RongCloud.bundle"]]; + self.headerImageView.frame = CGRectMake(40, 5, 60, 60); + + self.headerImageView.layer.cornerRadius = 5; + self.headerImageView.layer.masksToBounds = YES; + + [self.contentView addSubview:self.headerImageView]; + + self.nameLabel = [[UILabel alloc] init]; + self.nameLabel.frame = CGRectMake(110, 5, self.bounds.size.width - 110, 60); + self.nameLabel.textColor = [UIColor whiteColor]; + [self.contentView addSubview:self.nameLabel]; + + self.contentView.backgroundColor = RongVoIPUIColorFromRGB(0x262e42); + } + return self; } - (void)layoutSubviews { - [super layoutSubviews]; + [super layoutSubviews]; } - (void)awakeFromNib { - // Initialization code - [super awakeFromNib]; + // Initialization code + [super awakeFromNib]; } - (void)setSelected:(BOOL)selected animated:(BOOL)animated { - [super setSelected:selected animated:animated]; + [super setSelected:selected animated:animated]; } @end diff --git a/ios-rongcallkit/RongCallKit/Cell/RCCallTipMessageCell.m b/ios-rongcallkit/RongCallKit/Cell/RCCallTipMessageCell.m index f5d52a3..3b86bba 100644 --- a/ios-rongcallkit/RongCallKit/Cell/RCCallTipMessageCell.m +++ b/ios-rongcallkit/RongCallKit/Cell/RCCallTipMessageCell.m @@ -14,91 +14,80 @@ @implementation RCCallTipMessageCell + (CGSize)sizeForMessageModel:(RCMessageModel *)model withCollectionViewWidth:(CGFloat)collectionViewWidth referenceExtraHeight:(CGFloat)extraHeight { - CGFloat height = 17.5; - - height += extraHeight; - - return CGSizeMake(collectionViewWidth, height); + CGFloat height = 17.5; + + height += extraHeight; + + return CGSizeMake(collectionViewWidth, height); } - (instancetype)initWithFrame:(CGRect)frame { - self = [super initWithFrame:frame]; - if (self) { - self.messageLabel = [RCTipLabel greyTipLabel]; - [self.baseContentView addSubview:self.messageLabel]; - self.messageLabel.marginInsets = UIEdgeInsetsMake(0.5f, 0.5f, 0.5f, 0.5f); - } - return self; + self = [super initWithFrame:frame]; + if (self) { + self.messageLabel = [RCTipLabel greyTipLabel]; + [self.baseContentView addSubview:self.messageLabel]; + self.messageLabel.marginInsets = UIEdgeInsetsMake(0.5f, 0.5f, 0.5f, 0.5f); + } + return self; } - (id)initWithCoder:(NSCoder *)aDecoder { - self = [super initWithCoder:aDecoder]; - if (self) { - self.messageLabel = [RCTipLabel greyTipLabel]; - [self.baseContentView addSubview:self.messageLabel]; - self.messageLabel.marginInsets = UIEdgeInsetsMake(0.5f, 0.5f, 0.5f, 0.5f); - } - return self; + self = [super initWithCoder:aDecoder]; + if (self) { + self.messageLabel = [RCTipLabel greyTipLabel]; + [self.baseContentView addSubview:self.messageLabel]; + self.messageLabel.marginInsets = UIEdgeInsetsMake(0.5f, 0.5f, 0.5f, 0.5f); + } + return self; } - (void)setDataModel:(RCMessageModel *)model { - [super setDataModel:model]; + [super setDataModel:model]; - // RCMessageContent *content = model.content; + // RCMessageContent *content = model.content; - CGFloat maxMessageLabelWidth = - self.baseContentView.bounds.size.width - 30 * 2; + CGFloat maxMessageLabelWidth = self.baseContentView.bounds.size.width - 30 * 2; - if ([model.content isMemberOfClass:[RCCallSummaryMessage class]]) { - RCCallSummaryMessage *message = (RCCallSummaryMessage *)model.content; + if ([model.content isMemberOfClass:[RCCallSummaryMessage class]]) { + RCCallSummaryMessage *message = (RCCallSummaryMessage *)model.content; - NSString *status = nil; - if (message.connectedTime > 0) { - status = - NSLocalizedStringFromTable(@"VoIPCallHasEnd", @"RongCloudKit", nil); - } else if (message.hangupReason == RCCallDisconnectReasonReject || - message.hangupReason == RCCallDisconnectReasonRemoteReject) { - status = NSLocalizedStringFromTable(@"VoIPCallHasReject", @"RongCloudKit", - nil); - } else if (message.hangupReason == RCCallDisconnectReasonCancel){ - status = NSLocalizedStringFromTable(@"VoIPCallHasCancel", - @"RongCloudKit", nil); - } else if (message.hangupReason == RCCallDisconnectReasonRemoteCancel) { - status = NSLocalizedStringFromTable(@"VoIPCallNoResponse", - @"RongCloudKit", nil); - } else { - status = NSLocalizedStringFromTable(@"VoIPCallNoResponse", - @"RongCloudKit", nil); - } + NSString *status = nil; + if (message.connectedTime > 0) { + status = NSLocalizedStringFromTable(@"VoIPCallHasEnd", @"RongCloudKit", nil); + } else if (message.hangupReason == RCCallDisconnectReasonReject || + message.hangupReason == RCCallDisconnectReasonRemoteReject) { + status = NSLocalizedStringFromTable(@"VoIPCallHasReject", @"RongCloudKit", nil); + } else if (message.hangupReason == RCCallDisconnectReasonCancel) { + status = NSLocalizedStringFromTable(@"VoIPCallHasCancel", @"RongCloudKit", nil); + } else if (message.hangupReason == RCCallDisconnectReasonRemoteCancel) { + status = NSLocalizedStringFromTable(@"VoIPCallNoResponse", @"RongCloudKit", nil); + } else { + status = NSLocalizedStringFromTable(@"VoIPCallNoResponse", @"RongCloudKit", nil); + } - if (message.mediaType == RCCallMediaAudio) { - [self.messageLabel - setText:[NSString - stringWithFormat:@" %@ %@ ", - NSLocalizedStringFromTable( - @"VoIPAudioCall", - @"RongCloudKit", nil), - status] - dataDetectorEnabled:NO]; - } else { - [self.messageLabel - setText:[NSString - stringWithFormat:@" %@ %@ ", - NSLocalizedStringFromTable( - @"VoIPVideoCall", - @"RongCloudKit", nil), - status] - dataDetectorEnabled:NO]; + if (message.mediaType == RCCallMediaAudio) { + [self.messageLabel setText:[NSString stringWithFormat:@" %@ %@ ", + NSLocalizedStringFromTable(@"VoIPAudioCall", + @"RongCloudKit", nil), + status] + dataDetectorEnabled:NO]; + } else { + [self.messageLabel setText:[NSString stringWithFormat:@" %@ %@ ", + NSLocalizedStringFromTable(@"VoIPVideoCall", + @"RongCloudKit", nil), + status] + dataDetectorEnabled:NO]; + } } - } - NSString *__text = self.messageLabel.text; - - CGSize __textSize = [RCKitUtility getTextDrawingSize:__text font:[UIFont systemFontOfSize:14.f] constrainedSize:CGSizeMake(maxMessageLabelWidth, MAXFLOAT)]; - __textSize = CGSizeMake(ceilf(__textSize.width), ceilf(__textSize.height)); - CGSize __labelSize = CGSizeMake(__textSize.width + 5, __textSize.height + 6); + NSString *__text = self.messageLabel.text; + + CGSize __textSize = [RCKitUtility getTextDrawingSize:__text + font:[UIFont systemFontOfSize:14.f] + constrainedSize:CGSizeMake(maxMessageLabelWidth, MAXFLOAT)]; + __textSize = CGSizeMake(ceilf(__textSize.width), ceilf(__textSize.height)); + CGSize __labelSize = CGSizeMake(__textSize.width + 5, __textSize.height + 6); - self.messageLabel.frame = CGRectMake( - (self.baseContentView.bounds.size.width - __labelSize.width) / 2.0f, 10, - __labelSize.width, __labelSize.height); + self.messageLabel.frame = CGRectMake((self.baseContentView.bounds.size.width - __labelSize.width) / 2.0f, 10, + __labelSize.width, __labelSize.height); } @end diff --git a/ios-rongcallkit/RongCallKit/Controller/RCCallAudioMultiCallViewController.m b/ios-rongcallkit/RongCallKit/Controller/RCCallAudioMultiCallViewController.m index df12d0a..ffd56f7 100644 --- a/ios-rongcallkit/RongCallKit/Controller/RCCallAudioMultiCallViewController.m +++ b/ios-rongcallkit/RongCallKit/Controller/RCCallAudioMultiCallViewController.m @@ -30,411 +30,364 @@ @interface RCCallAudioMultiCallViewController () @implementation RCCallAudioMultiCallViewController - (instancetype)initWithIncomingCall:(RCCallSession *)callSession { - return [super initWithIncomingCall:callSession]; + return [super initWithIncomingCall:callSession]; } - (instancetype)initWithOutgoingCall:(RCConversationType)conversationType targetId:(NSString *)targetId userIdList:(NSArray *)userIdList { - return [super initWithOutgoingCall:conversationType - targetId:targetId - mediaType:RCCallMediaAudio - userIdList:userIdList]; + return [super initWithOutgoingCall:conversationType + targetId:targetId + mediaType:RCCallMediaAudio + userIdList:userIdList]; } - (instancetype)initWithActiveCall:(RCCallSession *)callSession { - return [super initWithActiveCall:callSession]; + return [super initWithActiveCall:callSession]; } - (void)viewDidLoad { - [super viewDidLoad]; + [super viewDidLoad]; - [[NSNotificationCenter defaultCenter] - addObserver:self - selector:@selector(onUserInfoUpdate:) - name:RCKitDispatchUserInfoUpdateNotification - object:nil]; + [[NSNotificationCenter defaultCenter] addObserver:self + selector:@selector(onUserInfoUpdate:) + name:RCKitDispatchUserInfoUpdateNotification + object:nil]; - [self initAllUserModel]; - if (self.callSession.callStatus == RCCallHangup) { - [[RCCall sharedRCCall] dismissCallViewController:self]; - return; - } + [self initAllUserModel]; + if (self.callSession.callStatus == RCCallHangup) { + [[RCCall sharedRCCall] dismissCallViewController:self]; + return; + } } - (void)viewWillAppear:(BOOL)animated { - [super viewWillAppear:animated]; + [super viewWillAppear:animated]; } - (void)initAllUserModel { - if (self.callSession.callStatus == RCCallIncoming || - self.callSession.callStatus == RCCallRinging) { - if ([self inviterHasHangup]) { - RCCallUserProfile *firstUserProfile = self.callSession.userProfileList[0]; - self.mainModel = [self generateUserModel:firstUserProfile.userId]; - - self.subUserModelList = [[NSMutableArray alloc] init]; - for (RCCallUserProfile *userProfile in self.callSession.userProfileList) { - if (![userProfile.userId isEqualToString:firstUserProfile.userId]) { - RCCallUserCallInfoModel *userModel = - [self generateUserModel:userProfile.userId]; - [self.subUserModelList addObject:userModel]; - } - } - RCCallUserCallInfoModel *userModel = - [self generateUserModel:currentUserId]; - [self.subUserModelList addObject:userModel]; - } else { - self.mainModel = [self generateUserModel:self.callSession.inviter]; - - self.subUserModelList = [[NSMutableArray alloc] init]; - BOOL isContaitSelf = NO; - for (RCCallUserProfile *userProfile in self.callSession.userProfileList) { - if (![userProfile.userId isEqualToString:self.callSession.inviter]) { - RCCallUserCallInfoModel *userModel = - [self generateUserModel:userProfile.userId]; - [self.subUserModelList addObject:userModel]; - } - if ([userProfile.userId isEqualToString:currentUserId]) { - isContaitSelf = YES; + if (self.callSession.callStatus == RCCallIncoming || self.callSession.callStatus == RCCallRinging) { + if ([self inviterHasHangup]) { + RCCallUserProfile *firstUserProfile = self.callSession.userProfileList[0]; + self.mainModel = [self generateUserModel:firstUserProfile.userId]; + + self.subUserModelList = [[NSMutableArray alloc] init]; + for (RCCallUserProfile *userProfile in self.callSession.userProfileList) { + if (![userProfile.userId isEqualToString:firstUserProfile.userId]) { + RCCallUserCallInfoModel *userModel = [self generateUserModel:userProfile.userId]; + [self.subUserModelList addObject:userModel]; + } + } + RCCallUserCallInfoModel *userModel = [self generateUserModel:currentUserId]; + [self.subUserModelList addObject:userModel]; + } else { + self.mainModel = [self generateUserModel:self.callSession.inviter]; + + self.subUserModelList = [[NSMutableArray alloc] init]; + BOOL isContaitSelf = NO; + for (RCCallUserProfile *userProfile in self.callSession.userProfileList) { + if (![userProfile.userId isEqualToString:self.callSession.inviter]) { + RCCallUserCallInfoModel *userModel = [self generateUserModel:userProfile.userId]; + [self.subUserModelList addObject:userModel]; + } + if ([userProfile.userId isEqualToString:currentUserId]) { + isContaitSelf = YES; + } + } + if (!isContaitSelf) { + RCCallUserCallInfoModel *userModel = [self generateUserModel:currentUserId]; + [self.subUserModelList addObject:userModel]; + } } - } - if (!isContaitSelf) { - RCCallUserCallInfoModel *userModel = - [self generateUserModel:currentUserId]; - [self.subUserModelList addObject:userModel]; - } - } - } else if (self.callSession.callStatus == RCCallDialing) { - self.mainModel = [self generateUserModel:currentUserId]; + } else if (self.callSession.callStatus == RCCallDialing) { + self.mainModel = [self generateUserModel:currentUserId]; - self.subUserModelList = [[NSMutableArray alloc] init]; - for (RCCallUserProfile *userProfile in self.callSession.userProfileList) { - RCCallUserCallInfoModel *userModel = - [self generateUserModel:userProfile.userId]; - [self.subUserModelList addObject:userModel]; - } - } else if (self.callSession.callStatus == RCCallActive) { - if ([self.callSession.inviter isEqualToString:currentUserId] || - [self inviterHasHangup]) { - self.mainModel = [self generateUserModel:currentUserId]; - - self.subUserModelList = [[NSMutableArray alloc] init]; - for (RCCallUserProfile *userProfile in self.callSession.userProfileList) { - RCCallUserCallInfoModel *userModel = - [self generateUserModel:userProfile.userId]; - [self.subUserModelList addObject:userModel]; - } - } else { - self.mainModel = [self generateUserModel:self.callSession.inviter]; - - self.subUserModelList = [[NSMutableArray alloc] init]; - for (RCCallUserProfile *userProfile in self.callSession.userProfileList) { - if (![userProfile.userId isEqualToString:self.callSession.inviter]) { - RCCallUserCallInfoModel *userModel = - [self generateUserModel:userProfile.userId]; - [self.subUserModelList addObject:userModel]; + self.subUserModelList = [[NSMutableArray alloc] init]; + for (RCCallUserProfile *userProfile in self.callSession.userProfileList) { + RCCallUserCallInfoModel *userModel = [self generateUserModel:userProfile.userId]; + [self.subUserModelList addObject:userModel]; + } + } else if (self.callSession.callStatus == RCCallActive) { + if ([self.callSession.inviter isEqualToString:currentUserId] || [self inviterHasHangup]) { + self.mainModel = [self generateUserModel:currentUserId]; + + self.subUserModelList = [[NSMutableArray alloc] init]; + for (RCCallUserProfile *userProfile in self.callSession.userProfileList) { + RCCallUserCallInfoModel *userModel = [self generateUserModel:userProfile.userId]; + [self.subUserModelList addObject:userModel]; + } + } else { + self.mainModel = [self generateUserModel:self.callSession.inviter]; + + self.subUserModelList = [[NSMutableArray alloc] init]; + for (RCCallUserProfile *userProfile in self.callSession.userProfileList) { + if (![userProfile.userId isEqualToString:self.callSession.inviter]) { + RCCallUserCallInfoModel *userModel = [self generateUserModel:userProfile.userId]; + [self.subUserModelList addObject:userModel]; + } + } + RCCallUserCallInfoModel *userModel = [self generateUserModel:currentUserId]; + [self.subUserModelList addObject:userModel]; } - } - RCCallUserCallInfoModel *userModel = - [self generateUserModel:currentUserId]; - [self.subUserModelList addObject:userModel]; } - } } - (RCCallUserCallInfoModel *)generateUserModel:(NSString *)userId { - RCCallUserCallInfoModel *userModel = [[RCCallUserCallInfoModel alloc] init]; - userModel.userId = userId; - userModel.userInfo = - [[RCUserInfoCacheManager sharedManager] getUserInfo:userId]; - - if ([userId isEqualToString:currentUserId]) { - userModel.profile = self.callSession.myProfile; - } else { - for (RCCallUserProfile *userProfile in self.callSession.userProfileList) { - if ([userProfile.userId isEqualToString:userId]) { - userModel.profile = userProfile; - break; - } + RCCallUserCallInfoModel *userModel = [[RCCallUserCallInfoModel alloc] init]; + userModel.userId = userId; + userModel.userInfo = [[RCUserInfoCacheManager sharedManager] getUserInfo:userId]; + + if ([userId isEqualToString:currentUserId]) { + userModel.profile = self.callSession.myProfile; + } else { + for (RCCallUserProfile *userProfile in self.callSession.userProfileList) { + if ([userProfile.userId isEqualToString:userId]) { + userModel.profile = userProfile; + break; + } + } } - } - return userModel; + return userModel; } - (NSArray *)getAllUserIdInSubUserModel { - NSMutableArray *userIdList = [[NSMutableArray alloc] init]; - for (RCCallUserCallInfoModel *userModel in self.subUserModelList) { - [userIdList addObject:userModel.userId]; - } - if (userIdList.count > 0) { - return [userIdList copy]; - } else { - return nil; - } + NSMutableArray *userIdList = [[NSMutableArray alloc] init]; + for (RCCallUserCallInfoModel *userModel in self.subUserModelList) { + [userIdList addObject:userModel.userId]; + } + if (userIdList.count > 0) { + return [userIdList copy]; + } else { + return nil; + } } - (RCCallUserCallInfoModel *)getModelInSubUserModelList:(NSString *)userId { - for (RCCallUserCallInfoModel *model in self.subUserModelList) { - if ([model.userId isEqualToString:userId]) { - return model; + for (RCCallUserCallInfoModel *model in self.subUserModelList) { + if ([model.userId isEqualToString:userId]) { + return model; + } } - } - return nil; + return nil; } - (BOOL)inviterHasHangup { - if ([self.callSession.inviter isEqualToString:currentUserId]) { - if (self.callSession.callStatus == RCCallHangup) { - return YES; + if ([self.callSession.inviter isEqualToString:currentUserId]) { + if (self.callSession.callStatus == RCCallHangup) { + return YES; + } else { + return NO; + } } else { - return NO; - } - } else { - for (RCCallUserProfile *userProfile in self.callSession.userProfileList) { - if ([userProfile.userId isEqualToString:self.callSession.inviter] && - userProfile.callStatus != RCCallHangup) { - return NO; - } + for (RCCallUserProfile *userProfile in self.callSession.userProfileList) { + if ([userProfile.userId isEqualToString:self.callSession.inviter] && + userProfile.callStatus != RCCallHangup) { + return NO; + } + } + return YES; } - return YES; - } } - (void)setMainModel:(RCCallUserCallInfoModel *)mainModel { - _mainModel = mainModel; - if (mainModel.userInfo) { - self.inviterNameLabel.text = mainModel.userInfo.name; - [self.inviterPortraitView - setImageURL:[NSURL URLWithString:mainModel.userInfo.portraitUri]]; - } else { - mainModel.userInfo = - [[RCUserInfoCacheManager sharedManager] getUserInfo:mainModel.userId]; - } + _mainModel = mainModel; + if (mainModel.userInfo) { + self.inviterNameLabel.text = mainModel.userInfo.name; + [self.inviterPortraitView setImageURL:[NSURL URLWithString:mainModel.userInfo.portraitUri]]; + } else { + mainModel.userInfo = [[RCUserInfoCacheManager sharedManager] getUserInfo:mainModel.userId]; + } } - (void)updateSubUserLayout:(RCCallUserCallInfoModel *)model { - if (model) { - NSInteger index = [self.subUserModelList indexOfObject:model]; - if (index != NSNotFound) { - NSIndexPath *indexPath = [NSIndexPath indexPathForItem:index inSection:0]; - [self.userCollectionView reloadItemsAtIndexPaths:@[ indexPath ]]; + if (model) { + NSInteger index = [self.subUserModelList indexOfObject:model]; + if (index != NSNotFound) { + NSIndexPath *indexPath = [NSIndexPath indexPathForItem:index inSection:0]; + [self.userCollectionView reloadItemsAtIndexPaths:@[ indexPath ]]; + } } - } } - (void)updateAllSubUserLayout { - [self.userCollectionView reloadData]; + [self.userCollectionView reloadData]; } - (void)addSubUserModel:(RCCallUserCallInfoModel *)model { - if (model.userId && - ![[self getAllUserIdInSubUserModel] containsObject:model.userId]) { - NSInteger index = self.subUserModelList.count; - NSIndexPath *indexPath = [NSIndexPath indexPathForItem:index inSection:0]; - [self.subUserModelList addObject:model]; - [self.userCollectionView - insertItemsAtIndexPaths:[NSArray arrayWithObject:indexPath]]; - } + if (model.userId && ![[self getAllUserIdInSubUserModel] containsObject:model.userId]) { + NSInteger index = self.subUserModelList.count; + NSIndexPath *indexPath = [NSIndexPath indexPathForItem:index inSection:0]; + [self.subUserModelList addObject:model]; + [self.userCollectionView insertItemsAtIndexPaths:[NSArray arrayWithObject:indexPath]]; + } } - (void)removeSubUserModel:(RCCallUserCallInfoModel *)model { - if (model) { - NSInteger index = [self.subUserModelList indexOfObject:model]; - if (index != NSNotFound) { - NSIndexPath *indexPath = [NSIndexPath indexPathForItem:index inSection:0]; - [self.subUserModelList removeObject:model]; - [self.userCollectionView - deleteItemsAtIndexPaths:[NSArray arrayWithObject:indexPath]]; + if (model) { + NSInteger index = [self.subUserModelList indexOfObject:model]; + if (index != NSNotFound) { + NSIndexPath *indexPath = [NSIndexPath indexPathForItem:index inSection:0]; + [self.subUserModelList removeObject:model]; + [self.userCollectionView deleteItemsAtIndexPaths:[NSArray arrayWithObject:indexPath]]; + } } - } } - (RCloudImageView *)inviterPortraitView { - if (!_inviterPortraitView) { - _inviterPortraitView = [[RCloudImageView alloc] init]; - - [self.view addSubview:_inviterPortraitView]; - _inviterPortraitView.hidden = YES; - [_inviterPortraitView - setPlaceholderImage:[RCCallKitUtility getDefaultPortraitImage]]; - _inviterPortraitView.layer.cornerRadius = 4; - _inviterPortraitView.layer.masksToBounds = YES; - } - return _inviterPortraitView; + if (!_inviterPortraitView) { + _inviterPortraitView = [[RCloudImageView alloc] init]; + + [self.view addSubview:_inviterPortraitView]; + _inviterPortraitView.hidden = YES; + [_inviterPortraitView setPlaceholderImage:[RCCallKitUtility getDefaultPortraitImage]]; + _inviterPortraitView.layer.cornerRadius = 4; + _inviterPortraitView.layer.masksToBounds = YES; + } + return _inviterPortraitView; } - (UILabel *)inviterNameLabel { - if (!_inviterNameLabel) { - _inviterNameLabel = [[UILabel alloc] init]; - _inviterNameLabel.backgroundColor = [UIColor clearColor]; - _inviterNameLabel.textColor = [UIColor whiteColor]; - _inviterNameLabel.font = [UIFont systemFontOfSize:18]; - _inviterNameLabel.textAlignment = NSTextAlignmentCenter; - - [self.view addSubview:_inviterNameLabel]; - _inviterNameLabel.hidden = YES; - } - return _inviterNameLabel; + if (!_inviterNameLabel) { + _inviterNameLabel = [[UILabel alloc] init]; + _inviterNameLabel.backgroundColor = [UIColor clearColor]; + _inviterNameLabel.textColor = [UIColor whiteColor]; + _inviterNameLabel.font = [UIFont systemFontOfSize:18]; + _inviterNameLabel.textAlignment = NSTextAlignmentCenter; + + [self.view addSubview:_inviterNameLabel]; + _inviterNameLabel.hidden = YES; + } + return _inviterNameLabel; } - (UILabel *)userCollectionTitleLabel { - if (!_userCollectionTitleLabel) { - _userCollectionTitleLabel = [[UILabel alloc] init]; - _userCollectionTitleLabel.backgroundColor = [UIColor clearColor]; - _userCollectionTitleLabel.textColor = [UIColor whiteColor]; - _userCollectionTitleLabel.font = [UIFont systemFontOfSize:16]; - _userCollectionTitleLabel.textAlignment = NSTextAlignmentCenter; - _userCollectionTitleLabel.text = NSLocalizedStringFromTable( - @"VoIPMultiCallUserCollectionTitle", @"RongCloudKit", nil); - - [self.view addSubview:_userCollectionTitleLabel]; - _userCollectionTitleLabel.hidden = YES; - } - return _userCollectionTitleLabel; + if (!_userCollectionTitleLabel) { + _userCollectionTitleLabel = [[UILabel alloc] init]; + _userCollectionTitleLabel.backgroundColor = [UIColor clearColor]; + _userCollectionTitleLabel.textColor = [UIColor whiteColor]; + _userCollectionTitleLabel.font = [UIFont systemFontOfSize:16]; + _userCollectionTitleLabel.textAlignment = NSTextAlignmentCenter; + _userCollectionTitleLabel.text = + NSLocalizedStringFromTable(@"VoIPMultiCallUserCollectionTitle", @"RongCloudKit", nil); + + [self.view addSubview:_userCollectionTitleLabel]; + _userCollectionTitleLabel.hidden = YES; + } + return _userCollectionTitleLabel; } - (UICollectionView *)userCollectionView { - if (!_userCollectionView) { - if (self.userCollectionViewLayout) { - _userCollectionView = [[UICollectionView alloc] - initWithFrame:CGRectZero - collectionViewLayout:self.userCollectionViewLayout]; - } else { - RCAudioMultiCallUserCollectionLayout *userCollectionViewLayout = - [[RCAudioMultiCallUserCollectionLayout alloc] initWithItemMargin:5 - buttomPadding:10]; - _userCollectionView = - [[UICollectionView alloc] initWithFrame:CGRectZero - collectionViewLayout:userCollectionViewLayout]; - } - _userCollectionView.backgroundColor = [UIColor clearColor]; + if (!_userCollectionView) { + if (self.userCollectionViewLayout) { + _userCollectionView = + [[UICollectionView alloc] initWithFrame:CGRectZero collectionViewLayout:self.userCollectionViewLayout]; + } else { + RCAudioMultiCallUserCollectionLayout *userCollectionViewLayout = + [[RCAudioMultiCallUserCollectionLayout alloc] initWithItemMargin:5 buttomPadding:10]; + _userCollectionView = + [[UICollectionView alloc] initWithFrame:CGRectZero collectionViewLayout:userCollectionViewLayout]; + } + _userCollectionView.backgroundColor = [UIColor clearColor]; - [self.view addSubview:_userCollectionView]; - _userCollectionView.hidden = YES; - _userCollectionView.dataSource = self; - [_userCollectionView registerClass:[RCCallMultiCallUserCell class] - forCellWithReuseIdentifier:RongVoIPMultiAudioCellReuseID]; - } - return _userCollectionView; + [self.view addSubview:_userCollectionView]; + _userCollectionView.hidden = YES; + _userCollectionView.dataSource = self; + [_userCollectionView registerClass:[RCCallMultiCallUserCell class] + forCellWithReuseIdentifier:RongVoIPMultiAudioCellReuseID]; + } + return _userCollectionView; } - (void)inviteUserButtonClicked { - [self didTapInviteUserButton]; + [self didTapInviteUserButton]; - if (self.callSession.isMultiCall) { - [self inviteNewUser]; - } else { - NSLog(@"not support add user for conversation type %zd", - self.callSession.conversationType); - } + if (self.callSession.isMultiCall) { + [self inviteNewUser]; + } else { + NSLog(@"not support add user for conversation type %zd", self.callSession.conversationType); + } } - (void)inviteNewUser { - NSMutableArray *existUserIdList = [[NSMutableArray alloc] init]; - for (RCCallUserProfile *userProfile in self.callSession.userProfileList) { - [existUserIdList addObject:userProfile.userId]; - } - [existUserIdList addObject:currentUserId]; - - __weak typeof(self) weakSelf = self; - UIViewController *selectViewController = - [[RCCallSelectMemberViewController alloc] - initWithConversationType:self.conversationType - targetId:self.targetId - mediaType:self.mediaType - exist:[existUserIdList copy] - success:^(NSArray *addUserIdList) { - [weakSelf.callSession - inviteRemoteUsers:addUserIdList - mediaType:weakSelf.mediaType]; - }]; - - dispatch_async(dispatch_get_main_queue(), ^{ - [weakSelf presentViewController:selectViewController - animated:YES - completion:nil]; - }); -} - -- (void)resetLayout:(BOOL)isMultiCall - mediaType:(RCCallMediaType)mediaType - callStatus:(RCCallStatus)callStatus { - [super resetLayout:isMultiCall - mediaType:mediaType - callStatus:callStatus]; - - if (callStatus == RCCallIncoming || callStatus == RCCallRinging) { - [self.inviterPortraitView - setImageURL:[NSURL URLWithString:self.mainModel.userInfo.portraitUri]]; - self.inviterPortraitView.frame = CGRectMake( - (self.view.frame.size.width - RCCallHeaderLength) / 2, - RCCallVerticalMargin * 2, RCCallHeaderLength, RCCallHeaderLength); - self.inviterPortraitView.hidden = NO; - - self.inviterNameLabel.text = self.mainModel.userInfo.name; - self.inviterNameLabel.frame = CGRectMake( - RCCallHorizontalMargin, - RCCallVerticalMargin * 2 + RCCallHeaderLength + RCCallInsideMargin, - self.view.frame.size.width - RCCallHorizontalMargin * 2, - RCCallLabelHeight); - self.inviterNameLabel.hidden = NO; - } else { - self.inviterNameLabel.hidden = YES; - self.inviterPortraitView.hidden = YES; - } - - CGFloat titleY = MAX(RCCallVerticalMargin * 2 + RCCallHeaderLength + - RCCallInsideMargin * 3 + RCCallLabelHeight * 2, - (self.view.frame.size.height - RCCallLabelHeight) / 2); - if (callStatus == RCCallIncoming || callStatus == RCCallRinging) { - self.userCollectionTitleLabel.frame = - CGRectMake(RCCallHorizontalMargin, titleY, - self.view.frame.size.width - RCCallHorizontalMargin * 2, - RCCallLabelHeight); - self.userCollectionTitleLabel.hidden = NO; - } else { - self.userCollectionTitleLabel.hidden = YES; - } - - if (callStatus == RCCallIncoming || callStatus == RCCallRinging) { - self.userCollectionView.frame = CGRectMake( - RCCallHorizontalMargin * 2.5, - titleY + RCCallLabelHeight + RCCallInsideMargin, - self.view.frame.size.width - RCCallHorizontalMargin * 5, - self.view.frame.size.height - RCCallVerticalMargin - - RCCallButtonLength - RCCallInsideMargin * 4 - RCCallLabelHeight - - (titleY + RCCallLabelHeight + RCCallInsideMargin)); - - if (self.userCollectionViewLayout) { - self.userCollectionView.collectionViewLayout = - self.userCollectionViewLayout; + NSMutableArray *existUserIdList = [[NSMutableArray alloc] init]; + for (RCCallUserProfile *userProfile in self.callSession.userProfileList) { + [existUserIdList addObject:userProfile.userId]; + } + [existUserIdList addObject:currentUserId]; + + __weak typeof(self) weakSelf = self; + UIViewController *selectViewController = [[RCCallSelectMemberViewController alloc] + initWithConversationType:self.conversationType + targetId:self.targetId + mediaType:self.mediaType + exist:[existUserIdList copy] + success:^(NSArray *addUserIdList) { + [weakSelf.callSession inviteRemoteUsers:addUserIdList mediaType:weakSelf.mediaType]; + }]; + + dispatch_async(dispatch_get_main_queue(), ^{ + [weakSelf presentViewController:selectViewController animated:YES completion:nil]; + }); +} + +- (void)resetLayout:(BOOL)isMultiCall mediaType:(RCCallMediaType)mediaType callStatus:(RCCallStatus)callStatus { + [super resetLayout:isMultiCall mediaType:mediaType callStatus:callStatus]; + + if (callStatus == RCCallIncoming || callStatus == RCCallRinging) { + [self.inviterPortraitView setImageURL:[NSURL URLWithString:self.mainModel.userInfo.portraitUri]]; + self.inviterPortraitView.frame = CGRectMake((self.view.frame.size.width - RCCallHeaderLength) / 2, + RCCallVerticalMargin * 2, RCCallHeaderLength, RCCallHeaderLength); + self.inviterPortraitView.hidden = NO; + + self.inviterNameLabel.text = self.mainModel.userInfo.name; + self.inviterNameLabel.frame = + CGRectMake(RCCallHorizontalMargin, RCCallVerticalMargin * 2 + RCCallHeaderLength + RCCallInsideMargin, + self.view.frame.size.width - RCCallHorizontalMargin * 2, RCCallLabelHeight); + self.inviterNameLabel.hidden = NO; } else { - RCAudioMultiCallUserCollectionLayout *userCollectionViewLayout = - [[RCAudioMultiCallUserCollectionLayout alloc] initWithItemMargin:5 - buttomPadding:10]; - [self.userCollectionView setCollectionViewLayout:userCollectionViewLayout - animated:YES]; + self.inviterNameLabel.hidden = YES; + self.inviterPortraitView.hidden = YES; } - self.userCollectionView.hidden = NO; - } else if (callStatus == RCCallDialing || callStatus == RCCallActive) { - self.userCollectionView.frame = CGRectMake( - 0, (self.view.frame.size.height - RCCallButtonLength * 3) / 2, - self.view.frame.size.width, RCCallButtonLength * 3); - - if (self.userCollectionViewLayout) { - self.userCollectionView.collectionViewLayout = - self.userCollectionViewLayout; + + CGFloat titleY = MAX(RCCallVerticalMargin * 2 + RCCallHeaderLength + RCCallInsideMargin * 3 + RCCallLabelHeight * 2, + (self.view.frame.size.height - RCCallLabelHeight) / 2); + if (callStatus == RCCallIncoming || callStatus == RCCallRinging) { + self.userCollectionTitleLabel.frame = CGRectMake( + RCCallHorizontalMargin, titleY, self.view.frame.size.width - RCCallHorizontalMargin * 2, RCCallLabelHeight); + self.userCollectionTitleLabel.hidden = NO; } else { - RCAudioMultiCallUserCollectionLayout *userCollectionViewLayout = - [[RCAudioMultiCallUserCollectionLayout alloc] initWithItemMargin:2 - buttomPadding:10]; - [self.userCollectionView setCollectionViewLayout:userCollectionViewLayout - animated:YES]; + self.userCollectionTitleLabel.hidden = YES; + } + + if (callStatus == RCCallIncoming || callStatus == RCCallRinging) { + self.userCollectionView.frame = CGRectMake( + RCCallHorizontalMargin * 2.5, titleY + RCCallLabelHeight + RCCallInsideMargin, + self.view.frame.size.width - RCCallHorizontalMargin * 5, + self.view.frame.size.height - RCCallVerticalMargin - RCCallButtonLength - RCCallInsideMargin * 4 - + RCCallLabelHeight - (titleY + RCCallLabelHeight + RCCallInsideMargin)); + + if (self.userCollectionViewLayout) { + self.userCollectionView.collectionViewLayout = self.userCollectionViewLayout; + } else { + RCAudioMultiCallUserCollectionLayout *userCollectionViewLayout = + [[RCAudioMultiCallUserCollectionLayout alloc] initWithItemMargin:5 buttomPadding:10]; + [self.userCollectionView setCollectionViewLayout:userCollectionViewLayout animated:YES]; + } + self.userCollectionView.hidden = NO; + } else if (callStatus == RCCallDialing || callStatus == RCCallActive) { + self.userCollectionView.frame = CGRectMake(0, (self.view.frame.size.height - RCCallButtonLength * 3) / 2, + self.view.frame.size.width, RCCallButtonLength * 3); + + if (self.userCollectionViewLayout) { + self.userCollectionView.collectionViewLayout = self.userCollectionViewLayout; + } else { + RCAudioMultiCallUserCollectionLayout *userCollectionViewLayout = + [[RCAudioMultiCallUserCollectionLayout alloc] initWithItemMargin:2 buttomPadding:10]; + [self.userCollectionView setCollectionViewLayout:userCollectionViewLayout animated:YES]; + } + self.userCollectionView.hidden = NO; } - self.userCollectionView.hidden = NO; - } } #pragma mark - RCCallSessionDelegate @@ -443,17 +396,16 @@ - (void)resetLayout:(BOOL)isMultiCall 通话已接通 */ - (void)callDidConnect { - [self.userCollectionView removeFromSuperview]; - _userCollectionView = nil; - if (![self.callSession.caller isEqualToString:currentUserId]) { - [self.subUserModelList - removeObject:[self getModelInSubUserModelList:currentUserId]]; - [self.subUserModelList addObject:self.mainModel]; - self.mainModel = nil; - } - [self userCollectionView]; - [self updateAllSubUserLayout]; - [super callDidConnect]; + [self.userCollectionView removeFromSuperview]; + _userCollectionView = nil; + if (![self.callSession.caller isEqualToString:currentUserId]) { + [self.subUserModelList removeObject:[self getModelInSubUserModelList:currentUserId]]; + [self.subUserModelList addObject:self.mainModel]; + self.mainModel = nil; + } + [self userCollectionView]; + [self updateAllSubUserLayout]; + [super callDidConnect]; } /*! @@ -462,8 +414,8 @@ - (void)callDidConnect { @param userId 对端的用户ID */ - (void)remoteUserDidRing:(NSString *)userId { - RCCallUserCallInfoModel *model = [self getModelInSubUserModelList:userId]; - [self updateSubUserLayout:model]; + RCCallUserCallInfoModel *model = [self getModelInSubUserModelList:userId]; + [self updateSubUserLayout:model]; } /*! @@ -472,29 +424,23 @@ - (void)remoteUserDidRing:(NSString *)userId { @param userId 被邀请的用户ID @param mediaType 希望被邀请者选择的媒体类型 */ -- (void)remoteUserDidInvite:(NSString *)userId - mediaType:(RCCallMediaType)mediaType { - RCCallUserCallInfoModel *model = [self generateUserModel:userId]; - [self addSubUserModel:model]; - - NSString *userName = - [[RCUserInfoCacheManager sharedManager] getUserInfo:userId].name; - if (userName) { - NSString *inviteTips = [NSString - stringWithFormat:NSLocalizedStringFromTable(@"VoIPCallRemoteDidInvite", - @"RongCloudKit", nil), - userName]; - self.tipsLabel.text = inviteTips; - - __weak typeof(self) weakSelf = self; - dispatch_after( - dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), - dispatch_get_main_queue(), ^{ - if ([weakSelf.tipsLabel.text isEqualToString:inviteTips]) { - weakSelf.tipsLabel.text = @""; - } +- (void)remoteUserDidInvite:(NSString *)userId mediaType:(RCCallMediaType)mediaType { + RCCallUserCallInfoModel *model = [self generateUserModel:userId]; + [self addSubUserModel:model]; + + NSString *userName = [[RCUserInfoCacheManager sharedManager] getUserInfo:userId].name; + if (userName) { + NSString *inviteTips = [NSString + stringWithFormat:NSLocalizedStringFromTable(@"VoIPCallRemoteDidInvite", @"RongCloudKit", nil), userName]; + self.tipsLabel.text = inviteTips; + + __weak typeof(self) weakSelf = self; + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ + if ([weakSelf.tipsLabel.text isEqualToString:inviteTips]) { + weakSelf.tipsLabel.text = @""; + } }); - } + } } /*! @@ -503,16 +449,15 @@ - (void)remoteUserDidInvite:(NSString *)userId @param userId 用户ID @param mediaType 用户的媒体类型 */ -- (void)remoteUserDidJoin:(NSString *)userId - mediaType:(RCCallMediaType)mediaType { - if (![userId isEqualToString:self.mainModel.userId]) { - RCCallUserCallInfoModel *model = [self getModelInSubUserModelList:userId]; - if (!model) { - [self addSubUserModel:[self generateUserModel:userId]]; - } else { - [self updateSubUserLayout:model]; +- (void)remoteUserDidJoin:(NSString *)userId mediaType:(RCCallMediaType)mediaType { + if (![userId isEqualToString:self.mainModel.userId]) { + RCCallUserCallInfoModel *model = [self getModelInSubUserModelList:userId]; + if (!model) { + [self addSubUserModel:[self generateUserModel:userId]]; + } else { + [self updateSubUserLayout:model]; + } } - } } /*! @@ -522,7 +467,7 @@ - (void)remoteUserDidJoin:(NSString *)userId @param muted 是否关闭camera */ - (void)remoteUserDidDisableCamera:(BOOL)muted byUser:(NSString *)userId { - // ignore + // ignore } /*! @@ -531,74 +476,67 @@ - (void)remoteUserDidDisableCamera:(BOOL)muted byUser:(NSString *)userId { @param userId 用户ID @param reason 挂断的原因 */ -- (void)remoteUserDidLeft:(NSString *)userId - reason:(RCCallDisconnectReason)reason { - if ([userId isEqualToString:self.mainModel.userId]) { - if (self.callSession.callStatus == RCCallIncoming || - self.callSession.callStatus == RCCallRinging || - self.callSession.callStatus == RCCallActive) { - RCCallUserCallInfoModel *tempModel = self.subUserModelList[0]; - self.mainModel = tempModel; - if (self.callSession.callStatus == RCCallIncoming || - self.callSession.callStatus == RCCallRinging) { - self.inviterNameLabel.text = tempModel.userInfo.name; - } - - [self.subUserModelList removeObject:tempModel]; - [self updateAllSubUserLayout]; - } - } else { - for (RCCallUserCallInfoModel *userModel in self.subUserModelList) { - if ([userId isEqualToString:userModel.userId]) { - [self removeSubUserModel:userModel]; - break; - } +- (void)remoteUserDidLeft:(NSString *)userId reason:(RCCallDisconnectReason)reason { + if ([userId isEqualToString:self.mainModel.userId]) { + if (self.callSession.callStatus == RCCallIncoming || self.callSession.callStatus == RCCallRinging || + self.callSession.callStatus == RCCallActive) { + RCCallUserCallInfoModel *tempModel = self.subUserModelList[0]; + self.mainModel = tempModel; + if (self.callSession.callStatus == RCCallIncoming || self.callSession.callStatus == RCCallRinging) { + self.inviterNameLabel.text = tempModel.userInfo.name; + } + + [self.subUserModelList removeObject:tempModel]; + [self updateAllSubUserLayout]; + } + } else { + for (RCCallUserCallInfoModel *userModel in self.subUserModelList) { + if ([userId isEqualToString:userModel.userId]) { + [self removeSubUserModel:userModel]; + break; + } + } } - } } #pragma mark - UICollectionViewDataSource -- (NSInteger)collectionView:(UICollectionView *)collectionView - numberOfItemsInSection:(NSInteger)section { - return self.subUserModelList.count; +- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section { + return self.subUserModelList.count; } - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath { - RCCallMultiCallUserCell *cell = [collectionView - dequeueReusableCellWithReuseIdentifier:RongVoIPMultiAudioCellReuseID - forIndexPath:indexPath]; - RCCallUserCallInfoModel *model = self.subUserModelList[indexPath.row]; - [cell setModel:model status:self.callSession.callStatus]; - return cell; + RCCallMultiCallUserCell *cell = + [collectionView dequeueReusableCellWithReuseIdentifier:RongVoIPMultiAudioCellReuseID forIndexPath:indexPath]; + RCCallUserCallInfoModel *model = self.subUserModelList[indexPath.row]; + [cell setModel:model status:self.callSession.callStatus]; + return cell; } #pragma mark - UserInfo Update - (void)onUserInfoUpdate:(NSNotification *)notification { - NSDictionary *userInfoDic = notification.object; - NSString *updateUserId = userInfoDic[@"userId"]; - RCUserInfo *updateUserInfo = userInfoDic[@"userInfo"]; - - __weak typeof(self) weakSelf = self; - dispatch_async(dispatch_get_main_queue(), ^{ - if ([updateUserId isEqualToString:weakSelf.mainModel.userId]) { - weakSelf.mainModel.userInfo = updateUserInfo; - weakSelf.inviterNameLabel.text = updateUserInfo.name; - [weakSelf.inviterPortraitView - setImageURL:[NSURL URLWithString:updateUserInfo.portraitUri]]; - } else { - RCCallUserCallInfoModel *model = - [weakSelf getModelInSubUserModelList:updateUserInfo.userId]; - if (model) { - model.userInfo = updateUserInfo; - [weakSelf updateSubUserLayout:model]; - } - } - }); + NSDictionary *userInfoDic = notification.object; + NSString *updateUserId = userInfoDic[@"userId"]; + RCUserInfo *updateUserInfo = userInfoDic[@"userInfo"]; + + __weak typeof(self) weakSelf = self; + dispatch_async(dispatch_get_main_queue(), ^{ + if ([updateUserId isEqualToString:weakSelf.mainModel.userId]) { + weakSelf.mainModel.userInfo = updateUserInfo; + weakSelf.inviterNameLabel.text = updateUserInfo.name; + [weakSelf.inviterPortraitView setImageURL:[NSURL URLWithString:updateUserInfo.portraitUri]]; + } else { + RCCallUserCallInfoModel *model = [weakSelf getModelInSubUserModelList:updateUserInfo.userId]; + if (model) { + model.userInfo = updateUserInfo; + [weakSelf updateSubUserLayout:model]; + } + } + }); } - (void)dealloc { - [[NSNotificationCenter defaultCenter] removeObserver:self]; + [[NSNotificationCenter defaultCenter] removeObserver:self]; } @end diff --git a/ios-rongcallkit/RongCallKit/Controller/RCCallBaseViewController.h b/ios-rongcallkit/RongCallKit/Controller/RCCallBaseViewController.h index 5a7c2a1..4171ae2 100644 --- a/ios-rongcallkit/RongCallKit/Controller/RCCallBaseViewController.h +++ b/ios-rongcallkit/RongCallKit/Controller/RCCallBaseViewController.h @@ -167,9 +167,7 @@ @discussion 如果您需要重写并调整UI的布局,应该先调用super。 */ -- (void)resetLayout:(BOOL)isMultiCall - mediaType:(RCCallMediaType)mediaType - callStatus:(RCCallStatus)callStatus; +- (void)resetLayout:(BOOL)isMultiCall mediaType:(RCCallMediaType)mediaType callStatus:(RCCallStatus)callStatus; #pragma mark - 初始化 /*! diff --git a/ios-rongcallkit/RongCallKit/Controller/RCCallBaseViewController.m b/ios-rongcallkit/RongCallKit/Controller/RCCallBaseViewController.m index 46fe885..64f8d2c 100644 --- a/ios-rongcallkit/RongCallKit/Controller/RCCallBaseViewController.m +++ b/ios-rongcallkit/RongCallKit/Controller/RCCallBaseViewController.m @@ -12,8 +12,8 @@ #import "RCCallKitUtility.h" #import "RCloudImageView.h" #import -#import #import +#import @interface RCCallBaseViewController () @@ -28,1070 +28,935 @@ @interface RCCallBaseViewController () @implementation RCCallBaseViewController #pragma mark - init - (instancetype)initWithIncomingCall:(RCCallSession *)callSession { - self = [super init]; - if (self) { - _callSession = callSession; - [self registerForegroundNotification]; - [_callSession setDelegate:self]; - [RCCallKitUtility setScreenForceOn]; - } - return self; + self = [super init]; + if (self) { + _callSession = callSession; + [self registerForegroundNotification]; + [_callSession setDelegate:self]; + [RCCallKitUtility setScreenForceOn]; + } + return self; } - (instancetype)initWithOutgoingCall:(RCConversationType)conversationType targetId:(NSString *)targetId mediaType:(RCCallMediaType)mediaType userIdList:(NSArray *)userIdList { - self = [super init]; - if (self) { - _callSession = [[RCCallClient sharedRCCallClient] startCall:conversationType - targetId:targetId - to:userIdList - mediaType:mediaType - sessionDelegate:self - extra:nil]; - [self registerForegroundNotification]; - [RCCallKitUtility setScreenForceOn]; - } - return self; + self = [super init]; + if (self) { + _callSession = [[RCCallClient sharedRCCallClient] startCall:conversationType + targetId:targetId + to:userIdList + mediaType:mediaType + sessionDelegate:self + extra:nil]; + [self registerForegroundNotification]; + [RCCallKitUtility setScreenForceOn]; + } + return self; } - (instancetype)initWithActiveCall:(RCCallSession *)callSession { - self = [super init]; - if (self) { - _callSession = callSession; - [self registerForegroundNotification]; - [_callSession setDelegate:self]; - } - return self; + self = [super init]; + if (self) { + _callSession = callSession; + [self registerForegroundNotification]; + [_callSession setDelegate:self]; + } + return self; } - (void)registerForegroundNotification { - [[NSNotificationCenter defaultCenter] - addObserver:self - selector:@selector(appDidBecomeActive) - name:UIApplicationDidBecomeActiveNotification - object:nil]; + [[NSNotificationCenter defaultCenter] addObserver:self + selector:@selector(appDidBecomeActive) + name:UIApplicationDidBecomeActiveNotification + object:nil]; } - (void)dealloc { - [[NSNotificationCenter defaultCenter] removeObserver:self]; + [[NSNotificationCenter defaultCenter] removeObserver:self]; } #pragma mark - getter - (RCConversationType)conversationType { - return self.callSession.conversationType; + return self.callSession.conversationType; } - (NSString *)targetId { - return self.callSession.targetId; + return self.callSession.targetId; } - (RCCallMediaType)mediaType { - return self.callSession.mediaType; + return self.callSession.mediaType; } - (void)appDidBecomeActive { - if (self.needPlayingAlertAfterForeground) { - [self shouldAlertForWaitingRemoteResponse]; - } else if (self.needPlayingRingAfterForeground) { - [self shouldRingForIncomingCall]; - } + if (self.needPlayingAlertAfterForeground) { + [self shouldAlertForWaitingRemoteResponse]; + } else if (self.needPlayingRingAfterForeground) { + [self shouldRingForIncomingCall]; + } } - (void)startPlayRing:(NSString *)ringPath { - if (ringPath) { - AVAudioSession *audioSession = [AVAudioSession sharedInstance]; - //默认情况下扬声器播放 - [audioSession setCategory:AVAudioSessionCategoryPlayback error:nil]; - [audioSession setActive:YES error:nil]; - - if (self.audioPlayer) { - [self stopPlayRing]; - } + if (ringPath) { + AVAudioSession *audioSession = [AVAudioSession sharedInstance]; + //默认情况下扬声器播放 + [audioSession setCategory:AVAudioSessionCategoryPlayback error:nil]; + [audioSession setActive:YES error:nil]; + + if (self.audioPlayer) { + [self stopPlayRing]; + } - NSURL *url = [NSURL URLWithString:ringPath]; - NSError *error = nil; - self.audioPlayer = - [[AVAudioPlayer alloc] initWithContentsOfURL:url error:&error]; - if (!error) { - self.audioPlayer.numberOfLoops = -1; - self.audioPlayer.volume = 1.0; - [self.audioPlayer prepareToPlay]; - [self.audioPlayer play]; + NSURL *url = [NSURL URLWithString:ringPath]; + NSError *error = nil; + self.audioPlayer = [[AVAudioPlayer alloc] initWithContentsOfURL:url error:&error]; + if (!error) { + self.audioPlayer.numberOfLoops = -1; + self.audioPlayer.volume = 1.0; + [self.audioPlayer prepareToPlay]; + [self.audioPlayer play]; + } } - } } - (void)stopPlayRing { - if (self.audioPlayer) { - [self.audioPlayer stop]; - self.audioPlayer = nil; - } + if (self.audioPlayer) { + [self.audioPlayer stop]; + self.audioPlayer = nil; + } } - (void)viewDidLoad { - [super viewDidLoad]; - - self.backgroundView = [[UIView alloc] initWithFrame:self.view.bounds]; - self.backgroundView.backgroundColor = RongVoIPUIColorFromRGB(0x262e42); - [self.view addSubview:self.backgroundView]; - self.backgroundView.hidden = NO; - - [[NSNotificationCenter defaultCenter] - addObserver:self - selector:@selector(onOrientationChanged:) - name:UIApplicationDidChangeStatusBarOrientationNotification - object:nil]; - - [self registerTelephonyEvent]; - [self addProximityMonitoringObserver]; - // UIVisualEffect *blurEffect = [UIBlurEffect - // effectWithStyle:UIBlurEffectStyleDark]; - // self.blurView = [[UIVisualEffectView alloc] initWithEffect:blurEffect]; - // self.blurView.frame = self.view.frame; - // [self.view addSubview:self.blurView]; - // self.blurView.hidden = NO; + [super viewDidLoad]; + + self.backgroundView = [[UIView alloc] initWithFrame:self.view.bounds]; + self.backgroundView.backgroundColor = RongVoIPUIColorFromRGB(0x262e42); + [self.view addSubview:self.backgroundView]; + self.backgroundView.hidden = NO; + + [[NSNotificationCenter defaultCenter] addObserver:self + selector:@selector(onOrientationChanged:) + name:UIApplicationDidChangeStatusBarOrientationNotification + object:nil]; + + [self registerTelephonyEvent]; + [self addProximityMonitoringObserver]; + // UIVisualEffect *blurEffect = [UIBlurEffect + // effectWithStyle:UIBlurEffectStyleDark]; + // self.blurView = [[UIVisualEffectView alloc] initWithEffect:blurEffect]; + // self.blurView.frame = self.view.frame; + // [self.view addSubview:self.blurView]; + // self.blurView.hidden = NO; } - (void)onOrientationChanged:(NSNotification *)notification { - [self resetLayout:self.callSession.isMultiCall - mediaType:self.callSession.mediaType - callStatus:self.callSession.callStatus]; + [self resetLayout:self.callSession.isMultiCall + mediaType:self.callSession.mediaType + callStatus:self.callSession.callStatus]; } - (void)viewWillAppear:(BOOL)animated { - [super viewWillAppear:animated]; - - if (self.callSession.callStatus == RCCallActive) { - [self updateActiveTimer]; - [self startActiveTimer]; - } else if (self.callSession.callStatus == RCCallDialing) { - self.tipsLabel.text = NSLocalizedStringFromTable( - @"VoIPCallWaitingForRemoteAccept", @"RongCloudKit", nil); - } else if (self.callSession.callStatus == RCCallIncoming || - self.callSession.callStatus == RCCallRinging) { - [self shouldRingForIncomingCall]; - if (self.callSession.mediaType == RCCallMediaAudio) { - self.tipsLabel.text = NSLocalizedStringFromTable(@"VoIPAudioCallIncoming", - @"RongCloudKit", nil); - } else { - self.tipsLabel.text = NSLocalizedStringFromTable(@"VoIPVideoCallIncoming", - @"RongCloudKit", nil); + [super viewWillAppear:animated]; + + if (self.callSession.callStatus == RCCallActive) { + [self updateActiveTimer]; + [self startActiveTimer]; + } else if (self.callSession.callStatus == RCCallDialing) { + self.tipsLabel.text = NSLocalizedStringFromTable(@"VoIPCallWaitingForRemoteAccept", @"RongCloudKit", nil); + } else if (self.callSession.callStatus == RCCallIncoming || self.callSession.callStatus == RCCallRinging) { + if (self.needPlayingRingAfterForeground) { + [self shouldRingForIncomingCall]; + } + if (self.callSession.mediaType == RCCallMediaAudio) { + self.tipsLabel.text = NSLocalizedStringFromTable(@"VoIPAudioCallIncoming", @"RongCloudKit", nil); + } else { + self.tipsLabel.text = NSLocalizedStringFromTable(@"VoIPVideoCallIncoming", @"RongCloudKit", nil); + } + } else if (self.callSession.callStatus == RCCallHangup) { + [self callDidDisconnect]; } - } else if (self.callSession.callStatus == RCCallHangup) { - [self callDidDisconnect]; - } - [self resetLayout:self.callSession.isMultiCall - mediaType:self.callSession.mediaType - callStatus:self.callSession.callStatus]; + [self resetLayout:self.callSession.isMultiCall + mediaType:self.callSession.mediaType + callStatus:self.callSession.callStatus]; } #pragma mark - Button&&Label&View - (UIButton *)minimizeButton { - if (!_minimizeButton) { - _minimizeButton = [[UIButton alloc] - initWithFrame:CGRectMake(RCCallHorizontalMargin / 2, - RCCallVerticalMargin / 2, RCCallButtonLength, - RCCallButtonLength)]; - [_minimizeButton - setImage:[RCCallKitUtility imageFromVoIPBundle:@"voip/minimize.png"] - forState:UIControlStateNormal]; - [_minimizeButton - setImage:[RCCallKitUtility imageFromVoIPBundle:@"voip/minimize.png"] - forState:UIControlStateHighlighted]; - - [_minimizeButton addTarget:self - action:@selector(minimizeButtonClicked) - forControlEvents:UIControlEventTouchUpInside]; - - [self.view addSubview:_minimizeButton]; - _minimizeButton.hidden = YES; - } - return _minimizeButton; + if (!_minimizeButton) { + _minimizeButton = + [[UIButton alloc] initWithFrame:CGRectMake(RCCallHorizontalMargin / 2, RCCallVerticalMargin / 2, + RCCallButtonLength, RCCallButtonLength)]; + [_minimizeButton setImage:[RCCallKitUtility imageFromVoIPBundle:@"voip/minimize.png"] + forState:UIControlStateNormal]; + [_minimizeButton setImage:[RCCallKitUtility imageFromVoIPBundle:@"voip/minimize.png"] + forState:UIControlStateHighlighted]; + + [_minimizeButton addTarget:self + action:@selector(minimizeButtonClicked) + forControlEvents:UIControlEventTouchUpInside]; + + [self.view addSubview:_minimizeButton]; + _minimizeButton.hidden = YES; + } + return _minimizeButton; } - (void)minimizeButtonClicked { - [self didTapMinimizeButton]; + [self didTapMinimizeButton]; - Class selfClass = [self class]; - [RCCallFloatingBoard - startCallFloatingBoard:self.callSession - withTouchedBlock:^(RCCallSession *callSession) { - [[RCCall sharedRCCall] - presentCallViewController:[[selfClass alloc] initWithActiveCall:callSession]]; - }]; - [self stopActiveTimer]; - [[RCCall sharedRCCall] dismissCallViewController:self]; + Class selfClass = [self class]; + [RCCallFloatingBoard + startCallFloatingBoard:self.callSession + withTouchedBlock:^(RCCallSession *callSession) { + [[RCCall sharedRCCall] presentCallViewController:[[selfClass alloc] initWithActiveCall:callSession]]; + }]; + [self stopActiveTimer]; + [[RCCall sharedRCCall] dismissCallViewController:self]; } - (UIButton *)inviteUserButton { - if (!_inviteUserButton) { - _inviteUserButton = [[UIButton alloc] - initWithFrame:CGRectMake(RCCallHorizontalMargin / 2, - RCCallVerticalMargin / 2, RCCallButtonLength, - RCCallButtonLength)]; - [_inviteUserButton - setImage:[RCCallKitUtility imageFromVoIPBundle:@"voip/add.png"] - forState:UIControlStateNormal]; - [_inviteUserButton - setImage:[RCCallKitUtility imageFromVoIPBundle:@"voip/add.png"] - forState:UIControlStateHighlighted]; - - [_inviteUserButton addTarget:self - action:@selector(inviteUserButtonClicked) - forControlEvents:UIControlEventTouchUpInside]; - - [self.view addSubview:_inviteUserButton]; - _inviteUserButton.hidden = YES; - } - return _inviteUserButton; + if (!_inviteUserButton) { + _inviteUserButton = + [[UIButton alloc] initWithFrame:CGRectMake(RCCallHorizontalMargin / 2, RCCallVerticalMargin / 2, + RCCallButtonLength, RCCallButtonLength)]; + [_inviteUserButton setImage:[RCCallKitUtility imageFromVoIPBundle:@"voip/add.png"] + forState:UIControlStateNormal]; + [_inviteUserButton setImage:[RCCallKitUtility imageFromVoIPBundle:@"voip/add.png"] + forState:UIControlStateHighlighted]; + + [_inviteUserButton addTarget:self + action:@selector(inviteUserButtonClicked) + forControlEvents:UIControlEventTouchUpInside]; + + [self.view addSubview:_inviteUserButton]; + _inviteUserButton.hidden = YES; + } + return _inviteUserButton; } - (void)inviteUserButtonClicked { - [self didTapInviteUserButton]; + [self didTapInviteUserButton]; } - (UILabel *)timeLabel { - if (!_timeLabel) { - _timeLabel = [[UILabel alloc] init]; - _timeLabel.backgroundColor = [UIColor clearColor]; - _timeLabel.textColor = [UIColor whiteColor]; - _timeLabel.font = [UIFont systemFontOfSize:18]; - _timeLabel.textAlignment = NSTextAlignmentCenter; - - [self.view addSubview:_timeLabel]; - _timeLabel.hidden = YES; - } - return _timeLabel; + if (!_timeLabel) { + _timeLabel = [[UILabel alloc] init]; + _timeLabel.backgroundColor = [UIColor clearColor]; + _timeLabel.textColor = [UIColor whiteColor]; + _timeLabel.font = [UIFont systemFontOfSize:18]; + _timeLabel.textAlignment = NSTextAlignmentCenter; + + [self.view addSubview:_timeLabel]; + _timeLabel.hidden = YES; + } + return _timeLabel; } - (void)startActiveTimer { - self.activeTimer = - [NSTimer scheduledTimerWithTimeInterval:1 - target:self - selector:@selector(updateActiveTimer) - userInfo:nil - repeats:YES]; - [self.activeTimer fire]; + self.activeTimer = [NSTimer scheduledTimerWithTimeInterval:1 + target:self + selector:@selector(updateActiveTimer) + userInfo:nil + repeats:YES]; + [self.activeTimer fire]; } - (void)stopActiveTimer { - if (self.activeTimer) { - [self.activeTimer invalidate]; - self.activeTimer = nil; - } + if (self.activeTimer) { + [self.activeTimer invalidate]; + self.activeTimer = nil; + } } - (void)updateActiveTimer { - long sec = [[NSDate date] timeIntervalSince1970] - - self.callSession.connectedTime / 1000; - self.timeLabel.text = [RCCallKitUtility getReadableStringForTime:sec]; + long sec = [[NSDate date] timeIntervalSince1970] - self.callSession.connectedTime / 1000; + self.timeLabel.text = [RCCallKitUtility getReadableStringForTime:sec]; } - (UILabel *)tipsLabel { - if (!_tipsLabel) { - _tipsLabel = [[UILabel alloc] init]; - _tipsLabel.backgroundColor = [UIColor clearColor]; - _tipsLabel.textColor = [UIColor whiteColor]; - _tipsLabel.font = [UIFont systemFontOfSize:18]; - _tipsLabel.textAlignment = NSTextAlignmentCenter; - - [self.view addSubview:_tipsLabel]; - _tipsLabel.hidden = YES; - } - return _tipsLabel; + if (!_tipsLabel) { + _tipsLabel = [[UILabel alloc] init]; + _tipsLabel.backgroundColor = [UIColor clearColor]; + _tipsLabel.textColor = [UIColor whiteColor]; + _tipsLabel.font = [UIFont systemFontOfSize:18]; + _tipsLabel.textAlignment = NSTextAlignmentCenter; + + [self.view addSubview:_tipsLabel]; + _tipsLabel.hidden = YES; + } + return _tipsLabel; } - (UIButton *)muteButton { - if (!_muteButton) { - _muteButton = [[UIButton alloc] init]; - [_muteButton - setImage:[RCCallKitUtility imageFromVoIPBundle:@"voip/mute.png"] - forState:UIControlStateNormal]; - [_muteButton - setImage:[RCCallKitUtility imageFromVoIPBundle:@"voip/mute_hover.png"] - forState:UIControlStateHighlighted]; - [_muteButton - setImage:[RCCallKitUtility imageFromVoIPBundle:@"voip/mute_hover.png"] - forState:UIControlStateSelected]; - [_muteButton setTitle:NSLocalizedStringFromTable(@"VoIPCallMute", - @"RongCloudKit", nil) - forState:UIControlStateNormal]; - [_muteButton setSelected:self.callSession.isMuted]; - [_muteButton addTarget:self - action:@selector(muteButtonClicked) - forControlEvents:UIControlEventTouchUpInside]; - - [self.view addSubview:_muteButton]; - _muteButton.hidden = YES; - } - return _muteButton; + if (!_muteButton) { + _muteButton = [[UIButton alloc] init]; + [_muteButton setImage:[RCCallKitUtility imageFromVoIPBundle:@"voip/mute.png"] forState:UIControlStateNormal]; + [_muteButton setImage:[RCCallKitUtility imageFromVoIPBundle:@"voip/mute_hover.png"] + forState:UIControlStateHighlighted]; + [_muteButton setImage:[RCCallKitUtility imageFromVoIPBundle:@"voip/mute_hover.png"] + forState:UIControlStateSelected]; + [_muteButton setTitle:NSLocalizedStringFromTable(@"VoIPCallMute", @"RongCloudKit", nil) + forState:UIControlStateNormal]; + [_muteButton setSelected:self.callSession.isMuted]; + [_muteButton addTarget:self action:@selector(muteButtonClicked) forControlEvents:UIControlEventTouchUpInside]; + + [self.view addSubview:_muteButton]; + _muteButton.hidden = YES; + } + return _muteButton; } - (void)muteButtonClicked { - [self didTapMuteButton]; + [self didTapMuteButton]; - [self.callSession setMuted:!self.callSession.isMuted]; - [self.muteButton setSelected:self.callSession.isMuted]; + [self.callSession setMuted:!self.callSession.isMuted]; + [self.muteButton setSelected:self.callSession.isMuted]; } - (UIButton *)speakerButton { - if (!_speakerButton) { - _speakerButton = [[UIButton alloc] init]; - [_speakerButton - setImage:[RCCallKitUtility imageFromVoIPBundle:@"voip/handfree.png"] - forState:UIControlStateNormal]; - [_speakerButton setImage:[RCCallKitUtility - imageFromVoIPBundle:@"voip/handfree_hover.png"] - forState:UIControlStateHighlighted]; - [_speakerButton setImage:[RCCallKitUtility - imageFromVoIPBundle:@"voip/handfree_hover.png"] - forState:UIControlStateSelected]; - [_speakerButton setTitle:NSLocalizedStringFromTable(@"VoIPCallSpeaker", - @"RongCloudKit", nil) - forState:UIControlStateNormal]; - [_speakerButton setSelected:self.callSession.speakerEnabled]; - - [_speakerButton addTarget:self - action:@selector(speakerButtonClicked) - forControlEvents:UIControlEventTouchUpInside]; - - [self.view addSubview:_speakerButton]; - _speakerButton.hidden = YES; - } - return _speakerButton; + if (!_speakerButton) { + _speakerButton = [[UIButton alloc] init]; + [_speakerButton setImage:[RCCallKitUtility imageFromVoIPBundle:@"voip/handfree.png"] + forState:UIControlStateNormal]; + [_speakerButton setImage:[RCCallKitUtility imageFromVoIPBundle:@"voip/handfree_hover.png"] + forState:UIControlStateHighlighted]; + [_speakerButton setImage:[RCCallKitUtility imageFromVoIPBundle:@"voip/handfree_hover.png"] + forState:UIControlStateSelected]; + [_speakerButton setTitle:NSLocalizedStringFromTable(@"VoIPCallSpeaker", @"RongCloudKit", nil) + forState:UIControlStateNormal]; + [_speakerButton setSelected:self.callSession.speakerEnabled]; + + [_speakerButton addTarget:self + action:@selector(speakerButtonClicked) + forControlEvents:UIControlEventTouchUpInside]; + + [self.view addSubview:_speakerButton]; + _speakerButton.hidden = YES; + } + return _speakerButton; } - (void)speakerButtonClicked { - [self didTapSpeakerButton]; + [self didTapSpeakerButton]; - [self.callSession setSpeakerEnabled:!self.callSession.speakerEnabled]; - [self.speakerButton setSelected:self.callSession.speakerEnabled]; + [self.callSession setSpeakerEnabled:!self.callSession.speakerEnabled]; + [self.speakerButton setSelected:self.callSession.speakerEnabled]; } - (UIButton *)acceptButton { - if (!_acceptButton) { - _acceptButton = [[UIButton alloc] init]; - [_acceptButton - setImage:[RCCallKitUtility imageFromVoIPBundle:@"voip/answer.png"] - forState:UIControlStateNormal]; - [_acceptButton - setImage:[RCCallKitUtility imageFromVoIPBundle:@"voip/answer_hover.png"] - forState:UIControlStateHighlighted]; - [_acceptButton setTitle:NSLocalizedStringFromTable(@"VoIPCallAccept", - @"RongCloudKit", nil) - forState:UIControlStateNormal]; - - [_acceptButton addTarget:self - action:@selector(acceptButtonClicked) - forControlEvents:UIControlEventTouchUpInside]; - - [self.view addSubview:_acceptButton]; - _acceptButton.hidden = YES; - } - return _acceptButton; + if (!_acceptButton) { + _acceptButton = [[UIButton alloc] init]; + [_acceptButton setImage:[RCCallKitUtility imageFromVoIPBundle:@"voip/answer.png"] + forState:UIControlStateNormal]; + [_acceptButton setImage:[RCCallKitUtility imageFromVoIPBundle:@"voip/answer_hover.png"] + forState:UIControlStateHighlighted]; + [_acceptButton setTitle:NSLocalizedStringFromTable(@"VoIPCallAccept", @"RongCloudKit", nil) + forState:UIControlStateNormal]; + + [_acceptButton addTarget:self + action:@selector(acceptButtonClicked) + forControlEvents:UIControlEventTouchUpInside]; + + [self.view addSubview:_acceptButton]; + _acceptButton.hidden = YES; + } + return _acceptButton; } - (void)acceptButtonClicked { - [self didTapAcceptButton]; + [self didTapAcceptButton]; - if (!self.callSession) { - [self callDidDisconnect]; - } else { - [self.callSession accept:self.callSession.mediaType]; - } + if (!self.callSession) { + [self callDidDisconnect]; + } else { + [self.callSession accept:self.callSession.mediaType]; + } } - (UIButton *)hangupButton { - if (!_hangupButton) { - _hangupButton = [[UIButton alloc] init]; - [_hangupButton - setImage:[RCCallKitUtility imageFromVoIPBundle:@"voip/hang_up.png"] - forState:UIControlStateNormal]; - [_hangupButton setImage:[RCCallKitUtility - imageFromVoIPBundle:@"voip/hang_up_hover.png"] - forState:UIControlStateHighlighted]; - [_hangupButton setTitle:NSLocalizedStringFromTable(@"VoIPCallHangup", - @"RongCloudKit", nil) - forState:UIControlStateNormal]; - - [_hangupButton addTarget:self - action:@selector(hangupButtonClicked) - forControlEvents:UIControlEventTouchUpInside]; - - [self.view addSubview:_hangupButton]; - _hangupButton.hidden = YES; - } - return _hangupButton; + if (!_hangupButton) { + _hangupButton = [[UIButton alloc] init]; + [_hangupButton setImage:[RCCallKitUtility imageFromVoIPBundle:@"voip/hang_up.png"] + forState:UIControlStateNormal]; + [_hangupButton setImage:[RCCallKitUtility imageFromVoIPBundle:@"voip/hang_up_hover.png"] + forState:UIControlStateHighlighted]; + [_hangupButton setTitle:NSLocalizedStringFromTable(@"VoIPCallHangup", @"RongCloudKit", nil) + forState:UIControlStateNormal]; + + [_hangupButton addTarget:self + action:@selector(hangupButtonClicked) + forControlEvents:UIControlEventTouchUpInside]; + + [self.view addSubview:_hangupButton]; + _hangupButton.hidden = YES; + } + return _hangupButton; } - (void)hangupButtonClicked { - [self didTapHangupButton]; + [self didTapHangupButton]; - if (!self.callSession) { - [self callDidDisconnect]; - } else { - [self.callSession hangup]; - } + if (!self.callSession) { + [self callDidDisconnect]; + } else { + [self.callSession hangup]; + } } - (UIButton *)cameraCloseButton { - if (!_cameraCloseButton) { - _cameraCloseButton = [[UIButton alloc] init]; - - if (!self.callSession.isMultiCall) { - [_cameraCloseButton - setImage:[RCCallKitUtility imageFromVoIPBundle:@"voip/audio.png"] - forState:UIControlStateNormal]; - [_cameraCloseButton - setImage:[RCCallKitUtility imageFromVoIPBundle:@"voip/audio.png"] - forState:UIControlStateHighlighted]; - [_cameraCloseButton - setTitle:NSLocalizedStringFromTable(@"VoIPVideoCallTurnToAudioCall", - @"RongCloudKit", nil) - forState:UIControlStateNormal]; - } else { - [_cameraCloseButton - setImage:[RCCallKitUtility imageFromVoIPBundle:@"voip/video.png"] - forState:UIControlStateNormal]; - [_cameraCloseButton - setImage:[RCCallKitUtility imageFromVoIPBundle:@"voip/video.png"] - forState:UIControlStateHighlighted]; - [_cameraCloseButton - setImage:[RCCallKitUtility - imageFromVoIPBundle:@"voip/video_hover.png"] - forState:UIControlStateSelected]; - [_cameraCloseButton - setTitle:NSLocalizedStringFromTable(@"VoIPVideoCallCloseCamera", - @"RongCloudKit", nil) - forState:UIControlStateNormal]; - [_cameraCloseButton - setTitle:NSLocalizedStringFromTable(@"VoIPVideoCallOpenCamera", - @"RongCloudKit", nil) - forState:UIControlStateSelected]; - } + if (!_cameraCloseButton) { + _cameraCloseButton = [[UIButton alloc] init]; + + if (!self.callSession.isMultiCall) { + [_cameraCloseButton setImage:[RCCallKitUtility imageFromVoIPBundle:@"voip/audio.png"] + forState:UIControlStateNormal]; + [_cameraCloseButton setImage:[RCCallKitUtility imageFromVoIPBundle:@"voip/audio.png"] + forState:UIControlStateHighlighted]; + [_cameraCloseButton + setTitle:NSLocalizedStringFromTable(@"VoIPVideoCallTurnToAudioCall", @"RongCloudKit", nil) + forState:UIControlStateNormal]; + } else { + [_cameraCloseButton setImage:[RCCallKitUtility imageFromVoIPBundle:@"voip/video.png"] + forState:UIControlStateNormal]; + [_cameraCloseButton setImage:[RCCallKitUtility imageFromVoIPBundle:@"voip/video.png"] + forState:UIControlStateHighlighted]; + [_cameraCloseButton setImage:[RCCallKitUtility imageFromVoIPBundle:@"voip/video_hover.png"] + forState:UIControlStateSelected]; + [_cameraCloseButton setTitle:NSLocalizedStringFromTable(@"VoIPVideoCallCloseCamera", @"RongCloudKit", nil) + forState:UIControlStateNormal]; + [_cameraCloseButton setTitle:NSLocalizedStringFromTable(@"VoIPVideoCallOpenCamera", @"RongCloudKit", nil) + forState:UIControlStateSelected]; + } - [_cameraCloseButton setSelected:!self.callSession.cameraEnabled]; - [_cameraCloseButton addTarget:self - action:@selector(cameraCloseButtonClicked) - forControlEvents:UIControlEventTouchUpInside]; + [_cameraCloseButton setSelected:!self.callSession.cameraEnabled]; + [_cameraCloseButton addTarget:self + action:@selector(cameraCloseButtonClicked) + forControlEvents:UIControlEventTouchUpInside]; - [self.view addSubview:_cameraCloseButton]; - _cameraCloseButton.hidden = YES; - } - return _cameraCloseButton; + [self.view addSubview:_cameraCloseButton]; + _cameraCloseButton.hidden = YES; + } + return _cameraCloseButton; } - (void)cameraCloseButtonClicked { - [self didTapCameraCloseButton]; + [self didTapCameraCloseButton]; - if (!self.callSession.isMultiCall) { - [self.callSession - setVideoView:nil - userId:[RCIMClient sharedRCIMClient].currentUserInfo.userId]; - [self.callSession setVideoView:nil userId:self.callSession.targetId]; + if (!self.callSession.isMultiCall) { + [self.callSession setVideoView:nil userId:[RCIMClient sharedRCIMClient].currentUserInfo.userId]; + [self.callSession setVideoView:nil userId:self.callSession.targetId]; - if (self.callSession.callStatus == RCCallIncoming || - self.callSession.callStatus == RCCallRinging) { - [self.callSession accept:RCCallMediaAudio]; - } + if (self.callSession.callStatus == RCCallIncoming || self.callSession.callStatus == RCCallRinging) { + [self.callSession accept:RCCallMediaAudio]; + } - if ([self.callSession changeMediaType:RCCallMediaAudio]) { - [self resetLayout:self.callSession.isMultiCall - mediaType:RCCallMediaAudio - callStatus:self.callSession.callStatus]; + if ([self.callSession changeMediaType:RCCallMediaAudio]) { + [self resetLayout:self.callSession.isMultiCall + mediaType:RCCallMediaAudio + callStatus:self.callSession.callStatus]; + } + } else { + [self.callSession setCameraEnabled:!self.callSession.cameraEnabled]; + [self.cameraCloseButton setSelected:!self.callSession.cameraEnabled]; } - } else { - [self.callSession setCameraEnabled:!self.callSession.cameraEnabled]; - [self.cameraCloseButton setSelected:!self.callSession.cameraEnabled]; - } } - (UIButton *)cameraSwitchButton { - if (!_cameraSwitchButton) { - _cameraSwitchButton = [[UIButton alloc] init]; - - if (!self.callSession.isMultiCall) { - [_cameraSwitchButton - setImage:[RCCallKitUtility imageFromVoIPBundle:@"voip/camera.png"] - forState:UIControlStateNormal]; - [_cameraSwitchButton - setImage:[RCCallKitUtility - imageFromVoIPBundle:@"voip/camera_hover.png"] - forState:UIControlStateHighlighted]; - [_cameraSwitchButton - setImage:[RCCallKitUtility - imageFromVoIPBundle:@"voip/camera_hover.png"] - forState:UIControlStateSelected]; - [_cameraSwitchButton - setTitle:NSLocalizedStringFromTable(@"VoIPAudioCallCamera", - @"RongCloudKit", nil) - forState:UIControlStateNormal]; - [_cameraSwitchButton - setTitle:NSLocalizedStringFromTable(@"VoIPAudioCallCamera", - @"RongCloudKit", nil) - forState:UIControlStateSelected]; - } else { - [_cameraSwitchButton - setImage:[RCCallKitUtility imageFromVoIPBundle:@"voip/change.png"] - forState:UIControlStateNormal]; - [_cameraSwitchButton - setImage:[RCCallKitUtility imageFromVoIPBundle:@"voip/change.png"] - forState:UIControlStateHighlighted]; - [_cameraSwitchButton - setImage:[RCCallKitUtility imageFromVoIPBundle:@"voip/change.png"] - forState:UIControlStateSelected]; - } + if (!_cameraSwitchButton) { + _cameraSwitchButton = [[UIButton alloc] init]; + + if (!self.callSession.isMultiCall) { + [_cameraSwitchButton setImage:[RCCallKitUtility imageFromVoIPBundle:@"voip/camera.png"] + forState:UIControlStateNormal]; + [_cameraSwitchButton setImage:[RCCallKitUtility imageFromVoIPBundle:@"voip/camera_hover.png"] + forState:UIControlStateHighlighted]; + [_cameraSwitchButton setImage:[RCCallKitUtility imageFromVoIPBundle:@"voip/camera_hover.png"] + forState:UIControlStateSelected]; + [_cameraSwitchButton setTitle:NSLocalizedStringFromTable(@"VoIPAudioCallCamera", @"RongCloudKit", nil) + forState:UIControlStateNormal]; + [_cameraSwitchButton setTitle:NSLocalizedStringFromTable(@"VoIPAudioCallCamera", @"RongCloudKit", nil) + forState:UIControlStateSelected]; + } else { + [_cameraSwitchButton setImage:[RCCallKitUtility imageFromVoIPBundle:@"voip/change.png"] + forState:UIControlStateNormal]; + [_cameraSwitchButton setImage:[RCCallKitUtility imageFromVoIPBundle:@"voip/change.png"] + forState:UIControlStateHighlighted]; + [_cameraSwitchButton setImage:[RCCallKitUtility imageFromVoIPBundle:@"voip/change.png"] + forState:UIControlStateSelected]; + } - [_cameraSwitchButton addTarget:self - action:@selector(cameraSwitchButtonClicked) - forControlEvents:UIControlEventTouchUpInside]; + [_cameraSwitchButton addTarget:self + action:@selector(cameraSwitchButtonClicked) + forControlEvents:UIControlEventTouchUpInside]; - [self.view addSubview:_cameraSwitchButton]; - _cameraSwitchButton.hidden = YES; - } - return _cameraSwitchButton; + [self.view addSubview:_cameraSwitchButton]; + _cameraSwitchButton.hidden = YES; + } + return _cameraSwitchButton; } - (void)cameraSwitchButtonClicked { - [self didTapCameraSwitchButton]; + [self didTapCameraSwitchButton]; - [self.callSession switchCameraMode]; + [self.callSession switchCameraMode]; } #pragma mark - layout -- (void)resetLayout:(BOOL)isMultiCall - mediaType:(RCCallMediaType)mediaType - callStatus:(RCCallStatus)callStatus { - if (mediaType == RCCallMediaAudio && - !isMultiCall) { - self.backgroundView.backgroundColor = RongVoIPUIColorFromRGB(0x262e42); - self.backgroundView.hidden = NO; - - self.blurView.hidden = NO; +- (void)resetLayout:(BOOL)isMultiCall mediaType:(RCCallMediaType)mediaType callStatus:(RCCallStatus)callStatus { + if (mediaType == RCCallMediaAudio && !isMultiCall) { + self.backgroundView.backgroundColor = RongVoIPUIColorFromRGB(0x262e42); + self.backgroundView.hidden = NO; + + self.blurView.hidden = NO; + + if (callStatus == RCCallActive) { + self.minimizeButton.frame = CGRectMake(RCCallHorizontalMargin / 2, RCCallVerticalMargin, + RCCallButtonLength / 2, RCCallButtonLength / 2); + self.minimizeButton.hidden = NO; + } else if (callStatus != RCCallHangup) { + self.minimizeButton.hidden = YES; + } - if (callStatus == RCCallActive) { - self.minimizeButton.frame = - CGRectMake(RCCallHorizontalMargin / 2, RCCallVerticalMargin, - RCCallButtonLength / 2, RCCallButtonLength / 2); - self.minimizeButton.hidden = NO; - } else if (callStatus != RCCallHangup) { - self.minimizeButton.hidden = YES; - } + self.inviteUserButton.hidden = YES; + + // header orgin y = RCCallVerticalMargin * 3 + if (callStatus == RCCallActive) { + self.timeLabel.frame = + CGRectMake(RCCallHorizontalMargin, + RCCallVerticalMargin * 3 + RCCallHeaderLength + RCCallInsideMargin * 2 + RCCallLabelHeight, + self.view.frame.size.width - RCCallHorizontalMargin * 2, RCCallLabelHeight); + self.timeLabel.hidden = NO; + } else if (callStatus != RCCallHangup) { + self.timeLabel.hidden = YES; + } - self.inviteUserButton.hidden = YES; - - // header orgin y = RCCallVerticalMargin * 3 - if (callStatus == RCCallActive) { - self.timeLabel.frame = - CGRectMake(RCCallHorizontalMargin, - RCCallVerticalMargin * 3 + RCCallHeaderLength + - RCCallInsideMargin * 2 + RCCallLabelHeight, - self.view.frame.size.width - RCCallHorizontalMargin * 2, - RCCallLabelHeight); - self.timeLabel.hidden = NO; - } else if (callStatus != RCCallHangup) { - self.timeLabel.hidden = YES; - } + if (callStatus == RCCallHangup) { + self.tipsLabel.frame = + CGRectMake(RCCallHorizontalMargin, + self.view.frame.size.height - RCCallVerticalMargin - RCCallButtonLength - + RCCallInsideMargin * 3 - RCCallLabelHeight, + self.view.frame.size.width - RCCallHorizontalMargin * 2, RCCallLabelHeight); + } else if (callStatus == RCCallActive) { + self.tipsLabel.frame = CGRectMake( + RCCallHorizontalMargin, + MAX((self.view.frame.size.height - RCCallLabelHeight) / 2, + RCCallVerticalMargin * 3 + RCCallHeaderLength + RCCallInsideMargin * 3 + RCCallLabelHeight * 2), + self.view.frame.size.width - RCCallHorizontalMargin * 2, RCCallLabelHeight); + } else { + self.tipsLabel.frame = + CGRectMake(RCCallHorizontalMargin, + RCCallVerticalMargin * 3 + RCCallHeaderLength + RCCallInsideMargin * 2 + RCCallLabelHeight, + self.view.frame.size.width - RCCallHorizontalMargin * 2, RCCallLabelHeight); + } + self.tipsLabel.hidden = NO; + + if (callStatus == RCCallActive) { + self.muteButton.frame = CGRectMake(RCCallHorizontalMargin, + self.view.frame.size.height - RCCallVerticalMargin - RCCallButtonLength, + RCCallButtonLength, RCCallButtonLength); + [self layoutTextUnderImageButton:self.muteButton]; + self.muteButton.hidden = NO; + } else if (callStatus != RCCallHangup) { + self.muteButton.hidden = YES; + } - if (callStatus == RCCallHangup) { - self.tipsLabel.frame = CGRectMake( - RCCallHorizontalMargin, - self.view.frame.size.height - RCCallVerticalMargin - - RCCallButtonLength - RCCallInsideMargin * 3 - RCCallLabelHeight, - self.view.frame.size.width - RCCallHorizontalMargin * 2, - RCCallLabelHeight); - } else if (callStatus == RCCallActive) { - self.tipsLabel.frame = - CGRectMake(RCCallHorizontalMargin, - MAX((self.view.frame.size.height - RCCallLabelHeight) / 2, - RCCallVerticalMargin * 3 + RCCallHeaderLength + - RCCallInsideMargin * 3 + RCCallLabelHeight * 2), - self.view.frame.size.width - RCCallHorizontalMargin * 2, - RCCallLabelHeight); - } else { - self.tipsLabel.frame = - CGRectMake(RCCallHorizontalMargin, - RCCallVerticalMargin * 3 + RCCallHeaderLength + - RCCallInsideMargin * 2 + RCCallLabelHeight, - self.view.frame.size.width - RCCallHorizontalMargin * 2, - RCCallLabelHeight); - } - self.tipsLabel.hidden = NO; - - if (callStatus == RCCallActive) { - self.muteButton.frame = CGRectMake( - RCCallHorizontalMargin, self.view.frame.size.height - - RCCallVerticalMargin - RCCallButtonLength, - RCCallButtonLength, RCCallButtonLength); - [self layoutTextUnderImageButton:self.muteButton]; - self.muteButton.hidden = NO; - } else if (callStatus != RCCallHangup) { - self.muteButton.hidden = YES; - } + if (callStatus == RCCallActive) { + self.speakerButton.frame = + CGRectMake(self.view.frame.size.width - RCCallHorizontalMargin - RCCallButtonLength, + self.view.frame.size.height - RCCallVerticalMargin - RCCallButtonLength, RCCallButtonLength, + RCCallButtonLength); + [self layoutTextUnderImageButton:self.speakerButton]; + self.speakerButton.hidden = NO; + } else if (callStatus != RCCallHangup) { + self.speakerButton.hidden = YES; + } - if (callStatus == RCCallActive) { - self.speakerButton.frame = - CGRectMake(self.view.frame.size.width - RCCallHorizontalMargin - - RCCallButtonLength, - self.view.frame.size.height - RCCallVerticalMargin - - RCCallButtonLength, - RCCallButtonLength, RCCallButtonLength); - [self layoutTextUnderImageButton:self.speakerButton]; - self.speakerButton.hidden = NO; - } else if (callStatus != RCCallHangup) { - self.speakerButton.hidden = YES; - } + if (callStatus == RCCallDialing) { + self.hangupButton.frame = + CGRectMake((self.view.frame.size.width - RCCallButtonLength) / 2, + self.view.frame.size.height - RCCallVerticalMargin - RCCallButtonLength, RCCallButtonLength, + RCCallButtonLength); + [self layoutTextUnderImageButton:self.hangupButton]; + self.hangupButton.hidden = NO; + + self.acceptButton.hidden = YES; + } else if (callStatus == RCCallIncoming || callStatus == RCCallRinging) { + self.hangupButton.frame = CGRectMake( + RCCallHorizontalMargin, self.view.frame.size.height - RCCallVerticalMargin - RCCallButtonLength, + RCCallButtonLength, RCCallButtonLength); + [self layoutTextUnderImageButton:self.hangupButton]; + self.hangupButton.hidden = NO; + + self.acceptButton.frame = + CGRectMake(self.view.frame.size.width - RCCallHorizontalMargin - RCCallButtonLength, + self.view.frame.size.height - RCCallVerticalMargin - RCCallButtonLength, RCCallButtonLength, + RCCallButtonLength); + [self layoutTextUnderImageButton:self.acceptButton]; + self.acceptButton.hidden = NO; + } else if (callStatus == RCCallActive) { + self.hangupButton.frame = + CGRectMake((self.view.frame.size.width - RCCallButtonLength) / 2, + self.view.frame.size.height - RCCallVerticalMargin - RCCallButtonLength, RCCallButtonLength, + RCCallButtonLength); + [self layoutTextUnderImageButton:self.hangupButton]; + self.hangupButton.hidden = NO; + + self.acceptButton.hidden = YES; + } - if (callStatus == RCCallDialing) { - self.hangupButton.frame = - CGRectMake((self.view.frame.size.width - RCCallButtonLength) / 2, - self.view.frame.size.height - RCCallVerticalMargin - - RCCallButtonLength, - RCCallButtonLength, RCCallButtonLength); - [self layoutTextUnderImageButton:self.hangupButton]; - self.hangupButton.hidden = NO; - - self.acceptButton.hidden = YES; - } else if (callStatus == RCCallIncoming || callStatus == RCCallRinging) { - self.hangupButton.frame = CGRectMake( - RCCallHorizontalMargin, self.view.frame.size.height - - RCCallVerticalMargin - RCCallButtonLength, - RCCallButtonLength, RCCallButtonLength); - [self layoutTextUnderImageButton:self.hangupButton]; - self.hangupButton.hidden = NO; - - self.acceptButton.frame = - CGRectMake(self.view.frame.size.width - RCCallHorizontalMargin - - RCCallButtonLength, - self.view.frame.size.height - RCCallVerticalMargin - - RCCallButtonLength, - RCCallButtonLength, RCCallButtonLength); - [self layoutTextUnderImageButton:self.acceptButton]; - self.acceptButton.hidden = NO; - } else if (callStatus == RCCallActive) { - self.hangupButton.frame = - CGRectMake((self.view.frame.size.width - RCCallButtonLength) / 2, - self.view.frame.size.height - RCCallVerticalMargin - - RCCallButtonLength, - RCCallButtonLength, RCCallButtonLength); - [self layoutTextUnderImageButton:self.hangupButton]; - self.hangupButton.hidden = NO; - - self.acceptButton.hidden = YES; - } + self.cameraCloseButton.hidden = YES; + self.cameraSwitchButton.hidden = YES; - self.cameraCloseButton.hidden = YES; - self.cameraSwitchButton.hidden = YES; + } else if (mediaType == RCCallMediaVideo && !isMultiCall) { + self.backgroundView.hidden = NO; - } else if (mediaType == RCCallMediaVideo && - !isMultiCall) { - self.backgroundView.hidden = NO; + self.blurView.hidden = YES; - self.blurView.hidden = YES; + if (callStatus == RCCallActive) { + self.minimizeButton.frame = CGRectMake(RCCallHorizontalMargin / 2, RCCallVerticalMargin, + RCCallButtonLength / 2, RCCallButtonLength / 2); + self.minimizeButton.hidden = NO; + } else if (callStatus != RCCallHangup) { + self.minimizeButton.hidden = YES; + } - if (callStatus == RCCallActive) { - self.minimizeButton.frame = - CGRectMake(RCCallHorizontalMargin / 2, RCCallVerticalMargin, - RCCallButtonLength / 2, RCCallButtonLength / 2); - self.minimizeButton.hidden = NO; - } else if (callStatus != RCCallHangup) { - self.minimizeButton.hidden = YES; - } + self.inviteUserButton.hidden = YES; - self.inviteUserButton.hidden = YES; - - if (callStatus == RCCallActive) { - self.timeLabel.frame = CGRectMake( - RCCallHorizontalMargin, - RCCallVerticalMargin + RCCallInsideMargin + RCCallLabelHeight, - self.view.frame.size.width - RCCallHorizontalMargin * 2, - RCCallLabelHeight); - self.timeLabel.hidden = NO; - } else if (callStatus != RCCallHangup) { - self.timeLabel.hidden = YES; - } + if (callStatus == RCCallActive) { + self.timeLabel.frame = + CGRectMake(RCCallHorizontalMargin, RCCallVerticalMargin + RCCallInsideMargin + RCCallLabelHeight, + self.view.frame.size.width - RCCallHorizontalMargin * 2, RCCallLabelHeight); + self.timeLabel.hidden = NO; + } else if (callStatus != RCCallHangup) { + self.timeLabel.hidden = YES; + } - // header orgin y = RCCallVerticalMargin * 3 - if (callStatus == RCCallActive) { - self.tipsLabel.frame = - CGRectMake(RCCallHorizontalMargin, - MAX((self.view.frame.size.height - RCCallLabelHeight) / 2, - RCCallVerticalMargin + RCCallHeaderLength * 1.5 + - RCCallInsideMargin * 3), - self.view.frame.size.width - RCCallHorizontalMargin * 2, - RCCallLabelHeight); - } else if (callStatus == RCCallDialing) { - self.tipsLabel.frame = - CGRectMake(RCCallHorizontalMargin, - RCCallVerticalMargin * 3 + RCCallHeaderLength + - RCCallInsideMargin * 2 + RCCallLabelHeight, - self.view.frame.size.width - RCCallHorizontalMargin * 2, - RCCallLabelHeight); - } else if (callStatus == RCCallIncoming || callStatus == RCCallRinging) { - self.tipsLabel.frame = - CGRectMake(RCCallHorizontalMargin, - RCCallVerticalMargin * 3 + RCCallHeaderLength + - RCCallInsideMargin * 2 + RCCallLabelHeight, - self.view.frame.size.width - RCCallHorizontalMargin * 2, - RCCallLabelHeight); - } else if (callStatus == RCCallHangup) { - self.tipsLabel.frame = - CGRectMake(RCCallHorizontalMargin, - self.view.frame.size.height - RCCallVerticalMargin - - RCCallButtonLength * 2 - RCCallInsideMargin * 8, - self.view.frame.size.width - RCCallHorizontalMargin * 2, - RCCallLabelHeight); - } - self.tipsLabel.hidden = NO; - - if (callStatus == RCCallActive) { - self.muteButton.frame = CGRectMake( - RCCallHorizontalMargin, self.view.frame.size.height - - RCCallVerticalMargin - RCCallButtonLength, - RCCallButtonLength, RCCallButtonLength); - [self layoutTextUnderImageButton:self.muteButton]; - self.muteButton.hidden = NO; - } else if (callStatus != RCCallHangup) { - self.muteButton.hidden = YES; - } + // header orgin y = RCCallVerticalMargin * 3 + if (callStatus == RCCallActive) { + self.tipsLabel.frame = + CGRectMake(RCCallHorizontalMargin, + MAX((self.view.frame.size.height - RCCallLabelHeight) / 2, + RCCallVerticalMargin + RCCallHeaderLength * 1.5 + RCCallInsideMargin * 3), + self.view.frame.size.width - RCCallHorizontalMargin * 2, RCCallLabelHeight); + } else if (callStatus == RCCallDialing) { + self.tipsLabel.frame = + CGRectMake(RCCallHorizontalMargin, + RCCallVerticalMargin * 3 + RCCallHeaderLength + RCCallInsideMargin * 2 + RCCallLabelHeight, + self.view.frame.size.width - RCCallHorizontalMargin * 2, RCCallLabelHeight); + } else if (callStatus == RCCallIncoming || callStatus == RCCallRinging) { + self.tipsLabel.frame = + CGRectMake(RCCallHorizontalMargin, + RCCallVerticalMargin * 3 + RCCallHeaderLength + RCCallInsideMargin * 2 + RCCallLabelHeight, + self.view.frame.size.width - RCCallHorizontalMargin * 2, RCCallLabelHeight); + } else if (callStatus == RCCallHangup) { + self.tipsLabel.frame = CGRectMake( + RCCallHorizontalMargin, + self.view.frame.size.height - RCCallVerticalMargin - RCCallButtonLength * 2 - RCCallInsideMargin * 8, + self.view.frame.size.width - RCCallHorizontalMargin * 2, RCCallLabelHeight); + } + self.tipsLabel.hidden = NO; + + if (callStatus == RCCallActive) { + self.muteButton.frame = CGRectMake(RCCallHorizontalMargin, + self.view.frame.size.height - RCCallVerticalMargin - RCCallButtonLength, + RCCallButtonLength, RCCallButtonLength); + [self layoutTextUnderImageButton:self.muteButton]; + self.muteButton.hidden = NO; + } else if (callStatus != RCCallHangup) { + self.muteButton.hidden = YES; + } - self.speakerButton.hidden = YES; - - if (callStatus == RCCallDialing) { - self.hangupButton.frame = - CGRectMake((self.view.frame.size.width - RCCallButtonLength) / 2, - self.view.frame.size.height - RCCallVerticalMargin - - RCCallButtonLength, - RCCallButtonLength, RCCallButtonLength); - [self layoutTextUnderImageButton:self.hangupButton]; - self.hangupButton.hidden = NO; - - self.acceptButton.hidden = YES; - } else if (callStatus == RCCallIncoming || callStatus == RCCallRinging) { - self.hangupButton.frame = CGRectMake( - RCCallHorizontalMargin, self.view.frame.size.height - - RCCallVerticalMargin - RCCallButtonLength, - RCCallButtonLength, RCCallButtonLength); - [self layoutTextUnderImageButton:self.hangupButton]; - self.hangupButton.hidden = NO; - - self.acceptButton.frame = - CGRectMake(self.view.frame.size.width - RCCallHorizontalMargin - - RCCallButtonLength, - self.view.frame.size.height - RCCallVerticalMargin - - RCCallButtonLength, - RCCallButtonLength, RCCallButtonLength); - [self layoutTextUnderImageButton:self.acceptButton]; - self.acceptButton.hidden = NO; - } else if (callStatus == RCCallActive) { - self.hangupButton.frame = - CGRectMake((self.view.frame.size.width - RCCallButtonLength) / 2, - self.view.frame.size.height - RCCallVerticalMargin - - RCCallButtonLength, - RCCallButtonLength, RCCallButtonLength); - [self layoutTextUnderImageButton:self.hangupButton]; - self.hangupButton.hidden = NO; - - self.acceptButton.hidden = YES; - } + self.speakerButton.hidden = YES; + + if (callStatus == RCCallDialing) { + self.hangupButton.frame = + CGRectMake((self.view.frame.size.width - RCCallButtonLength) / 2, + self.view.frame.size.height - RCCallVerticalMargin - RCCallButtonLength, RCCallButtonLength, + RCCallButtonLength); + [self layoutTextUnderImageButton:self.hangupButton]; + self.hangupButton.hidden = NO; + + self.acceptButton.hidden = YES; + } else if (callStatus == RCCallIncoming || callStatus == RCCallRinging) { + self.hangupButton.frame = CGRectMake( + RCCallHorizontalMargin, self.view.frame.size.height - RCCallVerticalMargin - RCCallButtonLength, + RCCallButtonLength, RCCallButtonLength); + [self layoutTextUnderImageButton:self.hangupButton]; + self.hangupButton.hidden = NO; + + self.acceptButton.frame = + CGRectMake(self.view.frame.size.width - RCCallHorizontalMargin - RCCallButtonLength, + self.view.frame.size.height - RCCallVerticalMargin - RCCallButtonLength, RCCallButtonLength, + RCCallButtonLength); + [self layoutTextUnderImageButton:self.acceptButton]; + self.acceptButton.hidden = NO; + } else if (callStatus == RCCallActive) { + self.hangupButton.frame = + CGRectMake((self.view.frame.size.width - RCCallButtonLength) / 2, + self.view.frame.size.height - RCCallVerticalMargin - RCCallButtonLength, RCCallButtonLength, + RCCallButtonLength); + [self layoutTextUnderImageButton:self.hangupButton]; + self.hangupButton.hidden = NO; + + self.acceptButton.hidden = YES; + } - if (callStatus == RCCallActive) { - self.cameraSwitchButton.frame = - CGRectMake(self.view.frame.size.width - RCCallHorizontalMargin - - RCCallButtonLength, - self.view.frame.size.height - RCCallVerticalMargin - - RCCallButtonLength, - RCCallButtonLength, RCCallButtonLength); - [self layoutTextUnderImageButton:self.cameraSwitchButton]; - self.cameraSwitchButton.hidden = NO; - } else if (callStatus != RCCallHangup) { - self.cameraSwitchButton.hidden = YES; - } + if (callStatus == RCCallActive) { + self.cameraSwitchButton.frame = + CGRectMake(self.view.frame.size.width - RCCallHorizontalMargin - RCCallButtonLength, + self.view.frame.size.height - RCCallVerticalMargin - RCCallButtonLength, RCCallButtonLength, + RCCallButtonLength); + [self layoutTextUnderImageButton:self.cameraSwitchButton]; + self.cameraSwitchButton.hidden = NO; + } else if (callStatus != RCCallHangup) { + self.cameraSwitchButton.hidden = YES; + } - if (callStatus == RCCallActive) { - self.cameraCloseButton.frame = - CGRectMake(self.view.frame.size.width - RCCallHorizontalMargin - - RCCallButtonLength, - self.view.frame.size.height - RCCallVerticalMargin - - RCCallButtonLength * 2 - RCCallInsideMargin * 5, - RCCallButtonLength, RCCallButtonLength); - [self layoutTextUnderImageButton:self.cameraCloseButton]; - self.cameraCloseButton.hidden = NO; - } else if (callStatus != RCCallHangup) { - self.cameraCloseButton.hidden = YES; - } + if (callStatus == RCCallActive) { + self.cameraCloseButton.frame = CGRectMake( + self.view.frame.size.width - RCCallHorizontalMargin - RCCallButtonLength, + self.view.frame.size.height - RCCallVerticalMargin - RCCallButtonLength * 2 - RCCallInsideMargin * 5, + RCCallButtonLength, RCCallButtonLength); + [self layoutTextUnderImageButton:self.cameraCloseButton]; + self.cameraCloseButton.hidden = NO; + } else if (callStatus != RCCallHangup) { + self.cameraCloseButton.hidden = YES; + } - } else if (mediaType == RCCallMediaAudio && - isMultiCall) { - self.backgroundView.backgroundColor = RongVoIPUIColorFromRGB(0x262e42); - self.backgroundView.hidden = NO; + } else if (mediaType == RCCallMediaAudio && isMultiCall) { + self.backgroundView.backgroundColor = RongVoIPUIColorFromRGB(0x262e42); + self.backgroundView.hidden = NO; - self.blurView.hidden = NO; + self.blurView.hidden = NO; - if (callStatus == RCCallActive) { - self.minimizeButton.frame = - CGRectMake(RCCallHorizontalMargin / 2, RCCallVerticalMargin, - RCCallButtonLength / 2, RCCallButtonLength / 2); - self.minimizeButton.hidden = NO; - } else if (callStatus != RCCallHangup) { - self.minimizeButton.hidden = YES; - } + if (callStatus == RCCallActive) { + self.minimizeButton.frame = CGRectMake(RCCallHorizontalMargin / 2, RCCallVerticalMargin, + RCCallButtonLength / 2, RCCallButtonLength / 2); + self.minimizeButton.hidden = NO; + } else if (callStatus != RCCallHangup) { + self.minimizeButton.hidden = YES; + } - if (callStatus == RCCallActive) { - self.inviteUserButton.frame = CGRectMake( - self.view.frame.size.width - RCCallHorizontalMargin / 2 - - RCCallButtonLength / 2, - RCCallVerticalMargin, RCCallButtonLength / 2, RCCallButtonLength / 2); - self.inviteUserButton.hidden = NO; - } else if (callStatus != RCCallHangup) { - self.inviteUserButton.hidden = YES; - } + if (callStatus == RCCallActive) { + self.inviteUserButton.frame = + CGRectMake(self.view.frame.size.width - RCCallHorizontalMargin / 2 - RCCallButtonLength / 2, + RCCallVerticalMargin, RCCallButtonLength / 2, RCCallButtonLength / 2); + self.inviteUserButton.hidden = NO; + } else if (callStatus != RCCallHangup) { + self.inviteUserButton.hidden = YES; + } - if (callStatus == RCCallActive) { - self.timeLabel.frame = - CGRectMake(RCCallHorizontalMargin, RCCallVerticalMargin, - self.view.frame.size.width - RCCallHorizontalMargin * 2, - RCCallLabelHeight); - self.timeLabel.hidden = NO; - } else if (callStatus != RCCallHangup) { - self.timeLabel.hidden = YES; - } + if (callStatus == RCCallActive) { + self.timeLabel.frame = + CGRectMake(RCCallHorizontalMargin, RCCallVerticalMargin, + self.view.frame.size.width - RCCallHorizontalMargin * 2, RCCallLabelHeight); + self.timeLabel.hidden = NO; + } else if (callStatus != RCCallHangup) { + self.timeLabel.hidden = YES; + } - // header orgin y = RCCallVerticalMargin * 2 - if (callStatus == RCCallIncoming || callStatus == RCCallRinging) { - self.tipsLabel.frame = - CGRectMake(RCCallHorizontalMargin, - RCCallVerticalMargin * 2 + RCCallHeaderLength + - RCCallInsideMargin * 2 + RCCallLabelHeight, - self.view.frame.size.width - RCCallHorizontalMargin * 2, - RCCallLabelHeight); - } else if (callStatus == RCCallDialing) { - self.tipsLabel.frame = - CGRectMake(RCCallHorizontalMargin, RCCallVerticalMargin, - self.view.frame.size.width - RCCallHorizontalMargin * 2, - RCCallLabelHeight); - } else { - self.tipsLabel.frame = CGRectMake( - RCCallHorizontalMargin, - self.view.frame.size.height - RCCallVerticalMargin - - RCCallButtonLength - RCCallInsideMargin * 3 - RCCallLabelHeight, - self.view.frame.size.width - RCCallHorizontalMargin * 2, - RCCallLabelHeight); - } - self.tipsLabel.hidden = NO; - - if (callStatus == RCCallActive) { - self.muteButton.frame = CGRectMake( - RCCallHorizontalMargin, self.view.frame.size.height - - RCCallVerticalMargin - RCCallButtonLength, - RCCallButtonLength, RCCallButtonLength); - [self layoutTextUnderImageButton:self.muteButton]; - self.muteButton.hidden = NO; - } else if (callStatus != RCCallHangup) { - self.muteButton.hidden = YES; - } + // header orgin y = RCCallVerticalMargin * 2 + if (callStatus == RCCallIncoming || callStatus == RCCallRinging) { + self.tipsLabel.frame = + CGRectMake(RCCallHorizontalMargin, + RCCallVerticalMargin * 2 + RCCallHeaderLength + RCCallInsideMargin * 2 + RCCallLabelHeight, + self.view.frame.size.width - RCCallHorizontalMargin * 2, RCCallLabelHeight); + } else if (callStatus == RCCallDialing) { + self.tipsLabel.frame = + CGRectMake(RCCallHorizontalMargin, RCCallVerticalMargin, + self.view.frame.size.width - RCCallHorizontalMargin * 2, RCCallLabelHeight); + } else { + self.tipsLabel.frame = + CGRectMake(RCCallHorizontalMargin, + self.view.frame.size.height - RCCallVerticalMargin - RCCallButtonLength - + RCCallInsideMargin * 3 - RCCallLabelHeight, + self.view.frame.size.width - RCCallHorizontalMargin * 2, RCCallLabelHeight); + } + self.tipsLabel.hidden = NO; + + if (callStatus == RCCallActive) { + self.muteButton.frame = CGRectMake(RCCallHorizontalMargin, + self.view.frame.size.height - RCCallVerticalMargin - RCCallButtonLength, + RCCallButtonLength, RCCallButtonLength); + [self layoutTextUnderImageButton:self.muteButton]; + self.muteButton.hidden = NO; + } else if (callStatus != RCCallHangup) { + self.muteButton.hidden = YES; + } - if (callStatus == RCCallActive) { - self.speakerButton.frame = - CGRectMake(self.view.frame.size.width - RCCallHorizontalMargin - - RCCallButtonLength, - self.view.frame.size.height - RCCallVerticalMargin - - RCCallButtonLength, - RCCallButtonLength, RCCallButtonLength); - [self layoutTextUnderImageButton:self.speakerButton]; - self.speakerButton.hidden = NO; - } else if (callStatus != RCCallHangup) { - self.speakerButton.hidden = YES; - } + if (callStatus == RCCallActive) { + self.speakerButton.frame = + CGRectMake(self.view.frame.size.width - RCCallHorizontalMargin - RCCallButtonLength, + self.view.frame.size.height - RCCallVerticalMargin - RCCallButtonLength, RCCallButtonLength, + RCCallButtonLength); + [self layoutTextUnderImageButton:self.speakerButton]; + self.speakerButton.hidden = NO; + } else if (callStatus != RCCallHangup) { + self.speakerButton.hidden = YES; + } - if (callStatus == RCCallDialing) { - self.hangupButton.frame = - CGRectMake((self.view.frame.size.width - RCCallButtonLength) / 2, - self.view.frame.size.height - RCCallVerticalMargin - - RCCallButtonLength, - RCCallButtonLength, RCCallButtonLength); - [self layoutTextUnderImageButton:self.hangupButton]; - self.hangupButton.hidden = NO; - - self.acceptButton.hidden = YES; - } else if (callStatus == RCCallIncoming || callStatus == RCCallRinging) { - self.hangupButton.frame = CGRectMake( - RCCallHorizontalMargin, self.view.frame.size.height - - RCCallVerticalMargin - RCCallButtonLength, - RCCallButtonLength, RCCallButtonLength); - [self layoutTextUnderImageButton:self.hangupButton]; - self.hangupButton.hidden = NO; - - self.acceptButton.frame = - CGRectMake(self.view.frame.size.width - RCCallHorizontalMargin - - RCCallButtonLength, - self.view.frame.size.height - RCCallVerticalMargin - - RCCallButtonLength, - RCCallButtonLength, RCCallButtonLength); - [self layoutTextUnderImageButton:self.acceptButton]; - self.acceptButton.hidden = NO; - } else if (callStatus == RCCallActive) { - self.hangupButton.frame = - CGRectMake((self.view.frame.size.width - RCCallButtonLength) / 2, - self.view.frame.size.height - RCCallVerticalMargin - - RCCallButtonLength, - RCCallButtonLength, RCCallButtonLength); - [self layoutTextUnderImageButton:self.hangupButton]; - self.hangupButton.hidden = NO; - - self.acceptButton.hidden = YES; - } + if (callStatus == RCCallDialing) { + self.hangupButton.frame = + CGRectMake((self.view.frame.size.width - RCCallButtonLength) / 2, + self.view.frame.size.height - RCCallVerticalMargin - RCCallButtonLength, RCCallButtonLength, + RCCallButtonLength); + [self layoutTextUnderImageButton:self.hangupButton]; + self.hangupButton.hidden = NO; + + self.acceptButton.hidden = YES; + } else if (callStatus == RCCallIncoming || callStatus == RCCallRinging) { + self.hangupButton.frame = CGRectMake( + RCCallHorizontalMargin, self.view.frame.size.height - RCCallVerticalMargin - RCCallButtonLength, + RCCallButtonLength, RCCallButtonLength); + [self layoutTextUnderImageButton:self.hangupButton]; + self.hangupButton.hidden = NO; + + self.acceptButton.frame = + CGRectMake(self.view.frame.size.width - RCCallHorizontalMargin - RCCallButtonLength, + self.view.frame.size.height - RCCallVerticalMargin - RCCallButtonLength, RCCallButtonLength, + RCCallButtonLength); + [self layoutTextUnderImageButton:self.acceptButton]; + self.acceptButton.hidden = NO; + } else if (callStatus == RCCallActive) { + self.hangupButton.frame = + CGRectMake((self.view.frame.size.width - RCCallButtonLength) / 2, + self.view.frame.size.height - RCCallVerticalMargin - RCCallButtonLength, RCCallButtonLength, + RCCallButtonLength); + [self layoutTextUnderImageButton:self.hangupButton]; + self.hangupButton.hidden = NO; + + self.acceptButton.hidden = YES; + } - self.cameraCloseButton.hidden = YES; - self.cameraSwitchButton.hidden = YES; + self.cameraCloseButton.hidden = YES; + self.cameraSwitchButton.hidden = YES; - } else if (mediaType == RCCallMediaVideo && - isMultiCall) { - self.backgroundView.hidden = NO; + } else if (mediaType == RCCallMediaVideo && isMultiCall) { + self.backgroundView.hidden = NO; - self.blurView.hidden = YES; + self.blurView.hidden = YES; - if (callStatus == RCCallActive) { - self.minimizeButton.frame = - CGRectMake(RCCallHorizontalMargin / 2, RCCallVerticalMargin, - RCCallButtonLength / 2, RCCallButtonLength / 2); - self.minimizeButton.hidden = NO; - } else if (callStatus != RCCallHangup) { - self.minimizeButton.hidden = YES; - } + if (callStatus == RCCallActive) { + self.minimizeButton.frame = CGRectMake(RCCallHorizontalMargin / 2, RCCallVerticalMargin, + RCCallButtonLength / 2, RCCallButtonLength / 2); + self.minimizeButton.hidden = NO; + } else if (callStatus != RCCallHangup) { + self.minimizeButton.hidden = YES; + } - if (callStatus == RCCallActive) { - self.cameraSwitchButton.frame = CGRectMake( - self.view.frame.size.width - RCCallHorizontalMargin / 2 - - RCCallButtonLength - RCCallInsideMargin, - RCCallVerticalMargin, RCCallButtonLength / 2, RCCallButtonLength / 2); - self.cameraSwitchButton.hidden = NO; - } else if (callStatus != RCCallHangup) { - self.cameraSwitchButton.hidden = YES; - } + if (callStatus == RCCallActive) { + self.cameraSwitchButton.frame = CGRectMake( + self.view.frame.size.width - RCCallHorizontalMargin / 2 - RCCallButtonLength - RCCallInsideMargin, + RCCallVerticalMargin, RCCallButtonLength / 2, RCCallButtonLength / 2); + self.cameraSwitchButton.hidden = NO; + } else if (callStatus != RCCallHangup) { + self.cameraSwitchButton.hidden = YES; + } - if (callStatus == RCCallActive) { - self.inviteUserButton.frame = CGRectMake( - self.view.frame.size.width - RCCallHorizontalMargin / 2 - - RCCallButtonLength / 2, - RCCallVerticalMargin, RCCallButtonLength / 2, RCCallButtonLength / 2); - self.inviteUserButton.hidden = NO; - } else if (callStatus != RCCallHangup) { - self.inviteUserButton.hidden = YES; - } + if (callStatus == RCCallActive) { + self.inviteUserButton.frame = + CGRectMake(self.view.frame.size.width - RCCallHorizontalMargin / 2 - RCCallButtonLength / 2, + RCCallVerticalMargin, RCCallButtonLength / 2, RCCallButtonLength / 2); + self.inviteUserButton.hidden = NO; + } else if (callStatus != RCCallHangup) { + self.inviteUserButton.hidden = YES; + } - if (callStatus == RCCallActive) { - self.timeLabel.frame = CGRectMake( - RCCallHorizontalMargin, - RCCallVerticalMargin + RCCallInsideMargin + RCCallLabelHeight, - self.view.frame.size.width - RCCallHorizontalMargin * 2, - RCCallLabelHeight); - self.timeLabel.hidden = NO; - } else if (callStatus != RCCallHangup) { - self.timeLabel.hidden = YES; - } + if (callStatus == RCCallActive) { + self.timeLabel.frame = + CGRectMake(RCCallHorizontalMargin, RCCallVerticalMargin + RCCallInsideMargin + RCCallLabelHeight, + self.view.frame.size.width - RCCallHorizontalMargin * 2, RCCallLabelHeight); + self.timeLabel.hidden = NO; + } else if (callStatus != RCCallHangup) { + self.timeLabel.hidden = YES; + } - if (callStatus == RCCallIncoming || callStatus == RCCallRinging) { - self.tipsLabel.frame = - CGRectMake(RCCallHorizontalMargin, - RCCallVerticalMargin * 2 + RCCallHeaderLength + - RCCallInsideMargin * 2 + RCCallLabelHeight, - self.view.frame.size.width - RCCallHorizontalMargin * 2, - RCCallLabelHeight); - } else if (callStatus == RCCallDialing) { - self.tipsLabel.frame = - CGRectMake(RCCallHorizontalMargin, RCCallVerticalMargin, - self.view.frame.size.width - RCCallHorizontalMargin * 2, - RCCallLabelHeight); - } else { - self.tipsLabel.frame = - CGRectMake(RCCallHorizontalMargin, - self.view.frame.size.height - RCCallVerticalMargin - - RCCallButtonLength * 3.5 - RCCallInsideMargin * 5 - - RCCallLabelHeight, - self.view.frame.size.width - RCCallHorizontalMargin * 2, - RCCallLabelHeight); - } - self.tipsLabel.hidden = NO; - - if (callStatus == RCCallActive) { - self.muteButton.frame = CGRectMake( - RCCallHorizontalMargin, self.view.frame.size.height - - RCCallVerticalMargin - RCCallButtonLength, - RCCallButtonLength, RCCallButtonLength); - [self layoutTextUnderImageButton:self.muteButton]; - self.muteButton.hidden = NO; - } else if (callStatus != RCCallHangup) { - self.muteButton.hidden = YES; - } + if (callStatus == RCCallIncoming || callStatus == RCCallRinging) { + self.tipsLabel.frame = + CGRectMake(RCCallHorizontalMargin, + RCCallVerticalMargin * 2 + RCCallHeaderLength + RCCallInsideMargin * 2 + RCCallLabelHeight, + self.view.frame.size.width - RCCallHorizontalMargin * 2, RCCallLabelHeight); + } else if (callStatus == RCCallDialing) { + self.tipsLabel.frame = + CGRectMake(RCCallHorizontalMargin, RCCallVerticalMargin, + self.view.frame.size.width - RCCallHorizontalMargin * 2, RCCallLabelHeight); + } else { + self.tipsLabel.frame = + CGRectMake(RCCallHorizontalMargin, + self.view.frame.size.height - RCCallVerticalMargin - RCCallButtonLength * 3.5 - + RCCallInsideMargin * 5 - RCCallLabelHeight, + self.view.frame.size.width - RCCallHorizontalMargin * 2, RCCallLabelHeight); + } + self.tipsLabel.hidden = NO; + + if (callStatus == RCCallActive) { + self.muteButton.frame = CGRectMake(RCCallHorizontalMargin, + self.view.frame.size.height - RCCallVerticalMargin - RCCallButtonLength, + RCCallButtonLength, RCCallButtonLength); + [self layoutTextUnderImageButton:self.muteButton]; + self.muteButton.hidden = NO; + } else if (callStatus != RCCallHangup) { + self.muteButton.hidden = YES; + } - self.speakerButton.hidden = YES; - - if (callStatus == RCCallDialing) { - self.hangupButton.frame = - CGRectMake((self.view.frame.size.width - RCCallButtonLength) / 2, - self.view.frame.size.height - RCCallVerticalMargin - - RCCallButtonLength, - RCCallButtonLength, RCCallButtonLength); - [self layoutTextUnderImageButton:self.hangupButton]; - self.hangupButton.hidden = NO; - - self.acceptButton.hidden = YES; - } else if (callStatus == RCCallIncoming || callStatus == RCCallRinging) { - self.hangupButton.frame = CGRectMake( - RCCallHorizontalMargin, self.view.frame.size.height - - RCCallVerticalMargin - RCCallButtonLength, - RCCallButtonLength, RCCallButtonLength); - [self layoutTextUnderImageButton:self.hangupButton]; - self.hangupButton.hidden = NO; - - self.acceptButton.frame = - CGRectMake(self.view.frame.size.width - RCCallHorizontalMargin - - RCCallButtonLength, - self.view.frame.size.height - RCCallVerticalMargin - - RCCallButtonLength, - RCCallButtonLength, RCCallButtonLength); - [self layoutTextUnderImageButton:self.acceptButton]; - self.acceptButton.hidden = NO; - } else if (callStatus == RCCallActive) { - self.hangupButton.frame = - CGRectMake((self.view.frame.size.width - RCCallButtonLength) / 2, - self.view.frame.size.height - RCCallVerticalMargin - - RCCallButtonLength, - RCCallButtonLength, RCCallButtonLength); - [self layoutTextUnderImageButton:self.hangupButton]; - self.hangupButton.hidden = NO; - - self.acceptButton.hidden = YES; - } + self.speakerButton.hidden = YES; + + if (callStatus == RCCallDialing) { + self.hangupButton.frame = + CGRectMake((self.view.frame.size.width - RCCallButtonLength) / 2, + self.view.frame.size.height - RCCallVerticalMargin - RCCallButtonLength, RCCallButtonLength, + RCCallButtonLength); + [self layoutTextUnderImageButton:self.hangupButton]; + self.hangupButton.hidden = NO; + + self.acceptButton.hidden = YES; + } else if (callStatus == RCCallIncoming || callStatus == RCCallRinging) { + self.hangupButton.frame = CGRectMake( + RCCallHorizontalMargin, self.view.frame.size.height - RCCallVerticalMargin - RCCallButtonLength, + RCCallButtonLength, RCCallButtonLength); + [self layoutTextUnderImageButton:self.hangupButton]; + self.hangupButton.hidden = NO; + + self.acceptButton.frame = + CGRectMake(self.view.frame.size.width - RCCallHorizontalMargin - RCCallButtonLength, + self.view.frame.size.height - RCCallVerticalMargin - RCCallButtonLength, RCCallButtonLength, + RCCallButtonLength); + [self layoutTextUnderImageButton:self.acceptButton]; + self.acceptButton.hidden = NO; + } else if (callStatus == RCCallActive) { + self.hangupButton.frame = + CGRectMake((self.view.frame.size.width - RCCallButtonLength) / 2, + self.view.frame.size.height - RCCallVerticalMargin - RCCallButtonLength, RCCallButtonLength, + RCCallButtonLength); + [self layoutTextUnderImageButton:self.hangupButton]; + self.hangupButton.hidden = NO; + + self.acceptButton.hidden = YES; + } - if (callStatus == RCCallActive) { - self.cameraCloseButton.frame = - CGRectMake(self.view.frame.size.width - RCCallHorizontalMargin - - RCCallButtonLength, - self.view.frame.size.height - RCCallVerticalMargin - - RCCallButtonLength, - RCCallButtonLength, RCCallButtonLength); - [self layoutTextUnderImageButton:self.cameraCloseButton]; - self.cameraCloseButton.hidden = NO; - } else if (callStatus != RCCallHangup) { - self.cameraCloseButton.hidden = YES; + if (callStatus == RCCallActive) { + self.cameraCloseButton.frame = + CGRectMake(self.view.frame.size.width - RCCallHorizontalMargin - RCCallButtonLength, + self.view.frame.size.height - RCCallVerticalMargin - RCCallButtonLength, RCCallButtonLength, + RCCallButtonLength); + [self layoutTextUnderImageButton:self.cameraCloseButton]; + self.cameraCloseButton.hidden = NO; + } else if (callStatus != RCCallHangup) { + self.cameraCloseButton.hidden = YES; + } } - } } - (void)layoutTextUnderImageButton:(UIButton *)button { - [button.titleLabel setFont:[UIFont systemFontOfSize:12]]; - [button setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; + [button.titleLabel setFont:[UIFont systemFontOfSize:12]]; + [button setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; - button.titleEdgeInsets = UIEdgeInsetsMake( - 0, -button.imageView.frame.size.width, - -button.imageView.frame.size.height - RCCallInsideMargin, 0); - button.imageEdgeInsets = UIEdgeInsetsMake( - -button.titleLabel.intrinsicContentSize.height - RCCallInsideMargin, 0, 0, - -button.titleLabel.intrinsicContentSize.width); + button.titleEdgeInsets = UIEdgeInsetsMake(0, -button.imageView.frame.size.width, + -button.imageView.frame.size.height - RCCallInsideMargin, 0); + button.imageEdgeInsets = UIEdgeInsetsMake(-button.titleLabel.intrinsicContentSize.height - RCCallInsideMargin, 0, 0, + -button.titleLabel.intrinsicContentSize.width); } #pragma mark - RCCallSessionDelegate @@ -1099,42 +964,39 @@ - (void)layoutTextUnderImageButton:(UIButton *)button { 通话已接通 */ - (void)callDidConnect { - [self callWillConnect]; + [self callWillConnect]; - self.tipsLabel.text = @""; - [self startActiveTimer]; - [self resetLayout:self.callSession.isMultiCall - mediaType:self.callSession.mediaType - callStatus:self.callSession.callStatus]; + self.tipsLabel.text = @""; + [self startActiveTimer]; + [self resetLayout:self.callSession.isMultiCall + mediaType:self.callSession.mediaType + callStatus:self.callSession.callStatus]; } /*! 通话已结束 */ - (void)callDidDisconnect { - [self callWillDisconnect]; - [RCCallKitUtility clearScreenForceOnStatus]; - - if (self.callSession.connectedTime > 0) { - self.tipsLabel.text = - NSLocalizedStringFromTable(@"VoIPCallEnd", @"RongCloudKit", nil); - } else { - self.tipsLabel.text = [RCCallKitUtility - getReadableStringForCallViewController:self.callSession - .disconnectReason]; - } - self.tipsLabel.textColor = [UIColor whiteColor]; - - [self stopActiveTimer]; - [self resetLayout:self.callSession.isMultiCall - mediaType:self.callSession.mediaType - callStatus:self.callSession.callStatus]; - - dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), - dispatch_get_main_queue(), ^{ - [[RCCall sharedRCCall] dismissCallViewController:self]; - }); - [self removeProximityMonitoringObserver]; + [self callWillDisconnect]; + [RCCallKitUtility clearScreenForceOnStatus]; + + if (self.callSession.connectedTime > 0) { + self.tipsLabel.text = NSLocalizedStringFromTable(@"VoIPCallEnd", @"RongCloudKit", nil); + } else { + self.tipsLabel.text = + [RCCallKitUtility getReadableStringForCallViewController:self.callSession.disconnectReason]; + } + self.tipsLabel.textColor = [UIColor whiteColor]; + + [self stopActiveTimer]; + [self resetLayout:self.callSession.isMultiCall + mediaType:self.callSession.mediaType + callStatus:self.callSession.callStatus]; + + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ + [[RCCall sharedRCCall] dismissCallViewController:self]; + }); + [self removeProximityMonitoringObserver]; } /*! @@ -1143,9 +1005,9 @@ - (void)callDidDisconnect { @param userId 对端的用户ID */ - (void)remoteUserDidRing:(NSString *)userId { - [self resetLayout:self.callSession.isMultiCall - mediaType:self.callSession.mediaType - callStatus:self.callSession.callStatus]; + [self resetLayout:self.callSession.isMultiCall + mediaType:self.callSession.mediaType + callStatus:self.callSession.callStatus]; } /*! @@ -1154,11 +1016,10 @@ - (void)remoteUserDidRing:(NSString *)userId { @param userId 被邀请的用户ID @param mediaType 希望被邀请者选择的媒体类型 */ -- (void)remoteUserDidInvite:(NSString *)userId - mediaType:(RCCallMediaType)mediaType { - [self resetLayout:self.callSession.isMultiCall - mediaType:self.callSession.mediaType - callStatus:self.callSession.callStatus]; +- (void)remoteUserDidInvite:(NSString *)userId mediaType:(RCCallMediaType)mediaType { + [self resetLayout:self.callSession.isMultiCall + mediaType:self.callSession.mediaType + callStatus:self.callSession.callStatus]; } /*! @@ -1167,11 +1028,10 @@ - (void)remoteUserDidInvite:(NSString *)userId @param userId 用户ID @param mediaType 用户的媒体类型 */ -- (void)remoteUserDidJoin:(NSString *)userId - mediaType:(RCCallMediaType)mediaType { - [self resetLayout:self.callSession.isMultiCall - mediaType:self.callSession.mediaType - callStatus:self.callSession.callStatus]; +- (void)remoteUserDidJoin:(NSString *)userId mediaType:(RCCallMediaType)mediaType { + [self resetLayout:self.callSession.isMultiCall + mediaType:self.callSession.mediaType + callStatus:self.callSession.callStatus]; } /*! @@ -1180,27 +1040,22 @@ - (void)remoteUserDidJoin:(NSString *)userId @param userId 用户ID @param mediaType 切换至的媒体类型 */ -- (void)remoteUserDidChangeMediaType:(NSString *)userId - mediaType:(RCCallMediaType)mediaType { - dispatch_async(dispatch_get_main_queue(), ^{ - if (!self.callSession.isMultiCall) { - if (mediaType == RCCallMediaAudio && - self.callSession.mediaType != RCCallMediaAudio) { - if ([self.callSession changeMediaType:RCCallMediaAudio]) { - [self.callSession - setVideoView:nil - userId:[RCIMClient sharedRCIMClient].currentUserInfo.userId]; - [self.callSession setVideoView:nil userId:self.callSession.targetId]; - [self resetLayout:self.callSession.isMultiCall - mediaType:RCCallMediaAudio - callStatus:self.callSession.callStatus]; +- (void)remoteUserDidChangeMediaType:(NSString *)userId mediaType:(RCCallMediaType)mediaType { + dispatch_async(dispatch_get_main_queue(), ^{ + if (!self.callSession.isMultiCall) { + if (mediaType == RCCallMediaAudio && self.callSession.mediaType != RCCallMediaAudio) { + if ([self.callSession changeMediaType:RCCallMediaAudio]) { + [self.callSession setVideoView:nil userId:[RCIMClient sharedRCIMClient].currentUserInfo.userId]; + [self.callSession setVideoView:nil userId:self.callSession.targetId]; + [self resetLayout:self.callSession.isMultiCall + mediaType:RCCallMediaAudio + callStatus:self.callSession.callStatus]; + } + } + } else if (self.callSession.mediaType == mediaType && mediaType == RCCallMediaVideo) { + [self remoteUserDidDisableCamera:NO byUser:userId]; } - } - } else if (self.callSession.mediaType == mediaType && - mediaType == RCCallMediaVideo) { - [self remoteUserDidDisableCamera:NO byUser:userId]; - } - }); + }); } /*! @@ -1210,9 +1065,9 @@ - (void)remoteUserDidChangeMediaType:(NSString *)userId @param muted 是否关闭camera */ - (void)remoteUserDidDisableCamera:(BOOL)muted byUser:(NSString *)userId { - [self resetLayout:self.callSession.isMultiCall - mediaType:self.callSession.mediaType - callStatus:self.callSession.callStatus]; + [self resetLayout:self.callSession.isMultiCall + mediaType:self.callSession.mediaType + callStatus:self.callSession.callStatus]; } /*! @@ -1221,52 +1076,47 @@ - (void)remoteUserDidDisableCamera:(BOOL)muted byUser:(NSString *)userId { @param userId 用户ID @param reason 挂断的原因 */ -- (void)remoteUserDidLeft:(NSString *)userId - reason:(RCCallDisconnectReason)reason { - [self resetLayout:self.callSession.isMultiCall - mediaType:self.callSession.mediaType - callStatus:self.callSession.callStatus]; +- (void)remoteUserDidLeft:(NSString *)userId reason:(RCCallDisconnectReason)reason { + [self resetLayout:self.callSession.isMultiCall + mediaType:self.callSession.mediaType + callStatus:self.callSession.callStatus]; } /*! 对方正在振铃,可以播放对应的彩铃 */ - (void)shouldAlertForWaitingRemoteResponse { - if ([UIApplication sharedApplication].applicationState == - UIApplicationStateActive) { - NSString *ringPath = - [[[NSBundle mainBundle] pathForResource:@"RongCloud" ofType:@"bundle"] + if ([UIApplication sharedApplication].applicationState == UIApplicationStateActive) { + NSString *ringPath = [[[NSBundle mainBundle] pathForResource:@"RongCloud" ofType:@"bundle"] stringByAppendingPathComponent:@"voip/voip_calling_ring.mp3"]; - [self startPlayRing:ringPath]; - self.needPlayingAlertAfterForeground = NO; - } else { - self.needPlayingAlertAfterForeground = YES; - } + [self startPlayRing:ringPath]; + self.needPlayingAlertAfterForeground = NO; + } else { + self.needPlayingAlertAfterForeground = YES; + } } /*! 收到电话,可以播放铃声 */ - (void)shouldRingForIncomingCall { - if ([UIApplication sharedApplication].applicationState == - UIApplicationStateActive) { - NSString *ringPath = - [[[NSBundle mainBundle] pathForResource:@"RongCloud" ofType:@"bundle"] + if ([UIApplication sharedApplication].applicationState == UIApplicationStateActive) { + NSString *ringPath = [[[NSBundle mainBundle] pathForResource:@"RongCloud" ofType:@"bundle"] stringByAppendingPathComponent:@"voip/voip_call.mp3"]; - [self startPlayRing:ringPath]; - self.needPlayingRingAfterForeground = NO; - } else { - self.needPlayingRingAfterForeground = YES; - } + [self startPlayRing:ringPath]; + self.needPlayingRingAfterForeground = NO; + } else { + self.needPlayingRingAfterForeground = YES; + } } /*! 停止播放铃声(通话接通或挂断) */ - (void)shouldStopAlertAndRing { - self.needPlayingRingAfterForeground = NO; - self.needPlayingAlertAfterForeground = NO; - [self stopPlayRing]; + self.needPlayingRingAfterForeground = NO; + self.needPlayingAlertAfterForeground = NO; + [self stopPlayRing]; } /*! @@ -1277,64 +1127,62 @@ - (void)shouldStopAlertAndRing { @warning 如果是不可恢复的错误,SDK会挂断电话并回调callDidDisconnect。 */ - (void)errorDidOccur:(RCCallErrorCode)error { - if ([self respondsToSelector:@selector(tipsWillShow:)]) { - if (![self tipsWillShow:error]) { - return; + if ([self respondsToSelector:@selector(tipsWillShow:)]) { + if (![self tipsWillShow:error]) { + return; + } } - } - // self.tipsLabel.text = [NSString stringWithFormat:@"错误码:%ld", - // (long)error]; + // self.tipsLabel.text = [NSString stringWithFormat:@"错误码:%ld", + // (long)error]; } /*! 当前通话网络状态的回调,该回调方法每两秒触发一次 - + @param txQuality 上行网络质量 @param rxQuality 下行网络质量 */ - (void)networkTxQuality:(RCCallQuality)txQuality rxQuality:(RCCallQuality)rxQuality { -// NSLog(@"networkTxQuality, %d, %d", txQuality, rxQuality); + // NSLog(@"networkTxQuality, %d, %d", txQuality, rxQuality); } #pragma mark - telephony - (void)registerTelephonyEvent { - self.callCenter = [[CTCallCenter alloc] init]; - __weak __typeof(self) weakSelf = self; - self.callCenter.callEventHandler = ^(CTCall *call) { - if ([call.callState isEqualToString:CTCallStateConnected]) { - [weakSelf.callSession hangup]; - } - }; + self.callCenter = [[CTCallCenter alloc] init]; + __weak __typeof(self) weakSelf = self; + self.callCenter.callEventHandler = ^(CTCall *call) { + if ([call.callState isEqualToString:CTCallStateConnected]) { + [weakSelf.callSession hangup]; + } + }; } #pragma mark - proximity - (void)addProximityMonitoringObserver { - [UIDevice currentDevice].proximityMonitoringEnabled = YES; - - [[NSNotificationCenter defaultCenter] - addObserver:self - selector:@selector(proximityStatueChanged:) - name:UIDeviceProximityStateDidChangeNotification - object:nil]; + [UIDevice currentDevice].proximityMonitoringEnabled = YES; + + [[NSNotificationCenter defaultCenter] addObserver:self + selector:@selector(proximityStatueChanged:) + name:UIDeviceProximityStateDidChangeNotification + object:nil]; } - (void)removeProximityMonitoringObserver { - [UIDevice currentDevice].proximityMonitoringEnabled = NO; - - [[NSNotificationCenter defaultCenter] - removeObserver:self - name:UIDeviceProximityStateDidChangeNotification - object:nil]; + [UIDevice currentDevice].proximityMonitoringEnabled = NO; + + [[NSNotificationCenter defaultCenter] removeObserver:self + name:UIDeviceProximityStateDidChangeNotification + object:nil]; } - (void)proximityStatueChanged:(NSNotificationCenter *)notification { - // if ([UIDevice currentDevice].proximityState) { - // [[AVAudioSession sharedInstance] - // setCategory:AVAudioSessionCategoryPlayAndRecord error:nil]; - // } else { - // [[AVAudioSession sharedInstance] - // setCategory:AVAudioSessionCategoryPlayback error:nil]; - // } + // if ([UIDevice currentDevice].proximityState) { + // [[AVAudioSession sharedInstance] + // setCategory:AVAudioSessionCategoryPlayAndRecord error:nil]; + // } else { + // [[AVAudioSession sharedInstance] + // setCategory:AVAudioSessionCategoryPlayback error:nil]; + // } } #pragma mark - outside callback @@ -1345,7 +1193,7 @@ - (void)callWillDisconnect { } - (BOOL)tipsWillShow:(RCCallErrorCode)warning { - return YES; + return YES; } - (void)didTapAcceptButton { diff --git a/ios-rongcallkit/RongCallKit/Controller/RCCallSelectMemberViewController.h b/ios-rongcallkit/RongCallKit/Controller/RCCallSelectMemberViewController.h index 7be5cfe..89d54fb 100644 --- a/ios-rongcallkit/RongCallKit/Controller/RCCallSelectMemberViewController.h +++ b/ios-rongcallkit/RongCallKit/Controller/RCCallSelectMemberViewController.h @@ -55,7 +55,6 @@ targetId:(NSString *)targetId mediaType:(RCCallMediaType)mediaType exist:(NSArray *)existUserIdList - success:(void (^)(NSArray *addUserIdList)) - successBlock; + success:(void (^)(NSArray *addUserIdList))successBlock; @end diff --git a/ios-rongcallkit/RongCallKit/Controller/RCCallSelectMemberViewController.m b/ios-rongcallkit/RongCallKit/Controller/RCCallSelectMemberViewController.m index 50ab7d1..f4fa4ea 100644 --- a/ios-rongcallkit/RongCallKit/Controller/RCCallSelectMemberViewController.m +++ b/ios-rongcallkit/RongCallKit/Controller/RCCallSelectMemberViewController.m @@ -17,8 +17,7 @@ typedef void (^CompleteBlock)(NSArray *addUserIdList); -@interface RCCallSelectMemberViewController () +@interface RCCallSelectMemberViewController () @property(nonatomic, strong) NSMutableArray *selectUserIds; @property(nonatomic, strong) CompleteBlock successBlock; @@ -31,247 +30,213 @@ - (instancetype)initWithConversationType:(RCConversationType)conversationType targetId:(NSString *)targetId mediaType:(RCCallMediaType)mediaType exist:(NSArray *)existUserIdList - success:(void (^)(NSArray *addUserIdList)) - successBlock { - self = [super init]; - if (self) { - self.conversationType = conversationType; - self.targetId = targetId; - self.mediaType = mediaType; - __weak typeof(self) weakSelf = self; - if (conversationType == ConversationType_DISCUSSION) { - [[RCIMClient sharedRCIMClient] getDiscussion:targetId - success:^(RCDiscussion *discussion) { - weakSelf.listingUserIdList = [discussion.memberIdList copy]; - } - error:^(RCErrorCode status){ - - }]; - - } else if (conversationType == ConversationType_GROUP) { - if ([RCIM sharedRCIM].groupMemberDataSource && - [[RCIM sharedRCIM] - .groupMemberDataSource - respondsToSelector:@selector(getAllMembersOfGroup:result:)]) { - [[RCIM sharedRCIM] - .groupMemberDataSource - getAllMembersOfGroup:self.targetId - result:^(NSArray *userIdList) { - weakSelf.listingUserIdList = userIdList; - NSLog(@"get the members success"); - }]; - } + success:(void (^)(NSArray *addUserIdList))successBlock { + self = [super init]; + if (self) { + self.conversationType = conversationType; + self.targetId = targetId; + self.mediaType = mediaType; + __weak typeof(self) weakSelf = self; + if (conversationType == ConversationType_DISCUSSION) { + [[RCIMClient sharedRCIMClient] getDiscussion:targetId + success:^(RCDiscussion *discussion) { + weakSelf.listingUserIdList = [discussion.memberIdList copy]; + } + error:^(RCErrorCode status){ + + }]; + + } else if (conversationType == ConversationType_GROUP) { + if ([RCIM sharedRCIM].groupMemberDataSource && + [[RCIM sharedRCIM].groupMemberDataSource respondsToSelector:@selector(getAllMembersOfGroup:result:)]) { + [[RCIM sharedRCIM].groupMemberDataSource getAllMembersOfGroup:self.targetId + result:^(NSArray *userIdList) { + weakSelf.listingUserIdList = userIdList; + NSLog(@"get the members success"); + }]; + } + } + self.existUserIdList = existUserIdList; + self.selectUserIds = [[NSMutableArray alloc] init]; + self.successBlock = successBlock; + + [[NSNotificationCenter defaultCenter] addObserver:self + selector:@selector(onUserInfoUpdate:) + name:RCKitDispatchUserInfoUpdateNotification + object:nil]; } - self.existUserIdList = existUserIdList; - self.selectUserIds = [[NSMutableArray alloc] init]; - self.successBlock = successBlock; - - [[NSNotificationCenter defaultCenter] - addObserver:self - selector:@selector(onUserInfoUpdate:) - name:RCKitDispatchUserInfoUpdateNotification - object:nil]; - } - return self; + return self; } - (void)setListingUserIdList:(NSArray *)listingUserIdList { - _listingUserIdList = listingUserIdList; + _listingUserIdList = listingUserIdList; - __weak typeof(self) weakSelf = self; - dispatch_async(dispatch_get_main_queue(), ^{ - [weakSelf.tableView reloadData]; - }); + __weak typeof(self) weakSelf = self; + dispatch_async(dispatch_get_main_queue(), ^{ + [weakSelf.tableView reloadData]; + }); } - (void)viewDidLoad { - [super viewDidLoad]; - - self.view.backgroundColor = RongVoIPUIColorFromRGB(0x262e42); - - self.tableView = [[UITableView alloc] init]; - self.tableView.frame = CGRectMake(0, 64, self.view.frame.size.width, - self.view.frame.size.height - 64); - self.tableView.dataSource = self; - self.tableView.delegate = self; - self.tableView.backgroundColor = [UIColor clearColor]; - [self.view addSubview:self.tableView]; - self.tableView.tableFooterView = [[UIView alloc] init]; - - UINavigationBar *navigationBar = [[UINavigationBar alloc] - initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, 64)]; - navigationBar.backgroundColor = [UIColor clearColor]; - [navigationBar setTintColor:[UIColor whiteColor]]; - [navigationBar setBarTintColor:RongVoIPUIColorFromRGB(0x262e42)]; - - [self.view addSubview:navigationBar]; - - UINavigationItem *navigationBarTitle = [[UINavigationItem alloc] - initWithTitle:NSLocalizedStringFromTable(@"VoIPCallSelectMember", - @"RongCloudKit", nil)]; - [navigationBar pushNavigationItem:navigationBarTitle animated:YES]; - - UIBarButtonItem *leftBarButtonItem = [[UIBarButtonItem alloc] - initWithTitle:NSLocalizedStringFromTable(@"Cancel", @"RongCloudKit", nil) - style:UIBarButtonItemStylePlain - target:self - action:@selector(cancel:)]; - navigationBarTitle.leftBarButtonItem = leftBarButtonItem; - - self.rightBarButtonItem = [[UIBarButtonItem alloc] - initWithTitle:NSLocalizedStringFromTable(@"OK", @"RongCloudKit", nil) - style:UIBarButtonItemStylePlain - target:self - action:@selector(done:)]; - navigationBarTitle.rightBarButtonItem = self.rightBarButtonItem; - [navigationBar setItems:[NSArray arrayWithObject:navigationBarTitle]]; - - [self updateRightButton]; + [super viewDidLoad]; + + self.view.backgroundColor = RongVoIPUIColorFromRGB(0x262e42); + + self.tableView = [[UITableView alloc] init]; + self.tableView.frame = CGRectMake(0, 64, self.view.frame.size.width, self.view.frame.size.height - 64); + self.tableView.dataSource = self; + self.tableView.delegate = self; + self.tableView.backgroundColor = [UIColor clearColor]; + [self.view addSubview:self.tableView]; + self.tableView.tableFooterView = [[UIView alloc] init]; + + UINavigationBar *navigationBar = + [[UINavigationBar alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, 64)]; + navigationBar.backgroundColor = [UIColor clearColor]; + [navigationBar setTintColor:[UIColor whiteColor]]; + [navigationBar setBarTintColor:RongVoIPUIColorFromRGB(0x262e42)]; + + [self.view addSubview:navigationBar]; + + UINavigationItem *navigationBarTitle = [[UINavigationItem alloc] + initWithTitle:NSLocalizedStringFromTable(@"VoIPCallSelectMember", @"RongCloudKit", nil)]; + [navigationBar pushNavigationItem:navigationBarTitle animated:YES]; + + UIBarButtonItem *leftBarButtonItem = + [[UIBarButtonItem alloc] initWithTitle:NSLocalizedStringFromTable(@"Cancel", @"RongCloudKit", nil) + style:UIBarButtonItemStylePlain + target:self + action:@selector(cancel:)]; + navigationBarTitle.leftBarButtonItem = leftBarButtonItem; + + self.rightBarButtonItem = + [[UIBarButtonItem alloc] initWithTitle:NSLocalizedStringFromTable(@"OK", @"RongCloudKit", nil) + style:UIBarButtonItemStylePlain + target:self + action:@selector(done:)]; + navigationBarTitle.rightBarButtonItem = self.rightBarButtonItem; + [navigationBar setItems:[NSArray arrayWithObject:navigationBarTitle]]; + + [self updateRightButton]; } - (void)cancel:(id)sender { - [[RCCall sharedRCCall] dismissCallViewController:self]; + [[RCCall sharedRCCall] dismissCallViewController:self]; } - (void)done:(id)sender { - if ((self.selectUserIds.count + self.existUserIdList.count > - [RCCall sharedRCCall].maxMultiAudioCallUserNumber) && - self.mediaType == RCCallMediaAudio) { - [self loadErrorAlert: - [NSString stringWithFormat:NSLocalizedStringFromTable( - @"VoIPAudioCallMaxNumSelectMember", - @"RongCloudKit", nil), - [RCCall sharedRCCall] - .maxMultiAudioCallUserNumber]]; - } else if ((self.selectUserIds.count + self.existUserIdList.count > - [RCCall sharedRCCall].maxMultiVideoCallUserNumber) && - self.mediaType == RCCallMediaVideo) { - [self loadErrorAlert: - [NSString stringWithFormat:NSLocalizedStringFromTable( - @"VoIPVideoCallMaxNumSelectMember", - @"RongCloudKit", nil), - [RCCall sharedRCCall] - .maxMultiVideoCallUserNumber]]; - } else { - [[RCCall sharedRCCall] dismissCallViewController:self]; - if (self.successBlock) { - self.successBlock(self.selectUserIds); + if ((self.selectUserIds.count + self.existUserIdList.count > [RCCall sharedRCCall].maxMultiAudioCallUserNumber) && + self.mediaType == RCCallMediaAudio) { + [self loadErrorAlert:[NSString stringWithFormat:NSLocalizedStringFromTable(@"VoIPAudioCallMaxNumSelectMember", + @"RongCloudKit", nil), + [RCCall sharedRCCall].maxMultiAudioCallUserNumber]]; + } else if ((self.selectUserIds.count + self.existUserIdList.count > + [RCCall sharedRCCall].maxMultiVideoCallUserNumber) && + self.mediaType == RCCallMediaVideo) { + [self loadErrorAlert:[NSString stringWithFormat:NSLocalizedStringFromTable(@"VoIPVideoCallMaxNumSelectMember", + @"RongCloudKit", nil), + [RCCall sharedRCCall].maxMultiVideoCallUserNumber]]; + } else { + [[RCCall sharedRCCall] dismissCallViewController:self]; + if (self.successBlock) { + self.successBlock(self.selectUserIds); + } } - } } - (void)loadErrorAlert:(NSString *)title { - UIAlertView *alert = [[UIAlertView alloc] initWithTitle:title - message:nil - delegate:nil - cancelButtonTitle:nil - otherButtonTitles:nil]; - [NSTimer scheduledTimerWithTimeInterval:1.0f - target:self - selector:@selector(cancelAlert:) - userInfo:alert - repeats:NO]; - [alert show]; + UIAlertView *alert = + [[UIAlertView alloc] initWithTitle:title message:nil delegate:nil cancelButtonTitle:nil otherButtonTitles:nil]; + [NSTimer scheduledTimerWithTimeInterval:1.0f + target:self + selector:@selector(cancelAlert:) + userInfo:alert + repeats:NO]; + [alert show]; } - (void)cancelAlert:(NSTimer *)scheduledTimer { - UIAlertView *alert = (UIAlertView *)(scheduledTimer.userInfo); - [alert dismissWithClickedButtonIndex:0 animated:NO]; + UIAlertView *alert = (UIAlertView *)(scheduledTimer.userInfo); + [alert dismissWithClickedButtonIndex:0 animated:NO]; } // UITableViewDataSource -- (NSInteger)tableView:(UITableView *)tableView - numberOfRowsInSection:(NSInteger)section { - return self.listingUserIdList.count; +- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { + return self.listingUserIdList.count; } -- (UITableViewCell *)tableView:(UITableView *)tableView - cellForRowAtIndexPath:(NSIndexPath *)indexPath { - static NSString *reusableID = @"RongVoIPSelectMembersCellId"; - RCCallSelectingMemberCell *cell = - [tableView dequeueReusableCellWithIdentifier:reusableID]; - if (!cell) { - cell = [[RCCallSelectingMemberCell alloc] - initWithStyle:UITableViewCellStyleDefault - reuseIdentifier:reusableID]; - } - - NSString *userId = self.listingUserIdList[indexPath.row]; - if ([self.existUserIdList containsObject:userId]) { - [cell.selectedImageView - setImage:[RCCallKitUtility imageFromVoIPBundle:@"voip/deselect.png"]]; - } else if ([self.selectUserIds containsObject:userId]) { - [cell.selectedImageView - setImage:[RCCallKitUtility imageFromVoIPBundle:@"voip/selected.png"]]; - } else { - [cell.selectedImageView - setImage:[RCCallKitUtility imageFromVoIPBundle:@"voip/unselected.png"]]; - } - - RCUserInfo *userInfo = - [[RCUserInfoCacheManager sharedManager] getUserInfo:userId]; - if (userInfo) { - [cell.headerImageView - setImageURL:[NSURL URLWithString:userInfo.portraitUri]]; - [cell.nameLabel setText:userInfo.name]; - } else { - [cell.headerImageView - setPlaceholderImage:[RCCallKitUtility getDefaultPortraitImage]]; - [cell.nameLabel setText:userId]; - } - - return cell; +- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { + static NSString *reusableID = @"RongVoIPSelectMembersCellId"; + RCCallSelectingMemberCell *cell = [tableView dequeueReusableCellWithIdentifier:reusableID]; + if (!cell) { + cell = [[RCCallSelectingMemberCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:reusableID]; + } + + NSString *userId = self.listingUserIdList[indexPath.row]; + if ([self.existUserIdList containsObject:userId]) { + [cell.selectedImageView setImage:[RCCallKitUtility imageFromVoIPBundle:@"voip/deselect.png"]]; + } else if ([self.selectUserIds containsObject:userId]) { + [cell.selectedImageView setImage:[RCCallKitUtility imageFromVoIPBundle:@"voip/selected.png"]]; + } else { + [cell.selectedImageView setImage:[RCCallKitUtility imageFromVoIPBundle:@"voip/unselected.png"]]; + } + + RCUserInfo *userInfo = [[RCUserInfoCacheManager sharedManager] getUserInfo:userId]; + if (userInfo) { + [cell.headerImageView setImageURL:[NSURL URLWithString:userInfo.portraitUri]]; + [cell.nameLabel setText:userInfo.name]; + } else { + [cell.headerImageView setPlaceholderImage:[RCCallKitUtility getDefaultPortraitImage]]; + [cell.nameLabel setText:userId]; + } + + return cell; } -- (CGFloat)tableView:(UITableView *)tableView - heightForRowAtIndexPath:(NSIndexPath *)indexPath { - return 70; +- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { + return 70; } -- (void)tableView:(UITableView *)tableView - didSelectRowAtIndexPath:(NSIndexPath *)indexPath { - NSString *userId = self.listingUserIdList[indexPath.row]; - if (![self.existUserIdList containsObject:userId]) { - if ([self.selectUserIds containsObject:userId]) { - [self.selectUserIds removeObject:userId]; - } else { - [self.selectUserIds addObject:userId]; +- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { + NSString *userId = self.listingUserIdList[indexPath.row]; + if (![self.existUserIdList containsObject:userId]) { + if ([self.selectUserIds containsObject:userId]) { + [self.selectUserIds removeObject:userId]; + } else { + [self.selectUserIds addObject:userId]; + } + [self updateRightButton]; } - [self updateRightButton]; - } - [self.tableView reloadRowsAtIndexPaths:@[ indexPath ] - withRowAnimation:UITableViewRowAnimationAutomatic]; + [self.tableView reloadRowsAtIndexPaths:@[ indexPath ] withRowAnimation:UITableViewRowAnimationAutomatic]; } - (void)updateRightButton { - [self.rightBarButtonItem setEnabled:self.selectUserIds.count > 0]; + [self.rightBarButtonItem setEnabled:self.selectUserIds.count > 0]; } #pragma mark - UserInfo Update - (void)onUserInfoUpdate:(NSNotification *)notification { - NSDictionary *userInfoDic = notification.object; - NSString *updateUserId = userInfoDic[@"userId"]; - - for (NSString *userId in self.listingUserIdList) { - if ([updateUserId isEqualToString:userId]) { - __weak typeof(self) weakSelf = self; - dispatch_async(dispatch_get_main_queue(), ^{ - NSIndexPath *index = [NSIndexPath - indexPathForRow:[weakSelf.listingUserIdList indexOfObject:userId] - inSection:0]; - - [weakSelf.tableView - reloadRowsAtIndexPaths:@[ index ] - withRowAnimation:UITableViewRowAnimationAutomatic]; - }); - return; + NSDictionary *userInfoDic = notification.object; + NSString *updateUserId = userInfoDic[@"userId"]; + + for (NSString *userId in self.listingUserIdList) { + if ([updateUserId isEqualToString:userId]) { + __weak typeof(self) weakSelf = self; + dispatch_async(dispatch_get_main_queue(), ^{ + NSIndexPath *index = + [NSIndexPath indexPathForRow:[weakSelf.listingUserIdList indexOfObject:userId] inSection:0]; + + [weakSelf.tableView reloadRowsAtIndexPaths:@[ index ] + withRowAnimation:UITableViewRowAnimationAutomatic]; + }); + return; + } } - } } - (void)dealloc { - [[NSNotificationCenter defaultCenter] removeObserver:self]; + [[NSNotificationCenter defaultCenter] removeObserver:self]; } @end diff --git a/ios-rongcallkit/RongCallKit/Controller/RCCallSingleCallViewController.h b/ios-rongcallkit/RongCallKit/Controller/RCCallSingleCallViewController.h index 6a052b6..c08f900 100644 --- a/ios-rongcallkit/RongCallKit/Controller/RCCallSingleCallViewController.h +++ b/ios-rongcallkit/RongCallKit/Controller/RCCallSingleCallViewController.h @@ -57,8 +57,7 @@ @return 单人音视频ViewController */ -- (instancetype)initWithOutgoingCall:(NSString *)targetId - mediaType:(RCCallMediaType)mediaType; +- (instancetype)initWithOutgoingCall:(NSString *)targetId mediaType:(RCCallMediaType)mediaType; /*! 初始化已经接通的音视频ViewController diff --git a/ios-rongcallkit/RongCallKit/Controller/RCCallSingleCallViewController.m b/ios-rongcallkit/RongCallKit/Controller/RCCallSingleCallViewController.m index 5209a5e..c9a2a09 100644 --- a/ios-rongcallkit/RongCallKit/Controller/RCCallSingleCallViewController.m +++ b/ios-rongcallkit/RongCallKit/Controller/RCCallSingleCallViewController.m @@ -9,7 +9,6 @@ #import "RCCallSingleCallViewController.h" #import "RCCallFloatingBoard.h" #import "RCCallKitUtility.h" -#import "RCCallKitUtility.h" #import "RCUserInfoCacheManager.h" #import "RCloudImageView.h" @@ -23,69 +22,62 @@ @implementation RCCallSingleCallViewController // init - (instancetype)initWithIncomingCall:(RCCallSession *)callSession { - return [super initWithIncomingCall:callSession]; + return [super initWithIncomingCall:callSession]; } -- (instancetype)initWithOutgoingCall:(NSString *)targetId - mediaType:(RCCallMediaType)mediaType { - return [super initWithOutgoingCall:ConversationType_PRIVATE - targetId:targetId - mediaType:mediaType - userIdList:@[ targetId ]]; +- (instancetype)initWithOutgoingCall:(NSString *)targetId mediaType:(RCCallMediaType)mediaType { + return [super initWithOutgoingCall:ConversationType_PRIVATE + targetId:targetId + mediaType:mediaType + userIdList:@[ targetId ]]; } - (instancetype)initWithActiveCall:(RCCallSession *)callSession { - return [super initWithActiveCall:callSession]; + return [super initWithActiveCall:callSession]; } - (void)viewDidLoad { - [super viewDidLoad]; - - [[NSNotificationCenter defaultCenter] - addObserver:self - selector:@selector(onUserInfoUpdate:) - name:RCKitDispatchUserInfoUpdateNotification - object:nil]; - - RCUserInfo *userInfo = [[RCUserInfoCacheManager sharedManager] - getUserInfo:self.callSession.targetId]; - if (!userInfo) { - userInfo = [[RCUserInfo alloc] initWithUserId:self.callSession.targetId - name:nil - portrait:nil]; - } - self.remoteUserInfo = userInfo; - [self.remoteNameLabel setText:userInfo.name]; - [self.remotePortraitView - setImageURL:[NSURL URLWithString:userInfo.portraitUri]]; + [super viewDidLoad]; + + [[NSNotificationCenter defaultCenter] addObserver:self + selector:@selector(onUserInfoUpdate:) + name:RCKitDispatchUserInfoUpdateNotification + object:nil]; + + RCUserInfo *userInfo = [[RCUserInfoCacheManager sharedManager] getUserInfo:self.callSession.targetId]; + if (!userInfo) { + userInfo = [[RCUserInfo alloc] initWithUserId:self.callSession.targetId name:nil portrait:nil]; + } + self.remoteUserInfo = userInfo; + [self.remoteNameLabel setText:userInfo.name]; + [self.remotePortraitView setImageURL:[NSURL URLWithString:userInfo.portraitUri]]; } - (RCloudImageView *)remotePortraitView { - if (!_remotePortraitView) { - _remotePortraitView = [[RCloudImageView alloc] init]; - - [self.view addSubview:_remotePortraitView]; - _remotePortraitView.hidden = YES; - [_remotePortraitView - setPlaceholderImage:[RCCallKitUtility getDefaultPortraitImage]]; - _remotePortraitView.layer.cornerRadius = 4; - _remotePortraitView.layer.masksToBounds = YES; - } - return _remotePortraitView; + if (!_remotePortraitView) { + _remotePortraitView = [[RCloudImageView alloc] init]; + + [self.view addSubview:_remotePortraitView]; + _remotePortraitView.hidden = YES; + [_remotePortraitView setPlaceholderImage:[RCCallKitUtility getDefaultPortraitImage]]; + _remotePortraitView.layer.cornerRadius = 4; + _remotePortraitView.layer.masksToBounds = YES; + } + return _remotePortraitView; } - (UILabel *)remoteNameLabel { - if (!_remoteNameLabel) { - _remoteNameLabel = [[UILabel alloc] init]; - _remoteNameLabel.backgroundColor = [UIColor clearColor]; - _remoteNameLabel.textColor = [UIColor whiteColor]; - _remoteNameLabel.font = [UIFont systemFontOfSize:18]; - _remoteNameLabel.textAlignment = NSTextAlignmentCenter; - - [self.view addSubview:_remoteNameLabel]; - _remoteNameLabel.hidden = YES; - } - return _remoteNameLabel; + if (!_remoteNameLabel) { + _remoteNameLabel = [[UILabel alloc] init]; + _remoteNameLabel.backgroundColor = [UIColor clearColor]; + _remoteNameLabel.textColor = [UIColor whiteColor]; + _remoteNameLabel.font = [UIFont systemFontOfSize:18]; + _remoteNameLabel.textAlignment = NSTextAlignmentCenter; + + [self.view addSubview:_remoteNameLabel]; + _remoteNameLabel.hidden = YES; + } + return _remoteNameLabel; } - (UIImageView *)statusView { @@ -99,244 +91,205 @@ - (UIImageView *)statusView { } - (UIView *)mainVideoView { - if (!_mainVideoView) { - _mainVideoView = [[UIView alloc] initWithFrame:self.backgroundView.frame]; - _mainVideoView.backgroundColor = RongVoIPUIColorFromRGB(0x262e42); - - [self.backgroundView addSubview:_mainVideoView]; - _mainVideoView.hidden = YES; - } - return _mainVideoView; + if (!_mainVideoView) { + _mainVideoView = [[UIView alloc] initWithFrame:self.backgroundView.frame]; + _mainVideoView.backgroundColor = RongVoIPUIColorFromRGB(0x262e42); + + [self.backgroundView addSubview:_mainVideoView]; + _mainVideoView.hidden = YES; + } + return _mainVideoView; } - (UIView *)subVideoView { - if (!_subVideoView) { - _subVideoView = [[UIView alloc] init]; - _subVideoView.backgroundColor = [UIColor blackColor]; - _subVideoView.layer.borderWidth = 1; - _subVideoView.layer.borderColor = [[UIColor whiteColor] CGColor]; - - [self.view addSubview:_subVideoView]; - _subVideoView.hidden = YES; - - UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] - initWithTarget:self - action:@selector(subVideoViewClicked)]; - [_subVideoView addGestureRecognizer:tap]; - } - return _subVideoView; + if (!_subVideoView) { + _subVideoView = [[UIView alloc] init]; + _subVideoView.backgroundColor = [UIColor blackColor]; + _subVideoView.layer.borderWidth = 1; + _subVideoView.layer.borderColor = [[UIColor whiteColor] CGColor]; + + [self.view addSubview:_subVideoView]; + _subVideoView.hidden = YES; + + UITapGestureRecognizer *tap = + [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(subVideoViewClicked)]; + [_subVideoView addGestureRecognizer:tap]; + } + return _subVideoView; } - (void)subVideoViewClicked { - if ([self.remoteUserInfo.userId isEqualToString:self.callSession.targetId]) { - RCUserInfo *userInfo = [RCIMClient sharedRCIMClient].currentUserInfo; + if ([self.remoteUserInfo.userId isEqualToString:self.callSession.targetId]) { + RCUserInfo *userInfo = [RCIMClient sharedRCIMClient].currentUserInfo; - self.remoteUserInfo = userInfo; - [self.remoteNameLabel setText:userInfo.name]; - [self.remotePortraitView - setImageURL:[NSURL URLWithString:userInfo.portraitUri]]; - - [self.callSession setVideoView:self.mainVideoView - userId:self.remoteUserInfo.userId]; - [self.callSession setVideoView:self.subVideoView - userId:self.callSession.targetId]; - } else { - RCUserInfo *userInfo = [[RCUserInfoCacheManager sharedManager] - getUserInfo:self.callSession.targetId]; - if (!userInfo) { - userInfo = [[RCUserInfo alloc] initWithUserId:self.callSession.targetId - name:nil - portrait:nil]; - } - self.remoteUserInfo = userInfo; - [self.remoteNameLabel setText:userInfo.name]; - [self.remotePortraitView - setImageURL:[NSURL URLWithString:userInfo.portraitUri]]; - - - [self.callSession - setVideoView:self.subVideoView - userId:[RCIMClient sharedRCIMClient].currentUserInfo.userId]; - [self.callSession setVideoView:self.mainVideoView - userId:self.remoteUserInfo.userId]; - } -} + self.remoteUserInfo = userInfo; + [self.remoteNameLabel setText:userInfo.name]; + [self.remotePortraitView setImageURL:[NSURL URLWithString:userInfo.portraitUri]]; -- (void)resetLayout:(BOOL)isMultiCall - mediaType:(RCCallMediaType)mediaType - callStatus:(RCCallStatus)callStatus { - [super resetLayout:isMultiCall - mediaType:mediaType - callStatus:callStatus]; - - UIImage *remoteHeaderImage = self.remotePortraitView.image; - - if (mediaType == RCCallMediaAudio) { - self.remotePortraitView.frame = CGRectMake( - (self.view.frame.size.width - RCCallHeaderLength) / 2, - RCCallVerticalMargin * 3, RCCallHeaderLength, RCCallHeaderLength); - self.remotePortraitView.image = remoteHeaderImage; - self.remotePortraitView.hidden = NO; - - self.remoteNameLabel.frame = CGRectMake( - RCCallHorizontalMargin, - RCCallVerticalMargin * 3 + RCCallHeaderLength + RCCallInsideMargin, - self.view.frame.size.width - RCCallHorizontalMargin * 2, - RCCallLabelHeight); - self.remoteNameLabel.hidden = NO; - - self.remoteNameLabel.textAlignment = NSTextAlignmentCenter; - self.tipsLabel.textAlignment = NSTextAlignmentCenter; - - self.statusView.frame = CGRectMake( - (self.view.frame.size.width - 17) / 2, - RCCallVerticalMargin * 3 + (RCCallHeaderLength - 4)/2, 17, 4); - - if (callStatus == RCCallRinging || callStatus == RCCallDialing || callStatus == RCCallIncoming) { - self.remotePortraitView.alpha = 0.5; - self.statusView.hidden = NO; - } else { - self.statusView.hidden = YES; - self.remotePortraitView.alpha = 1.0; - } - - self.mainVideoView.hidden = YES; - self.subVideoView.hidden = YES; - [self resetRemoteUserInfoIfNeed]; - } else { - if (callStatus == RCCallDialing) { - self.mainVideoView.hidden = NO; - [self.callSession - setVideoView:self.mainVideoView - userId:[RCIMClient sharedRCIMClient].currentUserInfo.userId]; - self.blurView.hidden = YES; - } else if (callStatus == RCCallActive) { - self.mainVideoView.hidden = NO; - [self.callSession setVideoView:self.mainVideoView - userId:self.callSession.targetId]; - self.blurView.hidden = YES; + [self.callSession setVideoView:self.mainVideoView userId:self.remoteUserInfo.userId]; + [self.callSession setVideoView:self.subVideoView userId:self.callSession.targetId]; } else { - self.mainVideoView.hidden = YES; + RCUserInfo *userInfo = [[RCUserInfoCacheManager sharedManager] getUserInfo:self.callSession.targetId]; + if (!userInfo) { + userInfo = [[RCUserInfo alloc] initWithUserId:self.callSession.targetId name:nil portrait:nil]; + } + self.remoteUserInfo = userInfo; + [self.remoteNameLabel setText:userInfo.name]; + [self.remotePortraitView setImageURL:[NSURL URLWithString:userInfo.portraitUri]]; + + [self.callSession setVideoView:self.subVideoView userId:[RCIMClient sharedRCIMClient].currentUserInfo.userId]; + [self.callSession setVideoView:self.mainVideoView userId:self.remoteUserInfo.userId]; } +} - if (callStatus == RCCallActive) { - self.remotePortraitView.hidden = YES; - - self.remoteNameLabel.frame = - CGRectMake(RCCallHorizontalMargin, RCCallVerticalMargin, - self.view.frame.size.width - RCCallHorizontalMargin * 2, - RCCallLabelHeight); - self.remoteNameLabel.hidden = NO; - self.remoteNameLabel.textAlignment = NSTextAlignmentCenter; - } else if (callStatus == RCCallDialing) { - self.remotePortraitView.frame = CGRectMake( - (self.view.frame.size.width - RCCallHeaderLength) / 2, - RCCallVerticalMargin * 3, RCCallHeaderLength, RCCallHeaderLength); - self.remotePortraitView.image = remoteHeaderImage; - self.remotePortraitView.hidden = NO; - - self.remoteNameLabel.frame = CGRectMake( - RCCallHorizontalMargin, - RCCallVerticalMargin * 3 + RCCallHeaderLength + RCCallInsideMargin, - self.view.frame.size.width - RCCallHorizontalMargin * 2, - RCCallLabelHeight); - self.remoteNameLabel.hidden = NO; - self.remoteNameLabel.textAlignment = NSTextAlignmentCenter; - } else if (callStatus == RCCallIncoming || callStatus == RCCallRinging) { - self.remotePortraitView.frame = CGRectMake( - (self.view.frame.size.width - RCCallHeaderLength) / 2, - RCCallVerticalMargin * 3, RCCallHeaderLength, RCCallHeaderLength); - self.remotePortraitView.image = remoteHeaderImage; - self.remotePortraitView.hidden = NO; - - self.remoteNameLabel.frame = CGRectMake( - RCCallHorizontalMargin, - RCCallVerticalMargin * 3 + RCCallHeaderLength + RCCallInsideMargin, - self.view.frame.size.width - RCCallHorizontalMargin * 2, - RCCallLabelHeight); - self.remoteNameLabel.hidden = NO; - self.remoteNameLabel.textAlignment = NSTextAlignmentCenter; - } +- (void)resetLayout:(BOOL)isMultiCall mediaType:(RCCallMediaType)mediaType callStatus:(RCCallStatus)callStatus { + [super resetLayout:isMultiCall mediaType:mediaType callStatus:callStatus]; + + UIImage *remoteHeaderImage = self.remotePortraitView.image; + + if (mediaType == RCCallMediaAudio) { + self.remotePortraitView.frame = CGRectMake((self.view.frame.size.width - RCCallHeaderLength) / 2, + RCCallVerticalMargin * 3, RCCallHeaderLength, RCCallHeaderLength); + self.remotePortraitView.image = remoteHeaderImage; + self.remotePortraitView.hidden = NO; + + self.remoteNameLabel.frame = + CGRectMake(RCCallHorizontalMargin, RCCallVerticalMargin * 3 + RCCallHeaderLength + RCCallInsideMargin, + self.view.frame.size.width - RCCallHorizontalMargin * 2, RCCallLabelHeight); + self.remoteNameLabel.hidden = NO; - if (callStatus == RCCallActive) { - if ([RCCallKitUtility isLandscape] && - [self isSupportOrientation:[UIDevice currentDevice].orientation]) { - self.subVideoView.frame = CGRectMake( - self.view.frame.size.width - RCCallHeaderLength - - RCCallHorizontalMargin / 2, - RCCallVerticalMargin, RCCallHeaderLength * 1.5, RCCallHeaderLength); - } else { - self.subVideoView.frame = CGRectMake( - self.view.frame.size.width - RCCallHeaderLength - - RCCallHorizontalMargin / 2, - RCCallVerticalMargin, RCCallHeaderLength, RCCallHeaderLength * 1.5); - } - [self.callSession - setVideoView:self.subVideoView - userId:[RCIMClient sharedRCIMClient].currentUserInfo.userId]; - self.subVideoView.hidden = NO; + self.remoteNameLabel.textAlignment = NSTextAlignmentCenter; + self.tipsLabel.textAlignment = NSTextAlignmentCenter; + + self.statusView.frame = CGRectMake((self.view.frame.size.width - 17) / 2, + RCCallVerticalMargin * 3 + (RCCallHeaderLength - 4) / 2, 17, 4); + + if (callStatus == RCCallRinging || callStatus == RCCallDialing || callStatus == RCCallIncoming) { + self.remotePortraitView.alpha = 0.5; + self.statusView.hidden = NO; + } else { + self.statusView.hidden = YES; + self.remotePortraitView.alpha = 1.0; + } + + self.mainVideoView.hidden = YES; + self.subVideoView.hidden = YES; + [self resetRemoteUserInfoIfNeed]; } else { - self.subVideoView.hidden = YES; + if (callStatus == RCCallDialing) { + self.mainVideoView.hidden = NO; + [self.callSession setVideoView:self.mainVideoView + userId:[RCIMClient sharedRCIMClient].currentUserInfo.userId]; + self.blurView.hidden = YES; + } else if (callStatus == RCCallActive) { + self.mainVideoView.hidden = NO; + [self.callSession setVideoView:self.mainVideoView userId:self.callSession.targetId]; + self.blurView.hidden = YES; + } else { + self.mainVideoView.hidden = YES; + } + + if (callStatus == RCCallActive) { + self.remotePortraitView.hidden = YES; + + self.remoteNameLabel.frame = + CGRectMake(RCCallHorizontalMargin, RCCallVerticalMargin, + self.view.frame.size.width - RCCallHorizontalMargin * 2, RCCallLabelHeight); + self.remoteNameLabel.hidden = NO; + self.remoteNameLabel.textAlignment = NSTextAlignmentCenter; + } else if (callStatus == RCCallDialing) { + self.remotePortraitView.frame = + CGRectMake((self.view.frame.size.width - RCCallHeaderLength) / 2, RCCallVerticalMargin * 3, + RCCallHeaderLength, RCCallHeaderLength); + self.remotePortraitView.image = remoteHeaderImage; + self.remotePortraitView.hidden = NO; + + self.remoteNameLabel.frame = + CGRectMake(RCCallHorizontalMargin, RCCallVerticalMargin * 3 + RCCallHeaderLength + RCCallInsideMargin, + self.view.frame.size.width - RCCallHorizontalMargin * 2, RCCallLabelHeight); + self.remoteNameLabel.hidden = NO; + self.remoteNameLabel.textAlignment = NSTextAlignmentCenter; + } else if (callStatus == RCCallIncoming || callStatus == RCCallRinging) { + self.remotePortraitView.frame = + CGRectMake((self.view.frame.size.width - RCCallHeaderLength) / 2, RCCallVerticalMargin * 3, + RCCallHeaderLength, RCCallHeaderLength); + self.remotePortraitView.image = remoteHeaderImage; + self.remotePortraitView.hidden = NO; + + self.remoteNameLabel.frame = + CGRectMake(RCCallHorizontalMargin, RCCallVerticalMargin * 3 + RCCallHeaderLength + RCCallInsideMargin, + self.view.frame.size.width - RCCallHorizontalMargin * 2, RCCallLabelHeight); + self.remoteNameLabel.hidden = NO; + self.remoteNameLabel.textAlignment = NSTextAlignmentCenter; + } + + if (callStatus == RCCallActive) { + if ([RCCallKitUtility isLandscape] && [self isSupportOrientation:(UIInterfaceOrientation)[UIDevice currentDevice].orientation]) { + self.subVideoView.frame = + CGRectMake(self.view.frame.size.width - RCCallHeaderLength - RCCallHorizontalMargin / 2, + RCCallVerticalMargin, RCCallHeaderLength * 1.5, RCCallHeaderLength); + } else { + self.subVideoView.frame = + CGRectMake(self.view.frame.size.width - RCCallHeaderLength - RCCallHorizontalMargin / 2, + RCCallVerticalMargin, RCCallHeaderLength, RCCallHeaderLength * 1.5); + } + [self.callSession setVideoView:self.subVideoView + userId:[RCIMClient sharedRCIMClient].currentUserInfo.userId]; + self.subVideoView.hidden = NO; + } else { + self.subVideoView.hidden = YES; + } + + self.remoteNameLabel.textAlignment = NSTextAlignmentCenter; + self.statusView.frame = CGRectMake((self.view.frame.size.width - 17) / 2, + RCCallVerticalMargin * 3 + (RCCallHeaderLength - 4) / 2, 17, 4); + + if (callStatus == RCCallRinging || callStatus == RCCallDialing || callStatus == RCCallIncoming) { + self.remotePortraitView.alpha = 0.5; + self.statusView.hidden = NO; + } else { + self.statusView.hidden = YES; + self.remotePortraitView.alpha = 1.0; + } } - - self.remoteNameLabel.textAlignment = NSTextAlignmentCenter; - self.statusView.frame = CGRectMake( - (self.view.frame.size.width - 17) / 2, - RCCallVerticalMargin * 3 + (RCCallHeaderLength - 4)/2, 17, 4); - - if (callStatus == RCCallRinging || callStatus == RCCallDialing || callStatus == RCCallIncoming) { - self.remotePortraitView.alpha = 0.5; - self.statusView.hidden = NO; - } else { - self.statusView.hidden = YES; - self.remotePortraitView.alpha = 1.0; - } - } } - (void)resetRemoteUserInfoIfNeed { - if (![self.remoteUserInfo.userId isEqualToString:self.callSession.targetId]) { - RCUserInfo *userInfo = [[RCUserInfoCacheManager sharedManager] - getUserInfo:self.callSession.targetId]; - if (!userInfo) { - userInfo = [[RCUserInfo alloc] initWithUserId:self.callSession.targetId - name:nil - portrait:nil]; + if (![self.remoteUserInfo.userId isEqualToString:self.callSession.targetId]) { + RCUserInfo *userInfo = [[RCUserInfoCacheManager sharedManager] getUserInfo:self.callSession.targetId]; + if (!userInfo) { + userInfo = [[RCUserInfo alloc] initWithUserId:self.callSession.targetId name:nil portrait:nil]; + } + self.remoteUserInfo = userInfo; + [self.remoteNameLabel setText:userInfo.name]; + [self.remotePortraitView setImageURL:[NSURL URLWithString:userInfo.portraitUri]]; } - self.remoteUserInfo = userInfo; - [self.remoteNameLabel setText:userInfo.name]; - [self.remotePortraitView - setImageURL:[NSURL URLWithString:userInfo.portraitUri]]; - } } - (BOOL)isSupportOrientation:(UIInterfaceOrientation)orientation { - return [[UIApplication sharedApplication] - supportedInterfaceOrientationsForWindow:[UIApplication - sharedApplication] - .keyWindow] & - (1 << orientation); + return [[UIApplication sharedApplication] + supportedInterfaceOrientationsForWindow:[UIApplication sharedApplication].keyWindow] & + (1 << orientation); } #pragma mark - UserInfo Update - (void)onUserInfoUpdate:(NSNotification *)notification { - NSDictionary *userInfoDic = notification.object; - NSString *updateUserId = userInfoDic[@"userId"]; - RCUserInfo *updateUserInfo = userInfoDic[@"userInfo"]; - - if ([updateUserId isEqualToString:self.remoteUserInfo.userId]) { - __weak typeof(self) weakSelf = self; - dispatch_async(dispatch_get_main_queue(), ^{ - weakSelf.remoteUserInfo = updateUserInfo; - [weakSelf.remoteNameLabel setText:updateUserInfo.name]; - [weakSelf.remotePortraitView - setImageURL:[NSURL URLWithString:updateUserInfo.portraitUri]]; - }); - } + NSDictionary *userInfoDic = notification.object; + NSString *updateUserId = userInfoDic[@"userId"]; + RCUserInfo *updateUserInfo = userInfoDic[@"userInfo"]; + + if ([updateUserId isEqualToString:self.remoteUserInfo.userId]) { + __weak typeof(self) weakSelf = self; + dispatch_async(dispatch_get_main_queue(), ^{ + weakSelf.remoteUserInfo = updateUserInfo; + [weakSelf.remoteNameLabel setText:updateUserInfo.name]; + [weakSelf.remotePortraitView setImageURL:[NSURL URLWithString:updateUserInfo.portraitUri]]; + }); + } } - (void)dealloc { - [[NSNotificationCenter defaultCenter] removeObserver:self]; + [[NSNotificationCenter defaultCenter] removeObserver:self]; } @end diff --git a/ios-rongcallkit/RongCallKit/Controller/RCCallVideoMultiCallViewController.m b/ios-rongcallkit/RongCallKit/Controller/RCCallVideoMultiCallViewController.m index 7a29d6e..2a739f8 100644 --- a/ios-rongcallkit/RongCallKit/Controller/RCCallVideoMultiCallViewController.m +++ b/ios-rongcallkit/RongCallKit/Controller/RCCallVideoMultiCallViewController.m @@ -21,8 +21,7 @@ #define currentUserId ([RCIMClient sharedRCIMClient].currentUserInfo.userId) #define RongVoIPMultiVideoCellReuseID @"RongVoIPMultiVideoCellReuseID" -@interface RCCallVideoMultiCallViewController () +@interface RCCallVideoMultiCallViewController () @property(nonatomic, strong) RCCallUserCallInfoModel *mainModel; @property(nonatomic, strong) NSMutableArray *subUserModelList; @@ -34,470 +33,415 @@ @interface RCCallVideoMultiCallViewController () 0) { - return [userIdList copy]; - } else { - return nil; - } + NSMutableArray *userIdList = [[NSMutableArray alloc] init]; + for (RCCallUserCallInfoModel *userModel in self.subUserModelList) { + [userIdList addObject:userModel.userId]; + } + if (userIdList.count > 0) { + return [userIdList copy]; + } else { + return nil; + } } - (BOOL)inviterHasHangup { - if ([self.callSession.inviter isEqualToString:currentUserId]) { - if (self.callSession.callStatus == RCCallHangup) { - return YES; + if ([self.callSession.inviter isEqualToString:currentUserId]) { + if (self.callSession.callStatus == RCCallHangup) { + return YES; + } else { + return NO; + } } else { - return NO; - } - } else { - for (RCCallUserProfile *userProfile in self.callSession.userProfileList) { - if ([userProfile.userId isEqualToString:self.callSession.inviter] && - userProfile.callStatus != RCCallHangup) { - return NO; - } + for (RCCallUserProfile *userProfile in self.callSession.userProfileList) { + if ([userProfile.userId isEqualToString:self.callSession.inviter] && + userProfile.callStatus != RCCallHangup) { + return NO; + } + } + return YES; } - return YES; - } } - (RCCallUserCallInfoModel *)getModelInSubUserModelList:(NSString *)userId { - for (RCCallUserCallInfoModel *model in self.subUserModelList) { - if ([model.userId isEqualToString:userId]) { - return model; + for (RCCallUserCallInfoModel *model in self.subUserModelList) { + if ([model.userId isEqualToString:userId]) { + return model; + } } - } - return nil; + return nil; } - (void)updateSubUserLayout:(RCCallUserCallInfoModel *)model { - if (model) { - NSInteger index = [self.subUserModelList indexOfObject:model]; - if (index != NSNotFound) { - NSIndexPath *indexPath = [NSIndexPath indexPathForItem:index inSection:0]; - [self.userCollectionView reloadItemsAtIndexPaths:@[ indexPath ]]; + if (model) { + NSInteger index = [self.subUserModelList indexOfObject:model]; + if (index != NSNotFound) { + NSIndexPath *indexPath = [NSIndexPath indexPathForItem:index inSection:0]; + [self.userCollectionView reloadItemsAtIndexPaths:@[ indexPath ]]; + } } - } } - (void)updateAllSubUserLayout { - [self.userCollectionView reloadData]; + [self.userCollectionView reloadData]; } - (void)addSubUserModel:(RCCallUserCallInfoModel *)model { - if (model.userId && - ![[self getAllUserIdInSubUserModel] containsObject:model.userId]) { - NSInteger index = self.subUserModelList.count; - NSIndexPath *indexPath = [NSIndexPath indexPathForItem:index inSection:0]; - [self.subUserModelList addObject:model]; - [self.userCollectionView - insertItemsAtIndexPaths:[NSArray arrayWithObject:indexPath]]; - } + if (model.userId && ![[self getAllUserIdInSubUserModel] containsObject:model.userId]) { + NSInteger index = self.subUserModelList.count; + NSIndexPath *indexPath = [NSIndexPath indexPathForItem:index inSection:0]; + [self.subUserModelList addObject:model]; + [self.userCollectionView insertItemsAtIndexPaths:[NSArray arrayWithObject:indexPath]]; + } } - (void)removeSubUserModel:(RCCallUserCallInfoModel *)model { - if (model) { - NSInteger index = [self.subUserModelList indexOfObject:model]; - if (index != NSNotFound) { - NSIndexPath *indexPath = [NSIndexPath indexPathForItem:index inSection:0]; - [self.subUserModelList removeObject:model]; - [self.userCollectionView - deleteItemsAtIndexPaths:[NSArray arrayWithObject:indexPath]]; + if (model) { + NSInteger index = [self.subUserModelList indexOfObject:model]; + if (index != NSNotFound) { + NSIndexPath *indexPath = [NSIndexPath indexPathForItem:index inSection:0]; + [self.subUserModelList removeObject:model]; + [self.userCollectionView deleteItemsAtIndexPaths:[NSArray arrayWithObject:indexPath]]; + } } - } } - (void)backgroundViewClicked { - if (self.callSession.callStatus == RCCallActive) { - self.isFullScreen = !self.isFullScreen; + if (self.callSession.callStatus == RCCallActive) { + self.isFullScreen = !self.isFullScreen; - [self resetLayout:self.callSession.isMultiCall - mediaType:self.callSession.mediaType - callStatus:self.callSession.callStatus]; - } + [self resetLayout:self.callSession.isMultiCall + mediaType:self.callSession.mediaType + callStatus:self.callSession.callStatus]; + } } - (RCloudImageView *)inviterPortraitView { - if (!_inviterPortraitView) { - _inviterPortraitView = [[RCloudImageView alloc] init]; - - [self.view addSubview:_inviterPortraitView]; - _inviterPortraitView.hidden = YES; - [_inviterPortraitView - setPlaceholderImage:[RCCallKitUtility getDefaultPortraitImage]]; - _inviterPortraitView.layer.cornerRadius = 4; - _inviterPortraitView.layer.masksToBounds = YES; - } - return _inviterPortraitView; + if (!_inviterPortraitView) { + _inviterPortraitView = [[RCloudImageView alloc] init]; + + [self.view addSubview:_inviterPortraitView]; + _inviterPortraitView.hidden = YES; + [_inviterPortraitView setPlaceholderImage:[RCCallKitUtility getDefaultPortraitImage]]; + _inviterPortraitView.layer.cornerRadius = 4; + _inviterPortraitView.layer.masksToBounds = YES; + } + return _inviterPortraitView; } - (UILabel *)inviterNameLabel { - if (!_inviterNameLabel) { - _inviterNameLabel = [[UILabel alloc] init]; - _inviterNameLabel.backgroundColor = [UIColor clearColor]; - _inviterNameLabel.textColor = [UIColor whiteColor]; - _inviterNameLabel.font = [UIFont systemFontOfSize:18]; - _inviterNameLabel.textAlignment = NSTextAlignmentCenter; - _inviterNameLabel.text = self.mainModel.userInfo.name; - - [self.view addSubview:_inviterNameLabel]; - _inviterNameLabel.hidden = YES; - } - return _inviterNameLabel; + if (!_inviterNameLabel) { + _inviterNameLabel = [[UILabel alloc] init]; + _inviterNameLabel.backgroundColor = [UIColor clearColor]; + _inviterNameLabel.textColor = [UIColor whiteColor]; + _inviterNameLabel.font = [UIFont systemFontOfSize:18]; + _inviterNameLabel.textAlignment = NSTextAlignmentCenter; + _inviterNameLabel.text = self.mainModel.userInfo.name; + + [self.view addSubview:_inviterNameLabel]; + _inviterNameLabel.hidden = YES; + } + return _inviterNameLabel; } - (UILabel *)mainNameLabel { - if (!_mainNameLabel) { - _mainNameLabel = [[UILabel alloc] init]; - _mainNameLabel.backgroundColor = [UIColor clearColor]; - _mainNameLabel.textColor = [UIColor whiteColor]; - _mainNameLabel.font = [UIFont systemFontOfSize:18]; - _mainNameLabel.textAlignment = NSTextAlignmentCenter; - _mainNameLabel.text = self.mainModel.userInfo.name; - - [self.view addSubview:_mainNameLabel]; - _mainNameLabel.hidden = YES; - } - return _mainNameLabel; + if (!_mainNameLabel) { + _mainNameLabel = [[UILabel alloc] init]; + _mainNameLabel.backgroundColor = [UIColor clearColor]; + _mainNameLabel.textColor = [UIColor whiteColor]; + _mainNameLabel.font = [UIFont systemFontOfSize:18]; + _mainNameLabel.textAlignment = NSTextAlignmentCenter; + _mainNameLabel.text = self.mainModel.userInfo.name; + + [self.view addSubview:_mainNameLabel]; + _mainNameLabel.hidden = YES; + } + return _mainNameLabel; } - (UILabel *)userCollectionTitleLabel { - if (!_userCollectionTitleLabel) { - _userCollectionTitleLabel = [[UILabel alloc] init]; - _userCollectionTitleLabel.backgroundColor = [UIColor clearColor]; - _userCollectionTitleLabel.textColor = [UIColor whiteColor]; - _userCollectionTitleLabel.font = [UIFont systemFontOfSize:18]; - _userCollectionTitleLabel.textAlignment = NSTextAlignmentCenter; - _userCollectionTitleLabel.text = NSLocalizedStringFromTable( - @"VoIPMultiCallUserCollectionTitle", @"RongCloudKit", nil); - - [self.view addSubview:_userCollectionTitleLabel]; - _userCollectionTitleLabel.hidden = YES; - } - return _userCollectionTitleLabel; + if (!_userCollectionTitleLabel) { + _userCollectionTitleLabel = [[UILabel alloc] init]; + _userCollectionTitleLabel.backgroundColor = [UIColor clearColor]; + _userCollectionTitleLabel.textColor = [UIColor whiteColor]; + _userCollectionTitleLabel.font = [UIFont systemFontOfSize:18]; + _userCollectionTitleLabel.textAlignment = NSTextAlignmentCenter; + _userCollectionTitleLabel.text = + NSLocalizedStringFromTable(@"VoIPMultiCallUserCollectionTitle", @"RongCloudKit", nil); + + [self.view addSubview:_userCollectionTitleLabel]; + _userCollectionTitleLabel.hidden = YES; + } + return _userCollectionTitleLabel; } - (UICollectionView *)userCollectionView { - if (!_userCollectionView) { - if (self.userCollectionViewLayout) { - _userCollectionView = [[UICollectionView alloc] - initWithFrame:CGRectZero - collectionViewLayout:self.userCollectionViewLayout]; - } else { - RCVideoMultiCallUserCollectionLayout *userCollectionViewLayout = - [[RCVideoMultiCallUserCollectionLayout alloc] initWithItemMargin:5]; - _userCollectionView = - [[UICollectionView alloc] initWithFrame:CGRectZero - collectionViewLayout:userCollectionViewLayout]; + if (!_userCollectionView) { + if (self.userCollectionViewLayout) { + _userCollectionView = + [[UICollectionView alloc] initWithFrame:CGRectZero collectionViewLayout:self.userCollectionViewLayout]; + } else { + RCVideoMultiCallUserCollectionLayout *userCollectionViewLayout = + [[RCVideoMultiCallUserCollectionLayout alloc] initWithItemMargin:5]; + _userCollectionView = + [[UICollectionView alloc] initWithFrame:CGRectZero collectionViewLayout:userCollectionViewLayout]; + } + _userCollectionView.backgroundColor = [UIColor clearColor]; + + [self.view addSubview:_userCollectionView]; + _userCollectionView.hidden = YES; + _userCollectionView.dataSource = self; + _userCollectionView.delegate = self; + [_userCollectionView registerClass:[RCCallMultiCallUserCell class] + forCellWithReuseIdentifier:RongVoIPMultiVideoCellReuseID]; } - _userCollectionView.backgroundColor = [UIColor clearColor]; - - [self.view addSubview:_userCollectionView]; - _userCollectionView.hidden = YES; - _userCollectionView.dataSource = self; - _userCollectionView.delegate = self; - [_userCollectionView registerClass:[RCCallMultiCallUserCell class] - forCellWithReuseIdentifier:RongVoIPMultiVideoCellReuseID]; - } - return _userCollectionView; + return _userCollectionView; } - (void)inviteUserButtonClicked { - [self didTapInviteUserButton]; + [self didTapInviteUserButton]; - if (self.callSession.isMultiCall) { - [self inviteNewUser]; - } else { - NSLog(@"not support add user for conversation type %zd", - self.callSession.conversationType); - } + if (self.callSession.isMultiCall) { + [self inviteNewUser]; + } else { + NSLog(@"not support add user for conversation type %zd", self.callSession.conversationType); + } } - (void)inviteNewUser { - NSMutableArray *existUserIdList = [[NSMutableArray alloc] init]; - for (RCCallUserProfile *userProfile in self.callSession.userProfileList) { - [existUserIdList addObject:userProfile.userId]; - } - [existUserIdList addObject:currentUserId]; - - __weak typeof(self) weakSelf = self; - RCCallSelectMemberViewController *selectViewController = - [[RCCallSelectMemberViewController alloc] - initWithConversationType:self.conversationType - targetId:self.targetId - mediaType:self.mediaType - exist:[existUserIdList copy] - success:^(NSArray *addUserIdList) { - [weakSelf.callSession - inviteRemoteUsers:addUserIdList - mediaType:weakSelf.mediaType]; - }]; - - dispatch_async(dispatch_get_main_queue(), ^{ - [weakSelf presentViewController:selectViewController - animated:YES - completion:nil]; - }); -} - -- (void)resetLayout:(BOOL)isMultiCall - mediaType:(RCCallMediaType)mediaType - callStatus:(RCCallStatus)callStatus { - [super resetLayout:isMultiCall - mediaType:mediaType - callStatus:callStatus]; - - if (callStatus == RCCallIncoming || callStatus == RCCallRinging) { - [self.inviterPortraitView - setImageURL:[NSURL URLWithString:self.mainModel.userInfo.portraitUri]]; - self.inviterPortraitView.frame = CGRectMake( - (self.view.frame.size.width - RCCallHeaderLength) / 2, - RCCallVerticalMargin * 2, RCCallHeaderLength, RCCallHeaderLength); - self.inviterPortraitView.hidden = NO; - - self.inviterNameLabel.text = self.mainModel.userInfo.name; - self.inviterNameLabel.frame = CGRectMake( - RCCallHorizontalMargin, - RCCallVerticalMargin * 2 + RCCallHeaderLength + RCCallInsideMargin, - self.view.frame.size.width - RCCallHorizontalMargin * 2, - RCCallLabelHeight); - self.inviterNameLabel.hidden = NO; - } else { - self.inviterNameLabel.hidden = YES; - self.inviterPortraitView.hidden = YES; - } - - if (callStatus == RCCallActive) { - self.mainNameLabel.frame = - CGRectMake(RCCallHorizontalMargin, RCCallVerticalMargin, - self.view.frame.size.width - RCCallHorizontalMargin * 2, - RCCallLabelHeight); - self.mainNameLabel.hidden = NO; - } else { - self.mainNameLabel.hidden = YES; - } - - CGFloat titleY = MAX(RCCallVerticalMargin * 2 + RCCallHeaderLength + - RCCallInsideMargin * 3 + RCCallLabelHeight * 2, - (self.view.frame.size.height - RCCallLabelHeight) / 2); - if (callStatus == RCCallIncoming || callStatus == RCCallRinging) { - self.userCollectionTitleLabel.frame = - CGRectMake(RCCallHorizontalMargin, titleY, - self.view.frame.size.width - RCCallHorizontalMargin * 2, - RCCallLabelHeight); - self.userCollectionTitleLabel.hidden = NO; - } else { - self.userCollectionTitleLabel.hidden = YES; - } - - if (callStatus == RCCallIncoming || callStatus == RCCallRinging) { - self.userCollectionView.frame = CGRectMake( - RCCallHorizontalMargin * 2.5, - titleY + RCCallLabelHeight + RCCallInsideMargin, - self.view.frame.size.width - RCCallHorizontalMargin * 5, - self.view.frame.size.height - RCCallVerticalMargin - - RCCallButtonLength - RCCallInsideMargin * 4 - RCCallLabelHeight - - (titleY + RCCallLabelHeight + RCCallInsideMargin)); - - if (self.userCollectionViewLayout) { - self.userCollectionView.collectionViewLayout = - self.userCollectionViewLayout; + NSMutableArray *existUserIdList = [[NSMutableArray alloc] init]; + for (RCCallUserProfile *userProfile in self.callSession.userProfileList) { + [existUserIdList addObject:userProfile.userId]; + } + [existUserIdList addObject:currentUserId]; + + __weak typeof(self) weakSelf = self; + RCCallSelectMemberViewController *selectViewController = [[RCCallSelectMemberViewController alloc] + initWithConversationType:self.conversationType + targetId:self.targetId + mediaType:self.mediaType + exist:[existUserIdList copy] + success:^(NSArray *addUserIdList) { + [weakSelf.callSession inviteRemoteUsers:addUserIdList mediaType:weakSelf.mediaType]; + }]; + + dispatch_async(dispatch_get_main_queue(), ^{ + [weakSelf presentViewController:selectViewController animated:YES completion:nil]; + }); +} + +- (void)resetLayout:(BOOL)isMultiCall mediaType:(RCCallMediaType)mediaType callStatus:(RCCallStatus)callStatus { + [super resetLayout:isMultiCall mediaType:mediaType callStatus:callStatus]; + + if (callStatus == RCCallIncoming || callStatus == RCCallRinging) { + [self.inviterPortraitView setImageURL:[NSURL URLWithString:self.mainModel.userInfo.portraitUri]]; + self.inviterPortraitView.frame = CGRectMake((self.view.frame.size.width - RCCallHeaderLength) / 2, + RCCallVerticalMargin * 2, RCCallHeaderLength, RCCallHeaderLength); + self.inviterPortraitView.hidden = NO; + + self.inviterNameLabel.text = self.mainModel.userInfo.name; + self.inviterNameLabel.frame = + CGRectMake(RCCallHorizontalMargin, RCCallVerticalMargin * 2 + RCCallHeaderLength + RCCallInsideMargin, + self.view.frame.size.width - RCCallHorizontalMargin * 2, RCCallLabelHeight); + self.inviterNameLabel.hidden = NO; } else { - RCAudioMultiCallUserCollectionLayout *userCollectionViewLayout = - [[RCAudioMultiCallUserCollectionLayout alloc] initWithItemMargin:5 - buttomPadding:10]; - [self.userCollectionView setCollectionViewLayout:userCollectionViewLayout - animated:YES]; + self.inviterNameLabel.hidden = YES; + self.inviterPortraitView.hidden = YES; } - self.userCollectionView.hidden = NO; - } else if (callStatus == RCCallDialing || - (callStatus == RCCallActive && !self.isFullScreen)) { - self.userCollectionView.frame = - CGRectMake(0, self.view.frame.size.height - RCCallVerticalMargin - - RCCallButtonLength * 3.5 - RCCallInsideMargin * 2, - self.view.frame.size.width, RCCallButtonLength * 2.5); - - if (self.userCollectionViewLayout) { - self.userCollectionView.collectionViewLayout = - self.userCollectionViewLayout; + + if (callStatus == RCCallActive) { + self.mainNameLabel.frame = + CGRectMake(RCCallHorizontalMargin, RCCallVerticalMargin, + self.view.frame.size.width - RCCallHorizontalMargin * 2, RCCallLabelHeight); + self.mainNameLabel.hidden = NO; + } else { + self.mainNameLabel.hidden = YES; + } + + CGFloat titleY = MAX(RCCallVerticalMargin * 2 + RCCallHeaderLength + RCCallInsideMargin * 3 + RCCallLabelHeight * 2, + (self.view.frame.size.height - RCCallLabelHeight) / 2); + if (callStatus == RCCallIncoming || callStatus == RCCallRinging) { + self.userCollectionTitleLabel.frame = CGRectMake( + RCCallHorizontalMargin, titleY, self.view.frame.size.width - RCCallHorizontalMargin * 2, RCCallLabelHeight); + self.userCollectionTitleLabel.hidden = NO; } else { - RCVideoMultiCallUserCollectionLayout *userCollectionViewLayout = - [[RCVideoMultiCallUserCollectionLayout alloc] initWithItemMargin:5]; - [self.userCollectionView setCollectionViewLayout:userCollectionViewLayout - animated:YES]; + self.userCollectionTitleLabel.hidden = YES; + } + + if (callStatus == RCCallIncoming || callStatus == RCCallRinging) { + self.userCollectionView.frame = CGRectMake( + RCCallHorizontalMargin * 2.5, titleY + RCCallLabelHeight + RCCallInsideMargin, + self.view.frame.size.width - RCCallHorizontalMargin * 5, + self.view.frame.size.height - RCCallVerticalMargin - RCCallButtonLength - RCCallInsideMargin * 4 - + RCCallLabelHeight - (titleY + RCCallLabelHeight + RCCallInsideMargin)); + + if (self.userCollectionViewLayout) { + self.userCollectionView.collectionViewLayout = self.userCollectionViewLayout; + } else { + RCAudioMultiCallUserCollectionLayout *userCollectionViewLayout = + [[RCAudioMultiCallUserCollectionLayout alloc] initWithItemMargin:5 buttomPadding:10]; + [self.userCollectionView setCollectionViewLayout:userCollectionViewLayout animated:YES]; + } + self.userCollectionView.hidden = NO; + } else if (callStatus == RCCallDialing || (callStatus == RCCallActive && !self.isFullScreen)) { + self.userCollectionView.frame = CGRectMake( + 0, self.view.frame.size.height - RCCallVerticalMargin - RCCallButtonLength * 3.5 - RCCallInsideMargin * 2, + self.view.frame.size.width, RCCallButtonLength * 2.5); + + if (self.userCollectionViewLayout) { + self.userCollectionView.collectionViewLayout = self.userCollectionViewLayout; + } else { + RCVideoMultiCallUserCollectionLayout *userCollectionViewLayout = + [[RCVideoMultiCallUserCollectionLayout alloc] initWithItemMargin:5]; + [self.userCollectionView setCollectionViewLayout:userCollectionViewLayout animated:YES]; + } + self.userCollectionView.hidden = NO; + } else if (callStatus == RCCallActive && self.isFullScreen) { + self.userCollectionView.frame = + CGRectMake(0, self.view.frame.size.height - RCCallInsideMargin - RCCallButtonLength * 2.5, + self.view.frame.size.width, RCCallButtonLength * 2.5); + self.userCollectionView.hidden = NO; + } + + if (callStatus == RCCallActive) { + self.minimizeButton.hidden = self.isFullScreen; + self.cameraSwitchButton.hidden = self.isFullScreen; + self.inviteUserButton.hidden = self.isFullScreen; + self.muteButton.hidden = self.isFullScreen; + self.hangupButton.hidden = self.isFullScreen; + self.cameraCloseButton.hidden = self.isFullScreen; } - self.userCollectionView.hidden = NO; - } else if (callStatus == RCCallActive && self.isFullScreen) { - self.userCollectionView.frame = - CGRectMake(0, self.view.frame.size.height - RCCallInsideMargin - - RCCallButtonLength * 2.5, - self.view.frame.size.width, RCCallButtonLength * 2.5); - self.userCollectionView.hidden = NO; - } - - if (callStatus == RCCallActive) { - self.minimizeButton.hidden = self.isFullScreen; - self.cameraSwitchButton.hidden = self.isFullScreen; - self.inviteUserButton.hidden = self.isFullScreen; - self.muteButton.hidden = self.isFullScreen; - self.hangupButton.hidden = self.isFullScreen; - self.cameraCloseButton.hidden = self.isFullScreen; - } } #pragma mark - RCCallSessionDelegate @@ -506,13 +450,12 @@ - (void)resetLayout:(BOOL)isMultiCall 通话已接通 */ - (void)callDidConnect { - [self.userCollectionView removeFromSuperview]; - _userCollectionView = nil; - [self userCollectionView]; - [self updateAllSubUserLayout]; - [self.callSession setVideoView:self.backgroundView - userId:self.mainModel.userId]; - [super callDidConnect]; + [self.userCollectionView removeFromSuperview]; + _userCollectionView = nil; + [self userCollectionView]; + [self updateAllSubUserLayout]; + [self.callSession setVideoView:self.backgroundView userId:self.mainModel.userId]; + [super callDidConnect]; } /*! @@ -521,8 +464,8 @@ - (void)callDidConnect { @param userId 对端的用户ID */ - (void)remoteUserDidRing:(NSString *)userId { - RCCallUserCallInfoModel *model = [self getModelInSubUserModelList:userId]; - [self updateSubUserLayout:model]; + RCCallUserCallInfoModel *model = [self getModelInSubUserModelList:userId]; + [self updateSubUserLayout:model]; } /*! @@ -531,29 +474,23 @@ - (void)remoteUserDidRing:(NSString *)userId { @param userId 被邀请的用户ID @param mediaType 希望被邀请者选择的媒体类型 */ -- (void)remoteUserDidInvite:(NSString *)userId - mediaType:(RCCallMediaType)mediaType { - RCCallUserCallInfoModel *model = [self generateUserModel:userId]; - [self addSubUserModel:model]; - - NSString *userName = - [[RCUserInfoCacheManager sharedManager] getUserInfo:userId].name; - if (userName) { - NSString *inviteTips = [NSString - stringWithFormat:NSLocalizedStringFromTable(@"VoIPCallRemoteDidInvite", - @"RongCloudKit", nil), - userName]; - self.tipsLabel.text = inviteTips; - - __weak typeof(self) weakSelf = self; - dispatch_after( - dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), - dispatch_get_main_queue(), ^{ - if ([weakSelf.tipsLabel.text isEqualToString:inviteTips]) { - weakSelf.tipsLabel.text = @""; - } +- (void)remoteUserDidInvite:(NSString *)userId mediaType:(RCCallMediaType)mediaType { + RCCallUserCallInfoModel *model = [self generateUserModel:userId]; + [self addSubUserModel:model]; + + NSString *userName = [[RCUserInfoCacheManager sharedManager] getUserInfo:userId].name; + if (userName) { + NSString *inviteTips = [NSString + stringWithFormat:NSLocalizedStringFromTable(@"VoIPCallRemoteDidInvite", @"RongCloudKit", nil), userName]; + self.tipsLabel.text = inviteTips; + + __weak typeof(self) weakSelf = self; + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ + if ([weakSelf.tipsLabel.text isEqualToString:inviteTips]) { + weakSelf.tipsLabel.text = @""; + } }); - } + } } /*! @@ -562,16 +499,15 @@ - (void)remoteUserDidInvite:(NSString *)userId @param userId 用户ID @param mediaType 用户的媒体类型 */ -- (void)remoteUserDidJoin:(NSString *)userId - mediaType:(RCCallMediaType)mediaType { - if (![userId isEqualToString:self.mainModel.userId]) { - RCCallUserCallInfoModel *model = [self getModelInSubUserModelList:userId]; - if (!model) { - [self addSubUserModel:[self generateUserModel:userId]]; - } else { - [self updateSubUserLayout:model]; +- (void)remoteUserDidJoin:(NSString *)userId mediaType:(RCCallMediaType)mediaType { + if (![userId isEqualToString:self.mainModel.userId]) { + RCCallUserCallInfoModel *model = [self getModelInSubUserModelList:userId]; + if (!model) { + [self addSubUserModel:[self generateUserModel:userId]]; + } else { + [self updateSubUserLayout:model]; + } } - } } /*! @@ -581,11 +517,11 @@ - (void)remoteUserDidJoin:(NSString *)userId @param muted 是否关闭camera */ - (void)remoteUserDidDisableCamera:(BOOL)muted byUser:(NSString *)userId { - if ([userId isEqualToString:self.mainModel.userId] && muted) { - self.backgroundView.backgroundColor = RongVoIPUIColorFromRGB(0x262e42); - } else { - [self updateSubUserLayout:[self getModelInSubUserModelList:userId]]; - } + if ([userId isEqualToString:self.mainModel.userId] && muted) { + self.backgroundView.backgroundColor = RongVoIPUIColorFromRGB(0x262e42); + } else { + [self updateSubUserLayout:[self getModelInSubUserModelList:userId]]; + } } /*! @@ -594,95 +530,84 @@ - (void)remoteUserDidDisableCamera:(BOOL)muted byUser:(NSString *)userId { @param userId 用户ID @param reason 挂断的原因 */ -- (void)remoteUserDidLeft:(NSString *)userId - reason:(RCCallDisconnectReason)reason { - if ([userId isEqualToString:self.mainModel.userId]) { - if (self.callSession.callStatus == RCCallIncoming || - self.callSession.callStatus == RCCallRinging || - self.callSession.callStatus == RCCallActive) { - RCCallUserCallInfoModel *tempModel = self.subUserModelList[0]; - self.mainModel = tempModel; - [self.callSession setVideoView:self.backgroundView - userId:self.mainModel.userId]; - self.mainNameLabel.text = tempModel.userInfo.name; - if (self.callSession.callStatus == RCCallIncoming || - self.callSession.callStatus == RCCallRinging) { - self.inviterNameLabel.text = tempModel.userInfo.name; - } - - [self.subUserModelList removeObject:tempModel]; - [self updateAllSubUserLayout]; - } - } else { - for (RCCallUserCallInfoModel *userModel in self.subUserModelList) { - if ([userId isEqualToString:userModel.userId]) { - [self removeSubUserModel:userModel]; - break; - } +- (void)remoteUserDidLeft:(NSString *)userId reason:(RCCallDisconnectReason)reason { + if ([userId isEqualToString:self.mainModel.userId]) { + if (self.callSession.callStatus == RCCallIncoming || self.callSession.callStatus == RCCallRinging || + self.callSession.callStatus == RCCallActive) { + RCCallUserCallInfoModel *tempModel = self.subUserModelList[0]; + self.mainModel = tempModel; + [self.callSession setVideoView:self.backgroundView userId:self.mainModel.userId]; + self.mainNameLabel.text = tempModel.userInfo.name; + if (self.callSession.callStatus == RCCallIncoming || self.callSession.callStatus == RCCallRinging) { + self.inviterNameLabel.text = tempModel.userInfo.name; + } + + [self.subUserModelList removeObject:tempModel]; + [self updateAllSubUserLayout]; + } + } else { + for (RCCallUserCallInfoModel *userModel in self.subUserModelList) { + if ([userId isEqualToString:userModel.userId]) { + [self removeSubUserModel:userModel]; + break; + } + } } - } } #pragma mark - UICollectionViewDataSource -- (NSInteger)collectionView:(UICollectionView *)collectionView - numberOfItemsInSection:(NSInteger)section { - return self.subUserModelList.count; +- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section { + return self.subUserModelList.count; } - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath { - RCCallMultiCallUserCell *cell = [collectionView - dequeueReusableCellWithReuseIdentifier:RongVoIPMultiVideoCellReuseID - forIndexPath:indexPath]; - RCCallUserCallInfoModel *userModel = self.subUserModelList[indexPath.row]; - [cell setModel:userModel status:self.callSession.callStatus]; - [self.callSession setVideoView:(UIView *)cell.headerImageView - userId:userModel.userId]; - return cell; + RCCallMultiCallUserCell *cell = + [collectionView dequeueReusableCellWithReuseIdentifier:RongVoIPMultiVideoCellReuseID forIndexPath:indexPath]; + RCCallUserCallInfoModel *userModel = self.subUserModelList[indexPath.row]; + [cell setModel:userModel status:self.callSession.callStatus]; + [self.callSession setVideoView:(UIView *)cell.headerImageView userId:userModel.userId]; + return cell; } -- (void)collectionView:(UICollectionView *)collectionView - didSelectItemAtIndexPath:(NSIndexPath *)indexPath { - RCCallUserCallInfoModel *tempModel = self.mainModel; - RCCallUserCallInfoModel *selectedModel = self.subUserModelList[indexPath.row]; +- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath { + RCCallUserCallInfoModel *tempModel = self.mainModel; + RCCallUserCallInfoModel *selectedModel = self.subUserModelList[indexPath.row]; - self.mainModel = selectedModel; - [self.callSession setVideoView:self.backgroundView - userId:self.mainModel.userId]; - self.mainNameLabel.text = selectedModel.userInfo.name; - [self.subUserModelList removeObject:selectedModel]; - [self.subUserModelList insertObject:tempModel atIndex:indexPath.row]; + self.mainModel = selectedModel; + [self.callSession setVideoView:self.backgroundView userId:self.mainModel.userId]; + self.mainNameLabel.text = selectedModel.userInfo.name; + [self.subUserModelList removeObject:selectedModel]; + [self.subUserModelList insertObject:tempModel atIndex:indexPath.row]; - [self updateSubUserLayout:tempModel]; + [self updateSubUserLayout:tempModel]; } #pragma mark - UserInfo Update - (void)onUserInfoUpdate:(NSNotification *)notification { - NSDictionary *userInfoDic = notification.object; - NSString *updateUserId = userInfoDic[@"userId"]; - RCUserInfo *updateUserInfo = userInfoDic[@"userInfo"]; - - __weak typeof(self) weakSelf = self; - dispatch_async(dispatch_get_main_queue(), ^{ - if ([updateUserId isEqualToString:weakSelf.mainModel.userId]) { - weakSelf.mainModel.userInfo = updateUserInfo; - weakSelf.mainNameLabel.text = updateUserInfo.name; - weakSelf.inviterNameLabel.text = updateUserInfo.name; - [weakSelf.inviterPortraitView - setImageURL:[NSURL URLWithString:updateUserInfo.portraitUri]]; - } else { - RCCallUserCallInfoModel *model = - [weakSelf getModelInSubUserModelList:updateUserInfo.userId]; - if (model) { - model.userInfo = updateUserInfo; - [weakSelf updateSubUserLayout:model]; - } - } - }); + NSDictionary *userInfoDic = notification.object; + NSString *updateUserId = userInfoDic[@"userId"]; + RCUserInfo *updateUserInfo = userInfoDic[@"userInfo"]; + + __weak typeof(self) weakSelf = self; + dispatch_async(dispatch_get_main_queue(), ^{ + if ([updateUserId isEqualToString:weakSelf.mainModel.userId]) { + weakSelf.mainModel.userInfo = updateUserInfo; + weakSelf.mainNameLabel.text = updateUserInfo.name; + weakSelf.inviterNameLabel.text = updateUserInfo.name; + [weakSelf.inviterPortraitView setImageURL:[NSURL URLWithString:updateUserInfo.portraitUri]]; + } else { + RCCallUserCallInfoModel *model = [weakSelf getModelInSubUserModelList:updateUserInfo.userId]; + if (model) { + model.userInfo = updateUserInfo; + [weakSelf updateSubUserLayout:model]; + } + } + }); } - (void)dealloc { - [[NSNotificationCenter defaultCenter] removeObserver:self]; + [[NSNotificationCenter defaultCenter] removeObserver:self]; } @end diff --git a/ios-rongcallkit/RongCallKit/Extension/RCCallKitExtensionModule.h b/ios-rongcallkit/RongCallKit/Extension/RCCallKitExtensionModule.h index 6ff453b..d03fa56 100644 --- a/ios-rongcallkit/RongCallKit/Extension/RCCallKitExtensionModule.h +++ b/ios-rongcallkit/RongCallKit/Extension/RCCallKitExtensionModule.h @@ -7,12 +7,12 @@ // #import -#import #import +#import /*! CallKit 插件类 - + @discussion IMKit会通过这个类将CallKit加载起来。 */ @interface RCCallKitExtensionModule : NSObject diff --git a/ios-rongcallkit/RongCallKit/Extension/RCCallKitExtensionModule.m b/ios-rongcallkit/RongCallKit/Extension/RCCallKitExtensionModule.m index db2d4d2..f33924b 100644 --- a/ios-rongcallkit/RongCallKit/Extension/RCCallKitExtensionModule.m +++ b/ios-rongcallkit/RongCallKit/Extension/RCCallKitExtensionModule.m @@ -7,124 +7,132 @@ // #import "RCCallKitExtensionModule.h" -#import "RCCallDetailMessageCell.h" -#import "RCCallTipMessageCell.h" #import "RCCall.h" +#import "RCCallDetailMessageCell.h" #import "RCCallKitUtility.h" +#import "RCCallTipMessageCell.h" @implementation RCCallKitExtensionModule /*! CallKit 插件生成方法 - + @warning IMKit会通过这个方法生成并加载CallKit,强烈建议不要删除其中的逻辑,否则肯能导致CallKit功能不正常。 */ + (instancetype)loadRongExtensionModule { - [RCCall sharedRCCall]; - return [[RCCallKitExtensionModule alloc] init]; + [RCCall sharedRCCall]; + return [[RCCallKitExtensionModule alloc] init]; } - (void)destroyModule { - } - (NSArray *)getMessageCellInfoList:(RCConversationType)conversationType targetId:(NSString *)targetId { - if (conversationType == ConversationType_PRIVATE) { - RCExtensionMessageCellInfo *cellInfo = [RCExtensionMessageCellInfo new]; - cellInfo.messageContentClass = [RCCallSummaryMessage class]; - cellInfo.messageCellClass = [RCCallDetailMessageCell class]; - return @[cellInfo]; - } else if (conversationType == ConversationType_GROUP || conversationType == ConversationType_DISCUSSION) { - RCExtensionMessageCellInfo *cellInfo = [RCExtensionMessageCellInfo new]; - cellInfo.messageContentClass = [RCCallSummaryMessage class]; - cellInfo.messageCellClass = [RCCallTipMessageCell class]; - return @[cellInfo]; - } - return nil; + if (conversationType == ConversationType_PRIVATE) { + RCExtensionMessageCellInfo *cellInfo = [RCExtensionMessageCellInfo new]; + cellInfo.messageContentClass = [RCCallSummaryMessage class]; + cellInfo.messageCellClass = [RCCallDetailMessageCell class]; + return @[ cellInfo ]; + } else if (conversationType == ConversationType_GROUP || conversationType == ConversationType_DISCUSSION) { + RCExtensionMessageCellInfo *cellInfo = [RCExtensionMessageCellInfo new]; + cellInfo.messageContentClass = [RCCallSummaryMessage class]; + cellInfo.messageCellClass = [RCCallTipMessageCell class]; + return @[ cellInfo ]; + } + return nil; } - - (void)didTapMessageCell:(RCMessageModel *)messageModel { - if ([messageModel.content isKindOfClass:[RCCallSummaryMessage class]]) { - RCCallSummaryMessage *callMessage = (RCCallSummaryMessage *)messageModel.content; - if (messageModel.conversationType == ConversationType_PRIVATE) { - [[RCCall sharedRCCall] startSingleCall:messageModel.targetId mediaType:callMessage.mediaType]; + if ([messageModel.content isKindOfClass:[RCCallSummaryMessage class]]) { + RCCallSummaryMessage *callMessage = (RCCallSummaryMessage *)messageModel.content; + if (messageModel.conversationType == ConversationType_PRIVATE) { + [[RCCall sharedRCCall] startSingleCall:messageModel.targetId mediaType:callMessage.mediaType]; + } } - } } - (NSArray *)getPluginBoardItemInfoList:(RCConversationType)conversationType - targetId:(NSString *)targetId { - NSMutableArray *itemList = [[NSMutableArray alloc] init]; - - if ([[RCCall sharedRCCall] isAudioCallEnabled:conversationType]) { - RCExtensionPluginItemInfo *audioItem = [[RCExtensionPluginItemInfo alloc] init]; - audioItem.image = [RCCallKitUtility imageFromVoIPBundle:@"voip/actionbar_audio_call_icon.png"]; - audioItem.title = NSLocalizedStringFromTable(@"VoIPAudioCall", @"RongCloudKit", nil); - if (conversationType == ConversationType_PRIVATE) { - audioItem.tapBlock = ^(RCChatSessionInputBarControl *chatSessionInputBar){[[RCCall sharedRCCall] startSingleCall:targetId mediaType:RCCallMediaAudio];}; - } else if (conversationType == ConversationType_GROUP || conversationType == ConversationType_DISCUSSION) { - audioItem.tapBlock = ^(RCChatSessionInputBarControl *chatSessionInputBar){[[RCCall sharedRCCall] startMultiCall:conversationType targetId:targetId mediaType:RCCallMediaAudio];}; + targetId:(NSString *)targetId { + NSMutableArray *itemList = [[NSMutableArray alloc] init]; + + if ([[RCCall sharedRCCall] isAudioCallEnabled:conversationType]) { + RCExtensionPluginItemInfo *audioItem = [[RCExtensionPluginItemInfo alloc] init]; + audioItem.image = [RCCallKitUtility imageFromVoIPBundle:@"voip/actionbar_audio_call_icon.png"]; + audioItem.title = NSLocalizedStringFromTable(@"VoIPAudioCall", @"RongCloudKit", nil); + if (conversationType == ConversationType_PRIVATE) { + audioItem.tapBlock = ^(RCChatSessionInputBarControl *chatSessionInputBar) { + [[RCCall sharedRCCall] startSingleCall:targetId mediaType:RCCallMediaAudio]; + }; + } else if (conversationType == ConversationType_GROUP || conversationType == ConversationType_DISCUSSION) { + audioItem.tapBlock = ^(RCChatSessionInputBarControl *chatSessionInputBar) { + [[RCCall sharedRCCall] startMultiCall:conversationType targetId:targetId mediaType:RCCallMediaAudio]; + }; + } + audioItem.tag = PLUGIN_BOARD_ITEM_VOIP_TAG; + [itemList addObject:audioItem]; } - audioItem.tag = PLUGIN_BOARD_ITEM_VOIP_TAG; - [itemList addObject:audioItem]; - } - if ([[RCCall sharedRCCall] isVideoCallEnabled:conversationType]) { - RCExtensionPluginItemInfo *videoItem = [[RCExtensionPluginItemInfo alloc] init]; - videoItem.image = [RCCallKitUtility imageFromVoIPBundle:@"voip/actionbar_video_call_icon.png"]; - videoItem.title = NSLocalizedStringFromTable(@"VoIPVideoCall", @"RongCloudKit", nil); - videoItem.tapBlock = ^(RCChatSessionInputBarControl *chatSessionInputBar){[[RCCall sharedRCCall] startSingleCall:targetId mediaType:RCCallMediaVideo];}; - if (conversationType == ConversationType_PRIVATE) { - videoItem.tapBlock = ^(RCChatSessionInputBarControl *chatSessionInputBar){[[RCCall sharedRCCall] startSingleCall:targetId mediaType:RCCallMediaVideo];}; - } else if (conversationType == ConversationType_GROUP || conversationType == ConversationType_DISCUSSION) { - videoItem.tapBlock = ^(RCChatSessionInputBarControl *chatSessionInputBar){[[RCCall sharedRCCall] startMultiCall:conversationType targetId:targetId mediaType:RCCallMediaVideo];}; + if ([[RCCall sharedRCCall] isVideoCallEnabled:conversationType]) { + RCExtensionPluginItemInfo *videoItem = [[RCExtensionPluginItemInfo alloc] init]; + videoItem.image = [RCCallKitUtility imageFromVoIPBundle:@"voip/actionbar_video_call_icon.png"]; + videoItem.title = NSLocalizedStringFromTable(@"VoIPVideoCall", @"RongCloudKit", nil); + videoItem.tapBlock = ^(RCChatSessionInputBarControl *chatSessionInputBar) { + [[RCCall sharedRCCall] startSingleCall:targetId mediaType:RCCallMediaVideo]; + }; + if (conversationType == ConversationType_PRIVATE) { + videoItem.tapBlock = ^(RCChatSessionInputBarControl *chatSessionInputBar) { + [[RCCall sharedRCCall] startSingleCall:targetId mediaType:RCCallMediaVideo]; + }; + } else if (conversationType == ConversationType_GROUP || conversationType == ConversationType_DISCUSSION) { + videoItem.tapBlock = ^(RCChatSessionInputBarControl *chatSessionInputBar) { + [[RCCall sharedRCCall] startMultiCall:conversationType targetId:targetId mediaType:RCCallMediaVideo]; + }; + } + videoItem.tag = PLUGIN_BOARD_ITEM_VIDEO_VOIP_TAG; + [itemList addObject:videoItem]; } - videoItem.tag = PLUGIN_BOARD_ITEM_VIDEO_VOIP_TAG; - [itemList addObject:videoItem]; - } - return [itemList copy]; + return [itemList copy]; } - (void)onMessageReceived:(RCMessage *)message { - } - (BOOL)handleAlertForMessageReceived:(RCMessage *)message { - if ([message.content isKindOfClass:[RCCallSummaryMessage class]]) { - return YES; - } else if ([RCCall sharedRCCall].currentCallSession.callStatus == RCCallActive) { - return YES; - } else { - return NO; - } + if ([message.content isKindOfClass:[RCCallSummaryMessage class]]) { + return YES; + } else if ([RCCall sharedRCCall].currentCallSession.callStatus == RCCallActive) { + return YES; + } else { + return NO; + } } -- (BOOL)handleNotificationForMessageReceived:(RCMessage *)message from:(NSString *)fromName userInfo:(NSDictionary *)userInfo { - if ([message.content isKindOfClass:[RCCallSummaryMessage class]]) { - //Todo post call end notification here? - return YES; - } else { - return NO; - } +- (BOOL)handleNotificationForMessageReceived:(RCMessage *)message + from:(NSString *)fromName + userInfo:(NSDictionary *)userInfo { + if ([message.content isKindOfClass:[RCCallSummaryMessage class]]) { + // Todo post call end notification here? + return YES; + } else { + return NO; + } } - (BOOL)isAudioHolding { - if ([RCCall sharedRCCall].currentCallSession) { - return YES; - } else { - return NO; - } + if ([RCCall sharedRCCall].currentCallSession) { + return YES; + } else { + return NO; + } } - (BOOL)isCameraHolding { - if ([RCCall sharedRCCall].currentCallSession - && [RCCall sharedRCCall].currentCallSession.mediaType == RCCallMediaVideo) { - return YES; - } else { - return NO; - } + if ([RCCall sharedRCCall].currentCallSession && + [RCCall sharedRCCall].currentCallSession.mediaType == RCCallMediaVideo) { + return YES; + } else { + return NO; + } } - @end diff --git a/ios-rongcallkit/RongCallKit/Header/RCUserInfoCacheManager.h b/ios-rongcallkit/RongCallKit/Header/RCUserInfoCacheManager.h index 690e8e7..7cc05c8 100644 --- a/ios-rongcallkit/RongCallKit/Header/RCUserInfoCacheManager.h +++ b/ios-rongcallkit/RongCallKit/Header/RCUserInfoCacheManager.h @@ -15,8 +15,7 @@ FOUNDATION_EXPORT NSString *const RCKitDispatchUserInfoUpdateNotification; FOUNDATION_EXPORT NSString *const RCKitDispatchGroupUserInfoUpdateNotification; FOUNDATION_EXPORT NSString *const RCKitDispatchGroupInfoUpdateNotification; -#define rcUserInfoWorkingDBHelper \ - ([RCUserInfoCacheManager sharedManager].workingDBHelper) +#define rcUserInfoWorkingDBHelper ([RCUserInfoCacheManager sharedManager].workingDBHelper) #define rcUserInfoDBQueue ([RCUserInfoCacheManager sharedManager].dbQueue) @interface RCUserInfoCacheManager : NSObject @@ -36,8 +35,7 @@ FOUNDATION_EXPORT NSString *const RCKitDispatchGroupInfoUpdateNotification; - (RCUserInfo *)getUserInfo:(NSString *)userId; //从cache和用户信息提供者取 -- (void)getUserInfo:(NSString *)userId - complete:(void (^)(RCUserInfo *userInfo))completeBlock; +- (void)getUserInfo:(NSString *)userId complete:(void (^)(RCUserInfo *userInfo))completeBlock; //只获取当前cache中的用户信息,不进行任何回调 - (RCUserInfo *)getUserInfoFromCacheOnly:(NSString *)userId; @@ -60,15 +58,11 @@ FOUNDATION_EXPORT NSString *const RCKitDispatchGroupInfoUpdateNotification; inGroupId:(NSString *)groupId complete:(void (^)(RCUserInfo *userInfo))completeBlock; -- (RCUserInfo *)getUserInfoFromCacheOnly:(NSString *)userId - inGroupId:(NSString *)groupId; +- (RCUserInfo *)getUserInfoFromCacheOnly:(NSString *)userId inGroupId:(NSString *)groupId; -- (void)updateUserInfo:(RCUserInfo *)userInfo - forUserId:(NSString *)userId - inGroup:(NSString *)groupId; +- (void)updateUserInfo:(RCUserInfo *)userInfo forUserId:(NSString *)userId inGroup:(NSString *)groupId; -- (void)clearGroupUserInfoNetworkCacheOnly:(NSString *)userId - inGroup:(NSString *)groupId; +- (void)clearGroupUserInfoNetworkCacheOnly:(NSString *)userId inGroup:(NSString *)groupId; - (void)clearGroupUserInfo:(NSString *)userId inGroup:(NSString *)groupId; @@ -78,8 +72,7 @@ FOUNDATION_EXPORT NSString *const RCKitDispatchGroupInfoUpdateNotification; - (RCGroup *)getGroupInfo:(NSString *)groupId; -- (void)getGroupInfo:(NSString *)groupId - complete:(void (^)(RCGroup *groupInfo))completeBlock; +- (void)getGroupInfo:(NSString *)groupId complete:(void (^)(RCGroup *groupInfo))completeBlock; - (RCGroup *)getGroupInfoFromCacheOnly:(NSString *)groupId; diff --git a/ios-rongcallkit/RongCallKit/Header/RCloudImageLoader.h b/ios-rongcallkit/RongCallKit/Header/RCloudImageLoader.h index 2031e6e..0926061 100644 --- a/ios-rongcallkit/RongCallKit/Header/RCloudImageLoader.h +++ b/ios-rongcallkit/RongCallKit/Header/RCloudImageLoader.h @@ -39,14 +39,14 @@ @protocol RCloudImageLoaderObserver; @interface RCloudImageLoader : NSObject /**/ { -@private - NSDictionary *_currentConnections; - NSMutableDictionary *currentConnections; + @private + NSDictionary *_currentConnections; + NSMutableDictionary *currentConnections; #if __EGOIL_USE_BLOCKS - dispatch_queue_t _operationQueue; + dispatch_queue_t _operationQueue; #endif - NSLock *connectionsLock; + NSLock *connectionsLock; } + (RCloudImageLoader *)sharedImageLoader; @@ -54,25 +54,19 @@ - (BOOL)isLoadingImageURL:(NSURL *)aURL; #if __EGOIL_USE_NOTIF -- (void)loadImageForURL:(NSURL *)aURL - observer:(id)observer; -- (UIImage *)imageForURL:(NSURL *)aURL - shouldLoadWithObserver:(id)observer; +- (void)loadImageForURL:(NSURL *)aURL observer:(id)observer; +- (UIImage *)imageForURL:(NSURL *)aURL shouldLoadWithObserver:(id)observer; - (void)removeObserver:(id)observer; -- (void)removeObserver:(id)observer - forURL:(NSURL *)aURL; +- (void)removeObserver:(id)observer forURL:(NSURL *)aURL; #endif #if __EGOIL_USE_BLOCKS -- (void)loadImageForURL:(NSURL *)aURL - completion:(void (^)(UIImage *image, NSURL *imageURL, - NSError *error))completion; +- (void)loadImageForURL:(NSURL *)aURL completion:(void (^)(UIImage *image, NSURL *imageURL, NSError *error))completion; - (void)loadImageForURL:(NSURL *)aURL style:(NSString *)style styler:(UIImage * (^)(UIImage *image))styler - completion:(void (^)(UIImage *image, NSURL *imageURL, - NSError *error))completion; + completion:(void (^)(UIImage *image, NSURL *imageURL, NSError *error))completion; #endif - (BOOL)hasLoadedImageURL:(NSURL *)aURL; @@ -86,12 +80,11 @@ @protocol RCloudImageLoaderObserver @optional -- (void)imageLoaderDidLoad:(NSNotification *)notification; // Object will be - // EGOImageLoader, - // userInfo will - // contain imageURL - // and image -- (void)imageLoaderDidFailToLoad: - (NSNotification *)notification; // Object will be EGOImageLoader, userInfo - // will contain error +- (void)imageLoaderDidLoad:(NSNotification *)notification; // Object will be + // EGOImageLoader, + // userInfo will + // contain imageURL + // and image +- (void)imageLoaderDidFailToLoad:(NSNotification *)notification; // Object will be EGOImageLoader, userInfo + // will contain error @end diff --git a/ios-rongcallkit/RongCallKit/Header/RCloudImageView.h b/ios-rongcallkit/RongCallKit/Header/RCloudImageView.h index 0cee6b1..83485a5 100644 --- a/ios-rongcallkit/RongCallKit/Header/RCloudImageView.h +++ b/ios-rongcallkit/RongCallKit/Header/RCloudImageView.h @@ -31,15 +31,14 @@ @protocol RCloudImageViewDelegate; @interface RCloudImageView : UIImageView { -@private - NSURL *imageURL; - UIImage *placeholderImage; - id delegate; + @private + NSURL *imageURL; + UIImage *placeholderImage; + id delegate; } - (instancetype)initWithPlaceholderImage:(UIImage *)anImage; // delegate:nil -- (instancetype)initWithPlaceholderImage:(UIImage *)anImage - delegate:(id)aDelegate; +- (instancetype)initWithPlaceholderImage:(UIImage *)anImage delegate:(id)aDelegate; - (void)cancelImageLoad; @@ -54,6 +53,5 @@ @protocol RCloudImageViewDelegate @optional - (void)imageViewLoadedImage:(RCloudImageView *)imageView; -- (void)imageViewFailedToLoadImage:(RCloudImageView *)imageView - error:(NSError *)error; +- (void)imageViewFailedToLoadImage:(RCloudImageView *)imageView error:(NSError *)error; @end \ No newline at end of file diff --git a/ios-rongcallkit/RongCallKit/Header/RongIMKitExtensionModel.h b/ios-rongcallkit/RongCallKit/Header/RongIMKitExtensionModel.h index 1cf27ec..c6b56c2 100644 --- a/ios-rongcallkit/RongCallKit/Header/RongIMKitExtensionModel.h +++ b/ios-rongcallkit/RongCallKit/Header/RongIMKitExtensionModel.h @@ -48,7 +48,8 @@ typedef void (^RCConversationPluginItemTapBlock)(); - (void)registerConversationPlugin:(RCConversationType)conversationType targetId:(NSString *)targetId - block:(void (^)(UIImage *image, NSString *title, RCConversationPluginItemTapBlock tapBlock))registerBlock; + block:(void (^)(UIImage *image, NSString *title, + RCConversationPluginItemTapBlock tapBlock))registerBlock; - (BOOL)didHoldReceivedMessageForKitUpdate:(RCMessage *)message; diff --git a/ios-rongcallkit/RongCallKit/Info.plist b/ios-rongcallkit/RongCallKit/Info.plist index 056dcff..96bd550 100644 --- a/ios-rongcallkit/RongCallKit/Info.plist +++ b/ios-rongcallkit/RongCallKit/Info.plist @@ -15,7 +15,7 @@ CFBundlePackageType FMWK CFBundleShortVersionString - 2.8.20 + 2.8.21 CFBundleSignature ???? CFBundleVersion diff --git a/ios-rongcallkit/RongCallKit/Layout/RCAudioMultiCallUserCollectionLayout.h b/ios-rongcallkit/RongCallKit/Layout/RCAudioMultiCallUserCollectionLayout.h index 28b0a04..ebe1d7b 100644 --- a/ios-rongcallkit/RongCallKit/Layout/RCAudioMultiCallUserCollectionLayout.h +++ b/ios-rongcallkit/RongCallKit/Layout/RCAudioMultiCallUserCollectionLayout.h @@ -13,7 +13,6 @@ @property(nonatomic, assign) CGFloat itemMargin; @property(nonatomic, assign) CGFloat buttomPadding; -- (instancetype)initWithItemMargin:(CGFloat)itemMargin - buttomPadding:(CGFloat)buttomPadding; +- (instancetype)initWithItemMargin:(CGFloat)itemMargin buttomPadding:(CGFloat)buttomPadding; @end diff --git a/ios-rongcallkit/RongCallKit/Layout/RCAudioMultiCallUserCollectionLayout.m b/ios-rongcallkit/RongCallKit/Layout/RCAudioMultiCallUserCollectionLayout.m index 7e17519..fa8deba 100644 --- a/ios-rongcallkit/RongCallKit/Layout/RCAudioMultiCallUserCollectionLayout.m +++ b/ios-rongcallkit/RongCallKit/Layout/RCAudioMultiCallUserCollectionLayout.m @@ -16,137 +16,116 @@ @interface RCAudioMultiCallUserCollectionLayout () @implementation RCAudioMultiCallUserCollectionLayout -- (instancetype)initWithItemMargin:(CGFloat)itemMargin - buttomPadding:(CGFloat)buttomPadding { - self = [super init]; - if (self) { - self.itemMargin = itemMargin; - self.buttomPadding = buttomPadding; - } - return self; +- (instancetype)initWithItemMargin:(CGFloat)itemMargin buttomPadding:(CGFloat)buttomPadding { + self = [super init]; + if (self) { + self.itemMargin = itemMargin; + self.buttomPadding = buttomPadding; + } + return self; } - (CGFloat)itemAreaWidth { - if (!_itemAreaWidth) { - CGRect frame = self.collectionView.bounds; - _itemAreaWidth = MIN((frame.size.width / 4), - (frame.size.height - self.buttomPadding) / 2); - } - return _itemAreaWidth; + if (!_itemAreaWidth) { + CGRect frame = self.collectionView.bounds; + _itemAreaWidth = MIN((frame.size.width / 4), (frame.size.height - self.buttomPadding) / 2); + } + return _itemAreaWidth; } - (CGFloat)itemWidth { - if (!_itemWidth) { - _itemWidth = self.itemAreaWidth - self.itemMargin - self.itemMargin; - } - return _itemWidth; + if (!_itemWidth) { + _itemWidth = self.itemAreaWidth - self.itemMargin - self.itemMargin; + } + return _itemWidth; } - (void)prepareLayout { - int itemCount = (int)[self.collectionView numberOfItemsInSection:0]; - if (itemCount == 0) { - [super prepareLayout]; - return; - } + int itemCount = (int)[self.collectionView numberOfItemsInSection:0]; + if (itemCount == 0) { + [super prepareLayout]; + return; + } - CGRect frame = self.collectionView.bounds; + CGRect frame = self.collectionView.bounds; - self.attributesArray = [[NSMutableArray alloc] init]; - if (itemCount <= 8) { - int topCount = (itemCount <= 4) ? itemCount : 4; + self.attributesArray = [[NSMutableArray alloc] init]; + if (itemCount <= 8) { + int topCount = (itemCount <= 4) ? itemCount : 4; - CGFloat topY = (frame.size.height - self.buttomPadding) / 2 - - self.itemAreaWidth + - (topCount == itemCount ? self.itemAreaWidth / 2 : 0); - CGFloat leftX1 = - (frame.size.width - self.itemAreaWidth * topCount) / 2; // line1 - CGFloat leftX2 = - (frame.size.width - self.itemAreaWidth * (itemCount - topCount)) / - 2; // line2 - for (int i = 0; i < itemCount; i++) { - UICollectionViewLayoutAttributes *attributes = - [UICollectionViewLayoutAttributes - layoutAttributesForCellWithIndexPath:[NSIndexPath - indexPathForItem:i - inSection:0]]; - if (i < topCount) { - attributes.frame = - CGRectMake(leftX1 + self.itemAreaWidth * i + self.itemMargin, - topY + self.itemMargin, self.itemWidth, self.itemWidth); - } else { - attributes.frame = CGRectMake( - leftX2 + self.itemAreaWidth * (i - topCount) + self.itemMargin, - topY + self.itemMargin + self.itemWidth + self.itemMargin + - self.itemMargin, - self.itemWidth, self.itemWidth); - } - [self.attributesArray addObject:attributes]; - } - } else { - int lines = (itemCount - 1) / 4 + 1; - CGFloat topY = - (frame.size.height - self.buttomPadding) / 2 - self.itemAreaWidth; - for (int line = 0; line < lines; line++) { - int maxCloumn = line < (lines - 1) ? 4 : (itemCount - (lines - 1) * 4); - for (int cloumn = 0; cloumn < maxCloumn; cloumn++) { - int index = line * 4 + cloumn; - UICollectionViewLayoutAttributes *attributes = - [UICollectionViewLayoutAttributes - layoutAttributesForCellWithIndexPath:[NSIndexPath - indexPathForItem:index - inSection:0]]; - attributes.frame = - CGRectMake((frame.size.width - self.itemAreaWidth * maxCloumn) / 2 + - self.itemAreaWidth * cloumn + self.itemMargin, - topY + self.itemAreaWidth * line + self.itemMargin, - self.itemWidth, self.itemWidth); - [self.attributesArray addObject:attributes]; - NSLog(@"the index is %d", index); - NSLog(@"frame is %f, %f, %f, %f", attributes.frame.origin.x, - attributes.frame.origin.y, attributes.frame.size.width, - attributes.frame.size.height); - } + CGFloat topY = (frame.size.height - self.buttomPadding) / 2 - self.itemAreaWidth + + (topCount == itemCount ? self.itemAreaWidth / 2 : 0); + CGFloat leftX1 = (frame.size.width - self.itemAreaWidth * topCount) / 2; // line1 + CGFloat leftX2 = (frame.size.width - self.itemAreaWidth * (itemCount - topCount)) / 2; // line2 + for (int i = 0; i < itemCount; i++) { + UICollectionViewLayoutAttributes *attributes = [UICollectionViewLayoutAttributes + layoutAttributesForCellWithIndexPath:[NSIndexPath indexPathForItem:i inSection:0]]; + if (i < topCount) { + attributes.frame = CGRectMake(leftX1 + self.itemAreaWidth * i + self.itemMargin, topY + self.itemMargin, + self.itemWidth, self.itemWidth); + } else { + attributes.frame = + CGRectMake(leftX2 + self.itemAreaWidth * (i - topCount) + self.itemMargin, + topY + self.itemMargin + self.itemWidth + self.itemMargin + self.itemMargin, + self.itemWidth, self.itemWidth); + } + [self.attributesArray addObject:attributes]; + } + } else { + int lines = (itemCount - 1) / 4 + 1; + CGFloat topY = (frame.size.height - self.buttomPadding) / 2 - self.itemAreaWidth; + for (int line = 0; line < lines; line++) { + int maxCloumn = line < (lines - 1) ? 4 : (itemCount - (lines - 1) * 4); + for (int cloumn = 0; cloumn < maxCloumn; cloumn++) { + int index = line * 4 + cloumn; + UICollectionViewLayoutAttributes *attributes = [UICollectionViewLayoutAttributes + layoutAttributesForCellWithIndexPath:[NSIndexPath indexPathForItem:index inSection:0]]; + attributes.frame = + CGRectMake((frame.size.width - self.itemAreaWidth * maxCloumn) / 2 + self.itemAreaWidth * cloumn + + self.itemMargin, + topY + self.itemAreaWidth * line + self.itemMargin, self.itemWidth, self.itemWidth); + [self.attributesArray addObject:attributes]; + NSLog(@"the index is %d", index); + NSLog(@"frame is %f, %f, %f, %f", attributes.frame.origin.x, attributes.frame.origin.y, + attributes.frame.size.width, attributes.frame.size.height); + } + } } - } - // let the flow layout calc the size. - self.scrollDirection = UICollectionViewScrollDirectionVertical; + // let the flow layout calc the size. + self.scrollDirection = UICollectionViewScrollDirectionVertical; - [super prepareLayout]; + [super prepareLayout]; } - (CGSize)collectionViewContentSize { - if ([self.collectionView numberOfItemsInSection:0] <= 8) { - return [self collectionView].frame.size; - } else { - // if (self.scrollDirection == - // UICollectionViewScrollDirectionVertical) { - int lines = - ((int)[self.collectionView numberOfItemsInSection:0] - 1) / 4 + 1; - CGFloat height = [self collectionView].frame.size.height + - self.itemAreaWidth * (lines - 2) - self.buttomPadding; - return CGSizeMake([self collectionView].frame.size.width, height); - } + if ([self.collectionView numberOfItemsInSection:0] <= 8) { + return [self collectionView].frame.size; + } else { + // if (self.scrollDirection == + // UICollectionViewScrollDirectionVertical) { + int lines = ((int)[self.collectionView numberOfItemsInSection:0] - 1) / 4 + 1; + CGFloat height = + [self collectionView].frame.size.height + self.itemAreaWidth * (lines - 2) - self.buttomPadding; + return CGSizeMake([self collectionView].frame.size.width, height); + } } -- (UICollectionViewLayoutAttributes *)layoutAttributesForItemAtIndexPath: - (NSIndexPath *)path { - // if ([self.collectionView numberOfItemsInSection:0] <= 8) { - UICollectionViewLayoutAttributes *attributes = - [self.attributesArray objectAtIndex:[path row]]; - return attributes; - // } else { - // return [super layoutAttributesForItemAtIndexPath:path]; - // } +- (UICollectionViewLayoutAttributes *)layoutAttributesForItemAtIndexPath:(NSIndexPath *)path { + // if ([self.collectionView numberOfItemsInSection:0] <= 8) { + UICollectionViewLayoutAttributes *attributes = [self.attributesArray objectAtIndex:[path row]]; + return attributes; + // } else { + // return [super layoutAttributesForItemAtIndexPath:path]; + // } } - (NSArray *)layoutAttributesForElementsInRect:(CGRect)rect { - // if ([self.collectionView numberOfItemsInSection:0] <= 8) { - NSMutableArray *attributes = [NSMutableArray array]; - for (NSInteger i = 0; i < [self.collectionView numberOfItemsInSection:0]; - i++) { - NSIndexPath *indexPath = [NSIndexPath indexPathForItem:i inSection:0]; - [attributes addObject:[self layoutAttributesForItemAtIndexPath:indexPath]]; - } - return attributes; - // } else { - // return [super layoutAttributesForElementsInRect:rect]; - // } + // if ([self.collectionView numberOfItemsInSection:0] <= 8) { + NSMutableArray *attributes = [NSMutableArray array]; + for (NSInteger i = 0; i < [self.collectionView numberOfItemsInSection:0]; i++) { + NSIndexPath *indexPath = [NSIndexPath indexPathForItem:i inSection:0]; + [attributes addObject:[self layoutAttributesForItemAtIndexPath:indexPath]]; + } + return attributes; + // } else { + // return [super layoutAttributesForElementsInRect:rect]; + // } } @end diff --git a/ios-rongcallkit/RongCallKit/Layout/RCVideoMultiCallUserCollectionLayout.m b/ios-rongcallkit/RongCallKit/Layout/RCVideoMultiCallUserCollectionLayout.m index cb42477..3953943 100644 --- a/ios-rongcallkit/RongCallKit/Layout/RCVideoMultiCallUserCollectionLayout.m +++ b/ios-rongcallkit/RongCallKit/Layout/RCVideoMultiCallUserCollectionLayout.m @@ -17,79 +17,71 @@ @interface RCVideoMultiCallUserCollectionLayout () @implementation RCVideoMultiCallUserCollectionLayout - (instancetype)initWithItemMargin:(CGFloat)itemMargin { - self = [super init]; - if (self) { - self.itemMargin = itemMargin; - } - return self; + self = [super init]; + if (self) { + self.itemMargin = itemMargin; + } + return self; } - (CGFloat)itemAreaWidth { - if (!_itemAreaWidth) { - CGRect frame = self.collectionView.bounds; - _itemAreaWidth = MIN((frame.size.width / 4), frame.size.height / 2); - } - return _itemAreaWidth; + if (!_itemAreaWidth) { + CGRect frame = self.collectionView.bounds; + _itemAreaWidth = MIN((frame.size.width / 4), frame.size.height / 2); + } + return _itemAreaWidth; } - (CGFloat)itemWidth { - if (!_itemWidth) { - _itemWidth = self.itemAreaWidth - self.itemMargin - self.itemMargin; - } - return _itemWidth; + if (!_itemWidth) { + _itemWidth = self.itemAreaWidth - self.itemMargin - self.itemMargin; + } + return _itemWidth; } - (void)prepareLayout { - int itemCount = (int)[self.collectionView numberOfItemsInSection:0]; - if (itemCount == 0) { - [super prepareLayout]; - return; - } + int itemCount = (int)[self.collectionView numberOfItemsInSection:0]; + if (itemCount == 0) { + [super prepareLayout]; + return; + } - CGRect frame = self.collectionView.bounds; + CGRect frame = self.collectionView.bounds; - self.attributesArray = [[NSMutableArray alloc] init]; - if (itemCount <= 8) { - CGFloat topY = frame.size.height / 2; - CGFloat leftMargin = (frame.size.width - self.itemAreaWidth * 4) / 2; - for (int i = 0; i < itemCount; i++) { - UICollectionViewLayoutAttributes *attributes = - [UICollectionViewLayoutAttributes - layoutAttributesForCellWithIndexPath:[NSIndexPath - indexPathForItem:i - inSection:0]]; - if (i < 4) { - attributes.frame = CGRectMake( - leftMargin + (3 - i) * self.itemAreaWidth + self.itemMargin, - topY + self.itemMargin, self.itemWidth, self.itemWidth); - } else { - attributes.frame = CGRectMake( - leftMargin + (7 - i) * self.itemAreaWidth + self.itemMargin, - topY - self.itemAreaWidth + self.itemMargin, self.itemWidth, - self.itemWidth); - } - [self.attributesArray addObject:attributes]; + self.attributesArray = [[NSMutableArray alloc] init]; + if (itemCount <= 8) { + CGFloat topY = frame.size.height / 2; + CGFloat leftMargin = (frame.size.width - self.itemAreaWidth * 4) / 2; + for (int i = 0; i < itemCount; i++) { + UICollectionViewLayoutAttributes *attributes = [UICollectionViewLayoutAttributes + layoutAttributesForCellWithIndexPath:[NSIndexPath indexPathForItem:i inSection:0]]; + if (i < 4) { + attributes.frame = CGRectMake(leftMargin + (3 - i) * self.itemAreaWidth + self.itemMargin, + topY + self.itemMargin, self.itemWidth, self.itemWidth); + } else { + attributes.frame = + CGRectMake(leftMargin + (7 - i) * self.itemAreaWidth + self.itemMargin, + topY - self.itemAreaWidth + self.itemMargin, self.itemWidth, self.itemWidth); + } + [self.attributesArray addObject:attributes]; + } } - } - [super prepareLayout]; + [super prepareLayout]; } - (CGSize)collectionViewContentSize { - return [self collectionView].frame.size; + return [self collectionView].frame.size; } -- (UICollectionViewLayoutAttributes *)layoutAttributesForItemAtIndexPath: - (NSIndexPath *)path { - UICollectionViewLayoutAttributes *attributes = - [self.attributesArray objectAtIndex:[path row]]; - return attributes; +- (UICollectionViewLayoutAttributes *)layoutAttributesForItemAtIndexPath:(NSIndexPath *)path { + UICollectionViewLayoutAttributes *attributes = [self.attributesArray objectAtIndex:[path row]]; + return attributes; } - (NSArray *)layoutAttributesForElementsInRect:(CGRect)rect { - NSMutableArray *attributes = [NSMutableArray array]; - for (NSInteger i = 0; i < [self.collectionView numberOfItemsInSection:0]; - i++) { - NSIndexPath *indexPath = [NSIndexPath indexPathForItem:i inSection:0]; - [attributes addObject:[self layoutAttributesForItemAtIndexPath:indexPath]]; - } - return attributes; + NSMutableArray *attributes = [NSMutableArray array]; + for (NSInteger i = 0; i < [self.collectionView numberOfItemsInSection:0]; i++) { + NSIndexPath *indexPath = [NSIndexPath indexPathForItem:i inSection:0]; + [attributes addObject:[self layoutAttributesForItemAtIndexPath:indexPath]]; + } + return attributes; } @end \ No newline at end of file diff --git a/ios-rongcallkit/RongCallKit/RCCall.h b/ios-rongcallkit/RongCallKit/RCCall.h index 6973ed8..ee0b168 100644 --- a/ios-rongcallkit/RongCallKit/RCCall.h +++ b/ios-rongcallkit/RongCallKit/RCCall.h @@ -34,12 +34,11 @@ /*! 群组成员列表提供者 - + @warning **已废弃,请勿使用。** 升级说明:如果您之前使用了此属性,可以直接替换为[RCIM sharedRCIM]的groupMemberDataSource属性,行为和实现完全一致。 */ -@property(nonatomic, weak) id - groupMemberDataSource __deprecated_msg("已废弃,请勿使用。"); +@property(nonatomic, weak) id groupMemberDataSource __deprecated_msg("已废弃,请勿使用。"); /*! 获取融云通话界面组件CallKit的核心类单例 @@ -74,8 +73,7 @@ @param targetId 对方的用户ID @param mediaType 使用的媒体类型 */ -- (void)startSingleCall:(NSString *)targetId - mediaType:(RCCallMediaType)mediaType; +- (void)startSingleCall:(NSString *)targetId mediaType:(RCCallMediaType)mediaType; /*! 选择成员并发起多人通话 diff --git a/ios-rongcallkit/RongCallKit/RCCall.mm b/ios-rongcallkit/RongCallKit/RCCall.mm index 594953b..ae65556 100644 --- a/ios-rongcallkit/RongCallKit/RCCall.mm +++ b/ios-rongcallkit/RongCallKit/RCCall.mm @@ -12,14 +12,13 @@ #import "RCCallDetailMessageCell.h" #import "RCCallKitUtility.h" #import "RCCallSelectMemberViewController.h" -#import "RCCallSelectMemberViewController.h" #import "RCCallSingleCallViewController.h" #import "RCCallTipMessageCell.h" #import "RCCallVideoMultiCallViewController.h" +#import "RCDAudioFrameObserver.h" #import "RCDVideoFrameObserver.h" #import "RCUserInfoCacheManager.h" #import -#import "RCDAudioFrameObserver.h" #define AlertWithoutConfirm 1000 #define AlertWithConfirm 1001 @@ -35,283 +34,268 @@ @interface RCCall () @implementation RCCall + (instancetype)sharedRCCall { - static RCCall *pRongVoIP; - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - if (pRongVoIP == nil) { - pRongVoIP = [[RCCall alloc] init]; - [[RCCallClient sharedRCCallClient] setDelegate:pRongVoIP]; - pRongVoIP.maxMultiAudioCallUserNumber = 20; - pRongVoIP.maxMultiVideoCallUserNumber = 9; - pRongVoIP.callWindows = [[NSMutableArray alloc] init]; - pRongVoIP.locationNotificationList = [[NSMutableArray alloc] init]; - -// agoraRegisterVideoFrameObserver(RCDVideoFrameObserver::sharedObserver(), true, true); -// agoraRegisterAudioFrameObserver(RCDAudioFrameObserver::sharedObserver()); + static RCCall *pRongVoIP; + static dispatch_once_t onceToken; + dispatch_once(&onceToken, ^{ + if (pRongVoIP == nil) { + pRongVoIP = [[RCCall alloc] init]; + [[RCCallClient sharedRCCallClient] setDelegate:pRongVoIP]; + pRongVoIP.maxMultiAudioCallUserNumber = 20; + pRongVoIP.maxMultiVideoCallUserNumber = 9; + pRongVoIP.callWindows = [[NSMutableArray alloc] init]; + pRongVoIP.locationNotificationList = [[NSMutableArray alloc] init]; + + // agoraRegisterVideoFrameObserver(RCDVideoFrameObserver::sharedObserver(), true, true); + // agoraRegisterAudioFrameObserver(RCDAudioFrameObserver::sharedObserver()); + [pRongVoIP registerNotification]; + } + }); + return pRongVoIP; +} + +- (void)registerNotification { + [[NSNotificationCenter defaultCenter] addObserver:self + selector:@selector(appDidBecomeActive) + name:UIApplicationDidBecomeActiveNotification + object:nil]; +} + +- (void)appDidBecomeActive { + for (UILocalNotification *notification in self.locationNotificationList) { + if ([notification.userInfo[@"appData"][@"callId"] isEqualToString:self.currentCallSession.callId]) { + [[UIApplication sharedApplication] cancelLocalNotification:notification]; + [self.locationNotificationList removeObject:notification]; + break; + } } - }); - return pRongVoIP; } - (BOOL)isAudioCallEnabled:(RCConversationType)conversationType { - return - [[RCCallClient sharedRCCallClient] isAudioCallEnabled:conversationType]; + return [[RCCallClient sharedRCCallClient] isAudioCallEnabled:conversationType]; } - (BOOL)isVideoCallEnabled:(RCConversationType)conversationType { - return - [[RCCallClient sharedRCCallClient] isVideoCallEnabled:conversationType]; + return [[RCCallClient sharedRCCallClient] isVideoCallEnabled:conversationType]; } -- (void)startSingleCall:(NSString *)targetId - mediaType:(RCCallMediaType)mediaType { - if ([self preCheckForStartCall:mediaType]) { - [self checkSystemPermission:mediaType - success:^{ - [self startSingleCallViewController:targetId - mediaType:mediaType]; - }]; - } +- (void)startSingleCall:(NSString *)targetId mediaType:(RCCallMediaType)mediaType { + if ([self preCheckForStartCall:mediaType]) { + [self checkSystemPermission:mediaType + success:^{ + [self startSingleCallViewController:targetId mediaType:mediaType]; + }]; + } } -- (void)startSingleCallViewController:(NSString *)targetId - mediaType:(RCCallMediaType)mediaType { - RCCallSingleCallViewController *singleCallViewController = - [[RCCallSingleCallViewController alloc] initWithOutgoingCall:targetId - mediaType:mediaType]; +- (void)startSingleCallViewController:(NSString *)targetId mediaType:(RCCallMediaType)mediaType { + RCCallSingleCallViewController *singleCallViewController = + [[RCCallSingleCallViewController alloc] initWithOutgoingCall:targetId mediaType:mediaType]; - [self presentCallViewController:singleCallViewController]; + [self presentCallViewController:singleCallViewController]; } - (void)startMultiCall:(RCConversationType)conversationType targetId:(NSString *)targetId mediaType:(RCCallMediaType)mediaType { - if ([self preCheckForStartCall:mediaType]) { - [self checkSystemPermission:mediaType - success:^{ - [self startSelectMemberViewContoller:conversationType - targetId:targetId - mediaType:mediaType]; - }]; - } + if ([self preCheckForStartCall:mediaType]) { + [self checkSystemPermission:mediaType + success:^{ + [self startSelectMemberViewContoller:conversationType + targetId:targetId + mediaType:mediaType]; + }]; + } } - (void)startSelectMemberViewContoller:(RCConversationType)conversationType targetId:(NSString *)targetId mediaType:(RCCallMediaType)mediaType { - if (conversationType == ConversationType_DISCUSSION || - conversationType == ConversationType_GROUP) { - __weak typeof(self) weakSelf = self; - RCCallSelectMemberViewController *voipCallSelectViewController = - [[RCCallSelectMemberViewController alloc] + if (conversationType == ConversationType_DISCUSSION || conversationType == ConversationType_GROUP) { + __weak typeof(self) weakSelf = self; + RCCallSelectMemberViewController *voipCallSelectViewController = [[RCCallSelectMemberViewController alloc] initWithConversationType:conversationType targetId:targetId mediaType:mediaType - exist:@[ - [RCIMClient sharedRCIMClient] - .currentUserInfo.userId - ] + exist:@[ [RCIMClient sharedRCIMClient].currentUserInfo.userId ] success:^(NSArray *addUserIdList) { - [weakSelf - startMultiCallViewController:conversationType - targetId:targetId - mediaType:mediaType - userIdList:addUserIdList]; + [weakSelf startMultiCallViewController:conversationType + targetId:targetId + mediaType:mediaType + userIdList:addUserIdList]; }]; - [self presentCallViewController:voipCallSelectViewController]; - } + [self presentCallViewController:voipCallSelectViewController]; + } } - (void)startMultiCallViewController:(RCConversationType)conversationType targetId:(NSString *)targetId mediaType:(RCCallMediaType)mediaType userIdList:(NSArray *)userIdList { - if (mediaType == RCCallMediaAudio) { - UIViewController *audioCallViewController = - [[RCCallAudioMultiCallViewController alloc] - initWithOutgoingCall:conversationType - targetId:targetId - userIdList:userIdList]; - - [self presentCallViewController:audioCallViewController]; - } else { - RCCallVideoMultiCallViewController *videoCallViewController = - [[RCCallVideoMultiCallViewController alloc] - initWithOutgoingCall:conversationType - targetId:targetId - mediaType:mediaType - userIdList:userIdList]; - - [self presentCallViewController:videoCallViewController]; - } + if (mediaType == RCCallMediaAudio) { + UIViewController *audioCallViewController = + [[RCCallAudioMultiCallViewController alloc] initWithOutgoingCall:conversationType + targetId:targetId + userIdList:userIdList]; + + [self presentCallViewController:audioCallViewController]; + } else { + RCCallVideoMultiCallViewController *videoCallViewController = + [[RCCallVideoMultiCallViewController alloc] initWithOutgoingCall:conversationType + targetId:targetId + mediaType:mediaType + userIdList:userIdList]; + + [self presentCallViewController:videoCallViewController]; + } } -- (void)checkSystemPermission:(RCCallMediaType)mediaType - success:(void (^)())successBlock { - if (mediaType == RCCallMediaVideo) { - [self checkCapturePermission:^(BOOL granted) { - if (granted) { +- (void)checkSystemPermission:(RCCallMediaType)mediaType success:(void (^)(void))successBlock { + if (mediaType == RCCallMediaVideo) { + [self checkCapturePermission:^(BOOL granted) { + if (granted) { + [self checkRecordPermission:^() { + successBlock(); + }]; + } + }]; + + } else if (mediaType == RCCallMediaAudio) { [self checkRecordPermission:^() { - successBlock(); + successBlock(); }]; - } - }]; - - } else if (mediaType == RCCallMediaAudio) { - [self checkRecordPermission:^() { - successBlock(); - }]; - } + } } -- (void)checkRecordPermission:(void (^)())successBlock { - if ([[AVAudioSession sharedInstance] - respondsToSelector:@selector(requestRecordPermission:)]) { - [[AVAudioSession sharedInstance] requestRecordPermission:^(BOOL granted) { - dispatch_async(dispatch_get_main_queue(), ^{ - if (granted) { - successBlock(); - } else { - [self loadErrorAlertWithConfirm:NSLocalizedStringFromTable( - @"AccessRightTitle", - @"RongCloudKit", nil) - message:NSLocalizedStringFromTable( - @"speakerAccessRight", - @"RongCloudKit", nil)]; - } - }); - }]; - } +- (void)checkRecordPermission:(void (^)(void))successBlock { + if ([[AVAudioSession sharedInstance] respondsToSelector:@selector(requestRecordPermission:)]) { + [[AVAudioSession sharedInstance] requestRecordPermission:^(BOOL granted) { + dispatch_async(dispatch_get_main_queue(), ^{ + if (granted) { + successBlock(); + } else { + [self + loadErrorAlertWithConfirm:NSLocalizedStringFromTable(@"AccessRightTitle", @"RongCloudKit", nil) + message:NSLocalizedStringFromTable(@"speakerAccessRight", @"RongCloudKit", + nil)]; + } + }); + }]; + } } - (void)checkCapturePermission:(void (^)(BOOL granted))complete { - AVAuthorizationStatus authStatus = - [AVCaptureDevice authorizationStatusForMediaType:AVMediaTypeVideo]; - - if (authStatus == AVAuthorizationStatusDenied || - authStatus == AVAuthorizationStatusRestricted) { - [self - loadErrorAlertWithConfirm:NSLocalizedStringFromTable( - @"AccessRightTitle", @"RongCloudKit", nil) - message:NSLocalizedStringFromTable( - @"cameraAccessRight", @"RongCloudKit", - nil)]; - complete(NO); - } else if (authStatus == AVAuthorizationStatusNotDetermined) { - [AVCaptureDevice - requestAccessForMediaType:AVMediaTypeVideo - completionHandler:^(BOOL granted) { - if (!granted) { - [self loadErrorAlertWithConfirm:NSLocalizedStringFromTable( - @"AccessRightTitle", - @"RongCloudKit", nil) - message:NSLocalizedStringFromTable( - @"cameraAccessRight", - @"RongCloudKit", nil)]; - } - complete(granted); - }]; - } else { - complete(YES); - } + AVAuthorizationStatus authStatus = [AVCaptureDevice authorizationStatusForMediaType:AVMediaTypeVideo]; + + if (authStatus == AVAuthorizationStatusDenied || authStatus == AVAuthorizationStatusRestricted) { + [self loadErrorAlertWithConfirm:NSLocalizedStringFromTable(@"AccessRightTitle", @"RongCloudKit", nil) + message:NSLocalizedStringFromTable(@"cameraAccessRight", @"RongCloudKit", nil)]; + complete(NO); + } else if (authStatus == AVAuthorizationStatusNotDetermined) { + [AVCaptureDevice + requestAccessForMediaType:AVMediaTypeVideo + completionHandler:^(BOOL granted) { + if (!granted) { + [self loadErrorAlertWithConfirm:NSLocalizedStringFromTable(@"AccessRightTitle", + @"RongCloudKit", nil) + message:NSLocalizedStringFromTable(@"cameraAccessRight", + @"RongCloudKit", nil)]; + } + complete(granted); + }]; + } else { + complete(YES); + } } - (BOOL)preCheckForStartCall:(RCCallMediaType)mediaType { - RCCallSession *currentCallSession = [RCCall sharedRCCall].currentCallSession; - if (currentCallSession && currentCallSession.mediaType == RCCallMediaAudio) { - [self loadErrorAlertWithoutConfirm:NSLocalizedStringFromTable( - @"VoIPAudioCallExistedWarning", - @"RongCloudKit", nil)]; - return NO; - } else if (currentCallSession && - currentCallSession.mediaType == RCCallMediaVideo) { - [self loadErrorAlertWithoutConfirm:NSLocalizedStringFromTable( - @"VoIPVideoCallExistedWarning", - @"RongCloudKit", nil)]; - return NO; - } else { - return YES; - } + RCCallSession *currentCallSession = [RCCall sharedRCCall].currentCallSession; + if (currentCallSession && currentCallSession.mediaType == RCCallMediaAudio) { + [self loadErrorAlertWithoutConfirm:NSLocalizedStringFromTable(@"VoIPAudioCallExistedWarning", @"RongCloudKit", + nil)]; + return NO; + } else if (currentCallSession && currentCallSession.mediaType == RCCallMediaVideo) { + [self loadErrorAlertWithoutConfirm:NSLocalizedStringFromTable(@"VoIPVideoCallExistedWarning", @"RongCloudKit", + nil)]; + return NO; + } else { + return YES; + } } -- (void)presentCallViewController:(UIViewController *)viewController{ - [[[UIApplication sharedApplication] keyWindow] endEditing:YES]; - UIWindow *activityWindow = - [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; - activityWindow.windowLevel = UIWindowLevelAlert; - activityWindow.rootViewController = viewController; - [activityWindow makeKeyAndVisible]; - CATransition *animation = [CATransition animation]; - [animation setDuration:0.3]; - animation.type = kCATransitionMoveIn; //可更改为其他方式 - animation.subtype = kCATransitionFromTop; //可更改为其他方式 - [[activityWindow layer] addAnimation:animation forKey:nil]; - [self.callWindows addObject:activityWindow]; +- (void)presentCallViewController:(UIViewController *)viewController { + [[[UIApplication sharedApplication] keyWindow] endEditing:YES]; + UIWindow *activityWindow = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; + activityWindow.windowLevel = UIWindowLevelAlert; + activityWindow.rootViewController = viewController; + [activityWindow makeKeyAndVisible]; + CATransition *animation = [CATransition animation]; + [animation setDuration:0.3]; + animation.type = kCATransitionMoveIn; //可更改为其他方式 + animation.subtype = kCATransitionFromTop; //可更改为其他方式 + [[activityWindow layer] addAnimation:animation forKey:nil]; + [self.callWindows addObject:activityWindow]; } - (void)dismissCallViewController:(UIViewController *)viewController { - if ([viewController isKindOfClass:[RCCallBaseViewController class]]) { - UIViewController *rootVC = viewController; - while (rootVC.parentViewController) { - rootVC = rootVC.parentViewController; + if ([viewController isKindOfClass:[RCCallBaseViewController class]]) { + UIViewController *rootVC = viewController; + while (rootVC.parentViewController) { + rootVC = rootVC.parentViewController; + } + viewController = rootVC; } - viewController = rootVC; - } - - for (UIWindow *window in self.callWindows) { - if (window.rootViewController == viewController) { - [window resignKeyWindow]; - window.hidden = YES; - [[UIApplication sharedApplication].delegate.window makeKeyWindow]; - [self.callWindows removeObject:window]; - break; + + for (UIWindow *window in self.callWindows) { + if (window.rootViewController == viewController) { + [window resignKeyWindow]; + window.hidden = YES; + [[UIApplication sharedApplication].delegate.window makeKeyWindow]; + [self.callWindows removeObject:window]; + break; + } } - } - [viewController dismissViewControllerAnimated:YES completion:nil]; + [viewController dismissViewControllerAnimated:YES completion:nil]; } - (RCCallSession *)currentCallSession { - return [RCCallClient sharedRCCallClient].currentCallSession; + return [RCCallClient sharedRCCallClient].currentCallSession; } #pragma mark - receive call - (void)didReceiveCall:(RCCallSession *)callSession { - if (!callSession.isMultiCall) { - RCCallSingleCallViewController *singleCallViewController = - [[RCCallSingleCallViewController alloc] - initWithIncomingCall:callSession]; + if (!callSession.isMultiCall) { + RCCallSingleCallViewController *singleCallViewController = + [[RCCallSingleCallViewController alloc] initWithIncomingCall:callSession]; - [self presentCallViewController:singleCallViewController]; - } else { - if (callSession.mediaType == RCCallMediaAudio) { - RCCallAudioMultiCallViewController *multiCallViewController = - [[RCCallAudioMultiCallViewController alloc] - initWithIncomingCall:callSession]; - - [self presentCallViewController:multiCallViewController]; + [self presentCallViewController:singleCallViewController]; } else { - RCCallVideoMultiCallViewController *multiCallViewController = - [[RCCallVideoMultiCallViewController alloc] - initWithIncomingCall:callSession]; + if (callSession.mediaType == RCCallMediaAudio) { + RCCallAudioMultiCallViewController *multiCallViewController = + [[RCCallAudioMultiCallViewController alloc] initWithIncomingCall:callSession]; + + [self presentCallViewController:multiCallViewController]; + } else { + RCCallVideoMultiCallViewController *multiCallViewController = + [[RCCallVideoMultiCallViewController alloc] initWithIncomingCall:callSession]; - [self presentCallViewController:multiCallViewController]; + [self presentCallViewController:multiCallViewController]; + } } - } } - (void)didCancelCallRemoteNotification:(NSString *)callId inviterUserId:(NSString *)inviterUserId mediaType:(RCCallMediaType)mediaType userIdList:(NSArray *)userIdList { - for (UILocalNotification *notification in self.locationNotificationList) { - if ([notification.userInfo[@"appData"][@"callId"] isEqualToString:callId]) { - [[UIApplication sharedApplication] cancelLocalNotification:notification]; - [self.locationNotificationList removeObject:notification]; - break; + for (UILocalNotification *notification in self.locationNotificationList) { + if ([notification.userInfo[@"appData"][@"callId"] isEqualToString:callId]) { + [[UIApplication sharedApplication] cancelLocalNotification:notification]; + [self.locationNotificationList removeObject:notification]; + break; + } } - } } - (void)didReceiveCallRemoteNotification:(NSString *)callId @@ -319,131 +303,118 @@ - (void)didReceiveCallRemoteNotification:(NSString *)callId mediaType:(RCCallMediaType)mediaType userIdList:(NSArray *)userIdList userDict:(NSDictionary *)userDict { - UILocalNotification *callNotification = [[UILocalNotification alloc] init]; - callNotification.alertAction = NSLocalizedStringFromTable( - @"LocalNotificationShow", @"RongCloudKit", nil); - - NSString *inviterUserName = - [[RCUserInfoCacheManager sharedManager] getUserInfo:inviterUserId].name; - if (mediaType == RCCallMediaAudio) { - if (inviterUserName) { - callNotification.alertBody = [NSString - stringWithFormat:@"%@%@", inviterUserName, - NSLocalizedStringFromTable(@"VoIPAudioCallIncoming", - @"RongCloudKit", nil)]; - } else { - callNotification.alertBody = [NSString - stringWithFormat:@"%@", NSLocalizedStringFromTable( - @"VoIPAudioCallIncomingWithoutUserName", - @"RongCloudKit", nil)]; - ; - } - } else { - if (inviterUserName) { - callNotification.alertBody = [NSString - stringWithFormat:@"%@%@", inviterUserName, - NSLocalizedStringFromTable(@"VoIPVideoCallIncoming", - @"RongCloudKit", nil)]; + UILocalNotification *callNotification = [[UILocalNotification alloc] init]; + callNotification.alertAction = NSLocalizedStringFromTable(@"LocalNotificationShow", @"RongCloudKit", nil); + + NSString *inviterUserName = [[RCUserInfoCacheManager sharedManager] getUserInfo:inviterUserId].name; + if (mediaType == RCCallMediaAudio) { + if (inviterUserName) { + callNotification.alertBody = + [NSString stringWithFormat:@"%@%@", inviterUserName, + NSLocalizedStringFromTable(@"VoIPAudioCallIncoming", @"RongCloudKit", nil)]; + } else { + callNotification.alertBody = + [NSString stringWithFormat:@"%@", NSLocalizedStringFromTable(@"VoIPAudioCallIncomingWithoutUserName", + @"RongCloudKit", nil)]; + ; + } } else { - callNotification.alertBody = [NSString - stringWithFormat:@"%@", NSLocalizedStringFromTable( - @"VoIPVideoCallIncomingWithoutUserName", - @"RongCloudKit", nil)]; + if (inviterUserName) { + callNotification.alertBody = + [NSString stringWithFormat:@"%@%@", inviterUserName, + NSLocalizedStringFromTable(@"VoIPVideoCallIncoming", @"RongCloudKit", nil)]; + } else { + callNotification.alertBody = + [NSString stringWithFormat:@"%@", NSLocalizedStringFromTable(@"VoIPVideoCallIncomingWithoutUserName", + @"RongCloudKit", nil)]; + } } - } - callNotification.userInfo = userDict; - callNotification.soundName = @"RongCloud.bundle/voip/voip_call.caf"; + callNotification.userInfo = userDict; + callNotification.soundName = @"RongCloud.bundle/voip/voip_call.caf"; - // VoIP Push和接收消息的通话排重 - for (UILocalNotification *notification in self.locationNotificationList) { - if ([notification.userInfo[@"appData"][@"callId"] isEqualToString:callId]) { - return; + // VoIP Push和接收消息的通话排重 + for (UILocalNotification *notification in self.locationNotificationList) { + if ([notification.userInfo[@"appData"][@"callId"] isEqualToString:callId]) { + return; + } } - } - [self.locationNotificationList addObject:callNotification]; - [[UIApplication sharedApplication] - presentLocalNotificationNow:callNotification]; + [self.locationNotificationList addObject:callNotification]; + [[UIApplication sharedApplication] presentLocalNotificationNow:callNotification]; } #pragma mark - ringing - (void)startPlayRing:(NSString *)ringPath { - if (ringPath) { - AVAudioSession *audioSession = [AVAudioSession sharedInstance]; - //默认情况下扬声器播放 - [audioSession setCategory:AVAudioSessionCategoryPlayback error:nil]; - [audioSession setActive:YES error:nil]; - - if (self.audioPlayer) { - [self stopPlayRing]; - } + if (ringPath) { + AVAudioSession *audioSession = [AVAudioSession sharedInstance]; + //默认情况下扬声器播放 + [audioSession setCategory:AVAudioSessionCategoryPlayback error:nil]; + [audioSession setActive:YES error:nil]; + + if (self.audioPlayer) { + [self stopPlayRing]; + } - NSURL *url = [NSURL URLWithString:ringPath]; - NSError *error = nil; - self.audioPlayer = - [[AVAudioPlayer alloc] initWithContentsOfURL:url error:&error]; - if (!error) { - self.audioPlayer.numberOfLoops = -1; - self.audioPlayer.volume = 1.0; - [self.audioPlayer prepareToPlay]; - [self.audioPlayer play]; + NSURL *url = [NSURL URLWithString:ringPath]; + NSError *error = nil; + self.audioPlayer = [[AVAudioPlayer alloc] initWithContentsOfURL:url error:&error]; + if (!error) { + self.audioPlayer.numberOfLoops = -1; + self.audioPlayer.volume = 1.0; + [self.audioPlayer prepareToPlay]; + [self.audioPlayer play]; + } } - } } - (void)stopPlayRing { - if (self.audioPlayer) { - [self.audioPlayer stop]; - self.audioPlayer = nil; - } + if (self.audioPlayer) { + [self.audioPlayer stop]; + self.audioPlayer = nil; + } } #pragma mark - alert - (void)loadErrorAlertWithoutConfirm:(NSString *)title { - UIAlertView *alert = [[UIAlertView alloc] initWithTitle:title - message:nil - delegate:nil - cancelButtonTitle:nil - otherButtonTitles:nil]; - alert.tag = AlertWithoutConfirm; - [NSTimer scheduledTimerWithTimeInterval:1.0f - target:self - selector:@selector(cancelAlert:) - userInfo:alert - repeats:NO]; - [alert show]; + UIAlertView *alert = + [[UIAlertView alloc] initWithTitle:title message:nil delegate:nil cancelButtonTitle:nil otherButtonTitles:nil]; + alert.tag = AlertWithoutConfirm; + [NSTimer scheduledTimerWithTimeInterval:1.0f + target:self + selector:@selector(cancelAlert:) + userInfo:alert + repeats:NO]; + [alert show]; } - (void)cancelAlert:(NSTimer *)scheduledTimer { - UIAlertView *alert = (UIAlertView *)(scheduledTimer.userInfo); - if (alert.tag == AlertWithoutConfirm) { - [alert dismissWithClickedButtonIndex:0 animated:NO]; - } + UIAlertView *alert = (UIAlertView *)(scheduledTimer.userInfo); + if (alert.tag == AlertWithoutConfirm) { + [alert dismissWithClickedButtonIndex:0 animated:NO]; + } } -- (void)loadErrorAlertWithConfirm:(NSString *)title - message:(NSString *)message { - UIAlertView *alert = [[UIAlertView alloc] - initWithTitle:title - message:message - delegate:nil - cancelButtonTitle:NSLocalizedStringFromTable(@"OK", @"RongCloudKit", nil) - otherButtonTitles:nil]; - alert.tag = AlertWithConfirm; - [alert show]; +- (void)loadErrorAlertWithConfirm:(NSString *)title message:(NSString *)message { + UIAlertView *alert = [[UIAlertView alloc] initWithTitle:title + message:message + delegate:nil + cancelButtonTitle:NSLocalizedStringFromTable(@"OK", @"RongCloudKit", nil) + otherButtonTitles:nil]; + alert.tag = AlertWithConfirm; + [alert show]; } - (void)dealloc { - [[NSNotificationCenter defaultCenter] removeObserver:self]; + [[NSNotificationCenter defaultCenter] removeObserver:self]; } //接口向后兼容 [[++ - (id)groupMemberDataSource { - return [RCIM sharedRCIM].groupMemberDataSource; + return [RCIM sharedRCIM].groupMemberDataSource; } - (void)setGroupMemberDataSource:(id)groupMemberDataSource { - [RCIM sharedRCIM].groupMemberDataSource = groupMemberDataSource; + [RCIM sharedRCIM].groupMemberDataSource = groupMemberDataSource; } //接口向后兼容 --]] diff --git a/ios-rongcallkit/RongCallKit/Utility/RCCallFloatingBoard.h b/ios-rongcallkit/RongCallKit/Utility/RCCallFloatingBoard.h index bb59c7a..938b50f 100644 --- a/ios-rongcallkit/RongCallKit/Utility/RCCallFloatingBoard.h +++ b/ios-rongcallkit/RongCallKit/Utility/RCCallFloatingBoard.h @@ -42,8 +42,7 @@ @param touchedBlock 悬浮窗点击的Block */ + (void)startCallFloatingBoard:(RCCallSession *)callSession - withTouchedBlock: - (void (^)(RCCallSession *callSession))touchedBlock; + withTouchedBlock:(void (^)(RCCallSession *callSession))touchedBlock; /*! 关闭当前悬浮窗 diff --git a/ios-rongcallkit/RongCallKit/Utility/RCCallFloatingBoard.m b/ios-rongcallkit/RongCallKit/Utility/RCCallFloatingBoard.m index cc12fb7..db28dfb 100644 --- a/ios-rongcallkit/RongCallKit/Utility/RCCallFloatingBoard.m +++ b/ios-rongcallkit/RongCallKit/Utility/RCCallFloatingBoard.m @@ -8,9 +8,9 @@ #import "RCCallFloatingBoard.h" #import "RCCallKitUtility.h" -#import -#import #import +#import +#import @interface RCCallFloatingBoard () @@ -28,398 +28,339 @@ @interface RCCallFloatingBoard () @implementation RCCallFloatingBoard + (void)startCallFloatingBoard:(RCCallSession *)callSession - withTouchedBlock: - (void (^)(RCCallSession *callSession))touchedBlock { - staticBoard = [[RCCallFloatingBoard alloc] init]; - staticBoard.callSession = callSession; - [staticBoard.callSession setDelegate:staticBoard]; - staticBoard.touchedBlock = touchedBlock; - [staticBoard initBoard]; + withTouchedBlock:(void (^)(RCCallSession *callSession))touchedBlock { + staticBoard = [[RCCallFloatingBoard alloc] init]; + staticBoard.callSession = callSession; + [staticBoard.callSession setDelegate:staticBoard]; + staticBoard.touchedBlock = touchedBlock; + [staticBoard initBoard]; } + (void)stopCallFloatingBoard { - [staticBoard hideCallFloatingBoard]; - [staticBoard clearCallFloatingBoard]; - staticBoard = nil; + [staticBoard hideCallFloatingBoard]; + [staticBoard clearCallFloatingBoard]; + staticBoard = nil; } - (void)initBoard { - if (self.callSession.callStatus == RCCallHangup) { - [self performSelector:@selector(clearCallFloatingBoard) - withObject:nil - afterDelay:2]; - } - [self updateActiveTimer]; - [self startActiveTimer]; - [self updateBoard]; - [self registerTelephonyEvent]; - [[NSNotificationCenter defaultCenter] - addObserver:self - selector:@selector(onOrientationChanged:) - name:UIApplicationDidChangeStatusBarOrientationNotification - object:nil]; - [self addProximityMonitoringObserver]; + if (self.callSession.callStatus == RCCallHangup) { + [self performSelector:@selector(clearCallFloatingBoard) withObject:nil afterDelay:2]; + } + [self updateActiveTimer]; + [self startActiveTimer]; + [self updateBoard]; + [self registerTelephonyEvent]; + [[NSNotificationCenter defaultCenter] addObserver:self + selector:@selector(onOrientationChanged:) + name:UIApplicationDidChangeStatusBarOrientationNotification + object:nil]; + [self addProximityMonitoringObserver]; } - (void)registerTelephonyEvent { - self.callCenter = [[CTCallCenter alloc] init]; - __weak __typeof(self) weakSelf = self; - self.callCenter.callEventHandler = ^(CTCall *call) { - if ([call.callState isEqualToString:CTCallStateConnected]) { - [weakSelf.callSession hangup]; - } - }; + self.callCenter = [[CTCallCenter alloc] init]; + __weak __typeof(self) weakSelf = self; + self.callCenter.callEventHandler = ^(CTCall *call) { + if ([call.callState isEqualToString:CTCallStateConnected]) { + [weakSelf.callSession hangup]; + } + }; } - (void)onOrientationChanged:(NSNotification *)notification { - [self updateBoard]; + [self updateBoard]; } - (void)startActiveTimer { - self.activeTimer = - [NSTimer scheduledTimerWithTimeInterval:1 - target:self - selector:@selector(updateActiveTimer) - userInfo:nil - repeats:YES]; - [self.activeTimer fire]; + self.activeTimer = [NSTimer scheduledTimerWithTimeInterval:1 + target:self + selector:@selector(updateActiveTimer) + userInfo:nil + repeats:YES]; + [self.activeTimer fire]; } - (void)stopActiveTimer { - if (self.activeTimer) { - [self.activeTimer invalidate]; - self.activeTimer = nil; - } + if (self.activeTimer) { + [self.activeTimer invalidate]; + self.activeTimer = nil; + } } - (void)updateActiveTimer { - long sec = [[NSDate date] timeIntervalSince1970] - - self.callSession.connectedTime / 1000; - if (self.callSession.callStatus == RCCallActive && - ![self isVideoViewEnabledSession]) { - [self.floatingButton - setTitle:[RCCallKitUtility getReadableStringForTime:sec] - forState:UIControlStateNormal]; - [self layoutTextUnderImageButton:self.floatingButton]; - } + long sec = [[NSDate date] timeIntervalSince1970] - self.callSession.connectedTime / 1000; + if (self.callSession.callStatus == RCCallActive && ![self isVideoViewEnabledSession]) { + [self.floatingButton setTitle:[RCCallKitUtility getReadableStringForTime:sec] forState:UIControlStateNormal]; + [self layoutTextUnderImageButton:self.floatingButton]; + } } - (void)updateBoard { - CGFloat posX = [[[NSUserDefaults standardUserDefaults] - objectForKey:RCVoipFloatingBoardPosX] floatValue]; - CGFloat posY = [[[NSUserDefaults standardUserDefaults] - objectForKey:RCVoipFloatingBoardPosY] floatValue]; - posX = posX ? posX : 30; - posY = posY ? posY : 30; - CGRect screenBounds = [UIScreen mainScreen].bounds; - posX = (posX + 30) > screenBounds.size.width ? (screenBounds.size.width - 30) - : posX; - posY = (posY + 48) > screenBounds.size.height - ? (screenBounds.size.height - 48) - : posY; - - if ([UIDevice currentDevice].orientation == - UIDeviceOrientationLandscapeLeft && - [self isSupportOrientation:UIInterfaceOrientationLandscapeLeft]) { - self.window.transform = CGAffineTransformMakeRotation(M_PI / 2); - self.window.frame = CGRectMake(posX, posY, 64, 96); - self.floatingButton.frame = CGRectMake(0, 0, 96, 64); - if ([self isVideoViewEnabledSession]) { - self.videoView.frame = CGRectMake(0, 0, 96, 64); - } - } else if ([UIDevice currentDevice].orientation == - UIDeviceOrientationLandscapeRight && - [self isSupportOrientation:UIInterfaceOrientationLandscapeRight]) { - self.window.transform = CGAffineTransformMakeRotation(-M_PI / 2); - self.window.frame = CGRectMake(posX, posY, 64, 96); - self.floatingButton.frame = CGRectMake(0, 0, 96, 64); - if ([self isVideoViewEnabledSession]) { - self.videoView.frame = CGRectMake(0, 0, 96, 64); - } - } else { - if ([UIDevice currentDevice].orientation == - UIDeviceOrientationPortraitUpsideDown && - [self isSupportOrientation:UIInterfaceOrientationPortraitUpsideDown]) { - self.window.transform = CGAffineTransformMakeRotation(M_PI); + CGFloat posX = [[[NSUserDefaults standardUserDefaults] objectForKey:RCVoipFloatingBoardPosX] floatValue]; + CGFloat posY = [[[NSUserDefaults standardUserDefaults] objectForKey:RCVoipFloatingBoardPosY] floatValue]; + posX = posX ? posX : 30; + posY = posY ? posY : 30; + CGRect screenBounds = [UIScreen mainScreen].bounds; + posX = (posX + 30) > screenBounds.size.width ? (screenBounds.size.width - 30) : posX; + posY = (posY + 48) > screenBounds.size.height ? (screenBounds.size.height - 48) : posY; + + if ([UIDevice currentDevice].orientation == UIDeviceOrientationLandscapeLeft && + [self isSupportOrientation:UIInterfaceOrientationLandscapeLeft]) { + self.window.transform = CGAffineTransformMakeRotation(M_PI / 2); + self.window.frame = CGRectMake(posX, posY, 64, 96); + self.floatingButton.frame = CGRectMake(0, 0, 96, 64); + if ([self isVideoViewEnabledSession]) { + self.videoView.frame = CGRectMake(0, 0, 96, 64); + } + } else if ([UIDevice currentDevice].orientation == UIDeviceOrientationLandscapeRight && + [self isSupportOrientation:UIInterfaceOrientationLandscapeRight]) { + self.window.transform = CGAffineTransformMakeRotation(-M_PI / 2); + self.window.frame = CGRectMake(posX, posY, 64, 96); + self.floatingButton.frame = CGRectMake(0, 0, 96, 64); + if ([self isVideoViewEnabledSession]) { + self.videoView.frame = CGRectMake(0, 0, 96, 64); + } } else { - self.window.transform = CGAffineTransformMakeRotation(0); + if ([UIDevice currentDevice].orientation == UIDeviceOrientationPortraitUpsideDown && + [self isSupportOrientation:UIInterfaceOrientationPortraitUpsideDown]) { + self.window.transform = CGAffineTransformMakeRotation(M_PI); + } else { + self.window.transform = CGAffineTransformMakeRotation(0); + } + + self.window.frame = CGRectMake(posX, posY, 64, 96); + self.floatingButton.frame = CGRectMake(0, 0, 64, 96); + if ([self isVideoViewEnabledSession]) { + self.videoView.frame = CGRectMake(0, 0, 64, 96); + } } - self.window.frame = CGRectMake(posX, posY, 64, 96); - self.floatingButton.frame = CGRectMake(0, 0, 64, 96); if ([self isVideoViewEnabledSession]) { - self.videoView.frame = CGRectMake(0, 0, 64, 96); - } - } - - if ([self isVideoViewEnabledSession]) { - if (self.callSession.callStatus == RCCallActive) { - [self.callSession setVideoView:self.videoView - userId:self.callSession.targetId]; - [self.callSession - setVideoView:nil - userId:[RCIMClient sharedRCIMClient].currentUserInfo.userId]; - } else if (self.callSession.callStatus == RCCallHangup) { - UILabel *videoStopTips = [[UILabel alloc] - initWithFrame:CGRectMake(0, self.videoView.frame.size.height / 2 - 10, - self.videoView.frame.size.width, 20)]; - videoStopTips.textAlignment = NSTextAlignmentCenter; - videoStopTips.text = - NSLocalizedStringFromTable(@"VoIPCallHasEnd", @"RongCloudKit", nil); - videoStopTips.textColor = RongVoIPUIColorFromRGB(0x0195ff); - [self.videoView addSubview:videoStopTips]; - } - } else { - if (self.callSession.callStatus == RCCallActive) { - [self.floatingButton setBackgroundColor:[UIColor clearColor]]; - } else if (self.callSession.callStatus == RCCallHangup) { - [self.floatingButton setTitle:NSLocalizedStringFromTable( - @"VoIPCallHasEnd", @"RongCloudKit", nil) - forState:UIControlStateNormal]; + if (self.callSession.callStatus == RCCallActive) { + [self.callSession setVideoView:self.videoView userId:self.callSession.targetId]; + [self.callSession setVideoView:nil userId:[RCIMClient sharedRCIMClient].currentUserInfo.userId]; + } else if (self.callSession.callStatus == RCCallHangup) { + UILabel *videoStopTips = + [[UILabel alloc] initWithFrame:CGRectMake(0, self.videoView.frame.size.height / 2 - 10, + self.videoView.frame.size.width, 20)]; + videoStopTips.textAlignment = NSTextAlignmentCenter; + videoStopTips.text = NSLocalizedStringFromTable(@"VoIPCallHasEnd", @"RongCloudKit", nil); + videoStopTips.textColor = RongVoIPUIColorFromRGB(0x0195ff); + [self.videoView addSubview:videoStopTips]; + } + } else { + if (self.callSession.callStatus == RCCallActive) { + [self.floatingButton setBackgroundColor:[UIColor clearColor]]; + } else if (self.callSession.callStatus == RCCallHangup) { + [self.floatingButton setTitle:NSLocalizedStringFromTable(@"VoIPCallHasEnd", @"RongCloudKit", nil) + forState:UIControlStateNormal]; + } } - } } - (UIWindow *)window { - if (!_window) { - CGFloat posX = [[[NSUserDefaults standardUserDefaults] - objectForKey:RCVoipFloatingBoardPosX] floatValue]; - CGFloat posY = [[[NSUserDefaults standardUserDefaults] - objectForKey:RCVoipFloatingBoardPosY] floatValue]; - posX = (posX - 30) ? posX : 30; - posY = (posY - 48) ? posY : 48; - CGRect screenBounds = [UIScreen mainScreen].bounds; - posX = (posX + 30) > screenBounds.size.width - ? (screenBounds.size.width - 30) - : posX; - posY = (posY + 48) > screenBounds.size.height - ? (screenBounds.size.height - 48) - : posY; - _window = [[UIWindow alloc] initWithFrame:CGRectMake(posX, posY, 64, 96)]; - _window.backgroundColor = [UIColor whiteColor]; - _window.windowLevel = UIWindowLevelAlert + 1; - _window.layer.cornerRadius = 4; - _window.layer.masksToBounds = YES; - _window.layer.borderWidth = 1; - _window.layer.borderColor = [RongVoIPUIColorFromRGB(0x0195ff) CGColor]; - [_window makeKeyAndVisible]; //关键语句,显示window - - UIPanGestureRecognizer *panGestureRecognizer = - [[UIPanGestureRecognizer alloc] - initWithTarget:self - action:@selector(handlePanGestures:)]; - panGestureRecognizer.minimumNumberOfTouches = 1; - panGestureRecognizer.maximumNumberOfTouches = 1; - [_window addGestureRecognizer:panGestureRecognizer]; - } - return _window; + if (!_window) { + CGFloat posX = [[[NSUserDefaults standardUserDefaults] objectForKey:RCVoipFloatingBoardPosX] floatValue]; + CGFloat posY = [[[NSUserDefaults standardUserDefaults] objectForKey:RCVoipFloatingBoardPosY] floatValue]; + posX = (posX - 30) ? posX : 30; + posY = (posY - 48) ? posY : 48; + CGRect screenBounds = [UIScreen mainScreen].bounds; + posX = (posX + 30) > screenBounds.size.width ? (screenBounds.size.width - 30) : posX; + posY = (posY + 48) > screenBounds.size.height ? (screenBounds.size.height - 48) : posY; + _window = [[UIWindow alloc] initWithFrame:CGRectMake(posX, posY, 64, 96)]; + _window.backgroundColor = [UIColor whiteColor]; + _window.windowLevel = UIWindowLevelAlert + 1; + _window.layer.cornerRadius = 4; + _window.layer.masksToBounds = YES; + _window.layer.borderWidth = 1; + _window.layer.borderColor = [RongVoIPUIColorFromRGB(0x0195ff) CGColor]; + [_window makeKeyAndVisible]; //关键语句,显示window + + UIPanGestureRecognizer *panGestureRecognizer = + [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(handlePanGestures:)]; + panGestureRecognizer.minimumNumberOfTouches = 1; + panGestureRecognizer.maximumNumberOfTouches = 1; + [_window addGestureRecognizer:panGestureRecognizer]; + } + return _window; } - (UIView *)videoView { - if (!_videoView) { - _videoView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 64, 96)]; - _videoView.backgroundColor = [UIColor blackColor]; - CGRect windowFrame = self.window.frame; - windowFrame.size.width = _videoView.frame.size.width; - windowFrame.size.height = _videoView.frame.size.height; - self.window.frame = windowFrame; - [self.window addSubview:_videoView]; - - UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] - initWithTarget:self - action:@selector(touchedBoard:)]; - [_videoView addGestureRecognizer:tap]; - } - return _videoView; + if (!_videoView) { + _videoView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 64, 96)]; + _videoView.backgroundColor = [UIColor blackColor]; + CGRect windowFrame = self.window.frame; + windowFrame.size.width = _videoView.frame.size.width; + windowFrame.size.height = _videoView.frame.size.height; + self.window.frame = windowFrame; + [self.window addSubview:_videoView]; + + UITapGestureRecognizer *tap = + [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(touchedBoard:)]; + [_videoView addGestureRecognizer:tap]; + } + return _videoView; } - (UIButton *)floatingButton { - if (!_floatingButton) { - _floatingButton = [UIButton buttonWithType:UIButtonTypeCustom]; - if (self.callSession.mediaType == RCCallMediaAudio) { - [_floatingButton - setImage:[RCCallKitUtility imageFromVoIPBundle:@"voip/audio_min.png"] - forState:UIControlStateNormal]; - } else { - [_floatingButton - setImage:[RCCallKitUtility imageFromVoIPBundle:@"voip/video_min.png"] - forState:UIControlStateNormal]; - } - [_floatingButton setTitle:@"" forState:UIControlStateNormal]; - _floatingButton.backgroundColor = [UIColor clearColor]; - _floatingButton.frame = CGRectMake(0, 0, 64, 96); - CGRect windowFrame = self.window.frame; - windowFrame.size.width = _floatingButton.frame.size.width; - windowFrame.size.height = _floatingButton.frame.size.height; - self.window.frame = windowFrame; + if (!_floatingButton) { + _floatingButton = [UIButton buttonWithType:UIButtonTypeCustom]; + if (self.callSession.mediaType == RCCallMediaAudio) { + [_floatingButton setImage:[RCCallKitUtility imageFromVoIPBundle:@"voip/audio_min.png"] + forState:UIControlStateNormal]; + } else { + [_floatingButton setImage:[RCCallKitUtility imageFromVoIPBundle:@"voip/video_min.png"] + forState:UIControlStateNormal]; + } + [_floatingButton setTitle:@"" forState:UIControlStateNormal]; + _floatingButton.backgroundColor = [UIColor clearColor]; + _floatingButton.frame = CGRectMake(0, 0, 64, 96); + CGRect windowFrame = self.window.frame; + windowFrame.size.width = _floatingButton.frame.size.width; + windowFrame.size.height = _floatingButton.frame.size.height; + self.window.frame = windowFrame; - [_floatingButton addTarget:self - action:@selector(touchedBoard:) - forControlEvents:UIControlEventTouchUpInside]; + [_floatingButton addTarget:self action:@selector(touchedBoard:) forControlEvents:UIControlEventTouchUpInside]; - [self.window addSubview:_floatingButton]; - } - return _floatingButton; + [self.window addSubview:_floatingButton]; + } + return _floatingButton; } - (BOOL)isSupportOrientation:(UIInterfaceOrientation)orientation { - UIInterfaceOrientationMask mask = [[UIApplication sharedApplication] - supportedInterfaceOrientationsForWindow:self.window]; - return mask & (1 << orientation); + UIInterfaceOrientationMask mask = + [[UIApplication sharedApplication] supportedInterfaceOrientationsForWindow:self.window]; + return mask & (1 << orientation); } - (void)handlePanGestures:(UIPanGestureRecognizer *)paramSender { - if (paramSender.state != UIGestureRecognizerStateEnded && - paramSender.state != UIGestureRecognizerStateFailed) { - CGPoint location = [paramSender - locationInView:[UIApplication sharedApplication].windows[0]]; - - if ([UIDevice currentDevice].orientation == - UIDeviceOrientationLandscapeLeft && - [self isSupportOrientation:UIInterfaceOrientationLandscapeLeft]) { - CGFloat tmp = location.x; - location.x = [UIScreen mainScreen].bounds.size.height - location.y; - location.y = tmp; - } else if ([UIDevice currentDevice].orientation == - UIDeviceOrientationLandscapeRight && - [self - isSupportOrientation:UIInterfaceOrientationLandscapeRight]) { - CGFloat tmp = location.x; - location.x = location.y; - location.y = [UIScreen mainScreen].bounds.size.width - tmp; - } else if ([UIDevice currentDevice].orientation == - UIDeviceOrientationPortraitUpsideDown && - [self isSupportOrientation: - UIInterfaceOrientationPortraitUpsideDown]) { - CGFloat tmp = location.x; - location.x = [UIScreen mainScreen].bounds.size.height - location.y; - location.y = [UIScreen mainScreen].bounds.size.width - tmp; - } + if (paramSender.state != UIGestureRecognizerStateEnded && paramSender.state != UIGestureRecognizerStateFailed) { + CGPoint location = [paramSender locationInView:[UIApplication sharedApplication].windows[0]]; + + if ([UIDevice currentDevice].orientation == UIDeviceOrientationLandscapeLeft && + [self isSupportOrientation:UIInterfaceOrientationLandscapeLeft]) { + CGFloat tmp = location.x; + location.x = [UIScreen mainScreen].bounds.size.height - location.y; + location.y = tmp; + } else if ([UIDevice currentDevice].orientation == UIDeviceOrientationLandscapeRight && + [self isSupportOrientation:UIInterfaceOrientationLandscapeRight]) { + CGFloat tmp = location.x; + location.x = location.y; + location.y = [UIScreen mainScreen].bounds.size.width - tmp; + } else if ([UIDevice currentDevice].orientation == UIDeviceOrientationPortraitUpsideDown && + [self isSupportOrientation:UIInterfaceOrientationPortraitUpsideDown]) { + CGFloat tmp = location.x; + location.x = [UIScreen mainScreen].bounds.size.height - location.y; + location.y = [UIScreen mainScreen].bounds.size.width - tmp; + } - CGRect frame = self.window.frame; - frame.origin.x = location.x - frame.size.width / 2; - frame.origin.y = location.y - frame.size.height / 2; + CGRect frame = self.window.frame; + frame.origin.x = location.x - frame.size.width / 2; + frame.origin.y = location.y - frame.size.height / 2; - if (frame.origin.x < 0) { - frame.origin.x = 2; - } - if (frame.origin.y < 0) { - frame.origin.y = 2; - } + if (frame.origin.x < 0) { + frame.origin.x = 2; + } + if (frame.origin.y < 0) { + frame.origin.y = 2; + } - if ([RCCallKitUtility isLandscape] && - [self isSupportOrientation:[UIDevice currentDevice].orientation]) { - if (frame.origin.y + frame.size.height > - [UIScreen mainScreen].bounds.size.width) { - frame.origin.y = - [UIScreen mainScreen].bounds.size.width - 2 - frame.size.height; - } - - if (frame.origin.x + frame.size.width > - [UIScreen mainScreen].bounds.size.height) { - frame.origin.x = - [UIScreen mainScreen].bounds.size.height - 2 - frame.size.width; - } - } else { - if (frame.origin.x + frame.size.width > - [UIScreen mainScreen].bounds.size.width) { - frame.origin.x = - [UIScreen mainScreen].bounds.size.width - 2 - frame.size.width; - } - - if (frame.origin.y + frame.size.height > - [UIScreen mainScreen].bounds.size.height) { - frame.origin.y = - [UIScreen mainScreen].bounds.size.height - 2 - frame.size.height; - } + if ([RCCallKitUtility isLandscape] && [self isSupportOrientation:(UIInterfaceOrientation)[UIDevice currentDevice].orientation]) { + if (frame.origin.y + frame.size.height > [UIScreen mainScreen].bounds.size.width) { + frame.origin.y = [UIScreen mainScreen].bounds.size.width - 2 - frame.size.height; + } + + if (frame.origin.x + frame.size.width > [UIScreen mainScreen].bounds.size.height) { + frame.origin.x = [UIScreen mainScreen].bounds.size.height - 2 - frame.size.width; + } + } else { + if (frame.origin.x + frame.size.width > [UIScreen mainScreen].bounds.size.width) { + frame.origin.x = [UIScreen mainScreen].bounds.size.width - 2 - frame.size.width; + } + + if (frame.origin.y + frame.size.height > [UIScreen mainScreen].bounds.size.height) { + frame.origin.y = [UIScreen mainScreen].bounds.size.height - 2 - frame.size.height; + } + } + self.window.frame = frame; + } else if (paramSender.state == UIGestureRecognizerStateEnded) { + CGRect frame = self.window.frame; + [[NSUserDefaults standardUserDefaults] setObject:@(frame.origin.x) forKey:RCVoipFloatingBoardPosX]; + [[NSUserDefaults standardUserDefaults] setObject:@(frame.origin.y) forKey:RCVoipFloatingBoardPosY]; + [[NSUserDefaults standardUserDefaults] synchronize]; } - self.window.frame = frame; - } else if (paramSender.state == UIGestureRecognizerStateEnded) { - CGRect frame = self.window.frame; - [[NSUserDefaults standardUserDefaults] setObject:@(frame.origin.x) - forKey:RCVoipFloatingBoardPosX]; - [[NSUserDefaults standardUserDefaults] setObject:@(frame.origin.y) - forKey:RCVoipFloatingBoardPosY]; - [[NSUserDefaults standardUserDefaults] synchronize]; - } } - (void)touchedBoard:(id)sender { - [self hideCallFloatingBoard]; - if (self.touchedBlock) { - self.touchedBlock(self.callSession); - } - [self clearCallFloatingBoard]; + [self hideCallFloatingBoard]; + if (self.touchedBlock) { + self.touchedBlock(self.callSession); + } + [self clearCallFloatingBoard]; } - (void)hideCallFloatingBoard { - [self stopActiveTimer]; + [self stopActiveTimer]; - if (_videoView) { - [_videoView removeFromSuperview]; - _videoView = nil; - } - if (_floatingButton) { - [_floatingButton removeFromSuperview]; - _floatingButton = nil; - } - [_window setHidden:YES]; + if (_videoView) { + [_videoView removeFromSuperview]; + _videoView = nil; + } + if (_floatingButton) { + [_floatingButton removeFromSuperview]; + _floatingButton = nil; + } + [_window setHidden:YES]; } - (void)clearCallFloatingBoard { - [[NSNotificationCenter defaultCenter] removeObserver:self]; - _activeTimer = nil; - _callSession = nil; - _touchedBlock = nil; - _floatingButton = nil; - _videoView = nil; - _window = nil; - staticBoard = nil; + [[NSNotificationCenter defaultCenter] removeObserver:self]; + _activeTimer = nil; + _callSession = nil; + _touchedBlock = nil; + _floatingButton = nil; + _videoView = nil; + _window = nil; + staticBoard = nil; } - (void)layoutTextUnderImageButton:(UIButton *)button { - [button.titleLabel setFont:[UIFont systemFontOfSize:16]]; - [button setTitleColor:RongVoIPUIColorFromRGB(0x0195ff) - forState:UIControlStateNormal]; - - button.titleEdgeInsets = UIEdgeInsetsMake( - 0, -button.imageView.frame.size.width, - -button.imageView.frame.size.height - RCCallInsideMargin / 2, 0); - // button.imageEdgeInsets = - // UIEdgeInsetsMake(-button.titleLabel.frame.size.height-offset/2, 0, 0, - // -button.titleLabel.frame.size.width); - // 由于iOS8中titleLabel的size为0,用上面这样设置有问题,修改一下即可 - button.imageEdgeInsets = UIEdgeInsetsMake( - -button.titleLabel.intrinsicContentSize.height - RCCallInsideMargin / 2, - 0, 0, -button.titleLabel.intrinsicContentSize.width); + [button.titleLabel setFont:[UIFont systemFontOfSize:16]]; + [button setTitleColor:RongVoIPUIColorFromRGB(0x0195ff) forState:UIControlStateNormal]; + + button.titleEdgeInsets = UIEdgeInsetsMake(0, -button.imageView.frame.size.width, + -button.imageView.frame.size.height - RCCallInsideMargin / 2, 0); + // button.imageEdgeInsets = + // UIEdgeInsetsMake(-button.titleLabel.frame.size.height-offset/2, 0, 0, + // -button.titleLabel.frame.size.width); + // 由于iOS8中titleLabel的size为0,用上面这样设置有问题,修改一下即可 + button.imageEdgeInsets = UIEdgeInsetsMake(-button.titleLabel.intrinsicContentSize.height - RCCallInsideMargin / 2, + 0, 0, -button.titleLabel.intrinsicContentSize.width); } - (BOOL)isVideoViewEnabledSession { - if (self.callSession.mediaType == RCCallMediaVideo && - !self.callSession.isMultiCall) { - return YES; - } else { - return NO; - } + if (self.callSession.mediaType == RCCallMediaVideo && !self.callSession.isMultiCall) { + return YES; + } else { + return NO; + } } /*! 通话已接通 */ - (void)callDidConnect { - [self updateBoard]; + [self updateBoard]; } /*! 通话已结束 */ - (void)callDidDisconnect { - [self updateBoard]; - [self performSelector:@selector(clearCallFloatingBoard) - withObject:nil - afterDelay:2]; - [RCCallKitUtility clearScreenForceOnStatus]; - [self removeProximityMonitoringObserver]; + [self updateBoard]; + [self performSelector:@selector(clearCallFloatingBoard) withObject:nil afterDelay:2]; + [RCCallKitUtility clearScreenForceOnStatus]; + [self removeProximityMonitoringObserver]; } /*! @@ -436,8 +377,7 @@ - (void)remoteUserDidRing:(NSString *)userId { @param userId 被邀请的用户ID @param mediaType 希望被邀请者选择的媒体类型 */ -- (void)remoteUserDidInvite:(NSString *)userId - mediaType:(RCCallMediaType)mediaType { +- (void)remoteUserDidInvite:(NSString *)userId mediaType:(RCCallMediaType)mediaType { } /*! @@ -446,8 +386,7 @@ - (void)remoteUserDidInvite:(NSString *)userId @param userId 用户ID @param mediaType 用户的媒体类型 */ -- (void)remoteUserDidJoin:(NSString *)userId - mediaType:(RCCallMediaType)mediaType { +- (void)remoteUserDidJoin:(NSString *)userId mediaType:(RCCallMediaType)mediaType { } /*! @@ -456,19 +395,17 @@ - (void)remoteUserDidJoin:(NSString *)userId @param userId 用户ID @param mediaType 切换至的媒体类型 */ -- (void)remoteUserDidChangeMediaType:(NSString *)userId - mediaType:(RCCallMediaType)mediaType { - dispatch_async(dispatch_get_main_queue(), ^{ - if (!self.callSession.isMultiCall) { - if (mediaType == RCCallMediaAudio && - self.callSession.mediaType != RCCallMediaAudio) { - if ([self.callSession changeMediaType:RCCallMediaAudio]) { - [self.videoView removeFromSuperview]; - [self initBoard]; +- (void)remoteUserDidChangeMediaType:(NSString *)userId mediaType:(RCCallMediaType)mediaType { + dispatch_async(dispatch_get_main_queue(), ^{ + if (!self.callSession.isMultiCall) { + if (mediaType == RCCallMediaAudio && self.callSession.mediaType != RCCallMediaAudio) { + if ([self.callSession changeMediaType:RCCallMediaAudio]) { + [self.videoView removeFromSuperview]; + [self initBoard]; + } + } } - } - } - }); + }); } /*! @@ -486,8 +423,7 @@ - (void)remoteUserDidDisableCamera:(BOOL)muted byUser:(NSString *)userId { @param userId 用户ID @param reason 挂断的原因 */ -- (void)remoteUserDidLeft:(NSString *)userId - reason:(RCCallDisconnectReason)reason { +- (void)remoteUserDidLeft:(NSString *)userId reason:(RCCallDisconnectReason)reason { } /*! @@ -519,31 +455,29 @@ - (void)errorDidOccur:(RCCallErrorCode)error { } - (void)addProximityMonitoringObserver { - [UIDevice currentDevice].proximityMonitoringEnabled = YES; - - [[NSNotificationCenter defaultCenter] - addObserver:self - selector:@selector(proximityStatueChanged:) - name:UIDeviceProximityStateDidChangeNotification - object:nil]; + [UIDevice currentDevice].proximityMonitoringEnabled = YES; + + [[NSNotificationCenter defaultCenter] addObserver:self + selector:@selector(proximityStatueChanged:) + name:UIDeviceProximityStateDidChangeNotification + object:nil]; } - (void)removeProximityMonitoringObserver { - [UIDevice currentDevice].proximityMonitoringEnabled = NO; - - [[NSNotificationCenter defaultCenter] - removeObserver:self - name:UIDeviceProximityStateDidChangeNotification - object:nil]; + [UIDevice currentDevice].proximityMonitoringEnabled = NO; + + [[NSNotificationCenter defaultCenter] removeObserver:self + name:UIDeviceProximityStateDidChangeNotification + object:nil]; } - (void)proximityStatueChanged:(NSNotificationCenter *)notification { - // if ([UIDevice currentDevice].proximityState) { - // [[AVAudioSession sharedInstance] - // setCategory:AVAudioSessionCategoryPlayAndRecord error:nil]; - // } else { - // [[AVAudioSession sharedInstance] - // setCategory:AVAudioSessionCategoryPlayback error:nil]; - // } + // if ([UIDevice currentDevice].proximityState) { + // [[AVAudioSession sharedInstance] + // setCategory:AVAudioSessionCategoryPlayAndRecord error:nil]; + // } else { + // [[AVAudioSession sharedInstance] + // setCategory:AVAudioSessionCategoryPlayback error:nil]; + // } } @end diff --git a/ios-rongcallkit/RongCallKit/Utility/RCCallKitUtility.h b/ios-rongcallkit/RongCallKit/Utility/RCCallKitUtility.h index d0f3c00..0b68c84 100644 --- a/ios-rongcallkit/RongCallKit/Utility/RCCallKitUtility.h +++ b/ios-rongcallkit/RongCallKit/Utility/RCCallKitUtility.h @@ -11,16 +11,14 @@ #import #import -#define RongVoIPUIColorFromRGB(rgbValue) \ - [UIColor colorWithRed:((float)((rgbValue & 0xFF0000) >> 16)) / 255.0 \ - green:((float)((rgbValue & 0x00FF00) >> 8)) / 255.0 \ - blue:((float)((rgbValue & 0x0000FF) >> 0)) / 255.0 \ - alpha:1.0] +#define RongVoIPUIColorFromRGB(rgbValue) \ + [UIColor colorWithRed:((float)((rgbValue & 0xFF0000) >> 16)) / 255.0 \ + green:((float)((rgbValue & 0x00FF00) >> 8)) / 255.0 \ + blue:((float)((rgbValue & 0x0000FF) >> 0)) / 255.0 \ + alpha:1.0] -#define RC_IOS_SYSTEM_VERSION_LESS_THAN(v) \ - ([[[UIDevice currentDevice] systemVersion] \ - compare:v \ - options:NSNumericSearch] == NSOrderedAscending) +#define RC_IOS_SYSTEM_VERSION_LESS_THAN(v) \ + ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] == NSOrderedAscending) #define RCCallHeaderLength 80.0f #define RCCallButtonLength 64.0f @@ -41,11 +39,9 @@ + (UIImage *)getDefaultPortraitImage; -+ (NSString *)getReadableStringForMessageCell: - (RCCallDisconnectReason)hangupReason; ++ (NSString *)getReadableStringForMessageCell:(RCCallDisconnectReason)hangupReason; -+ (NSString *)getReadableStringForCallViewController: - (RCCallDisconnectReason)hangupReason; ++ (NSString *)getReadableStringForCallViewController:(RCCallDisconnectReason)hangupReason; + (BOOL)isLandscape; diff --git a/ios-rongcallkit/RongCallKit/Utility/RCCallKitUtility.m b/ios-rongcallkit/RongCallKit/Utility/RCCallKitUtility.m index 09643f5..f079ead 100644 --- a/ios-rongcallkit/RongCallKit/Utility/RCCallKitUtility.m +++ b/ios-rongcallkit/RongCallKit/Utility/RCCallKitUtility.m @@ -12,166 +12,143 @@ @implementation RCCallKitUtility + (NSString *)getReadableStringForTime:(long)sec { - if (sec < 60 * 60) { - return [NSString stringWithFormat:@"%02ld:%02ld", sec / 60, sec % 60]; - } else { - return [NSString stringWithFormat:@"%02ld:%02ld:%02ld", sec / 60 / 60, - (sec / 60) % 60, sec % 60]; - } + if (sec < 60 * 60) { + return [NSString stringWithFormat:@"%02ld:%02ld", sec / 60, sec % 60]; + } else { + return [NSString stringWithFormat:@"%02ld:%02ld:%02ld", sec / 60 / 60, (sec / 60) % 60, sec % 60]; + } } + (UIImage *)getScaleImage:(UIImage *)image size:(CGSize)size { - UIGraphicsBeginImageContext(size); - if (size.height >= size.width) { - [image drawInRect:CGRectMake((size.width - size.height) / 2, 0, size.height, - size.height)]; - } else { - [image drawInRect:CGRectMake(0, (size.height - size.width) / 2, size.width, - size.width)]; - } - - UIImage *scaledImage = UIGraphicsGetImageFromCurrentImageContext(); - UIGraphicsEndImageContext(); - return scaledImage; + UIGraphicsBeginImageContext(size); + if (size.height >= size.width) { + [image drawInRect:CGRectMake((size.width - size.height) / 2, 0, size.height, size.height)]; + } else { + [image drawInRect:CGRectMake(0, (size.height - size.width) / 2, size.width, size.width)]; + } + + UIImage *scaledImage = UIGraphicsGetImageFromCurrentImageContext(); + UIGraphicsEndImageContext(); + return scaledImage; } + (UIColor *)getScaleImageColor:(UIImage *)image size:(CGSize)size { - return [UIColor colorWithPatternImage:[self getScaleImage:image size:size]]; + return [UIColor colorWithPatternImage:[self getScaleImage:image size:size]]; } + (UIImage *)imageFromVoIPBundle:(NSString *)imageName { - NSString *imagePath = - [[[NSBundle mainBundle] pathForResource:@"RongCloud" ofType:@"bundle"] - stringByAppendingPathComponent:imageName]; + NSString *imagePath = [[[NSBundle mainBundle] pathForResource:@"RongCloud" ofType:@"bundle"] + stringByAppendingPathComponent:imageName]; - UIImage *bundleImage = [UIImage imageWithContentsOfFile:imagePath]; - return bundleImage; + UIImage *bundleImage = [UIImage imageWithContentsOfFile:imagePath]; + return bundleImage; } + (UIImage *)getDefaultPortraitImage { - return [RCKitUtility imageNamed:@"default_portrait_msg" - ofBundle:@"RongCloud.bundle"]; + return [RCKitUtility imageNamed:@"default_portrait_msg" ofBundle:@"RongCloud.bundle"]; } + (NSString *)getGeneralReadableString:(RCCallDisconnectReason)hangupReason { - NSString *hangupReasonString = nil; - switch (hangupReason) { - case RCCallDisconnectReasonCancel: - hangupReasonString = - NSLocalizedStringFromTable(@"VoIPCallHasCancel", @"RongCloudKit", nil); - break; - case RCCallDisconnectReasonReject: - hangupReasonString = - NSLocalizedStringFromTable(@"VoIPCallHasReject", @"RongCloudKit", nil); - break; - case RCCallDisconnectReasonHangup: - hangupReasonString = - NSLocalizedStringFromTable(@"VoIPCallHasHangup", @"RongCloudKit", nil); - break; - case RCCallDisconnectReasonRemoteCancel: - hangupReasonString = NSLocalizedStringFromTable(@"VoIPCallRemoteCancel", - @"RongCloudKit", nil); - break; - case RCCallDisconnectReasonRemoteReject: - hangupReasonString = NSLocalizedStringFromTable(@"VoIPCallRemoteReject", - @"RongCloudKit", nil); - break; - case RCCallDisconnectReasonRemoteHangup: - hangupReasonString = NSLocalizedStringFromTable(@"VoIPCallRemoteHangup", - @"RongCloudKit", nil); - break; - case RCCallDisconnectReasonRemoteBusyLine: - hangupReasonString = NSLocalizedStringFromTable(@"VoIPCallRemoteBusyLine", - @"RongCloudKit", nil); - break; - case RCCallDisconnectReasonRemoteNoResponse: - hangupReasonString = NSLocalizedStringFromTable(@"VoIPCallRemoteNoResponse", - @"RongCloudKit", nil); - break; - case RCCallDisconnectReasonAcceptByOtherClient: - hangupReasonString = NSLocalizedStringFromTable(@"VoIPCallAcceptByOtherClient", - @"RongCloudKit", nil); - break; - - default: - break; - } - return hangupReasonString; + NSString *hangupReasonString = nil; + switch (hangupReason) { + case RCCallDisconnectReasonCancel: + hangupReasonString = NSLocalizedStringFromTable(@"VoIPCallHasCancel", @"RongCloudKit", nil); + break; + case RCCallDisconnectReasonReject: + hangupReasonString = NSLocalizedStringFromTable(@"VoIPCallHasReject", @"RongCloudKit", nil); + break; + case RCCallDisconnectReasonHangup: + hangupReasonString = NSLocalizedStringFromTable(@"VoIPCallHasHangup", @"RongCloudKit", nil); + break; + case RCCallDisconnectReasonRemoteCancel: + hangupReasonString = NSLocalizedStringFromTable(@"VoIPCallRemoteCancel", @"RongCloudKit", nil); + break; + case RCCallDisconnectReasonRemoteReject: + hangupReasonString = NSLocalizedStringFromTable(@"VoIPCallRemoteReject", @"RongCloudKit", nil); + break; + case RCCallDisconnectReasonRemoteHangup: + hangupReasonString = NSLocalizedStringFromTable(@"VoIPCallRemoteHangup", @"RongCloudKit", nil); + break; + case RCCallDisconnectReasonRemoteBusyLine: + hangupReasonString = NSLocalizedStringFromTable(@"VoIPCallRemoteBusyLine", @"RongCloudKit", nil); + break; + case RCCallDisconnectReasonRemoteNoResponse: + hangupReasonString = NSLocalizedStringFromTable(@"VoIPCallRemoteNoResponse", @"RongCloudKit", nil); + break; + case RCCallDisconnectReasonAcceptByOtherClient: + hangupReasonString = NSLocalizedStringFromTable(@"VoIPCallAcceptByOtherClient", @"RongCloudKit", nil); + break; + + default: + break; + } + return hangupReasonString; } -+ (NSString *)getReadableStringForMessageCell: - (RCCallDisconnectReason)hangupReason { - NSString *hangupReasonString = nil; - switch (hangupReason) { - case RCCallDisconnectReasonBusyLine: - hangupReasonString = - NSLocalizedStringFromTable(@"VoIPCallNoResponse", @"RongCloudKit", nil); - break; - case RCCallDisconnectReasonNoResponse: - hangupReasonString = - NSLocalizedStringFromTable(@"VoIPCallNoResponse", @"RongCloudKit", nil); - break; - case RCCallDisconnectReasonNetworkError: - hangupReasonString = - NSLocalizedStringFromTable(@"VoIPCallNoResponse", @"RongCloudKit", nil); - break; - case RCCallDisconnectReasonRemoteNetworkError: - hangupReasonString = NSLocalizedStringFromTable(@"VoIPCallRemoteNoResponse", - @"RongCloudKit", nil); - break; - case RCCallDisconnectReasonAddToBlackList: - hangupReasonString = NSLocalizedStringFromTable(@"VoIPCallHasReject", @"RongCloudKit", nil); - break; - default: - hangupReasonString = [self getGeneralReadableString:hangupReason]; - break; - } - return hangupReasonString; ++ (NSString *)getReadableStringForMessageCell:(RCCallDisconnectReason)hangupReason { + NSString *hangupReasonString = nil; + switch (hangupReason) { + case RCCallDisconnectReasonBusyLine: + hangupReasonString = NSLocalizedStringFromTable(@"VoIPCallNoResponse", @"RongCloudKit", nil); + break; + case RCCallDisconnectReasonNoResponse: + hangupReasonString = NSLocalizedStringFromTable(@"VoIPCallNoResponse", @"RongCloudKit", nil); + break; + case RCCallDisconnectReasonNetworkError: + hangupReasonString = NSLocalizedStringFromTable(@"VoIPCallNoResponse", @"RongCloudKit", nil); + break; + case RCCallDisconnectReasonRemoteNetworkError: + hangupReasonString = NSLocalizedStringFromTable(@"VoIPCallRemoteNoResponse", @"RongCloudKit", nil); + break; + case RCCallDisconnectReasonAddToBlackList: + hangupReasonString = NSLocalizedStringFromTable(@"VoIPCallHasReject", @"RongCloudKit", nil); + break; + default: + hangupReasonString = [self getGeneralReadableString:hangupReason]; + break; + } + return hangupReasonString; } -+ (NSString *)getReadableStringForCallViewController: - (RCCallDisconnectReason)hangupReason { - NSString *hangupReasonString = nil; - switch (hangupReason) { - case RCCallDisconnectReasonNoResponse: - hangupReasonString = - NSLocalizedStringFromTable(@"VoIPCallNoResponse", @"RongCloudKit", nil); - break; - case RCCallDisconnectReasonNetworkError: - hangupReasonString = NSLocalizedStringFromTable( - @"VoIPCallLocalNetworkError", @"RongCloudKit", nil); - break; - case RCCallDisconnectReasonRemoteNetworkError: - hangupReasonString = NSLocalizedStringFromTable( - @"VoIPCallRemoteNetworkError", @"RongCloudKit", nil); - break; - case RCCallDisconnectReasonRemoteBusyLine: - hangupReasonString = NSLocalizedStringFromTable( - @"VoIPCallRemoteBusyLineAndShowAdvice", @"RongCloudKit", nil); - break; - case RCCallDisconnectReasonAddToBlackList: - hangupReasonString = NSLocalizedStringFromTable(@"VoIP_Rejected_By_Blacklist", @"RongCloudKit", nil); - break; - default: - hangupReasonString = [self getGeneralReadableString:hangupReason]; - break; - } - return hangupReasonString; ++ (NSString *)getReadableStringForCallViewController:(RCCallDisconnectReason)hangupReason { + NSString *hangupReasonString = nil; + switch (hangupReason) { + case RCCallDisconnectReasonNoResponse: + hangupReasonString = NSLocalizedStringFromTable(@"VoIPCallNoResponse", @"RongCloudKit", nil); + break; + case RCCallDisconnectReasonNetworkError: + hangupReasonString = NSLocalizedStringFromTable(@"VoIPCallLocalNetworkError", @"RongCloudKit", nil); + break; + case RCCallDisconnectReasonRemoteNetworkError: + hangupReasonString = NSLocalizedStringFromTable(@"VoIPCallRemoteNetworkError", @"RongCloudKit", nil); + break; + case RCCallDisconnectReasonRemoteBusyLine: + hangupReasonString = NSLocalizedStringFromTable(@"VoIPCallRemoteBusyLineAndShowAdvice", @"RongCloudKit", nil); + break; + case RCCallDisconnectReasonAddToBlackList: + hangupReasonString = NSLocalizedStringFromTable(@"VoIP_Rejected_By_Blacklist", @"RongCloudKit", nil); + break; + default: + hangupReasonString = [self getGeneralReadableString:hangupReason]; + break; + } + return hangupReasonString; } + (BOOL)isLandscape { - CGRect screenBounds = [UIScreen mainScreen].bounds; - return screenBounds.size.width > screenBounds.size.height; + CGRect screenBounds = [UIScreen mainScreen].bounds; + return screenBounds.size.width > screenBounds.size.height; } + (void)setScreenForceOn { - [[NSUserDefaults standardUserDefaults] setBool:[UIApplication sharedApplication].idleTimerDisabled forKey:@"RCCallIdleTimerDisabled"]; - [UIApplication sharedApplication].idleTimerDisabled = YES; + [[NSUserDefaults standardUserDefaults] setBool:[UIApplication sharedApplication].idleTimerDisabled + forKey:@"RCCallIdleTimerDisabled"]; + [UIApplication sharedApplication].idleTimerDisabled = YES; } + (void)clearScreenForceOnStatus { - BOOL oldStatus = [[NSUserDefaults standardUserDefaults] boolForKey:@"RCCallIdleTimerDisabled"]; - [UIApplication sharedApplication].idleTimerDisabled = oldStatus; + BOOL oldStatus = [[NSUserDefaults standardUserDefaults] boolForKey:@"RCCallIdleTimerDisabled"]; + [UIApplication sharedApplication].idleTimerDisabled = oldStatus; } @end diff --git a/ios-rongcallkit/RongCallKit/VideoObserver/RCDVideoFrameObserver.h b/ios-rongcallkit/RongCallKit/VideoObserver/RCDVideoFrameObserver.h index badb290..e4dd19d 100644 --- a/ios-rongcallkit/RongCallKit/VideoObserver/RCDVideoFrameObserver.h +++ b/ios-rongcallkit/RongCallKit/VideoObserver/RCDVideoFrameObserver.h @@ -8,31 +8,30 @@ #ifndef RCDVideoFrameObserver_hpp #define RCDVideoFrameObserver_hpp +#import #include #import #include -#import class RCDVideoFrameObserver : public agora::media::IVideoFrameObserver { -public: - static RCDVideoFrameObserver *sharedObserver(); - unsigned int m_width; - unsigned int m_height; - unsigned int m_yStride; - unsigned int m_uStride; - unsigned int m_vStride; + public: + static RCDVideoFrameObserver *sharedObserver(); + unsigned int m_width; + unsigned int m_height; + unsigned int m_yStride; + unsigned int m_uStride; + unsigned int m_vStride; + + unsigned char *m_yBuffer; + unsigned char *m_uBuffer; + unsigned char *m_vBuffer; + + RCDVideoFrameObserver(); + void setYUV(unsigned char *yBuffer, unsigned char *uBuffer, unsigned char *vBuffer, int width, int height); - unsigned char *m_yBuffer; - unsigned char *m_uBuffer; - unsigned char *m_vBuffer; + bool onCaptureVideoFrame(VideoFrame &videoFrame); + bool onRenderVideoFrame(unsigned int uid, VideoFrame &videoFrame); - RCDVideoFrameObserver(); - void setYUV(unsigned char *yBuffer, unsigned char *uBuffer, - unsigned char *vBuffer, int width, int height); - - bool onCaptureVideoFrame(VideoFrame& videoFrame) ; - bool onRenderVideoFrame(unsigned int uid, VideoFrame& videoFrame) ; - - virtual ~RCDVideoFrameObserver(); + virtual ~RCDVideoFrameObserver(); }; #endif /* RCDVideoFrameObserver_hpp */ diff --git a/ios-rongcallkit/RongCallKit/VideoObserver/RCDVideoFrameObserver.mm b/ios-rongcallkit/RongCallKit/VideoObserver/RCDVideoFrameObserver.mm index e71ffee..f8d2742 100644 --- a/ios-rongcallkit/RongCallKit/VideoObserver/RCDVideoFrameObserver.mm +++ b/ios-rongcallkit/RongCallKit/VideoObserver/RCDVideoFrameObserver.mm @@ -10,109 +10,108 @@ static NSLock *s_lock; RCDVideoFrameObserver *RCDVideoFrameObserver::sharedObserver() { - static RCDVideoFrameObserver sharedObserver; - return &sharedObserver; + static RCDVideoFrameObserver sharedObserver; + return &sharedObserver; } RCDVideoFrameObserver::RCDVideoFrameObserver() { - m_width = 0; - m_height = 0; - m_yStride = 0; - m_uStride = 0; - m_vStride = 0; + m_width = 0; + m_height = 0; + m_yStride = 0; + m_uStride = 0; + m_vStride = 0; - m_yBuffer = NULL; - m_uBuffer = NULL; - m_vBuffer = NULL; - s_lock = [[NSLock alloc] init]; + m_yBuffer = NULL; + m_uBuffer = NULL; + m_vBuffer = NULL; + s_lock = [[NSLock alloc] init]; } RCDVideoFrameObserver::~RCDVideoFrameObserver() { - if (m_yBuffer) { - delete[] m_yBuffer; - } - if (m_uBuffer) { - delete[] m_uBuffer; - } - if (m_vBuffer) { - delete[] m_vBuffer; - } - s_lock = nil; + if (m_yBuffer) { + delete[] m_yBuffer; + } + if (m_uBuffer) { + delete[] m_uBuffer; + } + if (m_vBuffer) { + delete[] m_vBuffer; + } + s_lock = nil; } -bool RCDVideoFrameObserver::onCaptureVideoFrame(agora::media::IVideoFrameObserver::VideoFrame& videoFrame) { - if (!m_width) { //没有初始化内存,在这里初始化内存 - m_height = videoFrame.height; - m_yStride = videoFrame.yStride; - m_uStride = videoFrame.uStride; - m_vStride = videoFrame.vStride; - - m_yBuffer = new unsigned char[m_yStride * m_height]; - m_uBuffer = new unsigned char[m_height * m_uStride * m_uStride / m_yStride]; - m_vBuffer = new unsigned char[m_height * m_vStride * m_vStride / m_yStride]; - memset(m_yBuffer, 0, m_yStride * m_height); - memset(m_uBuffer, 0, m_height * m_uStride * m_uStride / m_yStride); - memset(m_vBuffer, 0, m_height * m_vStride * m_vStride / m_yStride); - - m_width = videoFrame.width; - - //画一个十字 - for (int i = videoFrame.height / 2 - 2; i < videoFrame.height / 2 + 3; i++) { - for (int j = 0; j < videoFrame.width; j++) { - *(m_yBuffer + i * videoFrame.yStride + j) = 150; - } - } - - for (int i = 0; i < videoFrame.height; i++) { - for (int j = videoFrame.width / 2 - 2; j < videoFrame.width / 2 + 3; j++) { - *(m_yBuffer + i * videoFrame.yStride + j) = 50; - } +bool RCDVideoFrameObserver::onCaptureVideoFrame(agora::media::IVideoFrameObserver::VideoFrame &videoFrame) { + if (!m_width) { //没有初始化内存,在这里初始化内存 + m_height = videoFrame.height; + m_yStride = videoFrame.yStride; + m_uStride = videoFrame.uStride; + m_vStride = videoFrame.vStride; + + m_yBuffer = new unsigned char[m_yStride * m_height]; + m_uBuffer = new unsigned char[m_height * m_uStride * m_uStride / m_yStride]; + m_vBuffer = new unsigned char[m_height * m_vStride * m_vStride / m_yStride]; + memset(m_yBuffer, 0, m_yStride * m_height); + memset(m_uBuffer, 0, m_height * m_uStride * m_uStride / m_yStride); + memset(m_vBuffer, 0, m_height * m_vStride * m_vStride / m_yStride); + + m_width = videoFrame.width; + + //画一个十字 + for (int i = videoFrame.height / 2 - 2; i < videoFrame.height / 2 + 3; i++) { + for (int j = 0; j < videoFrame.width; j++) { + *(m_yBuffer + i * videoFrame.yStride + j) = 150; + } + } + + for (int i = 0; i < videoFrame.height; i++) { + for (int j = videoFrame.width / 2 - 2; j < videoFrame.width / 2 + 3; j++) { + *(m_yBuffer + i * videoFrame.yStride + j) = 50; + } + } + + } else { // copy内存到媒体engine中 + [s_lock lock]; + unsigned char *y = (unsigned char *)(videoFrame.yBuffer); + unsigned char *u = (unsigned char *)(videoFrame.uBuffer); + unsigned char *v = (unsigned char *)(videoFrame.vBuffer); + memcpy(y, m_yBuffer, m_yStride * m_height); + memcpy(u, m_uBuffer, m_height * m_uStride * m_uStride / m_yStride); + memcpy(v, m_vBuffer, m_height * m_uStride * m_uStride / m_yStride); + [s_lock unlock]; } - - } else { // copy内存到媒体engine中 - [s_lock lock]; - unsigned char *y = (unsigned char *)(videoFrame.yBuffer); - unsigned char *u = (unsigned char *)(videoFrame.uBuffer); - unsigned char *v = (unsigned char *)(videoFrame.vBuffer); - memcpy(y, m_yBuffer, m_yStride * m_height); - memcpy(u, m_uBuffer, m_height * m_uStride * m_uStride / m_yStride); - memcpy(v, m_vBuffer, m_height * m_uStride * m_uStride / m_yStride); - [s_lock unlock]; - } - return true; + return true; } -bool RCDVideoFrameObserver::onRenderVideoFrame(unsigned int uid, agora::media::IVideoFrameObserver::VideoFrame& videoFrame) { - NSString *userId = rcGetUserIdFromAgoraUID(uid); - NSLog(@"the user id is %@", userId); - return true; +bool RCDVideoFrameObserver::onRenderVideoFrame(unsigned int uid, + agora::media::IVideoFrameObserver::VideoFrame &videoFrame) { + NSString *userId = rcGetUserIdFromAgoraUID(uid); + NSLog(@"the user id is %@", userId); + return true; } -void RCDVideoFrameObserver::setYUV(unsigned char *yBuffer, - unsigned char *uBuffer, - unsigned char *vBuffer, int width, +void RCDVideoFrameObserver::setYUV(unsigned char *yBuffer, unsigned char *uBuffer, unsigned char *vBuffer, int width, int height) { - if (m_width) { - [s_lock lock]; - for (int i = 0; i < height; i++) { - if (i >= m_height) { - break; - } - for (int j = 0; j < width; j++) { - if (j >= m_width) { - break; - } - *(m_yBuffer + i * m_yStride + j) = *(yBuffer + i * width + j); + if (m_width) { + [s_lock lock]; + for (int i = 0; i < height; i++) { + if (i >= m_height) { + break; + } + for (int j = 0; j < width; j++) { + if (j >= m_width) { + break; + } + *(m_yBuffer + i * m_yStride + j) = *(yBuffer + i * width + j); - if (j < m_width * m_uStride / m_yStride) { - *(m_uBuffer + i * (m_uStride * m_uStride / m_yStride) + j) = - *(uBuffer + i * (m_uStride * m_uStride / m_yStride) + j); - } + if (j < m_width * m_uStride / m_yStride) { + *(m_uBuffer + i * (m_uStride * m_uStride / m_yStride) + j) = + *(uBuffer + i * (m_uStride * m_uStride / m_yStride) + j); + } - if (j < m_width * m_vStride / m_yStride) { - *(m_vBuffer + i * (m_vStride * m_vStride / m_yStride) + j) = - *(vBuffer + i * (m_vStride * m_vStride / m_yStride) + j); + if (j < m_width * m_vStride / m_yStride) { + *(m_vBuffer + i * (m_vStride * m_vStride / m_yStride) + j) = + *(vBuffer + i * (m_vStride * m_vStride / m_yStride) + j); + } + } } - } + [s_lock unlock]; } - [s_lock unlock]; - } } diff --git a/ios-rongcallkit/framework/AgoraRtcEngineKit.framework/Headers/AgoraRtcEngineKit.h b/ios-rongcallkit/framework/AgoraRtcEngineKit.framework/Headers/AgoraRtcEngineKit.h old mode 100755 new mode 100644 index 6f85409..5ea0245 --- a/ios-rongcallkit/framework/AgoraRtcEngineKit.framework/Headers/AgoraRtcEngineKit.h +++ b/ios-rongcallkit/framework/AgoraRtcEngineKit.framework/Headers/AgoraRtcEngineKit.h @@ -6,8 +6,8 @@ // Copyright (c) 2015 Agora. All rights reserved. // -#import #import +#import #if TARGET_OS_IPHONE #import @@ -68,13 +68,13 @@ typedef NS_ENUM(NSInteger, AgoraRtcErrorCode) { AgoraRtc_Error_ChannelKeyExpired = 109, AgoraRtc_Error_InvalidChannelKey = 110, AgoraRtc_Error_ConnectionInterrupted = 111, // only used in web sdk - AgoraRtc_Error_ConnectionLost = 112, // only used in web sdk + AgoraRtc_Error_ConnectionLost = 112, // only used in web sdk AgoraRtc_Error_NotInChannel = 113, AgoraRtc_Error_SizeTooLarge = 114, AgoraRtc_Error_BitrateLimit = 115, AgoraRtc_Error_TooManyDataStreams = 116, AgoraRtc_Error_DecryptionFailed = 120, - + AgoraRtc_Error_LoadMediaEngine = 1001, AgoraRtc_Error_StartCall = 1002, AgoraRtc_Error_StartCamera = 1003, @@ -93,7 +93,7 @@ typedef NS_ENUM(NSInteger, AgoraRtcErrorCode) { AgoraRtc_Error_Adm_RecordAudioFailed = 1018, AgoraRtc_Error_Adm_Play_Abnormal_Frequency = 1020, AgoraRtc_Error_Adm_Record_Abnormal_Frequency = 1021, - AgoraRtc_Error_Adm_Init_Loopback = 1022, + AgoraRtc_Error_Adm_Init_Loopback = 1022, AgoraRtc_Error_Adm_Start_Loopback = 1023, // 1025, as warning for interruption of adm on ios // 1026, as warning for route change of adm on ios @@ -114,56 +114,56 @@ typedef NS_ENUM(NSInteger, AgoraRtcChannelProfile) { }; typedef NS_ENUM(NSInteger, AgoraRtcClientRole) { - AgoraRtc_ClientRole_Broadcaster = 1, - AgoraRtc_ClientRole_Audience = 2, + AgoraRtc_ClientRole_Broadcaster = 1, + AgoraRtc_ClientRole_Audience = 2, }; typedef NS_ENUM(NSInteger, AgoraRtcVideoProfile) { - // res fps kbps + // res fps kbps AgoraRtc_VideoProfile_Invalid = -1, - AgoraRtc_VideoProfile_120P = 0, // 160x120 15 65 + AgoraRtc_VideoProfile_120P = 0, // 160x120 15 65 #if TARGET_OS_IPHONE - AgoraRtc_VideoProfile_120P_3 = 2, // 120x120 15 50 - AgoraRtc_VideoProfile_180P = 10, // 320x180 15 140 - AgoraRtc_VideoProfile_180P_3 = 12, // 180x180 15 100 - AgoraRtc_VideoProfile_180P_4 = 13, // 240x180 15 120 + AgoraRtc_VideoProfile_120P_3 = 2, // 120x120 15 50 + AgoraRtc_VideoProfile_180P = 10, // 320x180 15 140 + AgoraRtc_VideoProfile_180P_3 = 12, // 180x180 15 100 + AgoraRtc_VideoProfile_180P_4 = 13, // 240x180 15 120 #endif - AgoraRtc_VideoProfile_240P = 20, // 320x240 15 200 + AgoraRtc_VideoProfile_240P = 20, // 320x240 15 200 #if TARGET_OS_IPHONE - AgoraRtc_VideoProfile_240P_3 = 22, // 240x240 15 140 - AgoraRtc_VideoProfile_240P_4 = 23, // 424x240 15 220 + AgoraRtc_VideoProfile_240P_3 = 22, // 240x240 15 140 + AgoraRtc_VideoProfile_240P_4 = 23, // 424x240 15 220 #endif - AgoraRtc_VideoProfile_360P = 30, // 640x360 15 400 + AgoraRtc_VideoProfile_360P = 30, // 640x360 15 400 #if TARGET_OS_IPHONE - AgoraRtc_VideoProfile_360P_3 = 32, // 360x360 15 260 + AgoraRtc_VideoProfile_360P_3 = 32, // 360x360 15 260 #endif - AgoraRtc_VideoProfile_360P_4 = 33, // 640x360 30 600 - AgoraRtc_VideoProfile_360P_6 = 35, // 360x360 30 400 - AgoraRtc_VideoProfile_360P_7 = 36, // 480x360 15 320 - AgoraRtc_VideoProfile_360P_8 = 37, // 480x360 30 490 - AgoraRtc_VideoProfile_360P_9 = 38, // 640x360 15 800 - AgoraRtc_VideoProfile_360P_10 = 39, // 640x360 24 800 - AgoraRtc_VideoProfile_360P_11 = 100, // 640x360 24 1000 - AgoraRtc_VideoProfile_480P = 40, // 640x480 15 500 + AgoraRtc_VideoProfile_360P_4 = 33, // 640x360 30 600 + AgoraRtc_VideoProfile_360P_6 = 35, // 360x360 30 400 + AgoraRtc_VideoProfile_360P_7 = 36, // 480x360 15 320 + AgoraRtc_VideoProfile_360P_8 = 37, // 480x360 30 490 + AgoraRtc_VideoProfile_360P_9 = 38, // 640x360 15 800 + AgoraRtc_VideoProfile_360P_10 = 39, // 640x360 24 800 + AgoraRtc_VideoProfile_360P_11 = 100, // 640x360 24 1000 + AgoraRtc_VideoProfile_480P = 40, // 640x480 15 500 #if TARGET_OS_IPHONE - AgoraRtc_VideoProfile_480P_3 = 42, // 480x480 15 400 + AgoraRtc_VideoProfile_480P_3 = 42, // 480x480 15 400 #endif - AgoraRtc_VideoProfile_480P_4 = 43, // 640x480 30 750 - AgoraRtc_VideoProfile_480P_6 = 45, // 480x480 30 600 - AgoraRtc_VideoProfile_480P_8 = 47, // 848x480 15 610 - AgoraRtc_VideoProfile_480P_9 = 48, // 848x480 30 930 - AgoraRtc_VideoProfile_480P_10 = 49, // 640x480 10 400 - AgoraRtc_VideoProfile_720P = 50, // 1280x720 15 1130 - AgoraRtc_VideoProfile_720P_3 = 52, // 1280x720 30 1710 - AgoraRtc_VideoProfile_720P_5 = 54, // 960x720 15 910 - AgoraRtc_VideoProfile_720P_6 = 55, // 960x720 30 1380 - AgoraRtc_VideoProfile_1080P = 60, // 1920x1080 15 2080 - AgoraRtc_VideoProfile_1080P_3 = 62, // 1920x1080 30 3150 - AgoraRtc_VideoProfile_1080P_5 = 64, // 1920x1080 60 4780 - AgoraRtc_VideoProfile_1440P = 66, // 2560x1440 30 4850 - AgoraRtc_VideoProfile_1440P_2 = 67, // 2560x1440 60 7350 - AgoraRtc_VideoProfile_4K = 70, // 3840x2160 30 8190 - AgoraRtc_VideoProfile_4K_3 = 72, // 3840x2160 60 13500 + AgoraRtc_VideoProfile_480P_4 = 43, // 640x480 30 750 + AgoraRtc_VideoProfile_480P_6 = 45, // 480x480 30 600 + AgoraRtc_VideoProfile_480P_8 = 47, // 848x480 15 610 + AgoraRtc_VideoProfile_480P_9 = 48, // 848x480 30 930 + AgoraRtc_VideoProfile_480P_10 = 49, // 640x480 10 400 + AgoraRtc_VideoProfile_720P = 50, // 1280x720 15 1130 + AgoraRtc_VideoProfile_720P_3 = 52, // 1280x720 30 1710 + AgoraRtc_VideoProfile_720P_5 = 54, // 960x720 15 910 + AgoraRtc_VideoProfile_720P_6 = 55, // 960x720 30 1380 + AgoraRtc_VideoProfile_1080P = 60, // 1920x1080 15 2080 + AgoraRtc_VideoProfile_1080P_3 = 62, // 1920x1080 30 3150 + AgoraRtc_VideoProfile_1080P_5 = 64, // 1920x1080 60 4780 + AgoraRtc_VideoProfile_1440P = 66, // 2560x1440 30 4850 + AgoraRtc_VideoProfile_1440P_2 = 67, // 2560x1440 60 7350 + AgoraRtc_VideoProfile_4K = 70, // 3840x2160 30 8190 + AgoraRtc_VideoProfile_4K_3 = 72, // 3840x2160 60 13500 AgoraRtc_VideoProfile_DEFAULT = AgoraRtc_VideoProfile_360P, }; @@ -188,8 +188,7 @@ typedef NS_ENUM(NSInteger, AgoraRtcVideoStreamType) { AgoraRtc_VideoStream_Low = 1, }; -typedef NS_ENUM(NSInteger, AgoraRtcAudioOutputRouting) -{ +typedef NS_ENUM(NSInteger, AgoraRtcAudioOutputRouting) { AgoraRtc_AudioOutputRouting_Default = -1, AgoraRtc_AudioOutputRouting_Headset = 0, AgoraRtc_AudioOutputRouting_Earpiece = 1, @@ -221,17 +220,21 @@ typedef NS_ENUM(NSInteger, AgoraRtmpStreamLifeCycle) { typedef NS_ENUM(NSUInteger, AgoraRtcRenderMode) { /** - Hidden(1): If the video size is different than that of the display window, crops the borders of the video (if the video is bigger) or stretch the video (if the video is smaller) to fit it in the window. + Hidden(1): If the video size is different than that of the display window, crops the borders of the video (if the + video is bigger) or stretch the video (if the video is smaller) to fit it in the window. */ AgoraRtc_Render_Hidden = 1, - + /** - AgoraRtc_Render_Fit(2): If the video size is different than that of the display window, resizes the video proportionally to fit the window. + AgoraRtc_Render_Fit(2): If the video size is different than that of the display window, resizes the video + proportionally to fit the window. */ AgoraRtc_Render_Fit = 2, - + /** - AgoraRtc_Render_Adaptive(3):If both callers use the same screen orientation, i.e., both use vertical screens or both use horizontal screens, the AgoraRtc_Render_Hidden mode applies; if they use different screen orientations, i.e., one vertical and one horizontal, the AgoraRtc_Render_Fit mode applies. + AgoraRtc_Render_Adaptive(3):If both callers use the same screen orientation, i.e., both use vertical screens or + both use horizontal screens, the AgoraRtc_Render_Hidden mode applies; if they use different screen orientations, + i.e., one vertical and one horizontal, the AgoraRtc_Render_Fit mode applies. */ AgoraRtc_Render_Adaptive = 3, }; @@ -259,64 +262,66 @@ typedef NS_ENUM(NSInteger, AgoraRtcDeviceType) { __attribute__((visibility("default"))) @interface AgoraRtcDeviceInfo : NSObject -@property (assign, nonatomic) int index; -@property (assign, nonatomic) AgoraRtcDeviceType type; // 0: recording, 1: playback, 2: capture -@property (copy, nonatomic) NSString* deviceId; // -@property (copy, nonatomic) NSString* deviceName; // + @property(assign, nonatomic) int index; +@property(assign, nonatomic) AgoraRtcDeviceType type; // 0: recording, 1: playback, 2: capture +@property(copy, nonatomic) NSString *deviceId; // +@property(copy, nonatomic) NSString *deviceName; // @end #endif - -__attribute__((visibility("default"))) @interface AgoraRtcVideoCanvas : NSObject - -/** - * The video display view. The SDK does not maintain the lifecycle of the view. - The view can be safely released after calling leaveChannel with a returned value. - The SDK keeps a cache of the view value, so 'setupLocalVideo' to set the view value to NULL could be able to clear cache before switching or releasing view. - */ -@property (strong, nonatomic) VIEW_CLASS* view; -@property (assign, nonatomic) AgoraRtcRenderMode renderMode; // the render mode of view: hidden, fit and adaptive -@property (assign, nonatomic) NSUInteger uid; // the user id of view + __attribute__((visibility("default"))) @interface AgoraRtcVideoCanvas + : NSObject + + /** + * The video display view. The SDK does not maintain the lifecycle of the view. + The view can be safely released after calling leaveChannel with a returned value. + The SDK keeps a cache of the view value, so 'setupLocalVideo' to set the view value to NULL could be able to + clear cache before switching or releasing view. + */ + @property(strong, nonatomic) VIEW_CLASS *view; +@property(assign, nonatomic) AgoraRtcRenderMode renderMode; // the render mode of view: hidden, fit and adaptive +@property(assign, nonatomic) NSUInteger uid; // the user id of view @end -/** - * For AgoraVideoFrame: color format field - */ -typedef NS_ENUM(NSUInteger, AgoraVideoFormat) { - AgoraRtc_FrameFormat_texture = 12, - AgoraRtc_FrameFormat_I420 = 1, - AgoraRtc_FrameFormat_RGBA = 4, - AgoraRtc_FrameFormat_IMC2 = 5, -}; - -__attribute__((visibility("default"))) @interface AgoraVideoFrame : NSObject -@property (assign, nonatomic) NSInteger format; /* 10: android texture (GL_TEXTURE_2D) - 11: android texture (OES, typically from camera) - 12: ios texture (CVPixelBufferRef) - 1: I420 - 2: BGRA - 3: NV21 - 4: RGBA - 5: IMC2 - 6: BGRA (same as 2) - 7: ARGB - 8: NV12 - */ -@property (assign, nonatomic) CMTime time; // time for this frame. -@property (assign, nonatomic) int stride DEPRECATED_MSG_ATTRIBUTE("use strideInPixels instead"); -@property (assign, nonatomic) int strideInPixels; // how many pixels between 2 consecutive rows. Note: in pixel, not byte. - // in case of ios texture, it is not used -@property (assign, nonatomic) int height; // how many rows of pixels, in case of ios texture, it is not used - -@property (assign, nonatomic) CVPixelBufferRef textureBuf; - -@property (strong, nonatomic) NSData *dataBuf; // raw data buffer. in case of ios texture, it is not used -@property (assign, nonatomic) int cropLeft; // how many pixels to crop on the left boundary -@property (assign, nonatomic) int cropTop; // how many pixels to crop on the top boundary -@property (assign, nonatomic) int cropRight; // how many pixels to crop on the right boundary -@property (assign, nonatomic) int cropBottom; // how many pixels to crop on the bottom boundary -@property (assign, nonatomic) int rotation; // 0, 90, 180, 270. See document for rotation calculation + /** + * For AgoraVideoFrame: color format field + */ + typedef NS_ENUM(NSUInteger, AgoraVideoFormat) { + AgoraRtc_FrameFormat_texture = 12, + AgoraRtc_FrameFormat_I420 = 1, + AgoraRtc_FrameFormat_RGBA = 4, + AgoraRtc_FrameFormat_IMC2 = 5, + }; + +__attribute__((visibility("default"))) @interface AgoraVideoFrame + : NSObject @property(assign, nonatomic) NSInteger format; /* 10: android texture (GL_TEXTURE_2D) + 11: android texture (OES, typically from camera) + 12: ios texture (CVPixelBufferRef) + 1: I420 + 2: BGRA + 3: NV21 + 4: RGBA + 5: IMC2 + 6: BGRA (same as 2) + 7: ARGB + 8: NV12 + */ +@property(assign, nonatomic) CMTime time; // time for this frame. +@property(assign, nonatomic) int stride DEPRECATED_MSG_ATTRIBUTE("use strideInPixels instead"); +@property(assign, nonatomic) + int strideInPixels; // how many pixels between 2 consecutive rows. Note: in pixel, not byte. + // in case of ios texture, it is not used +@property(assign, nonatomic) int height; // how many rows of pixels, in case of ios texture, it is not used + +@property(assign, nonatomic) CVPixelBufferRef textureBuf; + +@property(strong, nonatomic) NSData *dataBuf; // raw data buffer. in case of ios texture, it is not used +@property(assign, nonatomic) int cropLeft; // how many pixels to crop on the left boundary +@property(assign, nonatomic) int cropTop; // how many pixels to crop on the top boundary +@property(assign, nonatomic) int cropRight; // how many pixels to crop on the right boundary +@property(assign, nonatomic) int cropBottom; // how many pixels to crop on the bottom boundary +@property(assign, nonatomic) int rotation; // 0, 90, 180, 270. See document for rotation calculation /* Note * 1. strideInPixels * Stride is in unit of pixel, not byte @@ -359,89 +364,93 @@ __attribute__((visibility("default"))) @interface AgoraVideoFrame : NSObject @end -__attribute__((visibility("default"))) @interface AgoraRtcStats : NSObject -@property (assign, nonatomic) NSUInteger duration; -@property (assign, nonatomic) NSUInteger txBytes; -@property (assign, nonatomic) NSUInteger rxBytes; -@property (assign, nonatomic) NSUInteger txAudioKBitrate; -@property (assign, nonatomic) NSUInteger rxAudioKBitrate; -@property (assign, nonatomic) NSUInteger txVideoKBitrate; -@property (assign, nonatomic) NSUInteger rxVideoKBitrate; -@property (assign, nonatomic) NSUInteger users; -@property (assign, nonatomic) double cpuAppUsage; -@property (assign, nonatomic) double cpuTotalUsage; + __attribute__((visibility("default"))) @interface AgoraRtcStats : NSObject + @property(assign, nonatomic) NSUInteger duration; +@property(assign, nonatomic) NSUInteger txBytes; +@property(assign, nonatomic) NSUInteger rxBytes; +@property(assign, nonatomic) NSUInteger txAudioKBitrate; +@property(assign, nonatomic) NSUInteger rxAudioKBitrate; +@property(assign, nonatomic) NSUInteger txVideoKBitrate; +@property(assign, nonatomic) NSUInteger rxVideoKBitrate; +@property(assign, nonatomic) NSUInteger users; +@property(assign, nonatomic) double cpuAppUsage; +@property(assign, nonatomic) double cpuTotalUsage; @end -__attribute__((visibility("default"))) @interface AgoraRtcLocalVideoStats : NSObject -@property (assign, nonatomic) NSUInteger sentBitrate; -@property (assign, nonatomic) NSUInteger sentFrameRate; + __attribute__((visibility("default"))) @interface AgoraRtcLocalVideoStats + : NSObject @property(assign, nonatomic) NSUInteger sentBitrate; +@property(assign, nonatomic) NSUInteger sentFrameRate; @end -__attribute__((visibility("default"))) @interface AgoraRtcRemoteVideoStats : NSObject -@property (assign, nonatomic) NSUInteger uid; -@property (assign, nonatomic) NSUInteger delay; -@property (assign, nonatomic) NSUInteger width; -@property (assign, nonatomic) NSUInteger height; -@property (assign, nonatomic) NSUInteger receivedBitrate; -@property (assign, nonatomic) NSUInteger receivedFrameRate; -@property (assign, nonatomic) AgoraRtcVideoStreamType rxStreamType; + __attribute__((visibility("default"))) @interface AgoraRtcRemoteVideoStats + : NSObject @property(assign, nonatomic) NSUInteger uid; +@property(assign, nonatomic) NSUInteger delay; +@property(assign, nonatomic) NSUInteger width; +@property(assign, nonatomic) NSUInteger height; +@property(assign, nonatomic) NSUInteger receivedBitrate; +@property(assign, nonatomic) NSUInteger receivedFrameRate; +@property(assign, nonatomic) AgoraRtcVideoStreamType rxStreamType; @end -__attribute__((visibility("default"))) @interface AgoraRtcAudioVolumeInfo : NSObject -@property (assign, nonatomic) NSUInteger uid; -@property (assign, nonatomic) NSUInteger volume; + __attribute__((visibility("default"))) @interface AgoraRtcAudioVolumeInfo + : NSObject @property(assign, nonatomic) NSUInteger uid; +@property(assign, nonatomic) NSUInteger volume; @end -__attribute__((visibility("default"))) @interface AgoraRtcVideoCompositingRegion : NSObject -@property (assign, nonatomic) NSUInteger uid; -@property (assign, nonatomic) double x; -@property (assign, nonatomic) double y; -@property (assign, nonatomic) double width; -@property (assign, nonatomic) double height; -@property (assign, nonatomic) NSInteger zOrder; //optional, [0, 100] //0 (default): bottom most, 100: top most -@property (assign, nonatomic) double alpha; //optional, [0, 1.0] where 0 denotes throughly transparent, 1.0 opaque -@property (assign, nonatomic) AgoraRtcRenderMode renderMode; + __attribute__((visibility("default"))) @interface AgoraRtcVideoCompositingRegion + : NSObject @property(assign, nonatomic) NSUInteger uid; +@property(assign, nonatomic) double x; +@property(assign, nonatomic) double y; +@property(assign, nonatomic) double width; +@property(assign, nonatomic) double height; +@property(assign, nonatomic) NSInteger zOrder; // optional, [0, 100] //0 (default): bottom most, 100: top most +@property(assign, nonatomic) double alpha; // optional, [0, 1.0] where 0 denotes throughly transparent, 1.0 opaque +@property(assign, nonatomic) AgoraRtcRenderMode renderMode; @end -__attribute__((visibility("default"))) @interface AgoraRtcVideoCompositingLayout : NSObject -@property (assign, nonatomic) NSInteger canvasWidth; -@property (assign, nonatomic) NSInteger canvasHeight; -@property (copy, nonatomic) NSString* backgroundColor;//e.g. "#c0c0c0" -@property (retain, nonatomic) NSArray* regions; //array of AgoraRtcVideoCompositingRegion -@property (copy, nonatomic) NSString* appData;//app defined data + __attribute__((visibility("default"))) @interface AgoraRtcVideoCompositingLayout + : NSObject @property(assign, nonatomic) NSInteger canvasWidth; +@property(assign, nonatomic) NSInteger canvasHeight; +@property(copy, nonatomic) NSString *backgroundColor; // e.g. "#c0c0c0" +@property(retain, nonatomic) NSArray *regions; // array of AgoraRtcVideoCompositingRegion +@property(copy, nonatomic) NSString *appData; // app defined data @end -__attribute__((visibility("default"))) @interface AgoraPublisherConfiguration : NSObject -@property (assign, nonatomic) BOOL owner; -@property (assign, nonatomic) NSInteger width; -@property (assign, nonatomic) NSInteger height; -@property (assign, nonatomic) NSInteger framerate; -@property (assign, nonatomic) NSInteger bitrate; -@property (assign, nonatomic) NSInteger defaultLayout; -@property (assign, nonatomic) AgoraRtmpStreamLifeCycle lifeCycle; -@property (assign, nonatomic) NSInteger injectStreamWidth; -@property (assign, nonatomic) NSInteger injectStreamHeight; -@property (copy, nonatomic) NSString* injectStreamUrl; -@property (copy, nonatomic) NSString* publishUrl; -@property (copy, nonatomic) NSString* rawStreamUrl; -@property (copy, nonatomic) NSString* extraInfo; --(BOOL) validate; --(NSString *) toJsonString; + __attribute__((visibility("default"))) @interface AgoraPublisherConfiguration + : NSObject @property(assign, nonatomic) BOOL owner; +@property(assign, nonatomic) NSInteger width; +@property(assign, nonatomic) NSInteger height; +@property(assign, nonatomic) NSInteger framerate; +@property(assign, nonatomic) NSInteger bitrate; +@property(assign, nonatomic) NSInteger defaultLayout; +@property(assign, nonatomic) AgoraRtmpStreamLifeCycle lifeCycle; +@property(assign, nonatomic) NSInteger injectStreamWidth; +@property(assign, nonatomic) NSInteger injectStreamHeight; +@property(copy, nonatomic) NSString *injectStreamUrl; +@property(copy, nonatomic) NSString *publishUrl; +@property(copy, nonatomic) NSString *rawStreamUrl; +@property(copy, nonatomic) NSString *extraInfo; +- (BOOL)validate; +- (NSString *)toJsonString; @end -__attribute__((visibility("default"))) @interface AgoraPublisherConfigurationBuilder : NSObject -- (AgoraPublisherConfigurationBuilder *) setOwner:(BOOL)isOwner; -- (AgoraPublisherConfigurationBuilder *) setWidth:(NSInteger)width height:(NSInteger)height framerate:(NSInteger)framerate bitrate:(NSInteger)bitrate; -- (AgoraPublisherConfigurationBuilder *) setDefaultLayout:(NSInteger)layoutStyle; -- (AgoraPublisherConfigurationBuilder *) setLifeCycle:(AgoraRtmpStreamLifeCycle)lifecycle; -- (AgoraPublisherConfigurationBuilder *) setPublisherUrl:(NSString*)url; -- (AgoraPublisherConfigurationBuilder *) setRawStreamUrl:(NSString*)url; -- (AgoraPublisherConfigurationBuilder *) setExtraInfo:(NSString *)info; -- (AgoraPublisherConfigurationBuilder *) injectStream:(NSString *)url width:(NSInteger)width height:(NSInteger)height; -- (AgoraPublisherConfiguration *) build; + __attribute__((visibility("default"))) @interface AgoraPublisherConfigurationBuilder + : NSObject - + (AgoraPublisherConfigurationBuilder *)setOwner : (BOOL)isOwner; +- (AgoraPublisherConfigurationBuilder *)setWidth:(NSInteger)width + height:(NSInteger)height + framerate:(NSInteger)framerate + bitrate:(NSInteger)bitrate; +- (AgoraPublisherConfigurationBuilder *)setDefaultLayout:(NSInteger)layoutStyle; +- (AgoraPublisherConfigurationBuilder *)setLifeCycle:(AgoraRtmpStreamLifeCycle)lifecycle; +- (AgoraPublisherConfigurationBuilder *)setPublisherUrl:(NSString *)url; +- (AgoraPublisherConfigurationBuilder *)setRawStreamUrl:(NSString *)url; +- (AgoraPublisherConfigurationBuilder *)setExtraInfo:(NSString *)info; +- (AgoraPublisherConfigurationBuilder *)injectStream:(NSString *)url width:(NSInteger)width height:(NSInteger)height; +- (AgoraPublisherConfiguration *)build; @end -@class AgoraRtcEngineKit; + @class AgoraRtcEngineKit; @protocol AgoraRtcEngineDelegate @optional @@ -462,13 +471,16 @@ __attribute__((visibility("default"))) @interface AgoraPublisherConfigurationBui - (void)rtcEngine:(AgoraRtcEngineKit *)engine didOccurError:(AgoraRtcErrorCode)errorCode; /** - * The sdk reports the volume of a speaker. The interface is disable by default, and it could be enable by API "enableAudioVolumeIndication" + * The sdk reports the volume of a speaker. The interface is disable by default, and it could be enable by API + * "enableAudioVolumeIndication" * * @param engine The engine kit * @param speakers AgoraRtcAudioVolumeInfos array * @param totalVolume The total volume of speakers */ -- (void)rtcEngine:(AgoraRtcEngineKit *)engine reportAudioVolumeIndicationOfSpeakers:(NSArray*)speakers totalVolume:(NSInteger)totalVolume; +- (void)rtcEngine:(AgoraRtcEngineKit *)engine + reportAudioVolumeIndicationOfSpeakers:(NSArray *)speakers + totalVolume:(NSInteger)totalVolume; /** * Event of the first local frame starts rendering on the screen. @@ -487,7 +499,10 @@ __attribute__((visibility("default"))) @interface AgoraPublisherConfigurationBui * @param size The size of video stream * @param elapsed The elapsed time(ms) from the beginning of the session. */ -- (void)rtcEngine:(AgoraRtcEngineKit *)engine firstRemoteVideoDecodedOfUid:(NSUInteger)uid size:(CGSize)size elapsed:(NSInteger)elapsed; +- (void)rtcEngine:(AgoraRtcEngineKit *)engine + firstRemoteVideoDecodedOfUid:(NSUInteger)uid + size:(CGSize)size + elapsed:(NSInteger)elapsed; /** * Event of video size changed for local or remote user @@ -497,7 +512,10 @@ __attribute__((visibility("default"))) @interface AgoraPublisherConfigurationBui * @param size The new size of video * @param rotation The new rotate of video */ -- (void)rtcEngine:(AgoraRtcEngineKit *)engine videoSizeChangedOfUid:(NSUInteger)uid size:(CGSize)size rotation:(NSInteger)rotation; +- (void)rtcEngine:(AgoraRtcEngineKit *)engine + videoSizeChangedOfUid:(NSUInteger)uid + size:(CGSize)size + rotation:(NSInteger)rotation; /** * Event of the first frame of remote user is rendering on the screen. @@ -507,7 +525,10 @@ __attribute__((visibility("default"))) @interface AgoraPublisherConfigurationBui * @param size The size of video stream * @param elapsed The elapsed time(ms) from the beginning of the session. */ -- (void)rtcEngine:(AgoraRtcEngineKit *)engine firstRemoteVideoFrameOfUid:(NSUInteger)uid size:(CGSize)size elapsed:(NSInteger)elapsed; +- (void)rtcEngine:(AgoraRtcEngineKit *)engine + firstRemoteVideoFrameOfUid:(NSUInteger)uid + size:(CGSize)size + elapsed:(NSInteger)elapsed; /** * Event of remote user joined @@ -553,7 +574,6 @@ __attribute__((visibility("default"))) @interface AgoraPublisherConfigurationBui */ - (void)rtcEngine:(AgoraRtcEngineKit *)engine didAudioRouteChanged:(AgoraRtcAudioOutputRouting)routing; - /** * Event of remote user video enabled or disabled * @@ -569,15 +589,16 @@ __attribute__((visibility("default"))) @interface AgoraPublisherConfigurationBui * @param engine The engine kit * @param stats The statistics of local video, including sent bitrate, sent framerate */ -- (void)rtcEngine:(AgoraRtcEngineKit *)engine localVideoStats:(AgoraRtcLocalVideoStats*)stats; +- (void)rtcEngine:(AgoraRtcEngineKit *)engine localVideoStats:(AgoraRtcLocalVideoStats *)stats; /** * The statistics of remote video stream. Update every two seconds. * * @param engine The engine kit - * @param stats The statistics of remote video, including user id, delay, resolution, received bitrate, received framerate, video stream type + * @param stats The statistics of remote video, including user id, delay, resolution, received bitrate, + * received framerate, video stream type */ -- (void)rtcEngine:(AgoraRtcEngineKit *)engine remoteVideoStats:(AgoraRtcRemoteVideoStats*)stats; +- (void)rtcEngine:(AgoraRtcEngineKit *)engine remoteVideoStats:(AgoraRtcRemoteVideoStats *)stats; /** * Event of load media engine success @@ -630,8 +651,9 @@ __attribute__((visibility("default"))) @interface AgoraPublisherConfigurationBui - (void)rtcEngineConnectionDidInterrupted:(AgoraRtcEngineKit *)engine; /** - * Event of loss connection with server. This event is reported after the connection is interrupted and exceed the retry period (10 seconds by default). - * In the mean time SDK automatically tries to reconnect with the server until APP calls leaveChannel. + * Event of loss connection with server. This event is reported after the connection is interrupted and exceed the + * retry period (10 seconds by default). In the mean time SDK automatically tries to reconnect with the server until APP + * calls leaveChannel. * * @param engine The engine kit */ @@ -645,7 +667,10 @@ __attribute__((visibility("default"))) @interface AgoraPublisherConfigurationBui * @param uid The remote user id * @param elapsed The elapsed time (ms) from session beginning */ -- (void)rtcEngine:(AgoraRtcEngineKit *)engine didJoinChannel:(NSString*)channel withUid:(NSUInteger)uid elapsed:(NSInteger) elapsed; +- (void)rtcEngine:(AgoraRtcEngineKit *)engine + didJoinChannel:(NSString *)channel + withUid:(NSUInteger)uid + elapsed:(NSInteger)elapsed; /** * Event of the user rejoined the channel @@ -655,7 +680,10 @@ __attribute__((visibility("default"))) @interface AgoraPublisherConfigurationBui * @param uid The user id * @param elapsed The elapsed time (ms) from session beginning */ -- (void)rtcEngine:(AgoraRtcEngineKit *)engine didRejoinChannel:(NSString*)channel withUid:(NSUInteger)uid elapsed:(NSInteger) elapsed; +- (void)rtcEngine:(AgoraRtcEngineKit *)engine + didRejoinChannel:(NSString *)channel + withUid:(NSUInteger)uid + elapsed:(NSInteger)elapsed; /** * Statistics of rtc engine status. Updated every two seconds. @@ -663,7 +691,7 @@ __attribute__((visibility("default"))) @interface AgoraPublisherConfigurationBui * @param engine The engine kit * @param stats The statistics of rtc status, including duration, sent bytes and received bytes */ -- (void)rtcEngine:(AgoraRtcEngineKit *)engine reportRtcStats:(AgoraRtcStats*)stats; +- (void)rtcEngine:(AgoraRtcEngineKit *)engine reportRtcStats:(AgoraRtcStats *)stats; /** * The statistics of the call when leave channel @@ -671,7 +699,7 @@ __attribute__((visibility("default"))) @interface AgoraPublisherConfigurationBui * @param engine The engine kit * @param stats The statistics of the call, including duration, sent bytes and received bytes */ -- (void)rtcEngine:(AgoraRtcEngineKit *)engine didLeaveChannelWithStats:(AgoraRtcStats*)stats; +- (void)rtcEngine:(AgoraRtcEngineKit *)engine didLeaveChannelWithStats:(AgoraRtcStats *)stats; /** * The audio quality of the user. updated every two seconds. @@ -682,7 +710,11 @@ __attribute__((visibility("default"))) @interface AgoraPublisherConfigurationBui * @param delay The delay from the remote user * @param lost The percentage of lost packets */ -- (void)rtcEngine:(AgoraRtcEngineKit *)engine audioQualityOfUid:(NSUInteger)uid quality:(AgoraRtcQuality)quality delay:(NSUInteger)delay lost:(NSUInteger)lost; +- (void)rtcEngine:(AgoraRtcEngineKit *)engine + audioQualityOfUid:(NSUInteger)uid + quality:(AgoraRtcQuality)quality + delay:(NSUInteger)delay + lost:(NSUInteger)lost; /** * The network quality of local user. @@ -692,7 +724,10 @@ __attribute__((visibility("default"))) @interface AgoraPublisherConfigurationBui * @param txQuality The sending network quality * @param rxQuality The receiving network quality */ -- (void)rtcEngine:(AgoraRtcEngineKit *)engine networkQuality:(NSUInteger)uid txQuality:(AgoraRtcQuality)txQuality rxQuality:(AgoraRtcQuality)rxQuality; +- (void)rtcEngine:(AgoraRtcEngineKit *)engine + networkQuality:(NSUInteger)uid + txQuality:(AgoraRtcQuality)txQuality + rxQuality:(AgoraRtcQuality)rxQuality; /** * The network quality of lastmile test. @@ -711,7 +746,10 @@ __attribute__((visibility("default"))) @interface AgoraPublisherConfigurationBui * @param deviceType type of device: -1: audio unknown; 0: audio recording ; 1: audio playout ; 2: render; 4: capture * @param state state of device: 0: added; 1: removed */ -- (void)rtcEngine:(AgoraRtcEngineKit *)engine device:(NSString*) deviceId type:(AgoraRtcDeviceType) deviceType stateChanged:(NSInteger) state; +- (void)rtcEngine:(AgoraRtcEngineKit *)engine + device:(NSString *)deviceId + type:(AgoraRtcDeviceType)deviceType + stateChanged:(NSInteger)state; #endif @@ -722,7 +760,7 @@ __attribute__((visibility("default"))) @interface AgoraPublisherConfigurationBui * @param api The API description * @param error The error code */ -- (void)rtcEngine:(AgoraRtcEngineKit *)engine didApiCallExecute:(NSString*)api error:(NSInteger)error; +- (void)rtcEngine:(AgoraRtcEngineKit *)engine didApiCallExecute:(NSString *)api error:(NSInteger)error; /** * This callback returns the status code after executing the refreshRecordingServiceStatus method successfully. @@ -740,7 +778,10 @@ __attribute__((visibility("default"))) @interface AgoraPublisherConfigurationBui * @param streamId The stream id * @param data The user defined data */ -- (void)rtcEngine:(AgoraRtcEngineKit *)engine receiveStreamMessageFromUid:(NSUInteger)uid streamId:(NSInteger)streamId data:(NSData*)data; +- (void)rtcEngine:(AgoraRtcEngineKit *)engine + receiveStreamMessageFromUid:(NSUInteger)uid + streamId:(NSInteger)streamId + data:(NSData *)data; /** * the local user has not received the data stream from the other user within 5 seconds. @@ -752,14 +793,18 @@ __attribute__((visibility("default"))) @interface AgoraPublisherConfigurationBui * @param missed The number of lost messages * @param cached The number of incoming cached messages when the data stream is interrupted */ -- (void)rtcEngine:(AgoraRtcEngineKit *)engine didOccurStreamMessageErrorFromUid:(NSUInteger)uid streamId:(NSInteger)streamId error:(NSInteger)error missed:(NSInteger)missed cached:(NSInteger)cached; - +- (void)rtcEngine:(AgoraRtcEngineKit *)engine + didOccurStreamMessageErrorFromUid:(NSUInteger)uid + streamId:(NSInteger)streamId + error:(NSInteger)error + missed:(NSInteger)missed + cached:(NSInteger)cached; /** * when channel key is enabled, and specified channel key is invalid or expired, this function will be called. * APP should generate a new channel key and call renewChannelKey() to refresh the key. - * NOTE: to be compatible with previous version, ERR_CHANNEL_KEY_EXPIRED and ERR_INVALID_CHANNEL_KEY are also reported via onError() callback. - * You should move renew of channel key logic into this callback. + * NOTE: to be compatible with previous version, ERR_CHANNEL_KEY_EXPIRED and ERR_INVALID_CHANNEL_KEY are also reported + * via onError() callback. You should move renew of channel key logic into this callback. * @param engine The engine kit */ - (void)rtcEngineRequestChannelKey:(AgoraRtcEngineKit *)engine; @@ -781,7 +826,6 @@ __attribute__((visibility("default"))) @interface AgoraPublisherConfigurationBui */ - (void)rtcEngine:(AgoraRtcEngineKit *)engine firstRemoteAudioFrameOfUid:(NSUInteger)uid elapsed:(NSInteger)elapsed; - /** * The sdk reports who is active speaker in the channel * @@ -797,18 +841,20 @@ __attribute__((visibility("default"))) @interface AgoraPublisherConfigurationBui * @param oldRole the previous role * @param newRole the new role */ -- (void)rtcEngine:(AgoraRtcEngineKit *)engine didClientRoleChanged:(AgoraRtcClientRole)oldRole newRole:(AgoraRtcClientRole)newRole; +- (void)rtcEngine:(AgoraRtcEngineKit *)engine + didClientRoleChanged:(AgoraRtcClientRole)oldRole + newRole:(AgoraRtcClientRole)newRole; @end - __attribute__((visibility("default"))) @interface AgoraRtcEngineKit : NSObject -/** -* Get the version of Agora SDK. -* -* @return string, sdk version -*/ -+ (NSString *)getSdkVersion; + /** + * Get the version of Agora SDK. + * + * @return string, sdk version + */ + + + (NSString *)getSdkVersion; /** * Get the version of Media Engine @@ -820,8 +866,7 @@ __attribute__((visibility("default"))) @interface AgoraRtcEngineKit : NSObject /** * Get the native handler of sdk Engine */ -- (void*)getNativeHandle; - +- (void *)getNativeHandle; /** * Initializes the AgoraRtcEngineKit object. @@ -831,50 +876,57 @@ __attribute__((visibility("default"))) @interface AgoraRtcEngineKit : NSObject * * @return an object of AgoraRtcEngineKit class */ -+ (instancetype)sharedEngineWithAppId:(NSString*)appId - delegate:(id)delegate; ++ (instancetype)sharedEngineWithAppId:(NSString *)appId delegate:(id)delegate; /** * deprecated */ -+ (instancetype)sharedEngineWithAppId:(NSString*)AppId - error:(void(^)(AgoraRtcErrorCode errorCode))errorBlock __deprecated; ++ (instancetype)sharedEngineWithAppId:(NSString *)AppId + error:(void (^)(AgoraRtcErrorCode errorCode))errorBlock __deprecated; + (void)destroy; /** * deprecated blocks */ -- (void)audioVolumeIndicationBlock:(void(^)(NSArray *speakers, NSInteger totalVolume))audioVolumeIndicationBlock __deprecated; - -- (void)firstLocalVideoFrameBlock:(void(^)(NSInteger width, NSInteger height, NSInteger elapsed))firstLocalVideoFrameBlock __deprecated; -- (void)firstRemoteVideoDecodedBlock:(void(^)(NSUInteger uid, NSInteger width, NSInteger height, NSInteger elapsed))firstRemoteVideoDecodedBlock __deprecated; -- (void)firstRemoteVideoFrameBlock:(void(^)(NSUInteger uid, NSInteger width, NSInteger height, NSInteger elapsed))firstRemoteVideoFrameBlock __deprecated; -- (void)userJoinedBlock:(void(^)(NSUInteger uid, NSInteger elapsed))userJoinedBlock __deprecated; -- (void)userOfflineBlock:(void(^)(NSUInteger uid))userOfflineBlock __deprecated; -- (void)userMuteAudioBlock:(void(^)(NSUInteger uid, BOOL muted))userMuteAudioBlock __deprecated; -- (void)userMuteVideoBlock:(void(^)(NSUInteger uid, BOOL muted))userMuteVideoBlock __deprecated; -- (void)localVideoStatBlock:(void(^)(NSInteger sentBitrate, NSInteger sentFrameRate))localVideoStatBlock __deprecated; -- (void)remoteVideoStatBlock:(void(^)(NSUInteger uid, NSInteger delay, NSInteger receivedBitrate, NSInteger receivedFrameRate))remoteVideoStatBlock __deprecated; -- (void)cameraReadyBlock:(void(^)())cameraReadyBlock __deprecated; -- (void)connectionLostBlock:(void(^)())connectionLostBlock __deprecated; -- (void)rejoinChannelSuccessBlock:(void(^)(NSString* channel, NSUInteger uid, NSInteger elapsed))rejoinChannelSuccessBlock __deprecated; -- (void)rtcStatsBlock:(void(^)(AgoraRtcStats* stat))rtcStatsBlock __deprecated; -- (void)leaveChannelBlock:(void(^)(AgoraRtcStats* stat))leaveChannelBlock __deprecated; -- (void)audioQualityBlock:(void(^)(NSUInteger uid, AgoraRtcQuality quality, NSUInteger delay, NSUInteger lost))audioQualityBlock __deprecated; -- (void)networkQualityBlock:(void(^)(NSUInteger uid, AgoraRtcQuality txQuality, AgoraRtcQuality rxQuality))networkQualityBlock __deprecated; -- (void)lastmileQualityBlock:(void(^)(AgoraRtcQuality quality))lastmileQualityBlock __deprecated; -- (void)mediaEngineEventBlock:(void(^)(NSInteger code))mediaEngineEventBlock __deprecated; - - -/** - * Enable / Disable dispatching delegate to main queue. if disable, the app should dispatch UI operating to main queue by himself. +- (void)audioVolumeIndicationBlock:(void (^)(NSArray *speakers, NSInteger totalVolume))audioVolumeIndicationBlock + __deprecated; + +- (void)firstLocalVideoFrameBlock:(void (^)(NSInteger width, NSInteger height, + NSInteger elapsed))firstLocalVideoFrameBlock __deprecated; +- (void)firstRemoteVideoDecodedBlock:(void (^)(NSUInteger uid, NSInteger width, NSInteger height, + NSInteger elapsed))firstRemoteVideoDecodedBlock __deprecated; +- (void)firstRemoteVideoFrameBlock:(void (^)(NSUInteger uid, NSInteger width, NSInteger height, + NSInteger elapsed))firstRemoteVideoFrameBlock __deprecated; +- (void)userJoinedBlock:(void (^)(NSUInteger uid, NSInteger elapsed))userJoinedBlock __deprecated; +- (void)userOfflineBlock:(void (^)(NSUInteger uid))userOfflineBlock __deprecated; +- (void)userMuteAudioBlock:(void (^)(NSUInteger uid, BOOL muted))userMuteAudioBlock __deprecated; +- (void)userMuteVideoBlock:(void (^)(NSUInteger uid, BOOL muted))userMuteVideoBlock __deprecated; +- (void)localVideoStatBlock:(void (^)(NSInteger sentBitrate, NSInteger sentFrameRate))localVideoStatBlock __deprecated; +- (void)remoteVideoStatBlock:(void (^)(NSUInteger uid, NSInteger delay, NSInteger receivedBitrate, + NSInteger receivedFrameRate))remoteVideoStatBlock __deprecated; +- (void)cameraReadyBlock:(void (^)())cameraReadyBlock __deprecated; +- (void)connectionLostBlock:(void (^)())connectionLostBlock __deprecated; +- (void)rejoinChannelSuccessBlock:(void (^)(NSString *channel, NSUInteger uid, + NSInteger elapsed))rejoinChannelSuccessBlock __deprecated; +- (void)rtcStatsBlock:(void (^)(AgoraRtcStats *stat))rtcStatsBlock __deprecated; +- (void)leaveChannelBlock:(void (^)(AgoraRtcStats *stat))leaveChannelBlock __deprecated; +- (void)audioQualityBlock:(void (^)(NSUInteger uid, AgoraRtcQuality quality, NSUInteger delay, + NSUInteger lost))audioQualityBlock __deprecated; +- (void)networkQualityBlock:(void (^)(NSUInteger uid, AgoraRtcQuality txQuality, + AgoraRtcQuality rxQuality))networkQualityBlock __deprecated; +- (void)lastmileQualityBlock:(void (^)(AgoraRtcQuality quality))lastmileQualityBlock __deprecated; +- (void)mediaEngineEventBlock:(void (^)(NSInteger code))mediaEngineEventBlock __deprecated; + +/** + * Enable / Disable dispatching delegate to main queue. if disable, the app should dispatch UI operating to main queue + * by himself. * * @param enabled YES: dispatch delegate method to main queue. NO: not dispatch delegate methods to main queue * * @return 0 when executed successfully. return negative value if failed. */ -- (int) enableMainQueueDispatch: (BOOL) enabled; +- (int)enableMainQueueDispatch:(BOOL)enabled; /** BEGIN OF COMMON METHODS */ @@ -888,35 +940,40 @@ __attribute__((visibility("default"))) @interface AgoraRtcEngineKit : NSObject * @param channelName Joining in the same channel indicates those clients have entered in one room. * @param info Optional, this argument can be whatever the programmer likes personally. * @param uid Optional, this argument is the unique ID for each member in one channel. - If not specified, or set to 0, the SDK automatically allocates an ID, and the id could be gotten in onJoinChannelSuccess. - * @param joinSuccessBlock This callback indicates that the user has successfully joined the specified channel. Same as rtcEngine:didJoinChannel:withUid:elapsed:. If nil, the callback rtcEngine:didJoinChannel:withUid:elapsed: will works. + If not specified, or set to 0, the SDK automatically allocates an ID, and the id could be + gotten in onJoinChannelSuccess. + * @param joinSuccessBlock This callback indicates that the user has successfully joined the specified channel. Same + as rtcEngine:didJoinChannel:withUid:elapsed:. If nil, the callback rtcEngine:didJoinChannel:withUid:elapsed: will + works. * * @return 0 when executed successfully, and return negative value when failed. */ - (int)joinChannelByKey:(NSString *)channelKey - channelName:(NSString *)channelName - info:(NSString *)info - uid:(NSUInteger)uid - joinSuccess:(void(^)(NSString* channel, NSUInteger uid, NSInteger elapsed))joinSuccessBlock; + channelName:(NSString *)channelName + info:(NSString *)info + uid:(NSUInteger)uid + joinSuccess:(void (^)(NSString *channel, NSUInteger uid, NSInteger elapsed))joinSuccessBlock; /** * lets the user leave a channel, i.e., hanging up or exiting a call. After joining a channel, the user must call the leaveChannel method to end the call before joining another one. It is synchronous, i.e., it only returns until the call ends and all resources are released. - * @param leaveChannelBlock indicate the statistics of this call, from joinChannel to leaveChannel, including duration, tx bytes and rx bytes in the call. + * @param leaveChannelBlock indicate the statistics of this call, from joinChannel to leaveChannel, including duration, + tx bytes and rx bytes in the call. * * @return 0 if executed successfully, or return negative value if failed. */ -- (int)leaveChannel:(void(^)(AgoraRtcStats* stat))leaveChannelBlock; +- (int)leaveChannel:(void (^)(AgoraRtcStats *stat))leaveChannelBlock; - /** - * Enables the network quality test. When enabled, the callback 'networkQualityBlock' notifies the application about the user's network connection quality. - Note: Once the network test is enabled, it uses the network bandwidth even when the application is not in a call. - Recommandation: When the application is foreground, enable the network connection test; and when the application is switched to background, disable network test in order to reduce network traffic. - By default, the network test is disabled - * - * @return 0 when executed successfully, and return negative value when failed. - */ +/** +* Enables the network quality test. When enabled, the callback 'networkQualityBlock' notifies the application about the +user's network connection quality. Note: Once the network test is enabled, it uses the network bandwidth even when the +application is not in a call. Recommandation: When the application is foreground, enable the network connection test; +and when the application is switched to background, disable network test in order to reduce network traffic. By +default, the network test is disabled +* +* @return 0 when executed successfully, and return negative value when failed. +*/ - (int)enableLastmileTest; /** @@ -985,15 +1042,14 @@ __attribute__((visibility("default"))) @interface AgoraRtcEngineKit : NSObject */ - (int)setParameters:(NSString *)options; -- (NSString*)getParameter:(NSString*)parameter - args:(NSString*)args; +- (NSString *)getParameter:(NSString *)parameter args:(NSString *)args; /** * The call id of current client. The call id could be used in 'rate' and 'complain' method. * * @return The current call id. */ -- (NSString*) getCallId; +- (NSString *)getCallId; /** * Let user rate the call. Often called after the call ends. @@ -1002,11 +1058,10 @@ __attribute__((visibility("default"))) @interface AgoraRtcEngineKit : NSObject * @param rating The rating for the call between 1 (lowest score) to 10 (highest score). * @param description Optional, decribed by user for the call with a length less than 800 bytes. * - * @return 0 when executed successfully. return ERR_INVALID_ARGUMENT (-2):The passed argument is invalid, e.g., callId invalid. return ERR_NOT_READY (-3):The SDK status is incorrect, e.g., initialization failed. + * @return 0 when executed successfully. return ERR_INVALID_ARGUMENT (-2):The passed argument is invalid, e.g., callId + * invalid. return ERR_NOT_READY (-3):The SDK status is incorrect, e.g., initialization failed. */ -- (int) rate:(NSString*) callId - rating:(NSInteger) rating - description:(NSString*) description; +- (int)rate:(NSString *)callId rating:(NSInteger)rating description:(NSString *)description; /** * Let user complain the quality of the call. Often called after the call ends. @@ -1014,16 +1069,15 @@ __attribute__((visibility("default"))) @interface AgoraRtcEngineKit : NSObject * @param callId The call ID retrieved from the 'getCallId' method. * @param description Optional, decribed by user for the call with a length less than 800 bytes. * - * @return 0 when executed successfully. return ERR_INVALID_ARGUMENT (-2):The passed argument is invalid, e.g., callId invalid. return ERR_NOT_READY (-3):The SDK status is incorrect, e.g., initialization failed. + * @return 0 when executed successfully. return ERR_INVALID_ARGUMENT (-2):The passed argument is invalid, e.g., callId + * invalid. return ERR_NOT_READY (-3):The SDK status is incorrect, e.g., initialization failed. */ -- (int) complain:(NSString*) callId - description:(NSString*) description; +- (int)complain:(NSString *)callId description:(NSString *)description; /** END OF COMMON METHODS */ /** BEGIN OF AUDIO METHODS */ - /** * Enable / Disable speaker of device * @@ -1040,19 +1094,19 @@ __attribute__((visibility("default"))) @interface AgoraRtcEngineKit : NSObject */ - (BOOL)isSpeakerphoneEnabled; - /** * Set default audio route to Speakerphone * - * @param defaultToSpeaker YES: default to speakerphone. NO: default to earpiece for voice chat, speaker for video chat. + * @param defaultToSpeaker YES: default to speakerphone. NO: default to earpiece for voice chat, speaker for video + * chat. * * @return 0 when executed successfully. return negative value if failed. */ - (int)setDefaultAudioRouteToSpeakerphone:(BOOL)defaultToSpeaker; - /** - * Sets the speakerphone volume. The speaker volume could be adjust by MPMusicPlayerController and other iOS API easily. + * Sets the speakerphone volume. The speaker volume could be adjust by MPMusicPlayerController and other iOS API + * easily. * * @param volume between 0 (lowest volume) to 255 (highest volume). * @@ -1060,7 +1114,6 @@ __attribute__((visibility("default"))) @interface AgoraRtcEngineKit : NSObject */ - (int)setSpeakerphoneVolume:(NSUInteger)volume __deprecated; - /** * Enables to report to the application about the volume of the speakers. * @@ -1071,9 +1124,7 @@ __attribute__((visibility("default"))) @interface AgoraRtcEngineKit : NSObject * * @return 0 when executed successfully. return negative value if failed. */ -- (int)enableAudioVolumeIndication:(NSInteger)interval - smooth:(NSInteger)smooth; - +- (int)enableAudioVolumeIndication:(NSInteger)interval smooth:(NSInteger)smooth; /** * Start recording conversation to file specified by the file path. @@ -1083,9 +1134,7 @@ __attribute__((visibility("default"))) @interface AgoraRtcEngineKit : NSObject * * @return 0 when executed successfully. return negative value if failed. */ -- (int)startAudioRecording:(NSString*)filePath - quality:(AgoraRtcAudioRecordingQuality)quality; - +- (int)startAudioRecording:(NSString *)filePath quality:(AgoraRtcAudioRecordingQuality)quality; /** * Stop conversation recording @@ -1094,37 +1143,35 @@ __attribute__((visibility("default"))) @interface AgoraRtcEngineKit : NSObject */ - (int)stopAudioRecording; -- (int)startAudioMixing:(NSString*) filePath - loopback:(BOOL) loopback - replace:(BOOL) replace - cycle:(NSInteger) cycle; +- (int)startAudioMixing:(NSString *)filePath loopback:(BOOL)loopback replace:(BOOL)replace cycle:(NSInteger)cycle; - (int)stopAudioMixing; - (int)pauseAudioMixing; - (int)resumeAudioMixing; -- (int)adjustAudioMixingVolume:(NSInteger) volume; +- (int)adjustAudioMixingVolume:(NSInteger)volume; - (int)getAudioMixingDuration; - (int)getAudioMixingCurrentPosition; -- (int)setAudioMixingPosition:(NSInteger) pos; - - +- (int)setAudioMixingPosition:(NSInteger)pos; //- (int)setScreenCaptureId:(NSUInteger)windowId; - /** - * Launches an echo test to test if the audio devices (e.g., headset and speaker) and the network connection work properly. In the test, the user speaks first, and the recording will be played back in 10 seconds. If the user can hear what he said in 10 seconds, it indicates that the audio devices and network connection work properly. - Notes: Must call stopEchoTest to end the test, or won't start new test or join channel. + * Launches an echo test to test if the audio devices (e.g., headset and speaker) and the network connection work + properly. In the test, the user speaks first, and the recording will be played back in 10 seconds. If the user can hear + what he said in 10 seconds, it indicates that the audio devices and network connection work properly. Notes: Must call + stopEchoTest to end the test, or won't start new test or join channel. * * @param successBlock The callback indicates that the user has successfully joined the specified channel. * - * @return 0 when executed successfully. return negative value if failed. e.g. ERR_REFUSED (-5):Failed to launch the echo test, e.g., initialization failed. + * @return 0 when executed successfully. return negative value if failed. e.g. ERR_REFUSED (-5):Failed to launch the + echo test, e.g., initialization failed. */ -- (int)startEchoTest:(void(^)(NSString* channel, NSUInteger uid, NSInteger elapsed))successBlock; +- (int)startEchoTest:(void (^)(NSString *channel, NSUInteger uid, NSInteger elapsed))successBlock; /** * Stop echo test. * - * @return 0 when executed successfully. return negative value if failed. e.g. ERR_REFUSED(-5):Failed to stop the echo test. It could be that the echo test is not running. + * @return 0 when executed successfully. return negative value if failed. e.g. ERR_REFUSED(-5):Failed to stop the echo + * test. It could be that the echo test is not running. */ - (int)stopEchoTest; @@ -1133,11 +1180,10 @@ __attribute__((visibility("default"))) @interface AgoraRtcEngineKit : NSObject * * @param mute true: Mutes the local audio. false: Unmutes the local audio. * - * @return 0 when executed successfully. return negative value if failed. + * @return 0 when executed successfully. return negative value if failed. */ - (int)muteLocalAudioStream:(BOOL)mute; - /** * Mutes / Unmutes all remote audio. * @@ -1148,66 +1194,65 @@ __attribute__((visibility("default"))) @interface AgoraRtcEngineKit : NSObject - (int)muteAllRemoteAudioStreams:(BOOL)mute; -- (int)muteRemoteAudioStream:(NSUInteger)uid - mute:(BOOL)mute; +- (int)muteRemoteAudioStream:(NSUInteger)uid mute:(BOOL)mute; /** END OF AUDIO METHODS */ /** BEGIN OF VIDIO METHODS */ /** - * Set up the local video view. The video canvus is initialized with video display setting. And it could be called before entering a channel. + * Set up the local video view. The video canvus is initialized with video display setting. And it could be called + * before entering a channel. * - * @param local the canvas is composed of view, renderMode and uid. How to initialize 'local'? please take a look at 'AgoraRtcVideoCanvas' + * @param local the canvas is composed of view, renderMode and uid. How to initialize 'local'? please take a look at + * 'AgoraRtcVideoCanvas' * * @return 0 when executed successfully. return negative value if failed. */ -- (int)setupLocalVideo:(AgoraRtcVideoCanvas*)local; - +- (int)setupLocalVideo:(AgoraRtcVideoCanvas *)local; /** - * Set up the remote video view. The video canvus is initialized with video display setting. It could be called after receiving the remote video streams to configure the video settings. + * Set up the remote video view. The video canvus is initialized with video display setting. It could be called after + * receiving the remote video streams to configure the video settings. * - * @param remote the canvas is composed of view, renderMode and uid. How to initialize 'remote'? please take a look at 'AgoraRtcVideoCanvas' + * @param remote the canvas is composed of view, renderMode and uid. How to initialize 'remote'? please take a look at + * 'AgoraRtcVideoCanvas' * * @return 0 when executed successfully. return negative value if failed. */ -- (int)setupRemoteVideo:(AgoraRtcVideoCanvas*)remote; - +- (int)setupRemoteVideo:(AgoraRtcVideoCanvas *)remote; /** * Configure display setting of local view. And it could be called mutiple times during a call. * - * @param mode There are Hidden(1), Fit(2) and Adaptive(3) mode. Please take a look at definition of enum AgoraRtcRenderMode + * @param mode There are Hidden(1), Fit(2) and Adaptive(3) mode. Please take a look at definition of enum + * AgoraRtcRenderMode * * @return 0 when executed successfully. return negative value if failed. */ -- (int)setLocalRenderMode:(AgoraRtcRenderMode) mode; - +- (int)setLocalRenderMode:(AgoraRtcRenderMode)mode; /** * Configure display setting of remote view. And it could be called mutiple times during a call. * * @param uid The user id of remote view. - * @param mode There are Hidden(1), Fit(2) and Adaptive(3) mode. Please take a look at definition of enum AgoraRtcRenderMode + * @param mode There are Hidden(1), Fit(2) and Adaptive(3) mode. Please take a look at definition of enum + * AgoraRtcRenderMode * * @return 0 when executed successfully. return negative value if failed. */ -- (int)setRemoteRenderMode: (NSUInteger)uid - mode:(AgoraRtcRenderMode) mode; +- (int)setRemoteRenderMode:(NSUInteger)uid mode:(AgoraRtcRenderMode)mode; /** - * API deprecated. Please refer to open source https://github.com/AgoraLab/AgoraDemo, the function "onSwitchRemoteUsers" in demo agora-easycall-ios-oc - * Switches between video display views of two different users. + * API deprecated. Please refer to open source https://github.com/AgoraLab/AgoraDemo, the function + * "onSwitchRemoteUsers" in demo agora-easycall-ios-oc Switches between video display views of two different users. * * @param uid1 The user ID of the user whose video is to be switched. * @param uid2 The user ID of another user whose video is to be switched. * * @return 0 when executed successfully. return negative value if failed. */ -- (int)switchView:(NSUInteger)uid1 - andAnother:(NSUInteger)uid2 __deprecated; - +- (int)switchView:(NSUInteger)uid1 andAnother:(NSUInteger)uid2 __deprecated; /** * Switches between front and back cameras. @@ -1223,9 +1268,7 @@ __attribute__((visibility("default"))) @interface AgoraRtcEngineKit : NSObject * * @return 0 when executed successfully. return negative value if failed. */ -- (int)setVideoProfile:(AgoraRtcVideoProfile)profile - swapWidthAndHeight:(BOOL)swapWidthAndHeight; - +- (int)setVideoProfile:(AgoraRtcVideoProfile)profile swapWidthAndHeight:(BOOL)swapWidthAndHeight; /** * Enable / disable sending local video streams to the network. @@ -1236,7 +1279,6 @@ __attribute__((visibility("default"))) @interface AgoraRtcEngineKit : NSObject */ - (int)muteLocalVideoStream:(BOOL)mute; - /** * Enables / disables playing all remote callers’ video streams. * @@ -1254,8 +1296,7 @@ __attribute__((visibility("default"))) @interface AgoraRtcEngineKit : NSObject * * @return 0 when executed successfully. return negative value if failed. */ -- (int)muteRemoteVideoStream:(NSUInteger)uid - mute:(BOOL)mute; +- (int)muteRemoteVideoStream:(NSUInteger)uid mute:(BOOL)mute; /** END OF VIDIO METHODS */ @@ -1266,7 +1307,7 @@ __attribute__((visibility("default"))) @interface AgoraRtcEngineKit : NSObject * * @return 0 when executed successfully. return negative value if failed. */ -- (int)setLogFile:(NSString*)filePath; +- (int)setLogFile:(NSString *)filePath; /** * Specifiy the log level of output @@ -1278,14 +1319,14 @@ __attribute__((visibility("default"))) @interface AgoraRtcEngineKit : NSObject - (int)setLogFilter:(NSUInteger)filter; /** - * Renew channel key, refresh the new key into agora engine. APP should call this API when SDK reports error ERR_CHANNEL_KEY_EXPIRED. + * Renew channel key, refresh the new key into agora engine. APP should call this API when SDK reports error + * ERR_CHANNEL_KEY_EXPIRED. * * @param channelKey new channel key * * @return 0 when executed successfully. return negative value if failed. */ -- (int)renewChannelKey:(NSString*)channelKey; - +- (int)renewChannelKey:(NSString *)channelKey; /** * Set the channel profile: such as communication, live broadcasting @@ -1304,52 +1345,47 @@ __attribute__((visibility("default"))) @interface AgoraRtcEngineKit : NSObject * * @return 0 when executed successfully. return negative value if failed. */ -- (int)setClientRole:(AgoraRtcClientRole)role withKey: (NSString *)permissionKey; +- (int)setClientRole:(AgoraRtcClientRole)role withKey:(NSString *)permissionKey; - (int)enableDualStreamMode:(BOOL)enabled; /** - * Specify encryption mode of AES encryption algorithm. - * @param [in] encryptionMode - * encryption mode of AES algorithm, could be one of the following: - * "aes-128-xts", "aes-256-xts". - * The default value is "aes-128-xts". specify NULL value will use default encryption mode. - * @return return 0 if success or an error code - */ -- (int)setEncryptionMode:(NSString*)encryptionMode; + * Specify encryption mode of AES encryption algorithm. + * @param [in] encryptionMode + * encryption mode of AES algorithm, could be one of the following: + * "aes-128-xts", "aes-256-xts". + * The default value is "aes-128-xts". specify NULL value will use default encryption mode. + * @return return 0 if success or an error code + */ +- (int)setEncryptionMode:(NSString *)encryptionMode; /** - * Specifying encryption secret enables built-in AES-128 encryption. Leaving channel will clear the secret specified in last channel - * @param [in] secret - * secret to enable encryption - * @return return 0 if success or an error code - */ -- (int)setEncryptionSecret:(NSString*)secret; - -- (int) setRemoteVideoStream: (NSUInteger) uid - type: (AgoraRtcVideoStreamType) streamType; + * Specifying encryption secret enables built-in AES-128 encryption. Leaving channel will clear the secret specified in + * last channel + * @param [in] secret + * secret to enable encryption + * @return return 0 if success or an error code + */ +- (int)setEncryptionSecret:(NSString *)secret; +- (int)setRemoteVideoStream:(NSUInteger)uid type:(AgoraRtcVideoStreamType)streamType; -- (int) startRecordingService:(NSString*)recordingKey; -- (int) stopRecordingService:(NSString*)recordingKey; -- (int) refreshRecordingServiceStatus; +- (int)startRecordingService:(NSString *)recordingKey; +- (int)stopRecordingService:(NSString *)recordingKey; +- (int)refreshRecordingServiceStatus; -- (int)createDataStream:(NSInteger*)streamId - reliable:(BOOL)reliable - ordered:(BOOL)ordered; -- (int)sendStreamMessage:(NSInteger)streamId - data:(NSData*)data; +- (int)createDataStream:(NSInteger *)streamId reliable:(BOOL)reliable ordered:(BOOL)ordered; +- (int)sendStreamMessage:(NSInteger)streamId data:(NSData *)data; - (int)setRecordingAudioFrameParametersWithSampleRate:(NSInteger)sampleRate - channel:(NSInteger)channel - mode:(AgoraRtcRawAudioFrameOpMode)mode - samplesPerCall:(NSInteger)samplesPerCall; + channel:(NSInteger)channel + mode:(AgoraRtcRawAudioFrameOpMode)mode + samplesPerCall:(NSInteger)samplesPerCall; - (int)setPlaybackAudioFrameParametersWithSampleRate:(NSInteger)sampleRate - channel:(NSInteger)channel - mode:(AgoraRtcRawAudioFrameOpMode)mode - samplesPerCall:(NSInteger)samplesPerCall; -- (int)setMixedAudioFrameParametersWithSampleRate:(NSInteger)sampleRate - samplesPerCall:(NSInteger)samplesPerCall; + channel:(NSInteger)channel + mode:(AgoraRtcRawAudioFrameOpMode)mode + samplesPerCall:(NSInteger)samplesPerCall; +- (int)setMixedAudioFrameParametersWithSampleRate:(NSInteger)sampleRate samplesPerCall:(NSInteger)samplesPerCall; /** * adjust recording signal volume @@ -1369,9 +1405,7 @@ __attribute__((visibility("default"))) @interface AgoraRtcEngineKit : NSObject */ - (int)adjustPlaybackSignalVolume:(NSInteger)volume; -- (int)setHighQualityAudioParametersWithFullband:(BOOL)fullband - stereo:(BOOL)stereo - fullBitrate:(BOOL)fullBitrate; +- (int)setHighQualityAudioParametersWithFullband:(BOOL)fullband stereo:(BOOL)stereo fullBitrate:(BOOL)fullBitrate; - (int)enableInEarMonitoring:(BOOL)enabled; - (int)enableWebSdkInteroperability:(BOOL)enabled; @@ -1380,7 +1414,7 @@ __attribute__((visibility("default"))) @interface AgoraRtcEngineKit : NSObject - (int)configPublisher:(AgoraPublisherConfiguration *)config; -- (int)setVideoCompositingLayout:(AgoraRtcVideoCompositingLayout*)layout; +- (int)setVideoCompositingLayout:(AgoraRtcVideoCompositingLayout *)layout; - (int)clearVideoCompositingLayout; @@ -1390,8 +1424,7 @@ __attribute__((visibility("default"))) @interface AgoraRtcEngineKit : NSObject * * @return 0 when executed successfully. return negative value if failed. */ -- (int)startScreenCapture:(NSUInteger)windowId withCaptureFreq: (int) captureFreq AndRect :(CGRect)rect; - +- (int)startScreenCapture:(NSUInteger)windowId withCaptureFreq:(int)captureFreq AndRect:(CGRect)rect; /** * Stop screen capture @@ -1407,43 +1440,41 @@ __attribute__((visibility("default"))) @interface AgoraRtcEngineKit : NSObject */ - (int)updateScreenCaptureRegion:(CGRect)rect; -- (void) monitorDeviceChange: (BOOL)enabled; -- (NSArray*) enumerateDevices:(AgoraRtcDeviceType)type; // return array of AgoraRtcDeviceInfo -- (NSString*) getDeviceId:(AgoraRtcDeviceType)type; -- (int) setDevice:(AgoraRtcDeviceType)type deviceId:(NSString *) deviceId; -- (int) getDeviceVolume:(AgoraRtcDeviceType)type; -- (int) setDeviceVolume:(AgoraRtcDeviceType)type volume:(int)volume; +- (void)monitorDeviceChange:(BOOL)enabled; +- (NSArray *)enumerateDevices:(AgoraRtcDeviceType)type; // return array of AgoraRtcDeviceInfo +- (NSString *)getDeviceId:(AgoraRtcDeviceType)type; +- (int)setDevice:(AgoraRtcDeviceType)type deviceId:(NSString *)deviceId; +- (int)getDeviceVolume:(AgoraRtcDeviceType)type; +- (int)setDeviceVolume:(AgoraRtcDeviceType)type volume:(int)volume; -- (int) startRecordingDeviceTest:(int) indicationInterval; -- (int) stopRecordingDeviceTest; +- (int)startRecordingDeviceTest:(int)indicationInterval; +- (int)stopRecordingDeviceTest; -- (int) startPlaybackDeviceTest:(NSString *) audioFileName; -- (int) stopPlaybackDeviceTest; +- (int)startPlaybackDeviceTest:(NSString *)audioFileName; +- (int)stopPlaybackDeviceTest; -- (int) startCaptureDeviceTest:(NSView *) view; -- (int) stopCaptureDeviceTest; +- (int)startCaptureDeviceTest:(NSView *)view; +- (int)stopCaptureDeviceTest; #endif -//Audio Effects -- (double) getEffectsVolume; -- (int) setEffectsVolume:(double) volume; -- (int) setVolumeOfEffect:(int) soundId - withVolume:(double) volume; -- (int) playEffect:(int) soundId - filePath:(NSString*)filePath - loop:(BOOL)loop - pitch:(double) pitch - pan:(double) pan - gain:(double) gain; -- (int) stopEffect:(int) soundId; -- (int) stopAllEffects; -- (int) preloadEffect:(int) soundId - filePath:(NSString*) filePath; -- (int) unloadEffect:(int) soundId; -- (int) pauseEffect:(int) soundId; -- (int) pauseAllEffects; -- (int) resumeEffect:(int) soundId; -- (int) resumeAllEffects; +// Audio Effects +- (double)getEffectsVolume; +- (int)setEffectsVolume:(double)volume; +- (int)setVolumeOfEffect:(int)soundId withVolume:(double)volume; +- (int)playEffect:(int)soundId + filePath:(NSString *)filePath + loop:(BOOL)loop + pitch:(double)pitch + pan:(double)pan + gain:(double)gain; +- (int)stopEffect:(int)soundId; +- (int)stopAllEffects; +- (int)preloadEffect:(int)soundId filePath:(NSString *)filePath; +- (int)unloadEffect:(int)soundId; +- (int)pauseEffect:(int)soundId; +- (int)pauseAllEffects; +- (int)resumeEffect:(int)soundId; +- (int)resumeAllEffects; /** * External video source support @@ -1452,7 +1483,7 @@ __attribute__((visibility("default"))) @interface AgoraRtcEngineKit : NSObject // query whether texture can be supported (always returns YES) //+ (BOOL) isTextureEncodeSupported; // If external video source is to use, call this API before enableVideo/startPreview -- (void) setExternalVideoSource:(BOOL) enable useTexture:(BOOL)useTexture pushMode:(BOOL)pushMode; +- (void)setExternalVideoSource:(BOOL)enable useTexture:(BOOL)useTexture pushMode:(BOOL)pushMode; // Push a video frame to SDK -- (BOOL) pushExternalVideoFrame:(AgoraVideoFrame *)frame; +- (BOOL)pushExternalVideoFrame:(AgoraVideoFrame *)frame; @end diff --git a/ios-rongcallkit/framework/AgoraRtcEngineKit.framework/Headers/IAgoraMediaEngine.h b/ios-rongcallkit/framework/AgoraRtcEngineKit.framework/Headers/IAgoraMediaEngine.h index e10b6a5..e3179b7 100644 --- a/ios-rongcallkit/framework/AgoraRtcEngineKit.framework/Headers/IAgoraMediaEngine.h +++ b/ios-rongcallkit/framework/AgoraRtcEngineKit.framework/Headers/IAgoraMediaEngine.h @@ -7,169 +7,156 @@ typedef unsigned __int64 uint64_t; #include #endif -namespace agora -{ -namespace media -{ - -class IAudioFrameObserver -{ -public: - enum AUDIO_FRAME_TYPE { - FRAME_TYPE_PCM16 = 0, //PCM 16bit little endian - }; - struct AudioFrame { - AUDIO_FRAME_TYPE type; - int samples; //number of samples in this frame - int bytesPerSample; //number of bytes per sample: 2 for PCM16 - int channels; //number of channels (data are interleaved if stereo) - int samplesPerSec; //sampling rate - void* buffer; //data buffer - int64_t renderTimeMs; - }; -public: - virtual bool onRecordAudioFrame(AudioFrame& audioFrame) = 0; - virtual bool onPlaybackAudioFrame(AudioFrame& audioFrame) = 0; - virtual bool onMixedAudioFrame(AudioFrame& audioFrame) = 0; - virtual bool onPlaybackAudioFrameBeforeMixing(unsigned int uid, AudioFrame& audioFrame) = 0; +namespace agora { +namespace media { + +class IAudioFrameObserver { + public: + enum AUDIO_FRAME_TYPE { + FRAME_TYPE_PCM16 = 0, // PCM 16bit little endian + }; + struct AudioFrame { + AUDIO_FRAME_TYPE type; + int samples; // number of samples in this frame + int bytesPerSample; // number of bytes per sample: 2 for PCM16 + int channels; // number of channels (data are interleaved if stereo) + int samplesPerSec; // sampling rate + void *buffer; // data buffer + int64_t renderTimeMs; + }; + + public: + virtual bool onRecordAudioFrame(AudioFrame &audioFrame) = 0; + virtual bool onPlaybackAudioFrame(AudioFrame &audioFrame) = 0; + virtual bool onMixedAudioFrame(AudioFrame &audioFrame) = 0; + virtual bool onPlaybackAudioFrameBeforeMixing(unsigned int uid, AudioFrame &audioFrame) = 0; }; -class IVideoFrameObserver -{ -public: - enum VIDEO_FRAME_TYPE { - FRAME_TYPE_YUV420 = 0, //YUV 420 format - }; - struct VideoFrame { - VIDEO_FRAME_TYPE type; - int width; //width of video frame - int height; //height of video frame - int yStride; //stride of Y data buffer - int uStride; //stride of U data buffer - int vStride; //stride of V data buffer - void* yBuffer; //Y data buffer - void* uBuffer; //U data buffer - void* vBuffer; //V data buffer - int rotation; // rotation of this frame (0, 90, 180, 270) - int64_t renderTimeMs; - }; -public: - virtual bool onCaptureVideoFrame(VideoFrame& videoFrame) = 0; - virtual bool onRenderVideoFrame(unsigned int uid, VideoFrame& videoFrame) = 0; +class IVideoFrameObserver { + public: + enum VIDEO_FRAME_TYPE { + FRAME_TYPE_YUV420 = 0, // YUV 420 format + }; + struct VideoFrame { + VIDEO_FRAME_TYPE type; + int width; // width of video frame + int height; // height of video frame + int yStride; // stride of Y data buffer + int uStride; // stride of U data buffer + int vStride; // stride of V data buffer + void *yBuffer; // Y data buffer + void *uBuffer; // U data buffer + void *vBuffer; // V data buffer + int rotation; // rotation of this frame (0, 90, 180, 270) + int64_t renderTimeMs; + }; + + public: + virtual bool onCaptureVideoFrame(VideoFrame &videoFrame) = 0; + virtual bool onRenderVideoFrame(unsigned int uid, VideoFrame &videoFrame) = 0; }; -class IVideoFrame -{ -public: - enum PLANE_TYPE { - Y_PLANE = 0, - U_PLANE = 1, - V_PLANE = 2, - NUM_OF_PLANES = 3 - }; - enum VIDEO_TYPE { - VIDEO_TYPE_UNKNOWN = 0, - VIDEO_TYPE_I420 = 1, - VIDEO_TYPE_IYUV = 2, - VIDEO_TYPE_RGB24 = 3, - VIDEO_TYPE_ABGR = 4, - VIDEO_TYPE_ARGB = 5, - VIDEO_TYPE_ARGB4444 = 6, - VIDEO_TYPE_RGB565 = 7, - VIDEO_TYPE_ARGB1555 = 8, - VIDEO_TYPE_YUY2 = 9, - VIDEO_TYPE_YV12 = 10, - VIDEO_TYPE_UYVY = 11, - VIDEO_TYPE_MJPG = 12, - VIDEO_TYPE_NV21 = 13, - VIDEO_TYPE_NV12 = 14, - VIDEO_TYPE_BGRA = 15, - VIDEO_TYPE_RGBA = 16, - }; - virtual void release() = 0; - virtual const unsigned char* buffer(PLANE_TYPE type) const = 0; - - // Copy frame: If required size is bigger than allocated one, new buffers of - // adequate size will be allocated. - // Return value: 0 on success ,-1 on error. - virtual int copyFrame(IVideoFrame** dest_frame) const = 0; - - // Convert frame - // Input: - // - src_frame : Reference to a source frame. - // - dst_video_type : Type of output video. - // - dst_sample_size : Required only for the parsing of MJPG. - // - dst_frame : Pointer to a destination frame. - // Return value: 0 if OK, < 0 otherwise. - // It is assumed that source and destination have equal height. - virtual int convertFrame(VIDEO_TYPE dst_video_type, int dst_sample_size, unsigned char* dst_frame) const = 0; - - // Get allocated size per plane. - virtual int allocated_size(PLANE_TYPE type) const = 0; - - // Get allocated stride per plane. - virtual int stride(PLANE_TYPE type) const = 0; - - // Get frame width. - virtual int width() const = 0; - - // Get frame height. - virtual int height() const = 0; - - // Get frame timestamp (90kHz). - virtual unsigned int timestamp() const = 0; - - // Get render time in milliseconds. - virtual int64_t render_time_ms() const = 0; - - // Return true if underlying plane buffers are of zero size, false if not. - virtual bool IsZeroSize() const = 0; +class IVideoFrame { + public: + enum PLANE_TYPE { Y_PLANE = 0, U_PLANE = 1, V_PLANE = 2, NUM_OF_PLANES = 3 }; + enum VIDEO_TYPE { + VIDEO_TYPE_UNKNOWN = 0, + VIDEO_TYPE_I420 = 1, + VIDEO_TYPE_IYUV = 2, + VIDEO_TYPE_RGB24 = 3, + VIDEO_TYPE_ABGR = 4, + VIDEO_TYPE_ARGB = 5, + VIDEO_TYPE_ARGB4444 = 6, + VIDEO_TYPE_RGB565 = 7, + VIDEO_TYPE_ARGB1555 = 8, + VIDEO_TYPE_YUY2 = 9, + VIDEO_TYPE_YV12 = 10, + VIDEO_TYPE_UYVY = 11, + VIDEO_TYPE_MJPG = 12, + VIDEO_TYPE_NV21 = 13, + VIDEO_TYPE_NV12 = 14, + VIDEO_TYPE_BGRA = 15, + VIDEO_TYPE_RGBA = 16, + }; + virtual void release() = 0; + virtual const unsigned char *buffer(PLANE_TYPE type) const = 0; + + // Copy frame: If required size is bigger than allocated one, new buffers of + // adequate size will be allocated. + // Return value: 0 on success ,-1 on error. + virtual int copyFrame(IVideoFrame **dest_frame) const = 0; + + // Convert frame + // Input: + // - src_frame : Reference to a source frame. + // - dst_video_type : Type of output video. + // - dst_sample_size : Required only for the parsing of MJPG. + // - dst_frame : Pointer to a destination frame. + // Return value: 0 if OK, < 0 otherwise. + // It is assumed that source and destination have equal height. + virtual int convertFrame(VIDEO_TYPE dst_video_type, int dst_sample_size, unsigned char *dst_frame) const = 0; + + // Get allocated size per plane. + virtual int allocated_size(PLANE_TYPE type) const = 0; + + // Get allocated stride per plane. + virtual int stride(PLANE_TYPE type) const = 0; + + // Get frame width. + virtual int width() const = 0; + + // Get frame height. + virtual int height() const = 0; + + // Get frame timestamp (90kHz). + virtual unsigned int timestamp() const = 0; + + // Get render time in milliseconds. + virtual int64_t render_time_ms() const = 0; + + // Return true if underlying plane buffers are of zero size, false if not. + virtual bool IsZeroSize() const = 0; }; -class IExternalVideoRenderCallback -{ -public: - virtual void onViewSizeChanged(int width, int height) = 0; - virtual void onViewDestroyed() = 0; +class IExternalVideoRenderCallback { + public: + virtual void onViewSizeChanged(int width, int height) = 0; + virtual void onViewDestroyed() = 0; }; -struct ExternalVideoRenerContext -{ - IExternalVideoRenderCallback* renderCallback; - void* view; - int renderMode; - int zOrder; - float left; - float top; - float right; - float bottom; +struct ExternalVideoRenerContext { + IExternalVideoRenderCallback *renderCallback; + void *view; + int renderMode; + int zOrder; + float left; + float top; + float right; + float bottom; }; -class IExternalVideoRender -{ -public: - virtual void release() = 0; - virtual int initialize() = 0; - virtual int deliverFrame(const IVideoFrame& videoFrame, int rotation, bool mirrored) = 0; +class IExternalVideoRender { + public: + virtual void release() = 0; + virtual int initialize() = 0; + virtual int deliverFrame(const IVideoFrame &videoFrame, int rotation, bool mirrored) = 0; }; -class IExternalVideoRenderFactory -{ -public: - virtual IExternalVideoRender* createRenderInstance(const ExternalVideoRenerContext& context) = 0; +class IExternalVideoRenderFactory { + public: + virtual IExternalVideoRender *createRenderInstance(const ExternalVideoRenerContext &context) = 0; }; -class IMediaEngine -{ -public: - virtual void release() = 0; - virtual int registerAudioFrameObserver(IAudioFrameObserver* observer) = 0; - virtual int registerVideoFrameObserver(IVideoFrameObserver* observer) = 0; - virtual int registerVideoRenderFactory(IExternalVideoRenderFactory* factory) = 0; +class IMediaEngine { + public: + virtual void release() = 0; + virtual int registerAudioFrameObserver(IAudioFrameObserver *observer) = 0; + virtual int registerVideoFrameObserver(IVideoFrameObserver *observer) = 0; + virtual int registerVideoRenderFactory(IExternalVideoRenderFactory *factory) = 0; }; -} //media +} // namespace media -} //agora +} // namespace agora -#endif //AGORA_MEDIA_ENGINE_H +#endif // AGORA_MEDIA_ENGINE_H diff --git a/ios-rongcallkit/framework/AgoraRtcEngineKit.framework/Headers/IAgoraRtcEngine.h b/ios-rongcallkit/framework/AgoraRtcEngineKit.framework/Headers/IAgoraRtcEngine.h old mode 100755 new mode 100644 index 659aec4..66a65e0 --- a/ios-rongcallkit/framework/AgoraRtcEngineKit.framework/Headers/IAgoraRtcEngine.h +++ b/ios-rongcallkit/framework/AgoraRtcEngineKit.framework/Headers/IAgoraRtcEngine.h @@ -8,9 +8,9 @@ #ifndef AGORA_RTC_ENGINE_H #define AGORA_RTC_ENGINE_H +#include #include #include -#include #if defined(_WIN32) #define WIN32_LEAN_AND_MEAN @@ -33,32 +33,24 @@ #endif namespace agora { - namespace util { +namespace util { -template -class AutoPtr { +template class AutoPtr { typedef T value_type; - typedef T* pointer_type; -public: - AutoPtr(pointer_type p=0) - :ptr_(p) - {} + typedef T *pointer_type; + + public: + AutoPtr(pointer_type p = 0) : ptr_(p) {} ~AutoPtr() { if (ptr_) ptr_->release(); } operator bool() const { return ptr_ != (pointer_type)0; } - value_type& operator*() const { - return *get(); - } + value_type &operator*() const { return *get(); } - pointer_type operator->() const { - return get(); - } + pointer_type operator->() const { return get(); } - pointer_type get() const { - return ptr_; - } + pointer_type get() const { return ptr_; } pointer_type release() { pointer_type tmp = ptr_; @@ -71,50 +63,49 @@ class AutoPtr { ptr_->release(); ptr_ = ptr; } - template - bool queryInterface(C1* c, C2 iid) { + template bool queryInterface(C1 *c, C2 iid) { pointer_type p = NULL; - if (c && !c->queryInterface(iid, (void**)&p)) - { + if (c && !c->queryInterface(iid, (void **)&p)) { reset(p); } - return p != NULL;; - } -private: - AutoPtr(const AutoPtr&); - AutoPtr& operator=(const AutoPtr&); -private: + return p != NULL; + ; + } + + private: + AutoPtr(const AutoPtr &); + AutoPtr &operator=(const AutoPtr &); + + private: pointer_type ptr_; }; class IString { -public: + public: virtual bool empty() const = 0; - virtual const char* c_str() = 0; - virtual const char* data() = 0; + virtual const char *c_str() = 0; + virtual const char *data() = 0; virtual size_t length() = 0; virtual void release() = 0; }; typedef AutoPtr AString; - }//namespace util +} // namespace util namespace rtc { - typedef unsigned int uid_t; - typedef void* view_t; +typedef unsigned int uid_t; +typedef void *view_t; -enum INTERFACE_ID_TYPE -{ +enum INTERFACE_ID_TYPE { AGORA_IID_AUDIO_DEVICE_MANAGER = 1, AGORA_IID_VIDEO_DEVICE_MANAGER = 2, AGORA_IID_RTC_ENGINE_PARAMETER = 3, AGORA_IID_MEDIA_ENGINE = 4, }; -enum WARN_CODE_TYPE -{ +enum WARN_CODE_TYPE { WARN_INVALID_VIEW = 8, WARN_INIT_VIDEO = 16, WARN_PENDING = 20, - WARN_NO_AVAILABLE_CHANNEL = 103, + WARN_NO_AVAILABLE_CHANNEL = 103, WARN_LOOKUP_CHANNEL_TIMEOUT = 104, WARN_LOOKUP_CHANNEL_REJECTED = 105, WARN_OPEN_CHANNEL_TIMEOUT = 106, @@ -131,13 +122,12 @@ enum WARN_CODE_TYPE // sdk: 100~1000 WARN_SWITCH_LIVE_VIDEO_TIMEOUT = 111, - WARN_SET_CLIENT_ROLE_TIMEOUT = 118, + WARN_SET_CLIENT_ROLE_TIMEOUT = 118, }; -enum ERROR_CODE_TYPE -{ +enum ERROR_CODE_TYPE { ERR_OK = 0, - //1~1000 + // 1~1000 ERR_FAILED = 1, ERR_INVALID_ARGUMENT = 2, ERR_NOT_READY = 3, @@ -154,25 +144,25 @@ enum ERROR_CODE_TYPE ERR_NET_NOBUFS = 15, ERR_JOIN_CHANNEL_REJECTED = 17, ERR_LEAVE_CHANNEL_REJECTED = 18, - ERR_ALREADY_IN_USE = 19, - ERR_ABORTED = 20, + ERR_ALREADY_IN_USE = 19, + ERR_ABORTED = 20, ERR_INIT_NET_ENGINE = 21, ERR_INVALID_APP_ID = 101, ERR_INVALID_CHANNEL_NAME = 102, ERR_CHANNEL_KEY_EXPIRED = 109, ERR_INVALID_CHANNEL_KEY = 110, - ERR_CONNECTION_INTERRUPTED = 111, // only used in web sdk - ERR_CONNECTION_LOST = 112, // only used in web sdk + ERR_CONNECTION_INTERRUPTED = 111, // only used in web sdk + ERR_CONNECTION_LOST = 112, // only used in web sdk ERR_DECRYPTION_FAILED = 120, ERR_NOT_IN_CHANNEL = 113, ERR_SIZE_TOO_LARGE = 114, - ERR_BITRATE_LIMIT = 115, - ERR_TOO_MANY_DATA_STREAMS = 116, - ERR_STREAM_MESSAGE_TIMEOUT = 117, + ERR_BITRATE_LIMIT = 115, + ERR_TOO_MANY_DATA_STREAMS = 116, + ERR_STREAM_MESSAGE_TIMEOUT = 117, ERR_SET_CLIENT_ROLE_NOT_AUTHORIZED = 119, - //1001~2000 + // 1001~2000 ERR_LOAD_MEDIA_ENGINE = 1001, ERR_START_CALL = 1002, ERR_START_CAMERA = 1003, @@ -194,9 +184,9 @@ enum ERROR_CODE_TYPE ERR_ADM_NO_PERMISSION = 1027, // 1025, as warning for interruption of adm on ios // 1026, as warning for route change of adm on ios - + // VDM error code starts from 1500 - ERR_VDM_CAMERA_NOT_AUTHORIZED = 1501, + ERR_VDM_CAMERA_NOT_AUTHORIZED = 1501, // VCM error code starts from 1600 ERR_VCM_UNKNOWN_ERROR = 1600, @@ -205,30 +195,24 @@ enum ERROR_CODE_TYPE ERR_VCM_ENCODER_SET_ERROR = 1603, }; -enum LOG_FILTER_TYPE -{ - LOG_FILTER_OFF = 0, +enum LOG_FILTER_TYPE { + LOG_FILTER_OFF = 0, LOG_FILTER_DEBUG = 0x080f, LOG_FILTER_INFO = 0x000f, LOG_FILTER_WARN = 0x000e, LOG_FILTER_ERROR = 0x000c, LOG_FILTER_CRITICAL = 0x0008, - LOG_FILTER_MASK = 0x80f, + LOG_FILTER_MASK = 0x80f, }; -enum MAX_DEVICE_ID_LENGTH_TYPE -{ - MAX_DEVICE_ID_LENGTH = 512 -}; +enum MAX_DEVICE_ID_LENGTH_TYPE { MAX_DEVICE_ID_LENGTH = 512 }; -enum QUALITY_REPORT_FORMAT_TYPE -{ +enum QUALITY_REPORT_FORMAT_TYPE { QUALITY_REPORT_JSON = 0, QUALITY_REPORT_HTML = 1, }; -enum MEDIA_ENGINE_EVENT_CODE_TYPE -{ +enum MEDIA_ENGINE_EVENT_CODE_TYPE { MEDIA_ENGINE_RECORDING_ERROR = 0, MEDIA_ENGINE_PLAYOUT_ERROR = 1, MEDIA_ENGINE_RECORDING_WARNING = 2, @@ -244,16 +228,14 @@ enum MEDIA_ENGINE_EVENT_CODE_TYPE MEDIA_ENGINE_AUDIO_ADM_REQUIRE_RESTART = 110 }; -enum MEDIA_DEVICE_STATE_TYPE -{ +enum MEDIA_DEVICE_STATE_TYPE { MEDIA_DEVICE_STATE_ACTIVE = 1, MEDIA_DEVICE_STATE_DISABLED = 2, MEDIA_DEVICE_STATE_NOT_PRESENT = 4, MEDIA_DEVICE_STATE_UNPLUGGED = 8 }; -enum MEDIA_DEVICE_TYPE -{ +enum MEDIA_DEVICE_TYPE { UNKNOWN_AUDIO_DEVICE = -1, AUDIO_PLAYOUT_DEVICE = 0, AUDIO_RECORDING_DEVICE = 1, @@ -261,15 +243,13 @@ enum MEDIA_DEVICE_TYPE VIDEO_CAPTURE_DEVICE = 3, }; -enum AUDIO_RECORDING_QUALITY_TYPE -{ +enum AUDIO_RECORDING_QUALITY_TYPE { AUDIO_RECORDING_QUALITY_LOW = 0, AUDIO_RECORDING_QUALITY_MEDIUM = 1, AUDIO_RECORDING_QUALITY_HIGH = 2, }; -enum QUALITY_TYPE -{ +enum QUALITY_TYPE { QUALITY_UNKNOWN = 0, QUALITY_EXCELLENT = 1, QUALITY_GOOD = 2, @@ -279,101 +259,91 @@ enum QUALITY_TYPE QUALITY_DOWN = 6, }; -enum RENDER_MODE_TYPE -{ +enum RENDER_MODE_TYPE { RENDER_MODE_HIDDEN = 1, RENDER_MODE_FIT = 2, RENDER_MODE_ADAPTIVE = 3, }; -enum VIDEO_MIRROR_MODE_TYPE -{ - VIDEO_MIRROR_MODE_AUTO = 0,//determined by SDK - VIDEO_MIRROR_MODE_ENABLED = 1,//enabled mirror - VIDEO_MIRROR_MODE_DISABLED = 2,//disable mirror +enum VIDEO_MIRROR_MODE_TYPE { + VIDEO_MIRROR_MODE_AUTO = 0, // determined by SDK + VIDEO_MIRROR_MODE_ENABLED = 1, // enabled mirror + VIDEO_MIRROR_MODE_DISABLED = 2, // disable mirror }; -enum VIDEO_PROFILE_TYPE -{ // res fps kbps - VIDEO_PROFILE_120P = 0, // 160x120 15 65 - VIDEO_PROFILE_120P_3 = 2, // 120x120 15 50 - VIDEO_PROFILE_180P = 10, // 320x180 15 140 - VIDEO_PROFILE_180P_3 = 12, // 180x180 15 100 - VIDEO_PROFILE_180P_4 = 13, // 240x180 15 120 - VIDEO_PROFILE_240P = 20, // 320x240 15 200 - VIDEO_PROFILE_240P_3 = 22, // 240x240 15 140 - VIDEO_PROFILE_240P_4 = 23, // 424x240 15 220 - VIDEO_PROFILE_360P = 30, // 640x360 15 400 - VIDEO_PROFILE_360P_3 = 32, // 360x360 15 260 - VIDEO_PROFILE_360P_4 = 33, // 640x360 30 600 - VIDEO_PROFILE_360P_6 = 35, // 360x360 30 400 - VIDEO_PROFILE_360P_7 = 36, // 480x360 15 320 - VIDEO_PROFILE_360P_8 = 37, // 480x360 30 490 - VIDEO_PROFILE_360P_9 = 38, // 640x360 15 800 - VIDEO_PROFILE_360P_10 = 39, // 640x360 24 800 - VIDEO_PROFILE_360P_11 = 100, // 640x360 24 1000 - VIDEO_PROFILE_480P = 40, // 640x480 15 500 - VIDEO_PROFILE_480P_3 = 42, // 480x480 15 400 - VIDEO_PROFILE_480P_4 = 43, // 640x480 30 750 - VIDEO_PROFILE_480P_6 = 45, // 480x480 30 600 - VIDEO_PROFILE_480P_8 = 47, // 848x480 15 610 - VIDEO_PROFILE_480P_9 = 48, // 848x480 30 930 - VIDEO_PROFILE_480P_10 = 49, // 640x480 10 400 - VIDEO_PROFILE_720P = 50, // 1280x720 15 1130 - VIDEO_PROFILE_720P_3 = 52, // 1280x720 30 1710 - VIDEO_PROFILE_720P_5 = 54, // 960x720 15 910 - VIDEO_PROFILE_720P_6 = 55, // 960x720 30 1380 - VIDEO_PROFILE_1080P = 60, // 1920x1080 15 2080 - VIDEO_PROFILE_1080P_3 = 62, // 1920x1080 30 3150 - VIDEO_PROFILE_1080P_5 = 64, // 1920x1080 60 4780 - VIDEO_PROFILE_1440P = 66, // 2560x1440 30 4850 - VIDEO_PROFILE_1440P_2 = 67, // 2560x1440 60 7350 - VIDEO_PROFILE_4K = 70, // 3840x2160 30 8910 - VIDEO_PROFILE_4K_3 = 72, // 3840x2160 60 13500 +enum VIDEO_PROFILE_TYPE { // res fps kbps + VIDEO_PROFILE_120P = 0, // 160x120 15 65 + VIDEO_PROFILE_120P_3 = 2, // 120x120 15 50 + VIDEO_PROFILE_180P = 10, // 320x180 15 140 + VIDEO_PROFILE_180P_3 = 12, // 180x180 15 100 + VIDEO_PROFILE_180P_4 = 13, // 240x180 15 120 + VIDEO_PROFILE_240P = 20, // 320x240 15 200 + VIDEO_PROFILE_240P_3 = 22, // 240x240 15 140 + VIDEO_PROFILE_240P_4 = 23, // 424x240 15 220 + VIDEO_PROFILE_360P = 30, // 640x360 15 400 + VIDEO_PROFILE_360P_3 = 32, // 360x360 15 260 + VIDEO_PROFILE_360P_4 = 33, // 640x360 30 600 + VIDEO_PROFILE_360P_6 = 35, // 360x360 30 400 + VIDEO_PROFILE_360P_7 = 36, // 480x360 15 320 + VIDEO_PROFILE_360P_8 = 37, // 480x360 30 490 + VIDEO_PROFILE_360P_9 = 38, // 640x360 15 800 + VIDEO_PROFILE_360P_10 = 39, // 640x360 24 800 + VIDEO_PROFILE_360P_11 = 100, // 640x360 24 1000 + VIDEO_PROFILE_480P = 40, // 640x480 15 500 + VIDEO_PROFILE_480P_3 = 42, // 480x480 15 400 + VIDEO_PROFILE_480P_4 = 43, // 640x480 30 750 + VIDEO_PROFILE_480P_6 = 45, // 480x480 30 600 + VIDEO_PROFILE_480P_8 = 47, // 848x480 15 610 + VIDEO_PROFILE_480P_9 = 48, // 848x480 30 930 + VIDEO_PROFILE_480P_10 = 49, // 640x480 10 400 + VIDEO_PROFILE_720P = 50, // 1280x720 15 1130 + VIDEO_PROFILE_720P_3 = 52, // 1280x720 30 1710 + VIDEO_PROFILE_720P_5 = 54, // 960x720 15 910 + VIDEO_PROFILE_720P_6 = 55, // 960x720 30 1380 + VIDEO_PROFILE_1080P = 60, // 1920x1080 15 2080 + VIDEO_PROFILE_1080P_3 = 62, // 1920x1080 30 3150 + VIDEO_PROFILE_1080P_5 = 64, // 1920x1080 60 4780 + VIDEO_PROFILE_1440P = 66, // 2560x1440 30 4850 + VIDEO_PROFILE_1440P_2 = 67, // 2560x1440 60 7350 + VIDEO_PROFILE_4K = 70, // 3840x2160 30 8910 + VIDEO_PROFILE_4K_3 = 72, // 3840x2160 60 13500 VIDEO_PROFILE_DEFAULT = VIDEO_PROFILE_360P, }; -enum CHANNEL_PROFILE_TYPE -{ - CHANNEL_PROFILE_COMMUNICATION = 0, - CHANNEL_PROFILE_LIVE_BROADCASTING = 1, +enum CHANNEL_PROFILE_TYPE { + CHANNEL_PROFILE_COMMUNICATION = 0, + CHANNEL_PROFILE_LIVE_BROADCASTING = 1, CHANNEL_PROFILE_GAME = 2, }; -enum CLIENT_ROLE_TYPE -{ +enum CLIENT_ROLE_TYPE { CLIENT_ROLE_BROADCASTER = 1, CLIENT_ROLE_AUDIENCE = 2, }; -enum USER_OFFLINE_REASON_TYPE -{ +enum USER_OFFLINE_REASON_TYPE { USER_OFFLINE_QUIT = 0, USER_OFFLINE_DROPPED = 1, USER_OFFLINE_BECOME_AUDIENCE = 2, }; -enum REMOTE_VIDEO_STREAM_TYPE -{ +enum REMOTE_VIDEO_STREAM_TYPE { REMOTE_VIDEO_STREAM_HIGH = 0, REMOTE_VIDEO_STREAM_LOW = 1, }; -enum RAW_AUDIO_FRAME_OP_MODE_TYPE -{ +enum RAW_AUDIO_FRAME_OP_MODE_TYPE { RAW_AUDIO_FRAME_OP_MODE_READ_ONLY = 0, RAW_AUDIO_FRAME_OP_MODE_WRITE_ONLY = 1, RAW_AUDIO_FRAME_OP_MODE_READ_WRITE = 2, }; -struct AudioVolumeInfo -{ +struct AudioVolumeInfo { uid_t uid; unsigned int volume; // [0,255] }; -struct RtcStats -{ +struct RtcStats { unsigned int duration; unsigned int txBytes; unsigned int rxBytes; @@ -390,66 +360,47 @@ struct RtcStats double cpuTotalUsage; }; -struct LocalVideoStats -{ +struct LocalVideoStats { int sentBitrate; int sentFrameRate; }; -struct RemoteVideoStats -{ +struct RemoteVideoStats { uid_t uid; int delay; - int width; - int height; - int receivedBitrate; - int receivedFrameRate; + int width; + int height; + int receivedBitrate; + int receivedFrameRate; REMOTE_VIDEO_STREAM_TYPE rxStreamType; }; -struct VideoCompositingLayout -{ +struct VideoCompositingLayout { struct Region { uid_t uid; - double x;//[0,1] - double y;//[0,1] - double width;//[0,1] - double height;//[0,1] - int zOrder; //optional, [0, 100] //0 (default): bottom most, 100: top most + double x; //[0,1] + double y; //[0,1] + double width; //[0,1] + double height; //[0,1] + int zOrder; // optional, [0, 100] //0 (default): bottom most, 100: top most // Optional // [0, 1.0] where 0 denotes throughly transparent, 1.0 opaque double alpha; - RENDER_MODE_TYPE renderMode;//RENDER_MODE_HIDDEN: Crop, RENDER_MODE_FIT: Zoom to fit - Region() - :uid(0) - , x(0) - , y(0) - , width(0) - , height(0) - , zOrder(0) - , alpha(1.0) - , renderMode(RENDER_MODE_HIDDEN) - {} - + RENDER_MODE_TYPE renderMode; // RENDER_MODE_HIDDEN: Crop, RENDER_MODE_FIT: Zoom to fit + Region() : uid(0), x(0), y(0), width(0), height(0), zOrder(0), alpha(1.0), renderMode(RENDER_MODE_HIDDEN) {} }; int canvasWidth; int canvasHeight; - const char* backgroundColor;//e.g. "#C0C0C0" in RGB - const Region* regions; + const char *backgroundColor; // e.g. "#C0C0C0" in RGB + const Region *regions; int regionCount; - const char* appData; + const char *appData; int appDataLength; VideoCompositingLayout() - :canvasWidth(0) - ,canvasHeight(0) - ,backgroundColor(NULL) - ,regions(NULL) - , regionCount(0) - , appData(NULL) - , appDataLength(0) - {} + : canvasWidth(0), canvasHeight(0), backgroundColor(NULL), regions(NULL), regionCount(0), appData(NULL), + appDataLength(0) {} }; typedef struct Rect { @@ -458,194 +409,164 @@ typedef struct Rect { int bottom; int right; - Rect(): top(0), left(0), bottom(0), right(0) {} - Rect(int t, int l, int b, int r): top(t), left(l), bottom(b), right(r) {} + Rect() : top(0), left(0), bottom(0), right(0) {} + Rect(int t, int l, int b, int r) : top(t), left(l), bottom(b), right(r) {} } Rect; #if defined(_WIN32) -enum RTMP_STREAM_LIFE_CYCLE_TYPE -{ - RTMP_STREAM_LIFE_CYCLE_BIND2CHANNEL = 1, - RTMP_STREAM_LIFE_CYCLE_BIND2OWNER = 2, +enum RTMP_STREAM_LIFE_CYCLE_TYPE { + RTMP_STREAM_LIFE_CYCLE_BIND2CHANNEL = 1, + RTMP_STREAM_LIFE_CYCLE_BIND2OWNER = 2, }; struct PublisherConfiguration { - int width; - int height; - int framerate; - int bitrate; - int defaultLayout; - int lifecycle; - bool owner; - int injectStreamWidth; - int injectStreamHeight; - const char* injectStreamUrl; - const char* publishUrl; - const char* rawStreamUrl; - const char* extraInfo; - - - PublisherConfiguration() - : width(640) - , height(360) - , framerate(15) - , bitrate(500) - , defaultLayout(1) - , lifecycle(RTMP_STREAM_LIFE_CYCLE_BIND2CHANNEL) - , owner(true) - , injectStreamWidth(0) - , injectStreamHeight(0) - , injectStreamUrl(NULL) - , publishUrl(NULL) - , rawStreamUrl(NULL) - , extraInfo(NULL) - {} - + int width; + int height; + int framerate; + int bitrate; + int defaultLayout; + int lifecycle; + bool owner; + int injectStreamWidth; + int injectStreamHeight; + const char *injectStreamUrl; + const char *publishUrl; + const char *rawStreamUrl; + const char *extraInfo; + + PublisherConfiguration() + : width(640), height(360), framerate(15), bitrate(500), defaultLayout(1), + lifecycle(RTMP_STREAM_LIFE_CYCLE_BIND2CHANNEL), owner(true), injectStreamWidth(0), injectStreamHeight(0), + injectStreamUrl(NULL), publishUrl(NULL), rawStreamUrl(NULL), extraInfo(NULL) {} }; #endif #if !defined(__ANDROID__) -struct VideoCanvas -{ +struct VideoCanvas { view_t view; int renderMode; uid_t uid; void *priv; // private data (underlying video engine denotes it) - VideoCanvas() - : view(NULL) - , renderMode(RENDER_MODE_HIDDEN) - , uid(0) - , priv(NULL) - {} - VideoCanvas(view_t v, int m, uid_t u) - : view(v) - , renderMode(m) - , uid(u) - , priv(NULL) - {} + VideoCanvas() : view(NULL), renderMode(RENDER_MODE_HIDDEN), uid(0), priv(NULL) {} + VideoCanvas(view_t v, int m, uid_t u) : view(v), renderMode(m), uid(u), priv(NULL) {} }; #else struct VideoCanvas; #endif -class IPacketObserver -{ -public: - - struct Packet - { - const unsigned char* buffer; - unsigned int size; - }; - /** - * called by sdk before the audio packet is sent to other participants - * @param [in,out] packet - * buffer *buffer points the data to be sent - * size of buffer data to be sent - * @return returns true to send out the packet, returns false to discard the packet - */ - virtual bool onSendAudioPacket(Packet& packet) = 0; - /** - * called by sdk before the video packet is sent to other participants - * @param [in,out] packet - * buffer *buffer points the data to be sent - * size of buffer data to be sent - * @return returns true to send out the packet, returns false to discard the packet - */ - virtual bool onSendVideoPacket(Packet& packet) = 0; - /** - * called by sdk when the audio packet is received from other participants - * @param [in,out] packet - * buffer *buffer points the data to be sent - * size of buffer data to be sent - * @return returns true to process the packet, returns false to discard the packet - */ - virtual bool onReceiveAudioPacket(Packet& packet) = 0; - /** - * called by sdk when the video packet is received from other participants - * @param [in,out] packet - * buffer *buffer points the data to be sent - * size of buffer data to be sent - * @return returns true to process the packet, returns false to discard the packet - */ - virtual bool onReceiveVideoPacket(Packet& packet) = 0; +class IPacketObserver { + public: + struct Packet { + const unsigned char *buffer; + unsigned int size; + }; + /** + * called by sdk before the audio packet is sent to other participants + * @param [in,out] packet + * buffer *buffer points the data to be sent + * size of buffer data to be sent + * @return returns true to send out the packet, returns false to discard the packet + */ + virtual bool onSendAudioPacket(Packet &packet) = 0; + /** + * called by sdk before the video packet is sent to other participants + * @param [in,out] packet + * buffer *buffer points the data to be sent + * size of buffer data to be sent + * @return returns true to send out the packet, returns false to discard the packet + */ + virtual bool onSendVideoPacket(Packet &packet) = 0; + /** + * called by sdk when the audio packet is received from other participants + * @param [in,out] packet + * buffer *buffer points the data to be sent + * size of buffer data to be sent + * @return returns true to process the packet, returns false to discard the packet + */ + virtual bool onReceiveAudioPacket(Packet &packet) = 0; + /** + * called by sdk when the video packet is received from other participants + * @param [in,out] packet + * buffer *buffer points the data to be sent + * size of buffer data to be sent + * @return returns true to process the packet, returns false to discard the packet + */ + virtual bool onReceiveVideoPacket(Packet &packet) = 0; }; - /** -* the event call back interface -*/ -class IRtcEngineEventHandler -{ -public: + * the event call back interface + */ +class IRtcEngineEventHandler { + public: virtual ~IRtcEngineEventHandler() {} /** - * when join channel success, the function will be called - * @param [in] channel - * the channel name you have joined - * @param [in] uid - * the UID of you in this channel - * @param [in] elapsed - * the time elapsed in ms from the joinChannel been called to joining completed - */ - virtual void onJoinChannelSuccess(const char* channel, uid_t uid, int elapsed) { + * when join channel success, the function will be called + * @param [in] channel + * the channel name you have joined + * @param [in] uid + * the UID of you in this channel + * @param [in] elapsed + * the time elapsed in ms from the joinChannel been called to joining completed + */ + virtual void onJoinChannelSuccess(const char *channel, uid_t uid, int elapsed) { (void)channel; (void)uid; (void)elapsed; } /** - * when join channel success, the function will be called - * @param [in] channel - * the channel name you have joined - * @param [in] uid - * the UID of you in this channel - * @param [in] elapsed - * the time elapsed in ms elapsed - */ - virtual void onRejoinChannelSuccess(const char* channel, uid_t uid, int elapsed) { + * when join channel success, the function will be called + * @param [in] channel + * the channel name you have joined + * @param [in] uid + * the UID of you in this channel + * @param [in] elapsed + * the time elapsed in ms elapsed + */ + virtual void onRejoinChannelSuccess(const char *channel, uid_t uid, int elapsed) { (void)channel; (void)uid; (void)elapsed; } /** - * when warning message coming, the function will be called - * @param [in] warn - * warning code - * @param [in] msg - * the warning message - */ - virtual void onWarning(int warn, const char* msg) { + * when warning message coming, the function will be called + * @param [in] warn + * warning code + * @param [in] msg + * the warning message + */ + virtual void onWarning(int warn, const char *msg) { (void)warn; (void)msg; } /** - * when error message come, the function will be called - * @param [in] err - * error code - * @param [in] msg - * the error message - */ - virtual void onError(int err, const char* msg) { + * when error message come, the function will be called + * @param [in] err + * error code + * @param [in] msg + * the error message + */ + virtual void onError(int err, const char *msg) { (void)err; (void)msg; } /** - * when audio quality message come, the function will be called - * @param [in] uid - * the uid of the peer - * @param [in] quality - * the quality of the user, see QUALITY_TYPE for value definition - * @param [in] delay - * the average time of the audio packages delayed - * @param [in] lost - * the rate of the audio packages lost - */ + * when audio quality message come, the function will be called + * @param [in] uid + * the uid of the peer + * @param [in] quality + * the quality of the user, see QUALITY_TYPE for value definition + * @param [in] delay + * the average time of the audio packages delayed + * @param [in] lost + * the rate of the audio packages lost + */ virtual void onAudioQuality(uid_t uid, int quality, unsigned short delay, unsigned short lost) { (void)uid; (void)quality; @@ -654,48 +575,44 @@ class IRtcEngineEventHandler } /** - * when the audio volume information come, the function will be called - * @param [in] speakers - * the array of the speakers' audio volume information - * @param [in] speakerNumber - * the count of speakers in this array - * @param [in] totalVolume - * the total volume of all users - */ - virtual void onAudioVolumeIndication(const AudioVolumeInfo* speakers, unsigned int speakerNumber, int totalVolume) { + * when the audio volume information come, the function will be called + * @param [in] speakers + * the array of the speakers' audio volume information + * @param [in] speakerNumber + * the count of speakers in this array + * @param [in] totalVolume + * the total volume of all users + */ + virtual void onAudioVolumeIndication(const AudioVolumeInfo *speakers, unsigned int speakerNumber, int totalVolume) { (void)speakers; (void)speakerNumber; (void)totalVolume; } /** - * when the audio volume information come, the function will be called - * @param [in] stats - * the statistics of the call - */ - virtual void onLeaveChannel(const RtcStats& stats) { - (void)stats; - } + * when the audio volume information come, the function will be called + * @param [in] stats + * the statistics of the call + */ + virtual void onLeaveChannel(const RtcStats &stats) { (void)stats; } /** - * when the information of the RTC engine stats come, the function will be called - * @param [in] stats - * the RTC engine stats - */ - virtual void onRtcStats(const RtcStats& stats) { - (void)stats; - } + * when the information of the RTC engine stats come, the function will be called + * @param [in] stats + * the RTC engine stats + */ + virtual void onRtcStats(const RtcStats &stats) { (void)stats; } /** - * when the audio device state changed(plugged or removed), the function will be called - * @param [in] deviceId - * the ID of the state changed audio device - * @param [in] deviceType - * the type of the audio device(playout device or record device) - * @param [in] deviceState - * the device is been removed or added - */ - virtual void onAudioDeviceStateChanged(const char* deviceId, int deviceType, int deviceState) { + * when the audio device state changed(plugged or removed), the function will be called + * @param [in] deviceId + * the ID of the state changed audio device + * @param [in] deviceType + * the type of the audio device(playout device or record device) + * @param [in] deviceState + * the device is been removed or added + */ + virtual void onAudioDeviceStateChanged(const char *deviceId, int deviceType, int deviceState) { (void)deviceId; (void)deviceType; (void)deviceState; @@ -704,63 +621,59 @@ class IRtcEngineEventHandler /** * When audio mixing file playback finished, this function will be called */ - virtual void onAudioMixingFinished() { - } + virtual void onAudioMixingFinished() {} /** - * When audio effect playback finished, this function will be called - */ - virtual void onAudioEffectFinished(int soundId) { - } + * When audio effect playback finished, this function will be called + */ + virtual void onAudioEffectFinished(int soundId) {} /** - * when the video device state changed(plugged or removed), the function will be called - * @param [in] deviceId - * the ID of the state changed video device - * @param [in] deviceType - * not used - * @param [in] deviceState - * the device is been removed or added - */ - virtual void onVideoDeviceStateChanged(const char* deviceId, int deviceType, int deviceState) { + * when the video device state changed(plugged or removed), the function will be called + * @param [in] deviceId + * the ID of the state changed video device + * @param [in] deviceType + * not used + * @param [in] deviceState + * the device is been removed or added + */ + virtual void onVideoDeviceStateChanged(const char *deviceId, int deviceType, int deviceState) { (void)deviceId; (void)deviceType; (void)deviceState; } /** - * report the network quality - * @param [in] uid - * the UID of the remote user - * @param [in] txQuality - * the score of the send network quality 0~5 the higher the better - * @param [in] rxQuality - * the score of the recv network quality 0~5 the higher the better - */ + * report the network quality + * @param [in] uid + * the UID of the remote user + * @param [in] txQuality + * the score of the send network quality 0~5 the higher the better + * @param [in] rxQuality + * the score of the recv network quality 0~5 the higher the better + */ virtual void onNetworkQuality(uid_t uid, int txQuality, int rxQuality) { - (void)uid; - (void)txQuality; - (void)rxQuality; + (void)uid; + (void)txQuality; + (void)rxQuality; } /** - * report the last-mile test network quality - * @param [in] quality - * the score of the network quality 0~5 the higher the better - */ - virtual void onLastmileQuality(int quality) { - (void)quality; - } + * report the last-mile test network quality + * @param [in] quality + * the score of the network quality 0~5 the higher the better + */ + virtual void onLastmileQuality(int quality) { (void)quality; } /** - * when the first local video frame displayed, the function will be called - * @param [in] width - * the width of the video frame - * @param [in] height - * the height of the video frame - * @param [in] elapsed - * the time elapsed from channel joined in ms - */ + * when the first local video frame displayed, the function will be called + * @param [in] width + * the width of the video frame + * @param [in] height + * the height of the video frame + * @param [in] elapsed + * the time elapsed from channel joined in ms + */ virtual void onFirstLocalVideoFrame(int width, int height, int elapsed) { (void)width; (void)height; @@ -768,16 +681,16 @@ class IRtcEngineEventHandler } /** - * when the first remote video frame decoded, the function will be called - * @param [in] uid - * the UID of the remote user - * @param [in] width - * the width of the video frame - * @param [in] height - * the height of the video frame - * @param [in] elapsed - * the time elapsed from channel joined in ms - */ + * when the first remote video frame decoded, the function will be called + * @param [in] uid + * the UID of the remote user + * @param [in] width + * the width of the video frame + * @param [in] height + * the height of the video frame + * @param [in] elapsed + * the time elapsed from channel joined in ms + */ virtual void onFirstRemoteVideoDecoded(uid_t uid, int width, int height, int elapsed) { (void)uid; (void)width; @@ -804,16 +717,16 @@ class IRtcEngineEventHandler } /** - * when the first remote video frame displayed, the function will be called - * @param [in] uid - * the UID of the remote user - * @param [in] width - * the width of the video frame - * @param [in] height - * the height of the video frame - * @param [in] elapsed - * the time elapsed from remote user called joinChannel in ms - */ + * when the first remote video frame displayed, the function will be called + * @param [in] uid + * the UID of the remote user + * @param [in] width + * the width of the video frame + * @param [in] height + * the height of the video frame + * @param [in] elapsed + * the time elapsed from remote user called joinChannel in ms + */ virtual void onFirstRemoteVideoFrame(uid_t uid, int width, int height, int elapsed) { (void)uid; (void)width; @@ -822,141 +735,135 @@ class IRtcEngineEventHandler } /** - * when any other user joined in the same channel, the function will be called - * @param [in] uid - * the UID of the remote user - * @param [in] elapsed - * the time elapsed from remote used called joinChannel to joining completed in ms - */ + * when any other user joined in the same channel, the function will be called + * @param [in] uid + * the UID of the remote user + * @param [in] elapsed + * the time elapsed from remote used called joinChannel to joining completed in ms + */ virtual void onUserJoined(uid_t uid, int elapsed) { (void)uid; (void)elapsed; } /** - * when user offline(exit channel or offline by accident), the function will be called - * @param [in] uid - * the UID of the remote user - */ + * when user offline(exit channel or offline by accident), the function will be called + * @param [in] uid + * the UID of the remote user + */ virtual void onUserOffline(uid_t uid, USER_OFFLINE_REASON_TYPE reason) { (void)uid; (void)reason; } /** - * when remote user muted the audio stream, the function will be called - * @param [in] uid - * the UID of the remote user - * @param [in] muted - * true: the remote user muted the audio stream, false: the remote user unmuted the audio stream - */ + * when remote user muted the audio stream, the function will be called + * @param [in] uid + * the UID of the remote user + * @param [in] muted + * true: the remote user muted the audio stream, false: the remote user unmuted the audio stream + */ virtual void onUserMuteAudio(uid_t uid, bool muted) { (void)uid; (void)muted; } /** - * when remote user muted the video stream, the function will be called - * @param [in] uid - * the UID of the remote user - * @param [in] muted - * true: the remote user muted the video stream, false: the remote user unmuted the video stream - */ + * when remote user muted the video stream, the function will be called + * @param [in] uid + * the UID of the remote user + * @param [in] muted + * true: the remote user muted the video stream, false: the remote user unmuted the video stream + */ virtual void onUserMuteVideo(uid_t uid, bool muted) { (void)uid; (void)muted; } - /** - * when remote user enable video function, the function will be called - * @param [in] uid - * the UID of the remote user - * @param [in] enabled - * true: the remote user has enabled video function, false: the remote user has disabled video function - */ - virtual void onUserEnableVideo(uid_t uid, bool enabled) { - (void)uid; - (void)enabled; - } - - /** - * when api call executed completely, the function will be called - * @param [in] api - * the api name - * @param [in] error - * error code while 0 means OK - */ - virtual void onApiCallExecuted(const char* api, int error) { + /** + * when remote user enable video function, the function will be called + * @param [in] uid + * the UID of the remote user + * @param [in] enabled + * true: the remote user has enabled video function, false: the remote user has disabled video function + */ + virtual void onUserEnableVideo(uid_t uid, bool enabled) { + (void)uid; + (void)enabled; + } + + /** + * when api call executed completely, the function will be called + * @param [in] api + * the api name + * @param [in] error + * error code while 0 means OK + */ + virtual void onApiCallExecuted(const char *api, int error) { (void)api; (void)error; } /** - * reported local video stats - * @param [in] stats - * the latest local video stats - */ - virtual void onLocalVideoStats(const LocalVideoStats& stats) { - (void)stats; - } + * reported local video stats + * @param [in] stats + * the latest local video stats + */ + virtual void onLocalVideoStats(const LocalVideoStats &stats) { (void)stats; } /** - * reported remote video stats - * @param [in] stats - * the latest remote video stats - */ - virtual void onRemoteVideoStats(const RemoteVideoStats& stats) { - (void)stats; - } + * reported remote video stats + * @param [in] stats + * the latest remote video stats + */ + virtual void onRemoteVideoStats(const RemoteVideoStats &stats) { (void)stats; } /** - * when the camera is ready to work, the function will be called - */ + * when the camera is ready to work, the function will be called + */ virtual void onCameraReady() {} /** - * when all video stopped, the function will be called then you can repaint the video windows - */ + * when all video stopped, the function will be called then you can repaint the video windows + */ virtual void onVideoStopped() {} /** - * when the network can not worked well, the function will be called - */ + * when the network can not worked well, the function will be called + */ virtual void onConnectionLost() {} /** - * when local user disconnected by accident, the function will be called(then SDK will try to reconnect itself) - */ + * when local user disconnected by accident, the function will be called(then SDK will try to reconnect itself) + */ virtual void onConnectionInterrupted() {} - - virtual void onRefreshRecordingServiceStatus(int status) { - (void)status; - } - -// virtual void onStreamError(int streamId, int code, int parameter, const char* message, size_t length) {} - /** - * when stream message received, the function will be called - * @param [in] uid - * UID of the peer who sends the message - * @param [in] streamId - * APP can create multiple streams for sending messages of different purposes - * @param [in] data - * the message data - * @param [in] length - * the message length, in bytes - * frame rate - */ - virtual void onStreamMessage(uid_t uid, int streamId, const char* data, size_t length) { + + virtual void onRefreshRecordingServiceStatus(int status) { (void)status; } + + // virtual void onStreamError(int streamId, int code, int parameter, const char* message, size_t length) {} + /** + * when stream message received, the function will be called + * @param [in] uid + * UID of the peer who sends the message + * @param [in] streamId + * APP can create multiple streams for sending messages of different purposes + * @param [in] data + * the message data + * @param [in] length + * the message length, in bytes + * frame rate + */ + virtual void onStreamMessage(uid_t uid, int streamId, const char *data, size_t length) { (void)uid; (void)streamId; (void)data; (void)length; } - /** - * - */ - virtual void onStreamMessageError(uid_t uid, int streamId, int code, int missed, int cached) { + /** + * + */ + virtual void onStreamMessageError(uid_t uid, int streamId, int code, int missed, int cached) { (void)uid; (void)streamId; (void)code; @@ -964,767 +871,742 @@ class IRtcEngineEventHandler (void)cached; } - virtual void onMediaEngineLoadSuccess() { - } - virtual void onMediaEngineStartCallSuccess() { - } + virtual void onMediaEngineLoadSuccess() {} + virtual void onMediaEngineStartCallSuccess() {} /** - * when channel key is enabled, and specified channel key is invalid or expired, this function will be called. - * APP should generate a new channel key and call renewChannelKey() to refresh the key. - * NOTE: to be compatible with previous version, ERR_CHANNEL_KEY_EXPIRED and ERR_INVALID_CHANNEL_KEY are also reported via onError() callback. - * You should move renew of channel key logic into this callback. - */ - virtual void onRequestChannelKey() { - } + * when channel key is enabled, and specified channel key is invalid or expired, this function will be called. + * APP should generate a new channel key and call renewChannelKey() to refresh the key. + * NOTE: to be compatible with previous version, ERR_CHANNEL_KEY_EXPIRED and ERR_INVALID_CHANNEL_KEY are also + * reported via onError() callback. You should move renew of channel key logic into this callback. + */ + virtual void onRequestChannelKey() {} /** - * when the first local audio frame generated, the function will be called - * @param [in] elapsed - * the time elapsed from remote user called joinChannel in ms - */ - virtual void onFirstLocalAudioFrame(int elapsed) { - (void)elapsed; - } + * when the first local audio frame generated, the function will be called + * @param [in] elapsed + * the time elapsed from remote user called joinChannel in ms + */ + virtual void onFirstLocalAudioFrame(int elapsed) { (void)elapsed; } /** - * when the first remote audio frame arrived, the function will be called - * @param [in] uid - * the UID of the remote user - * @param [in] elapsed - * the time elapsed from remote user called joinChannel in ms - */ + * when the first remote audio frame arrived, the function will be called + * @param [in] uid + * the UID of the remote user + * @param [in] elapsed + * the time elapsed from remote user called joinChannel in ms + */ virtual void onFirstRemoteAudioFrame(uid_t uid, int elapsed) { (void)uid; (void)elapsed; } /** @param [in] uid - * the speaker uid who is talking in the channel - */ - virtual void onActiveSpeaker(uid_t uid) { - (void)uid; - } + * the speaker uid who is talking in the channel + */ + virtual void onActiveSpeaker(uid_t uid) { (void)uid; } /** - * when client role is successfully changed, the function will be called - */ - virtual void onClientRoleChanged(CLIENT_ROLE_TYPE oldRole, CLIENT_ROLE_TYPE newRole) { - } + * when client role is successfully changed, the function will be called + */ + virtual void onClientRoleChanged(CLIENT_ROLE_TYPE oldRole, CLIENT_ROLE_TYPE newRole) {} }; /** -* the video device collection interface -*/ -class IVideoDeviceCollection -{ -public: - /** - * get the audio device count - * @return returns the audio device count - */ + * the video device collection interface + */ +class IVideoDeviceCollection { + public: + /** + * get the audio device count + * @return returns the audio device count + */ virtual int getCount() = 0; /** - * get audio device information - * @param [in] index - * the index of the device in the device list - * @param [in, out] deviceName - * the device name, UTF8 format - * @param [in, out] deviceId - * the device ID, UTF8 format - * @return return 0 if success or an error code - */ + * get audio device information + * @param [in] index + * the index of the device in the device list + * @param [in, out] deviceName + * the device name, UTF8 format + * @param [in, out] deviceId + * the device ID, UTF8 format + * @return return 0 if success or an error code + */ virtual int getDevice(int index, char deviceName[MAX_DEVICE_ID_LENGTH], char deviceId[MAX_DEVICE_ID_LENGTH]) = 0; /** - * set current active audio device - * @param [in] deviceId - * the deviceId of the device you want to active currently - * @return return 0 if success or an error code - */ + * set current active audio device + * @param [in] deviceId + * the deviceId of the device you want to active currently + * @return return 0 if success or an error code + */ virtual int setDevice(const char deviceId[MAX_DEVICE_ID_LENGTH]) = 0; /** - * release the resource - */ + * release the resource + */ virtual void release() = 0; }; -class IVideoDeviceManager -{ -public: - +class IVideoDeviceManager { + public: /** - * create the IVideoDeviceCollection interface pointer - * @return return the IVideoDeviceCollection interface or nullptr if failed - */ - virtual IVideoDeviceCollection* enumerateVideoDevices() = 0; + * create the IVideoDeviceCollection interface pointer + * @return return the IVideoDeviceCollection interface or nullptr if failed + */ + virtual IVideoDeviceCollection *enumerateVideoDevices() = 0; /** - * active the video device for current using - * @param [in] deviceId - * the deviceId of the device you want to active currently - * @return return 0 if success or the error code. - */ + * active the video device for current using + * @param [in] deviceId + * the deviceId of the device you want to active currently + * @return return 0 if success or the error code. + */ virtual int setDevice(const char deviceId[MAX_DEVICE_ID_LENGTH]) = 0; /** - * get the current active video device - * @param [in, out] deviceId - * the device id of the current active video device - * @return return 0 if success or an error code - */ + * get the current active video device + * @param [in, out] deviceId + * the device id of the current active video device + * @return return 0 if success or an error code + */ virtual int getDevice(char deviceId[MAX_DEVICE_ID_LENGTH]) = 0; /** - * test the video capture device to know whether it can worked well - * @param [in] hwnd - * the HWND of the video-display window - * @return return 0 if success or an error code - */ + * test the video capture device to know whether it can worked well + * @param [in] hwnd + * the HWND of the video-display window + * @return return 0 if success or an error code + */ virtual int startDeviceTest(view_t hwnd) = 0; /** - * stop the video device testing - * @return return 0 if success or an error code - */ + * stop the video device testing + * @return return 0 if success or an error code + */ virtual int stopDeviceTest() = 0; /** - * release the resource - */ + * release the resource + */ virtual void release() = 0; }; -class IAudioDeviceCollection -{ -public: +class IAudioDeviceCollection { + public: /** - * get the available devices count - * @return return the device count - */ + * get the available devices count + * @return return the device count + */ virtual int getCount() = 0; /** - * get video device information - * @param [in] index - * the index of the device in the device list - * @param [in, out] deviceName - * the device name, UTF8 format - * @param [in, out] deviceId - * the device ID, UTF8 format - * @return return 0 if success or an error code - */ + * get video device information + * @param [in] index + * the index of the device in the device list + * @param [in, out] deviceName + * the device name, UTF8 format + * @param [in, out] deviceId + * the device ID, UTF8 format + * @return return 0 if success or an error code + */ virtual int getDevice(int index, char deviceName[MAX_DEVICE_ID_LENGTH], char deviceId[MAX_DEVICE_ID_LENGTH]) = 0; /** - * active the device for current using - * @param [in] deviceId - * the deviceId of the device you want to active currently - * @return return 0 if success or the error code. - */ + * active the device for current using + * @param [in] deviceId + * the deviceId of the device you want to active currently + * @return return 0 if success or the error code. + */ virtual int setDevice(const char deviceId[MAX_DEVICE_ID_LENGTH]) = 0; /** - * release the resource - */ + * release the resource + */ virtual void release() = 0; }; -class IAudioDeviceManager -{ -public: +class IAudioDeviceManager { + public: /** - * create the IAudioDeviceCollection interface pointer of the playback devices - * @return return the IVideoDeviceCollection interface or nullptr if failed - */ - virtual IAudioDeviceCollection* enumeratePlaybackDevices() = 0; + * create the IAudioDeviceCollection interface pointer of the playback devices + * @return return the IVideoDeviceCollection interface or nullptr if failed + */ + virtual IAudioDeviceCollection *enumeratePlaybackDevices() = 0; /** - * create the IAudioDeviceCollection interface pointer of the Recording devices - * @return return the IVideoDeviceCollection interface or nullptr if failed - */ - virtual IAudioDeviceCollection* enumerateRecordingDevices() = 0; + * create the IAudioDeviceCollection interface pointer of the Recording devices + * @return return the IVideoDeviceCollection interface or nullptr if failed + */ + virtual IAudioDeviceCollection *enumerateRecordingDevices() = 0; /** - * active the playback device for current using - * @param [in] deviceId - * the deviceId of the playback device you want to active currently - * @return return 0 if success or the error code. - */ + * active the playback device for current using + * @param [in] deviceId + * the deviceId of the playback device you want to active currently + * @return return 0 if success or the error code. + */ virtual int setPlaybackDevice(const char deviceId[MAX_DEVICE_ID_LENGTH]) = 0; /** - * get the current active playback device - * @param [in, out] deviceId - * the device id of the current active video device - * @return return 0 if success or an error code - */ + * get the current active playback device + * @param [in, out] deviceId + * the device id of the current active video device + * @return return 0 if success or an error code + */ virtual int getPlaybackDevice(char deviceId[MAX_DEVICE_ID_LENGTH]) = 0; /** - * set current playback device volume - * @param [in] volume - * the volume you want to set 0-255 - * @return return 0 if success or an error code - */ + * set current playback device volume + * @param [in] volume + * the volume you want to set 0-255 + * @return return 0 if success or an error code + */ virtual int setPlaybackDeviceVolume(int volume) = 0; /** - * get current playback device volume - * @param [in, out] volume - * the current playback device volume 0-255 - * @return return 0 if success or an error code - */ + * get current playback device volume + * @param [in, out] volume + * the current playback device volume 0-255 + * @return return 0 if success or an error code + */ virtual int getPlaybackDeviceVolume(int *volume) = 0; /** - * active the recording audio device for current using - * @param [in] deviceId - * the deviceId of the recording audio device you want to active currently - * @return return 0 if success or the error code. - */ + * active the recording audio device for current using + * @param [in] deviceId + * the deviceId of the recording audio device you want to active currently + * @return return 0 if success or the error code. + */ virtual int setRecordingDevice(const char deviceId[MAX_DEVICE_ID_LENGTH]) = 0; /** - * get the current active recording device - * @param [in, out] deviceId - * the device id of the current active recording audio device - * @return return 0 if success or an error code - */ + * get the current active recording device + * @param [in, out] deviceId + * the device id of the current active recording audio device + * @return return 0 if success or an error code + */ virtual int getRecordingDevice(char deviceId[MAX_DEVICE_ID_LENGTH]) = 0; /** - * set current recording device volume - * @param [in] volume - * the volume you want to set 0-255 - * @return return 0 if success or an error code - */ + * set current recording device volume + * @param [in] volume + * the volume you want to set 0-255 + * @return return 0 if success or an error code + */ virtual int setRecordingDeviceVolume(int volume) = 0; /** - * get current recording device volume - * @param [in, out] volume - * the current recording device volume 0-255 - * @return return 0 if success or an error code - */ + * get current recording device volume + * @param [in, out] volume + * the current recording device volume 0-255 + * @return return 0 if success or an error code + */ virtual int getRecordingDeviceVolume(int *volume) = 0; /** - * test the playback audio device to know whether it can worked well - * @param [in] testAudioFilePath - * the path of the .wav file - * @return return 0 if success and you can hear the sound of the .wav file or an error code. - */ - virtual int startPlaybackDeviceTest(const char* testAudioFilePath) = 0; + * test the playback audio device to know whether it can worked well + * @param [in] testAudioFilePath + * the path of the .wav file + * @return return 0 if success and you can hear the sound of the .wav file or an error code. + */ + virtual int startPlaybackDeviceTest(const char *testAudioFilePath) = 0; /** - * stop the playback audio device testing - * @return return 0 if success or an error code - */ + * stop the playback audio device testing + * @return return 0 if success or an error code + */ virtual int stopPlaybackDeviceTest() = 0; /** - * test the recording audio device to know whether it can worked well - * @param [in] indicationInterval - * the period in ms of the call back cycle - * @return return 0 if success or an error code - */ + * test the recording audio device to know whether it can worked well + * @param [in] indicationInterval + * the period in ms of the call back cycle + * @return return 0 if success or an error code + */ virtual int startRecordingDeviceTest(int indicationInterval) = 0; /** - * stop the recording audio device testing - * @return return 0 if success or an error code - */ + * stop the recording audio device testing + * @return return 0 if success or an error code + */ virtual int stopRecordingDeviceTest() = 0; /** - * release the resource - */ + * release the resource + */ virtual void release() = 0; }; -struct RtcEngineContext -{ - IRtcEngineEventHandler* eventHandler; - const char* appId; - RtcEngineContext() - :eventHandler(NULL) - ,appId(NULL) - {} +struct RtcEngineContext { + IRtcEngineEventHandler *eventHandler; + const char *appId; + RtcEngineContext() : eventHandler(NULL), appId(NULL) {} }; +class IRtcEngine { + public: + /** + * release the engine resource + * @param [in] sync + * true: release the engine resources and return after all resources have been destroyed. + * APP should try not to call release(true) in the engine's callbacks, call it this way in a separate + * thread instead. false: notify engine to release its resources and returns without waiting for resources are + * really destroyed + */ + virtual void release(bool sync = false) = 0; + + /** + * initialize the engine + * @param [in] context + * the RTC engine context + * @return return 0 if success or an error code + */ + virtual int initialize(const RtcEngineContext &context) = 0; + + /** + * get the pointer of the device manager object. + * @param [in] iid + * the iid of the interface you want to get + * @param [in, out] inter + * the pointer of the pointer you want to point to DeviceManager object + * @return return 0 if success or an error code + */ + virtual int queryInterface(INTERFACE_ID_TYPE iid, void **inter) = 0; + + /** + * get the version information of the SDK + * @param [in, out] build + * the build number + * @return return the version number string in char format + */ + virtual const char *getVersion(int *build) = 0; + + /** + * get the version information of the SDK + * @param [in, out] code + * the build number + * @return return the version number string in char format + */ + virtual const char *getErrorDescription(int code) = 0; + + /** + * join the channel, if the channel have not been created, it will been created automatically + * @param [in] channelKey + * the channel key, if you have initialized the engine with an available APP ID, it can be null here. If you + * enable channel key on the dashboard, specify channel key here + * @param [in] channelName + * the channel name + * @param [in] info + * the additional information, it can be null here + * @param [in] uid + * the uid of you, if 0 the system will automatically allocate one for you + * @return return 0 if success or an error code + */ + virtual int joinChannel(const char *channelKey, const char *channelName, const char *info, uid_t uid) = 0; -class IRtcEngine -{ -public: - /** - * release the engine resource - * @param [in] sync - * true: release the engine resources and return after all resources have been destroyed. - * APP should try not to call release(true) in the engine's callbacks, call it this way in a separate thread instead. - * false: notify engine to release its resources and returns without waiting for resources are really destroyed - */ - virtual void release(bool sync=false) = 0; - - /** - * initialize the engine - * @param [in] context - * the RTC engine context - * @return return 0 if success or an error code - */ - virtual int initialize(const RtcEngineContext& context) = 0; - - /** - * get the pointer of the device manager object. - * @param [in] iid - * the iid of the interface you want to get - * @param [in, out] inter - * the pointer of the pointer you want to point to DeviceManager object - * @return return 0 if success or an error code - */ - virtual int queryInterface(INTERFACE_ID_TYPE iid, void** inter) = 0; - - /** - * get the version information of the SDK - * @param [in, out] build - * the build number - * @return return the version number string in char format - */ - virtual const char* getVersion(int* build) = 0; - - /** - * get the version information of the SDK - * @param [in, out] code - * the build number - * @return return the version number string in char format - */ - virtual const char* getErrorDescription(int code) = 0; - - /** - * join the channel, if the channel have not been created, it will been created automatically - * @param [in] channelKey - * the channel key, if you have initialized the engine with an available APP ID, it can be null here. If you enable channel key on the dashboard, specify channel key here - * @param [in] channelName - * the channel name - * @param [in] info - * the additional information, it can be null here - * @param [in] uid - * the uid of you, if 0 the system will automatically allocate one for you - * @return return 0 if success or an error code - */ - virtual int joinChannel(const char* channelKey, const char* channelName, const char* info, uid_t uid) = 0; - - /** - * leave the current channel - * @return return 0 if success or an error code - */ + /** + * leave the current channel + * @return return 0 if success or an error code + */ virtual int leaveChannel() = 0; /** - * renew the channel key for the current channel - * @param [in] channelKey the renewed channel key, if old channel key expired. - * @return return 0 if success or an error code - */ - virtual int renewChannelKey(const char* channelKey) = 0; + * renew the channel key for the current channel + * @param [in] channelKey the renewed channel key, if old channel key expired. + * @return return 0 if success or an error code + */ + virtual int renewChannelKey(const char *channelKey) = 0; virtual int setChannelProfile(CHANNEL_PROFILE_TYPE profile) = 0; - virtual int setClientRole(CLIENT_ROLE_TYPE role, const char* permissionKey) = 0; + virtual int setClientRole(CLIENT_ROLE_TYPE role, const char *permissionKey) = 0; /** - * start the echo testing, if every thing goes well you can hear your echo from the server - * @return return 0 if success or an error code - */ + * start the echo testing, if every thing goes well you can hear your echo from the server + * @return return 0 if success or an error code + */ virtual int startEchoTest() = 0; /** - * stop the echo testing - * @return return 0 if success or an error code - */ + * stop the echo testing + * @return return 0 if success or an error code + */ virtual int stopEchoTest() = 0; /** - * start the network testing - * @return return 0 if success or an error code - */ + * start the network testing + * @return return 0 if success or an error code + */ virtual int enableLastmileTest() = 0; /** - * stop the network testing - * @return return 0 if success or an error code - */ + * stop the network testing + * @return return 0 if success or an error code + */ virtual int disableLastmileTest() = 0; /** - * enable video function - * @return return 0 if success or an error code - */ + * enable video function + * @return return 0 if success or an error code + */ virtual int enableVideo() = 0; /** - * disable video function - * @return return 0 if success or an error code - */ + * disable video function + * @return return 0 if success or an error code + */ virtual int disableVideo() = 0; /** - * start the local video previewing - * @return return 0 if success or an error code - */ + * start the local video previewing + * @return return 0 if success or an error code + */ virtual int startPreview() = 0; /** - * stop the local video previewing - * @return return 0 if success or an error code - */ + * stop the local video previewing + * @return return 0 if success or an error code + */ virtual int stopPreview() = 0; virtual int setVideoProfile(VIDEO_PROFILE_TYPE profile, bool swapWidthAndHeight) = 0; /** - * set the remote video canvas - * @param [in] canvas - * the canvas information - * @return return 0 if success or an error code - */ - virtual int setupRemoteVideo(const VideoCanvas& canvas) = 0; + * set the remote video canvas + * @param [in] canvas + * the canvas information + * @return return 0 if success or an error code + */ + virtual int setupRemoteVideo(const VideoCanvas &canvas) = 0; /** - * set the local video canvas - * @param [in] canvas - * the canvas information - * @return return 0 if success or an error code - */ - virtual int setupLocalVideo(const VideoCanvas& canvas) = 0; + * set the local video canvas + * @param [in] canvas + * the canvas information + * @return return 0 if success or an error code + */ + virtual int setupLocalVideo(const VideoCanvas &canvas) = 0; /** - * enable audio function, which is enabled by deault. - * @return return 0 if success or an error code - */ + * enable audio function, which is enabled by deault. + * @return return 0 if success or an error code + */ virtual int enableAudio() = 0; /** - * disable audio function - * @return return 0 if success or an error code - */ + * disable audio function + * @return return 0 if success or an error code + */ virtual int disableAudio() = 0; /** - * get self call id in the current channel - * @param [in, out] callId - * the self call Id - * @return return 0 if success or an error code - */ - virtual int getCallId(agora::util::AString& callId) = 0; - - virtual int rate(const char* callId, int rating, const char* description) = 0; // 0~10 - virtual int complain(const char* callId, const char* description) = 0; - - /** - * register a packet observer while the packet arrived or ready to be sent, the observer can touch the packet data - * @param [in] observer - * the pointer of the observer object - * @return return 0 if success or an error code - */ - virtual int registerPacketObserver(IPacketObserver* observer) = 0; - - /** - * Specify encryption mode of AES encryption algorithm. - * @param [in] encryptionMode - * encryption mode of AES algorithm, could be one of the following: - * "aes-128-xts", "aes-256-xts". - * The default value is "aes-128-xts". specify NULL value will use default encryption mode. - * @return return 0 if success or an error code - */ - virtual int setEncryptionMode(const char* encryptionMode) = 0; - /** - * Specify encryption secret enables built-in encryption function. Leaving channel will clear the secret specified in last channel - * @param [in] secret - * secret to enable encryption - * @return return 0 if success or an error code - */ - virtual int setEncryptionSecret(const char* secret) = 0; - - virtual int createDataStream(int* streamId, bool reliable, bool ordered) = 0; - virtual int sendStreamMessage(int streamId, const char* data, size_t length) = 0; - - virtual int setVideoCompositingLayout(const VideoCompositingLayout& sei) = 0; + * get self call id in the current channel + * @param [in, out] callId + * the self call Id + * @return return 0 if success or an error code + */ + virtual int getCallId(agora::util::AString &callId) = 0; + + virtual int rate(const char *callId, int rating, const char *description) = 0; // 0~10 + virtual int complain(const char *callId, const char *description) = 0; + + /** + * register a packet observer while the packet arrived or ready to be sent, the observer can touch the packet data + * @param [in] observer + * the pointer of the observer object + * @return return 0 if success or an error code + */ + virtual int registerPacketObserver(IPacketObserver *observer) = 0; + + /** + * Specify encryption mode of AES encryption algorithm. + * @param [in] encryptionMode + * encryption mode of AES algorithm, could be one of the following: + * "aes-128-xts", "aes-256-xts". + * The default value is "aes-128-xts". specify NULL value will use default encryption mode. + * @return return 0 if success or an error code + */ + virtual int setEncryptionMode(const char *encryptionMode) = 0; + /** + * Specify encryption secret enables built-in encryption function. Leaving channel will clear the secret specified + * in last channel + * @param [in] secret + * secret to enable encryption + * @return return 0 if success or an error code + */ + virtual int setEncryptionSecret(const char *secret) = 0; + + virtual int createDataStream(int *streamId, bool reliable, bool ordered) = 0; + virtual int sendStreamMessage(int streamId, const char *data, size_t length) = 0; + + virtual int setVideoCompositingLayout(const VideoCompositingLayout &sei) = 0; virtual int clearVideoCompositingLayout() = 0; #if defined(_WIN32) - virtual int configPublisher(const PublisherConfiguration& config) = 0; + virtual int configPublisher(const PublisherConfiguration &config) = 0; #endif }; - -class IRtcEngineParameter -{ -public: +class IRtcEngineParameter { + public: /** - * release the resource - */ + * release the resource + */ virtual void release() = 0; /** - * set bool value of the json - * @param [in] key - * the key name - * @param [in] value - * the value - * @return return 0 if success or an error code - */ - virtual int setBool(const char* key, bool value) = 0; - - /** - * set int value of the json - * @param [in] key - * the key name - * @param [in] value - * the value - * @return return 0 if success or an error code - */ - virtual int setInt(const char* key, int value) = 0; - - /** - * set unsigned int value of the json - * @param [in] key - * the key name - * @param [in] value - * the value - * @return return 0 if success or an error code - */ - virtual int setUInt(const char* key, unsigned int value) = 0; - - /** - * set double value of the json - * @param [in] key - * the key name - * @param [in] value - * the value - * @return return 0 if success or an error code - */ - virtual int setNumber(const char* key, double value) = 0; - - /** - * set string value of the json - * @param [in] key - * the key name - * @param [in] value - * the value - * @return return 0 if success or an error code - */ - virtual int setString(const char* key, const char* value) = 0; - - /** - * set object value of the json - * @param [in] key - * the key name - * @param [in] value - * the value - * @return return 0 if success or an error code - */ - virtual int setObject(const char* key, const char* value) = 0; - - /** - * get bool value of the json - * @param [in] key - * the key name - * @param [in, out] value - * the value - * @return return 0 if success or an error code - */ - virtual int getBool(const char* key, bool& value) = 0; - - /** - * get int value of the json - * @param [in] key - * the key name - * @param [in, out] value - * the value - * @return return 0 if success or an error code - */ - virtual int getInt(const char* key, int& value) = 0; - - /** - * get unsigned int value of the json - * @param [in] key - * the key name - * @param [in, out] value - * the value - * @return return 0 if success or an error code - */ - virtual int getUInt(const char* key, unsigned int& value) = 0; - - /** - * get double value of the json - * @param [in] key - * the key name - * @param [in, out] value - * the value - * @return return 0 if success or an error code - */ - virtual int getNumber(const char* key, double& value) = 0; - - /** - * get string value of the json - * @param [in] key - * the key name - * @param [in, out] value - * the value - * @return return 0 if success or an error code - */ - virtual int getString(const char* key, agora::util::AString& value) = 0; - - /** - * get a child object value of the json - * @param [in] key - * the key name - * @param [in, out] value - * the value - * @return return 0 if success or an error code - */ - virtual int getObject(const char* key, agora::util::AString& value) = 0; - - /** - * get array value of the json - * @param [in] key - * the key name - * @param [in, out] value - * the value - * @return return 0 if success or an error code - */ - virtual int getArray(const char* key, agora::util::AString& value) = 0; - - /** - * set parameters of the sdk or engine - * @param [in] parameters - * the parameters - * @return return 0 if success or an error code - */ - virtual int setParameters(const char* parameters) = 0; - - /** - * set profile to control the RTC engine - * @param [in] profile - * the profile - * @param [in] merge - * if merge with the original value - * @return return 0 if success or an error code - */ - virtual int setProfile(const char* profile, bool merge) = 0; - - virtual int convertPath(const char* filePath, agora::util::AString& value) = 0; + * set bool value of the json + * @param [in] key + * the key name + * @param [in] value + * the value + * @return return 0 if success or an error code + */ + virtual int setBool(const char *key, bool value) = 0; + + /** + * set int value of the json + * @param [in] key + * the key name + * @param [in] value + * the value + * @return return 0 if success or an error code + */ + virtual int setInt(const char *key, int value) = 0; + + /** + * set unsigned int value of the json + * @param [in] key + * the key name + * @param [in] value + * the value + * @return return 0 if success or an error code + */ + virtual int setUInt(const char *key, unsigned int value) = 0; + + /** + * set double value of the json + * @param [in] key + * the key name + * @param [in] value + * the value + * @return return 0 if success or an error code + */ + virtual int setNumber(const char *key, double value) = 0; + + /** + * set string value of the json + * @param [in] key + * the key name + * @param [in] value + * the value + * @return return 0 if success or an error code + */ + virtual int setString(const char *key, const char *value) = 0; + + /** + * set object value of the json + * @param [in] key + * the key name + * @param [in] value + * the value + * @return return 0 if success or an error code + */ + virtual int setObject(const char *key, const char *value) = 0; + + /** + * get bool value of the json + * @param [in] key + * the key name + * @param [in, out] value + * the value + * @return return 0 if success or an error code + */ + virtual int getBool(const char *key, bool &value) = 0; + + /** + * get int value of the json + * @param [in] key + * the key name + * @param [in, out] value + * the value + * @return return 0 if success or an error code + */ + virtual int getInt(const char *key, int &value) = 0; + + /** + * get unsigned int value of the json + * @param [in] key + * the key name + * @param [in, out] value + * the value + * @return return 0 if success or an error code + */ + virtual int getUInt(const char *key, unsigned int &value) = 0; + + /** + * get double value of the json + * @param [in] key + * the key name + * @param [in, out] value + * the value + * @return return 0 if success or an error code + */ + virtual int getNumber(const char *key, double &value) = 0; + + /** + * get string value of the json + * @param [in] key + * the key name + * @param [in, out] value + * the value + * @return return 0 if success or an error code + */ + virtual int getString(const char *key, agora::util::AString &value) = 0; + + /** + * get a child object value of the json + * @param [in] key + * the key name + * @param [in, out] value + * the value + * @return return 0 if success or an error code + */ + virtual int getObject(const char *key, agora::util::AString &value) = 0; + + /** + * get array value of the json + * @param [in] key + * the key name + * @param [in, out] value + * the value + * @return return 0 if success or an error code + */ + virtual int getArray(const char *key, agora::util::AString &value) = 0; + + /** + * set parameters of the sdk or engine + * @param [in] parameters + * the parameters + * @return return 0 if success or an error code + */ + virtual int setParameters(const char *parameters) = 0; + + /** + * set profile to control the RTC engine + * @param [in] profile + * the profile + * @param [in] merge + * if merge with the original value + * @return return 0 if success or an error code + */ + virtual int setProfile(const char *profile, bool merge) = 0; + + virtual int convertPath(const char *filePath, agora::util::AString &value) = 0; }; -class AAudioDeviceManager : public agora::util::AutoPtr -{ -public: - AAudioDeviceManager(IRtcEngine* engine) - { - queryInterface(engine, AGORA_IID_AUDIO_DEVICE_MANAGER); - } +class AAudioDeviceManager : public agora::util::AutoPtr { + public: + AAudioDeviceManager(IRtcEngine *engine) { queryInterface(engine, AGORA_IID_AUDIO_DEVICE_MANAGER); } }; -class AVideoDeviceManager : public agora::util::AutoPtr -{ -public: - AVideoDeviceManager(IRtcEngine* engine) - { - queryInterface(engine, AGORA_IID_VIDEO_DEVICE_MANAGER); - } +class AVideoDeviceManager : public agora::util::AutoPtr { + public: + AVideoDeviceManager(IRtcEngine *engine) { queryInterface(engine, AGORA_IID_VIDEO_DEVICE_MANAGER); } }; -class AParameter : public agora::util::AutoPtr -{ -public: - AParameter(IRtcEngine& engine) { initialize(&engine); } - AParameter(IRtcEngine* engine) { initialize(engine); } - AParameter(IRtcEngineParameter* p) :agora::util::AutoPtr(p) {} -private: - bool initialize(IRtcEngine* engine) - { - IRtcEngineParameter* p = NULL; - if (engine && !engine->queryInterface(AGORA_IID_RTC_ENGINE_PARAMETER, (void**)&p)) +class AParameter : public agora::util::AutoPtr { + public: + AParameter(IRtcEngine &engine) { initialize(&engine); } + AParameter(IRtcEngine *engine) { initialize(engine); } + AParameter(IRtcEngineParameter *p) : agora::util::AutoPtr(p) {} + + private: + bool initialize(IRtcEngine *engine) { + IRtcEngineParameter *p = NULL; + if (engine && !engine->queryInterface(AGORA_IID_RTC_ENGINE_PARAMETER, (void **)&p)) reset(p); return p != NULL; } }; -class RtcEngineParameters -{ -public: - RtcEngineParameters(IRtcEngine& engine) - :m_parameter(&engine){} - RtcEngineParameters(IRtcEngine* engine) - :m_parameter(engine){} - - /** - * mute/unmute the local stream capturing - * @param [in] mute - * true: mute - * false: unmute - * @return return 0 if success or an error code - */ +class RtcEngineParameters { + public: + RtcEngineParameters(IRtcEngine &engine) : m_parameter(&engine) {} + RtcEngineParameters(IRtcEngine *engine) : m_parameter(engine) {} + + /** + * mute/unmute the local stream capturing + * @param [in] mute + * true: mute + * false: unmute + * @return return 0 if success or an error code + */ int muteLocalAudioStream(bool mute) { - return setParameters("{\"rtc.audio.mute_me\":%s,\"che.audio.mute_me\":%s}", mute ? "true" : "false", mute ? "true" : "false"); + return setParameters("{\"rtc.audio.mute_me\":%s,\"che.audio.mute_me\":%s}", mute ? "true" : "false", + mute ? "true" : "false"); } // mute/unmute all peers. unmute will clear all muted peers specified mutePeer() interface - /** - * mute/unmute all the remote audio stream receiving - * @param [in] mute - * true: mute - * false: unmute - * @return return 0 if success or an error code - */ + /** + * mute/unmute all the remote audio stream receiving + * @param [in] mute + * true: mute + * false: unmute + * @return return 0 if success or an error code + */ int muteAllRemoteAudioStreams(bool mute) { return m_parameter ? m_parameter->setBool("rtc.audio.mute_peers", mute) : -ERR_NOT_INITIALIZED; } /** - * mute/unmute one remote audio stream receiving - * @param [in] uid - * the uid of the remote user you want to mute/unmute - * @param [in] mute - * true: mute - * false: unmute - * @return return 0 if success or an error code - */ + * mute/unmute one remote audio stream receiving + * @param [in] uid + * the uid of the remote user you want to mute/unmute + * @param [in] mute + * true: mute + * false: unmute + * @return return 0 if success or an error code + */ int muteRemoteAudioStream(uid_t uid, bool mute) { - return setObject("rtc.audio.mute_peer", "{\"uid\":%u,\"mute\":%s}", uid, mute?"true":"false"); + return setObject("rtc.audio.mute_peer", "{\"uid\":%u,\"mute\":%s}", uid, mute ? "true" : "false"); } /** - * mute/unmute local video stream sending - * @param [in] mute - * true: mute - * false: unmute - * @return return 0 if success or an error code - */ + * mute/unmute local video stream sending + * @param [in] mute + * true: mute + * false: unmute + * @return return 0 if success or an error code + */ int muteLocalVideoStream(bool mute) { - return setParameters("{\"rtc.video.mute_me\":%s,\"che.video.local.send\":%s}", mute ? "true" : "false", mute ? "false" : "true"); - } - - int enableLocalVideo(bool enabled) { - return setParameters("{\"rtc.video.capture\":%s,\"che.video.local.capture\":%s,\"che.video.local.render\":%s,\"che.video.local.send\":%s}", enabled ? "true" : "false", enabled ? "true" : "false", enabled ? "true" : "false", enabled ? "true" : "false"); - } - /** - * mute/unmute all the remote video stream receiving - * @param [in] mute - * true: mute - * false: unmute - * @return return 0 if success or an error code - */ + return setParameters("{\"rtc.video.mute_me\":%s,\"che.video.local.send\":%s}", mute ? "true" : "false", + mute ? "false" : "true"); + } + + int enableLocalVideo(bool enabled) { + return setParameters("{\"rtc.video.capture\":%s,\"che.video.local.capture\":%s,\"che.video.local.render\":%s," + "\"che.video.local.send\":%s}", + enabled ? "true" : "false", enabled ? "true" : "false", enabled ? "true" : "false", + enabled ? "true" : "false"); + } + /** + * mute/unmute all the remote video stream receiving + * @param [in] mute + * true: mute + * false: unmute + * @return return 0 if success or an error code + */ int muteAllRemoteVideoStreams(bool mute) { return m_parameter ? m_parameter->setBool("rtc.video.mute_peers", mute) : -ERR_NOT_INITIALIZED; } /** - * mute/unmute one remote video stream receiving - * @param [in] uid - * the uid of the remote user you want to mute/unmute - * @param [in] mute - * true: mute - * false: unmute - * @return return 0 if success or an error code - */ + * mute/unmute one remote video stream receiving + * @param [in] uid + * the uid of the remote user you want to mute/unmute + * @param [in] mute + * true: mute + * false: unmute + * @return return 0 if success or an error code + */ int muteRemoteVideoStream(uid_t uid, bool mute) { return setObject("rtc.video.mute_peer", "{\"uid\":%u,\"mute\":%s}", uid, mute ? "true" : "false"); } @@ -1734,25 +1616,25 @@ class RtcEngineParameters } /** - * set play sound volume - * @param [in] volume - * the volume 0~255 - * @return return 0 if success or an error code - */ - int setPlaybackDeviceVolume(int volume) {// [0,255] + * set play sound volume + * @param [in] volume + * the volume 0~255 + * @return return 0 if success or an error code + */ + int setPlaybackDeviceVolume(int volume) { // [0,255] return m_parameter ? m_parameter->setInt("che.audio.output.volume", volume) : -ERR_NOT_INITIALIZED; } /** - * enable or disable the audio volume indication - * @param [in] interval - * the period of the call back cycle, in ms - * interval <= 0: disable - * interval > 0: enable - * @param [in] smooth - * the smooth parameter - * @return return 0 if success or an error code - */ + * enable or disable the audio volume indication + * @param [in] interval + * the period of the call back cycle, in ms + * interval <= 0: disable + * interval > 0: enable + * @param [in] smooth + * the smooth parameter + * @return return 0 if success or an error code + */ int enableAudioVolumeIndication(int interval, int smooth) { // in ms: <= 0: disable, > 0: enable, interval in ms if (interval < 0) interval = 0; @@ -1760,13 +1642,14 @@ class RtcEngineParameters } /** - * start recording the audio stream - * @param [in] filePath - * the .wav file path you want to saved - * @return return 0 if success or an error code - */ - int startAudioRecording(const char* filePath, AUDIO_RECORDING_QUALITY_TYPE quality) { - if (!m_parameter) return -ERR_NOT_INITIALIZED; + * start recording the audio stream + * @param [in] filePath + * the .wav file path you want to saved + * @return return 0 if success or an error code + */ + int startAudioRecording(const char *filePath, AUDIO_RECORDING_QUALITY_TYPE quality) { + if (!m_parameter) + return -ERR_NOT_INITIALIZED; #if defined(_WIN32) util::AString path; if (!m_parameter->convertPath(filePath, path)) @@ -1778,51 +1661,50 @@ class RtcEngineParameters } /** - * stop recording the audio stream - * @return return 0 if success or an error code - */ + * stop recording the audio stream + * @return return 0 if success or an error code + */ int stopAudioRecording() { return m_parameter ? m_parameter->setBool("che.audio.stop_recording", true) : -ERR_NOT_INITIALIZED; } - /** - * mix microphone and local audio file into the audio stream - * @param [in] filePath - * specify the path and file name of the audio file to be played - * @param [in] loopback - * specify if local and remote participant can hear the audio file. - * false (default): both local and remote party can hear the the audio file - * true: only the local party can hear the audio file - * @param [in] replace - * false (default): mix the local microphone captured voice with the audio file - * true: replace the microphone captured voice with the audio file - * @param [in] cycle - * specify the number of cycles to play - * -1, infinite loop playback - * @return return 0 if success or an error code - */ - int startAudioMixing(const char* filePath, bool loopback, bool replace, int cycle) { - if (!m_parameter) return -ERR_NOT_INITIALIZED; + /** + * mix microphone and local audio file into the audio stream + * @param [in] filePath + * specify the path and file name of the audio file to be played + * @param [in] loopback + * specify if local and remote participant can hear the audio file. + * false (default): both local and remote party can hear the the audio file + * true: only the local party can hear the audio file + * @param [in] replace + * false (default): mix the local microphone captured voice with the audio file + * true: replace the microphone captured voice with the audio file + * @param [in] cycle + * specify the number of cycles to play + * -1, infinite loop playback + * @return return 0 if success or an error code + */ + int startAudioMixing(const char *filePath, bool loopback, bool replace, int cycle) { + if (!m_parameter) + return -ERR_NOT_INITIALIZED; #if defined(_WIN32) - util::AString path; - if (!m_parameter->convertPath(filePath, path)) - filePath = path->c_str(); - else - return -ERR_INVALID_ARGUMENT; + util::AString path; + if (!m_parameter->convertPath(filePath, path)) + filePath = path->c_str(); + else + return -ERR_INVALID_ARGUMENT; #endif - return setObject("che.audio.start_file_as_playout", "{\"filePath\":\"%s\",\"loopback\":%s,\"replace\":%s,\"cycle\":%d}", - filePath, - loopback?"true":"false", - replace?"true":"false", - cycle); - } - /** - * stop mixing the local audio stream - * @return return 0 if success or an error code - */ - int stopAudioMixing() { + return setObject("che.audio.start_file_as_playout", + "{\"filePath\":\"%s\",\"loopback\":%s,\"replace\":%s,\"cycle\":%d}", filePath, + loopback ? "true" : "false", replace ? "true" : "false", cycle); + } + /** + * stop mixing the local audio stream + * @return return 0 if success or an error code + */ + int stopAudioMixing() { return m_parameter ? m_parameter->setBool("che.audio.stop_file_as_playout", true) : -ERR_NOT_INITIALIZED; - } + } int pauseAudioMixing() { return m_parameter ? m_parameter->setBool("che.audio.pause_file_as_playout", true) : -ERR_NOT_INITIALIZED; @@ -1837,13 +1719,15 @@ class RtcEngineParameters } int getAudioMixingDuration() { int duration = 0; - int r = m_parameter ? m_parameter->getInt("che.audio.get_mixing_file_length_ms", duration) : -ERR_NOT_INITIALIZED; + int r = + m_parameter ? m_parameter->getInt("che.audio.get_mixing_file_length_ms", duration) : -ERR_NOT_INITIALIZED; if (r == 0) r = duration; return r; } int getAudioMixingCurrentPosition() { - if (!m_parameter) return -ERR_NOT_INITIALIZED; + if (!m_parameter) + return -ERR_NOT_INITIALIZED; int pos = 0; int r = m_parameter->getInt("che.audio.get_mixing_file_played_ms", pos); if (r == 0) @@ -1866,7 +1750,9 @@ class RtcEngineParameters if (!rect) return setObject("che.video.start_screen_capture", "{\"id\":%u,\"captureFreq\":%d}", windowId, captureFreq); else - return setObject("che.video.start_screen_capture", "{\"id\":%u,\"captureFreq\":%d,\"top\":%d,\"left\":%d,\"bottom\":%d,\"right\":%d}", windowId, captureFreq, rect->top, rect->left, rect->bottom, rect->right); + return setObject("che.video.start_screen_capture", + "{\"id\":%u,\"captureFreq\":%d,\"top\":%d,\"left\":%d,\"bottom\":%d,\"right\":%d}", + windowId, captureFreq, rect->top, rect->left, rect->bottom, rect->right); } /** @@ -1878,17 +1764,19 @@ class RtcEngineParameters } /** - * update screen capture region - * - * @param rect valid when windowId is 0; whole screen if rect is NULL. - * - * @return return 0 if success or an error code - */ + * update screen capture region + * + * @param rect valid when windowId is 0; whole screen if rect is NULL. + * + * @return return 0 if success or an error code + */ int updateScreenCaptureRegion(const Rect *rect) { - if (!rect) - return setObject("che.video.update_screen_capture_region", "{}"); - else - return setObject("che.video.update_screen_capture_region", "{\"top\":%d,\"left\":%d,\"bottom\":%d,\"right\":%d}", rect->top, rect->left, rect->bottom, rect->right); + if (!rect) + return setObject("che.video.update_screen_capture_region", "{}"); + else + return setObject("che.video.update_screen_capture_region", + "{\"top\":%d,\"left\":%d,\"bottom\":%d,\"right\":%d}", rect->top, rect->left, rect->bottom, + rect->right); } #elif defined(_WIN32) /** @@ -1901,9 +1789,12 @@ class RtcEngineParameters */ int startScreenCapture(HWND windowId, int captureFreq, const Rect *rect) { if (!rect) - return setObject("che.video.start_screen_capture", "{\"id\":%u,\"captureFreq\":%d}", (unsigned int)windowId, captureFreq); + return setObject("che.video.start_screen_capture", "{\"id\":%u,\"captureFreq\":%d}", (unsigned int)windowId, + captureFreq); else - return setObject("che.video.start_screen_capture", "{\"id\":%u,\"captureFreq\":%d,\"top\":%d,\"left\":%d,\"bottom\":%d,\"right\":%d}", (unsigned int)windowId, captureFreq, rect->top, rect->left, rect->bottom, rect->right); + return setObject("che.video.start_screen_capture", + "{\"id\":%u,\"captureFreq\":%d,\"top\":%d,\"left\":%d,\"bottom\":%d,\"right\":%d}", + (unsigned int)windowId, captureFreq, rect->top, rect->left, rect->bottom, rect->right); } /** @@ -1915,70 +1806,72 @@ class RtcEngineParameters } /** - * update screen capture region - * - * @param rect valid when windowId is 0; whole screen if rect is NULL. - * - * @return return 0 if success or an error code - */ + * update screen capture region + * + * @param rect valid when windowId is 0; whole screen if rect is NULL. + * + * @return return 0 if success or an error code + */ int updateScreenCaptureRegion(const Rect *rect) { - if (!rect) - return setObject("che.video.update_screen_capture_region", "{}"); - else - return setObject("che.video.update_screen_capture_region", "{\"top\":%d,\"left\":%d,\"bottom\":%d,\"right\":%d}", rect->top, rect->left, rect->bottom, rect->right); + if (!rect) + return setObject("che.video.update_screen_capture_region", "{}"); + else + return setObject("che.video.update_screen_capture_region", + "{\"top\":%d,\"left\":%d,\"bottom\":%d,\"right\":%d}", rect->top, rect->left, rect->bottom, + rect->right); } #endif /** - * set path to save the log file - * @param [in] filePath - * the .log file path you want to saved - * @return return 0 if success or an error code - */ - int setLogFile(const char* filePath) { - if (!m_parameter) return -ERR_NOT_INITIALIZED; + * set path to save the log file + * @param [in] filePath + * the .log file path you want to saved + * @return return 0 if success or an error code + */ + int setLogFile(const char *filePath) { + if (!m_parameter) + return -ERR_NOT_INITIALIZED; #if defined(_WIN32) - util::AString path; - if (!m_parameter->convertPath(filePath, path)) - filePath = path->c_str(); - else if (!filePath) - filePath = ""; + util::AString path; + if (!m_parameter->convertPath(filePath, path)) + filePath = path->c_str(); + else if (!filePath) + filePath = ""; #endif - return m_parameter->setString("rtc.log_file", filePath); + return m_parameter->setString("rtc.log_file", filePath); } /** - * set the log information filter level - * @param [in] filter - * the filter level - * @return return 0 if success or an error code - */ + * set the log information filter level + * @param [in] filter + * the filter level + * @return return 0 if success or an error code + */ int setLogFilter(unsigned int filter) { - return m_parameter ? m_parameter->setUInt("rtc.log_filter", filter&LOG_FILTER_MASK) : -ERR_NOT_INITIALIZED; + return m_parameter ? m_parameter->setUInt("rtc.log_filter", filter & LOG_FILTER_MASK) : -ERR_NOT_INITIALIZED; } /** - * set local video render mode - * @param [in] renderMode - * the render mode - * @return return 0 if success or an error code - */ - int setLocalRenderMode(RENDER_MODE_TYPE renderMode) { - return setRemoteRenderMode(0, renderMode); - } + * set local video render mode + * @param [in] renderMode + * the render mode + * @return return 0 if success or an error code + */ + int setLocalRenderMode(RENDER_MODE_TYPE renderMode) { return setRemoteRenderMode(0, renderMode); } /** - * set remote video render mode - * @param [in] renderMode - * the render mode - * @return return 0 if success or an error code - */ + * set remote video render mode + * @param [in] renderMode + * the render mode + * @return return 0 if success or an error code + */ int setRemoteRenderMode(uid_t uid, RENDER_MODE_TYPE renderMode) { return setObject("che.video.render_mode", "{\"uid\":%u,\"mode\":%d}", uid, renderMode); } - + int setLocalVideoMirrorMode(VIDEO_MIRROR_MODE_TYPE mirrorMode) { - if (!m_parameter) return -ERR_NOT_INITIALIZED; + if (!m_parameter) + return -ERR_NOT_INITIALIZED; const char *value; switch (mirrorMode) { case VIDEO_MIRROR_MODE_AUTO: @@ -1995,40 +1888,51 @@ class RtcEngineParameters } return m_parameter->setString("che.video.localViewMirrorSetting", value); } - int startRecordingService(const char* recordingKey) { - return m_parameter ? m_parameter->setString("rtc.api.start_recording_service", recordingKey) : -ERR_NOT_INITIALIZED; + int startRecordingService(const char *recordingKey) { + return m_parameter ? m_parameter->setString("rtc.api.start_recording_service", recordingKey) + : -ERR_NOT_INITIALIZED; } - - int stopRecordingService(const char* recordingKey) { - return m_parameter ? m_parameter->setString("rtc.api.stop_recording_service", recordingKey) : -ERR_NOT_INITIALIZED; + + int stopRecordingService(const char *recordingKey) { + return m_parameter ? m_parameter->setString("rtc.api.stop_recording_service", recordingKey) + : -ERR_NOT_INITIALIZED; } - + int refreshRecordingServiceStatus() { - return m_parameter ? m_parameter->setBool("rtc.api.query_recording_service_status", true) : -ERR_NOT_INITIALIZED; + return m_parameter ? m_parameter->setBool("rtc.api.query_recording_service_status", true) + : -ERR_NOT_INITIALIZED; } int enableDualStreamMode(bool enabled) { - return setParameters("{\"rtc.dual_stream_mode\":%s,\"che.video.enableLowBitRateStream\":%s}", enabled ? "true" : "false", enabled ? "true" : "false"); + return setParameters("{\"rtc.dual_stream_mode\":%s,\"che.video.enableLowBitRateStream\":%s}", + enabled ? "true" : "false", enabled ? "true" : "false"); } - int setRecordingAudioFrameParameters(int sampleRate, int channel, RAW_AUDIO_FRAME_OP_MODE_TYPE mode, int samplesPerCall) { - return setObject("che.audio.set_capture_raw_audio_format", "{\"sampleRate\":%d,\"channelCnt\":%d,\"mode\":%d,\"samplesPerCall\":%d}", sampleRate, channel, mode, samplesPerCall); + int setRecordingAudioFrameParameters(int sampleRate, int channel, RAW_AUDIO_FRAME_OP_MODE_TYPE mode, + int samplesPerCall) { + return setObject("che.audio.set_capture_raw_audio_format", + "{\"sampleRate\":%d,\"channelCnt\":%d,\"mode\":%d,\"samplesPerCall\":%d}", sampleRate, channel, + mode, samplesPerCall); } - int setPlaybackAudioFrameParameters(int sampleRate, int channel, RAW_AUDIO_FRAME_OP_MODE_TYPE mode, int samplesPerCall) { - return setObject("che.audio.set_render_raw_audio_format", "{\"sampleRate\":%d,\"channelCnt\":%d,\"mode\":%d,\"samplesPerCall\":%d}", sampleRate, channel, mode, samplesPerCall); + int setPlaybackAudioFrameParameters(int sampleRate, int channel, RAW_AUDIO_FRAME_OP_MODE_TYPE mode, + int samplesPerCall) { + return setObject("che.audio.set_render_raw_audio_format", + "{\"sampleRate\":%d,\"channelCnt\":%d,\"mode\":%d,\"samplesPerCall\":%d}", sampleRate, channel, + mode, samplesPerCall); } int setMixedAudioFrameParameters(int sampleRate, int samplesPerCall) { - return setObject("che.audio.set_mixed_raw_audio_format", "{\"sampleRate\":%d,\"samplesPerCall\":%d}", sampleRate, samplesPerCall); + return setObject("che.audio.set_mixed_raw_audio_format", "{\"sampleRate\":%d,\"samplesPerCall\":%d}", + sampleRate, samplesPerCall); } - - int adjustRecordingSignalVolume(int volume) {//[0, 400]: e.g. 50~0.5x 100~1x 400~4x + + int adjustRecordingSignalVolume(int volume) { //[0, 400]: e.g. 50~0.5x 100~1x 400~4x if (volume < 0) volume = 0; else if (volume > 400) volume = 400; return m_parameter ? m_parameter->setInt("che.audio.record.signal.volume", volume) : -ERR_NOT_INITIALIZED; } - int adjustPlaybackSignalVolume(int volume) {//[0, 400] + int adjustPlaybackSignalVolume(int volume) { //[0, 400] if (volume < 0) volume = 0; else if (volume > 400) @@ -2036,32 +1940,35 @@ class RtcEngineParameters return m_parameter ? m_parameter->setInt("che.audio.playout.signal.volume", volume) : -ERR_NOT_INITIALIZED; } int setHighQualityAudioParameters(bool fullband, bool stereo, bool fullBitrate) { - return setObject("che.audio.codec.hq", "{\"fullband\":%s,\"stereo\":%s,\"fullBitrate\":%s}", fullband ? "true" : "false", stereo ? "true" : "false", fullBitrate ? "true" : "false"); + return setObject("che.audio.codec.hq", "{\"fullband\":%s,\"stereo\":%s,\"fullBitrate\":%s}", + fullband ? "true" : "false", stereo ? "true" : "false", fullBitrate ? "true" : "false"); } - int enableWebSdkInteroperability(bool enabled) {//enable interoperability with zero-plugin web sdk - return setParameters("{\"rtc.video.web_h264_interop_enable\":%s,\"che.video.web_h264_interop_enable\":%s}", enabled ? "true" : "false", enabled ? "true" : "false"); + int enableWebSdkInteroperability(bool enabled) { // enable interoperability with zero-plugin web sdk + return setParameters("{\"rtc.video.web_h264_interop_enable\":%s,\"che.video.web_h264_interop_enable\":%s}", + enabled ? "true" : "false", enabled ? "true" : "false"); } - //only for live broadcasting + // only for live broadcasting int setVideoQualityParameters(bool preferFrameRateOverImageQuality) { - return setParameters("{\"rtc.video.prefer_frame_rate\":%s,\"che.video.prefer_frame_rate\":%s}", preferFrameRateOverImageQuality ? "true" : "false", preferFrameRateOverImageQuality ? "true" : "false"); - } -protected: - AParameter& parameter() { - return m_parameter; + return setParameters("{\"rtc.video.prefer_frame_rate\":%s,\"che.video.prefer_frame_rate\":%s}", + preferFrameRateOverImageQuality ? "true" : "false", + preferFrameRateOverImageQuality ? "true" : "false"); } - int setParameters(const char* format, ...) { + + protected: + AParameter ¶meter() { return m_parameter; } + int setParameters(const char *format, ...) { char buf[512]; va_list args; va_start(args, format); - vsnprintf(buf, sizeof(buf)-1, format, args); + vsnprintf(buf, sizeof(buf) - 1, format, args); va_end(args); return m_parameter ? m_parameter->setParameters(buf) : -ERR_NOT_INITIALIZED; } - int setObject(const char* key, const char* format, ...) { + int setObject(const char *key, const char *format, ...) { char buf[512]; va_list args; va_start(args, format); - vsnprintf(buf, sizeof(buf)-1, format, args); + vsnprintf(buf, sizeof(buf) - 1, format, args); va_end(args); return m_parameter ? m_parameter->setObject(key, buf) : -ERR_NOT_INITIALIZED; } @@ -2071,41 +1978,40 @@ class RtcEngineParameters int enableLocalVideoRender(bool enabled) { return m_parameter ? m_parameter->setBool("che.video.local.render", enabled) : -ERR_NOT_INITIALIZED; } - int enableLocalVideoSend(bool enabled) { - return muteLocalVideoStream(!enabled); - } + int enableLocalVideoSend(bool enabled) { return muteLocalVideoStream(!enabled); } int stopAllRemoteVideo() { return m_parameter ? m_parameter->setBool("che.video.peer.stop_render", true) : -ERR_NOT_INITIALIZED; } -private: + + private: AParameter m_parameter; }; -} //namespace rtc +} // namespace rtc } // namespace agora /** -* to get the version number of the SDK -* @param [in, out] build -* the build number of Agora SDK -* @return returns the string of the version of the SDK -*/ -AGORA_API const char* AGORA_CALL getAgoraRtcEngineVersion(int* build); + * to get the version number of the SDK + * @param [in, out] build + * the build number of Agora SDK + * @return returns the string of the version of the SDK + */ +AGORA_API const char *AGORA_CALL getAgoraRtcEngineVersion(int *build); /** -* create the RTC engine object and return the pointer -* @return returns the pointer of the RTC engine object -*/ -AGORA_API agora::rtc::IRtcEngine* AGORA_CALL createAgoraRtcEngine(); + * create the RTC engine object and return the pointer + * @return returns the pointer of the RTC engine object + */ +AGORA_API agora::rtc::IRtcEngine *AGORA_CALL createAgoraRtcEngine(); /** -* create the RTC engine object and return the pointer -* @param [in] err -* the error code -* @return returns the description of the error code -*/ -AGORA_API const char* AGORA_CALL getAgoraRtcEngineErrorDescription(int err); - -AGORA_API int AGORA_CALL setAgoraRtcEngineExternalSymbolLoader(void* (*func)(const char* symname)); + * create the RTC engine object and return the pointer + * @param [in] err + * the error code + * @return returns the description of the error code + */ +AGORA_API const char *AGORA_CALL getAgoraRtcEngineErrorDescription(int err); + +AGORA_API int AGORA_CALL setAgoraRtcEngineExternalSymbolLoader(void *(*func)(const char *symname)); #endif diff --git a/ios-rongcallkit/framework/RongCallLib.framework/Headers/IVideoFrameObserver.h b/ios-rongcallkit/framework/RongCallLib.framework/Headers/IVideoFrameObserver.h index 917c856..4f7b865 100644 --- a/ios-rongcallkit/framework/RongCallLib.framework/Headers/IVideoFrameObserver.h +++ b/ios-rongcallkit/framework/RongCallLib.framework/Headers/IVideoFrameObserver.h @@ -1,9 +1,8 @@ #ifndef _ivideoframeobserve_h #define _ivideoframeobserve_h -#import #import - +#import /* 视频前后处理用这个头文件 @@ -18,11 +17,11 @@ #ifdef __cplusplus extern "C" { #endif -int agoraRegisterVideoFrameObserver(agora::media::IVideoFrameObserver *observer, - bool useExternalResource = false, bool localPreview = true); - -int agoraRegisterAudioFrameObserver(agora::media::IAudioFrameObserver* observer); - +int agoraRegisterVideoFrameObserver(agora::media::IVideoFrameObserver *observer, bool useExternalResource = false, + bool localPreview = true); + +int agoraRegisterAudioFrameObserver(agora::media::IAudioFrameObserver *observer); + NSString *rcGetUserIdFromAgoraUID(int uid); #ifdef __cplusplus } diff --git a/ios-rongcallkit/framework/RongCallLib.framework/Headers/RCCallClient.h b/ios-rongcallkit/framework/RongCallLib.framework/Headers/RCCallClient.h index 1f86095..04e4739 100644 --- a/ios-rongcallkit/framework/RongCallLib.framework/Headers/RCCallClient.h +++ b/ios-rongcallkit/framework/RongCallLib.framework/Headers/RCCallClient.h @@ -119,7 +119,7 @@ /** 设置本地视频属性,可用此接口设置本地视频分辨率,设置宽和高替换 - + @param profile profile @param swapWidthAndHeight 是否交换宽和高 (默认不交换) */ @@ -133,5 +133,5 @@ /*! 是否生成通话记录消息,默认为YES */ -@property(nonatomic, assign)BOOL enableCallSummary; +@property(nonatomic, assign) BOOL enableCallSummary; @end diff --git a/ios-rongcallkit/framework/RongCallLib.framework/Headers/RCCallCommonDefine.h b/ios-rongcallkit/framework/RongCallLib.framework/Headers/RCCallCommonDefine.h index 559393b..26b58f3 100644 --- a/ios-rongcallkit/framework/RongCallLib.framework/Headers/RCCallCommonDefine.h +++ b/ios-rongcallkit/framework/RongCallLib.framework/Headers/RCCallCommonDefine.h @@ -13,60 +13,61 @@ 引擎类型 */ typedef NS_ENUM(NSInteger, RCCallEngineType) { - RCCallEngineNone = 0, - /*! - 声网 - */ - RCCallEngineAgora = 1, - /*! - 融云 - */ - RCCallEngineRong = 2, + RCCallEngineNone = 0, + /*! + 声网 + */ + RCCallEngineAgora = 1, + /*! + 融云 + */ + RCCallEngineRong = 2, }; /*! 媒体类型 */ typedef NS_ENUM(NSInteger, RCCallMediaType) { - /*! - 音频 - */ - RCCallMediaAudio = 1, - /*! - 视频 - */ - RCCallMediaVideo = 2, + /*! + 音频 + */ + RCCallMediaAudio = 1, + /*! + 视频 + */ + RCCallMediaVideo = 2, }; /*! 通话质量 */ typedef NS_ENUM(NSUInteger, RCCallQuality) { - RCCall_Quality_Unknown = 0, - RCCall_Quality_Excellent = 1, - RCCall_Quality_Good = 2, - RCCall_Quality_Poor = 3, - RCCall_Quality_Bad = 4, - RCCall_Quality_VBad = 5, - RCCall_Quality_Down = 6, + RCCall_Quality_Unknown = 0, + RCCall_Quality_Excellent = 1, + RCCall_Quality_Good = 2, + RCCall_Quality_Poor = 3, + RCCall_Quality_Bad = 4, + RCCall_Quality_VBad = 5, + RCCall_Quality_Down = 6, }; /** 视频显示模式 */ typedef NS_ENUM(NSInteger, RCCallRenderModel) { - + /*! 默认: 如果视频尺寸与显示视窗尺寸不一致,则视频流会按照显示视窗的比例进行周边裁剪或图像拉伸后填满视窗。 */ RCCallRenderModelHidden = 1, - + /*! RenderFit: 如果视频尺寸与显示视窗尺寸不一致,在保持长宽比的前提下,将视频进行缩放后填满视窗。 */ RCCallRenderModelFit = 2, - + /*! - RenderAdaptive: 如果自己和对方都是竖屏,或者如果自己和对方都是横屏,使用 RCCallRenderModelHidden;如果对方和自己一个竖屏一个横屏,则使用RCCallRenderModelFit。 + RenderAdaptive: 如果自己和对方都是竖屏,或者如果自己和对方都是横屏,使用 + RCCallRenderModelHidden;如果对方和自己一个竖屏一个横屏,则使用RCCallRenderModelFit。 */ RCCallRenderModelAdaptive = 3, }; @@ -77,177 +78,177 @@ typedef NS_ENUM(NSInteger, RCCallRenderModel) { 错误码 */ typedef NS_ENUM(NSInteger, RCCallErrorCode) { - /*! - 成功 - */ - RCCallSuccess = 0, - /*! - 网络不可用 - */ - RCCallNetworkUnavailable = 1, - /*! - 已经处于通话中了 - */ - RCCallOneCallExisted = 2, - /*! - 无效操作 - */ - RCCallOperationUnavailable = 3, - /*! - 参数错误 - */ - RCCallInvalidParam = 4, - /*! - 网络不稳定 - */ - RCCallNetworkUnstable = 5, - /*! - 媒体服务请求失败 - */ - RCCallMediaRequestFailed = 6, - /*! - 媒体服务初始化失败 - */ - RCCallMediaServerNotReady = 7, - /*! - 媒体服务未初始化 - */ - RCCallMediaServerNotInitialized = 8, - /*! - 媒体服务请求超时 - */ - RCCallMediaRequestTimeout = 9, - /*! - 未知的媒体服务错误 - */ - RCCallMediaUnkownError = 10, + /*! + 成功 + */ + RCCallSuccess = 0, + /*! + 网络不可用 + */ + RCCallNetworkUnavailable = 1, + /*! + 已经处于通话中了 + */ + RCCallOneCallExisted = 2, + /*! + 无效操作 + */ + RCCallOperationUnavailable = 3, + /*! + 参数错误 + */ + RCCallInvalidParam = 4, + /*! + 网络不稳定 + */ + RCCallNetworkUnstable = 5, + /*! + 媒体服务请求失败 + */ + RCCallMediaRequestFailed = 6, + /*! + 媒体服务初始化失败 + */ + RCCallMediaServerNotReady = 7, + /*! + 媒体服务未初始化 + */ + RCCallMediaServerNotInitialized = 8, + /*! + 媒体服务请求超时 + */ + RCCallMediaRequestTimeout = 9, + /*! + 未知的媒体服务错误 + */ + RCCallMediaUnkownError = 10, }; /*! 通话结束原因 */ typedef NS_ENUM(NSInteger, RCCallDisconnectReason) { - /*! - 己方取消已发出的通话请求 - */ - RCCallDisconnectReasonCancel = 1, - /*! - 己方拒绝收到的通话请求 - */ - RCCallDisconnectReasonReject = 2, - /*! - 己方挂断 - */ - RCCallDisconnectReasonHangup = 3, - /*! - 己方忙碌 - */ - RCCallDisconnectReasonBusyLine = 4, - /*! - 己方未接听 - */ - RCCallDisconnectReasonNoResponse = 5, - /*! - 己方不支持当前引擎 - */ - RCCallDisconnectReasonEngineUnsupported = 6, - /*! - 己方网络出错 - */ - RCCallDisconnectReasonNetworkError = 7, + /*! + 己方取消已发出的通话请求 + */ + RCCallDisconnectReasonCancel = 1, + /*! + 己方拒绝收到的通话请求 + */ + RCCallDisconnectReasonReject = 2, + /*! + 己方挂断 + */ + RCCallDisconnectReasonHangup = 3, + /*! + 己方忙碌 + */ + RCCallDisconnectReasonBusyLine = 4, + /*! + 己方未接听 + */ + RCCallDisconnectReasonNoResponse = 5, + /*! + 己方不支持当前引擎 + */ + RCCallDisconnectReasonEngineUnsupported = 6, + /*! + 己方网络出错 + */ + RCCallDisconnectReasonNetworkError = 7, - /*! - 对方取消已发出的通话请求 - */ - RCCallDisconnectReasonRemoteCancel = 11, - /*! - 对方拒绝收到的通话请求 - */ - RCCallDisconnectReasonRemoteReject = 12, - /*! - 通话过程对方挂断 - */ - RCCallDisconnectReasonRemoteHangup = 13, - /*! - 对方忙碌 - */ - RCCallDisconnectReasonRemoteBusyLine = 14, - /*! - 对方未接听 - */ - RCCallDisconnectReasonRemoteNoResponse = 15, - /*! - 对方网络错误 - */ - RCCallDisconnectReasonRemoteEngineUnsupported = 16, - /*! - 对方网络错误 - */ - RCCallDisconnectReasonRemoteNetworkError = 17, - /*! - 己方其他端已接听 - */ - RCCallDisconnectReasonAcceptByOtherClient = 18, - /*! - 己方被加入黑名单 - */ - RCCallDisconnectReasonAddToBlackList = 19, + /*! + 对方取消已发出的通话请求 + */ + RCCallDisconnectReasonRemoteCancel = 11, + /*! + 对方拒绝收到的通话请求 + */ + RCCallDisconnectReasonRemoteReject = 12, + /*! + 通话过程对方挂断 + */ + RCCallDisconnectReasonRemoteHangup = 13, + /*! + 对方忙碌 + */ + RCCallDisconnectReasonRemoteBusyLine = 14, + /*! + 对方未接听 + */ + RCCallDisconnectReasonRemoteNoResponse = 15, + /*! + 对方网络错误 + */ + RCCallDisconnectReasonRemoteEngineUnsupported = 16, + /*! + 对方网络错误 + */ + RCCallDisconnectReasonRemoteNetworkError = 17, + /*! + 己方其他端已接听 + */ + RCCallDisconnectReasonAcceptByOtherClient = 18, + /*! + 己方被加入黑名单 + */ + RCCallDisconnectReasonAddToBlackList = 19, }; /*! 通话视频参数 */ typedef NS_ENUM(NSInteger, RCVideoProfile) { - /*! - 320x240, 15fps, 200kbps - */ - RC_VIDEO_PROFILE_240P = 20, - /*! - 640x360, 15fps, 400kbps - */ - RC_VIDEO_PROFILE_360P = 30, - /*! - 640x480, 15fps, 500kbps - */ - RC_VIDEO_PROFILE_480P = 40, - /*! - 1280x720, 15fps, 1000kbps - */ - RC_VIDEO_PROFILE_720P = 50, - /*! - 默认的视频参数 - */ - RC_VIDEO_PROFILE_DEFAULT = RC_VIDEO_PROFILE_360P, + /*! + 320x240, 15fps, 200kbps + */ + RC_VIDEO_PROFILE_240P = 20, + /*! + 640x360, 15fps, 400kbps + */ + RC_VIDEO_PROFILE_360P = 30, + /*! + 640x480, 15fps, 500kbps + */ + RC_VIDEO_PROFILE_480P = 40, + /*! + 1280x720, 15fps, 1000kbps + */ + RC_VIDEO_PROFILE_720P = 50, + /*! + 默认的视频参数 + */ + RC_VIDEO_PROFILE_DEFAULT = RC_VIDEO_PROFILE_360P, }; /*! 通话状态 */ typedef NS_ENUM(NSInteger, RCCallStatus) { - /*! - 初始状态 - */ -// RCCallIdle = 0, - /*! - 正在呼出 - */ - RCCallDialing = 1, - /*! - 正在呼入 - */ - RCCallIncoming = 2, - /*! - 收到一个通话呼入后,正在振铃 - */ - RCCallRinging = 3, - /*! - 正在通话 - */ - RCCallActive = 4, - /*! - 已经挂断 - */ - RCCallHangup = 5, + /*! + 初始状态 + */ + // RCCallIdle = 0, + /*! + 正在呼出 + */ + RCCallDialing = 1, + /*! + 正在呼入 + */ + RCCallIncoming = 2, + /*! + 收到一个通话呼入后,正在振铃 + */ + RCCallRinging = 3, + /*! + 正在通话 + */ + RCCallActive = 4, + /*! + 已经挂断 + */ + RCCallHangup = 5, }; #endif /* RCCallCommonDefine_h */ diff --git a/ios-rongcallkit/framework/RongCallLib.framework/Headers/RCCallSession.h b/ios-rongcallkit/framework/RongCallLib.framework/Headers/RCCallSession.h index 3ab85e7..8b8fe10 100644 --- a/ios-rongcallkit/framework/RongCallLib.framework/Headers/RCCallSession.h +++ b/ios-rongcallkit/framework/RongCallLib.framework/Headers/RCCallSession.h @@ -41,8 +41,7 @@ @param userId 被邀请的用户ID @param mediaType 希望被邀请者使用的媒体类型 */ -- (void)remoteUserDidInvite:(NSString *)userId - mediaType:(RCCallMediaType)mediaType; +- (void)remoteUserDidInvite:(NSString *)userId mediaType:(RCCallMediaType)mediaType; /*! 对端用户加入了通话 @@ -50,8 +49,7 @@ @param userId 用户ID @param mediaType 用户的媒体类型 */ -- (void)remoteUserDidJoin:(NSString *)userId - mediaType:(RCCallMediaType)mediaType; +- (void)remoteUserDidJoin:(NSString *)userId mediaType:(RCCallMediaType)mediaType; /*! 对端用户切换了媒体类型 @@ -59,8 +57,7 @@ @param userId 用户ID @param mediaType 切换至的媒体类型 */ -- (void)remoteUserDidChangeMediaType:(NSString *)userId - mediaType:(RCCallMediaType)mediaType; +- (void)remoteUserDidChangeMediaType:(NSString *)userId mediaType:(RCCallMediaType)mediaType; /*! 对端用户开启或关闭了摄像头的状态 @@ -76,8 +73,7 @@ @param userId 用户ID @param reason 挂断的原因 */ -- (void)remoteUserDidLeft:(NSString *)userId - reason:(RCCallDisconnectReason)reason; +- (void)remoteUserDidLeft:(NSString *)userId reason:(RCCallDisconnectReason)reason; /*! 彩铃 @@ -106,12 +102,11 @@ /*! 当前通话网络状态的回调,该回调方法每两秒触发一次 - + @param txQuality 上行网络质量 @param rxQuality 下行网络质量 */ -- (void)networkTxQuality:(RCCallQuality)txQuality - rxQuality:(RCCallQuality)rxQuality; +- (void)networkTxQuality:(RCCallQuality)txQuality rxQuality:(RCCallQuality)rxQuality; @end @@ -229,7 +224,7 @@ - (void)setVideoView:(UIView *)view userId:(NSString *)userId; /** - 设置用户所在的视频View + 设置用户所在的视频View @param view userId 用户ID(自己或他人) @param userId 视频的View diff --git a/ios-rongcallkit/framework/RongCallLib.framework/Info.plist b/ios-rongcallkit/framework/RongCallLib.framework/Info.plist index 77dc416..b620f4a 100644 Binary files a/ios-rongcallkit/framework/RongCallLib.framework/Info.plist and b/ios-rongcallkit/framework/RongCallLib.framework/Info.plist differ diff --git a/ios-rongcallkit/framework/RongCallLib.framework/RongCallLib b/ios-rongcallkit/framework/RongCallLib.framework/RongCallLib index 2b87da5..3c29b9f 100644 Binary files a/ios-rongcallkit/framework/RongCallLib.framework/RongCallLib and b/ios-rongcallkit/framework/RongCallLib.framework/RongCallLib differ diff --git a/ios-rongcallkit/framework/RongCloud.bundle/forwardIcon.png b/ios-rongcallkit/framework/RongCloud.bundle/forwardIcon@2x.png similarity index 100% rename from ios-rongcallkit/framework/RongCloud.bundle/forwardIcon.png rename to ios-rongcallkit/framework/RongCloud.bundle/forwardIcon@2x.png diff --git a/ios-rongcallkit/framework/RongIMKit.framework/Headers/RCAttributedLabel.h b/ios-rongcallkit/framework/RongIMKit.framework/Headers/RCAttributedLabel.h index f826c03..7c8b2c1 100644 --- a/ios-rongcallkit/framework/RongIMKit.framework/Headers/RCAttributedLabel.h +++ b/ios-rongcallkit/framework/RongIMKit.framework/Headers/RCAttributedLabel.h @@ -56,14 +56,14 @@ /** * text */ -@property (nonatomic, copy) id text; +@property(nonatomic, copy) id text; @end /** * RCAttributedLabel */ -@interface RCAttributedLabel : UILabel +@interface RCAttributedLabel : UILabel /** * 可以通过设置attributeDataSource或者attributeDictionary、highlightedAttributeDictionary来自定义不同文本的字体颜色 */ @@ -75,9 +75,9 @@ * if ([cell isKindOfClass:[RCTextMessageCell class]]) { * RCTextMessageCell *newCell = (RCTextMessageCell *)cell; * if (newCell.textLabel.text.length>3) { - * NSTextCheckingResult *textCheckingResult = [NSTextCheckingResult linkCheckingResultWithRange:(NSMakeRange(0, 3)) URL:[NSURL URLWithString:@"http://www.baidu.com"]]; - * [newCell.textLabel.attributedStrings addObject:textCheckingResult]; - * [newCell.textLabel setTextHighlighted:YES atPoint:CGPointMake(0, 3)]; + * NSTextCheckingResult *textCheckingResult = [NSTextCheckingResult linkCheckingResultWithRange:(NSMakeRange(0, + *3)) URL:[NSURL URLWithString:@"http://www.baidu.com"]]; [newCell.textLabel.attributedStrings + *addObject:textCheckingResult]; [newCell.textLabel setTextHighlighted:YES atPoint:CGPointMake(0, 3)]; * } * } *} @@ -87,7 +87,7 @@ /*! 点击回调 */ -@property (nonatomic, weak) id delegate; +@property(nonatomic, weak) id delegate; /** * attributeDictionary */ @@ -137,7 +137,7 @@ /*! 点击URL的回调 - + @param label 当前Label @param url 点击的URL */ @@ -145,7 +145,7 @@ /*! 点击电话号码的回调 - + @param label 当前Label @param phoneNumber 点击的URL */ @@ -153,11 +153,10 @@ /*! 点击Label的回调 - + @param label 当前Label @param content 点击的内容 */ - (void)attributedLabel:(RCAttributedLabel *)label didTapLabel:(NSString *)content; @end - diff --git a/ios-rongcallkit/framework/RongIMKit.framework/Headers/RCBaseViewController.h b/ios-rongcallkit/framework/RongIMKit.framework/Headers/RCBaseViewController.h index f750ece..ce1a7b9 100644 --- a/ios-rongcallkit/framework/RongIMKit.framework/Headers/RCBaseViewController.h +++ b/ios-rongcallkit/framework/RongIMKit.framework/Headers/RCBaseViewController.h @@ -6,12 +6,12 @@ // Copyright (c) 2015年 RongCloud. All rights reserved. // -#import #import +#import /*! IMKit ViewController基类 - + @discussion 主要定义了View的默认大小。 */ @interface RCBaseViewController : UIViewController @@ -19,6 +19,6 @@ ///*! // 是否开启左滑返回手势,默认是 NO ,关闭状态,可以在页面 viewDidLoad 里开启 // */ -//如果需要实现滑动返回,请参考知识库http://support.rongcloud.cn/kb/NTEx +//如果需要实现滑动返回,请参考知识库http://support.rongcloud.cn/kb/NTEx //@property(nonatomic, assign) BOOL enableInteractivePopGestureRecognizer; @end diff --git a/ios-rongcallkit/framework/RongIMKit.framework/Headers/RCChatSessionInputBarControl.h b/ios-rongcallkit/framework/RongIMKit.framework/Headers/RCChatSessionInputBarControl.h index 35ce80a..0a3cd00 100644 --- a/ios-rongcallkit/framework/RongIMKit.framework/Headers/RCChatSessionInputBarControl.h +++ b/ios-rongcallkit/framework/RongIMKit.framework/Headers/RCChatSessionInputBarControl.h @@ -6,26 +6,26 @@ // Copyright (c) 2015年 RongCloud. All rights reserved. // -#import -#import -#import "RCTextView.h" #import "RCEmojiBoardView.h" #import "RCPluginBoardView.h" +#import "RCTextView.h" +#import +#import #define RC_ChatSessionInputBar_Height 50.f ///输入栏扩展输入的唯一标示 -#define INPUT_MENTIONED_SELECT_TAG 1000 -#define PLUGIN_BOARD_ITEM_ALBUM_TAG 1001 -#define PLUGIN_BOARD_ITEM_CAMERA_TAG 1002 -#define PLUGIN_BOARD_ITEM_LOCATION_TAG 1003 -#define PLUGIN_BOARD_ITEM_FILE_TAG 1006 -#define PLUGIN_BOARD_ITEM_VOIP_TAG 1101 -#define PLUGIN_BOARD_ITEM_VIDEO_VOIP_TAG 1102 -#define PLUGIN_BOARD_ITEM_EVA_TAG 1103 -#define PLUGIN_BOARD_ITEM_RED_PACKET_TAG 1104 +#define INPUT_MENTIONED_SELECT_TAG 1000 +#define PLUGIN_BOARD_ITEM_ALBUM_TAG 1001 +#define PLUGIN_BOARD_ITEM_CAMERA_TAG 1002 +#define PLUGIN_BOARD_ITEM_LOCATION_TAG 1003 +#define PLUGIN_BOARD_ITEM_FILE_TAG 1006 +#define PLUGIN_BOARD_ITEM_VOIP_TAG 1101 +#define PLUGIN_BOARD_ITEM_VIDEO_VOIP_TAG 1102 +#define PLUGIN_BOARD_ITEM_EVA_TAG 1103 +#define PLUGIN_BOARD_ITEM_RED_PACKET_TAG 1104 #define PLUGIN_BOARD_ITEM_VOICE_INPUT_TAG 1105 -#define PLUGIN_BOARD_ITEM_PTT_TAG 1106 -#define PLUGIN_BOARD_ITEM_CARD_TAG 1107 +#define PLUGIN_BOARD_ITEM_PTT_TAG 1106 +#define PLUGIN_BOARD_ITEM_CARD_TAG 1107 /*! 输入工具栏的显示布局 @@ -81,12 +81,12 @@ typedef NS_ENUM(NSInteger, RCChatSessionInputBarControlType) { 公众服务 */ RCChatSessionInputBarControlPubType = 1, - + /*! 客服机器人 */ RCChatSessionInputBarControlCSRobotType = 2, - + /*! 客服机器人 */ @@ -174,7 +174,7 @@ typedef NS_ENUM(NSInteger, KBottomBarStatus) { /*! 公众服务菜单的容器View - + @warning **已废弃,请勿使用。** 升级说明:如果您之前使用了此属性,可以直接替换为containerView属性,行为和实现完全一致。 */ @@ -236,30 +236,26 @@ typedef NS_ENUM(NSInteger, KBottomBarStatus) { @property(nonatomic) KBottomBarStatus currentBottomBarStatus; /*! 所处的会话页面View - + @warning **已废弃,请勿使用。** 升级说明:如果您之前使用了此属性,可以直接替换为contextView属性,行为和实现完全一致。 */ -@property(assign, nonatomic, readonly) UIView *contextView -__deprecated_msg("已废弃,请勿使用。"); +@property(assign, nonatomic, readonly) UIView *contextView __deprecated_msg("已废弃,请勿使用。"); /*! Frame现在的Y坐标 */ -@property(assign, nonatomic) float currentPositionY -__deprecated_msg("已废弃,请勿使用。"); +@property(assign, nonatomic) float currentPositionY __deprecated_msg("已废弃,请勿使用。"); /*! Frame之前的Y坐标 */ -@property(assign, nonatomic) float originalPositionY -__deprecated_msg("已废弃,请勿使用。"); +@property(assign, nonatomic) float originalPositionY __deprecated_msg("已废弃,请勿使用。"); /*! 文本输入框的高度 */ -@property(assign, nonatomic) float inputTextview_height -__deprecated_msg("已废弃,请勿使用。"); +@property(assign, nonatomic) float inputTextview_height __deprecated_msg("已废弃,请勿使用。"); /*! 公众服务账号菜单 @@ -293,13 +289,13 @@ __deprecated_msg("已废弃,请勿使用。"); /*! 初始化输入工具栏 - + @param frame 显示的Frame @param containerView 所处的会话页面View @param controlType 菜单类型 @param controlStyle 显示布局 @param defaultInputType 默认的输入模式 - + @return 输入工具栏对象 */ - (instancetype)initWithFrame:(CGRect)frame @@ -310,14 +306,13 @@ __deprecated_msg("已废弃,请勿使用。"); /*! 设置输入工具栏的样式 - + @param type 菜单类型 @param style 显示布局 - + @discussion 您可以在会话页面RCConversationViewController的viewDidLoad之后设置,改变输入工具栏的样式。 */ -- (void)setInputBarType:(RCChatSessionInputBarControlType)type - style:(RCChatSessionInputBarControlStyle)style; +- (void)setInputBarType:(RCChatSessionInputBarControlType)type style:(RCChatSessionInputBarControlStyle)style; /*! 销毁公众账号弹出的菜单 @@ -350,13 +345,13 @@ __deprecated_msg("已废弃,请勿使用。"); - (void)containerViewWillDisappear; /*! 设置输入框的输入状态 - + @param status 输入框状态 @param animated 是否使用动画效果 - + @discussion 如果需要设置,请在输入框执行containerViewWillAppear之后(即会话页面viewWillAppear之后)。 */ --(void)updateStatus:(KBottomBarStatus)status animated:(BOOL)animated; +- (void)updateStatus:(KBottomBarStatus)status animated:(BOOL)animated; /*! 重置到默认状态 @@ -365,49 +360,49 @@ __deprecated_msg("已废弃,请勿使用。"); /*! 内容区域大小发生变化。 - + @discussion 当本view所在的view frame发生变化,需要重新计算本view的frame时,调用此方法 */ - (void)containerViewSizeChanged; /*! 设置默认的输入框类型 - + @param defaultInputType 默认输入框类型 */ - (void)setDefaultInputType:(RCChatSessionInputBarInputType)defaultInputType; /*! 添加被@的用户 - + @param userInfo 被@的用户信息 */ - (void)addMentionedUser:(RCUserInfo *)userInfo; /*! 打开系统相册,选择图片 - + @discussion 选择结果通过delegate返回 */ - (void)openSystemAlbum; /*! 打开系统相机,拍摄图片 - + @discussion 拍摄结果通过delegate返回 */ - (void)openSystemCamera; /*! 打开地图picker,选择位置 - + @discussion 选择结果通过delegate返回 */ - (void)openLocationPicker; /*! 打开文件选择器,选择文件 - + @discussion 选择结果通过delegate返回 */ - (void)openFileSelector; @@ -416,11 +411,10 @@ __deprecated_msg("已废弃,请勿使用。"); /*! 更新输入框的Frame - + @warning **已废弃,请勿使用。** */ -- (void)refreshInputViewFrame -__deprecated_msg("已废弃,请勿使用。"); +- (void)refreshInputViewFrame __deprecated_msg("已废弃,请勿使用。"); @end @@ -431,18 +425,17 @@ __deprecated_msg("已废弃,请勿使用。"); /*! 显示ViewController - + @param viewController 需要显示的ViewController @param functionTag 功能标识 */ -- (void)presentViewController:(UIViewController *)viewController - functionTag:(NSInteger)functionTag; +- (void)presentViewController:(UIViewController *)viewController functionTag:(NSInteger)functionTag; @optional /*! 输入工具栏尺寸(高度)发生变化的回调 - + @param chatInputBar 输入工具栏 @param frame 输入工具栏最终需要显示的Frame */ @@ -450,7 +443,7 @@ __deprecated_msg("已废弃,请勿使用。"); /*! 点击键盘Return按钮的回调 - + @param inputTextView 文本输入框 */ - (void)inputTextViewDidTouchSendKey:(UITextView *)inputTextView; @@ -462,31 +455,33 @@ __deprecated_msg("已废弃,请勿使用。"); /*! 输入框中内容发生变化的回调 - + @param inputTextView 文本输入框 @param range 当前操作的范围 @param text 插入的文本 */ -- (void)inputTextView:(UITextView *)inputTextView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text; +- (void)inputTextView:(UITextView *)inputTextView + shouldChangeTextInRange:(NSRange)range + replacementText:(NSString *)text; /*! 公众服务菜单的点击回调 - + @param selectedMenuItem 点击的公众服务菜单项 */ - (void)onPublicServiceMenuItemSelected:(RCPublicServiceMenuItem *)selectedMenuItem; /*! 点击扩展功能板中的扩展项的回调 - + @param pluginBoardView 当前扩展功能板 @param tag 点击的扩展项的唯一标示符 */ --(void)pluginBoardView:(RCPluginBoardView*)pluginBoardView clickedItemWithTag:(NSInteger)tag; +- (void)pluginBoardView:(RCPluginBoardView *)pluginBoardView clickedItemWithTag:(NSInteger)tag; /*! 点击表情的回调 - + @param emojiView 表情输入的View @param touchedEmoji 点击的表情对应的字符串编码 */ @@ -494,7 +489,7 @@ __deprecated_msg("已废弃,请勿使用。"); /*! 点击发送按钮的回调 - + @param emojiView 表情输入的View @param sendButton 发送按钮 */ @@ -517,17 +512,17 @@ __deprecated_msg("已废弃,请勿使用。"); /*! 相机拍照图片 - + @param image 相机拍摄,选择发送的图片 */ - (void)imageDidCapture:(UIImage *)image; /** 相机录制小视频 - + @param url 小视频url */ -- (void)sightDidFinishRecord:(NSString*)url thumbnail:(UIImage*)image duration:(NSUInteger)duration; +- (void)sightDidFinishRecord:(NSString *)url thumbnail:(UIImage *)image duration:(NSUInteger)duration; /*! 地理位置选择完成之后的回调 @@ -535,21 +530,22 @@ __deprecated_msg("已废弃,请勿使用。"); @param locationName 位置的名称 @param mapScreenShot 位置在地图中的缩略图 */ -- (void)locationDidSelect:(CLLocationCoordinate2D)location locationName:(NSString *)locationName mapScreenShot:(UIImage *)mapScreenShot; +- (void)locationDidSelect:(CLLocationCoordinate2D)location + locationName:(NSString *)locationName + mapScreenShot:(UIImage *)mapScreenShot; /*! 相册选择图片列表 - + @warning **已废弃,请勿使用。** @param selectedImages 选中的图片 @param full 用户是否要求原图 */ -- (void)imageDidSelect:(NSArray *)selectedImages fullImageRequired:(BOOL)full -__deprecated_msg("已废弃,请勿使用。"); +- (void)imageDidSelect:(NSArray *)selectedImages fullImageRequired:(BOOL)full __deprecated_msg("已废弃,请勿使用。"); /*! 相册选择图片列表,返回图片的 NSData(请不要同时实现 imageDidSelect:fullImageRequired:) - + @warning **已废弃,请勿使用。** @param selectedImages 选中的图片 @param full 用户是否要求原图 @@ -558,25 +554,24 @@ __deprecated_msg("已废弃,请勿使用。"); /*! 选择文件列表 - + @param filePathList 被选中的文件路径list */ - (void)fileDidSelect:(NSArray *)filePathList; /*! 输入工具栏状态变化时的回调(暂未实现) - + @param bottomBarStatus 当前状态 */ --(void)chatSessionInputBarStatusChanged:(KBottomBarStatus)bottomBarStatus; +- (void)chatSessionInputBarStatusChanged:(KBottomBarStatus)bottomBarStatus; @end - -@protocol RCChatSessionInputBarControlDataSource +@protocol RCChatSessionInputBarControlDataSource /*! 获取待选择的用户ID列表 - + @param completion 获取完成的回调 @param functionTag 功能标识 */ @@ -584,7 +579,7 @@ __deprecated_msg("已废弃,请勿使用。"); /*! 获取待选择的UserId的用户信息 - + @param userId 用户ID @return 用户信息 */ diff --git a/ios-rongcallkit/framework/RongIMKit.framework/Headers/RCContentView.h b/ios-rongcallkit/framework/RongIMKit.framework/Headers/RCContentView.h index 9c55955..adbe8a4 100644 --- a/ios-rongcallkit/framework/RongIMKit.framework/Headers/RCContentView.h +++ b/ios-rongcallkit/framework/RongIMKit.framework/Headers/RCContentView.h @@ -20,7 +20,7 @@ /*! 注册Frame发生变化的回调 - + @param eventBlock Frame发生变化的回调 */ - (void)registerFrameChangedEvent:(void (^)(CGRect frame))eventBlock; diff --git a/ios-rongcallkit/framework/RongIMKit.framework/Headers/RCConversationCell.h b/ios-rongcallkit/framework/RongIMKit.framework/Headers/RCConversationCell.h index 6646c80..6f11b84 100644 --- a/ios-rongcallkit/framework/RongIMKit.framework/Headers/RCConversationCell.h +++ b/ios-rongcallkit/framework/RongIMKit.framework/Headers/RCConversationCell.h @@ -7,10 +7,10 @@ // #import "RCConversationBaseCell.h" -#import "RCMessageBubbleTipView.h" -#import "RCThemeDefine.h" #import "RCConversationDetailContentView.h" #import "RCConversationStatusView.h" +#import "RCMessageBubbleTipView.h" +#import "RCThemeDefine.h" #import @@ -91,7 +91,7 @@ @property(nonatomic, assign) BOOL isShowNotificationNumber; /*! - 是否在群组和讨论组会话Cell中隐藏发送者的名称 + 是否在群组和讨论组会话Cell中隐藏发送者的名称 */ @property(nonatomic, assign) BOOL hideSenderName; @@ -120,7 +120,6 @@ */ @property(nonatomic, strong) RCConversationStatusView *statusView; - /*! 设置Cell中显示的头像形状 diff --git a/ios-rongcallkit/framework/RongIMKit.framework/Headers/RCConversationListViewController.h b/ios-rongcallkit/framework/RongIMKit.framework/Headers/RCConversationListViewController.h index f2b3511..f7a443d 100644 --- a/ios-rongcallkit/framework/RongIMKit.framework/Headers/RCConversationListViewController.h +++ b/ios-rongcallkit/framework/RongIMKit.framework/Headers/RCConversationListViewController.h @@ -17,8 +17,7 @@ /*! 会话列表界面类 */ -@interface RCConversationListViewController - : RCBaseViewController +@interface RCConversationListViewController : RCBaseViewController #pragma mark - 初始化 @@ -26,10 +25,12 @@ 初始化会话列表 @param displayConversationTypeArray 列表中需要显示的会话类型数组(需要将RCConversationType转为NSNumber构建Array) - @param collectionConversationTypeArray 列表中需要聚合为一条显示的会话类型数组(需要将RCConversationType转为NSNumber构建Array) + @param collectionConversationTypeArray + 列表中需要聚合为一条显示的会话类型数组(需要将RCConversationType转为NSNumber构建Array) @return 会话列表对象 - @discussion 聚合为一条显示指的是,将指定会话类型的所有会话在会话列表中聚合显示成一条,点击进入会显示该会话类型的所有会话列表。 + @discussion + 聚合为一条显示指的是,将指定会话类型的所有会话在会话列表中聚合显示成一条,点击进入会显示该会话类型的所有会话列表。 */ - (instancetype)initWithDisplayConversationTypes:(NSArray *)displayConversationTypeArray collectionConversationType:(NSArray *)collectionConversationTypeArray; @@ -199,15 +200,13 @@ @discussion 您可以在此回调中修改Cell的一些显示属性。 */ -- (void)willDisplayConversationTableCell:(RCConversationBaseCell *)cell - atIndexPath:(NSIndexPath *)indexPath; - +- (void)willDisplayConversationTableCell:(RCConversationBaseCell *)cell atIndexPath:(NSIndexPath *)indexPath; /** Cell状态更新时的回调 @param indexPath 该Cell对应的会话Cell数据模型在数据源中的索引值 - + @discussion 当Cell的阅读状态等信息发生改变时的回调,您可以在此回调中更新Cell的显示。 */ - (void)updateCellAtIndexPath:(NSIndexPath *)indexPath; @@ -231,8 +230,7 @@ @param indexPath 该Cell对应的会话Cell数据模型在数据源中的索引值 @return 自定义会话需要显示的Cell的高度 */ -- (CGFloat)rcConversationListTableView:(UITableView *)tableView - heightForRowAtIndexPath:(NSIndexPath *)indexPath; +- (CGFloat)rcConversationListTableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath; /*! 左滑删除自定义会话时的回调 @@ -268,10 +266,9 @@ */ - (void)refreshConversationTableViewWithConversationModel:(RCConversationModel *)conversationModel; - /*! 当用户退出登陆时,是否还能继续显示会话列表 - + @discussion 默认值为YES。 */ @property(nonatomic, assign) BOOL showConversationListWhileLogOut; diff --git a/ios-rongcallkit/framework/RongIMKit.framework/Headers/RCConversationModel.h b/ios-rongcallkit/framework/RongIMKit.framework/Headers/RCConversationModel.h index 467995e..2d2eec1 100644 --- a/ios-rongcallkit/framework/RongIMKit.framework/Headers/RCConversationModel.h +++ b/ios-rongcallkit/framework/RongIMKit.framework/Headers/RCConversationModel.h @@ -118,7 +118,7 @@ typedef NS_ENUM(NSUInteger, RCConversationModelType) { /*! 会话中最后一条消息的发送者的用户名(已废弃,请勿使用) - + @warning **已废弃,请勿使用。** */ @property(nonatomic, strong) __deprecated_msg("已废弃,请勿使用。") NSString *senderUserName; @@ -150,34 +150,33 @@ typedef NS_ENUM(NSUInteger, RCConversationModelType) { /*! 初始化会话Cell的数据模型(已废弃,请勿使用) - + @param conversationModelType 会话Cell数据模型的显示类型 @param extend 用户自定义的扩展数据 @return 会话Cell的数据模型对象 - + @warning **已废弃,请勿使用。** */ -- (instancetype)init:(RCConversationModelType)conversationModelType exntend:(id)extend -__deprecated_msg("已废弃,请勿使用。"); +- (instancetype)init:(RCConversationModelType)conversationModelType + exntend:(id)extend __deprecated_msg("已废弃,请勿使用。"); /*! 初始化会话显示数据模型 - + @param conversationModelType 会话Cell数据模型的显示类型 @param conversation 会话 @param extend 用户自定义的扩展数据 @return 会话Cell的数据模型对象 - + @warning **已废弃,请勿使用。** */ - (instancetype)init:(RCConversationModelType)conversationModelType conversation:(RCConversation *)conversation - extend:(id)extend -__deprecated_msg("已废弃,请勿使用。"); + extend:(id)extend __deprecated_msg("已废弃,请勿使用。"); /*! 初始化会话显示数据模型 - + @param conversation 会话 @param extend 用户自定义的扩展数据 @return 会话Cell的数据模型对象 @@ -186,19 +185,18 @@ __deprecated_msg("已废弃,请勿使用。"); /*! 更新数据模型中的消息 - + @param message 此会话中最新的消息 */ - (void)updateWithMessage:(RCMessage *)message; /*! 会话和数据模型是否匹配 - + @param conversationType 会话类型 @param targetId 目标会话ID @return 会话和数据模型是否匹配 */ -- (BOOL)isMatching:(RCConversationType)conversationType - targetId:(NSString *)targetId; +- (BOOL)isMatching:(RCConversationType)conversationType targetId:(NSString *)targetId; @end diff --git a/ios-rongcallkit/framework/RongIMKit.framework/Headers/RCConversationSettingTableViewController.h b/ios-rongcallkit/framework/RongIMKit.framework/Headers/RCConversationSettingTableViewController.h index 7f74c9d..517a264 100644 --- a/ios-rongcallkit/framework/RongIMKit.framework/Headers/RCConversationSettingTableViewController.h +++ b/ios-rongcallkit/framework/RongIMKit.framework/Headers/RCConversationSettingTableViewController.h @@ -46,49 +46,49 @@ /*! 禁止删除用户 - + @param disable 是否禁止删除用户 */ - (void)disableDeleteMemberEvent:(BOOL)disable; /*! 设置添加用户 - + @param disable 是否禁止删除用户 */ - (void)disableInviteMemberEvent:(BOOL)disable; /*! 开闭置顶聊天的回调 - + @param sender 点击的Switch开关 */ - (void)onClickIsTopSwitch:(id)sender; /*! 开闭新通知提醒的回调 - + @param sender 点击的Switch开关 */ - (void)onClickNewMessageNotificationSwitch:(id)sender; /*! 点击清除聊天记录的回调 - + @param sender 清除聊天记录的按钮 */ - (void)onClickClearMessageHistory:(id)sender; /*! 添加用户到顶部视图 - + @param users 用户信息RCUserInfo列表 */ - (void)inviteRemoteUsers:(NSArray *)users; /*! 点击Item(用户头像或加减号)的回调 - + @param settingTableViewHeader 当前会话设置界面 @param indexPathOfSelectedItem 点击的Item索引值 @param users 当前的用户信息RCUserInfo列表 @@ -99,18 +99,18 @@ /*! 点击删除用户的回调 - + @param indexPath 当前删除的用户的头像索引值 - + @discussion 点击头像左上角的删除按钮时的回调。 */ - (void)deleteTipButtonClicked:(NSIndexPath *)indexPath; /*! 点击头像的回调 - + @param userId 头像对应的用户ID */ -- (void)didTipHeaderClicked:(NSString*)userId; +- (void)didTipHeaderClicked:(NSString *)userId; @end diff --git a/ios-rongcallkit/framework/RongIMKit.framework/Headers/RCConversationSettingTableViewHeader.h b/ios-rongcallkit/framework/RongIMKit.framework/Headers/RCConversationSettingTableViewHeader.h index ec0cf93..aa7a35d 100644 --- a/ios-rongcallkit/framework/RongIMKit.framework/Headers/RCConversationSettingTableViewHeader.h +++ b/ios-rongcallkit/framework/RongIMKit.framework/Headers/RCConversationSettingTableViewHeader.h @@ -18,7 +18,7 @@ /*! 点击Item(用户头像或加减号)的回调 - + @param settingTableViewHeader 当前会话设置界面 @param indexPathOfSelectedItem 点击的Item索引值 @param users 当前的用户信息RCUserInfo列表 @@ -29,14 +29,14 @@ /*! 点击删除的回调 - + @param indexPath 点击的索引 */ - (void)deleteTipButtonClicked:(NSIndexPath *)indexPath; /*! 点击头像的回调 - + @param userId 头像对应的用户ID */ - (void)didTipHeaderClicked:(NSString *)userId; diff --git a/ios-rongcallkit/framework/RongIMKit.framework/Headers/RCConversationViewController.h b/ios-rongcallkit/framework/RongIMKit.framework/Headers/RCConversationViewController.h index 557a744..4efb362 100644 --- a/ios-rongcallkit/framework/RongIMKit.framework/Headers/RCConversationViewController.h +++ b/ios-rongcallkit/framework/RongIMKit.framework/Headers/RCConversationViewController.h @@ -6,54 +6,54 @@ // Copyright (c) 2015年 RongCloud. All rights reserved. // -#import #import "RCBaseViewController.h" #import "RCChatSessionInputBarControl.h" -#import "RCPluginBoardView.h" +#import "RCConversationModel.h" #import "RCEmojiBoardView.h" -#import "RCThemeDefine.h" #import "RCMessageBaseCell.h" #import "RCMessageModel.h" -#import "RCConversationModel.h" +#import "RCPluginBoardView.h" +#import "RCThemeDefine.h" +#import /*! 客服服务状态 */ typedef NS_ENUM(NSUInteger, RCCustomerServiceStatus) { - /*! - 无客服服务 - */ - RCCustomerService_NoService, - - /*! - 人工客服服务 - */ - RCCustomerService_HumanService, - - /*! - 机器人客服服务 - */ - RCCustomerService_RobotService + /*! + 无客服服务 + */ + RCCustomerService_NoService, + + /*! + 人工客服服务 + */ + RCCustomerService_HumanService, + + /*! + 机器人客服服务 + */ + RCCustomerService_RobotService }; /*! 会话页面类 */ -@interface RCConversationViewController: RCBaseViewController - +@interface RCConversationViewController + : RCBaseViewController #pragma mark - 初始化 /*! 初始化会话页面 - + @param conversationType 会话类型 @param targetId 目标会话ID - + @return 会话页面对象 */ -- (id)initWithConversationType:(RCConversationType)conversationType - targetId:(NSString *)targetId; +- (id)initWithConversationType:(RCConversationType)conversationType targetId:(NSString *)targetId; #pragma mark - 会话属性 @@ -69,7 +69,7 @@ typedef NS_ENUM(NSUInteger, RCCustomerServiceStatus) { /*! 当前的用户名称(已废弃,请勿使用) - + @warning **已废弃,请勿使用。** */ @property(nonatomic, strong) __deprecated_msg("已废弃,请勿使用。") NSString *userName; @@ -77,14 +77,14 @@ typedef NS_ENUM(NSUInteger, RCCustomerServiceStatus) { #pragma mark - 会话页面属性 /** 进入页面时定位的消息的发送时间 - + @discussion 用于消息搜索之后点击进入页面等场景 */ @property(nonatomic, assign) long long locatedMessageSentTime; /*! 聊天内容的消息Cell数据模型的数据源 - + @discussion 数据源中存放的元素为消息Cell的数据模型,即RCMessageModel对象。 @warning 非线程安全,请在主线程操作该属性 */ @@ -103,7 +103,7 @@ typedef NS_ENUM(NSUInteger, RCCustomerServiceStatus) { #pragma mark 导航栏返回按钮中的未读消息数提示 /*! 需要统计未读数的会话类型数组(在导航栏的返回按钮中显示) - + @discussion 此属性表明在导航栏的返回按钮中需要统计显示哪部分的会话类型的未读数。 (需要将RCConversationType转为NSNumber构建Array) */ @@ -111,7 +111,7 @@ typedef NS_ENUM(NSUInteger, RCCustomerServiceStatus) { /*! 更新导航栏返回按钮中显示的未读消息数 - + @discussion 如果您重写此方法,需要注意调用super。 */ - (void)notifyUpdateUnreadMessageCount; @@ -119,7 +119,7 @@ typedef NS_ENUM(NSUInteger, RCCustomerServiceStatus) { #pragma mark 右上角的未读消息数提示 /*! 当收到的消息超过一个屏幕时,进入会话之后,是否在右上角提示上方存在的未读消息数 - + @discussion 默认值为NO。 开启该提示功能之后,当一个会话收到大量消息时(超过一个屏幕能显示的内容), 进入该会话后,会在右上角提示用户上方存在的未读消息数,用户点击该提醒按钮,会跳转到最开始的未读消息。 @@ -133,10 +133,10 @@ typedef NS_ENUM(NSUInteger, RCCustomerServiceStatus) { /*! 右上角未读消息数提示的Label - + @discussion 当 150 >= unReadMessage > 10 右上角会显示未读消息数。 */ -@property(nonatomic,strong) UILabel *unReadMessageLabel; +@property(nonatomic, strong) UILabel *unReadMessageLabel; /*! 右上角未读消息数提示的按钮 @@ -146,7 +146,7 @@ typedef NS_ENUM(NSUInteger, RCCustomerServiceStatus) { #pragma mark 右下角的未读消息数提示 /*! 当前阅读区域的下方收到消息时,是否在会话页面的右下角提示下方存在未读消息 - + @discussion 默认值为NO。 开启该提示功能之后,当会话页面滑动到最下方时,此会话中收到消息会自动更新; 当用户停留在上方某个区域阅读时,此会话收到消息时,会在右下角显示未读消息提示,而不会自动滚动到最下方, @@ -168,21 +168,21 @@ typedef NS_ENUM(NSUInteger, RCCustomerServiceStatus) { /*! 输入框的默认输入模式 - + @discussion 默认值为RCChatSessionInputBarInputText,即文本输入模式。 请在[super viewWillAppear:animated]之后调用 */ @property(nonatomic) RCChatSessionInputBarInputType defaultInputType; /*! 会话扩展显示区域 - + @discussion 可以自定义显示会话页面的view。 */ -@property(nonatomic, strong)UIView *extensionView; +@property(nonatomic, strong) UIView *extensionView; /*! 输入框中内容发生变化的回调 - + @param inputTextView 文本输入框 @param range 当前操作的范围 @param text 插入的文本 @@ -193,28 +193,27 @@ typedef NS_ENUM(NSUInteger, RCCustomerServiceStatus) { /*! 扩展功能板的点击回调 - + @param pluginBoardView 输入扩展功能板View @param tag 输入扩展功能(Item)的唯一标示 */ --(void)pluginBoardView:(RCPluginBoardView*)pluginBoardView - clickedItemWithTag:(NSInteger)tag; +- (void)pluginBoardView:(RCPluginBoardView *)pluginBoardView clickedItemWithTag:(NSInteger)tag; /*! 设置输入框的输入状态 - + @param inputBarStatus 输入框状态 @param animated 是否使用动画效果 - + @warning **已废弃,请勿使用。** 升级说明:如果您之前使用了此接口,可以直接替换为chatSessionInputBarControl的updateStatus:animated:接口,行为和实现完全一致。 */ --(void)setChatSessionInputBarStatus:(KBottomBarStatus)inputBarStatus animated:(BOOL)animated -__deprecated_msg("已废弃,请勿使用。"); +- (void)setChatSessionInputBarStatus:(KBottomBarStatus)inputBarStatus + animated:(BOOL)animated __deprecated_msg("已废弃,请勿使用。"); /*! 输入扩展功能板View - + @warning **已废弃,请勿使用。** 升级说明:如果您之前使用了此属性,可以直接替换为chatSessionInputBarControl的pluginBoardView属性,行为和实现完全一致。 */ @@ -222,7 +221,7 @@ __deprecated_msg("已废弃,请勿使用。"); /*! 表情View - + @warning **已废弃,请勿使用。** 升级说明:如果您之前使用了此属性,可以直接替换为chatSessionInputBarControl的emojiBoardView属性,行为和实现完全一致。 */ @@ -232,7 +231,7 @@ __deprecated_msg("已废弃,请勿使用。"); /*! 收到的消息是否显示发送者的名字 - + @discussion 默认值为YES。 您可以针对群聊、聊天室、单聊等不同场景,自己定制是否显示发送方的名字。 */ @@ -240,7 +239,7 @@ __deprecated_msg("已废弃,请勿使用。"); /*! 设置进入聊天室需要获取的历史消息数量(仅在当前会话为聊天室时生效) - + @discussion 此属性需要在viewDidLoad之前进行设置。 -1表示不获取任何历史消息,0表示不特殊设置而使用SDK默认的设置(默认为获取10条),0 -#import #import "RCEmoticonTabSource.h" +#import +#import @class RCEmojiPageControl; @class RCEmojiBoardView; @@ -21,7 +21,7 @@ /*! 点击表情的回调 - + @param emojiView 表情输入的View @param string 点击的表情对应的字符串编码 */ @@ -29,7 +29,7 @@ /*! 点击发送按钮的回调 - + @param emojiView 表情输入的View @param sendButton 发送按钮 */ @@ -40,7 +40,7 @@ /*! 表情输入的View */ -@interface RCEmojiBoardView : UIView +@interface RCEmojiBoardView : UIView /*! 当前的会话类型 @@ -59,7 +59,7 @@ /*! 表情的Label(已废弃,请勿使用) - + @warning **已废弃,请勿使用。** */ @property(nonatomic, strong) __deprecated_msg("已废弃,请勿使用。") UILabel *emojiLabel; @@ -72,7 +72,7 @@ /*! 表情区域的大小 */ -@property(nonatomic, assign,readonly)CGSize contentViewSize; +@property(nonatomic, assign, readonly) CGSize contentViewSize; /** * init @@ -88,7 +88,7 @@ /*! 发送按钮是否可点击 - + @param sender 发送者 */ - (void)enableSendButton:(BOOL)sender; @@ -110,9 +110,9 @@ - (void)setCurrentIndex:(int)index withTotalPages:(int)totalPageNum; /** - * 重新加载通过扩展方式加载的表情包,(调用这个方法会回调RCExtensionModule 协议实现的扩展通过 addEmojiTab 加入的表情包不会重写加载) + * 重新加载通过扩展方式加载的表情包,(调用这个方法会回调RCExtensionModule 协议实现的扩展通过 addEmojiTab + * 加入的表情包不会重写加载) */ - (void)reloadExtensionEmoticonTabSource; - @end diff --git a/ios-rongcallkit/framework/RongIMKit.framework/Headers/RCEmoticonTabSource.h b/ios-rongcallkit/framework/RongIMKit.framework/Headers/RCEmoticonTabSource.h index ab52f8a..933d6bc 100644 --- a/ios-rongcallkit/framework/RongIMKit.framework/Headers/RCEmoticonTabSource.h +++ b/ios-rongcallkit/framework/RongIMKit.framework/Headers/RCEmoticonTabSource.h @@ -17,25 +17,24 @@ 表情tab的标识符 @return 表情tab的标识符,请勿重复 */ --(NSString *)identify; +- (NSString *)identify; /*! 表情tab的图标 @return 表情tab的图标 */ --(UIImage *)image; +- (UIImage *)image; /*! 表情tab的页数 @return 表情tab的页数 */ --(int)pageCount; +- (int)pageCount; /*! 表情tab的index页的表情View - + @return 表情tab的index页的表情View @discussion 返回的 view 大小必须等于 contentViewSize (宽度 = 屏幕宽度,高度 = 186) */ --(UIView *)loadEmoticonView:(NSString *)identify index:(int)index; +- (UIView *)loadEmoticonView:(NSString *)identify index:(int)index; @end - diff --git a/ios-rongcallkit/framework/RongIMKit.framework/Headers/RCExtensionMessageCellInfo.h b/ios-rongcallkit/framework/RongIMKit.framework/Headers/RCExtensionMessageCellInfo.h index 8fc33f1..97c39ff 100644 --- a/ios-rongcallkit/framework/RongIMKit.framework/Headers/RCExtensionMessageCellInfo.h +++ b/ios-rongcallkit/framework/RongIMKit.framework/Headers/RCExtensionMessageCellInfo.h @@ -13,7 +13,7 @@ */ @interface RCExtensionMessageCellInfo : NSObject -@property (nonatomic, strong)Class messageContentClass; -@property (nonatomic, strong)Class messageCellClass; +@property(nonatomic, strong) Class messageContentClass; +@property(nonatomic, strong) Class messageCellClass; @end diff --git a/ios-rongcallkit/framework/RongIMKit.framework/Headers/RCExtensionModule.h b/ios-rongcallkit/framework/RongIMKit.framework/Headers/RCExtensionModule.h index 7a9d8ba..159f4f6 100644 --- a/ios-rongcallkit/framework/RongIMKit.framework/Headers/RCExtensionModule.h +++ b/ios-rongcallkit/framework/RongIMKit.framework/Headers/RCExtensionModule.h @@ -6,10 +6,10 @@ // Copyright © 2016年 RongCloud. All rights reserved. // -#import +#import "RCChatSessionInputBarControl.h" #import "RCEmoticonTabSource.h" #import "RCExtensionPluginItemInfo.h" -#import "RCChatSessionInputBarControl.h" +#import #import /*! @@ -26,14 +26,14 @@ #pragma mark - SDK status notify /*! 初始化融云SDK - + @param appkey 应用的融云Appkey */ - (void)initWithAppKey:(NSString *)appkey; /*! 连接融云IM服务 - + @param userId 用户ID */ - (void)didConnect:(NSString *)userId; @@ -50,51 +50,56 @@ /*! 当前登陆的用户信息变化的回调 - + @param userInfo 当前登陆的用户信息 */ - (void)didCurrentUserInfoUpdated:(RCUserInfo *)userInfo; /*! 处理收到的消息 - + @param message 收到的消息 */ - (void)onMessageReceived:(RCMessage *)message; /*! 处理收到消息响铃事件 - + @param message 收到的消息 - + @return 扩展模块处理的结果,YES为模块处理,SDK不会响铃。NO为模块未处理,SDK会默认处理。 - @discussion 当应用处在前台时,如果在新来消息的会话内,没有铃声和通知;如果不在该会话内会铃声提示。当应用处在后台时,新来消息会弹出本地通知 + @discussion + 当应用处在前台时,如果在新来消息的会话内,没有铃声和通知;如果不在该会话内会铃声提示。当应用处在后台时,新来消息会弹出本地通知 */ - (BOOL)handleAlertForMessageReceived:(RCMessage *)message; /*! 处理收到消息通知事件 - + @param message 收到的消息 - @param fromName 来源名字,如果message是单聊消息就是发送者的名字,如果是群组消息就是群组名,如果是讨论组消息就是讨论组名。 + @param fromName + 来源名字,如果message是单聊消息就是发送者的名字,如果是群组消息就是群组名,如果是讨论组消息就是讨论组名。 @param userInfo LocalNotification userInfo。如果扩展模块要弹本地通知,请一定带上userInfo。 - + @return 扩展模块处理的结果,YES为模块处理,SDK不会弹出通知。NO为模块未处理,SDK会默认处理。 - @discussion 当应用处在前台时,如果在新来消息的会话内,没有铃声和通知;如果不在该会话内会铃声提示。当应用处在后台时,新来消息会弹出本地通知 + @discussion + 当应用处在前台时,如果在新来消息的会话内,没有铃声和通知;如果不在该会话内会铃声提示。当应用处在后台时,新来消息会弹出本地通知 */ -- (BOOL)handleNotificationForMessageReceived:(RCMessage *)message from:(NSString *)fromName userInfo:(NSDictionary *)userInfo; +- (BOOL)handleNotificationForMessageReceived:(RCMessage *)message + from:(NSString *)fromName + userInfo:(NSDictionary *)userInfo; #pragma mark - App URL /*! 设置扩展模块URL scheme。 - + @param scheme URL scheme */ - (void)setScheme:(NSString *)scheme; /*! 处理openUrl请求 - + return 是否处理 */ - (BOOL)onOpenUrl:(NSURL *)url; @@ -102,16 +107,16 @@ #pragma mark - Input Bar /*! 获取会话页面的plugin board item信息。 - + @param conversationType 会话类型 @param targetId targetId - + @return plugin board item信息列表。 - + @discussion 当进入到会话页面时,SDK需要注册扩展面部区域的item。 */ - (NSArray *)getPluginBoardItemInfoList:(RCConversationType)conversationType - targetId:(NSString *)targetId; + targetId:(NSString *)targetId; /*! 获取会话输入区的表情tab页 @@ -132,8 +137,8 @@ @param inputBarControl 表情面板所在的输入工具栏 */ - (void)emoticonTab:(RCEmojiBoardView *)emojiView - didTouchAddButton:(UIButton *)addButton - inInputBar:(RCChatSessionInputBarControl *)inputBarControl; + didTouchAddButton:(UIButton *)addButton + inInputBar:(RCChatSessionInputBarControl *)inputBarControl; /*! 点击表情面板中的设置按钮的回调 @@ -152,19 +157,16 @@ @param inputTextView 文本输入框 @param inputBarControl 文本输入框所在的输入工具栏 */ -- (void)inputTextViewDidChange:(UITextView *)inputTextView - inInputBar:(RCChatSessionInputBarControl *)inputBarControl; +- (void)inputTextViewDidChange:(UITextView *)inputTextView inInputBar:(RCChatSessionInputBarControl *)inputBarControl; /*! 输入工具栏状态发生变化的回调 - + @param status 输入工具栏当前状态 @param inputBarControl 输入工具栏 */ -- (void)inputBarStatusDidChange:(KBottomBarStatus)status - inInputBar:(RCChatSessionInputBarControl *)inputBarControl; - +- (void)inputBarStatusDidChange:(KBottomBarStatus)status inInputBar:(RCChatSessionInputBarControl *)inputBarControl; /*! 是否需要显示表情加号按钮 @@ -175,13 +177,13 @@ /*! 是否需要显示表情设置按钮 - + @param inputBarControl 输入工具栏 */ - (BOOL)isEmoticonSettingButtonEnabled:(RCChatSessionInputBarControl *)inputBarControl; ///*! // 点击加号面板中按钮的回调 -// +// // @param emojiView 加号面板 // @param addButton 加号中的每一项 // @param inputBarControl 面板所在的输入工具栏 diff --git a/ios-rongcallkit/framework/RongIMKit.framework/Headers/RCExtensionPluginItemInfo.h b/ios-rongcallkit/framework/RongIMKit.framework/Headers/RCExtensionPluginItemInfo.h index dd584b2..1a77944 100644 --- a/ios-rongcallkit/framework/RongIMKit.framework/Headers/RCExtensionPluginItemInfo.h +++ b/ios-rongcallkit/framework/RongIMKit.framework/Headers/RCExtensionPluginItemInfo.h @@ -6,9 +6,9 @@ // Copyright © 2016年 RongCloud. All rights reserved. // +#import "RCChatSessionInputBarControl.h" #import #import -#import "RCChatSessionInputBarControl.h" typedef void (^RCConversationPluginItemTapBlock)(RCChatSessionInputBarControl *chatSessionInputBar); @@ -17,9 +17,9 @@ typedef void (^RCConversationPluginItemTapBlock)(RCChatSessionInputBarControl *c */ @interface RCExtensionPluginItemInfo : NSObject -@property (nonatomic, strong)UIImage *image; -@property (nonatomic, strong)NSString *title; -@property (nonatomic, copy)RCConversationPluginItemTapBlock tapBlock; -@property (nonatomic, assign)NSInteger tag; +@property(nonatomic, strong) UIImage *image; +@property(nonatomic, strong) NSString *title; +@property(nonatomic, copy) RCConversationPluginItemTapBlock tapBlock; +@property(nonatomic, assign) NSInteger tag; @end diff --git a/ios-rongcallkit/framework/RongIMKit.framework/Headers/RCFileMessageCell.h b/ios-rongcallkit/framework/RongIMKit.framework/Headers/RCFileMessageCell.h index ceba000..8d7a6e5 100644 --- a/ios-rongcallkit/framework/RongIMKit.framework/Headers/RCFileMessageCell.h +++ b/ios-rongcallkit/framework/RongIMKit.framework/Headers/RCFileMessageCell.h @@ -6,8 +6,8 @@ // Copyright © 2016年 RongCloud. All rights reserved. // -#import #import "RCMessageCell.h" +#import /*! 文件消息Cell @@ -50,4 +50,3 @@ @property(nonatomic, strong) UILabel *cancelLabel; @end - diff --git a/ios-rongcallkit/framework/RongIMKit.framework/Headers/RCIM.h b/ios-rongcallkit/framework/RongIMKit.framework/Headers/RCIM.h index d61c776..3fa0911 100644 --- a/ios-rongcallkit/framework/RongIMKit.framework/Headers/RCIM.h +++ b/ios-rongcallkit/framework/RongIMKit.framework/Headers/RCIM.h @@ -6,18 +6,18 @@ // Copyright (c) 2015年 RongCloud. All rights reserved. // +#import "RCThemeDefine.h" #import #import -#import "RCThemeDefine.h" /*! @const 收到消息的Notification - + @discussion 接收到消息后,SDK会分发此通知。 - + Notification的object为RCMessage消息对象。 userInfo为NSDictionary对象,其中key值为@"left",value为还剩余未接收的消息数的NSNumber对象。 - + 与RCIMReceiveMessageDelegate的区别: RCKitDispatchMessageNotification只要注册都可以收到通知;RCIMReceiveMessageDelegate需要设置监听,并同时只能存在一个监听。 */ @@ -25,11 +25,11 @@ FOUNDATION_EXPORT NSString *const RCKitDispatchMessageNotification; /*! @const 消息被撤回的Notification - + @discussion 消息被撤回后,SDK会分发此通知。 - + Notification的object为NSNumber的messageId。 - + 与RCIMReceiveMessageDelegate的区别: RCKitDispatchRecallMessageNotification只要注册都可以收到通知;RCIMReceiveMessageDelegate需要设置监听,并同时只能存在一个监听。 */ @@ -37,9 +37,9 @@ FOUNDATION_EXPORT NSString *const RCKitDispatchRecallMessageNotification; /*! @const 收到已读回执的Notification - + @discussion 收到消息已读回执之后 IMLib 更新消息状态之后,IMKit会分发此通知。 - + Notification的object为nil,userInfo为NSDictionary对象, 其中key值分别为@"cType"、@"tId"、@"messageTime", 对应的value为会话类型的NSNumber对象、会话的targetId、已阅读的最后一条消息的sendTime。 @@ -48,21 +48,22 @@ FOUNDATION_EXPORT NSString *const RCKitDispatchRecallMessageNotification; NSNumber *time = [notification.userInfo objectForKey:@"messageTime"]; NSString *targetId = [notification.userInfo objectForKey:@"tId"]; NSString *fromUserId = [notification.userInfo objectForKey:@"fId"]; - + 收到这个消息之后可以更新这个会话中messageTime以前的消息UI为已读(底层数据库消息状态已经改为已读)。 - + @warning **已废弃,请勿使用。** 升级说明:如果您之前使用了此通知,可以直接替换为RCLibDispatchReadReceiptNotification通知,行为和内容完全一致。 */ -FOUNDATION_EXPORT NSString *const RCKitDispatchReadReceiptNotification __deprecated_msg("已废弃,请使用RCLibDispatchReadReceiptNotification通知。"); +FOUNDATION_EXPORT NSString *const + RCKitDispatchReadReceiptNotification __deprecated_msg("已废弃,请使用RCLibDispatchReadReceiptNotification通知。"); /*! @const 连接状态变化的Notification - + @discussion SDK连接状态发生变化时,SDK会分发此通知。 - + Notification的object为NSNumber对象,对应于RCConnectionStatus的值。 - + 与RCIMConnectionStatusDelegate的区别: RCKitDispatchConnectionStatusChangedNotification只要注册都可以收到通知;RCIMConnectionStatusDelegate需要设置监听,同时只能存在一个监听。 */ @@ -89,60 +90,58 @@ FOUNDATION_EXPORT NSString *const RCKitDispatchMessageReceiptRequestNotification /*! 用户信息提供者 - + @discussion SDK需要通过您实现的用户信息提供者,获取用户信息并显示。 */ @protocol RCIMUserInfoDataSource /*! 获取用户信息 - + @param userId 用户ID @param completion 获取用户信息完成之后需要执行的Block [userInfo:该用户ID对应的用户信息] - + @discussion SDK通过此方法获取用户信息并显示,请在completion中返回该用户ID对应的用户信息。 在您设置了用户信息提供者之后,SDK在需要显示用户信息的时候,会调用此方法,向您请求用户信息用于显示。 */ -- (void)getUserInfoWithUserId:(NSString *)userId - completion:(void (^)(RCUserInfo *userInfo))completion; +- (void)getUserInfoWithUserId:(NSString *)userId completion:(void (^)(RCUserInfo *userInfo))completion; @end /*! 群组信息提供者 - + @discussion SDK需要通过您实现的群组信息提供者,获取群组信息并显示。 */ @protocol RCIMGroupInfoDataSource /*! 获取群组信息 - + @param groupId 群组ID @param completion 获取群组信息完成之后需要执行的Block [groupInfo:该群组ID对应的群组信息] - + @discussion SDK通过此方法获取用户信息并显示,请在completion的block中返回该用户ID对应的用户信息。 在您设置了用户信息提供者之后,SDK在需要显示用户信息的时候,会调用此方法,向您请求用户信息用于显示。 */ -- (void)getGroupInfoWithGroupId:(NSString *)groupId - completion:(void (^)(RCGroup *groupInfo))completion; +- (void)getGroupInfoWithGroupId:(NSString *)groupId completion:(void (^)(RCGroup *groupInfo))completion; @end /*! 群名片信息提供者 - + @discussion 如果您使用了群名片功能,SDK需要通过您实现的群名片信息提供者,获取用户在群组中的名片信息并显示。 */ @protocol RCIMGroupUserInfoDataSource /*! 获取用户在群组中的群名片信息 - + @param userId 用户ID @param groupId 群组ID @param completion 获取群名片信息完成之后需要执行的Block [userInfo:该用户ID在群组中对应的群名片信息] - + @discussion 如果您使用了群名片功能,SDK需要通过您实现的群名片信息提供者,获取用户在群组中的名片信息并显示。 */ - (void)getUserInfoWithUserId:(NSString *)userId @@ -159,22 +158,20 @@ FOUNDATION_EXPORT NSString *const RCKitDispatchMessageReceiptRequestNotification /*! 获取当前群组成员列表的回调(需要实现用户信息提供者 RCIMUserInfoDataSource) - + @param groupId 群ID @param resultBlock 获取成功 [userIdList:群成员ID列表] */ -- (void)getAllMembersOfGroup:(NSString *)groupId - result:(void (^)(NSArray *userIdList))resultBlock; +- (void)getAllMembersOfGroup:(NSString *)groupId result:(void (^)(NSArray *userIdList))resultBlock; @end - #pragma mark - 消息接收监听器 /*! IMKit消息接收的监听器 - + @discussion 设置 IMKit 的消息接收监听器请参考 RCIM 的 receiveMessageDelegate 属性。 - + @warning 如果您使用 IMKit,可以设置并实现此 Delegate 监听消息接收; 如果您使用 IMLib,请使用 RCIMClient 中的 RCIMClientReceiveMessageDelegate 监听消息接收,而不要使用此监听器。 */ @@ -182,26 +179,25 @@ FOUNDATION_EXPORT NSString *const RCKitDispatchMessageReceiptRequestNotification /*! 接收消息的回调方法 - + @param message 当前接收到的消息 @param left 还剩余的未接收的消息数,left>=0 - + @discussion 如果您设置了IMKit消息监听之后,SDK在接收到消息时候会执行此方法(无论App处于前台或者后台)。 其中,left为还剩余的、还未接收的消息数量。比如刚上线一口气收到多条消息时,通过此方法,您可以获取到每条消息,left会依次递减直到0。 您可以根据left数量来优化您的App体验和性能,比如收到大量消息时等待left为0再刷新UI。 */ -- (void)onRCIMReceiveMessage:(RCMessage *)message - left:(int)left; +- (void)onRCIMReceiveMessage:(RCMessage *)message left:(int)left; @optional /*! 当App处于后台时,接收到消息并弹出本地通知的回调方法 - + @param message 接收到的消息 @param senderName 消息发送者的用户名称 @return 当返回值为NO时,SDK会弹出默认的本地通知提示;当返回值为YES时,SDK针对此消息不再弹本地通知提示 - + @discussion 如果您设置了IMKit消息监听之后,当App处于后台,收到消息时弹出本地通知之前,会执行此方法。 如果App没有实现此方法,SDK会弹出默认的本地通知提示。 流程: @@ -209,37 +205,36 @@ FOUNDATION_EXPORT NSString *const RCKitDispatchMessageReceiptRequestNotification -> 用户/群组信息为空 -> 不弹出本地通知 -> 用户/群组信息存在 -> 回调此方法准备弹出本地通知 -> App实现并返回YES -> SDK不再弹出此消息的本地通知 -> App未实现此方法或者返回NO -> SDK弹出默认的本地通知提示 - - + + 您可以通过RCIM的disableMessageNotificaiton属性,关闭所有的本地通知(此时不再回调此接口)。 - + @warning 如果App在后台想使用SDK默认的本地通知提醒,需要实现用户/群组/群名片信息提供者,并返回正确的用户信息或群组信息。 参考RCIMUserInfoDataSource、RCIMGroupInfoDataSource与RCIMGroupUserInfoDataSource */ --(BOOL)onRCIMCustomLocalNotification:(RCMessage*)message - withSenderName:(NSString *)senderName; +- (BOOL)onRCIMCustomLocalNotification:(RCMessage *)message withSenderName:(NSString *)senderName; /*! 当App处于前台时,接收到消息并播放提示音的回调方法 - + @param message 接收到的消息 @return 当返回值为NO时,SDK会播放默认的提示音;当返回值为YES时,SDK针对此消息不再播放提示音 - + @discussion 到消息时播放提示音之前,会执行此方法。 如果App没有实现此方法,SDK会播放默认的提示音。 流程: SDK接收到消息 -> App处于前台状态 -> 回调此方法准备播放提示音 -> App实现并返回YES -> SDK针对此消息不再播放提示音 -> App未实现此方法或者返回NO -> SDK会播放默认的提示音 - + 您可以通过RCIM的disableMessageAlertSound属性,关闭所有前台消息的提示音(此时不再回调此接口)。 */ --(BOOL)onRCIMCustomAlertSound:(RCMessage*)message; +- (BOOL)onRCIMCustomAlertSound:(RCMessage *)message; /*! 消息被撤回的回调方法 - + @param messageId 被撤回的消息ID - + @discussion 被撤回的消息会变更为RCRecallNotificationMessage,App需要在UI上刷新这条消息。 */ - (void)onRCIMMessageRecalled:(long)messageId; @@ -250,9 +245,9 @@ FOUNDATION_EXPORT NSString *const RCKitDispatchMessageReceiptRequestNotification /*! IMKit连接状态的的监听器 - + @discussion 设置IMKit的连接状态监听器,请参考RCIM的connectionStatusDelegate属性。 - + @warning 如果您使用IMKit,可以设置并实现此Delegate监听消息接收; 如果您使用IMLib,请使用RCIMClient中的RCIMClientReceiveMessageDelegate监听消息接收,而不要使用此监听器。 */ @@ -260,9 +255,9 @@ FOUNDATION_EXPORT NSString *const RCKitDispatchMessageReceiptRequestNotification /*! IMKit连接状态的的监听器 - + @param status SDK与融云服务器的连接状态 - + @discussion 如果您设置了IMKit消息监听之后,当SDK与融云服务器的连接状态发生变化时,会回调此方法。 */ - (void)onRCIMConnectionStatusChanged:(RCConnectionStatus)status; @@ -273,16 +268,16 @@ FOUNDATION_EXPORT NSString *const RCKitDispatchMessageReceiptRequestNotification /*! 融云IMKit核心类 - + @discussion 您需要通过sharedRCIM方法,获取单例对象 */ @interface RCIM : NSObject /*! 获取融云界面组件IMKit的核心类单例 - + @return 融云界面组件IMKit的核心类单例 - + @discussion 您可以通过此方法,获取IMKit的单例,访问对象中的属性和方法。 */ + (instancetype)sharedRCIM; @@ -291,12 +286,12 @@ FOUNDATION_EXPORT NSString *const RCKitDispatchMessageReceiptRequestNotification /*! 初始化融云SDK - + @param appKey 从融云开发者平台创建应用后获取到的App Key - + @discussion 您在使用融云SDK所有功能(包括显示SDK中或者继承于SDK的View)之前,您必须先调用此方法初始化SDK。 在App整个生命周期中,您只需要执行一次初始化。 - + @warning 如果您使用IMKit,请使用此方法初始化SDK; 如果您使用IMLib,请使用RCIMClient中的同名方法初始化,而不要使用此方法。 */ @@ -306,43 +301,43 @@ FOUNDATION_EXPORT NSString *const RCKitDispatchMessageReceiptRequestNotification /*! 与融云服务器建立连接 - + @param token 从您服务器端获取的token(用户身份令牌) @param successBlock 连接建立成功的回调 [userId:当前连接成功所用的用户ID @param errorBlock 连接建立失败的回调 [status:连接失败的错误码] @param tokenIncorrectBlock token错误或者过期的回调 - + @discussion 在App整个生命周期,您只需要调用一次此方法与融云服务器建立连接。 之后无论是网络出现异常或者App有前后台的切换等,SDK都会负责自动重连。 除非您已经手动将连接断开,否则您不需要自己再手动重连。 - + tokenIncorrectBlock有两种情况: 一是token错误,请您检查客户端初始化使用的AppKey和您服务器获取token使用的AppKey是否一致; 二是token过期,是因为您在开发者后台设置了token过期时间,您需要请求您的服务器重新获取token并再次用新的token建立连接。 - + @warning 如果您使用IMKit,请使用此方法建立与融云服务器的连接; 如果您使用IMLib,请使用RCIMClient中的同名方法建立与融云服务器的连接,而不要使用此方法。 - + 在tokenIncorrectBlock的情况下,您需要请求您的服务器重新获取token并建立连接,但是注意避免无限循环,以免影响App用户体验。 - + 此方法的回调并非为原调用线程,您如果需要进行UI操作,请注意切换到主线程。 */ - (void)connectWithToken:(NSString *)token success:(void (^)(NSString *userId))successBlock error:(void (^)(RCConnectErrorCode status))errorBlock - tokenIncorrect:(void (^)())tokenIncorrectBlock; + tokenIncorrect:(void (^)(void))tokenIncorrectBlock; /*! 断开与融云服务器的连接 - + @param isReceivePush App在断开连接之后,是否还接收远程推送 - + @discussion 因为SDK在前后台切换或者网络出现异常都会自动重连,会保证连接的可靠性。 所以除非您的App逻辑需要登出,否则一般不需要调用此方法进行手动断开。 - + @warning 如果您使用IMKit,请使用此方法断开与融云服务器的连接; 如果您使用IMLib,请使用RCIMClient中的同名方法断开与融云服务器的连接,而不要使用此方法。 - + isReceivePush指断开与融云服务器的连接之后,是否还接收远程推送。 [[RCIM sharedRCIM] disconnect:YES]与[[RCIM sharedRCIM] disconnect]完全一致; [[RCIM sharedRCIM] disconnect:NO]与[[RCIM sharedRCIM] logout]完全一致。 @@ -352,13 +347,13 @@ FOUNDATION_EXPORT NSString *const RCKitDispatchMessageReceiptRequestNotification /*! 断开与融云服务器的连接,但仍然接收远程推送 - + @discussion 因为SDK在前后台切换或者网络出现异常都会自动重连,会保证连接的可靠性。 所以除非您的App逻辑需要登出,否则一般不需要调用此方法进行手动断开。 - + @warning 如果您使用IMKit,请使用此方法断开与融云服务器的连接; 如果您使用IMLib,请使用RCIMClient中的同名方法断开与融云服务器的连接,而不要使用此方法。 - + [[RCIM sharedRCIM] disconnect:YES]与[[RCIM sharedRCIM] disconnect]完全一致; [[RCIM sharedRCIM] disconnect:NO]与[[RCIM sharedRCIM] logout]完全一致。 您只需要按照您的需求,使用disconnect:与disconnect以及logout三个接口其中一个即可。 @@ -367,13 +362,13 @@ FOUNDATION_EXPORT NSString *const RCKitDispatchMessageReceiptRequestNotification /*! 断开与融云服务器的连接,并不再接收远程推送 - + @discussion 因为SDK在前后台切换或者网络出现异常都会自动重连,会保证连接的可靠性。 所以除非您的App逻辑需要登出,否则一般不需要调用此方法进行手动断开。 - + @warning 如果您使用IMKit,请使用此方法断开与融云服务器的连接; 如果您使用IMLib,请使用RCIMClient中的同名方法断开与融云服务器的连接,而不要使用此方法。 - + [[RCIM sharedRCIM] disconnect:YES]与[[RCIM sharedRCIM] disconnect]完全一致; [[RCIM sharedRCIM] disconnect:NO]与[[RCIM sharedRCIM] logout]完全一致。 您只需要按照您的需求,使用disconnect:与disconnect以及logout三个接口其中一个即可。 @@ -384,7 +379,7 @@ FOUNDATION_EXPORT NSString *const RCKitDispatchMessageReceiptRequestNotification /*! IMKit连接状态的监听器 - + @warning 如果您使用IMKit,可以设置并实现此Delegate监听消息接收; 如果您使用IMLib,请使用RCIMClient中的RCIMClientReceiveMessageDelegate监听消息接收,而不要使用此方法。 */ @@ -392,7 +387,7 @@ FOUNDATION_EXPORT NSString *const RCKitDispatchMessageReceiptRequestNotification /*! 获取当前SDK的连接状态 - + @return 当前SDK的连接状态 */ - (RCConnectionStatus)getConnectionStatus; @@ -401,11 +396,11 @@ FOUNDATION_EXPORT NSString *const RCKitDispatchMessageReceiptRequestNotification /*! 注册自定义的消息类型 - + @param messageClass 自定义消息的类,该自定义消息需要继承于RCMessageContent - + @discussion 如果您需要自定义消息,必须调用此方法注册该自定义消息的消息类型,否则SDK将无法识别和解析该类型消息。 - + @warning 如果您使用IMKit,请使用此方法注册自定义的消息类型; 如果您使用IMLib,请使用RCIMClient中的同名方法注册自定义的消息类型,而不要使用此方法。 */ @@ -414,7 +409,7 @@ FOUNDATION_EXPORT NSString *const RCKitDispatchMessageReceiptRequestNotification #pragma mark 消息发送 /*! 发送消息(除图片消息、文件消息外的所有消息),会自动更新UI - + @param conversationType 发送消息的会话类型 @param targetId 发送消息的目标会话ID @param content 消息的内容 @@ -423,13 +418,13 @@ FOUNDATION_EXPORT NSString *const RCKitDispatchMessageReceiptRequestNotification @param successBlock 消息发送成功的回调 [messageId:消息的ID] @param errorBlock 消息发送失败的回调 [nErrorCode:发送失败的错误码, messageId:消息的ID] @return 发送的消息实体 - + @discussion 当接收方离线并允许远程推送时,会收到远程推送。 远程推送中包含两部分内容,一是pushContent,用于显示;二是pushData,用于携带不显示的数据。 - + SDK内置的消息类型,如果您将pushContent和pushData置为nil,会使用默认的推送格式进行远程推送。 自定义类型的消息,需要您自己设置pushContent和pushData来定义推送内容,否则将不会进行远程推送。 - + @warning 如果您使用IMKit,使用此方法发送消息SDK会自动更新UI; 如果您使用IMLib,请使用RCIMClient中的同名方法发送消息,不会自动更新UI。 */ @@ -443,7 +438,7 @@ FOUNDATION_EXPORT NSString *const RCKitDispatchMessageReceiptRequestNotification /*! 发送媒体文件消息,会自动更新UI - + @param conversationType 发送消息的会话类型 @param targetId 发送消息的目标会话ID @param content 消息的内容 @@ -454,13 +449,13 @@ FOUNDATION_EXPORT NSString *const RCKitDispatchMessageReceiptRequestNotification @param errorBlock 消息发送失败的回调 [errorCode:发送失败的错误码, messageId:消息的ID] @param cancelBlock 用户取消了消息发送的回调 [messageId:消息的ID] @return 发送的消息实体 - + @discussion 当接收方离线并允许远程推送时,会收到远程推送。 远程推送中包含两部分内容,一是pushContent,用于显示;二是pushData,用于携带不显示的数据。 - + SDK内置的消息类型,如果您将pushContent和pushData置为nil,会使用默认的推送格式进行远程推送。 自定义类型的消息,需要您自己设置pushContent和pushData来定义推送内容,否则将不会进行远程推送。 - + @warning 如果您使用IMKit,使用此方法发送媒体文件消息SDK会自动更新UI; 如果您使用IMLib,请使用RCIMClient中的同名方法发送媒体文件消息,不会自动更新UI。 */ @@ -476,42 +471,42 @@ FOUNDATION_EXPORT NSString *const RCKitDispatchMessageReceiptRequestNotification /*! 取消发送中的媒体信息 - + @param messageId 媒体消息的messageId - + @return YES表示取消成功,NO表示取消失败,即已经发送成功或者消息不存在。 */ - (BOOL)cancelSendMediaMessage:(long)messageId; /*! 下载消息中的媒体文件 - + @param messageId 消息ID @param progressBlock 下载进度更新的回调 [progress:当前的发送进度, 0 <= progress <= 100] @param successBlock 下载成功的回调 [mediaPath:下载完成后文件在本地的存储路径] @param errorBlock 下载失败的回调 [errorCode:下载失败的错误码] - @param cancelBlock 下载取消的回调 - + @param cancelBlock 下载取消的回调 + @discussion 媒体消息仅限于图片消息和文件消息。 */ - (void)downloadMediaMessage:(long)messageId progress:(void (^)(int progress))progressBlock success:(void (^)(NSString *mediaPath))successBlock error:(void (^)(RCErrorCode errorCode))errorBlock - cancel:(void (^)())cancelBlock; + cancel:(void (^)(void))cancelBlock; /*! 取消下载中的媒体信息 - + @param messageId 媒体消息的messageId - + @return YES表示取消成功,NO表示取消失败,即已经下载完成或者消息不存在。 */ - (BOOL)cancelDownloadMediaMessage:(long)messageId; /*! 发送图片消息,会自动更新UI - + @param conversationType 发送消息的会话类型 @param targetId 发送消息的目标会话ID @param content 消息的内容 @@ -521,16 +516,16 @@ FOUNDATION_EXPORT NSString *const RCKitDispatchMessageReceiptRequestNotification @param successBlock 消息发送成功的回调 [messageId:消息的ID] @param errorBlock 消息发送失败的回调 [errorCode:发送失败的错误码, messageId:消息的ID] @return 发送的消息实体 - + @discussion 当接收方离线并允许远程推送时,会收到远程推送。 远程推送中包含两部分内容,一是pushContent,用于显示;二是pushData,用于携带不显示的数据。 - + SDK内置的消息类型,如果您将pushContent和pushData置为nil,会使用默认的推送格式进行远程推送。 自定义类型的消息,需要您自己设置pushContent和pushData来定义推送内容,否则将不会进行远程推送。 - + 如果您使用IMKit,使用此方法发送图片消息SDK会自动更新UI; 如果您使用IMLib,请使用RCIMClient中的同名方法发送图片消息,不会自动更新UI。 - + @warning **已废弃,请勿使用。** 升级说明:如果您之前使用了此接口,可以直接替换为sendMediaMessage:targetId:content:pushContent:pushData:success:error:cancel:接口,行为和实现完全一致。 */ @@ -542,11 +537,11 @@ FOUNDATION_EXPORT NSString *const RCKitDispatchMessageReceiptRequestNotification progress:(void (^)(int progress, long messageId))progressBlock success:(void (^)(long messageId))successBlock error:(void (^)(RCErrorCode errorCode, long messageId))errorBlock -__deprecated_msg("已废弃,请使用sendMediaMessage函数。"); + __deprecated_msg("已废弃,请使用sendMediaMessage函数。"); /*! 发送定向消息,会自动更新UI - + @param conversationType 发送消息的会话类型 @param targetId 发送消息的目标会话ID @param userIdList 发送给的用户ID列表 @@ -556,13 +551,13 @@ __deprecated_msg("已废弃,请使用sendMediaMessage函数。"); @param successBlock 消息发送成功的回调 [messageId:消息的ID] @param errorBlock 消息发送失败的回调 [errorCode:发送失败的错误码, messageId:消息的ID] - + @return 发送的消息实体 - + @discussion 此方法用于在群组和讨论组中发送消息给其中的部分用户,其它用户不会收到这条消息。 如果您使用IMKit,使用此方法发送定向消息SDK会自动更新UI; 如果您使用IMLib,请使用RCIMClient中的同名方法发送定向消息,不会自动更新UI。 - + @warning 此方法目前仅支持群组和讨论组。 */ - (RCMessage *)sendDirectionalMessage:(RCConversationType)conversationType @@ -576,9 +571,9 @@ __deprecated_msg("已废弃,请使用sendMediaMessage函数。"); /*! 发起VoIP语音通话 - + @param targetId 要发起语音通话的对方的用户ID - + @warning 旧版本VoIP接口,不再支持,请升级到最新VoIP版本。 */ //- (void)startVoIPCallWithTargetId:(NSString *)targetId; @@ -586,7 +581,7 @@ __deprecated_msg("已废弃,请使用sendMediaMessage函数。"); #pragma mark 消息接收监听 /*! IMKit消息接收的监听器 - + @warning 如果您使用IMKit,可以设置并实现此Delegate监听消息接收; 如果您使用IMLib,请使用RCIMClient中的RCIMClientReceiveMessageDelegate监听消息接收,而不要使用此方法。 */ @@ -595,14 +590,14 @@ __deprecated_msg("已废弃,请使用sendMediaMessage函数。"); #pragma mark 消息通知提醒 /*! 是否关闭所有的本地通知,默认值是NO - + @discussion 当App处于后台时,默认会弹出本地通知提示,您可以通过将此属性设置为YES,关闭所有的本地通知。 */ @property(nonatomic, assign) BOOL disableMessageNotificaiton; /*! 是否关闭所有的前台消息提示音,默认值是NO - + @discussion 当App处于前台时,默认会播放消息提示音,您可以通过将此属性设置为YES,关闭所有的前台消息提示音。 */ @property(nonatomic, assign) BOOL disableMessageAlertSound; @@ -614,24 +609,25 @@ __deprecated_msg("已废弃,请使用sendMediaMessage函数。"); /*! 是否开启已读回执功能,默认值是NO - + @discussion 开启后会在会话页面消息显示之后会发送已读回执给对方。 - + @warning **已废弃,请勿使用。** 升级说明:请使用enabledReadReceiptConversationTypeList,设置开启回执的会话类型 */ -@property(nonatomic, assign) BOOL enableReadReceipt __deprecated_msg("已废弃,请使用enabledReadReceiptConversationTypeList,设置开启回执的会话类型。"); +@property(nonatomic, assign) BOOL enableReadReceipt __deprecated_msg( + "已废弃,请使用enabledReadReceiptConversationTypeList,设置开启回执的会话类型。"); /*! 开启已读回执功能的会话类型,默认为空 - + @discussion 这些会话类型的消息在会话页面显示了之后会发送已读回执。目前仅支持单聊、群聊和讨论组。 */ -@property(nonatomic, copy) NSArray* enabledReadReceiptConversationTypeList; +@property(nonatomic, copy) NSArray *enabledReadReceiptConversationTypeList; /*! 是否开启多端同步未读状态的功能,默认值是NO - + @discussion 开启之后,用户在其他端上阅读过的消息,当前客户端会清掉该消息的未读数。目前仅支持单聊、群聊、讨论组。 */ @property(nonatomic, assign) BOOL enableSyncReadStatus; @@ -653,10 +649,10 @@ __deprecated_msg("已废弃,请使用sendMediaMessage函数。"); /*! 是否在会话页面和会话列表界面显示未注册的消息类型,默认值是NO - + @discussion App不断迭代开发,可能会在以后的新版本中不断增加某些自定义类型的消息,但是已经发布的老版本无法识别此类消息。 针对这种情况,可以预先定义好未注册的消息的显示,以提升用户体验(如提示当前版本不支持,引导用户升级版本等) - + 未注册的消息,可以通过RCConversationViewController中的rcUnkownConversationCollectionView:cellForItemAtIndexPath:和rcUnkownConversationCollectionView:layout:sizeForItemAtIndexPath:方法定制在会话页面的显示。 未注册的消息,可以通过修改unknown_message_cell_tip字符串资源定制在会话列表界面的显示。 */ @@ -664,25 +660,24 @@ __deprecated_msg("已废弃,请使用sendMediaMessage函数。"); /*! 未注册的消息类型是否显示本地通知,默认值是NO - + @discussion App不断迭代开发,可能会在以后的新版本中不断增加某些自定义类型的消息,但是已经发布的老版本无法识别此类消息。 针对这种情况,可以预先定义好未注册的消息的显示,以提升用户体验(如提示当前版本不支持,引导用户升级版本等) - + 未注册的消息,可以通过修改unknown_message_notification_tip字符串资源定制本地通知的显示。 */ @property(nonatomic, assign) BOOL showUnkownMessageNotificaiton; /*! 语音消息的最大长度 - + @discussion 默认值是60s,有效值为不小于5秒,不大于60秒 */ @property(nonatomic, assign) NSUInteger maxVoiceDuration; - /*! APP是否独占音频 - + @discussion 默认是NO,录音结束之后会调用AVAudioSession 的 setActive:NO , 恢复其他后台APP播放的声音,如果设置成YES,不会调用 setActive:NO,这样不会中断当前APP播放的声音 (如果当前APP 正在播放音频,这时候如果调用SDK 的录音,可以设置这里为YES) @@ -693,7 +688,7 @@ __deprecated_msg("已废弃,请使用sendMediaMessage函数。"); /*! 创建讨论组 - + @param name 讨论组名称 @param userIdList 用户ID的列表 @param successBlock 创建讨论组成功的回调 [discussion:创建成功返回的讨论组对象] @@ -706,12 +701,12 @@ __deprecated_msg("已废弃,请使用sendMediaMessage函数。"); /*! 讨论组加人,将用户加入讨论组 - + @param discussionId 讨论组ID @param userIdList 需要加入的用户ID列表 @param successBlock 讨论组加人成功的回调 [discussion:讨论组加人成功返回的讨论组对象] @param errorBlock 讨论组加人失败的回调 [status:讨论组加人失败的错误码] - + @discussion 设置的讨论组名称长度不能超过40个字符,否则将会截断为前40个字符。 */ - (void)addMemberToDiscussion:(NSString *)discussionId @@ -721,14 +716,14 @@ __deprecated_msg("已废弃,请使用sendMediaMessage函数。"); /*! 讨论组踢人,将用户移出讨论组 - + @param discussionId 讨论组ID @param userId 需要移出的用户ID @param successBlock 讨论组踢人成功的回调 [discussion:讨论组踢人成功返回的讨论组对象] @param errorBlock 讨论组踢人失败的回调 [status:讨论组踢人失败的错误码] - + @discussion 如果当前登录用户不是此讨论组的创建者并且此讨论组没有开放加人权限,则会返回错误。 - + @warning 不能使用此接口将自己移除,否则会返回错误。 如果您需要退出该讨论组,可以使用-quitDiscussion:success:error:方法。 */ @@ -739,7 +734,7 @@ __deprecated_msg("已废弃,请使用sendMediaMessage函数。"); /*! 退出当前讨论组 - + @param discussionId 讨论组ID @param successBlock 退出成功的回调 [discussion:退出成功返回的讨论组对象] @param errorBlock 退出失败的回调 [status:退出失败的错误码] @@ -750,7 +745,7 @@ __deprecated_msg("已废弃,请使用sendMediaMessage函数。"); /*! 获取讨论组的信息 - + @param discussionId 需要获取信息的讨论组ID @param successBlock 获取讨论组信息成功的回调 [discussion:获取的讨论组信息] @param errorBlock 获取讨论组信息失败的回调 [status:获取讨论组信息失败的错误码] @@ -761,61 +756,62 @@ __deprecated_msg("已废弃,请使用sendMediaMessage函数。"); /*! 设置讨论组名称 - + @param discussionId 需要设置的讨论组ID @param discussionName 需要设置的讨论组名称,discussionName长度<=40 @param successBlock 设置成功的回调 @param errorBlock 设置失败的回调 [status:设置失败的错误码] - + @discussion 设置的讨论组名称长度不能超过40个字符,否则将会截断为前40个字符。 */ - (void)setDiscussionName:(NSString *)discussionId name:(NSString *)discussionName - success:(void (^)())successBlock + success:(void (^)(void))successBlock error:(void (^)(RCErrorCode status))errorBlock; /*! 设置讨论组是否开放加人权限 - + @param discussionId 论组ID @param isOpen 是否开放加人权限 @param successBlock 设置成功的回调 @param errorBlock 设置失败的回调[status:设置失败的错误码] - + @discussion 讨论组默认开放加人权限,即所有成员都可以加人。 如果关闭加人权限之后,只有讨论组的创建者有加人权限。 */ - (void)setDiscussionInviteStatus:(NSString *)discussionId isOpen:(BOOL)isOpen - success:(void (^)())successBlock + success:(void (^)(void))successBlock error:(void (^)(RCErrorCode status))errorBlock; #pragma mark - 用户信息、群组信息相关 /*! 当前登录的用户的用户信息 - + @discussion 与融云服务器建立连接之后,应该设置当前用户的用户信息,用于SDK显示和发送。 - + @warning 如果传入的用户信息中的用户ID与当前登录的用户ID不匹配,则将会忽略。 */ @property(nonatomic, strong) RCUserInfo *currentUserInfo; /*! 是否将用户信息和群组信息在本地持久化存储,默认值为NO - - @discussion 如果设置为NO,则SDK在需要显示用户信息时,会调用用户信息提供者获取用户信息并缓存到Cache,此Cache在App生命周期结束时会被移除,下次启动时会再次通过用户信息提供者获取信息。 + + @discussion + 如果设置为NO,则SDK在需要显示用户信息时,会调用用户信息提供者获取用户信息并缓存到Cache,此Cache在App生命周期结束时会被移除,下次启动时会再次通过用户信息提供者获取信息。 如果设置为YES,则会将获取到的用户信息持久化存储在本地,App下次启动时Cache会仍然有效。 */ @property(nonatomic, assign) BOOL enablePersistentUserInfoCache; /*! 是否在发送的所有消息中携带当前登录的用户信息,默认值为NO - + @discussion 如果设置为YES,则会在每一条发送的消息中携带当前登录用户的用户信息。 收到一条携带了用户信息的消息,SDK会将其信息加入用户信息的cache中并显示; 若消息中不携带用户信息,则仍然会通过用户信息提供者获取用户信息进行显示。 - + @warning 需要先设置当前登录用户的用户信息,参考RCIM的currentUserInfo。 */ @property(nonatomic, assign) BOOL enableMessageAttachUserInfo; @@ -824,27 +820,26 @@ __deprecated_msg("已废弃,请使用sendMediaMessage函数。"); /*! 用户信息提供者 - + @discussion SDK需要通过您实现的用户信息提供者,获取用户信息并显示。 */ @property(nonatomic, weak) id userInfoDataSource; /*! 更新SDK中的用户信息缓存 - + @param userInfo 需要更新的用户信息 @param userId 需要更新的用户ID - + @discussion 使用此方法,可以更新SDK缓存的用户信息。 但是处于性能和使用场景权衡,SDK不会在当前View立即自动刷新(会在切换到其他View的时候再刷新该用户的显示信息)。 如果您想立即刷新,您可以在会话列表或者会话页面reload强制刷新。 */ -- (void)refreshUserInfoCache:(RCUserInfo *)userInfo - withUserId:(NSString *)userId; +- (void)refreshUserInfoCache:(RCUserInfo *)userInfo withUserId:(NSString *)userId; /*! 获取SDK中缓存的用户信息 - + @param userId 用户ID @return SDK中缓存的用户信息 */ @@ -852,7 +847,7 @@ __deprecated_msg("已废弃,请使用sendMediaMessage函数。"); /*! 清空SDK中所有的用户信息缓存 - + @discussion 使用此方法,会清空SDK中所有的用户信息缓存。 但是处于性能和使用场景权衡,SDK不会在当前View立即自动刷新(会在切换到其他View的时候再刷新所显示的用户信息)。 如果您想立即刷新,您可以在会话列表或者会话页面reload强制刷新。 @@ -862,27 +857,26 @@ __deprecated_msg("已废弃,请使用sendMediaMessage函数。"); #pragma mark 群组信息 /*! 群组信息提供者 - + @discussion SDK需要通过您实现的群组信息提供者,获取群组信息并显示。 */ @property(nonatomic, weak) id groupInfoDataSource; /*! 更新SDK中的群组信息缓存 - + @param groupInfo 需要更新的群组信息 @param groupId 需要更新的群组ID - + @discussion 使用此方法,可以更新SDK缓存的群组信息。 但是处于性能和使用场景权衡,SDK不会在当前View立即自动刷新(会在切换到其他View的时候再刷新该群组的显示信息)。 如果您想立即刷新,您可以在会话列表或者会话页面reload强制刷新。 */ -- (void)refreshGroupInfoCache:(RCGroup *)groupInfo - withGroupId:(NSString *)groupId; +- (void)refreshGroupInfoCache:(RCGroup *)groupInfo withGroupId:(NSString *)groupId; /*! 获取SDK中缓存的群组信息 - + @param groupId 群组ID @return SDK中缓存的群组信息 */ @@ -890,7 +884,7 @@ __deprecated_msg("已废弃,请使用sendMediaMessage函数。"); /*! 清空SDK中所有的群组信息缓存 - + @discussion 使用此方法,会清空SDK中所有的群组信息缓存。 但是处于性能和使用场景权衡,SDK不会在当前View立即自动刷新(会在切换到其他View的时候再刷新所显示的群组信息)。 如果您想立即刷新,您可以在会话列表或者会话页面reload强制刷新。 @@ -901,39 +895,36 @@ __deprecated_msg("已废弃,请使用sendMediaMessage函数。"); /*! 群名片信息提供者 - + @discussion 如果您使用了群名片功能,SDK需要通过您实现的群名片信息提供者,获取用户在群组中的名片信息并显示。 */ @property(nonatomic, weak) id groupUserInfoDataSource; /*! 获取SDK中缓存的群名片信息 - + @param userId 用户ID @param groupId 群组ID @return 群名片信息 */ -- (RCUserInfo *)getGroupUserInfoCache:(NSString *)userId - withGroupId:(NSString *)groupId; +- (RCUserInfo *)getGroupUserInfoCache:(NSString *)userId withGroupId:(NSString *)groupId; /*! 更新SDK中的群名片信息缓存 - + @param userInfo 需要更新的用户信息 @param userId 需要更新的用户ID @param groupId 需要更新群名片信息的群组ID - + @discussion 使用此方法,可以更新SDK缓存的群名片信息。 但是处于性能和使用场景权衡,SDK不会在当前View立即自动刷新(会在切换到其他View的时候再刷新该群名片的显示信息)。 如果您想立即刷新,您可以在会话列表或者会话页面reload强制刷新。 */ -- (void)refreshGroupUserInfoCache:(RCUserInfo *)userInfo - withUserId:(NSString *)userId - withGroupId:(NSString *)groupId; +- (void)refreshGroupUserInfoCache:(RCUserInfo *)userInfo withUserId:(NSString *)userId withGroupId:(NSString *)groupId; /*! 清空SDK中所有的群名片信息缓存 - + @discussion 使用此方法,会清空SDK中所有的群名片信息缓存。 但是处于性能和使用场景权衡,SDK不会在当前View立即自动刷新(会在切换到其他View的时候再刷新所显示的群名片信息)。 如果您想立即刷新,您可以在会话列表或者会话页面reload强制刷新。 @@ -944,7 +935,7 @@ __deprecated_msg("已废弃,请使用sendMediaMessage函数。"); /*! 群成员信息提供者 - + @discussion 如果您使用了@功能,SDK需要通过您实现的群用户成员提供者,获取群组中的用户列表。 */ @property(nonatomic, weak) id groupMemberDataSource; @@ -953,42 +944,42 @@ __deprecated_msg("已废弃,请使用sendMediaMessage函数。"); /*! SDK中全局的导航按钮字体颜色 - + @discussion 默认值为[UIColor whiteColor] */ @property(nonatomic, strong) UIColor *globalNavigationBarTintColor; /*! SDK会话列表界面中显示的头像形状,矩形或者圆形 - + @discussion 默认值为矩形,即RC_USER_AVATAR_RECTANGLE */ @property(nonatomic) RCUserAvatarStyle globalConversationAvatarStyle; /*! SDK会话列表界面中显示的头像大小,高度必须大于或者等于36 - + @discussion 默认值为46*46 */ @property(nonatomic) CGSize globalConversationPortraitSize; /*! SDK会话页面中显示的头像形状,矩形或者圆形 - + @discussion 默认值为矩形,即RC_USER_AVATAR_RECTANGLE */ @property(nonatomic) RCUserAvatarStyle globalMessageAvatarStyle; /*! SDK会话页面中显示的头像大小 - + @discussion 默认值为40*40 */ @property(nonatomic) CGSize globalMessagePortraitSize; /*! SDK会话列表界面和会话页面的头像的圆角曲率半径 - + @discussion 默认值为4,只有当头像形状设置为矩形时才会生效。 参考RCIM的globalConversationAvatarStyle和globalMessageAvatarStyle。 */ @@ -997,7 +988,7 @@ __deprecated_msg("已废弃,请使用sendMediaMessage函数。"); #pragma mark - 网页展示模式 /*! 点击Cell中的URL时,优先使用WebView还是SFSafariViewController打开。 - + @discussion 默认为NO。 如果设置为YES,将使用WebView打开URL链接,则您需要在App的Info.plist的NSAppTransportSecurity中增加NSAllowsArbitraryLoadsInWebContent和NSAllowsArbitraryLoads字段,并在苹果审核的时候提供额外的说明。 如果设置为NO,将优先使用SFSafariViewController,在iOS 8及之前的系统中使用WebView,在审核的时候不需要提供额外说明。 @@ -1010,14 +1001,16 @@ __deprecated_msg("已废弃,请使用sendMediaMessage函数。"); 设置Extension Module的URL scheme。 @param scheme URL scheme @param moduleName Extension module name - - @discussion 有些第三方扩展(比如红包)需要打开其他应用(比如使用支付宝进行支付),然后等待返回结果。因此首先要为第三方扩展设置一个URL scheme并加入到info.plist中,然后再告诉该扩展模块scheme。 + + @discussion + 有些第三方扩展(比如红包)需要打开其他应用(比如使用支付宝进行支付),然后等待返回结果。因此首先要为第三方扩展设置一个URL + scheme并加入到info.plist中,然后再告诉该扩展模块scheme。 */ - (void)setScheme:(NSString *)scheme forExtensionModule:(NSString *)moduleName; /*! 第三方扩展处理openUrl - + @param url url @return YES处理,NO未处理。 */ diff --git a/ios-rongcallkit/framework/RongIMKit.framework/Headers/RCImageMessageCell.h b/ios-rongcallkit/framework/RongIMKit.framework/Headers/RCImageMessageCell.h index 1d43135..35144e4 100644 --- a/ios-rongcallkit/framework/RongIMKit.framework/Headers/RCImageMessageCell.h +++ b/ios-rongcallkit/framework/RongIMKit.framework/Headers/RCImageMessageCell.h @@ -6,8 +6,8 @@ // Copyright (c) 2015年 RongCloud. All rights reserved. // -#import "RCMessageCell.h" #import "RCImageMessageProgressView.h" +#import "RCMessageCell.h" /*! 图片消息Cell diff --git a/ios-rongcallkit/framework/RongIMKit.framework/Headers/RCImageMessageProgressView.h b/ios-rongcallkit/framework/RongIMKit.framework/Headers/RCImageMessageProgressView.h index 9a7de31..ddabd6d 100644 --- a/ios-rongcallkit/framework/RongIMKit.framework/Headers/RCImageMessageProgressView.h +++ b/ios-rongcallkit/framework/RongIMKit.framework/Headers/RCImageMessageProgressView.h @@ -25,7 +25,7 @@ /*! 更新进度 - + @param progress 进度值,0 <= progress <= 100 */ - (void)updateProgress:(NSInteger)progress; diff --git a/ios-rongcallkit/framework/RongIMKit.framework/Headers/RCImagePreviewController.h b/ios-rongcallkit/framework/RongIMKit.framework/Headers/RCImagePreviewController.h index 167d500..65c611c 100644 --- a/ios-rongcallkit/framework/RongIMKit.framework/Headers/RCImagePreviewController.h +++ b/ios-rongcallkit/framework/RongIMKit.framework/Headers/RCImagePreviewController.h @@ -6,9 +6,9 @@ // Copyright (c) 2014年 Heq.Shinoda. All rights reserved. // -#import #import "RCBaseViewController.h" #import "RCImageMessageProgressView.h" +#import @class RCMessageModel; @@ -34,9 +34,9 @@ /*! 取消按钮的点击事件 - + @param sender 取消按钮 - + @discussion SDK在此方法中,会针对默认的NavigationBar退出当前界面; 如果您使用自定义导航按钮或者自定义按钮,可以重写此方法退出当前界面。 */ @@ -44,9 +44,9 @@ /*! 保存按钮的点击事件 - + @param sender 保存按钮 - + @discussion SDK在此方法中,默认会进行图片的保存。 */ - (void)rightBarButtonItemPressed:(id)sender; diff --git a/ios-rongcallkit/framework/RongIMKit.framework/Headers/RCKitUtility.h b/ios-rongcallkit/framework/RongIMKit.framework/Headers/RCKitUtility.h index 8a16972..55ef8e6 100644 --- a/ios-rongcallkit/framework/RongIMKit.framework/Headers/RCKitUtility.h +++ b/ios-rongcallkit/framework/RongIMKit.framework/Headers/RCKitUtility.h @@ -7,8 +7,8 @@ // #import -#import #import +#import @class RCConversationModel; @@ -19,10 +19,10 @@ /*! 时间转换 - + @param secs Unix时间戳(秒) @return 可视化的时间字符串 - + @discussion 如果该时间是今天的,则返回值为"HH:mm"格式的字符串; 如果该时间是昨天的,则返回字符串资源中Yesterday对应语言的字符串; 如果该时间是昨天之前或者今天之后的,则返回"yyyy-MM-dd"的字符串。 @@ -31,10 +31,10 @@ /*! 时间转换 - + @param secs Unix时间戳(秒) @return 可视化的时间字符串 - + @discussion 如果该时间是今天的,则返回值为"HH:mm"格式的字符串; 如果该时间是昨天的,则返回"Yesterday HH:mm"的字符串(其中,Yesterday为字符串资源中Yesterday对应语言的字符串); 如果该时间是昨天之前或者今天之后的,则返回"yyyy-MM-dd HH:mm"的字符串。 @@ -43,7 +43,7 @@ /*! 获取资源包中的图片 - + @param name 图片名 @param bundleName 图片所在的Bundle名 @return 图片 @@ -52,7 +52,7 @@ /*! 获取指定颜色的图片 - + @param color 颜色值 @return 坐标为(0.0f, 0.0f, 1.0f, 1.0f)的纯色图片 */ @@ -60,23 +60,23 @@ /*! 获取文字显示的尺寸 - + @param text 文字 @param font 字体 @param constrainedSize 文字显示的容器大小 - + @return 文字显示的尺寸 - + @discussion 该方法在计算iOS 7以下系统显示的时候默认使用NSLineBreakByTruncatingTail模式。 */ + (CGSize)getTextDrawingSize:(NSString *)text font:(UIFont *)font constrainedSize:(CGSize)constrainedSize; /*! 获取消息内容的摘要 - + @param messageContent 消息内容 @return 消息内容的摘要 - + @discussion SDK默认的消息有内置的处理, 自定义消息会调用RCMessageContent中RCMessageContentView协议的conversationDigest获取消息摘要。 */ @@ -84,7 +84,7 @@ /*! 消息是否需要显示 - + @param message 消息 @return 是否需要显示 */ @@ -92,7 +92,7 @@ /*! 消息是否需要显示 - + @param messageId 消息ID @param content 消息内容 @return 是否需要显示 @@ -101,7 +101,7 @@ /*! 以消息的类型名为Key值在字符串资源中查找对应语言的字符串 - + @param messageContent 消息内容 @return 对应语言的字符串 */ @@ -109,7 +109,7 @@ /*! 获取消息对应的本地消息Dictionary - + @param message 消息实体 @return 本地通知的Dictionary */ @@ -117,32 +117,38 @@ /*! 获取消息对应的本地消息Dictionary(已废弃,请勿使用) - + @param conversationType 会话类型 @param fromUserId 发送者的用户ID @param targetId 消息的目标会话ID @param messageContent 消息内容 @return 本地通知的Dictionary - + @warning **已废弃,请勿使用。** */ -+ (NSDictionary *)getNotificationUserInfoDictionary:(RCConversationType)conversationType fromUserId:(NSString *)fromUserId targetId:(NSString *)targetId messageContent:(RCMessageContent *)messageContent -__deprecated_msg("已废弃,请勿使用。"); ++ (NSDictionary *)getNotificationUserInfoDictionary:(RCConversationType)conversationType + fromUserId:(NSString *)fromUserId + targetId:(NSString *)targetId + messageContent:(RCMessageContent *)messageContent + __deprecated_msg("已废弃,请勿使用。"); /*! 获取消息对应的本地消息Dictionary - + @param conversationType 会话类型 @param fromUserId 发送者的用户ID @param targetId 消息的目标会话ID @param objectName 消息的类型名 @return 本地通知的Dictionary */ -+ (NSDictionary *)getNotificationUserInfoDictionary:(RCConversationType)conversationType fromUserId:(NSString *)fromUserId targetId:(NSString *)targetId objectName:(NSString *)objectName; ++ (NSDictionary *)getNotificationUserInfoDictionary:(RCConversationType)conversationType + fromUserId:(NSString *)fromUserId + targetId:(NSString *)targetId + objectName:(NSString *)objectName; /*! 获取文件消息中消息类型对应的图片名称 - + @param fileType 文件类型 @return 图片名称 */ @@ -150,7 +156,7 @@ __deprecated_msg("已废弃,请勿使用。"); /*! 获取文件大小的字符串,单位是k - + @param byteSize 文件大小,单位是byte @return 文件大小的字符串 */ @@ -158,7 +164,7 @@ __deprecated_msg("已废弃,请勿使用。"); /*! 获取会话默认的占位头像 - + @param model 会话数据模型 @return 默认的占位头像 */ @@ -166,7 +172,7 @@ __deprecated_msg("已废弃,请勿使用。"); /*! 获取聚合显示的会话标题 - + @param conversationType 聚合显示的会话类型 @return 显示的标题 */ @@ -174,7 +180,7 @@ __deprecated_msg("已废弃,请勿使用。"); /*! 获取会话模型对应的未读数 - + @param model 会话数据模型 @return 未读消息数 */ @@ -182,7 +188,7 @@ __deprecated_msg("已废弃,请勿使用。"); /*! 会话模型是否包含未读的@消息 - + @param model 会话数据模型 @return 是否包含未读的@消息 */ @@ -190,25 +196,25 @@ __deprecated_msg("已废弃,请勿使用。"); /*! 同步会话多端阅读状态 - + @param conversation 会话 - + @discussion 会根据已经设置的RCIM的enabledReadReceiptConversationTypeList属性进行过滤、同步。 */ + (void)syncConversationReadStatusIfEnabled:(RCConversation *)conversation; /*! 获取汉字对应的拼音首字母 - + @param hanZi 汉字 - + @return 拼音首字母 */ + (NSString *)getPinYinUpperFirstLetters:(NSString *)hanZi; /*! 在SFSafariViewController或WebViewController中打开URL - + @param url URL @param viewController 基于哪个页面弹出新的页面 */ @@ -231,5 +237,5 @@ __deprecated_msg("已废弃,请勿使用。"); /*! 验证邮箱 */ -+ (BOOL) validateEmail:(NSString *)email; ++ (BOOL)validateEmail:(NSString *)email; @end diff --git a/ios-rongcallkit/framework/RongIMKit.framework/Headers/RCLocationMessageCell.h b/ios-rongcallkit/framework/RongIMKit.framework/Headers/RCLocationMessageCell.h index ab6f0a4..1e49dab 100644 --- a/ios-rongcallkit/framework/RongIMKit.framework/Headers/RCLocationMessageCell.h +++ b/ios-rongcallkit/framework/RongIMKit.framework/Headers/RCLocationMessageCell.h @@ -6,8 +6,8 @@ // Copyright (c) 2015年 RongCloud. All rights reserved. // -#import "RCMessageCell.h" #import "RCImageMessageProgressView.h" +#import "RCMessageCell.h" /*! 位置消息Cell diff --git a/ios-rongcallkit/framework/RongIMKit.framework/Headers/RCLocationPickerViewController.h b/ios-rongcallkit/framework/RongIMKit.framework/Headers/RCLocationPickerViewController.h index bb28e2d..a12e06e 100644 --- a/ios-rongcallkit/framework/RongIMKit.framework/Headers/RCLocationPickerViewController.h +++ b/ios-rongcallkit/framework/RongIMKit.framework/Headers/RCLocationPickerViewController.h @@ -6,13 +6,13 @@ // Copyright (c) 2014年 RongCloud. All rights reserved. // -#import #import +#import #import /*! POI搜索结束后的回调block - + @param pois 需要显示的POI列表 @param clearPreviousResult 如果地图位置已经发生变化,需要清空之前的POI数据 @param hasMore 如果POI数据很多,可以进行“更多”显示 @@ -27,7 +27,7 @@ typedef void (^OnPoiSearchResult)(NSArray *pois, BOOL clearPreviousResult, BOOL 地理位置选取的ViewController */ @interface RCLocationPickerViewController -: UIViewController + : UIViewController /*! 地理位置选择完成之后的回调 @@ -46,7 +46,7 @@ typedef void (^OnPoiSearchResult)(NSArray *pois, BOOL clearPreviousResult, BOOL /*! 初始化地理位置选取的ViewController - + @param dataSource 位置选择的数据源 @return 地理位置选取的ViewController对象 */ @@ -54,9 +54,9 @@ typedef void (^OnPoiSearchResult)(NSArray *pois, BOOL clearPreviousResult, BOOL /*! 退出当前界面 - + @param sender 返回按钮 - + @discussion SDK在此方法中,会针对默认的NavigationBar退出当前界面; 如果您使用自定义导航按钮或者自定义按钮,可以重写此方法退出当前界面。 */ @@ -64,9 +64,9 @@ typedef void (^OnPoiSearchResult)(NSArray *pois, BOOL clearPreviousResult, BOOL /*! 完成位置获取 - + @param sender 完成按钮 - + @discussion 点击完成按钮的后会调用本函数。 */ - (void)rightBarButtonItemPressed:(id)sender; @@ -81,23 +81,23 @@ typedef void (^OnPoiSearchResult)(NSArray *pois, BOOL clearPreviousResult, BOOL /*! 获取显示的地图控件 - + @return 在界面上显示的地图控件 */ - (UIView *)mapView; /*! 获取显示的中心点标记 - + @return 界面上显示的中心点标记 - + @discussion 如不想显示中心点标记,可以返回nil。 */ - (CALayer *)annotationLayer; /*! 获取位置标注的名称 - + @param placeMark 位置标注 @return 位置标注的名称 */ @@ -105,7 +105,7 @@ typedef void (^OnPoiSearchResult)(NSArray *pois, BOOL clearPreviousResult, BOOL /*! 获取位置标注的坐标 - + @param placeMark 位置标注 @return 位置标注的二维坐标值 */ @@ -113,7 +113,7 @@ typedef void (^OnPoiSearchResult)(NSArray *pois, BOOL clearPreviousResult, BOOL /*! 设置地图显示的中心点坐标 - + @param location 中心点坐标 @param animated 是否开启动画效果 */ @@ -121,7 +121,7 @@ typedef void (^OnPoiSearchResult)(NSArray *pois, BOOL clearPreviousResult, BOOL /*! 设置地图显示区域 - + @param coordinateRegion 地图显示区域 @param animated 是否开启动画效果 */ @@ -129,9 +129,9 @@ typedef void (^OnPoiSearchResult)(NSArray *pois, BOOL clearPreviousResult, BOOL /*! 选择位置标示 - + @param placeMark 选择的位置标注 - + @discussion 开发者自己实现的RCLocationPickerViewControllerDataSource可以据此进行特定处理。 当有新的POI列表时,默认选中第一个。 */ @@ -139,14 +139,14 @@ typedef void (^OnPoiSearchResult)(NSArray *pois, BOOL clearPreviousResult, BOOL /*! 获取地图当前中心点的坐标 - + @return 当前地图中心点 */ - (CLLocationCoordinate2D)mapViewCenter; /*! 设置POI搜索完毕后的回调 - + @param poiSearchResult POI查询结果 */ - (void)setOnPoiSearchResult:(OnPoiSearchResult)poiSearchResult; @@ -158,7 +158,7 @@ typedef void (^OnPoiSearchResult)(NSArray *pois, BOOL clearPreviousResult, BOOL /*! 获取位置在地图中的缩略图 - + @return 位置在地图中的缩略图 */ - (UIImage *)mapViewScreenShot; @@ -172,13 +172,14 @@ typedef void (^OnPoiSearchResult)(NSArray *pois, BOOL clearPreviousResult, BOOL /*! 地理位置选择完成之后的回调 - + @param locationPicker 地理位置选取的ViewController @param location 位置的二维坐标 @param locationName 位置的名称 @param mapScreenShot 位置在地图中的缩略图 - - @discussion 如果您需要重写地理位置选择的界面,当选择地理位置完成后,需要调用此回调通知RCConversationViewController定位已完成,可以进一步生成位置消息并发送。 + + @discussion + 如果您需要重写地理位置选择的界面,当选择地理位置完成后,需要调用此回调通知RCConversationViewController定位已完成,可以进一步生成位置消息并发送。 */ - (void)locationPicker:(RCLocationPickerViewController *)locationPicker didSelectLocation:(CLLocationCoordinate2D)location diff --git a/ios-rongcallkit/framework/RongIMKit.framework/Headers/RCLocationViewController.h b/ios-rongcallkit/framework/RongIMKit.framework/Headers/RCLocationViewController.h index 6534176..9e41c7a 100644 --- a/ios-rongcallkit/framework/RongIMKit.framework/Headers/RCLocationViewController.h +++ b/ios-rongcallkit/framework/RongIMKit.framework/Headers/RCLocationViewController.h @@ -27,9 +27,9 @@ /*! 返回按钮的点击事件 - + @param sender 返回按钮 - + @discussion SDK在此方法中,会针对默认的NavigationBa退出当前界面; 如果您使用自定义导航按钮或者自定义按钮,可以重写此方法退出当前界面。 */ diff --git a/ios-rongcallkit/framework/RongIMKit.framework/Headers/RCMessageBaseCell.h b/ios-rongcallkit/framework/RongIMKit.framework/Headers/RCMessageBaseCell.h index 84510fa..ca41b97 100644 --- a/ios-rongcallkit/framework/RongIMKit.framework/Headers/RCMessageBaseCell.h +++ b/ios-rongcallkit/framework/RongIMKit.framework/Headers/RCMessageBaseCell.h @@ -6,12 +6,12 @@ // Copyright (c) 2015年 RongCloud. All rights reserved. // -#import -#import -#import "RCMessageModel.h" -#import "RCMessageCellNotificationModel.h" #import "RCMessageCellDelegate.h" +#import "RCMessageCellNotificationModel.h" +#import "RCMessageModel.h" #import "RCTipLabel.h" +#import +#import /*! 消息发送状态更新的Notification @@ -22,7 +22,7 @@ UIKIT_EXTERN NSString *const KNotificationMessageBaseCellUpdateSendingStatus; /*! 消息Cell基类 - + @discussion 消息Cell基类包含了所有消息Cell的必要信息。 消息Cell基类针对用户头像是否显示,主要可以分为两类的: 一是提醒类的Cell,不显示用户信息,如:RCTipMessageCell和RCUnknownMessageCell; @@ -34,13 +34,13 @@ UIKIT_EXTERN NSString *const KNotificationMessageBaseCellUpdateSendingStatus; /*! 自定义消息Cell的Size - + @param model 要显示的消息model @param collectionViewWidth cell所在的collectionView的宽度 @param extraHeight cell内容区域之外的高度 - + @return 自定义消息Cell的Size - + @discussion 当应用自定义消息时,必须实现该方法来返回cell的Size。 其中,extraHeight是Cell根据界面上下文,需要额外显示的高度(比如时间、用户名的高度等)。 一般而言,Cell的高度应该是内容显示的高度再加上extraHeight的高度。 @@ -86,7 +86,7 @@ UIKIT_EXTERN NSString *const KNotificationMessageBaseCellUpdateSendingStatus; /*! 初始化消息Cell - + @param frame 显示的Frame @return 消息Cell基类对象 */ @@ -94,14 +94,14 @@ UIKIT_EXTERN NSString *const KNotificationMessageBaseCellUpdateSendingStatus; /*! 设置当前消息Cell的数据模型 - + @param model 消息Cell的数据模型 */ - (void)setDataModel:(RCMessageModel *)model; /*! 消息发送状态更新的监听回调 - + @param notification 消息发送状态更新的Notification */ - (void)messageCellUpdateSendingStatusEvent:(NSNotification *)notification; diff --git a/ios-rongcallkit/framework/RongIMKit.framework/Headers/RCMessageBubbleTipView.h b/ios-rongcallkit/framework/RongIMKit.framework/Headers/RCMessageBubbleTipView.h index a22a744..f6223c2 100644 --- a/ios-rongcallkit/framework/RongIMKit.framework/Headers/RCMessageBubbleTipView.h +++ b/ios-rongcallkit/framework/RongIMKit.framework/Headers/RCMessageBubbleTipView.h @@ -62,7 +62,7 @@ typedef NS_ENUM(NSInteger, RCMessageBubbleTipViewAlignment) { /*! 角标的位置 - + @discussion 默认值为RC_MESSAGE_BUBBLE_TIP_VIEW_ALIGNMENT_TOP_RIGHT,即右上。 */ @property(nonatomic, assign) RCMessageBubbleTipViewAlignment bubbleTipAlignment; @@ -94,7 +94,7 @@ typedef NS_ENUM(NSInteger, RCMessageBubbleTipViewAlignment) { /*! 角标的覆盖颜色(已废弃,请勿使用) - + @warning **已废弃,请勿使用。** */ @property(nonatomic, strong) __deprecated_msg("已废弃,请勿使用。") UIColor *bubbleTipOverlayColor; @@ -111,14 +111,14 @@ typedef NS_ENUM(NSInteger, RCMessageBubbleTipViewAlignment) { /*! 角标是否显示数字 - + @discussion 如果为NO,会显示红点,不显示具体数字。 */ @property(nonatomic) BOOL isShowNotificationNumber; /*! 初始化角标View - + @param parentView 角标依附于的View @param alignment 角标的位置 @return 角标View对象 @@ -127,7 +127,7 @@ typedef NS_ENUM(NSInteger, RCMessageBubbleTipViewAlignment) { /*! 设置角标的值 - + @param msgCount 角标值 */ - (void)setBubbleTipNumber:(int)msgCount; diff --git a/ios-rongcallkit/framework/RongIMKit.framework/Headers/RCMessageCell.h b/ios-rongcallkit/framework/RongIMKit.framework/Headers/RCMessageCell.h index 2d5a454..d4d6ff9 100644 --- a/ios-rongcallkit/framework/RongIMKit.framework/Headers/RCMessageCell.h +++ b/ios-rongcallkit/framework/RongIMKit.framework/Headers/RCMessageCell.h @@ -6,11 +6,11 @@ // Copyright (c) 2015年 RongCloud. All rights reserved. // +#import "RCContentView.h" #import "RCMessageBaseCell.h" -#import "RCThemeDefine.h" -#import "RCMessageCellNotificationModel.h" #import "RCMessageCellDelegate.h" -#import "RCContentView.h" +#import "RCMessageCellNotificationModel.h" +#import "RCThemeDefine.h" //#define PORTRAIT_WIDTH 45 //#define PORTRAIT_HEIGHT 45 @@ -20,7 +20,7 @@ /*! 展示的消息Cell类 - + @discussion 需要展示用户信息和内容的消息Cell可以继承此类, 如:RCTextMessageCell、RCImageMessageCell、RCLocationMessageCell、RCVoiceMessageCell、RCRichContentMessageCell等。 如果您需要显示自定义消息,可以继承此类。 @@ -44,7 +44,7 @@ /*! 显示发送状态的View - + @discussion 其中包含messageFailedStatusView子View。 */ @property(nonatomic, strong) UIView *statusContentView; @@ -81,28 +81,28 @@ /*! 显示是否消息回执的Button - + @discussion 仅在群组和讨论组中显示 */ @property(nonatomic, strong) UIButton *receiptView; /*! 消息阅读人数的Label - + @discussion 仅在群组和讨论组中显示 */ @property(nonatomic, strong) UILabel *receiptCountLabel; /*! 显示群是否消息回执的Button - + @warning 如果您使用了该属性,可以迁移到receiptView,完全一致。 */ @property(nonatomic, strong) UIButton *groupAndDiscussionReceiptView __deprecated_msg("已废弃,请勿使用。"); /*! 消息阅读人数的Label - + @warning 如果您使用了该属性,可以迁移到receiptCountLabel,完全一致。 */ @property(nonatomic, strong) UILabel *groupAndDiscussionReceiptCountView __deprecated_msg("已废弃,请勿使用。"); @@ -114,14 +114,14 @@ /*! 设置当前消息Cell的数据模型 - + @param model 消息Cell的数据模型 */ - (void)setDataModel:(RCMessageModel *)model; /*! 更新消息发送状态 - + @param model 消息Cell的数据模型 */ - (void)updateStatusContentView:(RCMessageModel *)model; diff --git a/ios-rongcallkit/framework/RongIMKit.framework/Headers/RCMessageCellDelegate.h b/ios-rongcallkit/framework/RongIMKit.framework/Headers/RCMessageCellDelegate.h index 36a58e0..7ad0b6b 100644 --- a/ios-rongcallkit/framework/RongIMKit.framework/Headers/RCMessageCellDelegate.h +++ b/ios-rongcallkit/framework/RongIMKit.framework/Headers/RCMessageCellDelegate.h @@ -16,48 +16,48 @@ /*! 点击Cell内容的回调 - + @param model 消息Cell的数据模型 */ - (void)didTapMessageCell:(RCMessageModel *)model; /*! 点击Cell中URL的回调 - + @param url 点击的URL @param model 消息Cell的数据模型 - + @discussion 点击Cell中的URL,会调用此回调,不会再触发didTapMessageCell:。 */ - (void)didTapUrlInMessageCell:(NSString *)url model:(RCMessageModel *)model; /*! 点击Cell中电话号码的回调 - + @param phoneNumber 点击的电话号码 @param model 消息Cell的数据模型 - + @discussion 点击Cell中的电话号码,会调用此回调,不会再触发didTapMessageCell:。 */ -- (void)didTapPhoneNumberInMessageCell:(NSString *) phoneNumber model:(RCMessageModel *)model; +- (void)didTapPhoneNumberInMessageCell:(NSString *)phoneNumber model:(RCMessageModel *)model; /*! 点击Cell中用户头像的回调 - + @param userId 头像对应的用户ID */ - (void)didTapCellPortrait:(NSString *)userId; /*! 长按Cell中用户头像的回调 - + @param userId 头像对应的用户ID */ - (void)didLongPressCellPortrait:(NSString *)userId; /*! 长按Cell内容的回调 - + @param model 消息Cell的数据模型 @param view 长按区域的View */ @@ -65,25 +65,25 @@ /*! 点击消息发送失败红点的回调 - + @param model 消息Cell的数据模型 */ - (void)didTapmessageFailedStatusViewForResend:(RCMessageModel *)model; /*! 点击消息阅读人数View的回调 - + @param model 消息Cell的数据模型 - + @discussion 仅支持群组和讨论组 */ - (void)didTapReceiptCountView:(RCMessageModel *)model; /*! 点击媒体消息取消发送按钮 - + @param model 媒体消息Cell的数据模型 - + @discussion 仅支持取消文件消息的发送 */ - (void)didTapCancelUploadButton:(RCMessageModel *)model; @@ -91,7 +91,7 @@ #pragma mark - 客服机器人评价 /*! 机器人解答问题,点击是否解决问题的回调 - + @param model 消息Cell的数据模型 @param isResolved 是否解决问题 */ @@ -99,14 +99,13 @@ /*! 点击需要消息回执View的回调 - + @param model 消息Cell的数据模型 - + @discussion 仅支持群组和讨论组 */ - (void)didTapNeedReceiptView:(RCMessageModel *)model; - @end /*! @@ -117,34 +116,34 @@ /*! 公众服务会话中,点击Cell内容的回调 - + @param model 消息Cell的数据模型 */ - (void)didTapPublicServiceMessageCell:(RCMessageModel *)model; /*! 公众服务会话中,点击Cell中URL的回调 - + @param url 点击的URL @param model 消息Cell的数据模型 - + @discussion 点击Cell中的URL,会调用此回调,不会再触发didTapMessageCell:。 */ - (void)didTapUrlInPublicServiceMessageCell:(NSString *)url model:(RCMessageModel *)model; /*! 公众服务会话中,点击Cell中电话号码的回调 - + @param phoneNumber 点击的电话号码 @param model 消息Cell的数据模型 - + @discussion 点击Cell中的电话号码,会调用此回调,不会再触发didTapMessageCell:。 */ -- (void)didTapPhoneNumberInPublicServiceMessageCell:(NSString *) phoneNumber model:(RCMessageModel *)model; +- (void)didTapPhoneNumberInPublicServiceMessageCell:(NSString *)phoneNumber model:(RCMessageModel *)model; /*! 公众服务会话中,长按Cell内容的回调 - + @param model 消息Cell的数据模型 @param view 长按区域的View */ @@ -152,7 +151,7 @@ /*! 公众服务会话中,点击消息发送失败红点的回调 - + @param model 消息Cell的数据模型 */ - (void)didTapPublicServiceMessageFailedStatusViewForResend:(RCMessageModel *)model; diff --git a/ios-rongcallkit/framework/RongIMKit.framework/Headers/RCMessageCellNotificationModel.h b/ios-rongcallkit/framework/RongIMKit.framework/Headers/RCMessageCellNotificationModel.h index c4be1c8..1ce4353 100644 --- a/ios-rongcallkit/framework/RongIMKit.framework/Headers/RCMessageCellNotificationModel.h +++ b/ios-rongcallkit/framework/RongIMKit.framework/Headers/RCMessageCellNotificationModel.h @@ -17,7 +17,7 @@ UIKIT_EXTERN NSString *const CONVERSATION_CELL_STATUS_SEND_PROGRESS; UIKIT_EXTERN NSString *const CONVERSATION_CELL_DATA_IMAGE_KEY_UPDATE; UIKIT_EXTERN NSString *const CONVERSATION_CELL_STATUS_SEND_HASREAD; -UIKIT_EXTERN NSString *const CONVERSATION_CELL_STATUS_SEND_READCOUNT;//已读数 +UIKIT_EXTERN NSString *const CONVERSATION_CELL_STATUS_SEND_READCOUNT; //已读数 #import diff --git a/ios-rongcallkit/framework/RongIMKit.framework/Headers/RCMessageModel.h b/ios-rongcallkit/framework/RongIMKit.framework/Headers/RCMessageModel.h index 653bcd3..2ecda07 100644 --- a/ios-rongcallkit/framework/RongIMKit.framework/Headers/RCMessageModel.h +++ b/ios-rongcallkit/framework/RongIMKit.framework/Headers/RCMessageModel.h @@ -84,7 +84,6 @@ */ @property(nonatomic, strong) RCMessageContent *content; - /*! 阅读回执状态 */ @@ -97,32 +96,32 @@ /*! 消息展示时的Cell高度 - + @discussion 用于大量消息的显示优化 */ @property(nonatomic) CGSize cellSize; /*! 全局唯一ID - + @discussion 服务器消息唯一ID(在同一个Appkey下全局唯一) */ @property(nonatomic, strong) NSString *messageUId; /*! 消息是否可以发送请求回执 - + */ -@property(nonatomic,assign)BOOL isCanSendReadReceipt; +@property(nonatomic, assign) BOOL isCanSendReadReceipt; /*! 已读人数 - + */ -@property(nonatomic,assign)NSInteger readReceiptCount; +@property(nonatomic, assign) NSInteger readReceiptCount; /*! 初始化消息Cell的数据模型 - + @param rcMessage 消息实体 @return 消息Cell的数据模型对象 */ @@ -130,7 +129,7 @@ /*! 初始化消息Cell的数据模型 - + @param rcMessage 消息实体 @return 消息Cell的数据模型对象 */ diff --git a/ios-rongcallkit/framework/RongIMKit.framework/Headers/RCPluginBoardView.h b/ios-rongcallkit/framework/RongIMKit.framework/Headers/RCPluginBoardView.h index ba0e6fb..5632167 100644 --- a/ios-rongcallkit/framework/RongIMKit.framework/Headers/RCPluginBoardView.h +++ b/ios-rongcallkit/framework/RongIMKit.framework/Headers/RCPluginBoardView.h @@ -23,7 +23,7 @@ /*! 展示所有的功能按钮 */ -@property(nonatomic,strong) UICollectionView *contentView; +@property(nonatomic, strong) UICollectionView *contentView; /*! 扩展view ,此视图会覆盖加号区域其他视图,默认隐藏 @@ -37,57 +37,57 @@ /*! 向扩展功能板中插入扩展项 - + @param image 扩展项的展示图片 @param title 扩展项的展示标题 @param index 需要添加到的索引值 @param tag 扩展项的唯一标示符 - + @discussion 您以在RCConversationViewController的viewdidload后,添加自定义的扩展项。 SDK默认的扩展项的唯一标示符为1XXX,我们建议您在自定义扩展功能时不要选用1XXX,以免与SDK预留的扩展项唯一标示符重复。 */ -- (void)insertItemWithImage:(UIImage*)image title:(NSString*)title atIndex:(NSInteger)index tag:(NSInteger)tag; +- (void)insertItemWithImage:(UIImage *)image title:(NSString *)title atIndex:(NSInteger)index tag:(NSInteger)tag; /*! 添加扩展项到扩展功能板,并在显示为最后一项 - + @param image 扩展项的展示图片 @param title 扩展项的展示标题 @param tag 扩展项的唯一标示符 - + @discussion 您以在RCConversationViewController的viewdidload后,添加自定义的扩展项。 SDK默认的扩展项的唯一标示符为1XXX,我们建议您在自定义扩展功能时不要选用1XXX,以免与SDK预留的扩展项唯一标示符重复。 */ --(void)insertItemWithImage:(UIImage*)image title:(NSString*)title tag:(NSInteger)tag; +- (void)insertItemWithImage:(UIImage *)image title:(NSString *)title tag:(NSInteger)tag; /*! 更新指定扩展项 - + @param index 扩展项的索引值 @param image 扩展项的展示图片 @param title 扩展项的展示标题 */ --(void)updateItemAtIndex:(NSInteger)index image:(UIImage*)image title:(NSString*)title; +- (void)updateItemAtIndex:(NSInteger)index image:(UIImage *)image title:(NSString *)title; /*! 更新指定扩展项 - + @param tag 扩展项的唯一标示符 @param image 扩展项的展示图片 @param title 扩展项的展示标题 */ --(void)updateItemWithTag:(NSInteger)tag image:(UIImage*)image title:(NSString*)title; +- (void)updateItemWithTag:(NSInteger)tag image:(UIImage *)image title:(NSString *)title; /*! 删除扩展功能板中的指定扩展项 - + @param index 指定扩展项的索引值 */ - (void)removeItemAtIndex:(NSInteger)index; /*! 删除扩展功能板中的指定扩展项 - + @param tag 指定扩展项的唯一标示符 */ - (void)removeItemWithTag:(NSInteger)tag; @@ -105,10 +105,10 @@ /*! 点击扩展功能板中的扩展项的回调 - + @param pluginBoardView 当前扩展功能板 @param tag 点击的扩展项的唯一标示符 */ --(void)pluginBoardView:(RCPluginBoardView*)pluginBoardView clickedItemWithTag:(NSInteger)tag; +- (void)pluginBoardView:(RCPluginBoardView *)pluginBoardView clickedItemWithTag:(NSInteger)tag; @end diff --git a/ios-rongcallkit/framework/RongIMKit.framework/Headers/RCPublicServiceChatViewController.h b/ios-rongcallkit/framework/RongIMKit.framework/Headers/RCPublicServiceChatViewController.h index cafcac6..3ccde7f 100644 --- a/ios-rongcallkit/framework/RongIMKit.framework/Headers/RCPublicServiceChatViewController.h +++ b/ios-rongcallkit/framework/RongIMKit.framework/Headers/RCPublicServiceChatViewController.h @@ -6,8 +6,8 @@ // Copyright (c) 2015年 RongCloud. All rights reserved. // -#import #import "RCConversationViewController.h" +#import /*! 公众服务会话页面的ViewController @@ -16,16 +16,16 @@ /*! 点击富文本(图文)消息中URL的回调 - + @param tapedUrl 点击的URL @param rcWebViewController 已包含融云JS鉴权的WebViewController - + @discussion SDK在回调中默认会使用WebView打开URL,您可以重写此回调。 此回调中的rcWebViewController,已经包含了融云公众账号的JS鉴权,您在重写时可以直接使用此WebView来显示URL。 - + @warning **已废弃,请勿使用。** 升级说明:如果您之前使用了此接口,可以直接替换为RCConversationViewController的didTapUrlInPublicServiceMessageCell:model:回调。 */ -- (void)didTapImageTxtMsgCell:(NSString *)tapedUrl webViewController:(UIViewController *)rcWebViewController -__deprecated_msg("已废弃,请勿使用。"); +- (void)didTapImageTxtMsgCell:(NSString *)tapedUrl + webViewController:(UIViewController *)rcWebViewController __deprecated_msg("已废弃,请勿使用。"); @end diff --git a/ios-rongcallkit/framework/RongIMKit.framework/Headers/RCPublicServiceProfileViewController.h b/ios-rongcallkit/framework/RongIMKit.framework/Headers/RCPublicServiceProfileViewController.h index 2340b41..51f90a7 100644 --- a/ios-rongcallkit/framework/RongIMKit.framework/Headers/RCPublicServiceProfileViewController.h +++ b/ios-rongcallkit/framework/RongIMKit.framework/Headers/RCPublicServiceProfileViewController.h @@ -6,9 +6,9 @@ // Copyright (c) 2015年 litao. All rights reserved. // -#import -#import #import "RCThemeDefine.h" +#import +#import /*! 公众服务账号信息中的URL点击回调 @@ -17,7 +17,7 @@ /*! 点击公众服务账号信息的URL回调 - + @param url 点击的URL */ - (void)gotoUrl:(NSString *)url; diff --git a/ios-rongcallkit/framework/RongIMKit.framework/Headers/RCRichContentMessageCell.h b/ios-rongcallkit/framework/RongIMKit.framework/Headers/RCRichContentMessageCell.h index d511796..fb5cff4 100644 --- a/ios-rongcallkit/framework/RongIMKit.framework/Headers/RCRichContentMessageCell.h +++ b/ios-rongcallkit/framework/RongIMKit.framework/Headers/RCRichContentMessageCell.h @@ -6,8 +6,8 @@ // Copyright (c) 2015年 RongCloud. All rights reserved. // -#import "RCMessageCell.h" #import "RCAttributedLabel.h" +#import "RCMessageCell.h" #define RichContent_Title_Font_Size 15 #define RichContent_Message_Font_Size 12 diff --git a/ios-rongcallkit/framework/RongIMKit.framework/Headers/RCSettingViewController.h b/ios-rongcallkit/framework/RongIMKit.framework/Headers/RCSettingViewController.h index 59a94bc..13466fb 100644 --- a/ios-rongcallkit/framework/RongIMKit.framework/Headers/RCSettingViewController.h +++ b/ios-rongcallkit/framework/RongIMKit.framework/Headers/RCSettingViewController.h @@ -6,12 +6,12 @@ // Copyright (c) 2015年 RongCloud. All rights reserved. // -#import #import "RCConversationSettingTableViewController.h" +#import /*! 清空会话中所有消息的回调 - + @param isSuccess 是否删除会话中的所有消息 */ typedef void (^clearHistory)(BOOL isSuccess); @@ -33,7 +33,7 @@ typedef void (^clearHistory)(BOOL isSuccess); /*! 清空会话中所有消息的回调 - + @discussion 在清空消息的的回调中,您需要调用会话页面的reloadData进行刷新。 */ @property(nonatomic, copy) clearHistory clearHistoryCompletion; @@ -50,7 +50,7 @@ typedef void (^clearHistory)(BOOL isSuccess); /*! 点击Item(用户头像或加减号)的回调 - + @param settingTableViewHeader 当前会话设置界面 @param indexPathOfSelectedItem 点击的Item索引值 @param users 当前的用户信息RCUserInfo列表 @@ -61,9 +61,9 @@ typedef void (^clearHistory)(BOOL isSuccess); /*! 点击删除用户的回调 - + @param indexPath 当前删除的用户的头像索引值 - + @discussion 点击头像左上角的删除按钮时的回调。 */ - (void)deleteTipButtonClicked:(NSIndexPath *)indexPath; diff --git a/ios-rongcallkit/framework/RongIMKit.framework/Headers/RCTextMessageCell.h b/ios-rongcallkit/framework/RongIMKit.framework/Headers/RCTextMessageCell.h index 9b32116..3add34f 100644 --- a/ios-rongcallkit/framework/RongIMKit.framework/Headers/RCTextMessageCell.h +++ b/ios-rongcallkit/framework/RongIMKit.framework/Headers/RCTextMessageCell.h @@ -6,15 +6,15 @@ // Copyright (c) 2015年 RongCloud. All rights reserved. // -#import "RCMessageCell.h" #import "RCAttributedLabel.h" +#import "RCMessageCell.h" #define Text_Message_Font_Size 16 /*! 文本消息Cell */ -@interface RCTextMessageCell : RCMessageCell +@interface RCTextMessageCell : RCMessageCell /*! 显示消息内容的Label @@ -28,7 +28,7 @@ /*! 设置当前消息Cell的数据模型 - + @param model 消息Cell的数据模型 */ - (void)setDataModel:(RCMessageModel *)model; diff --git a/ios-rongcallkit/framework/RongIMKit.framework/Headers/RCTextView.h b/ios-rongcallkit/framework/RongIMKit.framework/Headers/RCTextView.h index e84b6f4..a9b4fca 100644 --- a/ios-rongcallkit/framework/RongIMKit.framework/Headers/RCTextView.h +++ b/ios-rongcallkit/framework/RongIMKit.framework/Headers/RCTextView.h @@ -24,7 +24,7 @@ /*! 是否关闭菜单 - + @discussion 默认值为NO。 */ @property(nonatomic, assign) BOOL disableActionMenu; diff --git a/ios-rongcallkit/framework/RongIMKit.framework/Headers/RCThemeDefine.h b/ios-rongcallkit/framework/RongIMKit.framework/Headers/RCThemeDefine.h index 4e2e432..3033a88 100644 --- a/ios-rongcallkit/framework/RongIMKit.framework/Headers/RCThemeDefine.h +++ b/ios-rongcallkit/framework/RongIMKit.framework/Headers/RCThemeDefine.h @@ -19,4 +19,3 @@ typedef NS_ENUM(NSInteger, RCUserAvatarStyle) { */ RC_USER_AVATAR_CYCLE }; - diff --git a/ios-rongcallkit/framework/RongIMKit.framework/Headers/RCTipLabel.h b/ios-rongcallkit/framework/RongIMKit.framework/Headers/RCTipLabel.h index 4e16fa3..f66e0fe 100644 --- a/ios-rongcallkit/framework/RongIMKit.framework/Headers/RCTipLabel.h +++ b/ios-rongcallkit/framework/RongIMKit.framework/Headers/RCTipLabel.h @@ -6,8 +6,8 @@ // Copyright (c) 2014 RongCloud. All rights reserved. // -#import #import "RCAttributedLabel.h" +#import /*! 灰条提示Label @@ -21,7 +21,7 @@ /*! 初始化灰条提示Label对象 - + @return 灰条提示Label对象 */ + (instancetype)greyTipLabel; diff --git a/ios-rongcallkit/framework/RongIMKit.framework/Headers/RCTipMessageCell.h b/ios-rongcallkit/framework/RongIMKit.framework/Headers/RCTipMessageCell.h index f5d1b8b..01e242a 100644 --- a/ios-rongcallkit/framework/RongIMKit.framework/Headers/RCTipMessageCell.h +++ b/ios-rongcallkit/framework/RongIMKit.framework/Headers/RCTipMessageCell.h @@ -20,7 +20,7 @@ /*! 设置当前消息Cell的数据模型 - + @param model 消息Cell的数据模型 */ - (void)setDataModel:(RCMessageModel *)model; diff --git a/ios-rongcallkit/framework/RongIMKit.framework/Headers/RCUnknownMessageCell.h b/ios-rongcallkit/framework/RongIMKit.framework/Headers/RCUnknownMessageCell.h index 627b1e8..d503781 100644 --- a/ios-rongcallkit/framework/RongIMKit.framework/Headers/RCUnknownMessageCell.h +++ b/ios-rongcallkit/framework/RongIMKit.framework/Headers/RCUnknownMessageCell.h @@ -20,7 +20,7 @@ /*! 设置当前消息Cell的数据模型 - + @param model 消息Cell的数据模型 */ - (void)setDataModel:(RCMessageModel *)model; diff --git a/ios-rongcallkit/framework/RongIMKit.framework/Headers/RongIMKit.h b/ios-rongcallkit/framework/RongIMKit.framework/Headers/RongIMKit.h index ef26955..74ffc08 100644 --- a/ios-rongcallkit/framework/RongIMKit.framework/Headers/RongIMKit.h +++ b/ios-rongcallkit/framework/RongIMKit.framework/Headers/RongIMKit.h @@ -21,45 +21,45 @@ FOUNDATION_EXPORT const unsigned char RongIMKitVersionString[]; #import /// 会话页面相关类 #import -#import -#import #import #import #import #import +#import +#import /// 会话列表Cell相关类 #import #import #import /// 消息Cell相关类 +#import +#import +#import +#import #import #import +#import +#import +#import +#import +#import #import #import #import -#import -#import -#import -#import -#import -#import -#import -#import -#import /// 工具类 #import #import /// 其他 +#import #import -#import #import -#import -#import -#import -#import #import +#import +#import #import +#import +#import +#import #import -#import /// VoIPCall diff --git a/ios-rongcallkit/framework/RongIMKit.framework/Headers/RongIMKitExtensionModule.h b/ios-rongcallkit/framework/RongIMKit.framework/Headers/RongIMKitExtensionModule.h index dfcd0ff..3db41c4 100644 --- a/ios-rongcallkit/framework/RongIMKit.framework/Headers/RongIMKitExtensionModule.h +++ b/ios-rongcallkit/framework/RongIMKit.framework/Headers/RongIMKitExtensionModule.h @@ -6,10 +6,10 @@ // Copyright © 2016年 RongCloud. All rights reserved. // -#import +#import "RCExtensionMessageCellInfo.h" #import "RCExtensionModule.h" #import "RCMessageModel.h" -#import "RCExtensionMessageCellInfo.h" +#import /*! RongCloud IM扩展模块协议 @@ -21,12 +21,12 @@ #pragma mark - Cell /*! 获取会话页面的cell信息。 - + @param conversationType 会话类型 @param targetId targetId - + @return cell信息列表。 - + @discussion 当进入到会话页面时,SDK需要了解扩展模块的消息对应的MessageCell和reuseIdentifier。 */ - (NSArray *)getMessageCellInfoList:(RCConversationType)conversationType @@ -34,14 +34,14 @@ /*! 点击MessageCell的处理 - + @param messageModel 被点击MessageCell的model */ - (void)didTapMessageCell:(RCMessageModel *)messageModel; /** 会话页面 WillAppear 时会调用,可以自己修改 extensionView 的 frame 及内容 - + @param conversationType 会话类型 @param targetId targetId @param extensionView 扩展view @@ -51,22 +51,20 @@ extensionView:(UIView *)extensionView; /** - 会话页面 WillDisappear 时会调用(如果您的扩展模块里有其他需要改变会话页面的 extensionView,在收到这个方法之后就应该终止修改) - + 会话页面 WillDisappear 时会调用(如果您的扩展模块里有其他需要改变会话页面的 + extensionView,在收到这个方法之后就应该终止修改) + @param conversationType 会话类型 @param targetId targetId */ -- (void)extensionViewWillDisappear:(RCConversationType)conversationType - targetId:(NSString *)targetId; - +- (void)extensionViewWillDisappear:(RCConversationType)conversationType targetId:(NSString *)targetId; /** 会话页面即将被销毁,点击会话页面左上角的“返回”按钮会触发这个回调 - + @param conversationType 会话类型 @param targetId targetId */ -- (void)containerViewWillDestroy:(RCConversationType)conversationType - targetId:(NSString *)targetId; +- (void)containerViewWillDestroy:(RCConversationType)conversationType targetId:(NSString *)targetId; @end diff --git a/ios-rongcallkit/framework/RongIMKit.framework/Info.plist b/ios-rongcallkit/framework/RongIMKit.framework/Info.plist index 4bf7684..a963664 100644 Binary files a/ios-rongcallkit/framework/RongIMKit.framework/Info.plist and b/ios-rongcallkit/framework/RongIMKit.framework/Info.plist differ diff --git a/ios-rongcallkit/framework/RongIMKit.framework/RongIMKit b/ios-rongcallkit/framework/RongIMKit.framework/RongIMKit index 0588e9e..d6d0035 100644 Binary files a/ios-rongcallkit/framework/RongIMKit.framework/RongIMKit and b/ios-rongcallkit/framework/RongIMKit.framework/RongIMKit differ diff --git a/ios-rongcallkit/framework/RongIMLib.framework/Headers/RCAMRDataConverter.h b/ios-rongcallkit/framework/RongIMLib.framework/Headers/RCAMRDataConverter.h index 033b6c5..3445344 100644 --- a/ios-rongcallkit/framework/RongIMLib.framework/Headers/RCAMRDataConverter.h +++ b/ios-rongcallkit/framework/RongIMLib.framework/Headers/RCAMRDataConverter.h @@ -57,9 +57,7 @@ 如果您想和SDK自带的语音消息保持一致和互通,考虑到跨平台和传输的原因,SDK对于WAV音频有所限制. 具体可以参考RCVoiceMessage中的音频参数说明(nChannels为1,nBitsPerSample为16)。 */ -- (NSData *)encodeWAVEToAMR:(NSData *)data - channel:(int)nChannels - nBitsPerSample:(int)nBitsPerSample; +- (NSData *)encodeWAVEToAMR:(NSData *)data channel:(int)nChannels nBitsPerSample:(int)nBitsPerSample; @end #endif diff --git a/ios-rongcallkit/framework/RongIMLib.framework/Headers/RCCSLeaveMessage.h b/ios-rongcallkit/framework/RongIMLib.framework/Headers/RCCSLeaveMessage.h index e799eca..ad30202 100644 --- a/ios-rongcallkit/framework/RongIMLib.framework/Headers/RCCSLeaveMessage.h +++ b/ios-rongcallkit/framework/RongIMLib.framework/Headers/RCCSLeaveMessage.h @@ -9,5 +9,5 @@ #import #define RCCSLeaveMessageTypeIdentifier @"RC:CsLM" @interface RCCSLeaveMessage : RCMessageContent -@property (nonatomic, strong)NSDictionary *leaveMessageDic; +@property(nonatomic, strong) NSDictionary *leaveMessageDic; @end diff --git a/ios-rongcallkit/framework/RongIMLib.framework/Headers/RCCSLeaveMessageItem.h b/ios-rongcallkit/framework/RongIMLib.framework/Headers/RCCSLeaveMessageItem.h index f8f94f3..0974f99 100644 --- a/ios-rongcallkit/framework/RongIMLib.framework/Headers/RCCSLeaveMessageItem.h +++ b/ios-rongcallkit/framework/RongIMLib.framework/Headers/RCCSLeaveMessageItem.h @@ -24,7 +24,7 @@ //验证后提示信息 @property(nonatomic, strong) NSArray *message; //最大字数限制 -@property(nonatomic, assign)int max; +@property(nonatomic, assign) int max; + (instancetype)modelWithDic:(NSDictionary *)dic; - (instancetype)initWithDic:(NSDictionary *)dic; diff --git a/ios-rongcallkit/framework/RongIMLib.framework/Headers/RCCSPullLeaveMessage.h b/ios-rongcallkit/framework/RongIMLib.framework/Headers/RCCSPullLeaveMessage.h index 29dad34..efc26ea 100644 --- a/ios-rongcallkit/framework/RongIMLib.framework/Headers/RCCSPullLeaveMessage.h +++ b/ios-rongcallkit/framework/RongIMLib.framework/Headers/RCCSPullLeaveMessage.h @@ -9,5 +9,5 @@ #import #define RCCSPullLeaveMessageTypeIdentifier @"RC:CsPLM" @interface RCCSPullLeaveMessage : RCMessageContent -@property (nonatomic,copy)NSString *content; +@property(nonatomic, copy) NSString *content; @end diff --git a/ios-rongcallkit/framework/RongIMLib.framework/Headers/RCCommandMessage.h b/ios-rongcallkit/framework/RongIMLib.framework/Headers/RCCommandMessage.h index 57d5dc9..0674229 100644 --- a/ios-rongcallkit/framework/RongIMLib.framework/Headers/RCCommandMessage.h +++ b/ios-rongcallkit/framework/RongIMLib.framework/Headers/RCCommandMessage.h @@ -18,7 +18,7 @@ @discussion 命令消息类,此消息不存储不计入未读消息数。 与RCCommandNotificationMessage的区别是,此消息不存储,也不会在界面上显示。 */ -@interface RCCommandMessage : RCMessageContent +@interface RCCommandMessage : RCMessageContent /*! 命令的名称 diff --git a/ios-rongcallkit/framework/RongIMLib.framework/Headers/RCCommandNotificationMessage.h b/ios-rongcallkit/framework/RongIMLib.framework/Headers/RCCommandNotificationMessage.h index 78c14b6..fc03b08 100644 --- a/ios-rongcallkit/framework/RongIMLib.framework/Headers/RCCommandNotificationMessage.h +++ b/ios-rongcallkit/framework/RongIMLib.framework/Headers/RCCommandNotificationMessage.h @@ -23,7 +23,7 @@ @discussion 命令消息类,此消息会进行存储,但不计入未读消息数。 与RCCommandMessage的区别是,此消息会进行存储并在界面上显示。 */ -@interface RCCommandNotificationMessage : RCMessageContent +@interface RCCommandNotificationMessage : RCMessageContent /*! 命令提醒的名称 diff --git a/ios-rongcallkit/framework/RongIMLib.framework/Headers/RCContactNotificationMessage.h b/ios-rongcallkit/framework/RongIMLib.framework/Headers/RCContactNotificationMessage.h index cee13cc..f58c741 100644 --- a/ios-rongcallkit/framework/RongIMLib.framework/Headers/RCContactNotificationMessage.h +++ b/ios-rongcallkit/framework/RongIMLib.framework/Headers/RCContactNotificationMessage.h @@ -24,13 +24,11 @@ /*! 同意添加好友的请求 */ -#define ContactNotificationMessage_ContactOperationAcceptResponse \ - @"AcceptResponse" +#define ContactNotificationMessage_ContactOperationAcceptResponse @"AcceptResponse" /*! 拒绝添加好友的请求 */ -#define ContactNotificationMessage_ContactOperationRejectResponse \ - @"RejectResponse" +#define ContactNotificationMessage_ContactOperationRejectResponse @"RejectResponse" /*! 好友请求消息类 diff --git a/ios-rongcallkit/framework/RongIMLib.framework/Headers/RCConversation.h b/ios-rongcallkit/framework/RongIMLib.framework/Headers/RCConversation.h index f685a5d..79da89e 100644 --- a/ios-rongcallkit/framework/RongIMLib.framework/Headers/RCConversation.h +++ b/ios-rongcallkit/framework/RongIMLib.framework/Headers/RCConversation.h @@ -88,8 +88,7 @@ @warning **已废弃,请勿使用。** */ -@property(nonatomic, strong) NSString *senderUserName -__deprecated_msg("已废弃,请勿使用。"); +@property(nonatomic, strong) NSString *senderUserName __deprecated_msg("已废弃,请勿使用。"); /*! 会话中最后一条消息的消息ID @@ -108,7 +107,7 @@ __deprecated_msg("已废弃,请勿使用。"); /*! 会话中最后一条消息的json Dictionary - + @discussion 此字段存放最后一条消息内容中未编码的json数据。 SDK内置的消息,如果消息解码失败,默认会将消息的内容存放到此字段;如果编码和解码正常,此字段会置为nil。 */ @@ -123,7 +122,7 @@ __deprecated_msg("已废弃,请勿使用。"); /*! 会话中是否存在被@的消息 - + @discussion 在清除会话未读数(clearMessagesUnreadStatus:targetId:)的时候,会将此状态置成 NO。 */ @property(nonatomic, assign) BOOL hasUnreadMentioned; @@ -136,7 +135,6 @@ __deprecated_msg("已废弃,请勿使用。"); @warning **已废弃,请勿使用。** */ -+ (instancetype)conversationWithProperties:(NSDictionary *)json - __deprecated_msg("已废弃,请勿使用。"); ++ (instancetype)conversationWithProperties:(NSDictionary *)json __deprecated_msg("已废弃,请勿使用。"); @end diff --git a/ios-rongcallkit/framework/RongIMLib.framework/Headers/RCCustomerServiceConfig.h b/ios-rongcallkit/framework/RongIMLib.framework/Headers/RCCustomerServiceConfig.h index c12933c..d64ea59 100644 --- a/ios-rongcallkit/framework/RongIMLib.framework/Headers/RCCustomerServiceConfig.h +++ b/ios-rongcallkit/framework/RongIMLib.framework/Headers/RCCustomerServiceConfig.h @@ -6,9 +6,9 @@ // Copyright © 2016年 RongCloud. All rights reserved. // -#import -#import "RCStatusDefine.h" #import "RCCSLeaveMessageItem.h" +#import "RCStatusDefine.h" +#import // onResult:(void(^)(int isSuccess, NSString *errMsg))resultBlock // onBlocked:(void(^)(void))blockedBlock // onCompanyInfo:(void(^)(NSString *companyName, NSString @@ -59,10 +59,9 @@ /*! * 评价类型 - 如果 evaType 为 RCCSEvaSeparately,发送机器人评价消息调用RCIMClient中evaluateCustomerService: knownledgeId: robotValue: suggest: - 发送人工评价消息调用RCIMClient中 - evaluateCustomerService: dialogId: humanValue: suggest: - + 如果 evaType 为 RCCSEvaSeparately,发送机器人评价消息调用RCIMClient中evaluateCustomerService: knownledgeId: robotValue: + suggest: 发送人工评价消息调用RCIMClient中 evaluateCustomerService: dialogId: humanValue: suggest: + 如果 evaType 为 EVA_UNIFIED,发送评价消息调用RCIMClient中 evaluateCustomerService: dialogId: starValue: suggest: resolveStatus: */ @@ -76,7 +75,7 @@ /*! * 留言样式:0.默认跳转留言界面;1.跳转url留言 */ -@property(nonatomic, assign) RCCSLMType leaveMessageType; +@property(nonatomic, assign) RCCSLMType leaveMessageType; /*! * 是否支持地图发送:0.支持;1.不支持 diff --git a/ios-rongcallkit/framework/RongIMLib.framework/Headers/RCCustomerServiceGroupItem.h b/ios-rongcallkit/framework/RongIMLib.framework/Headers/RCCustomerServiceGroupItem.h index dae0ea1..46603c8 100644 --- a/ios-rongcallkit/framework/RongIMLib.framework/Headers/RCCustomerServiceGroupItem.h +++ b/ios-rongcallkit/framework/RongIMLib.framework/Headers/RCCustomerServiceGroupItem.h @@ -9,7 +9,7 @@ #import @interface RCCustomerServiceGroupItem : NSObject -@property (nonatomic, strong)NSString *groupId; -@property (nonatomic, strong)NSString *name; -@property (nonatomic, assign)BOOL online; +@property(nonatomic, strong) NSString *groupId; +@property(nonatomic, strong) NSString *name; +@property(nonatomic, assign) BOOL online; @end diff --git a/ios-rongcallkit/framework/RongIMLib.framework/Headers/RCCustomerServiceInfo.h b/ios-rongcallkit/framework/RongIMLib.framework/Headers/RCCustomerServiceInfo.h index a263234..bca99ba 100644 --- a/ios-rongcallkit/framework/RongIMLib.framework/Headers/RCCustomerServiceInfo.h +++ b/ios-rongcallkit/framework/RongIMLib.framework/Headers/RCCustomerServiceInfo.h @@ -26,17 +26,17 @@ @property(nonatomic, strong) NSString *mobileNo; //电话号码 @property(nonatomic, strong) NSString *email; //邮箱 @property(nonatomic, strong) NSString *address; //地址 -@property(nonatomic, strong) NSString *QQ; // QQ号 -@property(nonatomic, strong) NSString *weibo; //微博 -@property(nonatomic, strong) NSString *weixin; //微信 +@property(nonatomic, strong) NSString *QQ; // QQ号 +@property(nonatomic, strong) NSString *weibo; //微博 +@property(nonatomic, strong) NSString *weixin; //微信 @property(nonatomic, strong) NSString *page; //页面信息 @property(nonatomic, strong) NSString *referrer; //来源 @property(nonatomic, strong) NSString *enterUrl; // @property(nonatomic, strong) NSString *skillId; @property(nonatomic, strong) NSArray *listUrl; -@property(nonatomic, strong) NSString *define; //自定义信息 -@property(nonatomic, strong) NSString *productId;//商品id +@property(nonatomic, strong) NSString *define; //自定义信息 +@property(nonatomic, strong) NSString *productId; //商品id - (NSData *)encode; @end diff --git a/ios-rongcallkit/framework/RongIMLib.framework/Headers/RCDiscussion.h b/ios-rongcallkit/framework/RongIMLib.framework/Headers/RCDiscussion.h index cf4bc74..52c786b 100644 --- a/ios-rongcallkit/framework/RongIMLib.framework/Headers/RCDiscussion.h +++ b/ios-rongcallkit/framework/RongIMLib.framework/Headers/RCDiscussion.h @@ -52,16 +52,14 @@ @warning **已废弃,请勿使用。** */ -@property(nonatomic, assign) __deprecated_msg("已废弃,请勿使用。") - int conversationType; +@property(nonatomic, assign) __deprecated_msg("已废弃,请勿使用。") int conversationType; /*! 讨论组是否允许消息提醒(已废弃,请勿使用) @warning **已废弃,请勿使用。** */ -@property(nonatomic, assign) __deprecated_msg("已废弃,请勿使用。") - int pushMessageNotificationStatus; +@property(nonatomic, assign) __deprecated_msg("已废弃,请勿使用。") int pushMessageNotificationStatus; /*! 讨论组初始化方法 diff --git a/ios-rongcallkit/framework/RongIMLib.framework/Headers/RCDiscussionNotificationMessage.h b/ios-rongcallkit/framework/RongIMLib.framework/Headers/RCDiscussionNotificationMessage.h index 603f522..91fd9c1 100644 --- a/ios-rongcallkit/framework/RongIMLib.framework/Headers/RCDiscussionNotificationMessage.h +++ b/ios-rongcallkit/framework/RongIMLib.framework/Headers/RCDiscussionNotificationMessage.h @@ -21,26 +21,26 @@ 讨论组通知的类型 */ typedef NS_ENUM(NSInteger, RCDiscussionNotificationType) { - /*! - 有成员加入讨论组的通知 - */ - RCInviteDiscussionNotification = 1, - /*! - 有成员退出讨论组的通知 - */ - RCQuitDiscussionNotification, - /*! - 讨论组名称发生变更的通知 - */ - RCRenameDiscussionTitleNotification, - /*! - 有成员被踢出讨论组的通知 - */ - RCRemoveDiscussionMemberNotification, - /*! - 讨论组加入权限的变更 - */ - RCSwichInvitationAccessNotification + /*! + 有成员加入讨论组的通知 + */ + RCInviteDiscussionNotification = 1, + /*! + 有成员退出讨论组的通知 + */ + RCQuitDiscussionNotification, + /*! + 讨论组名称发生变更的通知 + */ + RCRenameDiscussionTitleNotification, + /*! + 有成员被踢出讨论组的通知 + */ + RCRemoveDiscussionMemberNotification, + /*! + 讨论组加入权限的变更 + */ + RCSwichInvitationAccessNotification }; /*! diff --git a/ios-rongcallkit/framework/RongIMLib.framework/Headers/RCFileMessage.h b/ios-rongcallkit/framework/RongIMLib.framework/Headers/RCFileMessage.h index a06b007..a4a7b07 100644 --- a/ios-rongcallkit/framework/RongIMLib.framework/Headers/RCFileMessage.h +++ b/ios-rongcallkit/framework/RongIMLib.framework/Headers/RCFileMessage.h @@ -13,7 +13,7 @@ */ #define RCFileMessageTypeIdentifier @"RC:FileMsg" -@interface RCFileMessage : RCMessageContent +@interface RCFileMessage : RCMessageContent /*! 文件名 diff --git a/ios-rongcallkit/framework/RongIMLib.framework/Headers/RCGroup.h b/ios-rongcallkit/framework/RongIMLib.framework/Headers/RCGroup.h index 334e4a6..94a4e80 100644 --- a/ios-rongcallkit/framework/RongIMLib.framework/Headers/RCGroup.h +++ b/ios-rongcallkit/framework/RongIMLib.framework/Headers/RCGroup.h @@ -40,8 +40,6 @@ @param portraitUri 群组头像的URL @return 群组信息对象 */ -- (instancetype)initWithGroupId:(NSString *)groupId - groupName:(NSString *)groupName - portraitUri:(NSString *)portraitUri; +- (instancetype)initWithGroupId:(NSString *)groupId groupName:(NSString *)groupName portraitUri:(NSString *)portraitUri; @end diff --git a/ios-rongcallkit/framework/RongIMLib.framework/Headers/RCGroupNotificationMessage.h b/ios-rongcallkit/framework/RongIMLib.framework/Headers/RCGroupNotificationMessage.h index cd7dfff..f68e420 100644 --- a/ios-rongcallkit/framework/RongIMLib.framework/Headers/RCGroupNotificationMessage.h +++ b/ios-rongcallkit/framework/RongIMLib.framework/Headers/RCGroupNotificationMessage.h @@ -43,7 +43,7 @@ @discussion 群组通知消息类,此消息会进行存储,但不计入未读消息数。 */ -@interface RCGroupNotificationMessage : RCMessageContent +@interface RCGroupNotificationMessage : RCMessageContent /*! 群组通知的当前操作名 diff --git a/ios-rongcallkit/framework/RongIMLib.framework/Headers/RCIMClient.h b/ios-rongcallkit/framework/RongIMLib.framework/Headers/RCIMClient.h index 0bd8783..4d1b7a1 100644 --- a/ios-rongcallkit/framework/RongIMLib.framework/Headers/RCIMClient.h +++ b/ios-rongcallkit/framework/RongIMLib.framework/Headers/RCIMClient.h @@ -18,19 +18,19 @@ #import "RCChatRoomInfo.h" #import "RCConversation.h" #import "RCCustomerServiceConfig.h" +#import "RCCustomerServiceGroupItem.h" #import "RCCustomerServiceInfo.h" #import "RCDiscussion.h" #import "RCMessage.h" #import "RCPublicServiceProfile.h" +#import "RCPushProfile.h" +#import "RCSearchConversationResult.h" #import "RCStatusDefine.h" #import "RCUploadImageStatusListener.h" #import "RCUploadMediaStatusListener.h" #import "RCUserInfo.h" -#import "RCWatchKitStatusDelegate.h" -#import "RCCustomerServiceGroupItem.h" -#import "RCSearchConversationResult.h" -#import "RCPushProfile.h" #import "RCUserOnlineStatusInfo.h" +#import "RCWatchKitStatusDelegate.h" #pragma mark - 消息接收监听器 @@ -62,22 +62,25 @@ @optional /*! 消息被撤回的回调方法 - + @param messageId 被撤回的消息ID - + @discussion 被撤回的消息会变更为RCRecallNotificationMessage,App需要在UI上刷新这条消息。 */ - (void)onMessageRecalled:(long)messageId; /*! - 请求消息已读回执(收到需要阅读时发送回执的请求,收到此请求后在会话页面已经展示该 messageUId 对应的消息或者调用 getHistoryMessages 获取消息的时候,包含此 messageUId 的消息,需要调用 - sendMessageReadReceiptResponse 接口发送消息阅读回执) - + 请求消息已读回执(收到需要阅读时发送回执的请求,收到此请求后在会话页面已经展示该 messageUId 对应的消息或者调用 + getHistoryMessages 获取消息的时候,包含此 messageUId 的消息,需要调用 sendMessageReadReceiptResponse + 接口发送消息阅读回执) + @param messageUId 请求已读回执的消息ID @param conversationType conversationType @param targetId targetId */ -- (void)onMessageReceiptRequest:(RCConversationType)conversationType targetId:(NSString *)targetId messageUId:(NSString *)messageUId; +- (void)onMessageReceiptRequest:(RCConversationType)conversationType + targetId:(NSString *)targetId + messageUId:(NSString *)messageUId; /*! 消息已读回执响应(收到阅读回执响应,可以按照 messageUId 更新消息的阅读数) @@ -86,7 +89,10 @@ @param targetId targetId @param userIdList 已读userId列表 */ -- (void)onMessageReceiptResponse:(RCConversationType)conversationType targetId:(NSString *)targetId messageUId:(NSString *)messageUId readerList:(NSMutableDictionary *)userIdList; +- (void)onMessageReceiptResponse:(RCConversationType)conversationType + targetId:(NSString *)targetId + messageUId:(NSString *)messageUId + readerList:(NSMutableDictionary *)userIdList; @end @@ -118,7 +124,7 @@ /*! IMLib聊天室状态的的监听器 - + @discussion 设置IMLib的聊天室状态监听器,请参考RCIMClient的setChatRoomStatusDelegate:方法。 */ @@ -126,32 +132,32 @@ /*! 开始加入聊天室的回调 - + @param chatroomId 聊天室ID */ - (void)onChatRoomJoining:(NSString *)chatroomId; /*! 加入聊天室成功的回调 - + @param chatroomId 聊天室ID */ - (void)onChatRoomJoined:(NSString *)chatroomId; /*! 加入聊天室失败的回调 - + @param chatroomId 聊天室ID @param errorCode 加入失败的错误码 - - @discussion 如果错误码是KICKED_FROM_CHATROOM或RC_CHATROOM_NOT_EXIST,则不会自动重新加入聊天室,App需要按照自己的逻辑处理。 + + @discussion + 如果错误码是KICKED_FROM_CHATROOM或RC_CHATROOM_NOT_EXIST,则不会自动重新加入聊天室,App需要按照自己的逻辑处理。 */ -- (void)onChatRoomJoinFailed:(NSString *)chatroomId - errorCode:(RCErrorCode)errorCode; +- (void)onChatRoomJoinFailed:(NSString *)chatroomId errorCode:(RCErrorCode)errorCode; /*! 退出聊天室成功的回调 - + @param chatroomId 聊天室ID */ - (void)onChatRoomQuited:(NSString *)chatroomId; @@ -165,7 +171,8 @@ @discussion 设置IMLib的输入状态监听器,请参考RCIMClient的setRCTypingStatusDelegate:方法。 - @warning 如果您使用IMLib,可以设置并实现此Delegate监听消息接收;如果您使用IMKit,请直接设置RCIM中的enableSendComposingStatus,而不要使用此监听器,否则会导致IMKit中无法自动更新UI! + @warning + 如果您使用IMLib,可以设置并实现此Delegate监听消息接收;如果您使用IMKit,请直接设置RCIM中的enableSendComposingStatus,而不要使用此监听器,否则会导致IMKit中无法自动更新UI! */ @protocol RCTypingStatusDelegate @@ -176,7 +183,8 @@ @param targetId 会话目标ID @param userTypingStatusList 正在输入的RCUserTypingStatus列表(nil标示当前没有用户正在输入) - @discussion 当客户端收到用户输入状态的变化时,会回调此接口,通知发生变化的会话以及当前正在输入的RCUserTypingStatus列表。 + @discussion + 当客户端收到用户输入状态的变化时,会回调此接口,通知发生变化的会话以及当前正在输入的RCUserTypingStatus列表。 @warning 目前仅支持单聊。 */ @@ -189,17 +197,17 @@ #pragma mark - 日志监听器 /*! IMLib日志的监听器 - + @discussion 设置IMLib日志的监听器,请参考RCIMClient的setRCLogInfoDelegate:方法。 - + @discussion 您可以通过logLevel来控制日志的级别。 */ @protocol RCLogInfoDelegate /*! IMLib日志的回调 - + @param logInfo 日志信息 */ - (void)didOccurLog:(NSString *)logInfo; @@ -309,7 +317,7 @@ @param statisticServer 统计服务器地址,具体的格式参考下面的说明 @return 是否设置成功 - + @warning 仅限独立数据中心使用,使用前必须先联系商务开通。必须在SDK init和setDeviceToken之前进行设置。 @discussion statisticServer必须为有效的服务器地址,否则会造成推送等业务不能正常使用。 @@ -348,7 +356,7 @@ - (void)connectWithToken:(NSString *)token success:(void (^)(NSString *userId))successBlock error:(void (^)(RCConnectErrorCode status))errorBlock - tokenIncorrect:(void (^)())tokenIncorrectBlock; + tokenIncorrect:(void (^)(void))tokenIncorrectBlock; ///*! // 重新建立与服务器的连接 @@ -429,8 +437,7 @@ @warning 如果您使用IMLib,可以设置并实现此Delegate监听连接状态变化; 如果您使用IMKit,请使用RCIM中的connectionStatusDelegate监听连接状态变化,而不要使用此方法,否则会导致IMKit中无法自动更新UI! */ -- (void)setRCConnectionStatusChangeDelegate: - (id)delegate; +- (void)setRCConnectionStatusChangeDelegate:(id)delegate; /*! 获取当前SDK的连接状态 @@ -456,8 +463,7 @@ /*! 用于Apple Watch的IMLib事务监听器 */ -@property(nonatomic, strong) id - watchKitStatusDelegate; +@property(nonatomic, strong) id watchKitStatusDelegate; #pragma mark - 用户信息 @@ -484,8 +490,7 @@ */ - (void)getUserInfo:(NSString *)userId success:(void (^)(RCUserInfo *userInfo))successBlock - error:(void (^)(RCErrorCode status))errorBlock - __deprecated_msg("已废弃,请勿使用。"); + error:(void (^)(RCErrorCode status))errorBlock __deprecated_msg("已废弃,请勿使用。"); #pragma mark - 消息接收与发送 @@ -528,7 +533,7 @@ 如果您使用此方法发送文件消息,需要您自己实现文件的上传,构建一个RCFileMessage对象, 并将RCFileMessage中的fileUrl字段设置为上传成功的URL地址,然后使用此方法发送。 - + @warning 如果您使用IMLib,可以使用此方法发送消息; 如果您使用IMKit,请使用RCIM中的同名方法发送消息,否则不会自动更新UI。 */ @@ -538,13 +543,11 @@ pushContent:(NSString *)pushContent pushData:(NSString *)pushData success:(void (^)(long messageId))successBlock - error:(void (^)(RCErrorCode nErrorCode, - long messageId))errorBlock; - + error:(void (^)(RCErrorCode nErrorCode, long messageId))errorBlock; /*! 发送媒体消息(图片消息或文件消息) - + @param conversationType 发送消息的会话类型 @param targetId 发送消息的目标会话ID @param content 消息的内容 @@ -557,23 +560,23 @@ messageId:消息的ID] @param cancelBlock 用户取消了消息发送的回调 [messageId:消息的ID] @return 发送的消息实体 - + @discussion 当接收方离线并允许远程推送时,会收到远程推送。 远程推送中包含两部分内容,一是pushContent,用于显示;二是pushData,用于携带不显示的数据。 - + SDK内置的消息类型,如果您将pushContent和pushData置为nil,会使用默认的推送格式进行远程推送。 自定义类型的消息,需要您自己设置pushContent和pushData来定义推送内容,否则将不会进行远程推送。 - + 如果您需要上传图片到自己的服务器,需要构建一个RCImageMessage对象, 并将RCImageMessage中的imageUrl字段设置为上传成功的URL地址,然后使用RCIMClient的 sendMessage:targetId:content:pushContent:pushData:success:error:方法 或sendMessage:targetId:content:pushContent:success:error:方法进行发送,不要使用此方法。 - + 如果您需要上传文件到自己的服务器,构建一个RCFileMessage对象, 并将RCFileMessage中的fileUrl字段设置为上传成功的URL地址,然后使用RCIMClient的 sendMessage:targetId:content:pushContent:pushData:success:error:方法 或sendMessage:targetId:content:pushContent:success:error:方法进行发送,不要使用此方法。 - + @warning 如果您使用IMLib,可以使用此方法发送媒体消息; 如果您使用IMKit,请使用RCIM中的同名方法发送媒体消息,否则不会自动更新UI。 */ @@ -589,7 +592,7 @@ /*! 发送媒体消息(上传图片或文件等媒体信息到指定的服务器) - + @param conversationType 发送消息的会话类型 @param targetId 发送消息的目标会话ID @param content 消息的内容 @@ -604,13 +607,13 @@ messageId:消息的ID] @param cancelBlock 用户取消了消息发送的回调 [messageId:消息的ID] @return 发送的消息实体 - + @discussion 此方法仅用于IMKit。 如果您需要上传图片到自己的服务器并使用IMLib,构建一个RCImageMessage对象, 并将RCImageMessage中的imageUrl字段设置为上传成功的URL地址,然后使用RCIMClient的 sendMessage:targetId:content:pushContent:pushData:success:error:方法 或sendMessage:targetId:content:pushContent:success:error:方法进行发送,不要使用此方法。 - + 如果您需要上传文件到自己的服务器并使用IMLib,构建一个RCFileMessage对象, 并将RCFileMessage中的fileUrl字段设置为上传成功的URL地址,然后使用RCIMClient的 sendMessage:targetId:content:pushContent:pushData:success:error:方法 @@ -629,9 +632,9 @@ /*! 取消发送中的媒体信息 - + @param messageId 媒体消息的messageId - + @return YES表示取消成功,NO表示取消失败,即已经发送成功或者消息不存在。 */ - (BOOL)cancelSendMediaMessage:(long)messageId; @@ -655,18 +658,17 @@ targetId:(NSString *)targetId senderUserId:(NSString *)senderUserId sendStatus:(RCSentStatus)sendStatus - content:(RCMessageContent *)content -__deprecated_msg("已废弃,请勿使用。"); + content:(RCMessageContent *)content __deprecated_msg("已废弃,请勿使用。"); /*! 插入向外发送的消息 - + @param conversationType 会话类型 @param targetId 目标会话ID @param sentStatus 发送状态 @param content 消息的内容 @return 插入的消息实体 - + @discussion 此方法不支持聊天室的会话类型。 */ - (RCMessage *)insertOutgoingMessage:(RCConversationType)conversationType @@ -675,14 +677,14 @@ __deprecated_msg("已废弃,请勿使用。"); content:(RCMessageContent *)content; /*! 插入向外发送的、指定时间的消息(此方法如果 sentTime 有问题会影响消息排序,慎用!!) - + @param conversationType 会话类型 @param targetId 目标会话ID @param sentStatus 发送状态 @param content 消息的内容 @param sentTime 消息发送的Unix时间戳,单位为毫秒(传 0 会按照本地时间插入) @return 插入的消息实体 - + @discussion 此方法不支持聊天室的会话类型。如果sentTime<=0,则被忽略,会以插入时的时间为准。 */ - (RCMessage *)insertOutgoingMessage:(RCConversationType)conversationType @@ -693,14 +695,14 @@ __deprecated_msg("已废弃,请勿使用。"); /*! 插入接收的消息 - + @param conversationType 会话类型 @param targetId 目标会话ID @param senderUserId 发送者ID @param receivedStatus 接收状态 @param content 消息的内容 @return 插入的消息实体 - + @discussion 此方法不支持聊天室的会话类型。 */ - (RCMessage *)insertIncomingMessage:(RCConversationType)conversationType @@ -711,7 +713,7 @@ __deprecated_msg("已废弃,请勿使用。"); /*! 插入接收的消息(此方法如果 sentTime 有问题会影响消息排序,慎用!!) - + @param conversationType 会话类型 @param targetId 目标会话ID @param senderUserId 发送者ID @@ -719,7 +721,7 @@ __deprecated_msg("已废弃,请勿使用。"); @param content 消息的内容 @param sentTime 消息发送的Unix时间戳,单位为毫秒 (传 0 会按照本地时间插入) @return 插入的消息实体 - + @discussion 此方法不支持聊天室的会话类型。 */ - (RCMessage *)insertIncomingMessage:(RCConversationType)conversationType @@ -729,7 +731,6 @@ __deprecated_msg("已废弃,请勿使用。"); content:(RCMessageContent *)content sentTime:(long long)sentTime; - /*! 下载消息内容中的媒体信息 @@ -753,7 +754,7 @@ __deprecated_msg("已废弃,请勿使用。"); /*! 下载消息内容中的媒体信息 - + @param messageId 媒体消息的messageId @param progressBlock 消息下载进度更新的回调 [progress:当前的下载进度, 0 <= progress <= 100] @param successBlock 下载成功的回调[mediaPath:下载成功后本地存放的文件路径] @@ -764,13 +765,13 @@ __deprecated_msg("已废弃,请勿使用。"); progress:(void (^)(int progress))progressBlock success:(void (^)(NSString *mediaPath))successBlock error:(void (^)(RCErrorCode errorCode))errorBlock - cancel:(void (^)())cancelBlock; + cancel:(void (^)(void))cancelBlock; /*! 取消下载中的媒体信息 - + @param messageId 媒体消息的messageId - + @return YES表示取消成功,NO表示取消失败,即已经下载完成或者消息不存在。 */ - (BOOL)cancelDownloadMediaMessage:(long)messageId; @@ -825,7 +826,7 @@ __deprecated_msg("已废弃,请勿使用。"); 如果您使用IMLib,可以使用此方法发送消息; 如果您使用IMKit,请使用RCIM中的同名方法发送消息,否则不会自动更新UI。 - + @warning **已废弃,请勿使用。** 升级说明:如果您之前使用了此接口,可以直接替换为sendMessage:targetId:content:pushContent:pushData:success:error:接口(pushData传为nil),行为和实现完全一致。 */ @@ -834,8 +835,7 @@ __deprecated_msg("已废弃,请勿使用。"); content:(RCMessageContent *)content pushContent:(NSString *)pushContent success:(void (^)(long messageId))successBlock - error:(void (^)(RCErrorCode nErrorCode, - long messageId))errorBlock + error:(void (^)(RCErrorCode nErrorCode, long messageId))errorBlock __deprecated_msg("已废弃,请勿使用。"); /*! @@ -868,18 +868,17 @@ __deprecated_msg("已废弃,请勿使用。"); 如果您使用IMLib,可以使用此方法发送图片消息; 如果您使用IMKit,请使用RCIM中的同名方法发送图片消息,否则不会自动更新UI。 - + @warning **已废弃,请勿使用。** 升级说明:如果您之前使用了此接口,可以直接替换为sendMediaMessage:targetId:content:pushContent:pushData:progress:success:error:cancel:接口(pushData传为nil),行为和实现完全一致。 */ -- (RCMessage *) -sendImageMessage:(RCConversationType)conversationType - targetId:(NSString *)targetId - content:(RCMessageContent *)content - pushContent:(NSString *)pushContent - progress:(void (^)(int progress, long messageId))progressBlock - success:(void (^)(long messageId))successBlock - error:(void (^)(RCErrorCode errorCode, long messageId))errorBlock +- (RCMessage *)sendImageMessage:(RCConversationType)conversationType + targetId:(NSString *)targetId + content:(RCMessageContent *)content + pushContent:(NSString *)pushContent + progress:(void (^)(int progress, long messageId))progressBlock + success:(void (^)(long messageId))successBlock + error:(void (^)(RCErrorCode errorCode, long messageId))errorBlock __deprecated_msg("已废弃,请勿使用。"); /*! @@ -914,15 +913,14 @@ sendImageMessage:(RCConversationType)conversationType @warning **已废弃,请勿使用。** 升级说明:如果您之前使用了此接口,可以直接替换为sendMediaMessage:targetId:content:pushContent:pushData:progress:success:error:cancel:接口,行为和实现完全一致。 */ -- (RCMessage *) -sendImageMessage:(RCConversationType)conversationType - targetId:(NSString *)targetId - content:(RCMessageContent *)content - pushContent:(NSString *)pushContent - pushData:(NSString *)pushData - progress:(void (^)(int progress, long messageId))progressBlock - success:(void (^)(long messageId))successBlock - error:(void (^)(RCErrorCode errorCode, long messageId))errorBlock +- (RCMessage *)sendImageMessage:(RCConversationType)conversationType + targetId:(NSString *)targetId + content:(RCMessageContent *)content + pushContent:(NSString *)pushContent + pushData:(NSString *)pushData + progress:(void (^)(int progress, long messageId))progressBlock + success:(void (^)(long messageId))successBlock + error:(void (^)(RCErrorCode errorCode, long messageId))errorBlock __deprecated_msg("已废弃,请勿使用。"); /*! @@ -951,22 +949,20 @@ sendImageMessage:(RCConversationType)conversationType @warning **已废弃,请勿使用。** 升级说明:如果您之前使用了此接口,可以直接替换为sendMediaMessage:targetId:content:pushContent:pushData:uploadPrepare:progress:success:error:cancel:接口,行为和实现完全一致。 */ -- (RCMessage *) -sendImageMessage:(RCConversationType)conversationType - targetId:(NSString *)targetId - content:(RCMessageContent *)content - pushContent:(NSString *)pushContent - pushData:(NSString *)pushData - uploadPrepare: - (void (^)(RCUploadImageStatusListener *uploadListener))uploadPrepareBlock - progress:(void (^)(int progress, long messageId))progressBlock - success:(void (^)(long messageId))successBlock - error:(void (^)(RCErrorCode errorCode, long messageId))errorBlock +- (RCMessage *)sendImageMessage:(RCConversationType)conversationType + targetId:(NSString *)targetId + content:(RCMessageContent *)content + pushContent:(NSString *)pushContent + pushData:(NSString *)pushData + uploadPrepare:(void (^)(RCUploadImageStatusListener *uploadListener))uploadPrepareBlock + progress:(void (^)(int progress, long messageId))progressBlock + success:(void (^)(long messageId))successBlock + error:(void (^)(RCErrorCode errorCode, long messageId))errorBlock __deprecated_msg("已废弃,请勿使用。"); /*! 发送定向消息 - + @param conversationType 发送消息的会话类型 @param targetId 发送消息的目标会话ID @param userIdList 发送给的用户ID列表 @@ -976,13 +972,13 @@ sendImageMessage:(RCConversationType)conversationType @param successBlock 消息发送成功的回调 [messageId:消息的ID] @param errorBlock 消息发送失败的回调 [errorCode:发送失败的错误码, messageId:消息的ID] - + @return 发送的消息实体 - + @discussion 此方法用于在群组和讨论组中发送消息给其中的部分用户,其它用户不会收到这条消息。 如果您使用IMLib,可以使用此方法发送定向消息; 如果您使用IMKit,请使用RCIM中的同名方法发送定向消息,否则不会自动更新UI。 - + @warning 此方法目前仅支持群组和讨论组。 */ - (RCMessage *)sendDirectionalMessage:(RCConversationType)conversationType @@ -1010,8 +1006,7 @@ sendImageMessage:(RCConversationType)conversationType @warning 如果您使用IMlib,可以设置并实现此Delegate监听消息接收; 如果您使用IMKit,请使用RCIM中的receiveMessageDelegate监听消息接收,而不要使用此方法,否则会导致IMKit中无法自动更新UI! */ -- (void)setReceiveMessageDelegate:(id)delegate - object:(id)userData; +- (void)setReceiveMessageDelegate:(id)delegate object:(id)userData; #pragma mark 消息阅读回执 /*! @@ -1027,7 +1022,7 @@ sendImageMessage:(RCConversationType)conversationType NSNumber *time = [notification.userInfo objectForKey:@"messageTime"]; NSString *targetId = [notification.userInfo objectForKey:@"tId"]; NSString *fromUserId = [notification.userInfo objectForKey:@"fId"]; - + 收到这个消息之后可以更新这个会话中messageTime以前的消息UI为已读(底层数据库消息状态已经改为已读)。 @warning 目前仅支持单聊。 @@ -1052,42 +1047,42 @@ FOUNDATION_EXPORT NSString *const RCLibDispatchReadReceiptNotification; - (void)sendReadReceiptMessage:(RCConversationType)conversationType targetId:(NSString *)targetId time:(long long)timestamp - success:(void (^)())successBlock + success:(void (^)(void))successBlock error:(void (^)(RCErrorCode nErrorCode))errorBlock; /*! 请求消息阅读回执 - + @param message 要求阅读回执的消息 @param successBlock 请求成功的回调 @param errorBlock 请求失败的回调[nErrorCode: 失败的错误码] - + @discussion 通过此接口,可以要求阅读了这条消息的用户发送阅读回执。 */ - (void)sendReadReceiptRequest:(RCMessage *)message - success:(void (^)())successBlock + success:(void (^)(void))successBlock error:(void (^)(RCErrorCode nErrorCode))errorBlock; /*! 发送阅读回执 - + @param conversationType 会话类型 @param targetId 会话ID @param messageList 已经阅读了的消息列表 @param successBlock 发送成功的回调 @param errorBlock 发送失败的回调[nErrorCode: 失败的错误码] - + @discussion 当用户阅读了需要阅读回执的消息,可以通过此接口发送阅读回执,消息的发送方即可直接知道那些人已经阅读。 */ - (void)sendReadReceiptResponse:(RCConversationType)conversationType targetId:(NSString *)targetId messageList:(NSArray *)messageList - success:(void (^)())successBlock + success:(void (^)(void))successBlock error:(void (^)(RCErrorCode nErrorCode))errorBlock; /*! 同步会话阅读状态 - + @param conversationType 会话类型 @param targetId 会话ID @param timestamp 已经阅读的最后一条消息的Unix时间戳(毫秒) @@ -1097,35 +1092,34 @@ FOUNDATION_EXPORT NSString *const RCLibDispatchReadReceiptNotification; - (void)syncConversationReadStatus:(RCConversationType)conversationType targetId:(NSString *)targetId time:(long long)timestamp - success:(void (^)())successBlock + success:(void (^)(void))successBlock error:(void (^)(RCErrorCode nErrorCode))errorBlock; /*! 撤回消息 - + @param message 需要撤回的消息 @param pushContent 当下发 push 消息时,在通知栏里会显示这个字段。如果不设置该字段,无法接受到 push 推送。 @param successBlock 撤回成功的回调 [messageId:撤回的消息ID,该消息已经变更为新的消息] @param errorBlock 撤回失败的回调 [errorCode:撤回失败错误码] - + @warning 仅支持单聊、群组和讨论组。 */ - (void)recallMessage:(RCMessage *)message pushContent:(NSString *)pushContent success:(void (^)(long messageId))successBlock - error:(void(^)(RCErrorCode errorcode))errorBlock; - + error:(void (^)(RCErrorCode errorcode))errorBlock; /*! 撤回消息 - + @param message 需要撤回的消息 @param successBlock 撤回成功的回调 [messageId:撤回的消息ID,该消息已经变更为新的消息] @param errorBlock 撤回失败的回调 [errorCode:撤回失败错误码] */ - (void)recallMessage:(RCMessage *)message success:(void (^)(long messageId))successBlock - error:(void(^)(RCErrorCode errorcode))errorBlock; + error:(void (^)(RCErrorCode errorcode))errorBlock; #pragma mark - 消息操作 @@ -1141,9 +1135,7 @@ FOUNDATION_EXPORT NSString *const RCLibDispatchReadReceiptNotification; 此方法会获取该会话中指定数量的最新消息实体,返回的消息实体按照时间从新到旧排列。 如果会话中的消息数量小于参数count的值,会将该会话中的所有消息返回。 */ -- (NSArray *)getLatestMessages:(RCConversationType)conversationType - targetId:(NSString *)targetId - count:(int)count; +- (NSArray *)getLatestMessages:(RCConversationType)conversationType targetId:(NSString *)targetId count:(int)count; /*! 获取会话中,从指定消息之前、指定数量的最新消息实体 @@ -1210,15 +1202,16 @@ FOUNDATION_EXPORT NSString *const RCLibDispatchReadReceiptNotification; count:(int)count; /*! - 在会话中搜索指定消息的前 beforeCount 数量和后 afterCount 数量的消息。返回的消息列表中会包含指定的消息。消息列表时间顺序从旧到新。 - + 在会话中搜索指定消息的前 beforeCount 数量和后 afterCount + 数量的消息。返回的消息列表中会包含指定的消息。消息列表时间顺序从旧到新。 + @param conversationType 会话类型 @param targetId 目标会话ID @param sentTime 消息的发送时间 @param beforeCount 指定消息的前部分消息数量 @param afterCount 指定消息的后部分消息数量 @return 消息实体RCMessage对象列表 - + @discussion 获取该会话的这条消息及这条消息前 beforeCount 条和后 afterCount 条消息,如前后消息不够则返回实际数量的消息。 */ @@ -1257,10 +1250,11 @@ FOUNDATION_EXPORT NSString *const RCLibDispatchReadReceiptNotification; @param order 拉取顺序,RC_Timestamp_Desc:倒序,RC_Timestamp_ASC:正序 @param successBlock 获取成功的回调 [messages:获取到的历史消息数组, syncTime:下次拉取消息的时间戳] @param errorBlock 获取失败的回调 [status:获取失败的错误码] - + @discussion 此方法从服务器端获取聊天室的历史消息,但是必须先开通聊天室消息云存储功能。 - 指定开始时间,比如2016年9月1日10点(1472695200000), 默认是0(正序:从存储的第一条消息开始拉取,倒序:从存储的最后一条消息开始拉取) + 指定开始时间,比如2016年9月1日10点(1472695200000), + 默认是0(正序:从存储的第一条消息开始拉取,倒序:从存储的最后一条消息开始拉取) */ - (void)getRemoteChatroomHistoryMessages:(NSString *)targetId recordTime:(long long)recordTime @@ -1271,17 +1265,16 @@ FOUNDATION_EXPORT NSString *const RCLibDispatchReadReceiptNotification; /*! 获取会话中@提醒自己的消息 - + @param conversationType 会话类型 @param targetId 目标会话ID - + @discussion 此方法从本地获取被@提醒的消息(最多返回10条信息) @warning 使用 IMKit 注意在进入会话页面前调用,否则在进入会话清除未读数的接口 clearMessagesUnreadStatus: targetId: 以及 设置消息接收状态接口 setMessageReceivedStatus:receivedStatus:会同步清除被提示信息状态。 */ -- (NSArray *)getUnreadMentionedMessages:(RCConversationType)conversationType - targetId:(NSString *)targetId; +- (NSArray *)getUnreadMentionedMessages:(RCConversationType)conversationType targetId:(NSString *)targetId; /*! 获取消息的发送时间(Unix时间戳、毫秒) @@ -1316,7 +1309,7 @@ FOUNDATION_EXPORT NSString *const RCLibDispatchReadReceiptNotification; /*! 删除某个会话中的所有消息 - + @param conversationType 会话类型,不支持聊天室 @param targetId 目标会话ID @param successBlock 成功的回调 @@ -1326,7 +1319,7 @@ FOUNDATION_EXPORT NSString *const RCLibDispatchReadReceiptNotification; */ - (void)deleteMessages:(RCConversationType)conversationType targetId:(NSString *)targetId - success:(void (^)())successBlock + success:(void (^)(void))successBlock error:(void (^)(RCErrorCode status))errorBlock; /*! @@ -1336,8 +1329,7 @@ FOUNDATION_EXPORT NSString *const RCLibDispatchReadReceiptNotification; @param targetId 目标会话ID @return 是否删除成功 */ -- (BOOL)clearMessages:(RCConversationType)conversationType - targetId:(NSString *)targetId; +- (BOOL)clearMessages:(RCConversationType)conversationType targetId:(NSString *)targetId; /*! 设置消息的附加信息 @@ -1355,8 +1347,7 @@ FOUNDATION_EXPORT NSString *const RCLibDispatchReadReceiptNotification; @param receivedStatus 消息的接收状态 @return 是否设置成功 */ -- (BOOL)setMessageReceivedStatus:(long)messageId - receivedStatus:(RCReceivedStatus)receivedStatus; +- (BOOL)setMessageReceivedStatus:(long)messageId receivedStatus:(RCReceivedStatus)receivedStatus; /*! 设置消息的发送状态 @@ -1365,8 +1356,7 @@ FOUNDATION_EXPORT NSString *const RCLibDispatchReadReceiptNotification; @param sentStatus 消息的发送状态 @return 是否设置成功 */ -- (BOOL)setMessageSentStatus:(long)messageId - sentStatus:(RCSentStatus)sentStatus; +- (BOOL)setMessageSentStatus:(long)messageId sentStatus:(RCSentStatus)sentStatus; #pragma mark - 会话列表操作 /*! @@ -1382,19 +1372,16 @@ FOUNDATION_EXPORT NSString *const RCLibDispatchReadReceiptNotification; /*! 分页获取会话列表 - + @param conversationTypeList 会话类型的数组(需要将RCConversationType转为NSNumber构建Array) @param count 获取的数量 @param startTime 会话的时间戳(获取这个时间戳之前的会话列表,0表示从最新开始获取) @return 会话RCConversation的列表 - + @discussion 此方法会从本地数据库中,读取会话列表。 返回的会话列表按照时间从前往后排列,如果有置顶的会话,则置顶的会话会排列在前面。 */ -- (NSArray *)getConversationList:(NSArray *)conversationTypeList - count:(int)count - startTime:(long long)startTime; - +- (NSArray *)getConversationList:(NSArray *)conversationTypeList count:(int)count startTime:(long long)startTime; /*! 获取单个会话数据 @@ -1403,8 +1390,7 @@ FOUNDATION_EXPORT NSString *const RCLibDispatchReadReceiptNotification; @param targetId 目标会话ID @return 会话的对象 */ -- (RCConversation *)getConversation:(RCConversationType)conversationType - targetId:(NSString *)targetId; +- (RCConversation *)getConversation:(RCConversationType)conversationType targetId:(NSString *)targetId; /*! 获取会话中的消息数量 @@ -1415,8 +1401,7 @@ FOUNDATION_EXPORT NSString *const RCLibDispatchReadReceiptNotification; @discussion -1表示获取消息数量出错。 */ -- (int)getMessageCount:(RCConversationType)conversationType - targetId:(NSString *)targetId; +- (int)getMessageCount:(RCConversationType)conversationType targetId:(NSString *)targetId; /*! 删除指定类型的会话 @@ -1435,8 +1420,7 @@ FOUNDATION_EXPORT NSString *const RCLibDispatchReadReceiptNotification; @discussion 此方法会从本地存储中删除该会话,但是不会删除会话中的消息。 */ -- (BOOL)removeConversation:(RCConversationType)conversationType - targetId:(NSString *)targetId; +- (BOOL)removeConversation:(RCConversationType)conversationType targetId:(NSString *)targetId; /*! 设置会话的置顶状态 @@ -1446,16 +1430,14 @@ FOUNDATION_EXPORT NSString *const RCLibDispatchReadReceiptNotification; @param isTop 是否置顶 @return 设置是否成功 */ -- (BOOL)setConversationToTop:(RCConversationType)conversationType - targetId:(NSString *)targetId - isTop:(BOOL)isTop; +- (BOOL)setConversationToTop:(RCConversationType)conversationType targetId:(NSString *)targetId isTop:(BOOL)isTop; /*! 获取置顶的会话列表 - + @param conversationTypeList 会话类型的数组(需要将RCConversationType转为NSNumber构建Array) @return 置顶的会话RCConversation的列表 - + @discussion 此方法会从本地数据库中,读取置顶的会话列表。 */ - (NSArray *)getTopConversationList:(NSArray *)conversationTypeList; @@ -1468,8 +1450,7 @@ FOUNDATION_EXPORT NSString *const RCLibDispatchReadReceiptNotification; @param targetId 会话目标ID @return 该会话中的草稿 */ -- (NSString *)getTextMessageDraft:(RCConversationType)conversationType - targetId:(NSString *)targetId; +- (NSString *)getTextMessageDraft:(RCConversationType)conversationType targetId:(NSString *)targetId; /*! 保存草稿信息 @@ -1490,8 +1471,7 @@ FOUNDATION_EXPORT NSString *const RCLibDispatchReadReceiptNotification; @param targetId 会话目标ID @return 是否删除成功 */ -- (BOOL)clearTextMessageDraft:(RCConversationType)conversationType - targetId:(NSString *)targetId; +- (BOOL)clearTextMessageDraft:(RCConversationType)conversationType targetId:(NSString *)targetId; #pragma mark 未读消息数 @@ -1509,12 +1489,11 @@ FOUNDATION_EXPORT NSString *const RCLibDispatchReadReceiptNotification; @param targetId 会话目标ID @return 该会话内的未读消息数 */ -- (int)getUnreadCount:(RCConversationType)conversationType - targetId:(NSString *)targetId; +- (int)getUnreadCount:(RCConversationType)conversationType targetId:(NSString *)targetId; /*! 获取某些会话的总未读消息数 - + @param conversations 会话列表 (RCConversation 对象只需要 conversationType 和 targetId ) @return 传入会话列表的未读消息数 */ @@ -1530,7 +1509,7 @@ FOUNDATION_EXPORT NSString *const RCLibDispatchReadReceiptNotification; /*! 获取某个类型的会话中所有未读的被@的消息数 - + @param conversationTypes 会话类型的数组 @return 该类型的会话中所有未读的被@的消息数 */ @@ -1543,12 +1522,11 @@ FOUNDATION_EXPORT NSString *const RCLibDispatchReadReceiptNotification; @param targetId 目标会话ID @return 是否清除成功 */ -- (BOOL)clearMessagesUnreadStatus:(RCConversationType)conversationType - targetId:(NSString *)targetId; +- (BOOL)clearMessagesUnreadStatus:(RCConversationType)conversationType targetId:(NSString *)targetId; /*! 清除某个会话中的未读消息数 - + @param conversationType 会话类型,不支持聊天室 @param targetId 目标会话ID @param timestamp 该会话已阅读的最后一条消息的发送时间戳 @@ -1573,13 +1551,11 @@ FOUNDATION_EXPORT NSString *const RCLibDispatchReadReceiptNotification; @discussion 如果您使用IMLib,此方法会屏蔽该会话的远程推送;如果您使用IMKit,此方法会屏蔽该会话的所有提醒(远程推送、本地通知、前台提示音),该接口不支持聊天室。 */ -- (void) -setConversationNotificationStatus:(RCConversationType)conversationType - targetId:(NSString *)targetId - isBlocked:(BOOL)isBlocked - success:(void (^)(RCConversationNotificationStatus - nStatus))successBlock - error:(void (^)(RCErrorCode status))errorBlock; +- (void)setConversationNotificationStatus:(RCConversationType)conversationType + targetId:(NSString *)targetId + isBlocked:(BOOL)isBlocked + success:(void (^)(RCConversationNotificationStatus nStatus))successBlock + error:(void (^)(RCErrorCode status))errorBlock; /*! 查询会话的消息提醒状态 @@ -1589,19 +1565,17 @@ setConversationNotificationStatus:(RCConversationType)conversationType @param successBlock 查询成功的回调 [nStatus:会话设置的消息提醒状态] @param errorBlock 查询失败的回调 [status:设置失败的错误码] */ -- (void) -getConversationNotificationStatus:(RCConversationType)conversationType - targetId:(NSString *)targetId - success:(void (^)(RCConversationNotificationStatus - nStatus))successBlock - error:(void (^)(RCErrorCode status))errorBlock; +- (void)getConversationNotificationStatus:(RCConversationType)conversationType + targetId:(NSString *)targetId + success:(void (^)(RCConversationNotificationStatus nStatus))successBlock + error:(void (^)(RCErrorCode status))errorBlock; /*! 获取屏蔽消息提醒的会话列表 - + @param conversationTypeList 会话类型的数组(需要将RCConversationType转为NSNumber构建Array) @return 屏蔽消息提醒的会话RCConversation的列表 - + @discussion 此方法会从本地数据库中,读取屏蔽消息提醒的会话列表。 */ - (NSArray *)getBlockedConversationList:(NSArray *)conversationTypeList; @@ -1621,7 +1595,7 @@ getConversationNotificationStatus:(RCConversationType)conversationType */ - (void)setNotificationQuietHours:(NSString *)startTime spanMins:(int)spanMins - success:(void (^)())successBlock + success:(void (^)(void))successBlock error:(void (^)(RCErrorCode status))errorBlock; /*! @@ -1630,8 +1604,7 @@ getConversationNotificationStatus:(RCConversationType)conversationType @param successBlock 删除屏蔽成功的回调 @param errorBlock 删除屏蔽失败的回调 [status:失败的错误码] */ -- (void)removeNotificationQuietHours:(void (^)())successBlock - error:(void (^)(RCErrorCode status))errorBlock; +- (void)removeNotificationQuietHours:(void (^)(void))successBlock error:(void (^)(RCErrorCode status))errorBlock; /*! 查询已设置的全局时间段消息提醒屏蔽 @@ -1640,8 +1613,7 @@ getConversationNotificationStatus:(RCConversationType)conversationType spansMin:已设置的屏蔽时间分钟数,0 < spansMin < 1440] @param errorBlock 查询失败的回调 [status:查询失败的错误码] */ -- (void)getNotificationQuietHours:(void (^)(NSString *startTime, - int spansMin))successBlock +- (void)getNotificationQuietHours:(void (^)(NSString *startTime, int spansMin))successBlock error:(void (^)(RCErrorCode status))errorBlock; /*! @@ -1660,9 +1632,8 @@ getConversationNotificationStatus:(RCConversationType)conversationType */ - (void)setConversationNotificationQuietHours:(NSString *)startTime spanMins:(int)spanMins - success:(void (^)())successBlock - error:(void (^)(RCErrorCode status)) - errorBlock + success:(void (^)(void))successBlock + error:(void (^)(RCErrorCode status))errorBlock __deprecated_msg("已废弃,请勿使用。"); /*! @@ -1674,9 +1645,8 @@ getConversationNotificationStatus:(RCConversationType)conversationType @warning **已废弃,请勿使用。** 升级说明:如果您之前使用了此接口,可以直接替换为removeNotificationQuietHours:error:接口,行为和实现完全一致。 */ -- (void)removeConversationNotificationQuietHours:(void (^)())successBlock - error:(void (^)(RCErrorCode status)) - errorBlock +- (void)removeConversationNotificationQuietHours:(void (^)(void))successBlock + error:(void (^)(RCErrorCode status))errorBlock __deprecated_msg("已废弃,请勿使用。"); #pragma mark - 输入状态提醒 @@ -1717,7 +1687,7 @@ getConversationNotificationStatus:(RCConversationType)conversationType @param errorBlock 加入黑名单失败的回调 [status:失败的错误码] */ - (void)addToBlacklist:(NSString *)userId - success:(void (^)())successBlock + success:(void (^)(void))successBlock error:(void (^)(RCErrorCode status))errorBlock; /*! @@ -1728,7 +1698,7 @@ getConversationNotificationStatus:(RCConversationType)conversationType @param errorBlock 移出黑名单失败的回调[status:失败的错误码] */ - (void)removeFromBlacklist:(NSString *)userId - success:(void (^)())successBlock + success:(void (^)(void))successBlock error:(void (^)(RCErrorCode status))errorBlock; /*! @@ -1750,8 +1720,7 @@ getConversationNotificationStatus:(RCConversationType)conversationType [blockUserIds:已经设置的黑名单中的用户ID列表] @param errorBlock 查询失败的回调 [status:失败的错误码] */ -- (void)getBlacklist:(void (^)(NSArray *blockUserIds))successBlock - error:(void (^)(RCErrorCode status))errorBlock; +- (void)getBlacklist:(void (^)(NSArray *blockUserIds))successBlock error:(void (^)(RCErrorCode status))errorBlock; #pragma mark - 讨论组操作 @@ -1802,8 +1771,7 @@ getConversationNotificationStatus:(RCConversationType)conversationType */ - (void)removeMemberFromDiscussion:(NSString *)discussionId userId:(NSString *)userId - success: - (void (^)(RCDiscussion *discussion))successBlock + success:(void (^)(RCDiscussion *discussion))successBlock error:(void (^)(RCErrorCode status))errorBlock; /*! @@ -1841,7 +1809,7 @@ getConversationNotificationStatus:(RCConversationType)conversationType */ - (void)setDiscussionName:(NSString *)discussionId name:(NSString *)discussionName - success:(void (^)())successBlock + success:(void (^)(void))successBlock error:(void (^)(RCErrorCode status))errorBlock; /*! @@ -1857,7 +1825,7 @@ getConversationNotificationStatus:(RCConversationType)conversationType */ - (void)setDiscussionInviteStatus:(NSString *)discussionId isOpen:(BOOL)isOpen - success:(void (^)())successBlock + success:(void (^)(void))successBlock error:(void (^)(RCErrorCode status))errorBlock; #pragma mark - 群组操作(已废弃,请勿使用) @@ -1875,9 +1843,8 @@ getConversationNotificationStatus:(RCConversationType)conversationType @warning **已废弃,请勿使用。** */ - (void)syncGroups:(NSArray *)groupList - success:(void (^)())successBlock - error:(void (^)(RCErrorCode status))errorBlock - __deprecated_msg("已废弃,请勿使用。"); + success:(void (^)(void))successBlock + error:(void (^)(RCErrorCode status))errorBlock __deprecated_msg("已废弃,请勿使用。"); /*! 加入群组(已废弃,建议您通过您的App Server进行群组操作) @@ -1894,9 +1861,8 @@ getConversationNotificationStatus:(RCConversationType)conversationType */ - (void)joinGroup:(NSString *)groupId groupName:(NSString *)groupName - success:(void (^)())successBlock - error:(void (^)(RCErrorCode status))errorBlock - __deprecated_msg("已废弃,请勿使用。"); + success:(void (^)(void))successBlock + error:(void (^)(RCErrorCode status))errorBlock __deprecated_msg("已废弃,请勿使用。"); /*! 退出群组(已废弃,建议您通过您的App Server进行群组操作) @@ -1911,9 +1877,8 @@ getConversationNotificationStatus:(RCConversationType)conversationType @warning **已废弃,请勿使用。** */ - (void)quitGroup:(NSString *)groupId - success:(void (^)())successBlock - error:(void (^)(RCErrorCode status))errorBlock - __deprecated_msg("已废弃,请勿使用。"); + success:(void (^)(void))successBlock + error:(void (^)(RCErrorCode status))errorBlock __deprecated_msg("已废弃,请勿使用。"); #pragma mark - 聊天室操作 @@ -1932,7 +1897,7 @@ getConversationNotificationStatus:(RCConversationType)conversationType */ - (void)joinChatRoom:(NSString *)targetId messageCount:(int)messageCount - success:(void (^)())successBlock + success:(void (^)(void))successBlock error:(void (^)(RCErrorCode status))errorBlock; /*! @@ -1956,7 +1921,7 @@ getConversationNotificationStatus:(RCConversationType)conversationType */ - (void)joinExistChatRoom:(NSString *)targetId messageCount:(int)messageCount - success:(void (^)())successBlock + success:(void (^)(void))successBlock error:(void (^)(RCErrorCode status))errorBlock; /*! @@ -1968,19 +1933,21 @@ getConversationNotificationStatus:(RCConversationType)conversationType [status:退出聊天室失败的错误码] */ - (void)quitChatRoom:(NSString *)targetId - success:(void (^)())successBlock + success:(void (^)(void))successBlock error:(void (^)(RCErrorCode status))errorBlock; /*! 获取聊天室的信息(包含部分成员信息和当前聊天室中的成员总数) @param targetId 聊天室ID - @param count 需要获取的成员信息的数量(目前获取到的聊天室信息中仅包含不多于20人的成员信息,即0 <= count <= 20,传入0获取到的聊天室信息将或仅包含成员总数,不包含具体的成员列表) + @param count 需要获取的成员信息的数量(目前获取到的聊天室信息中仅包含不多于20人的成员信息,即0 <= count <= + 20,传入0获取到的聊天室信息将或仅包含成员总数,不包含具体的成员列表) @param order 需要获取的成员列表的顺序(最早加入或是最晚加入的部分成员) @param successBlock 获取成功的回调 [chatRoomInfo:聊天室信息] @param errorBlock 获取失败的回调 [status:获取失败的错误码] - @discussion 因为聊天室一般成员数量巨大,权衡效率和用户体验,目前返回的聊天室信息仅包含不多于20人的成员信息和当前成员总数。如果您使用RC_ChatRoom_Member_Asc升序方式查询,将返回最早加入的成员信息列表,按加入时间从旧到新排列;如果您使用RC_ChatRoom_Member_Desc降序方式查询,将返回最晚加入的成员信息列表,按加入时间从新到旧排列。 + @discussion + 因为聊天室一般成员数量巨大,权衡效率和用户体验,目前返回的聊天室信息仅包含不多于20人的成员信息和当前成员总数。如果您使用RC_ChatRoom_Member_Asc升序方式查询,将返回最早加入的成员信息列表,按加入时间从旧到新排列;如果您使用RC_ChatRoom_Member_Desc降序方式查询,将返回最晚加入的成员信息列表,按加入时间从新到旧排列。 */ - (void)getChatRoomInfo:(NSString *)targetId count:(int)count @@ -1990,7 +1957,7 @@ getConversationNotificationStatus:(RCConversationType)conversationType /*! 设置IMLib的聊天室状态监听器 - + @param delegate IMLib聊天室状态监听器 */ - (void)setChatRoomStatusDelegate:(id)delegate; @@ -2037,7 +2004,7 @@ getConversationNotificationStatus:(RCConversationType)conversationType */ - (void)subscribePublicService:(RCPublicServiceType)publicServiceType publicServiceId:(NSString *)publicServiceId - success:(void (^)())successBlock + success:(void (^)(void))successBlock error:(void (^)(RCErrorCode status))errorBlock; /*! @@ -2050,7 +2017,7 @@ getConversationNotificationStatus:(RCConversationType)conversationType */ - (void)unsubscribePublicService:(RCPublicServiceType)publicServiceType publicServiceId:(NSString *)publicServiceId - success:(void (^)())successBlock + success:(void (^)(void))successBlock error:(void (^)(RCErrorCode status))errorBlock; /*! @@ -2069,8 +2036,7 @@ getConversationNotificationStatus:(RCConversationType)conversationType @discussion 此方法会从本地缓存中获取公众服务账号信息 */ -- (RCPublicServiceProfile *)getPublicServiceProfile: - (RCPublicServiceType)publicServiceType +- (RCPublicServiceProfile *)getPublicServiceProfile:(RCPublicServiceType)publicServiceType publicServiceId:(NSString *)publicServiceId; /*! @@ -2081,14 +2047,12 @@ getConversationNotificationStatus:(RCConversationType)conversationType @param onSuccess 获取成功的回调 [serviceProfile:获取到的公众账号信息] @param onError 获取失败的回调 [error:失败的错误码] - + @discussion 此方法会从服务器获取公众服务账号信息 */ - (void)getPublicServiceProfile:(NSString *)targetId conversationType:(RCConversationType)type - onSuccess: - (void (^)(RCPublicServiceProfile *serviceProfile)) - onSuccess + onSuccess:(void (^)(RCPublicServiceProfile *serviceProfile))onSuccess onError:(void (^)(NSError *error))onError; /*! @@ -2096,8 +2060,9 @@ getConversationNotificationStatus:(RCConversationType)conversationType @param URLString 准备打开的URL @return 公众服务使用的WebView Controller - - @discussion 如果您选在用WebView打开URL连接,则您需要在App的Info.plist的NSAppTransportSecurity中增加NSAllowsArbitraryLoadsInWebContent和NSAllowsArbitraryLoads字段,并在苹果审核的时候提供额外的说明。 + + @discussion + 如果您选在用WebView打开URL连接,则您需要在App的Info.plist的NSAppTransportSecurity中增加NSAllowsArbitraryLoadsInWebContent和NSAllowsArbitraryLoads字段,并在苹果审核的时候提供额外的说明。 更多内容可以参考:https://developer.apple.com/library/content/documentation/General/Reference/InfoPlistKeyReference/Articles/CocoaKeys.html#//apple_ref/doc/uid/TP40009251-SW55 */ - (UIViewController *)getPublicServiceWebViewController:(NSString *)URLString; @@ -2168,7 +2133,7 @@ getConversationNotificationStatus:(RCConversationType)conversationType /*! 获取当前手机与服务器的时间差 - + @return 时间差 */ - (long long)getDeltaTime; @@ -2183,7 +2148,7 @@ getConversationNotificationStatus:(RCConversationType)conversationType /*! 将AMR格式的音频数据转化为WAV格式的音频数据,数据开头不携带WAVE文件头 - + @param data AMR格式的音频数据,必须是AMR-NB的格式 @return WAV格式的音频数据 */ @@ -2204,9 +2169,7 @@ getConversationNotificationStatus:(RCConversationType)conversationType 如果您想和SDK自带的语音消息保持一致和互通,考虑到跨平台和传输的原因,SDK对于WAV音频有所限制. 具体可以参考RCVoiceMessage中的音频参数说明(nChannels为1,nBitsPerSample为16)。 */ -- (NSData *)encodeWAVEToAMR:(NSData *)data - channel:(int)nChannels - nBitsPerSample:(int)nBitsPerSample; +- (NSData *)encodeWAVEToAMR:(NSData *)data channel:(int)nChannels nBitsPerSample:(int)nBitsPerSample; #pragma mark - 客服方法 /*! @@ -2221,20 +2184,19 @@ getConversationNotificationStatus:(RCConversationType)conversationType @param selectGroupBlock 客服分组选择 @param quitBlock 客服被动结束。如果主动调用stopCustomerService,则不会调用到该block - @discussion 有些客服提供商可能会主动邀请评价,有些不会,所以用lib开发客服需要注意对pullEvaluationBlock的处理。在pullEvaluationBlock里应该弹出评价。如果pullEvaluationBlock没有被调用到,需要在结束客服时(之前之后都可以)弹出评价框并评价。如果客服有分组,selectGroupBlock会被回调,此时必须让用户选择分组然后调用selectCustomerServiceGroup:withGroupId:。 + @discussion + 有些客服提供商可能会主动邀请评价,有些不会,所以用lib开发客服需要注意对pullEvaluationBlock的处理。在pullEvaluationBlock里应该弹出评价。如果pullEvaluationBlock没有被调用到,需要在结束客服时(之前之后都可以)弹出评价框并评价。如果客服有分组,selectGroupBlock会被回调,此时必须让用户选择分组然后调用selectCustomerServiceGroup:withGroupId:。 @warning 如果你使用IMKit,请不要使用此方法。RCConversationViewController默认已经做了处理。 */ -- (void) -startCustomerService:(NSString *)kefuId - info:(RCCustomerServiceInfo *)csInfo - onSuccess:(void (^)(RCCustomerServiceConfig *config))successBlock - onError:(void (^)(int errorCode, NSString *errMsg))errorBlock - onModeType:(void (^)(RCCSModeType mode))modeTypeBlock - onPullEvaluation:(void (^)(NSString *dialogId))pullEvaluationBlock - onSelectGroup:(void (^)(NSArray *groupList))selectGroupBlock - onQuit:(void (^)(NSString *quitMsg))quitBlock; - +- (void)startCustomerService:(NSString *)kefuId + info:(RCCustomerServiceInfo *)csInfo + onSuccess:(void (^)(RCCustomerServiceConfig *config))successBlock + onError:(void (^)(int errorCode, NSString *errMsg))errorBlock + onModeType:(void (^)(RCCSModeType mode))modeTypeBlock + onPullEvaluation:(void (^)(NSString *dialogId))pullEvaluationBlock + onSelectGroup:(void (^)(NSArray *groupList))selectGroupBlock + onQuit:(void (^)(NSString *quitMsg))quitBlock; /*! 结束客服聊天 @@ -2249,7 +2211,7 @@ startCustomerService:(NSString *)kefuId /*! 选择客服分组模式 - + @param kefuId 客服ID @param groupId 选择的客服分组id @discussion 此方法依赖startCustomerService方法,只有调用成功以后才有效。 @@ -2313,7 +2275,7 @@ startCustomerService:(NSString *)kefuId /*! 通用客服评价,不区分机器人人工 - + @param kefuId 客服ID @param dialogId 对话ID,客服请求评价的对话ID @param value 分数,取值范围1-5 @@ -2327,13 +2289,13 @@ startCustomerService:(NSString *)kefuId */ - (void)evaluateCustomerService:(NSString *)kefuId dialogId:(NSString *)dialogId - starValue:(int)value + starValue:(int)value suggest:(NSString *)suggest resolveStatus:(RCCSResolveStatus)resolveStatus; /*! 客服留言 - + @param kefuId 客服ID @param leaveMessageDic 客服留言信息字典,根据RCCSLeaveMessageItem中关于留言的配置存储对应的key-value @discussion 此方法依赖startCustomerService方法。可在客服结束之前或之后调用。 @@ -2343,22 +2305,22 @@ startCustomerService:(NSString *)kefuId */ - (void)leaveMessageCustomerService:(NSString *)kefuId leaveMessageDic:(NSDictionary *)leaveMessageDic - success:(void (^)())successBlock - failure:(void (^)())failureBlock; + success:(void (^)(void))successBlock + failure:(void (^)(void))failureBlock; #pragma mark - 搜索 /*! 根据关键字搜索指定会话中的消息 - + @param conversationType 会话类型 @param targetId 会话ID @param keyword 关键字 @param count 最大的查询数量 @param startTime 查询记录的起始时间(传 0 表示不限时间) - + @return 匹配的消息列表 */ -- (NSArray *)searchMessages:(RCConversationType)conversationType +- (NSArray *)searchMessages:(RCConversationType)conversationType targetId:(NSString *)targetId keyword:(NSString *)keyword count:(int)count @@ -2366,18 +2328,17 @@ startCustomerService:(NSString *)kefuId /*! 根据关键字搜索会话 - + @param conversationTypeList 需要搜索的会话类型列表 @param objectNameList 需要搜索的消息类型名列表(即每个消息类方法getObjectName的返回值) @param keyword 关键字 - + @return 匹配的会话搜索结果列表 - + @discussion 目前,SDK内置的文本消息、文件消息、图文消息支持搜索。 自定义的消息必须要实现RCMessageContent的getSearchableWords接口才能进行搜索。 */ -- (NSArray *)searchConversations: - (NSArray *)conversationTypeList +- (NSArray *)searchConversations:(NSArray *)conversationTypeList messageType:(NSArray *)objectNameList keyword:(NSString *)keyword; @@ -2386,57 +2347,56 @@ startCustomerService:(NSString *)kefuId /*! 设置日志级别 */ -@property (nonatomic, assign) RCLogLevel logLevel; +@property(nonatomic, assign) RCLogLevel logLevel; /*! 设置IMLib日志的监听器 - + @param delegate IMLib日志的监听器 @discussion 您可以通过logLevel来控制日志的级别。 */ -- (void)setRCLogInfoDelegate: (id)delegate; +- (void)setRCLogInfoDelegate:(id)delegate; #pragma mark - File Storage /*! 文件消息下载路径 - + @discussion 默认值为沙盒下的Documents/MyFile目录。您可以通过修改RCConfig.plist中的RelativePath来修改该路径。 */ -@property (nonatomic, strong, readonly) NSString *fileStoragePath; +@property(nonatomic, strong, readonly) NSString *fileStoragePath; #pragma mark - 第三方平台厂商接口 /*! 获取Vendor token. 仅供融云第三方服务厂家使用。 - + @param successBlock 成功回调 @param errorBlock 失败回调 */ -- (void)getVendorToken:(void (^)(NSString *vendorToken))successBlock - error:(void (^)(RCErrorCode nErrorCode))errorBlock; +- (void)getVendorToken:(void (^)(NSString *vendorToken))successBlock error:(void (^)(RCErrorCode nErrorCode))errorBlock; //远程推送相关设置 -@property(nonatomic,strong,readonly)RCPushProfile *pushProfile; +@property(nonatomic, strong, readonly) RCPushProfile *pushProfile; #pragma mark - 历史消息 /** 设置离线消息补偿时间(以天为单位) - + @param duration 离线消息补偿时间,范围【1~7天】 @param successBlock 成功回调 @param errorBlock 失败回调 */ --(void)setOfflineMessageDuration:(int)duration - success:(void (^)())successBlock - failure:(void (^)(RCErrorCode nErrorCode))errorBlock; +- (void)setOfflineMessageDuration:(int)duration + success:(void (^)(void))successBlock + failure:(void (^)(RCErrorCode nErrorCode))errorBlock; /** 获取离线消息补偿时间 (以天为单位) - + @return 离线消息补偿时间 */ --(int)getOfflineMessageDuration; +- (int)getOfflineMessageDuration; @end #endif diff --git a/ios-rongcallkit/framework/RongIMLib.framework/Headers/RCImageMessage.h b/ios-rongcallkit/framework/RongIMLib.framework/Headers/RCImageMessage.h index 2885bf0..e94275a 100644 --- a/ios-rongcallkit/framework/RongIMLib.framework/Headers/RCImageMessage.h +++ b/ios-rongcallkit/framework/RongIMLib.framework/Headers/RCImageMessage.h @@ -62,7 +62,7 @@ /*! 图片消息的原始图片信息 */ -@property(nonatomic, strong,readonly) NSData *originalImageData; +@property(nonatomic, strong, readonly) NSData *originalImageData; /*! 初始化图片消息 @@ -82,7 +82,7 @@ /*! 初始化图片消息 - + @param imageData 图片的原始数据 @return 图片消息对象 */ diff --git a/ios-rongcallkit/framework/RongIMLib.framework/Headers/RCInformationNotificationMessage.h b/ios-rongcallkit/framework/RongIMLib.framework/Headers/RCInformationNotificationMessage.h index c4acf10..2ba97da 100644 --- a/ios-rongcallkit/framework/RongIMLib.framework/Headers/RCInformationNotificationMessage.h +++ b/ios-rongcallkit/framework/RongIMLib.framework/Headers/RCInformationNotificationMessage.h @@ -22,7 +22,7 @@ @discussion 通知消息类,此消息会进行存储,但不计入未读消息数。 */ -@interface RCInformationNotificationMessage : RCMessageContent +@interface RCInformationNotificationMessage : RCMessageContent /*! 通知的内容 @@ -41,7 +41,6 @@ @param extra 通知的附加信息 @return 通知消息对象 */ -+ (instancetype)notificationWithMessage:(NSString *)message - extra:(NSString *)extra; ++ (instancetype)notificationWithMessage:(NSString *)message extra:(NSString *)extra; @end diff --git a/ios-rongcallkit/framework/RongIMLib.framework/Headers/RCMentionedInfo.h b/ios-rongcallkit/framework/RongIMLib.framework/Headers/RCMentionedInfo.h index e8af32f..99aec92 100644 --- a/ios-rongcallkit/framework/RongIMLib.framework/Headers/RCMentionedInfo.h +++ b/ios-rongcallkit/framework/RongIMLib.framework/Headers/RCMentionedInfo.h @@ -38,11 +38,11 @@ /*! 初始化@提醒信息 - + @param type @提醒的类型 @param userIdList @的用户ID列表 @param mentionedContent @ Push 内容 - + @return @提醒信息的对象 */ - (instancetype)initWithMentionedType:(RCMentionedType)type diff --git a/ios-rongcallkit/framework/RongIMLib.framework/Headers/RCMessage.h b/ios-rongcallkit/framework/RongIMLib.framework/Headers/RCMessage.h index 757afaf..4ca22d7 100644 --- a/ios-rongcallkit/framework/RongIMLib.framework/Headers/RCMessage.h +++ b/ios-rongcallkit/framework/RongIMLib.framework/Headers/RCMessage.h @@ -13,8 +13,8 @@ #ifndef __RCMessage #define __RCMessage #import "RCMessageContent.h" -#import "RCStatusDefine.h" #import "RCReadReceiptInfo.h" +#import "RCStatusDefine.h" #import /*! @@ -98,7 +98,6 @@ */ @property(nonatomic, strong) RCReadReceiptInfo *readReceiptInfo; - /*! RCMessage初始化方法 @@ -122,8 +121,7 @@ @warning **已废弃,请勿使用。** */ -+ (instancetype)messageWithJSON:(NSDictionary *)jsonData - __deprecated_msg("已废弃,请勿使用。"); ++ (instancetype)messageWithJSON:(NSDictionary *)jsonData __deprecated_msg("已废弃,请勿使用。"); @end #endif diff --git a/ios-rongcallkit/framework/RongIMLib.framework/Headers/RCMessageContent.h b/ios-rongcallkit/framework/RongIMLib.framework/Headers/RCMessageContent.h index 3b72651..b45903a 100644 --- a/ios-rongcallkit/framework/RongIMLib.framework/Headers/RCMessageContent.h +++ b/ios-rongcallkit/framework/RongIMLib.framework/Headers/RCMessageContent.h @@ -13,10 +13,10 @@ #ifndef __RCMessageContent #define __RCMessageContent +#import "RCMentionedInfo.h" #import "RCStatusDefine.h" #import "RCUserInfo.h" #import -#import "RCMentionedInfo.h" /*! 消息内容的编解码协议 @@ -58,9 +58,9 @@ /*! 返回可搜索的关键内容列表 - + @return 返回可搜索的关键内容列表 - + @discussion 这里返回的关键内容列表将用于消息搜索,自定义消息必须要实现此接口才能进行搜索。 */ - (NSArray *)getSearchableWords; @@ -113,9 +113,7 @@ 所有的消息内容均为此类的子类,包括SDK自带的消息(如RCTextMessage、RCImageMessage等)和用户自定义的消息。 所有的自定义消息必须继承此类,并实现RCMessageCoding和RCMessagePersistentCompatible、RCMessageContentView协议。 */ -@interface RCMessageContent - : NSObject +@interface RCMessageContent : NSObject /*! 消息内容中携带的发送者的用户信息 @@ -139,12 +137,11 @@ /*! 将消息内容中携带的@提醒信息解码 - + @param dictionary @提醒信息的Dictionary */ - (void)decodeMentionedInfo:(NSDictionary *)dictionary; - /*! 消息内容的原始json数据 diff --git a/ios-rongcallkit/framework/RongIMLib.framework/Headers/RCProfileNotificationMessage.h b/ios-rongcallkit/framework/RongIMLib.framework/Headers/RCProfileNotificationMessage.h index d7c35b8..31b1fc4 100644 --- a/ios-rongcallkit/framework/RongIMLib.framework/Headers/RCProfileNotificationMessage.h +++ b/ios-rongcallkit/framework/RongIMLib.framework/Headers/RCProfileNotificationMessage.h @@ -22,7 +22,7 @@ @discussion 公众服务账号信息变更消息类,此消息会进行存储,但不计入未读消息数。 */ -@interface RCProfileNotificationMessage : RCMessageContent +@interface RCProfileNotificationMessage : RCMessageContent /*! 公众服务账号信息变更的操作名 @@ -47,8 +47,6 @@ @param extra 信息变更的附加信息 @return 公众服务账号信息变更消息的对象 */ -+ (instancetype)notificationWithOperation:(NSString *)operation - data:(NSString *)data - extra:(NSString *)extra; ++ (instancetype)notificationWithOperation:(NSString *)operation data:(NSString *)data extra:(NSString *)extra; @end diff --git a/ios-rongcallkit/framework/RongIMLib.framework/Headers/RCPublicServiceCommandMessage.h b/ios-rongcallkit/framework/RongIMLib.framework/Headers/RCPublicServiceCommandMessage.h index f6b15f0..63087fd 100644 --- a/ios-rongcallkit/framework/RongIMLib.framework/Headers/RCPublicServiceCommandMessage.h +++ b/ios-rongcallkit/framework/RongIMLib.framework/Headers/RCPublicServiceCommandMessage.h @@ -20,7 +20,7 @@ @discussion 公众服务请求消息类,此消息不存储,也不计入未读消息数。 此消息仅用于客户端公共服务账号中的菜单,向服务器发送请求。 */ -@interface RCPublicServiceCommandMessage : RCMessageContent +@interface RCPublicServiceCommandMessage : RCMessageContent /*! 请求的名称 diff --git a/ios-rongcallkit/framework/RongIMLib.framework/Headers/RCPublicServiceMenu.h b/ios-rongcallkit/framework/RongIMLib.framework/Headers/RCPublicServiceMenu.h index c443bde..6ca3e45 100644 --- a/ios-rongcallkit/framework/RongIMLib.framework/Headers/RCPublicServiceMenu.h +++ b/ios-rongcallkit/framework/RongIMLib.framework/Headers/RCPublicServiceMenu.h @@ -40,7 +40,6 @@ @warning **已废弃,请勿使用。** */ -- (void)decodeWithJsonDictionaryArray:(NSArray *)jsonDictionary - __deprecated_msg("已废弃,请勿使用。"); +- (void)decodeWithJsonDictionaryArray:(NSArray *)jsonDictionary __deprecated_msg("已废弃,请勿使用。"); @end diff --git a/ios-rongcallkit/framework/RongIMLib.framework/Headers/RCPublicServiceMenuItem.h b/ios-rongcallkit/framework/RongIMLib.framework/Headers/RCPublicServiceMenuItem.h index d0f93be..ecb3f43 100644 --- a/ios-rongcallkit/framework/RongIMLib.framework/Headers/RCPublicServiceMenuItem.h +++ b/ios-rongcallkit/framework/RongIMLib.framework/Headers/RCPublicServiceMenuItem.h @@ -53,7 +53,6 @@ @warning **已废弃,请勿使用。** */ -+ (NSArray *)menuItemsFromJsonArray:(NSArray *)jsonArray - __deprecated_msg("已废弃,请勿使用。"); ++ (NSArray *)menuItemsFromJsonArray:(NSArray *)jsonArray __deprecated_msg("已废弃,请勿使用。"); @end diff --git a/ios-rongcallkit/framework/RongIMLib.framework/Headers/RCPublicServiceMultiRichContentMessage.h b/ios-rongcallkit/framework/RongIMLib.framework/Headers/RCPublicServiceMultiRichContentMessage.h index 4343a9e..306c377 100644 --- a/ios-rongcallkit/framework/RongIMLib.framework/Headers/RCPublicServiceMultiRichContentMessage.h +++ b/ios-rongcallkit/framework/RongIMLib.framework/Headers/RCPublicServiceMultiRichContentMessage.h @@ -22,7 +22,7 @@ @discussion 公众服务的多图文消息类,此消息会进行存储并计入未读消息数。 */ -@interface RCPublicServiceMultiRichContentMessage : RCMessageContent +@interface RCPublicServiceMultiRichContentMessage : RCMessageContent /*! 多图文消息的内容RCRichContentItem数组 diff --git a/ios-rongcallkit/framework/RongIMLib.framework/Headers/RCPublicServiceRichContentMessage.h b/ios-rongcallkit/framework/RongIMLib.framework/Headers/RCPublicServiceRichContentMessage.h index 5661e96..f5d3628 100644 --- a/ios-rongcallkit/framework/RongIMLib.framework/Headers/RCPublicServiceRichContentMessage.h +++ b/ios-rongcallkit/framework/RongIMLib.framework/Headers/RCPublicServiceRichContentMessage.h @@ -23,7 +23,7 @@ @discussion 公众服务图文消息类,此消息会进行存储并计入未读消息数。 */ -@interface RCPublicServiceRichContentMessage : RCMessageContent +@interface RCPublicServiceRichContentMessage : RCMessageContent /*! 公众服务图文信息条目RCRichContentItem内容 diff --git a/ios-rongcallkit/framework/RongIMLib.framework/Headers/RCPushProfile.h b/ios-rongcallkit/framework/RongIMLib.framework/Headers/RCPushProfile.h index 1e39a4b..1f81fdf 100644 --- a/ios-rongcallkit/framework/RongIMLib.framework/Headers/RCPushProfile.h +++ b/ios-rongcallkit/framework/RongIMLib.framework/Headers/RCPushProfile.h @@ -6,12 +6,12 @@ // Copyright © 2016年 RongCloud. All rights reserved. // -#import #import "RCStatusDefine.h" +#import @interface RCPushProfile : NSObject //是否显示远程推送的内容 -@property(nonatomic,assign,readonly)BOOL isShowPushContent; +@property(nonatomic, assign, readonly) BOOL isShowPushContent; /** 设置是否显示远程推送的内容 @@ -20,8 +20,8 @@ @param successBlock 成功回调 @param errorBlock 失败回调 */ --(void)updateShowPushContentStatus:(BOOL)isShowPushContent - success:(void (^)())successBlock - error:(void (^)(RCErrorCode status))errorBlock; +- (void)updateShowPushContentStatus:(BOOL)isShowPushContent + success:(void (^)(void))successBlock + error:(void (^)(RCErrorCode status))errorBlock; @end diff --git a/ios-rongcallkit/framework/RongIMLib.framework/Headers/RCReadReceiptInfo.h b/ios-rongcallkit/framework/RongIMLib.framework/Headers/RCReadReceiptInfo.h index 879b6f3..1b19c3c 100644 --- a/ios-rongcallkit/framework/RongIMLib.framework/Headers/RCReadReceiptInfo.h +++ b/ios-rongcallkit/framework/RongIMLib.framework/Headers/RCReadReceiptInfo.h @@ -18,7 +18,7 @@ /** * 是否已经发送回执 */ -@property(nonatomic,assign) BOOL hasRespond; +@property(nonatomic, assign) BOOL hasRespond; /*! 发送回执的用户ID列表 diff --git a/ios-rongcallkit/framework/RongIMLib.framework/Headers/RCRealTimeLocationManager.h b/ios-rongcallkit/framework/RongIMLib.framework/Headers/RCRealTimeLocationManager.h index a17c9a1..3cf811d 100644 --- a/ios-rongcallkit/framework/RongIMLib.framework/Headers/RCRealTimeLocationManager.h +++ b/ios-rongcallkit/framework/RongIMLib.framework/Headers/RCRealTimeLocationManager.h @@ -14,44 +14,44 @@ 实时位置共享状态 */ typedef NS_ENUM(NSInteger, RCRealTimeLocationStatus) { - /*! - 实时位置共享,初始状态 - */ - RC_REAL_TIME_LOCATION_STATUS_IDLE, - /*! - 实时位置共享,接收状态 - */ - RC_REAL_TIME_LOCATION_STATUS_INCOMING, - /*! - 实时位置共享,发起状态 - */ - RC_REAL_TIME_LOCATION_STATUS_OUTGOING, - /*! - 实时位置共享,共享状态 - */ - RC_REAL_TIME_LOCATION_STATUS_CONNECTED + /*! + 实时位置共享,初始状态 + */ + RC_REAL_TIME_LOCATION_STATUS_IDLE, + /*! + 实时位置共享,接收状态 + */ + RC_REAL_TIME_LOCATION_STATUS_INCOMING, + /*! + 实时位置共享,发起状态 + */ + RC_REAL_TIME_LOCATION_STATUS_OUTGOING, + /*! + 实时位置共享,共享状态 + */ + RC_REAL_TIME_LOCATION_STATUS_CONNECTED }; /*! 实时位置共享错误码 */ typedef NS_ENUM(NSInteger, RCRealTimeLocationErrorCode) { - /*! - 当前设备不支持实时位置共享 - */ - RC_REAL_TIME_LOCATION_NOT_SUPPORT, - /*! - 当前会话不支持实时位置共享 - */ - RC_REAL_TIME_LOCATION_CONVERSATION_NOT_SUPPORT, - /*! - 当前会话超出了参与者人数限制 - */ - RC_REAL_TIME_LOCATION_EXCEED_MAX_PARTICIPANT, - /*! - 获取当前会话信息失败 - */ - RC_REAL_TIME_LOCATION_GET_CONVERSATION_FAILURE + /*! + 当前设备不支持实时位置共享 + */ + RC_REAL_TIME_LOCATION_NOT_SUPPORT, + /*! + 当前会话不支持实时位置共享 + */ + RC_REAL_TIME_LOCATION_CONVERSATION_NOT_SUPPORT, + /*! + 当前会话超出了参与者人数限制 + */ + RC_REAL_TIME_LOCATION_EXCEED_MAX_PARTICIPANT, + /*! + 获取当前会话信息失败 + */ + RC_REAL_TIME_LOCATION_GET_CONVERSATION_FAILURE }; /*! @@ -184,12 +184,9 @@ typedef NS_ENUM(NSInteger, RCRealTimeLocationErrorCode) { @param successBlock 获取代理成功的处理 @param errorBlock 获取代理失败的处理 */ -- (void) -getRealTimeLocationProxy:(RCConversationType)conversationType - targetId:(NSString *)targetId - success:(void (^)(id locationShare)) - successBlock - error: - (void (^)(RCRealTimeLocationErrorCode status))errorBlock; +- (void)getRealTimeLocationProxy:(RCConversationType)conversationType + targetId:(NSString *)targetId + success:(void (^)(id locationShare))successBlock + error:(void (^)(RCRealTimeLocationErrorCode status))errorBlock; @end diff --git a/ios-rongcallkit/framework/RongIMLib.framework/Headers/RCRecallNotificationMessage.h b/ios-rongcallkit/framework/RongIMLib.framework/Headers/RCRecallNotificationMessage.h index fab670e..1737e1d 100644 --- a/ios-rongcallkit/framework/RongIMLib.framework/Headers/RCRecallNotificationMessage.h +++ b/ios-rongcallkit/framework/RongIMLib.framework/Headers/RCRecallNotificationMessage.h @@ -16,7 +16,7 @@ /*! 撤回通知消息类 */ -@interface RCRecallNotificationMessage : RCMessageContent +@interface RCRecallNotificationMessage : RCMessageContent /*! 发起撤回操作的用户ID diff --git a/ios-rongcallkit/framework/RongIMLib.framework/Headers/RCRichContentMessage.h b/ios-rongcallkit/framework/RongIMLib.framework/Headers/RCRichContentMessage.h index e14f668..42b9d0b 100644 --- a/ios-rongcallkit/framework/RongIMLib.framework/Headers/RCRichContentMessage.h +++ b/ios-rongcallkit/framework/RongIMLib.framework/Headers/RCRichContentMessage.h @@ -23,7 +23,7 @@ @discussion 图文消息类,此消息会进行存储并计入未读消息数。 */ -@interface RCRichContentMessage : RCMessageContent +@interface RCRichContentMessage : RCMessageContent /*! 图文消息的标题 diff --git a/ios-rongcallkit/framework/RongIMLib.framework/Headers/RCSearchConversationResult.h b/ios-rongcallkit/framework/RongIMLib.framework/Headers/RCSearchConversationResult.h index 115df30..67fcab5 100644 --- a/ios-rongcallkit/framework/RongIMLib.framework/Headers/RCSearchConversationResult.h +++ b/ios-rongcallkit/framework/RongIMLib.framework/Headers/RCSearchConversationResult.h @@ -6,8 +6,8 @@ // Copyright © 2016年 RongCloud. All rights reserved. // -#import #import "RCConversation.h" +#import /*! 搜索的会话结果 diff --git a/ios-rongcallkit/framework/RongIMLib.framework/Headers/RCStatusDefine.h b/ios-rongcallkit/framework/RongIMLib.framework/Headers/RCStatusDefine.h index b21cd90..cde91ca 100644 --- a/ios-rongcallkit/framework/RongIMLib.framework/Headers/RCStatusDefine.h +++ b/ios-rongcallkit/framework/RongIMLib.framework/Headers/RCStatusDefine.h @@ -30,199 +30,199 @@ */ typedef NS_ENUM(NSInteger, RCConnectErrorCode) { - /*! - 连接已被释放 + /*! + 连接已被释放 - @discussion 建立连接的临时错误码,SDK会做好自动重连,开发者无须处理。 - */ - RC_NET_CHANNEL_INVALID = 30001, + @discussion 建立连接的临时错误码,SDK会做好自动重连,开发者无须处理。 + */ + RC_NET_CHANNEL_INVALID = 30001, - /*! - 连接不可用 + /*! + 连接不可用 - @discussion 建立连接的临时错误码,SDK会做好自动重连,开发者无须处理。 - */ - RC_NET_UNAVAILABLE = 30002, + @discussion 建立连接的临时错误码,SDK会做好自动重连,开发者无须处理。 + */ + RC_NET_UNAVAILABLE = 30002, - /*! - 导航HTTP发送失败 + /*! + 导航HTTP发送失败 - @discussion 如果是偶尔出现此错误,SDK会做好自动重连,开发者无须处理。如果一直是这个错误,应该是您没有设置好ATS。 - ATS默认只使用HTTPS协议,当HTTP协议被禁止时SDK会一直30004错误。您可以在我们iOS开发文档中搜索到ATS设置。 - */ - RC_NAVI_REQUEST_FAIL = 30004, + @discussion 如果是偶尔出现此错误,SDK会做好自动重连,开发者无须处理。如果一直是这个错误,应该是您没有设置好ATS。 + ATS默认只使用HTTPS协议,当HTTP协议被禁止时SDK会一直30004错误。您可以在我们iOS开发文档中搜索到ATS设置。 + */ + RC_NAVI_REQUEST_FAIL = 30004, - /*! - 导航HTTP请求失败 + /*! + 导航HTTP请求失败 - @discussion 建立连接的临时错误码,SDK会做好自动重连,开发者无须处理。 - */ - RC_NAVI_RESPONSE_ERROR = 30007, + @discussion 建立连接的临时错误码,SDK会做好自动重连,开发者无须处理。 + */ + RC_NAVI_RESPONSE_ERROR = 30007, - /*! - 导航HTTP返回数据格式错误 + /*! + 导航HTTP返回数据格式错误 - @discussion 建立连接的临时错误码,SDK会做好自动重连,开发者无须处理。 - */ - RC_NODE_NOT_FOUND = 30008, + @discussion 建立连接的临时错误码,SDK会做好自动重连,开发者无须处理。 + */ + RC_NODE_NOT_FOUND = 30008, - /*! - 创建Socket连接失败 + /*! + 创建Socket连接失败 - @discussion 建立连接的临时错误码,SDK会做好自动重连,开发者无须处理。 - */ - RC_SOCKET_NOT_CONNECTED = 30010, + @discussion 建立连接的临时错误码,SDK会做好自动重连,开发者无须处理。 + */ + RC_SOCKET_NOT_CONNECTED = 30010, - /*! - Socket断开 + /*! + Socket断开 - @discussion 建立连接的临时错误码,SDK会做好自动重连,开发者无须处理。 - */ - RC_SOCKET_DISCONNECTED = 30011, + @discussion 建立连接的临时错误码,SDK会做好自动重连,开发者无须处理。 + */ + RC_SOCKET_DISCONNECTED = 30011, - /*! - PING失败 + /*! + PING失败 - @discussion 建立连接的临时错误码,SDK会做好自动重连,开发者无须处理。 - */ - RC_PING_SEND_FAIL = 30012, + @discussion 建立连接的临时错误码,SDK会做好自动重连,开发者无须处理。 + */ + RC_PING_SEND_FAIL = 30012, - /*! - PING超时 + /*! + PING超时 - @discussion 建立连接的临时错误码,SDK会做好自动重连,开发者无须处理。 - */ - RC_PONG_RECV_FAIL = 30013, + @discussion 建立连接的临时错误码,SDK会做好自动重连,开发者无须处理。 + */ + RC_PONG_RECV_FAIL = 30013, - /*! - 信令发送失败 + /*! + 信令发送失败 - @discussion 建立连接的临时错误码,SDK会做好自动重连,开发者无须处理。 - */ - RC_MSG_SEND_FAIL = 30014, + @discussion 建立连接的临时错误码,SDK会做好自动重连,开发者无须处理。 + */ + RC_MSG_SEND_FAIL = 30014, - /*! - 连接过于频繁 + /*! + 连接过于频繁 - @discussion 建立连接的临时错误码,SDK会做好自动重连,开发者无须处理。 - */ - RC_CONN_OVERFREQUENCY = 30015, + @discussion 建立连接的临时错误码,SDK会做好自动重连,开发者无须处理。 + */ + RC_CONN_OVERFREQUENCY = 30015, - /*! - 连接ACK超时 + /*! + 连接ACK超时 - @discussion 建立连接的临时错误码,SDK会做好自动重连,开发者无须处理。 - */ - RC_CONN_ACK_TIMEOUT = 31000, + @discussion 建立连接的临时错误码,SDK会做好自动重连,开发者无须处理。 + */ + RC_CONN_ACK_TIMEOUT = 31000, - /*! - 信令版本错误 + /*! + 信令版本错误 - @discussion 建立连接的临时错误码,SDK会做好自动重连,开发者无须处理。 - */ - RC_CONN_PROTO_VERSION_ERROR = 31001, + @discussion 建立连接的临时错误码,SDK会做好自动重连,开发者无须处理。 + */ + RC_CONN_PROTO_VERSION_ERROR = 31001, - /*! - AppKey错误 + /*! + AppKey错误 - @discussion 请检查您使用的AppKey是否正确。 - */ - RC_CONN_ID_REJECT = 31002, + @discussion 请检查您使用的AppKey是否正确。 + */ + RC_CONN_ID_REJECT = 31002, - /*! - 服务器当前不可用(预留) + /*! + 服务器当前不可用(预留) - @discussion 建立连接的临时错误码,SDK会做好自动重连,开发者无须处理。 - */ - RC_CONN_SERVER_UNAVAILABLE = 31003, + @discussion 建立连接的临时错误码,SDK会做好自动重连,开发者无须处理。 + */ + RC_CONN_SERVER_UNAVAILABLE = 31003, - /*! - Token无效 + /*! + Token无效 + + @discussion Token无效一般有以下两种原因。 + 一是token错误,请您检查客户端初始化使用的AppKey和您服务器获取token使用的AppKey是否一致; + 二是token过期,是因为您在开发者后台设置了token过期时间,您需要请求您的服务器重新获取token并再次用新的token建立连接。 + */ + RC_CONN_TOKEN_INCORRECT = 31004, + + /*! + AppKey与Token不匹配 + + @discussion + 请检查您使用的AppKey与Token是否正确,是否匹配。一般有以下两种原因。 + 一是token错误,请您检查客户端初始化使用的AppKey和您服务器获取token使用的AppKey是否一致; + 二是token过期,是因为您在开发者后台设置了token过期时间,您需要请求您的服务器重新获取token并再次用新的token建立连接。 + */ + RC_CONN_NOT_AUTHRORIZED = 31005, + + /*! + 连接重定向 + + @discussion 建立连接的临时错误码,SDK会做好自动重连,开发者无须处理。 + */ + RC_CONN_REDIRECTED = 31006, + + /*! + BundleID不正确 + + @discussion 请检查您App的BundleID是否正确。 + */ + RC_CONN_PACKAGE_NAME_INVALID = 31007, + + /*! + AppKey被封禁或已删除 + + @discussion 请检查您使用的AppKey是否正确。 + */ + RC_CONN_APP_BLOCKED_OR_DELETED = 31008, + + /*! + 用户被封禁 - @discussion Token无效一般有以下两种原因。 - 一是token错误,请您检查客户端初始化使用的AppKey和您服务器获取token使用的AppKey是否一致; - 二是token过期,是因为您在开发者后台设置了token过期时间,您需要请求您的服务器重新获取token并再次用新的token建立连接。 - */ - RC_CONN_TOKEN_INCORRECT = 31004, + @discussion 请检查您使用的Token是否正确,以及对应的UserId是否被封禁。 + */ + RC_CONN_USER_BLOCKED = 31009, - /*! - AppKey与Token不匹配 + /*! + 当前用户在其他设备上登录,此设备被踢下线 + */ + RC_DISCONN_KICK = 31010, - @discussion - 请检查您使用的AppKey与Token是否正确,是否匹配。一般有以下两种原因。 - 一是token错误,请您检查客户端初始化使用的AppKey和您服务器获取token使用的AppKey是否一致; - 二是token过期,是因为您在开发者后台设置了token过期时间,您需要请求您的服务器重新获取token并再次用新的token建立连接。 - */ - RC_CONN_NOT_AUTHRORIZED = 31005, + /*! + 连接被拒绝 - /*! - 连接重定向 + @discussion 建立连接的临时错误码,SDK会做好自动重连,开发者无须处理。 + */ + RC_CONN_REFUSED = 32061, - @discussion 建立连接的临时错误码,SDK会做好自动重连,开发者无须处理。 - */ - RC_CONN_REDIRECTED = 31006, + /*! + SDK没有初始化 - /*! - BundleID不正确 + @discussion 在使用SDK任何功能之前,必须先Init。 + */ + RC_CLIENT_NOT_INIT = 33001, - @discussion 请检查您App的BundleID是否正确。 - */ - RC_CONN_PACKAGE_NAME_INVALID = 31007, + /*! + 开发者接口调用时传入的参数错误 - /*! - AppKey被封禁或已删除 + @discussion 请检查接口调用时传入的参数类型和值。 + */ + RC_INVALID_PARAMETER = 33003, - @discussion 请检查您使用的AppKey是否正确。 - */ - RC_CONN_APP_BLOCKED_OR_DELETED = 31008, + /*! + Connection已经存在 - /*! - 用户被封禁 + @discussion + 调用过connect之后,只有在token错误或者被踢下线或者用户logout的情况下才需要再次调用connect。SDK会自动重连,不需要应用多次调用connect来保证连接性。 + */ + RC_CONNECTION_EXIST = 34001, - @discussion 请检查您使用的Token是否正确,以及对应的UserId是否被封禁。 - */ - RC_CONN_USER_BLOCKED = 31009, + /*! + 开发者接口调用时传入的参数错误 - /*! - 当前用户在其他设备上登录,此设备被踢下线 - */ - RC_DISCONN_KICK = 31010, - - /*! - 连接被拒绝 - - @discussion 建立连接的临时错误码,SDK会做好自动重连,开发者无须处理。 - */ - RC_CONN_REFUSED = 32061, - - /*! - SDK没有初始化 - - @discussion 在使用SDK任何功能之前,必须先Init。 - */ - RC_CLIENT_NOT_INIT = 33001, - - /*! - 开发者接口调用时传入的参数错误 - - @discussion 请检查接口调用时传入的参数类型和值。 - */ - RC_INVALID_PARAMETER = 33003, - - /*! - Connection已经存在 - - @discussion - 调用过connect之后,只有在token错误或者被踢下线或者用户logout的情况下才需要再次调用connect。SDK会自动重连,不需要应用多次调用connect来保证连接性。 - */ - RC_CONNECTION_EXIST = 34001, - - /*! - 开发者接口调用时传入的参数错误 - - @discussion 请检查接口调用时传入的参数类型和值。 - */ - RC_INVALID_ARGUMENT = -1000 + @discussion 请检查接口调用时传入的参数类型和值。 + */ + RC_INVALID_ARGUMENT = -1000 }; #pragma mark RCErrorCode - 具体业务错误码 @@ -230,153 +230,153 @@ typedef NS_ENUM(NSInteger, RCConnectErrorCode) { 具体业务错误码 */ typedef NS_ENUM(NSInteger, RCErrorCode) { - /*! - 未知错误(预留) - */ - ERRORCODE_UNKNOWN = -1, - - /*! - 已被对方加入黑名单 - */ - REJECTED_BY_BLACKLIST = 405, - - /*! - 超时 - */ - ERRORCODE_TIMEOUT = 5004, - - /*! - 发送消息频率过高,1秒钟最多只允许发送5条消息 - */ - SEND_MSG_FREQUENCY_OVERRUN = 20604, - - /*! - 不在该讨论组中 - */ - NOT_IN_DISCUSSION = 21406, - - /*! - 不在该群组中 - */ - NOT_IN_GROUP = 22406, - - /*! - 在群组中已被禁言 - */ - FORBIDDEN_IN_GROUP = 22408, - - /*! - 不在该聊天室中 - */ - NOT_IN_CHATROOM = 23406, - - /*! - 在该聊天室中已被禁言 - */ - FORBIDDEN_IN_CHATROOM = 23408, - - /*! - 已被踢出并禁止加入聊天室 - */ - KICKED_FROM_CHATROOM = 23409, - - /*! - 聊天室不存在 - */ - RC_CHATROOM_NOT_EXIST = 23410, - - /*! - 聊天室成员超限 - */ - RC_CHATROOM_IS_FULL = 23411, - - /*! - 聊天室接口参数无效 - */ - RC_PARAMETER_INVALID_CHATROOM = 23412, - - /*! - 聊天室云存储业务未开通 - */ - RC_ROAMING_SERVICE_UNAVAILABLE_CHATROOM = 23414, - - /*! - 当前连接不可用(连接已经被释放) - */ - RC_CHANNEL_INVALID = 30001, - - /*! - 当前连接不可用 - */ - RC_NETWORK_UNAVAILABLE = 30002, - - /*! - 消息响应超时 - */ - RC_MSG_RESPONSE_TIMEOUT = 30003, - - /*! - SDK没有初始化 - - @discussion 在使用SDK任何功能之前,必须先Init。 - */ - CLIENT_NOT_INIT = 33001, - - /*! - 数据库错误 - - @discussion 请检查您使用的Token和userId是否正确。 - */ - DATABASE_ERROR = 33002, - - /*! - 开发者接口调用时传入的参数错误 - - @discussion 请检查接口调用时传入的参数类型和值。 - */ - INVALID_PARAMETER = 33003, - - /*! - 历史消息云存储业务未开通 - */ - MSG_ROAMING_SERVICE_UNAVAILABLE = 33007, - - /*! - 无效的公众号。(由会话类型和Id所标识的公众号会话是无效的) - */ - INVALID_PUBLIC_NUMBER = 29201, - /*! - 消息大小超限,消息体(序列化成json格式之后的内容)最大128k bytes。 - */ - RC_MSG_SIZE_OUT_OF_LIMIT = 30016, - - /*! - 撤回消息参数无效。 - */ - RC_RECALLMESSAGE_PARAMETER_INVALID = 25101, - /*! - push设置参数无效。 - */ - RC_PUSHSETTING_PARAMETER_INVALID = 26001, - /*! - 操作被禁止。 - */ - RC_OPERATION_BLOCKED = 20605, - - /*! - 操作不支持。 - */ - RC_OPERATION_NOT_SUPPORT = 20606, - - /*! - 发送的消息中包含敏感词 (发送方发送失败,接收方不会收到消息) - */ - RC_MSG_BLOCKED_SENSITIVE_WORD = 21501, - - /*! - 消息中敏感词已经被替换 (接收方可以收到被替换之后的消息) - */ - RC_MSG_REPLACED_SENSITIVE_WORD = 21502 + /*! + 未知错误(预留) + */ + ERRORCODE_UNKNOWN = -1, + + /*! + 已被对方加入黑名单 + */ + REJECTED_BY_BLACKLIST = 405, + + /*! + 超时 + */ + ERRORCODE_TIMEOUT = 5004, + + /*! + 发送消息频率过高,1秒钟最多只允许发送5条消息 + */ + SEND_MSG_FREQUENCY_OVERRUN = 20604, + + /*! + 不在该讨论组中 + */ + NOT_IN_DISCUSSION = 21406, + + /*! + 不在该群组中 + */ + NOT_IN_GROUP = 22406, + + /*! + 在群组中已被禁言 + */ + FORBIDDEN_IN_GROUP = 22408, + + /*! + 不在该聊天室中 + */ + NOT_IN_CHATROOM = 23406, + + /*! + 在该聊天室中已被禁言 + */ + FORBIDDEN_IN_CHATROOM = 23408, + + /*! + 已被踢出并禁止加入聊天室 + */ + KICKED_FROM_CHATROOM = 23409, + + /*! + 聊天室不存在 + */ + RC_CHATROOM_NOT_EXIST = 23410, + + /*! + 聊天室成员超限 + */ + RC_CHATROOM_IS_FULL = 23411, + + /*! + 聊天室接口参数无效 + */ + RC_PARAMETER_INVALID_CHATROOM = 23412, + + /*! + 聊天室云存储业务未开通 + */ + RC_ROAMING_SERVICE_UNAVAILABLE_CHATROOM = 23414, + + /*! + 当前连接不可用(连接已经被释放) + */ + RC_CHANNEL_INVALID = 30001, + + /*! + 当前连接不可用 + */ + RC_NETWORK_UNAVAILABLE = 30002, + + /*! + 消息响应超时 + */ + RC_MSG_RESPONSE_TIMEOUT = 30003, + + /*! + SDK没有初始化 + + @discussion 在使用SDK任何功能之前,必须先Init。 + */ + CLIENT_NOT_INIT = 33001, + + /*! + 数据库错误 + + @discussion 请检查您使用的Token和userId是否正确。 + */ + DATABASE_ERROR = 33002, + + /*! + 开发者接口调用时传入的参数错误 + + @discussion 请检查接口调用时传入的参数类型和值。 + */ + INVALID_PARAMETER = 33003, + + /*! + 历史消息云存储业务未开通 + */ + MSG_ROAMING_SERVICE_UNAVAILABLE = 33007, + + /*! + 无效的公众号。(由会话类型和Id所标识的公众号会话是无效的) + */ + INVALID_PUBLIC_NUMBER = 29201, + /*! + 消息大小超限,消息体(序列化成json格式之后的内容)最大128k bytes。 + */ + RC_MSG_SIZE_OUT_OF_LIMIT = 30016, + + /*! + 撤回消息参数无效。 + */ + RC_RECALLMESSAGE_PARAMETER_INVALID = 25101, + /*! + push设置参数无效。 + */ + RC_PUSHSETTING_PARAMETER_INVALID = 26001, + /*! + 操作被禁止。 + */ + RC_OPERATION_BLOCKED = 20605, + + /*! + 操作不支持。 + */ + RC_OPERATION_NOT_SUPPORT = 20606, + + /*! + 发送的消息中包含敏感词 (发送方发送失败,接收方不会收到消息) + */ + RC_MSG_BLOCKED_SENSITIVE_WORD = 21501, + + /*! + 消息中敏感词已经被替换 (接收方可以收到被替换之后的消息) + */ + RC_MSG_REPLACED_SENSITIVE_WORD = 21502 }; #pragma mark - 连接状态 @@ -392,106 +392,106 @@ typedef NS_ENUM(NSInteger, RCErrorCode) { ConnectionStatus_TOKEN_INCORRECT */ typedef NS_ENUM(NSInteger, RCConnectionStatus) { - /*! - 未知状态 - - @discussion 建立连接中出现异常的临时状态,SDK会做好自动重连,开发者无须处理。 - */ - ConnectionStatus_UNKNOWN = -1, - - /*! - 连接成功 - */ - ConnectionStatus_Connected = 0, - - /*! - 当前设备网络不可用 - - @discussion 建立连接的临时状态,SDK会做好自动重连,开发者无须处理。 - */ - ConnectionStatus_NETWORK_UNAVAILABLE = 1, - - /*! - 当前设备切换到飞行模式 - - @discussion 建立连接的临时状态,SDK会做好自动重连,开发者无须处理。 - */ - ConnectionStatus_AIRPLANE_MODE = 2, - - /*! - 当前设备切换到 2G(GPRS、EDGE)低速网络 - - @discussion 建立连接的临时状态,SDK会做好自动重连,开发者无须处理。 - */ - ConnectionStatus_Cellular_2G = 3, - - /*! - 当前设备切换到 3G 或 4G 高速网络 - - @discussion 建立连接的临时状态,SDK会做好自动重连,开发者无须处理。 - */ - ConnectionStatus_Cellular_3G_4G = 4, - - /*! - 当前设备切换到 WIFI 网络 - - @discussion 建立连接的临时状态,SDK会做好自动重连,开发者无须处理。 - */ - ConnectionStatus_WIFI = 5, - - /*! - 当前用户在其他设备上登录,此设备被踢下线 - */ - ConnectionStatus_KICKED_OFFLINE_BY_OTHER_CLIENT = 6, - - /*! - 当前用户在 Web 端登录 - - @discussion 建立连接的临时状态,SDK会做好自动重连,开发者无须处理。 - */ - ConnectionStatus_LOGIN_ON_WEB = 7, - - /*! - 服务器异常 - - @discussion 建立连接的临时状态,SDK会做好自动重连,开发者无须处理。 - */ - ConnectionStatus_SERVER_INVALID = 8, - - /*! - 连接验证异常 - - @discussion 建立连接的临时状态,SDK会做好自动重连,开发者无须处理。 - */ - ConnectionStatus_VALIDATE_INVALID = 9, - - /*! - 连接中 - */ - ConnectionStatus_Connecting = 10, - - /*! - 连接失败或未连接 - */ - ConnectionStatus_Unconnected = 11, - - /*! - 已注销 - */ - ConnectionStatus_SignUp = 12, - - /*! - Token无效 - - @discussion - Token无效一般有两种原因。一是token错误,请您检查客户端初始化使用的AppKey和您服务器获取token使用的AppKey是否一致;二是token过期,是因为您在开发者后台设置了token过期时间,您需要请求您的服务器重新获取token并再次用新的token建立连接。 - */ - ConnectionStatus_TOKEN_INCORRECT = 31004, - - /*! - 与服务器的连接已断开,用户被封禁 - */ - ConnectionStatus_DISCONN_EXCEPTION = 31011 + /*! + 未知状态 + + @discussion 建立连接中出现异常的临时状态,SDK会做好自动重连,开发者无须处理。 + */ + ConnectionStatus_UNKNOWN = -1, + + /*! + 连接成功 + */ + ConnectionStatus_Connected = 0, + + /*! + 当前设备网络不可用 + + @discussion 建立连接的临时状态,SDK会做好自动重连,开发者无须处理。 + */ + ConnectionStatus_NETWORK_UNAVAILABLE = 1, + + /*! + 当前设备切换到飞行模式 + + @discussion 建立连接的临时状态,SDK会做好自动重连,开发者无须处理。 + */ + ConnectionStatus_AIRPLANE_MODE = 2, + + /*! + 当前设备切换到 2G(GPRS、EDGE)低速网络 + + @discussion 建立连接的临时状态,SDK会做好自动重连,开发者无须处理。 + */ + ConnectionStatus_Cellular_2G = 3, + + /*! + 当前设备切换到 3G 或 4G 高速网络 + + @discussion 建立连接的临时状态,SDK会做好自动重连,开发者无须处理。 + */ + ConnectionStatus_Cellular_3G_4G = 4, + + /*! + 当前设备切换到 WIFI 网络 + + @discussion 建立连接的临时状态,SDK会做好自动重连,开发者无须处理。 + */ + ConnectionStatus_WIFI = 5, + + /*! + 当前用户在其他设备上登录,此设备被踢下线 + */ + ConnectionStatus_KICKED_OFFLINE_BY_OTHER_CLIENT = 6, + + /*! + 当前用户在 Web 端登录 + + @discussion 建立连接的临时状态,SDK会做好自动重连,开发者无须处理。 + */ + ConnectionStatus_LOGIN_ON_WEB = 7, + + /*! + 服务器异常 + + @discussion 建立连接的临时状态,SDK会做好自动重连,开发者无须处理。 + */ + ConnectionStatus_SERVER_INVALID = 8, + + /*! + 连接验证异常 + + @discussion 建立连接的临时状态,SDK会做好自动重连,开发者无须处理。 + */ + ConnectionStatus_VALIDATE_INVALID = 9, + + /*! + 连接中 + */ + ConnectionStatus_Connecting = 10, + + /*! + 连接失败或未连接 + */ + ConnectionStatus_Unconnected = 11, + + /*! + 已注销 + */ + ConnectionStatus_SignUp = 12, + + /*! + Token无效 + + @discussion + Token无效一般有两种原因。一是token错误,请您检查客户端初始化使用的AppKey和您服务器获取token使用的AppKey是否一致;二是token过期,是因为您在开发者后台设置了token过期时间,您需要请求您的服务器重新获取token并再次用新的token建立连接。 + */ + ConnectionStatus_TOKEN_INCORRECT = 31004, + + /*! + 与服务器的连接已断开,用户被封禁 + */ + ConnectionStatus_DISCONN_EXCEPTION = 31011 }; #pragma mark RCNetworkStatus - 当前所处的网络 @@ -499,30 +499,30 @@ typedef NS_ENUM(NSInteger, RCConnectionStatus) { 当前所处的网络 */ typedef NS_ENUM(NSUInteger, RCNetworkStatus) { - /*! - 当前网络不可用 - */ - RC_NotReachable = 0, - - /*! - 当前处于WiFi网络 - */ - RC_ReachableViaWiFi = 1, - - /*! - 移动网络 - */ - RC_ReachableViaWWAN = 2, - - // /*! - // 当前处于3G网络 - // */ - // RC_ReachableVia3G = 3, - // - // /*! - // 当前处于2G网络 - // */ - // RC_ReachableVia2G = 4 + /*! + 当前网络不可用 + */ + RC_NotReachable = 0, + + /*! + 当前处于WiFi网络 + */ + RC_ReachableViaWiFi = 1, + + /*! + 移动网络 + */ + RC_ReachableViaWWAN = 2, + + // /*! + // 当前处于3G网络 + // */ + // RC_ReachableVia3G = 3, + // + // /*! + // 当前处于2G网络 + // */ + // RC_ReachableVia2G = 4 }; #pragma mark RCSDKRunningMode - SDK当前所处的状态 @@ -530,15 +530,15 @@ typedef NS_ENUM(NSUInteger, RCNetworkStatus) { SDK当前所处的状态 */ typedef NS_ENUM(NSUInteger, RCSDKRunningMode) { - /*! - 前台运行状态 - */ - RCSDKRunningMode_Background = 0, - - /*! - 后台运行状态 - */ - RCSDKRunningMode_Foreground = 1 + /*! + 前台运行状态 + */ + RCSDKRunningMode_Background = 0, + + /*! + 后台运行状态 + */ + RCSDKRunningMode_Foreground = 1 }; #pragma mark - 会话相关 @@ -548,54 +548,54 @@ typedef NS_ENUM(NSUInteger, RCSDKRunningMode) { 会话类型 */ typedef NS_ENUM(NSUInteger, RCConversationType) { - /*! - 单聊 - */ - ConversationType_PRIVATE = 1, - - /*! - 讨论组 - */ - ConversationType_DISCUSSION = 2, - - /*! - 群组 - */ - ConversationType_GROUP = 3, - - /*! - 聊天室 - */ - ConversationType_CHATROOM = 4, - - /*! - 客服 - */ - ConversationType_CUSTOMERSERVICE = 5, - - /*! - 系统会话 - */ - ConversationType_SYSTEM = 6, - - /*! - 应用内公众服务会话 - - @discussion - 客服2.0使用应用内公众服务会话(ConversationType_APPSERVICE)的方式实现。 - 即客服2.0会话是其中一个应用内公众服务会话,这种方式我们目前不推荐,请尽快升级到新客服,升级方法请参考官网的客服文档。 - */ - ConversationType_APPSERVICE = 7, - - /*! - 跨应用公众服务会话 - */ - ConversationType_PUBLICSERVICE = 8, - - /*! - 推送服务会话 - */ - ConversationType_PUSHSERVICE = 9 + /*! + 单聊 + */ + ConversationType_PRIVATE = 1, + + /*! + 讨论组 + */ + ConversationType_DISCUSSION = 2, + + /*! + 群组 + */ + ConversationType_GROUP = 3, + + /*! + 聊天室 + */ + ConversationType_CHATROOM = 4, + + /*! + 客服 + */ + ConversationType_CUSTOMERSERVICE = 5, + + /*! + 系统会话 + */ + ConversationType_SYSTEM = 6, + + /*! + 应用内公众服务会话 + + @discussion + 客服2.0使用应用内公众服务会话(ConversationType_APPSERVICE)的方式实现。 + 即客服2.0会话是其中一个应用内公众服务会话,这种方式我们目前不推荐,请尽快升级到新客服,升级方法请参考官网的客服文档。 + */ + ConversationType_APPSERVICE = 7, + + /*! + 跨应用公众服务会话 + */ + ConversationType_PUBLICSERVICE = 8, + + /*! + 推送服务会话 + */ + ConversationType_PUSHSERVICE = 9 }; #pragma mark RCConversationNotificationStatus - 会话提醒状态 @@ -603,15 +603,15 @@ typedef NS_ENUM(NSUInteger, RCConversationType) { 会话提醒状态 */ typedef NS_ENUM(NSUInteger, RCConversationNotificationStatus) { - /*! - 免打扰 - */ - DO_NOT_DISTURB = 0, - - /*! - 新消息提醒 - */ - NOTIFY = 1, + /*! + 免打扰 + */ + DO_NOT_DISTURB = 0, + + /*! + 新消息提醒 + */ + NOTIFY = 1, }; #pragma mark RCReadReceiptMessageType - 消息回执 @@ -619,10 +619,10 @@ typedef NS_ENUM(NSUInteger, RCConversationNotificationStatus) { 已读状态消息类型 */ typedef NS_ENUM(NSUInteger, RCReadReceiptMessageType) { - /*! - 根据会话来更新未读消息状态 - */ - RC_ReadReceipt_Conversation = 1, + /*! + 根据会话来更新未读消息状态 + */ + RC_ReadReceipt_Conversation = 1, }; #pragma mark RCChatRoomMemberOrder - 聊天室成员排列顺序 @@ -630,15 +630,15 @@ typedef NS_ENUM(NSUInteger, RCReadReceiptMessageType) { 聊天室成员的排列顺序 */ typedef NS_ENUM(NSUInteger, RCChatRoomMemberOrder) { - /*! - 升序,返回最早加入的成员列表 - */ - RC_ChatRoom_Member_Asc = 1, - - /*! - 降序,返回最晚加入的成员列表 - */ - RC_ChatRoom_Member_Desc = 2, + /*! + 升序,返回最早加入的成员列表 + */ + RC_ChatRoom_Member_Asc = 1, + + /*! + 降序,返回最晚加入的成员列表 + */ + RC_ChatRoom_Member_Desc = 2, }; #pragma mark - 消息相关 @@ -648,27 +648,27 @@ typedef NS_ENUM(NSUInteger, RCChatRoomMemberOrder) { 消息的存储策略 */ typedef NS_ENUM(NSUInteger, RCMessagePersistent) { - /*! - 在本地不存储,不计入未读数 - */ - MessagePersistent_NONE = 0, - - /*! - 在本地只存储,但不计入未读数 - */ - MessagePersistent_ISPERSISTED = 1, - - /*! - 在本地进行存储并计入未读数 - */ - MessagePersistent_ISCOUNTED = 3, - - /*! - 在本地不存储,不计入未读数,并且如果对方不在线,服务器会直接丢弃该消息,对方如果之后再上线也不会再收到此消息(聊天室类型除外,此类消息聊天室会视为普通消息)。 - - @discussion 一般用于发送输入状态之类的消息,该类型消息的messageUId为nil。 - */ - MessagePersistent_STATUS = 16 + /*! + 在本地不存储,不计入未读数 + */ + MessagePersistent_NONE = 0, + + /*! + 在本地只存储,但不计入未读数 + */ + MessagePersistent_ISPERSISTED = 1, + + /*! + 在本地进行存储并计入未读数 + */ + MessagePersistent_ISCOUNTED = 3, + + /*! + 在本地不存储,不计入未读数,并且如果对方不在线,服务器会直接丢弃该消息,对方如果之后再上线也不会再收到此消息(聊天室类型除外,此类消息聊天室会视为普通消息)。 + + @discussion 一般用于发送输入状态之类的消息,该类型消息的messageUId为nil。 + */ + MessagePersistent_STATUS = 16 }; #pragma mark RCMessageDirection - 消息的方向 @@ -676,15 +676,15 @@ typedef NS_ENUM(NSUInteger, RCMessagePersistent) { 消息的方向 */ typedef NS_ENUM(NSUInteger, RCMessageDirection) { - /*! - 发送 - */ - MessageDirection_SEND = 1, - - /*! - 接收 - */ - MessageDirection_RECEIVE = 2 + /*! + 发送 + */ + MessageDirection_SEND = 1, + + /*! + 接收 + */ + MessageDirection_RECEIVE = 2 }; #pragma mark RCSentStatus - 消息的发送状态 @@ -692,40 +692,40 @@ typedef NS_ENUM(NSUInteger, RCMessageDirection) { 消息的发送状态 */ typedef NS_ENUM(NSUInteger, RCSentStatus) { - /*! - 发送中 - */ - SentStatus_SENDING = 10, - - /*! - 发送失败 - */ - SentStatus_FAILED = 20, - - /*! - 已发送成功 - */ - SentStatus_SENT = 30, - - /*! - 对方已接收 - */ - SentStatus_RECEIVED = 40, - - /*! - 对方已阅读 - */ - SentStatus_READ = 50, - - /*! - 对方已销毁 - */ - SentStatus_DESTROYED = 60, - - /*! - 发送已取消 - */ - SentStatus_CANCELED = 70 + /*! + 发送中 + */ + SentStatus_SENDING = 10, + + /*! + 发送失败 + */ + SentStatus_FAILED = 20, + + /*! + 已发送成功 + */ + SentStatus_SENT = 30, + + /*! + 对方已接收 + */ + SentStatus_RECEIVED = 40, + + /*! + 对方已阅读 + */ + SentStatus_READ = 50, + + /*! + 对方已销毁 + */ + SentStatus_DESTROYED = 60, + + /*! + 发送已取消 + */ + SentStatus_CANCELED = 70 }; #pragma mark RCReceivedStatus - 消息的接收状态 @@ -733,37 +733,37 @@ typedef NS_ENUM(NSUInteger, RCSentStatus) { 消息的接收状态 */ typedef NS_ENUM(NSUInteger, RCReceivedStatus) { - /*! - 未读 - */ - ReceivedStatus_UNREAD = 0, - - /*! - 已读 - */ - ReceivedStatus_READ = 1, - - /*! - 已听 - - @discussion 仅用于语音消息 - */ - ReceivedStatus_LISTENED = 2, - - /*! - 已下载 - */ - ReceivedStatus_DOWNLOADED = 4, - - /*! - 该消息已经被其他登录的多端收取过。(即该消息已经被其他端收取过后。当前端才登录,并重新拉取了这条消息。客户可以通过这个状态更新UI,比如不再提示)。 - */ - ReceivedStatus_RETRIEVED = 8, - - /*! - 该消息是被多端同时收取的。(即其他端正同时登录,一条消息被同时发往多端。客户可以通过这个状态值更新自己的某些UI状态)。 - */ - ReceivedStatus_MULTIPLERECEIVE = 16, + /*! + 未读 + */ + ReceivedStatus_UNREAD = 0, + + /*! + 已读 + */ + ReceivedStatus_READ = 1, + + /*! + 已听 + + @discussion 仅用于语音消息 + */ + ReceivedStatus_LISTENED = 2, + + /*! + 已下载 + */ + ReceivedStatus_DOWNLOADED = 4, + + /*! + 该消息已经被其他登录的多端收取过。(即该消息已经被其他端收取过后。当前端才登录,并重新拉取了这条消息。客户可以通过这个状态更新UI,比如不再提示)。 + */ + ReceivedStatus_RETRIEVED = 8, + + /*! + 该消息是被多端同时收取的。(即其他端正同时登录,一条消息被同时发往多端。客户可以通过这个状态值更新自己的某些UI状态)。 + */ + ReceivedStatus_MULTIPLERECEIVE = 16, }; @@ -772,25 +772,25 @@ typedef NS_ENUM(NSUInteger, RCReceivedStatus) { 消息内容中多媒体文件的类型 */ typedef NS_ENUM(NSUInteger, RCMediaType) { - /*! - 图片 - */ - MediaType_IMAGE = 1, - - /*! - 语音 - */ - MediaType_AUDIO = 2, - - /*! - 视频 - */ - MediaType_VIDEO = 3, - - /*! - 其他文件 - */ - MediaType_FILE = 4 + /*! + 图片 + */ + MediaType_IMAGE = 1, + + /*! + 语音 + */ + MediaType_AUDIO = 2, + + /*! + 视频 + */ + MediaType_VIDEO = 3, + + /*! + 其他文件 + */ + MediaType_FILE = 4 }; #pragma mark RCMediaType - 消息中@提醒的类型 @@ -798,15 +798,15 @@ typedef NS_ENUM(NSUInteger, RCMediaType) { @提醒的类型 */ typedef NS_ENUM(NSUInteger, RCMentionedType) { - /*! - @所有人 - */ - RC_Mentioned_All = 1, - - /*! - @部分指定用户 - */ - RC_Mentioned_Users = 2, + /*! + @所有人 + */ + RC_Mentioned_All = 1, + + /*! + @部分指定用户 + */ + RC_Mentioned_Users = 2, }; #pragma mark - 公众服务相关 @@ -816,15 +816,15 @@ typedef NS_ENUM(NSUInteger, RCMentionedType) { 公众服务账号类型 */ typedef NS_ENUM(NSUInteger, RCPublicServiceType) { - /*! - 应用内公众服务账号 - */ - RC_APP_PUBLIC_SERVICE = 7, - - /*! - 跨应用公众服务账号 - */ - RC_PUBLIC_SERVICE = 8, + /*! + 应用内公众服务账号 + */ + RC_APP_PUBLIC_SERVICE = 7, + + /*! + 跨应用公众服务账号 + */ + RC_PUBLIC_SERVICE = 8, }; #pragma mark RCPublicServiceMenuItemType - 公众服务菜单类型 @@ -832,20 +832,20 @@ typedef NS_ENUM(NSUInteger, RCPublicServiceType) { 公众服务菜单类型 */ typedef NS_ENUM(NSUInteger, RCPublicServiceMenuItemType) { - /*! - 包含子菜单的一组菜单 - */ - RC_PUBLIC_SERVICE_MENU_ITEM_GROUP = 0, - - /*! - 包含查看事件的菜单 - */ - RC_PUBLIC_SERVICE_MENU_ITEM_VIEW = 1, - - /*! - 包含点击事件的菜单 - */ - RC_PUBLIC_SERVICE_MENU_ITEM_CLICK = 2, + /*! + 包含子菜单的一组菜单 + */ + RC_PUBLIC_SERVICE_MENU_ITEM_GROUP = 0, + + /*! + 包含查看事件的菜单 + */ + RC_PUBLIC_SERVICE_MENU_ITEM_VIEW = 1, + + /*! + 包含点击事件的菜单 + */ + RC_PUBLIC_SERVICE_MENU_ITEM_CLICK = 2, }; #pragma mark RCSearchType - 公众服务查找匹配方式 @@ -853,115 +853,115 @@ typedef NS_ENUM(NSUInteger, RCPublicServiceMenuItemType) { 公众服务查找匹配方式 */ typedef NS_ENUM(NSUInteger, RCSearchType) { - /*! - 精确匹配 - */ - RC_SEARCH_TYPE_EXACT = 0, - - /*! - 模糊匹配 - */ - RC_SEARCH_TYPE_FUZZY = 1, + /*! + 精确匹配 + */ + RC_SEARCH_TYPE_EXACT = 0, + + /*! + 模糊匹配 + */ + RC_SEARCH_TYPE_FUZZY = 1, }; /*! 客服服务方式 */ typedef NS_ENUM(NSUInteger, RCCSModeType) { - /*! - 无客服服务 - */ - RC_CS_NoService = 0, - - /*! - 机器人服务 - */ - RC_CS_RobotOnly = 1, - - /*! - 人工服务 - */ - RC_CS_HumanOnly = 2, - - /*! - 机器人优先服务 - */ - RC_CS_RobotFirst = 3, + /*! + 无客服服务 + */ + RC_CS_NoService = 0, + + /*! + 机器人服务 + */ + RC_CS_RobotOnly = 1, + + /*! + 人工服务 + */ + RC_CS_HumanOnly = 2, + + /*! + 机器人优先服务 + */ + RC_CS_RobotFirst = 3, }; /*! 客服评价时机 */ typedef NS_ENUM(NSUInteger, RCCSEvaEntryPoint) { - /*! - 离开客服评价 - */ - RCCSEvaLeave = 0, - - /*! - 在扩展中展示客户主动评价按钮,离开客服不评价 - */ - RCCSEvaExtention = 1, - - /*! - 无评价入口 - */ - RCCSEvaNone = 2, - - /*! - 坐席结束会话评价 - */ - RCCSEvaCSEnd = 3, + /*! + 离开客服评价 + */ + RCCSEvaLeave = 0, + + /*! + 在扩展中展示客户主动评价按钮,离开客服不评价 + */ + RCCSEvaExtention = 1, + + /*! + 无评价入口 + */ + RCCSEvaNone = 2, + + /*! + 坐席结束会话评价 + */ + RCCSEvaCSEnd = 3, }; /*! 客服留言类型 */ typedef NS_ENUM(NSUInteger, RCCSLMType) { - /*! - 本地Native页面留言 - */ - RCCSLMNative = 0, - - /*! - web页面留言 - */ - RCCSLMWeb = 1, + /*! + 本地Native页面留言 + */ + RCCSLMNative = 0, + + /*! + web页面留言 + */ + RCCSLMWeb = 1, }; /*! 客服问题解决状态 */ typedef NS_ENUM(NSUInteger, RCCSResolveStatus) { - /*! - 未解决 - */ - RCCSUnresolved = 0, - - /*! - 已解决 - */ - RCCSResolved = 1, - - /*! - 解决中 - */ - RCCSResolving = 2, + /*! + 未解决 + */ + RCCSUnresolved = 0, + + /*! + 已解决 + */ + RCCSResolved = 1, + + /*! + 解决中 + */ + RCCSResolving = 2, }; /*! 客服评价类型 */ typedef NS_ENUM(NSUInteger, RCCSEvaType) { - /*! - 人工机器人分开评价 - */ - RCCSEvaSeparately = 0, - - /*! - 人工机器人统一评价 - */ - EVA_UNIFIED = 1, + /*! + 人工机器人分开评价 + */ + RCCSEvaSeparately = 0, + + /*! + 人工机器人统一评价 + */ + EVA_UNIFIED = 1, }; #pragma mark RCLogLevel - 日志级别 @@ -969,20 +969,20 @@ typedef NS_ENUM(NSUInteger, RCCSEvaType) { 日志级别 */ typedef NS_ENUM(NSUInteger, RCLogLevel) { - /*! - * 只输出错误的日志 - */ - RC_Log_Level_Error = 1, - - /*! - * 输出错误和警告的日志 - */ - RC_Log_Level_Warn = 2, - - /*! - * 输出错误、警告和一般的日志 - */ - RC_Log_Level_Info = 3, + /*! + * 只输出错误的日志 + */ + RC_Log_Level_Error = 1, + + /*! + * 输出错误和警告的日志 + */ + RC_Log_Level_Warn = 2, + + /*! + * 输出错误、警告和一般的日志 + */ + RC_Log_Level_Info = 3, }; #pragma mark RCTimestampOrder - 历史消息查询顺序 @@ -994,7 +994,7 @@ typedef NS_ENUM(NSUInteger, RCTimestampOrder) { * 降序, 按照时间戳从大到小 */ RC_Timestamp_Desc = 0, - + /*! * 升序, 按照时间戳从小到大 */ @@ -1006,36 +1006,36 @@ typedef NS_ENUM(NSUInteger, RCTimestampOrder) { 在线平台 */ typedef NS_ENUM(NSUInteger, RCPlatform) { - /*! - 其它平台 - */ - RCPlatform_Other = 0, - - /*! - iOS - */ - RCPlatform_iOS = 1, - - /*! - Android - */ - RCPlatform_Android = 2, - - /*! - Web - */ - RCPlatform_Web = 3, - - /*! - PC - */ - RCPlatform_PC = 4 + /*! + 其它平台 + */ + RCPlatform_Other = 0, + + /*! + iOS + */ + RCPlatform_iOS = 1, + + /*! + Android + */ + RCPlatform_Android = 2, + + /*! + Web + */ + RCPlatform_Web = 3, + + /*! + PC + */ + RCPlatform_PC = 4 }; #pragma mark RCPushLauguageType - push 语音设置 typedef NS_ENUM(NSUInteger, RCPushLauguage) { RCPushLauguage_EN_US = 1, //英文 - RCPushLauguage_ZH_CN, //中文 + RCPushLauguage_ZH_CN, //中文 }; #endif diff --git a/ios-rongcallkit/framework/RongIMLib.framework/Headers/RCTextMessage.h b/ios-rongcallkit/framework/RongIMLib.framework/Headers/RCTextMessage.h index 3862388..08a7443 100644 --- a/ios-rongcallkit/framework/RongIMLib.framework/Headers/RCTextMessage.h +++ b/ios-rongcallkit/framework/RongIMLib.framework/Headers/RCTextMessage.h @@ -34,7 +34,6 @@ */ @property(nonatomic, strong) NSString *extra; - /*! 初始化文本消息 diff --git a/ios-rongcallkit/framework/RongIMLib.framework/Headers/RCUnknownMessage.h b/ios-rongcallkit/framework/RongIMLib.framework/Headers/RCUnknownMessage.h index 92cb9a7..987e007 100644 --- a/ios-rongcallkit/framework/RongIMLib.framework/Headers/RCUnknownMessage.h +++ b/ios-rongcallkit/framework/RongIMLib.framework/Headers/RCUnknownMessage.h @@ -22,6 +22,6 @@ @discussion 所有未注册的消息类型,在IMKit中都会作为此类消息处理和显示。 */ -@interface RCUnknownMessage : RCMessageContent +@interface RCUnknownMessage : RCMessageContent @end diff --git a/ios-rongcallkit/framework/RongIMLib.framework/Headers/RCUploadMediaStatusListener.h b/ios-rongcallkit/framework/RongIMLib.framework/Headers/RCUploadMediaStatusListener.h index 3684883..66e7269 100644 --- a/ios-rongcallkit/framework/RongIMLib.framework/Headers/RCUploadMediaStatusListener.h +++ b/ios-rongcallkit/framework/RongIMLib.framework/Headers/RCUploadMediaStatusListener.h @@ -33,7 +33,7 @@ content:上传成功之后,需要发送的消息内容。 您可以使用currentMessage,把其中content属性对应的url字段设置成您上传成功的网络URL。 请参考下面代码。 - + 升级说明:如果您之前使用了此接口,请参考下面代码把参数从 url 替换成 message。 if ([currentMessage.content isKindOfClass:[RCImageMessage class]]) { RCImageMessage *content = (RCImageMessage *)currentMessage.content; @@ -55,7 +55,7 @@ /*! 上传取消需要调用的block */ -@property(nonatomic, strong) void (^cancelBlock)(); +@property(nonatomic, strong) void (^cancelBlock)(void); /*! 初始化媒体文件上传进度更新的IMKit监听 @@ -72,11 +72,11 @@ uploadProgress:(void (^)(int progress))progressBlock uploadSuccess:(void (^)(RCMessageContent *content))successBlock uploadError:(void (^)(RCErrorCode errorCode))errorBlock - uploadCancel:(void (^)())cancelBlock; + uploadCancel:(void (^)(void))cancelBlock; /*! 取消当前上传 - + @discussion 如果您实现取消正在上传的媒体消息功能,则必须实现此回调。 您需要在取消成功之后,调用cancelBlock通知SDK,SDK会自动更新UI。 */ diff --git a/ios-rongcallkit/framework/RongIMLib.framework/Headers/RCUserInfo.h b/ios-rongcallkit/framework/RongIMLib.framework/Headers/RCUserInfo.h index b11e25f..538d6b5 100644 --- a/ios-rongcallkit/framework/RongIMLib.framework/Headers/RCUserInfo.h +++ b/ios-rongcallkit/framework/RongIMLib.framework/Headers/RCUserInfo.h @@ -40,8 +40,6 @@ @param portrait 用户头像的URL @return 用户信息对象 */ -- (instancetype)initWithUserId:(NSString *)userId - name:(NSString *)username - portrait:(NSString *)portrait; +- (instancetype)initWithUserId:(NSString *)userId name:(NSString *)username portrait:(NSString *)portrait; @end diff --git a/ios-rongcallkit/framework/RongIMLib.framework/Headers/RCUserOnlineStatusInfo.h b/ios-rongcallkit/framework/RongIMLib.framework/Headers/RCUserOnlineStatusInfo.h index 405f12f..d0b2813 100644 --- a/ios-rongcallkit/framework/RongIMLib.framework/Headers/RCUserOnlineStatusInfo.h +++ b/ios-rongcallkit/framework/RongIMLib.framework/Headers/RCUserOnlineStatusInfo.h @@ -21,15 +21,16 @@ /*! 融云服务在线状态 - + @discussion 0表示离线,1表示在线 */ @property(nonatomic, assign) int rcServiceStatus; /*! 用户自定义的在线状态(1 < customerStatus <= 255) - - @discussion 如果没有通过RCIMClient的setUserOnlineStatus:success:error:设置自定义的在线状态,默认的在线状态值为1,若离线则为0。 + + @discussion + 如果没有通过RCIMClient的setUserOnlineStatus:success:error:设置自定义的在线状态,默认的在线状态值为1,若离线则为0。 */ @property(nonatomic, assign) int customerStatus; diff --git a/ios-rongcallkit/framework/RongIMLib.framework/Headers/RCUserTypingStatus.h b/ios-rongcallkit/framework/RongIMLib.framework/Headers/RCUserTypingStatus.h index 49d1be7..93e5bbf 100644 --- a/ios-rongcallkit/framework/RongIMLib.framework/Headers/RCUserTypingStatus.h +++ b/ios-rongcallkit/framework/RongIMLib.framework/Headers/RCUserTypingStatus.h @@ -35,7 +35,6 @@ @return 用户输入状态对象 */ -- (instancetype)initWithUserId:(NSString *)userId - contentType:(NSString *)objectName; +- (instancetype)initWithUserId:(NSString *)userId contentType:(NSString *)objectName; @end diff --git a/ios-rongcallkit/framework/RongIMLib.framework/Headers/RCUtilities.h b/ios-rongcallkit/framework/RongIMLib.framework/Headers/RCUtilities.h index 4c8d514..897cf6d 100644 --- a/ios-rongcallkit/framework/RongIMLib.framework/Headers/RCUtilities.h +++ b/ios-rongcallkit/framework/RongIMLib.framework/Headers/RCUtilities.h @@ -13,8 +13,8 @@ #ifndef __RCUtilities #define __RCUtilities -#import #import "RCMessage.h" +#import /*! 工具类 @@ -59,19 +59,17 @@ @return image */ -+ (UIImage *)imageByScalingAndCropSize:(UIImage *)image - targetSize:(CGSize)targetSize; ++ (UIImage *)imageByScalingAndCropSize:(UIImage *)image targetSize:(CGSize)targetSize; /*! generate thumbnail from image - + @param image image @param targetSize targetSize - + @return image */ -+ (UIImage *)generateThumbnail:(UIImage *)image - targetSize:(CGSize)targetSize; ++ (UIImage *)generateThumbnail:(UIImage *)image targetSize:(CGSize)targetSize; /*! compressedImageWithMaxDataLength @@ -80,8 +78,7 @@ @return nsdate */ -+ (NSData *)compressedImageWithMaxDataLength:(UIImage *)image - maxDataLength:(CGFloat)maxDataLength; ++ (NSData *)compressedImageWithMaxDataLength:(UIImage *)image maxDataLength:(CGFloat)maxDataLength; /*! compressedImageAndScalingSize @@ -92,9 +89,7 @@ @return image nsdata */ -+ (NSData *)compressedImageAndScalingSize:(UIImage *)image - targetSize:(CGSize)targetSize - maxDataLen:(CGFloat)maxDataLen; ++ (NSData *)compressedImageAndScalingSize:(UIImage *)image targetSize:(CGSize)targetSize maxDataLen:(CGFloat)maxDataLen; /*! compressedImageAndScalingSize @@ -105,9 +100,7 @@ @return image nsdata */ -+ (NSData *)compressedImageAndScalingSize:(UIImage *)image - targetSize:(CGSize)targetSize - percent:(CGFloat)percent; ++ (NSData *)compressedImageAndScalingSize:(UIImage *)image targetSize:(CGSize)targetSize percent:(CGFloat)percent; /*! compressedImage @@ -120,40 +113,40 @@ /*! 获取文字显示的尺寸 - + @param text 文字 @param font 字体 @param constrainedSize 文字显示的容器大小 - + @return 文字显示的尺寸 - + @discussion 该方法在计算iOS 7以下系统显示的时候默认使用NSLineBreakByTruncatingTail模式。 */ + (CGSize)getTextDrawingSize:(NSString *)text font:(UIFont *)font constrainedSize:(CGSize)constrainedSize; /*! 判断是否是本地路径 - + @param path 路径 - + @return 是否是本地路径 */ + (BOOL)isLocalPath:(NSString *)path; /*! 判断是否是网络地址 - + @param url 地址 - + @return 是否是网络地址 */ + (BOOL)isRemoteUrl:(NSString *)url; /*! 获取沙盒修正后的文件路径 - + @param localPath 本地路径 - + @return 修正后的文件路径 */ + (NSString *)getCorrectedFilePath:(NSString *)localPath; @@ -216,7 +209,7 @@ /*! 获取当前网络类型 - + @return 当前网络类型 */ + (NSString *)currentNetworkType; @@ -237,11 +230,11 @@ /*! 获取非换行的字符串 - + @param originalString 原始的字符串 - + @return 非换行的字符串 - + @discussion 所有换行符将被替换成单个空格 */ + (NSString *)getNowrapString:(NSString *)originalString; diff --git a/ios-rongcallkit/framework/RongIMLib.framework/Headers/RCWatchKitStatusDelegate.h b/ios-rongcallkit/framework/RongIMLib.framework/Headers/RCWatchKitStatusDelegate.h index a014ee7..959e354 100644 --- a/ios-rongcallkit/framework/RongIMLib.framework/Headers/RCWatchKitStatusDelegate.h +++ b/ios-rongcallkit/framework/RongIMLib.framework/Headers/RCWatchKitStatusDelegate.h @@ -49,8 +49,7 @@ @param messageId 消息ID @param status 完成的状态吗。0表示成功,非0表示失败 */ -- (void)notifyWatchKitSendMessageCompletion:(long)messageId - status:(RCErrorCode)status; +- (void)notifyWatchKitSendMessageCompletion:(long)messageId status:(RCErrorCode)status; /*! 上传图片进度更新的回调 @@ -58,8 +57,7 @@ @param progress 进度 @param messageId 消息ID */ -- (void)notifyWatchKitUploadFileProgress:(int)progress - messageId:(long)messageId; +- (void)notifyWatchKitUploadFileProgress:(int)progress messageId:(long)messageId; #pragma mark 消息与会话操作 /*! @@ -75,8 +73,7 @@ @param conversationType 会话类型 @param targetId 目标会话ID */ -- (void)notifyWatchKitClearMessages:(RCConversationType)conversationType - targetId:(NSString *)targetId; +- (void)notifyWatchKitClearMessages:(RCConversationType)conversationType targetId:(NSString *)targetId; /*! 删除消息的回调 @@ -91,8 +88,7 @@ @param conversationType 会话类型 @param targetId 目标会话ID */ -- (void)notifyWatchKitClearUnReadStatus:(RCConversationType)conversationType - targetId:(NSString *)targetId; +- (void)notifyWatchKitClearUnReadStatus:(RCConversationType)conversationType targetId:(NSString *)targetId; #pragma mark 讨论组 @@ -102,8 +98,7 @@ @param name 讨论组名称 @param userIdList 成员的用户ID列表 */ -- (void)notifyWatchKitCreateDiscussion:(NSString *)name - userIdList:(NSArray *)userIdList; +- (void)notifyWatchKitCreateDiscussion:(NSString *)name userIdList:(NSArray *)userIdList; /*! 创建讨论组成功的回调 @@ -127,8 +122,7 @@ @discussion 加人的结果可以通过notifyWatchKitDiscussionOperationCompletion获得。 */ -- (void)notifyWatchKitAddMemberToDiscussion:(NSString *)discussionId - userIdList:(NSArray *)userIdList; +- (void)notifyWatchKitAddMemberToDiscussion:(NSString *)discussionId userIdList:(NSArray *)userIdList; /*! 讨论组踢人的回调 @@ -138,8 +132,7 @@ @discussion 踢人的结果可以通过notifyWatchKitDiscussionOperationCompletion获得。 */ -- (void)notifyWatchKitRemoveMemberFromDiscussion:(NSString *)discussionId - userId:(NSString *)userId; +- (void)notifyWatchKitRemoveMemberFromDiscussion:(NSString *)discussionId userId:(NSString *)userId; /*! 退出讨论组的回调 @@ -156,8 +149,7 @@ @param tag 讨论组的操作类型。100为加人,101为踢人,102为退出 @param status 操作的结果。0表示成功,非0表示失败 */ -- (void)notifyWatchKitDiscussionOperationCompletion:(int)tag - status:(RCErrorCode)status; +- (void)notifyWatchKitDiscussionOperationCompletion:(int)tag status:(RCErrorCode)status; @end #endif diff --git a/ios-rongcallkit/framework/RongIMLib.framework/Headers/RongIMLib.h b/ios-rongcallkit/framework/RongIMLib.framework/Headers/RongIMLib.h index cbc002b..e8e6c51 100644 --- a/ios-rongcallkit/framework/RongIMLib.framework/Headers/RongIMLib.h +++ b/ios-rongcallkit/framework/RongIMLib.framework/Headers/RongIMLib.h @@ -28,6 +28,8 @@ FOUNDATION_EXPORT const unsigned char RongIMLibVersionString[]; #import #import /// 消息相关类 +#import +#import #import #import #import @@ -45,26 +47,25 @@ FOUNDATION_EXPORT const unsigned char RongIMLibVersionString[]; #import #import #import +#import #import #import #import #import -#import -#import -#import /// 工具类 #import +#import #import #import #import -#import ///客服 +#import #import #import -#import /// 其他 #import +#import #import #import #import @@ -73,10 +74,8 @@ FOUNDATION_EXPORT const unsigned char RongIMLibVersionString[]; #import #import #import -#import #import #import #import #import - diff --git a/ios-rongcallkit/framework/RongIMLib.framework/Headers/interf_dec.h b/ios-rongcallkit/framework/RongIMLib.framework/Headers/interf_dec.h index 28497bc..5edba0c 100644 --- a/ios-rongcallkit/framework/RongIMLib.framework/Headers/interf_dec.h +++ b/ios-rongcallkit/framework/RongIMLib.framework/Headers/interf_dec.h @@ -25,8 +25,7 @@ extern "C" { void *Decoder_Interface_init(void); void Decoder_Interface_exit(void *state); -void Decoder_Interface_Decode(void *state, const unsigned char *in, short *out, - int bfi); +void Decoder_Interface_Decode(void *state, const unsigned char *in, short *out, int bfi); #ifdef __cplusplus } diff --git a/ios-rongcallkit/framework/RongIMLib.framework/Headers/interf_enc.h b/ios-rongcallkit/framework/RongIMLib.framework/Headers/interf_enc.h index 1a43d7c..781e2fe 100644 --- a/ios-rongcallkit/framework/RongIMLib.framework/Headers/interf_enc.h +++ b/ios-rongcallkit/framework/RongIMLib.framework/Headers/interf_enc.h @@ -26,23 +26,22 @@ extern "C" { #ifndef AMRNB_WRAPPER_INTERNAL /* Copied from enc/src/gsmamr_enc.h */ enum Mode { - MR475 = 0, /* 4.75 kbps */ - MR515, /* 5.15 kbps */ - MR59, /* 5.90 kbps */ - MR67, /* 6.70 kbps */ - MR74, /* 7.40 kbps */ - MR795, /* 7.95 kbps */ - MR102, /* 10.2 kbps */ - MR122, /* 12.2 kbps */ - MRDTX, /* DTX */ - N_MODES /* Not Used */ + MR475 = 0, /* 4.75 kbps */ + MR515, /* 5.15 kbps */ + MR59, /* 5.90 kbps */ + MR67, /* 6.70 kbps */ + MR74, /* 7.40 kbps */ + MR795, /* 7.95 kbps */ + MR102, /* 10.2 kbps */ + MR122, /* 12.2 kbps */ + MRDTX, /* DTX */ + N_MODES /* Not Used */ }; #endif void *Encoder_Interface_init(int dtx); void Encoder_Interface_exit(void *state); -int Encoder_Interface_Encode(void *state, enum Mode mode, const short *speech, - unsigned char *out, int forceSpeech); +int Encoder_Interface_Encode(void *state, enum Mode mode, const short *speech, unsigned char *out, int forceSpeech); #ifdef __cplusplus } diff --git a/ios-rongcallkit/framework/RongIMLib.framework/Info.plist b/ios-rongcallkit/framework/RongIMLib.framework/Info.plist index 947c588..a35f417 100644 Binary files a/ios-rongcallkit/framework/RongIMLib.framework/Info.plist and b/ios-rongcallkit/framework/RongIMLib.framework/Info.plist differ diff --git a/ios-rongcallkit/framework/RongIMLib.framework/RongIMLib b/ios-rongcallkit/framework/RongIMLib.framework/RongIMLib index dc6a90a..2071506 100644 Binary files a/ios-rongcallkit/framework/RongIMLib.framework/RongIMLib and b/ios-rongcallkit/framework/RongIMLib.framework/RongIMLib differ diff --git a/ios-rongcallkit/framework/en.lproj/RongCloudKit.strings b/ios-rongcallkit/framework/en.lproj/RongCloudKit.strings index f0fd833..ed5771e 100644 --- a/ios-rongcallkit/framework/en.lproj/RongCloudKit.strings +++ b/ios-rongcallkit/framework/en.lproj/RongCloudKit.strings @@ -116,7 +116,7 @@ "Wait"="Please wait a moment..."; "Searching"="Searching..."; "Search"="Search:"; -"Right_unReadMessage"="%ld new message"; +"Right_unReadMessage"="%@ new message"; "HistoryMessageTip"="Above is the historical messages"; "DISCUSSION"="discussion"; "DateFormat"="MM-dd"; diff --git a/ios-rongcallkit/framework/zh-Hans.lproj/RongCloudKit.strings b/ios-rongcallkit/framework/zh-Hans.lproj/RongCloudKit.strings index ff8f080..7777bad 100644 --- a/ios-rongcallkit/framework/zh-Hans.lproj/RongCloudKit.strings +++ b/ios-rongcallkit/framework/zh-Hans.lproj/RongCloudKit.strings @@ -116,7 +116,7 @@ "Wait"="请稍等..."; "Searching"="搜索中..."; "Search"="搜索:"; -"Right_unReadMessage"="%ld 条新消息"; +"Right_unReadMessage"="%@ 条新消息"; "HistoryMessageTip"="以上是历史消息"; "DISCUSSION"="讨论组"; "DateFormat"="MM月dd日";