Skip to content

Commit

Permalink
Merge pull request #11 from JoaoCaixinha/master
Browse files Browse the repository at this point in the history
checkForEmoji fix
  • Loading branch information
realtime-framework authored Aug 25, 2016
2 parents 26e1604 + a3f11be commit b7bcf06
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 8 deletions.
25 changes: 19 additions & 6 deletions Pod/Classes/OrtcClient/OrtcClient.m
Original file line number Diff line number Diff line change
Expand Up @@ -1291,18 +1291,31 @@ - (void)opReceive:(NSString*) message {


- (NSString*)checkForEmoji:(NSString*)str{
for (int i = 0; i < str.length; i++) {
for (int i = 0; i < [str length]; i++) {
unichar ascii = [str characterAtIndex:i];
if(ascii == '\\'){
i = i + 1;
int next = [str characterAtIndex:i];

if(next == 'u'){
NSString *emoji = [str substringWithRange:NSMakeRange(i - 1, 12)];
NSData *pos = [emoji dataUsingEncoding:NSUTF8StringEncoding];
emoji = [[NSString alloc] initWithData:pos encoding:NSNonLossyASCIIStringEncoding];

str = [str stringByReplacingCharactersInRange:NSMakeRange(i - 1, 12) withString:emoji];
@try {
NSString *emoji = [str substringWithRange:NSMakeRange(i - 1, 12)];
NSData *pos = [emoji dataUsingEncoding:NSUTF8StringEncoding];
emoji = [[NSString alloc] initWithData:pos encoding:NSNonLossyASCIIStringEncoding];

str = [str stringByReplacingCharactersInRange:NSMakeRange(i - 1, 12) withString:emoji];

} @catch (NSException *e) {
@try {
NSString *emoji = [str substringWithRange:NSMakeRange(i - 1, 6)];
NSData *pos = [emoji dataUsingEncoding:NSUTF8StringEncoding];
emoji = [[NSString alloc] initWithData:pos encoding:NSNonLossyASCIIStringEncoding];

str = [str stringByReplacingCharactersInRange:NSMakeRange(i - 1, 6) withString:emoji];
} @catch (NSException *e) {
return str;
}
}
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions RealtimeMessaging-iOS.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

Pod::Spec.new do |s|
s.name = "RealtimeMessaging-iOS"
s.version = "2.1.24"
s.version = "2.1.26"
s.summary = "Realtime Cloud Messaging (ORTC) SDK for iOS"
s.description = <<-DESC
Part of the The Realtime® Framework, Realtime Cloud Messaging (aka ORTC) is a secure, fast and highly scalable cloud-hosted Pub/Sub real-time message broker for web and mobile apps.
Expand All @@ -19,7 +19,7 @@ DESC
s.homepage = "http://framework.realtime.co/messaging"
s.license = 'MIT'
s.author = { "Realtime.co" => "[email protected]" }
s.source = { :git => "https://github.com/realtime-framework/RealtimeMessaging-iOS.git", :tag => "2.1.24"}
s.source = { :git => "https://github.com/realtime-framework/RealtimeMessaging-iOS.git", :tag => "2.1.26"}
s.social_media_url = 'https://twitter.com/RTWworld'

s.platform = :ios, '7.0'
Expand Down

0 comments on commit b7bcf06

Please sign in to comment.