Skip to content

Commit

Permalink
Release RongCloud CallKit SDK 2.6.4
Browse files Browse the repository at this point in the history
  • Loading branch information
RongRobot committed Jun 29, 2016
1 parent b985ee2 commit c4958e4
Show file tree
Hide file tree
Showing 300 changed files with 42,067 additions and 0 deletions.
554 changes: 554 additions & 0 deletions ios-rongcallkit/RongCallKit.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0730"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "A6BE1A4D1CCE561200FF6BF7"
BuildableName = "RongCallKit.framework"
BlueprintName = "RongCallKit"
ReferencedContainer = "container:RongCallKit.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "A6BE1A4D1CCE561200FF6BF7"
BuildableName = "RongCallKit.framework"
BlueprintName = "RongCallKit"
ReferencedContainer = "container:RongCallKit.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "A6BE1A4D1CCE561200FF6BF7"
BuildableName = "RongCallKit.framework"
BlueprintName = "RongCallKit"
ReferencedContainer = "container:RongCallKit.xcodeproj">
</BuildableReference>
</MacroExpansion>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
38 changes: 38 additions & 0 deletions ios-rongcallkit/RongCallKit/Cell/RCCallDetailMessageCell.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
//
// RCCallDetailMessageCell.h
// RongVoIPKit
//
// Created by 岑裕 on 16/3/20.
// Copyright © 2016年 RongCloud. All rights reserved.
//

#import <RongIMKit/RongIMKit.h>

/*!
通话摘要的消息Cell
*/
@interface RCCallDetailMessageCell : RCMessageCell

/*!
消息文本的Label
*/
@property(strong, nonatomic) UILabel *textLabel;

/*!
标识媒体类型的Icon
*/
@property(strong, nonatomic) UIImageView *mediaTypeIcon;

/*!
消息的背景View
*/
@property(nonatomic, strong) UIImageView *bubbleBackgroundView;

/*!
设置当前消息Cell的数据模型
@param model 消息Cell的数据模型
*/
- (void)setDataModel:(RCMessageModel *)model;

@end
242 changes: 242 additions & 0 deletions ios-rongcallkit/RongCallKit/Cell/RCCallDetailMessageCell.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,242 @@
//
// RCCallDetailMessageCell.m
// RongVoIPKit
//
// Created by 岑裕 on 16/3/20.
// Copyright © 2016年 RongCloud. All rights reserved.
//

#import "RCCallDetailMessageCell.h"
#import "RCCall.h"
#import "RCCallKitUtility.h"
#import "RCKitCommonDefine.h"

@implementation RCCallDetailMessageCell

- (instancetype)initWithFrame:(CGRect)frame {
self = [super initWithFrame:frame];
if (self) {
[self initialize];
}
return self;
}

- (id)initWithCoder:(NSCoder *)aDecoder {
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 (IOS_FSystenVersion < 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];
}
}

- (void)tapMediaTypeIcon:(UIGestureRecognizer *)gestureRecognizer {
if ([self.delegate respondsToSelector:@selector(didTapMessageCell:)]) {
[self.delegate didTapMessageCell:self.model];
}
}

- (void)setDataModel:(RCMessageModel *)model {
[super setDataModel:model];

[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 = CGSizeZero;
if (IOS_FSystenVersion < 7.0) {
__textSize = RC_MULTILINE_TEXTSIZE_LIOS7(
self.textLabel.text, [UIFont systemFontOfSize:Text_Message_Font_Size],
CGSizeMake(
self.baseContentView.bounds.size.width -
(10 + [RCIM sharedRCIM].globalMessagePortraitSize.width + 10) *
2 -
5 - 35,
8000),
NSLineBreakByTruncatingTail);
} else {
__textSize = RC_MULTILINE_TEXTSIZE_GEIOS7(
self.textLabel.text, [UIFont systemFontOfSize:Text_Message_Font_Size],
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 + 9 +
[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];
}
}

@end
Loading

0 comments on commit c4958e4

Please sign in to comment.