Console: BugFix SYIOS-79 - Partial text input should be remembered per-room

This commit is contained in:
giomfo 2015-02-16 10:37:17 +01:00
parent 089c843202
commit 041ede9ab0
6 changed files with 190 additions and 149 deletions

View file

@ -72,35 +72,33 @@ typedef enum : NSUInteger {
- (void)enableInAppNotifications:(BOOL)isEnabled;
- (BOOL)isSupportedAttachment:(MXEvent*)event;
- (BOOL)isEmote:(MXEvent*)event;
// return a MatrixIDs list of 1:1 room members
- (NSArray*)oneToOneRoomMemberMatrixIDs;
// return a userIds list of 1:1 room members
- (NSArray*)oneToOneRoomMemberIDs;
// Searches if a private OneToOne room has been started with this user
// Returns the room ID (nil if not found)
- (NSString*)privateOneToOneRoomIdWithUserId:(NSString*)userId;
// Reopens an existing private OneToOne room with this userId or creates a new one (if it doesn't exist)
- (void)startPrivateOneToOneRoomWithUserId:(NSString*)userId;
// the pushes could have disabled for a dedicated room
// reenable them
- (void)allowRoomPushes:(NSString*)roomID;
// Enables inApp notifications for a dedicated room if they were disabled
- (void)restoreInAppNotificationsForRoomId:(NSString*)roomID;
// Return the suitable url to display the content thumbnail into the provided view size
// Note: the provided view size is supposed in points, this method will convert this size in pixels by considering screen scale
- (NSString*)thumbnailURLForContent:(NSString*)contentURI inViewSize:(CGSize)viewSize withMethod:(MXThumbnailingMethod)thumbnailingMethod;
// Stores the current text message partially typed in text input before leaving a room (use nil to reset the current value)
- (void)storePartialTextMessage:(NSString*)textMessage forRoomId:(NSString*)roomId;
// Returns the current partial message stored for this room (nil if none)
- (NSString*)partialTextMessageForRoomId:(NSString*)roomId;
// user power level in a dedicated room
- (CGFloat)getPowerLevel:(MXRoomMember *)roomMember inRoom:(MXRoom *)room;
- (BOOL)isSupportedAttachment:(MXEvent*)event;
- (BOOL)isEmote:(MXEvent*)event;
// Note: the room state expected by the 3 following methods is the room state right before handling the event
- (NSString*)senderDisplayNameForEvent:(MXEvent*)event withRoomState:(MXRoomState*)roomState;
- (NSString*)senderAvatarUrlForEvent:(MXEvent*)event withRoomState:(MXRoomState*)roomState;
- (NSString*)displayTextForEvent:(MXEvent*)event withRoomState:(MXRoomState*)roomState inSubtitleMode:(BOOL)isSubtitle;
// user power level in a dedicated room
- (CGFloat)getPowerLevel:(MXRoomMember *)roomMember inRoom:(MXRoom *)room;
// return the presence ring color
// nil means there is no ring to display
- (UIColor*)getPresenceRingColor:(MXPresence)presence;
@ -108,4 +106,8 @@ typedef enum : NSUInteger {
// return YES if the text contains a bing word
- (BOOL)containsBingWord:(NSString*)text;
// Return the suitable url to display the content thumbnail into the provided view size
// Note: the provided view size is supposed in points, this method will convert this size in pixels by considering screen scale
- (NSString*)thumbnailURLForContent:(NSString*)contentURI inViewSize:(CGSize)viewSize withMethod:(MXThumbnailingMethod)thumbnailingMethod;
@end

View file

@ -49,7 +49,9 @@ static MatrixSDKHandler *sharedHandler = nil;
@property (strong, nonatomic) MXCAlert *mxNotification;
@property (nonatomic) UIBackgroundTaskIdentifier bgTask;
// when the user cancels a notification
@property (strong, nonatomic) NSMutableDictionary *partialTextMsgByRoomId;
// When the user cancels an inApp notification
// assume that any messagge room will be ignored
// until the next launch / debackground
@property (nonatomic,readwrite) NSMutableArray* unnotifiedRooms;
@ -91,6 +93,7 @@ static MatrixSDKHandler *sharedHandler = nil;
}
_unnotifiedRooms = [[NSMutableArray alloc] init];
_partialTextMsgByRoomId = [[NSMutableDictionary alloc] init];
}
return self;
}
@ -105,6 +108,10 @@ static MatrixSDKHandler *sharedHandler = nil;
_processingQueue = nil;
_unnotifiedRooms = nil;
_partialTextMsgByRoomId = nil;
[self closeSession];
self.mxSession = nil;
@ -351,6 +358,7 @@ static MatrixSDKHandler *sharedHandler = nil;
self.homeServer = nil;
_unnotifiedRooms = [[NSMutableArray alloc] init];
_partialTextMsgByRoomId = [[NSMutableDictionary alloc] init];
// Keep userLogin, homeServerUrl
}
@ -483,6 +491,8 @@ static MatrixSDKHandler *sharedHandler = nil;
_status = status;
}
#pragma mark User's profile
- (NSString *)homeServerURL {
return [[NSUserDefaults standardUserDefaults] objectForKey:@"homeserverurl"];
}
@ -593,6 +603,38 @@ static MatrixSDKHandler *sharedHandler = nil;
}
}
#pragma mark Cache handling
- (NSUInteger) MXCacheSize {
if (self.mxFileStore) {
return self.mxFileStore.diskUsage;
}
return 0;
}
- (NSUInteger) cachesSize {
return self.MXCacheSize + [MediaManager cacheSize];
}
- (NSUInteger) minCachesSize {
// add a 50MB margin to avoid cache file deletion
return self.MXCacheSize + [MediaManager minCacheSize] + 50 * 1024 * 1024;
}
- (NSUInteger) currentMaxCachesSize {
return self.MXCacheSize + [MediaManager currentMaxCacheSize];
}
- (void)setCurrentMaxCachesSize:(NSUInteger)maxCachesSize {
[MediaManager setCurrentMaxCacheSize:maxCachesSize - self.MXCacheSize];
}
- (NSUInteger) maxAllowedCachesSize {
return self.MXCacheSize + [MediaManager maxAllowedCacheSize];
}
#pragma mark - Matrix user's settings
- (void)setUserPresence:(MXPresence)userPresence andStatusMessage:(NSString *)statusMessage completion:(void (^)(void))completion {
@ -608,50 +650,10 @@ static MatrixSDKHandler *sharedHandler = nil;
}];
}
#pragma mark - events handler
// Checks whether the event is related to an attachment and if it is supported
- (BOOL)isSupportedAttachment:(MXEvent*)event {
BOOL isSupportedAttachment = NO;
if (event.eventType == MXEventTypeRoomMessage) {
NSString *msgtype = event.content[@"msgtype"];
NSString *requiredField;
if ([msgtype isEqualToString:kMXMessageTypeImage]) {
requiredField = event.content[@"url"];
if (requiredField.length) {
isSupportedAttachment = YES;
}
} else if ([msgtype isEqualToString:kMXMessageTypeAudio]) {
// Not supported yet
} else if ([msgtype isEqualToString:kMXMessageTypeVideo]) {
requiredField = event.content[@"url"];
if (requiredField) {
isSupportedAttachment = YES;
}
} else if ([msgtype isEqualToString:kMXMessageTypeLocation]) {
// Not supported yet
}
}
return isSupportedAttachment;
}
// Check whether the event is emote event
- (BOOL)isEmote:(MXEvent*)event {
if (event.eventType == MXEventTypeRoomMessage) {
NSString *msgtype = event.content[@"msgtype"];
if ([msgtype isEqualToString:kMXMessageTypeEmote]) {
return YES;
}
}
return NO;
}
#pragma mark -
#pragma mark - Room handling
// return a MatrixIDs list of 1:1 room members
- (NSArray*)oneToOneRoomMemberMatrixIDs {
- (NSArray*)oneToOneRoomMemberIDs {
NSMutableArray* matrixIDs = [[NSMutableArray alloc] init];
MatrixSDKHandler *mxHandler = [MatrixSDKHandler sharedHandler];
@ -760,30 +762,99 @@ static MatrixSDKHandler *sharedHandler = nil;
}
}
// the pushes could have disabled for a dedicated room
// reenable them
- (void)allowRoomPushes:(NSString*)roomID {
- (void)restoreInAppNotificationsForRoomId:(NSString*)roomID {
if (roomID) {
// Enable inApp notification for this room
[self.unnotifiedRooms removeObject:roomID];
}
}
// Return the suitable url to display the content thumbnail into the provided view size
// Note: the provided view size is supposed in points, this method will convert this size in pixels by considering screen scale
- (NSString*)thumbnailURLForContent:(NSString*)contentURI inViewSize:(CGSize)viewSize withMethod:(MXThumbnailingMethod)thumbnailingMethod {
// Suppose this url is a matrix content uri, we use SDK to get the well adapted thumbnail from server
// Convert first the provided size in pixels
CGFloat scale = [[UIScreen mainScreen] scale];
CGSize sizeInPixels = CGSizeMake(viewSize.width * scale, viewSize.height * scale);
NSString *thumbnailURL = [self.mxRestClient urlOfContentThumbnail:contentURI withSize:sizeInPixels andMethod:thumbnailingMethod];
if (nil == thumbnailURL) {
// Manage backward compatibility. The content URL used to be an absolute HTTP URL
thumbnailURL = contentURI;
- (void)storePartialTextMessage:(NSString*)textMessage forRoomId:(NSString*)roomId {
if (roomId) {
if (textMessage.length) {
[self.partialTextMsgByRoomId setObject:textMessage forKey:roomId];
} else {
[self.partialTextMsgByRoomId removeObjectForKey:roomId];
}
}
return thumbnailURL;
}
#pragma mark -
- (NSString*)partialTextMessageForRoomId:(NSString*)roomId {
if (roomId) {
return [self.partialTextMsgByRoomId objectForKey:roomId];
}
return nil;
}
- (CGFloat)getPowerLevel:(MXRoomMember *)roomMember inRoom:(MXRoom *)room {
CGFloat powerLevel = 0;
// Customize banned and left (kicked) members
if (roomMember.membership == MXMembershipLeave || roomMember.membership == MXMembershipBan) {
powerLevel = 0;
} else {
// Handle power level display
//self.userPowerLevel.hidden = NO;
MXRoomPowerLevels *roomPowerLevels = room.state.powerLevels;
int maxLevel = 0;
for (NSString *powerLevel in roomPowerLevels.users.allValues) {
int level = [powerLevel intValue];
if (level > maxLevel) {
maxLevel = level;
}
}
NSUInteger userPowerLevel = [roomPowerLevels powerLevelOfUserWithUserID:roomMember.userId];
float userPowerLevelFloat = 0.0;
if (userPowerLevel) {
userPowerLevelFloat = userPowerLevel;
}
powerLevel = maxLevel ? userPowerLevelFloat / maxLevel : 1;
}
return powerLevel;
}
#pragma mark - Event handling
// Checks whether the event is related to an attachment and if it is supported
- (BOOL)isSupportedAttachment:(MXEvent*)event {
BOOL isSupportedAttachment = NO;
if (event.eventType == MXEventTypeRoomMessage) {
NSString *msgtype = event.content[@"msgtype"];
NSString *requiredField;
if ([msgtype isEqualToString:kMXMessageTypeImage]) {
requiredField = event.content[@"url"];
if (requiredField.length) {
isSupportedAttachment = YES;
}
} else if ([msgtype isEqualToString:kMXMessageTypeAudio]) {
// Not supported yet
} else if ([msgtype isEqualToString:kMXMessageTypeVideo]) {
requiredField = event.content[@"url"];
if (requiredField) {
isSupportedAttachment = YES;
}
} else if ([msgtype isEqualToString:kMXMessageTypeLocation]) {
// Not supported yet
}
}
return isSupportedAttachment;
}
// Check whether the event is emote event
- (BOOL)isEmote:(MXEvent*)event {
if (event.eventType == MXEventTypeRoomMessage) {
NSString *msgtype = event.content[@"msgtype"];
if ([msgtype isEqualToString:kMXMessageTypeEmote]) {
return YES;
}
}
return NO;
}
- (NSString*)senderDisplayNameForEvent:(MXEvent*)event withRoomState:(MXRoomState*)roomState {
// Consider first the current display name defined in provided room state (Note: this room state is supposed to not take the new event into account)
@ -1149,66 +1220,7 @@ static MatrixSDKHandler *sharedHandler = nil;
return displayText;
}
- (NSUInteger) MXCacheSize {
if (self.mxFileStore) {
return self.mxFileStore.diskUsage;
}
return 0;
}
- (NSUInteger) cachesSize {
return self.MXCacheSize + [MediaManager cacheSize];
}
- (NSUInteger) minCachesSize {
// add a 50MB margin to avoid cache file deletion
return self.MXCacheSize + [MediaManager minCacheSize] + 50 * 1024 * 1024;
}
- (NSUInteger) currentMaxCachesSize {
return self.MXCacheSize + [MediaManager currentMaxCacheSize];
}
- (void)setCurrentMaxCachesSize:(NSUInteger)maxCachesSize {
[MediaManager setCurrentMaxCacheSize:maxCachesSize - self.MXCacheSize];
}
- (NSUInteger) maxAllowedCachesSize {
return self.MXCacheSize + [MediaManager maxAllowedCacheSize];
}
- (CGFloat)getPowerLevel:(MXRoomMember *)roomMember inRoom:(MXRoom *)room {
CGFloat powerLevel = 0;
// Customize banned and left (kicked) members
if (roomMember.membership == MXMembershipLeave || roomMember.membership == MXMembershipBan) {
powerLevel = 0;
} else {
// Handle power level display
//self.userPowerLevel.hidden = NO;
MXRoomPowerLevels *roomPowerLevels = room.state.powerLevels;
int maxLevel = 0;
for (NSString *powerLevel in roomPowerLevels.users.allValues) {
int level = [powerLevel intValue];
if (level > maxLevel) {
maxLevel = level;
}
}
NSUInteger userPowerLevel = [roomPowerLevels powerLevelOfUserWithUserID:roomMember.userId];
float userPowerLevelFloat = 0.0;
if (userPowerLevel) {
userPowerLevelFloat = userPowerLevel;
}
powerLevel = maxLevel ? userPowerLevelFloat / maxLevel : 1;
}
return powerLevel;
}
#pragma mark - Presence
// return the presence ring color
// nil means there is no ring to display
@ -1228,6 +1240,8 @@ static MatrixSDKHandler *sharedHandler = nil;
}
}
#pragma mark - Bing work
// return YES if the text contains a bing word
- (BOOL)containsBingWord:(NSString*)text {
MatrixSDKHandler *mxHandler = [MatrixSDKHandler sharedHandler];
@ -1266,4 +1280,21 @@ static MatrixSDKHandler *sharedHandler = nil;
return NO;
}
#pragma mark - Thumbnail
// Return the suitable url to display the content thumbnail into the provided view size
// Note: the provided view size is supposed in points, this method will convert this size in pixels by considering screen scale
- (NSString*)thumbnailURLForContent:(NSString*)contentURI inViewSize:(CGSize)viewSize withMethod:(MXThumbnailingMethod)thumbnailingMethod {
// Suppose this url is a matrix content uri, we use SDK to get the well adapted thumbnail from server
// Convert first the provided size in pixels
CGFloat scale = [[UIScreen mainScreen] scale];
CGSize sizeInPixels = CGSizeMake(viewSize.width * scale, viewSize.height * scale);
NSString *thumbnailURL = [self.mxRestClient urlOfContentThumbnail:contentURI withSize:sizeInPixels andMethod:thumbnailingMethod];
if (nil == thumbnailURL) {
// Manage backward compatibility. The content URL used to be an absolute HTTP URL
thumbnailURL = contentURI;
}
return thumbnailURL;
}
@end

View file

@ -311,10 +311,10 @@
</connections>
</tableView>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="6fM-aJ-d0M" userLabel="ControlView">
<rect key="frame" x="0.0" y="507" width="600" height="44"/>
<rect key="frame" x="0.0" y="505" width="600" height="46"/>
<subviews>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="contactAdd" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="cfF-YG-Cvg">
<rect key="frame" x="4" y="7" width="30" height="30"/>
<rect key="frame" x="4" y="8" width="30" height="30"/>
<constraints>
<constraint firstAttribute="height" constant="30" id="MxI-8f-ECJ"/>
<constraint firstAttribute="width" constant="30" id="pUe-Lu-1Q0"/>
@ -327,13 +327,13 @@
</connections>
</button>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="UVo-EY-Nyg" customClass="MXCGrowingTextView">
<rect key="frame" x="38" y="4" width="510" height="36"/>
<rect key="frame" x="38" y="4" width="510" height="38"/>
</view>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Icg-kc-a2c">
<rect key="frame" x="552" y="0.0" width="44" height="44"/>
<rect key="frame" x="552" y="0.0" width="44" height="46"/>
<constraints>
<constraint firstAttribute="width" constant="44" id="28c-o8-T5D"/>
<constraint firstAttribute="height" constant="44" id="cwy-NO-c5b"/>
<constraint firstAttribute="height" constant="46" id="cwy-NO-c5b"/>
</constraints>
<state key="normal" title="Send">
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
@ -346,13 +346,13 @@
<color key="backgroundColor" red="0.89816151494565222" green="0.89816151494565222" blue="0.89816151494565222" alpha="1" colorSpace="calibratedRGB"/>
<constraints>
<constraint firstAttribute="bottom" secondItem="UVo-EY-Nyg" secondAttribute="bottom" constant="4" id="42W-Aj-tDe"/>
<constraint firstAttribute="bottom" secondItem="cfF-YG-Cvg" secondAttribute="bottom" constant="7" id="FaK-A3-nl8"/>
<constraint firstAttribute="bottom" secondItem="cfF-YG-Cvg" secondAttribute="bottom" constant="8" id="FaK-A3-nl8"/>
<constraint firstAttribute="bottom" secondItem="Icg-kc-a2c" secondAttribute="bottom" id="GBv-Db-4H0"/>
<constraint firstItem="cfF-YG-Cvg" firstAttribute="leading" secondItem="6fM-aJ-d0M" secondAttribute="leading" constant="4" id="JLw-Kl-Rdp"/>
<constraint firstItem="Icg-kc-a2c" firstAttribute="leading" secondItem="UVo-EY-Nyg" secondAttribute="trailing" constant="4" id="lVs-Ba-j3d"/>
<constraint firstAttribute="trailing" secondItem="Icg-kc-a2c" secondAttribute="trailing" constant="4" id="pQV-JJ-C09"/>
<constraint firstItem="UVo-EY-Nyg" firstAttribute="top" secondItem="6fM-aJ-d0M" secondAttribute="top" constant="4" id="qPI-ig-yno"/>
<constraint firstAttribute="height" constant="44" id="tGp-dw-uAO"/>
<constraint firstAttribute="height" constant="46" id="tGp-dw-uAO"/>
<constraint firstItem="UVo-EY-Nyg" firstAttribute="leading" secondItem="cfF-YG-Cvg" secondAttribute="trailing" constant="4" id="u00-eB-vAB"/>
</constraints>
</view>
@ -581,6 +581,8 @@
<outlet property="membersTableView" destination="pLY-I9-ghF" id="Ioc-IJ-WYX"/>
<outlet property="membersView" destination="OWi-J8-sFZ" id="3n2-n5-r6B"/>
<outlet property="messageTextView" destination="UVo-EY-Nyg" id="zc1-ch-1Mf"/>
<outlet property="messageTextViewBottomConstraint" destination="42W-Aj-tDe" id="Cjc-w3-Vsf"/>
<outlet property="messageTextViewTopConstraint" destination="qPI-ig-yno" id="XX2-bD-siz"/>
<outlet property="messagesTableView" destination="meV-kn-sxo" id="W1n-q0-ml7"/>
<outlet property="messagesTableViewBottomConstraint" destination="Cos-M5-WHG" id="uv8-tO-HiR"/>
<outlet property="optionBtn" destination="cfF-YG-Cvg" id="Ppb-dg-Tub"/>

View file

@ -253,8 +253,7 @@ NSString *const kInvitationMessage = @"I'd like to chat with you with matrix. Pl
} else {
[self stopActivityIndicator];
//NSArray* users = [mxHandler.mxSession users];
NSArray* usersIDs = [mxHandler oneToOneRoomMemberMatrixIDs];
NSArray* usersIDs = [mxHandler oneToOneRoomMemberIDs];
// return a MatrixIDs list of 1:1 room members
NSMutableArray* knownUserIDs = [[matrixUserByMatrixID allKeys] mutableCopy];

View file

@ -143,7 +143,7 @@
}
- (void)setVisibleRoomId:(NSString *)aVisibleRoomId {
[[MatrixSDKHandler sharedHandler] allowRoomPushes:aVisibleRoomId];
[[MatrixSDKHandler sharedHandler] restoreInAppNotificationsForRoomId:aVisibleRoomId];
_visibleRoomId = aVisibleRoomId;
}

View file

@ -126,6 +126,8 @@ NSString *const kCmdResetUserPowerLevel = @"/deop";
@property (weak, nonatomic) IBOutlet UIView *controlView;
@property (weak, nonatomic) IBOutlet UIButton *optionBtn;
@property (weak, nonatomic) IBOutlet MXCGrowingTextView *messageTextView;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *messageTextViewTopConstraint;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *messageTextViewBottomConstraint;
@property (weak, nonatomic) IBOutlet UIButton *sendBtn;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *messagesTableViewBottomConstraint;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *controlViewBottomConstraint;
@ -313,6 +315,8 @@ NSString *const kCmdResetUserPowerLevel = @"/deop";
}];
self.messageTextView.delegate = self;
// Retrieve the potential message partially typed during last room display
self.messageTextView.text = [mxHandler partialTextMessageForRoomId:self.roomId];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onKeyboardWillShow:) name:UIKeyboardWillShowNotification object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onKeyboardWillHide:) name:UIKeyboardWillHideNotification object:nil];
@ -322,6 +326,8 @@ NSString *const kCmdResetUserPowerLevel = @"/deop";
- (void)viewWillDisappear:(BOOL)animated {
[super viewWillDisappear:animated];
MatrixSDKHandler *mxHandler = [MatrixSDKHandler sharedHandler];
// hide action
if (self.actionMenu) {
[self.actionMenu dismiss:NO];
@ -335,6 +341,8 @@ NSString *const kCmdResetUserPowerLevel = @"/deop";
[self hideRoomMembers];
self.messageTextView.delegate = nil;
// Store the potential message partially typed in text input
[mxHandler storePartialTextMessage:self.messageTextView.text forRoomId:self.roomId];
// slide to hide keyboard management
if (isKeyboardObserver) {
@ -346,7 +354,6 @@ NSString *const kCmdResetUserPowerLevel = @"/deop";
[self dismissAttachmentImageViews];
if (membersListener) {
MatrixSDKHandler *mxHandler = [MatrixSDKHandler sharedHandler];
[mxHandler.mxSession removeListener:membersListener];
membersListener = nil;
}
@ -2168,18 +2175,18 @@ NSString *const kCmdResetUserPowerLevel = @"/deop";
- (void)growingTextView:(HPGrowingTextView *)growingTextView willChangeHeight:(float)height {
// margins between _messageTextView and its superview (controlView)
CGFloat controlViewHeight = height + self.controlView.frame.size.height - _messageTextView.frame.size.height;
CGFloat controlViewUpdatedHeight = height + _messageTextViewTopConstraint.constant + _messageTextViewBottomConstraint.constant;
// update the controlView height
_controlViewHeightConstraint.constant = controlViewHeight;
_controlViewHeightConstraint.constant = controlViewUpdatedHeight;
UIEdgeInsets insets = self.messagesTableView.contentInset;
// if the keyboard is not displayed
if (!isKeyboardDisplayed) {
insets.bottom = [AppDelegate theDelegate].masterTabBarController.tabBar.frame.size.height + controlViewHeight - defaultMessagesTableViewBottomConstraint;
insets.bottom = [AppDelegate theDelegate].masterTabBarController.tabBar.frame.size.height + controlViewUpdatedHeight - defaultMessagesTableViewBottomConstraint;
} else {
insets.bottom = keyboardHeight + controlViewHeight - defaultMessagesTableViewBottomConstraint;
insets.bottom = keyboardHeight + controlViewUpdatedHeight - defaultMessagesTableViewBottomConstraint;
}
self.messagesTableView.contentInset = insets;