Commit d97770e80cde21718aa6257b3f6f1f9cbbf51376

Authored by daojian
1 parent 6fd5514b

0.1.23 版本,兼容安卓商家版发送表情消息

CNLiveBusinessTools.podspec
@@ -8,7 +8,7 @@ @@ -8,7 +8,7 @@
8 8
9 Pod::Spec.new do |s| 9 Pod::Spec.new do |s|
10 s.name = 'CNLiveBusinessTools' 10 s.name = 'CNLiveBusinessTools'
11 - s.version = '0.1.22' 11 + s.version = '0.1.23'
12 s.summary = '业务工具集合组件.' 12 s.summary = '业务工具集合组件.'
13 13
14 # This description is used to generate tags and improve search results. 14 # This description is used to generate tags and improve search results.
CNLiveBusinessTools/Classes/CNLiveBusinessTools.m
@@ -1081,6 +1081,24 @@ @@ -1081,6 +1081,24 @@
1081 [attStr replaceCharactersInRange:result.range withAttributedString:imageStr]; 1081 [attStr replaceCharactersInRange:result.range withAttributedString:imageStr];
1082 NSLog(@"\n11111:text%@,range:%@",text,NSStringFromRange(result.range)); 1082 NSLog(@"\n11111:text%@,range:%@",text,NSStringFromRange(result.range));
1083 } 1083 }
  1084 + else if([[text substringWithRange:result.range] cn_containsString:emojiArr[j].identifier])
  1085 + {
  1086 + NSString *resultStr = [text substringWithRange:result.range];
  1087 + resultStr = [resultStr stringByReplacingOccurrencesOfString:@"[" withString:@""];
  1088 + resultStr = [resultStr stringByReplacingOccurrencesOfString:@"]" withString:@""];
  1089 + if ([resultStr isEqualToString:emojiArr[j].identifier]) {
  1090 +
  1091 + CNEmojiTextAttachment *textAttachment = [[CNEmojiTextAttachment alloc]init];
  1092 + textAttachment.image = emojiArr[j].image;
  1093 + textAttachment.bounds = CGRectMake(0, -4.7, 20*RATIO, 20*RATIO);
  1094 + textAttachment.emojiText = emojiArr[j].displayName;
  1095 +
  1096 + NSAttributedString *imageStr = [NSAttributedString attributedStringWithAttachment:textAttachment];
  1097 + [attStr replaceCharactersInRange:result.range withAttributedString:imageStr];
  1098 + NSLog(@"\n11111:text%@,range:%@",text,NSStringFromRange(result.range));
  1099 + }
  1100 +
  1101 + }
1084 } 1102 }
1085 }else 1103 }else
1086 {//目前只有 暂时没有判断是否是url办法 表情和url 1104 {//目前只有 暂时没有判断是否是url办法 表情和url