Skip to content

Commit

Permalink
4.1.3
Browse files Browse the repository at this point in the history
  • Loading branch information
xushichen committed Jan 3, 2019
1 parent 0c0a48e commit 3142b08
Show file tree
Hide file tree
Showing 33 changed files with 1,416 additions and 1,290 deletions.
35 changes: 34 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,20 @@ https://github.com/udesk/UdeskSDK-iOS

##### **注意:UdeskSDK并不依赖UdeskCall,如果不需要此功能则不要导入该SDK。**

### 兼容性

| 类别 | 兼容范围 |
| -------- | ----------------------------- |
| 系统 | 支持iOS 7.0及以上系统 |
| 架构 | armv7、arm64、i386、x86_64 |
| 开发环境 | 建议使用最新版本Xcode进行开发 |

### SDK大小说明

1. 由于 Bitcode 开启会导致二进制文件体积增大,这部分会在 AppStore 发布时进行进一步编译优化,并不会引起最终文件的体积变化,故此处计算的是关闭 Bitcode 下的二进制增量。
2. .a中是多个架构做了合并,使用lipo可以看到细节。所以.a库文件本身很大,且打包出来的ipa也相对较大。但用户实际下载到手机中会被AppStore优化,只下载用户设备需要的架构,所以实际在手机上占用的空间很小。`Architectures in the fat file: libUdesk.a are: armv7 i386 x86_64 arm64 `
3. DemoApp 在iPhoneX 12.1 中实际占用大小小于10M

### 导入UdeskSDK到工程

#### 1.1 手动导入
Expand Down Expand Up @@ -321,7 +335,20 @@ UdeskSDKManager *sdkManager = [[UdeskSDKManager alloc] initWithSDKStyle:[UdeskSD
UdeskEmojiPanelModel *model = [UdeskEmojiPanelModel new];
//必填
model.emojiIcon = [UIImage imageNamed:@"likeSticker"];
model.bundleURL = [[NSBundle mainBundle] URLForResource:@"Sticker" withExtension:@".bundle"];
model.stickerPaths = @[
[[NSBundle mainBundle] pathForResource:@"angry"ofType:@"png"],
[[NSBundle mainBundle] pathForResource:@"cry"ofType:@"png"],
[[NSBundle mainBundle] pathForResource:@"dead"ofType:@"png"],
[[NSBundle mainBundle] pathForResource:@"embarrass"ofType:@"png"],
[[NSBundle mainBundle] pathForResource:@"happy"ofType:@"png"],
[[NSBundle mainBundle] pathForResource:@"joy"ofType:@"png"],
[[NSBundle mainBundle] pathForResource:@"love"ofType:@"png"],
[[NSBundle mainBundle] pathForResource:@"sad"ofType:@"png"],
[[NSBundle mainBundle] pathForResource:@"shy"ofType:@"png"],
[[NSBundle mainBundle] pathForResource:@"sleepy"ofType:@"png"],
[[NSBundle mainBundle] pathForResource:@"surprise"ofType:@"png"],
[[NSBundle mainBundle] pathForResource:@"wink"ofType:@"png"],
];
//非必填
model.stickerTitles = @[@"愤怒",@"哭泣",@"糟糕",@"冷汗",@"大笑",@"可爱",@"爱",@"流汗",@"害羞",@"睡觉",@"惊讶",@"调皮"];

Expand Down Expand Up @@ -927,6 +954,12 @@ chatViewManager.orientationMask = UIInterfaceOrientationMaskPortrait;
#### 更新记录:
sdk v4.1.3版本更新功能:
1.消息优化
------
sdk v4.1.2版本更新功能:
1.客服连接逻辑优化
Expand Down
2 changes: 1 addition & 1 deletion UdeskSDK.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

Pod::Spec.new do |s|
s.name = 'UdeskSDK'
s.version = '4.1.2'
s.version = '4.1.3'
s.license = 'MIT'
s.summary = 'Udesk SDK for iOS'
s.homepage = 'https://github.com/udesk/UdeskSDK-iOS'
Expand Down
7 changes: 6 additions & 1 deletion UdeskSDK/SDK/UdeskManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// UdeskManager.h
// UdeskSDK
//
// Version: 4.1.2
// Version: 4.1.3
//
// Created by Udesk on 16/1/12.
// Copyright © 2016年 Udesk. All rights reserved.
Expand Down Expand Up @@ -68,6 +68,11 @@ typedef void (^UDUploadProgressHandler)(NSString *key, float percent);
*/
- (void)fetchSessionMessages:(NSString *)sessionId;

/**
请求客服信息,创建会话
*/
- (void)fetchAgentAgainCreateSession;

@end


Expand Down
Binary file modified UdeskSDK/SDK/libUdesk.a
Binary file not shown.
15 changes: 11 additions & 4 deletions UdeskSDK/UDChatMessage/UDIM/Controller/UdeskChatViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -554,7 +554,7 @@ - (void)didResendMessage:(UdeskMessage *)resendMessage {
} completion:^(UdeskMessage *message) {
//处理发送结果UI
@udStrongify(self);
[self updateMessageStatus:message];
[self updateChatMessageUI:message];
}];
}

Expand Down Expand Up @@ -1220,12 +1220,19 @@ - (void)servicesFeedbackSurveyWithAgentId:(NSString *)agentId {
[UdeskTopAlertView showAlertType:UDAlertTypeOrange withMessage:getUDLocalizedString(@"udesk_has_survey") parentView:self.view];
}
else {
UdeskSurveyView *surveyView = [[UdeskSurveyView alloc] initWithAgentId:agentId imSubSessionId:[NSString stringWithFormat:@"%ld",self.chatInputToolBar.agent.imSubSessionId]];
[surveyView show];
[self showSurveyViewWithAgentId:agentId];
}
}];
}

//显示满意度评价
- (void)showSurveyViewWithAgentId:(NSString *)agentId {
if (!agentId || agentId == (id)kCFNull) return ;

UdeskSurveyView *surveyView = [[UdeskSurveyView alloc] initWithAgentId:agentId imSubSessionId:[NSString stringWithFormat:@"%ld",self.chatInputToolBar.agent.imSubSessionId]];
[surveyView show];
}

//开启用户相册
- (void)openCustomerAlubm {

Expand Down Expand Up @@ -1406,7 +1413,7 @@ - (void)checkInvestigationWhenLeave {
if (![hasSurvey boolValue]) {
//标记满意度只显示一次
self.backAlreadyDisplayedSurvey = YES;
[self servicesFeedbackSurveyWithAgentId:self.chatInputToolBar.agent.agentId];
[self showSurveyViewWithAgentId:self.chatInputToolBar.agent.agentId];
}
else {
[self dismissViewController];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ - (void)createCustomer {
NSURLRequest *request = [NSURLRequest requestWithURL:self.robotURL cachePolicy:NSURLRequestReloadIgnoringLocalAndRemoteCacheData timeoutInterval:30];

if (ud_isIOS8) {

_robotWkWebView = [[WKWebView alloc] initWithFrame:webViewRect];
_robotWkWebView.UIDelegate = self;
_robotWkWebView.navigationDelegate = self;
Expand All @@ -163,7 +163,7 @@ - (void)createCustomer {
[self.view addSubview:_robotWkWebView];
}
else {

_robotWebView = [[UIWebView alloc] initWithFrame:webViewRect];
_robotWebView.udHeight -= spacing;
_robotWebView.backgroundColor=[UIColor whiteColor];
Expand Down
29 changes: 23 additions & 6 deletions UdeskSDK/UDChatMessage/UDIM/ViewModel/UdeskChatViewModel.m
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ @interface UdeskChatViewModel()<UDManagerDelegate>
@property (nonatomic, strong) UdeskQueueMessage *queueMessage;
/** 排队消息最大 */
@property (nonatomic, copy ) NSString *queueMessageMaxTips;
/** 重发消息Timer */
@property (nonatomic, strong) NSTimer *chatMsgTimer;

#if __has_include(<UdeskCall/UdeskCall.h>)
/** 用户ID */
Expand Down Expand Up @@ -743,6 +745,19 @@ - (void)fetchSessionMessages:(NSString *)sessionId {
}];
}

//请求客服信息,创建会话
- (void)fetchAgentAgainCreateSession {

[self requestAgentDataWithPreSessionMessage:nil completion:^(UdeskAgent *agentModel) {
if (agentModel.code == UDAgentStatusResultOffline) {
if (self.chatMsgTimer) {
[self.chatMsgTimer invalidate];
self.chatMsgTimer = nil;
}
}
}];
}

#pragma mark - 发送文字消息
- (void)sendTextMessage:(NSString *)text completion:(void(^)(UdeskMessage *message))completion {

Expand Down Expand Up @@ -1201,11 +1216,9 @@ - (void)endPreSessionWithMessage:(UdeskMessage *)message delay:(CGFloat)delay co
dispatch_after(delayTime, dispatch_get_main_queue(), ^{
[UdeskSDKAlert showWithMsg:getUDLocalizedString(@"udesk_connecting_agent")];
[self requestAgentDataWithPreSessionMessage:message completion:^(UdeskAgent *agentModel) {
if (agentModel.code == UDAgentStatusResultOnline || agentModel.code == UDAgentStatusResultQueue) {
message.messageStatus = UDMessageSendStatusSuccess;
if (completion) {
completion();
}
message.messageStatus = UDMessageSendStatusSuccess;
if (completion) {
completion();
}
}];
});
Expand Down Expand Up @@ -1426,7 +1439,8 @@ - (void)updateContent {
- (void)autoResendFailedMessageWithProgress:(void(^)(NSString *messageId,float percent))progress
completion:(void(^)(UdeskMessage *failedMessage))completion {

[UdeskMessageUtil resendFailedMessage:self.resendArray progress:progress completion:completion];
if (!self.resendArray || self.resendArray == (id)kCFNull || self.resendArray.count == 0) return ;
self.chatMsgTimer = [UdeskMessageUtil resendFailedMessage:self.resendArray progress:progress completion:completion];
}

- (void)resendMessageWithMessage:(UdeskMessage *)resendMessage
Expand All @@ -1448,6 +1462,9 @@ - (void)resendMessageWithMessage:(UdeskMessage *)resendMessage
else if (self.agentModel.code != UDAgentStatusResultOnline &&
self.agentModel.code != UDAgentStatusResultLeaveMessage) {
[self showAgentStatusAlert];
if (completion) {
completion(resendMessage);
}
}
else {

Expand Down
2 changes: 1 addition & 1 deletion UdeskSDK/UDChatMessage/UDIM/Views/Cells/UdeskVideoCell.m
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ - (void)errorHandle:(Udesk_WHC_DownloadOperation *)operation error:(NSError *)er
_downloadButton.hidden = NO;
_playButton.hidden = YES;

[[UdeskCacheUtil sharedManager] removeObjectForKey:self.baseMessage.messageId];
[[UdeskCacheUtil sharedManager] udRemoveObjectForKey:self.baseMessage.messageId];
[self removeDownloadStateOperation:operation];
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,24 +70,16 @@ - (void)customEmoji {
for (UdeskEmojiPanelModel *panelModel in customEmojis) {

if (![panelModel isKindOfClass:[UdeskEmojiPanelModel class]]) return;
if (!panelModel.bundleURL || panelModel.bundleURL == (id)kCFNull) return ;
if (![panelModel.bundleURL isKindOfClass:[NSURL class]]) return ;

NSURL *bundleURL = panelModel.bundleURL;

NSFileManager *fileManager = [NSFileManager defaultManager];
NSArray *contents = [fileManager contentsOfDirectoryAtURL:bundleURL
includingPropertiesForKeys:@[]
options:NSDirectoryEnumerationSkipsHiddenFiles
error:nil];

if (!panelModel.stickerPaths || panelModel.stickerPaths == (id)kCFNull) return ;
if (![panelModel.stickerPaths.firstObject isKindOfClass:[NSString class]]) return ;

NSMutableArray *emojiContent = [NSMutableArray new];
for (NSURL *path in contents) {
for (NSString *path in panelModel.stickerPaths) {
UdeskEmojiContentModel *model = [UdeskEmojiContentModel new];
model.resource = [path path];
model.resource = path;
model.stickerImage = [UdeskImageUtil imageResize:[UIImage imageWithContentsOfFile:model.resource] toSize:CGSizeMake(140, 140)];
model.emojiType = UdeskEmojiTypeSticker;
NSInteger index = [contents indexOfObject:path];
NSInteger index = [panelModel.stickerPaths indexOfObject:path];
model.stickerTitle = panelModel.stickerTitles[index];
[emojiContent addObject:model];
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ typedef NS_ENUM(NSUInteger, UdeskEmojiType) {
@property (nonatomic, assign) UdeskEmojiType emojiType;
@property (nonatomic, strong) UIImage *emojiIcon;
@property (nonatomic, strong) NSArray *contentArray;
//表情资源文件路径(用户自定义表情时需要传入,图片大小最好在50-60左右)
@property (nonatomic, strong) NSURL *bundleURL;
//表情资源文件路径(具体用法参考文档或者demo,注:图片大小最好在50-60左右)
@property (nonatomic, strong) NSArray *stickerPaths;
//自定义表情标题(非必填)
@property (nonatomic, strong) NSArray *stickerTitles;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ - (void)viewDidLayoutSubviews {
_previewCollectionView.frame = CGRectMake(-10, 0, CGRectGetWidth(self.view.frame) + 20, CGRectGetHeight(self.view.frame));
[_previewCollectionView setCollectionViewLayout:_previewFlowLayout];

CGFloat toolBarHeight = (udIsIPhoneXSeries ? 50 + (83 - 49) : 50) + (_dataSource.count > 1 ? 80 : 0);
CGFloat toolBarHeight = (udIsIPhoneXSeries ? 50 + (83 - 49) : 50) + (self.selectedAssetArray.count > 1 ? 80 : 0);
CGFloat toolBarTop = CGRectGetHeight(self.view.frame) - toolBarHeight;
_toolBar.frame = CGRectMake(0, toolBarTop, CGRectGetWidth(self.view.frame), toolBarHeight);
}
Expand Down Expand Up @@ -284,7 +284,7 @@ - (void)refreshNavBarAndBottomBarState {

[self.toolBar updateSendNumber:udImagePicker.selectedModels.count];
self.toolBar.selectedAssets = udImagePicker.selectedModels;
if (_dataSource.count > 1) {
if (self.selectedAssetArray.count > 1) {
self.toolBar.toolBarCollectionView.hidden = NO;
}
[self.view setNeedsLayout];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -432,6 +432,12 @@ - (void)viewDidAppear:(BOOL)animated{
}

- (id<UIViewControllerAnimatedTransitioning>)navigationController:(UINavigationController *)navigationController animationControllerForOperation:(UINavigationControllerOperation)operation fromViewController:(UIViewController *)fromVC toViewController:(UIViewController *)toVC{

//预览图
if ([toVC isKindOfClass:[UdeskAssetPreviewController class]]) {
return nil;
}

if (operation == UINavigationControllerOperationPush) {
return [[UdeskPopAnimation alloc] init];
}
Expand Down
4 changes: 0 additions & 4 deletions UdeskSDK/UDChatMessage/UDTools/Animation/UdeskPushAnimation.m
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,12 @@ - (NSTimeInterval)transitionDuration:(id <UIViewControllerContextTransitioning>)
- (void)animateTransition:(id <UIViewControllerContextTransitioning>)transitionContext{

UIViewController *toViewController = [transitionContext viewControllerForKey:UITransitionContextToViewControllerKey];
UIViewController *fromViewController = [transitionContext viewControllerForKey:UITransitionContextFromViewControllerKey];

UIView* toView = nil;
UIView* fromView = nil;

if ([transitionContext respondsToSelector:@selector(viewForKey:)]) {
fromView = [transitionContext viewForKey:UITransitionContextFromViewKey];
toView = [transitionContext viewForKey:UITransitionContextToViewKey];
} else {
fromView = fromViewController.view;
toView = toViewController.view;
}

Expand Down
2 changes: 1 addition & 1 deletion UdeskSDK/UDChatMessage/UDTools/Util/UdeskCacheUtil.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

- (void)storeVideo:(NSData *)videoData videoId:(NSString *)videoId;
- (BOOL)containsObjectForKey:(NSString *)key;
- (BOOL)removeObjectForKey:(NSString *)key;
- (BOOL)udRemoveObjectForKey:(NSString *)key;

- (NSString *)filePathForkey:(NSString *)key;
- (NSString *)filePath;
Expand Down
2 changes: 1 addition & 1 deletion UdeskSDK/UDChatMessage/UDTools/Util/UdeskCacheUtil.m
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ - (NSString *)filePathForkey:(NSString *)key {
return [filePath stringByAppendingPathComponent:[NSString stringWithFormat:@"%@.mp4",key]];
}

- (BOOL)removeObjectForKey:(NSString *)key {
- (BOOL)udRemoveObjectForKey:(NSString *)key {

NSString *filePath = self.diskCache.path;
filePath = [filePath stringByAppendingPathComponent:[NSString stringWithFormat:@"%@.mp4",key]];
Expand Down
2 changes: 1 addition & 1 deletion UdeskSDK/UDChatMessage/UDTools/Util/UdeskMessageUtil.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
+ (NSArray *)chatMessageWithMsgModel:(NSArray *)array agentNick:(NSString *)agentNick lastMessage:(UdeskMessage *)lastMessage;

//重发失败的消息
+ (void)resendFailedMessage:(NSMutableArray *)resendMessageArray progress:(void(^)(NSString *key,float percent))progress completion:(void(^)(UdeskMessage *failedMessage))completion;
+ (NSTimer *)resendFailedMessage:(NSMutableArray *)resendMessageArray progress:(void(^)(NSString *key,float percent))progress completion:(void(^)(UdeskMessage *failedMessage))completion;

//地理位置消息转换
+ (UdeskLocationModel *)locationModelWithMessage:(UdeskMessage *)message;
Expand Down
Loading

0 comments on commit 3142b08

Please sign in to comment.