|  |  | @ -1098,35 +1098,21 @@ typedef enum : NSUInteger { | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |     text = [text stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]]; |  |  |  |     text = [text stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]]; | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |     // Limit outgoing text messages to 64kb. |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     // |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     // TODO: Convert large text messages to attachments |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     // which are presented as normal text messages. |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     const NSUInteger kMaxTextMessageSize = 64 * 1024; |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     if ([text lengthOfBytesUsingEncoding:NSUTF8StringEncoding] > kMaxTextMessageSize) { |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |         UIAlertController *controller = |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |         [UIAlertController alertControllerWithTitle:NSLocalizedString(@"CONVERSATION_VIEW_TEXT_MESSAGE_TOO_LARGE_ALERT_TITLE", |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                                                                       @"The title of the 'text message too large' alert.") |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                                             message:NSLocalizedString(@"CONVERSATION_VIEW_TEXT_MESSAGE_TOO_LARGE_ALERT_MESSAGE", |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                                                                       @"The message of the 'text message too large' alert.") |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                                      preferredStyle:UIAlertControllerStyleAlert]; |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |         [controller addAction:[UIAlertAction actionWithTitle:NSLocalizedString(@"OK", nil) |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                                                        style:UIAlertActionStyleDefault |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                                                      handler:nil]]; |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |         [self presentViewController:controller |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                            animated:YES |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                          completion:nil]; |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |         return; |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     } |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |      |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |     if (text.length > 0) { |  |  |  |     if (text.length > 0) { | 
			
		
	
		
		
			
				
					
					|  |  |  |         if ([Environment.preferences soundInForeground]) { |  |  |  |         if ([Environment.preferences soundInForeground]) { | 
			
		
	
		
		
			
				
					
					|  |  |  |             [JSQSystemSoundPlayer jsq_playMessageSentSound]; |  |  |  |             [JSQSystemSoundPlayer jsq_playMessageSentSound]; | 
			
		
	
		
		
			
				
					
					|  |  |  |         } |  |  |  |         } | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |         // Limit outgoing text messages to 16kb. | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |         [ThreadUtil sendMessageWithText:text |  |  |  |         // | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                                inThread:self.thread |  |  |  |         // We convert large text messages to attachments | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                           messageSender:self.messageSender]; |  |  |  |         // which are presented as normal text messages. | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         const NSUInteger kOversizeTextMessageSizeThreshold = 16 * 1024; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         if ([text lengthOfBytesUsingEncoding:NSUTF8StringEncoding] >= kOversizeTextMessageSizeThreshold) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             SignalAttachment *attachment = [SignalAttachment oversizeTextAttachmentWithText:text]; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             [ThreadUtil sendMessageWithAttachment:attachment inThread:self.thread messageSender:self.messageSender]; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         } else { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             [ThreadUtil sendMessageWithText:text inThread:self.thread messageSender:self.messageSender]; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         } | 
			
		
	
		
		
			
				
					
					|  |  |  |         if (updateKeyboardState) |  |  |  |         if (updateKeyboardState) | 
			
		
	
		
		
			
				
					
					|  |  |  |         { |  |  |  |         { | 
			
		
	
		
		
			
				
					
					|  |  |  |             [self toggleDefaultKeyboard]; |  |  |  |             [self toggleDefaultKeyboard]; | 
			
		
	
	
		
		
			
				
					|  |  | 
 |