Commit 636f2e01 authored by Dominic Vedericho's avatar Dominic Vedericho
Browse files

Merge branch 'release/0.2.4'

parents 41be5f10 b969f859
......@@ -16,7 +16,7 @@ Pod::Spec.new do |s|
#
s.name = "TapTalk"
s.version = "0.2.3"
s.version = "0.2.4"
s.summary = "Powerful Chat Engine"
# This description is used to generate tags and improve search results.
......@@ -78,7 +78,7 @@ Pod::Spec.new do |s|
#
# s.source = { :path => '.' }
s.source = { :git => 'git@git.moselo.com:taptalk/taptalk-ios.git', :tag => '0.2.3' }
s.source = { :git => 'git@git.moselo.com:taptalk/taptalk-ios.git', :tag => '0.2.4' }
# ――― Source Code ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
#
......
No preview for this file type
......@@ -155,45 +155,45 @@
if ([UIApplication sharedApplication].applicationState != UIApplicationStateActive) {
//Handling local push notification
if ([UNUserNotificationCenter class]) { //Check if UNUserNotifcation is supported
UNMutableNotificationContent *content = [[UNMutableNotificationContent alloc] init];
content.title = message.user.fullname;
NSString *messageText = message.body;
content.body = messageText;
content.sound = [UNNotificationSound soundNamed:NOTIFICATION_SOUND_NAME];
content.userInfo = message.toDictionary;
content.threadIdentifier = message.room.roomID;
content.summaryArgument = message.user.fullname;
// Deliver the notification after x second
UNTimeIntervalNotificationTrigger *trigger = [UNTimeIntervalNotificationTrigger
triggerWithTimeInterval:1.0f repeats:NO];
UNNotificationRequest *request = [UNNotificationRequest requestWithIdentifier:message.localID
content:content
trigger:trigger];
// Schedule the notification.
UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter];
[center addNotificationRequest:request withCompletionHandler:^(NSError * _Nullable error) {
}];
}
else {
//UserNotifcation.framework is not available below iOS 10
UILocalNotification *localNotification = [[UILocalNotification alloc] init];
NSDate *currentDate = [NSDate date];
NSTimeInterval currentTimeInterval = [currentDate timeIntervalSince1970];
currentTimeInterval += 1.0f; //Fire message with delay to avoid miss date
NSDate *updatedDate = [NSDate dateWithTimeIntervalSince1970:currentTimeInterval];
localNotification.fireDate = updatedDate;
localNotification.alertTitle = message.user.fullname;
NSString *messageText = message.body;
localNotification.alertBody = messageText;
localNotification.soundName = NOTIFICATION_SOUND_NAME;
localNotification.userInfo = [message toDictionary];
[[UIApplication sharedApplication] scheduleLocalNotification:localNotification];
}
// if ([UNUserNotificationCenter class]) { //Check if UNUserNotifcation is supported
// UNMutableNotificationContent *content = [[UNMutableNotificationContent alloc] init];
// content.title = message.user.fullname;
// NSString *messageText = message.body;
// content.body = messageText;
// content.sound = [UNNotificationSound soundNamed:NOTIFICATION_SOUND_NAME];
// content.userInfo = message.toDictionary;
// content.threadIdentifier = message.room.roomID;
// content.summaryArgument = message.user.fullname;
//
// // Deliver the notification after x second
// UNTimeIntervalNotificationTrigger *trigger = [UNTimeIntervalNotificationTrigger
// triggerWithTimeInterval:1.0f repeats:NO];
// UNNotificationRequest *request = [UNNotificationRequest requestWithIdentifier:message.localID
// content:content
// trigger:trigger];
//
// // Schedule the notification.
// UNUserNotificationCenter *center = [UNUserNotificationCenter currentNotificationCenter];
// [center addNotificationRequest:request withCompletionHandler:^(NSError * _Nullable error) {
//
// }];
// }
// else {
// //UserNotifcation.framework is not available below iOS 10
// UILocalNotification *localNotification = [[UILocalNotification alloc] init];
// NSDate *currentDate = [NSDate date];
// NSTimeInterval currentTimeInterval = [currentDate timeIntervalSince1970];
// currentTimeInterval += 1.0f; //Fire message with delay to avoid miss date
// NSDate *updatedDate = [NSDate dateWithTimeIntervalSince1970:currentTimeInterval];
// localNotification.fireDate = updatedDate;
// localNotification.alertTitle = message.user.fullname;
// NSString *messageText = message.body;
// localNotification.alertBody = messageText;
// localNotification.soundName = NOTIFICATION_SOUND_NAME;
// localNotification.userInfo = [message toDictionary];
//
// [[UIApplication sharedApplication] scheduleLocalNotification:localNotification];
// }
//Update message delivery status to API
[[TAPMessageStatusManager sharedManager] markMessageAsDeliveredFromPushNotificationWithMessage:message];
......@@ -248,46 +248,46 @@
- (void)removeReadLocalNotificationWithMessage:(TAPMessageModel *)message {
//Handling local push notification
if ([UNUserNotificationCenter class]) { //Check if UNUserNotifcation is supported
[[UNUserNotificationCenter currentNotificationCenter] getDeliveredNotificationsWithCompletionHandler:^(NSArray<UNNotification *> * _Nonnull notifications) {
for (NSInteger counter = 0; counter < [notifications count]; counter++) {
UNNotification *notification = [notifications objectAtIndex:counter];
NSString *identifier = notification.request.identifier;
NSDictionary *userInfoDictionary = notification.request.content.userInfo;
NSString *notificationRoomID = [userInfoDictionary valueForKeyPath:@"room.roomID"];
NSString *obtainedLocalID = message.localID;
NSString *obtainedRoomID = message.room.roomID;
if ([identifier isEqualToString:obtainedLocalID] && [notificationRoomID isEqualToString:obtainedRoomID]) {
//Cancelling local notification
[[UNUserNotificationCenter currentNotificationCenter]
removeDeliveredNotificationsWithIdentifiers:@[identifier]];
break;
}
}
}];
}
else {
//UserNotifcation.framework is not available below iOS 10
NSArray *localNotificationArray = [[UIApplication sharedApplication] scheduledLocalNotifications];
for (NSInteger counter = 0; counter < [localNotificationArray count]; counter++) {
UILocalNotification *selectedLocalNotification = [localNotificationArray objectAtIndex:counter];
NSDictionary *currentUserInfo = selectedLocalNotification.userInfo;
NSString *notificationLocalID = [currentUserInfo objectForKey:@"localID"];
NSString *notificationRoomID = [currentUserInfo valueForKeyPath:@"room.roomID"];
NSString *obtainedLocalID = message.localID;
NSString *obtainedRoomID = message.room.roomID;
if ([notificationLocalID isEqualToString:obtainedLocalID] && [notificationRoomID isEqualToString:obtainedRoomID]) {
//Cancelling local notification
[[UIApplication sharedApplication] cancelLocalNotification:selectedLocalNotification];
break;
}
}
}
// if ([UNUserNotificationCenter class]) { //Check if UNUserNotifcation is supported
// [[UNUserNotificationCenter currentNotificationCenter] getDeliveredNotificationsWithCompletionHandler:^(NSArray<UNNotification *> * _Nonnull notifications) {
//
// for (NSInteger counter = 0; counter < [notifications count]; counter++) {
// UNNotification *notification = [notifications objectAtIndex:counter];
// NSString *identifier = notification.request.identifier;
// NSDictionary *userInfoDictionary = notification.request.content.userInfo;
// NSString *notificationRoomID = [userInfoDictionary valueForKeyPath:@"room.roomID"];
//
// NSString *obtainedLocalID = message.localID;
// NSString *obtainedRoomID = message.room.roomID;
//
// if ([identifier isEqualToString:obtainedLocalID] && [notificationRoomID isEqualToString:obtainedRoomID]) {
// //Cancelling local notification
// [[UNUserNotificationCenter currentNotificationCenter]
// removeDeliveredNotificationsWithIdentifiers:@[identifier]];
// break;
// }
// }
// }];
// }
// else {
// //UserNotifcation.framework is not available below iOS 10
// NSArray *localNotificationArray = [[UIApplication sharedApplication] scheduledLocalNotifications];
// for (NSInteger counter = 0; counter < [localNotificationArray count]; counter++) {
// UILocalNotification *selectedLocalNotification = [localNotificationArray objectAtIndex:counter];
// NSDictionary *currentUserInfo = selectedLocalNotification.userInfo;
// NSString *notificationLocalID = [currentUserInfo objectForKey:@"localID"];
// NSString *notificationRoomID = [currentUserInfo valueForKeyPath:@"room.roomID"];
//
// NSString *obtainedLocalID = message.localID;
// NSString *obtainedRoomID = message.room.roomID;
//
// if ([notificationLocalID isEqualToString:obtainedLocalID] && [notificationRoomID isEqualToString:obtainedRoomID]) {
// //Cancelling local notification
// [[UIApplication sharedApplication] cancelLocalNotification:selectedLocalNotification];
// break;
// }
// }
// }
}
- (void)updateApplicationBadgeCount {
......
......@@ -1705,6 +1705,11 @@ typedef NS_ENUM(NSInteger, InputAccessoryExtensionType) {
if(self.currentInputAccessoryExtensionHeight > 0.0f) {
[self showInputAccessoryExtensionView:NO];
self.chatAnchorButtonBottomConstrait.constant = kChatAnchorDefaultBottomConstraint + self.keyboardHeight - kInputMessageAccessoryViewHeight;
CGFloat tableViewYContentInset = self.keyboardHeight - [TAPUtil safeAreaBottomPadding] - kInputMessageAccessoryViewHeight;
self.tableView.contentInset = UIEdgeInsetsMake(tableViewYContentInset, self.tableView.contentInset.left, self.tableView.contentInset.bottom, self.tableView.contentInset.right);
self.tableView.scrollIndicatorInsets = UIEdgeInsetsMake(tableViewYContentInset, self.tableView.scrollIndicatorInsets.left, self.tableView.scrollIndicatorInsets.bottom, self.tableView.scrollIndicatorInsets.right);
}
//hide empty chat
......@@ -2666,7 +2671,9 @@ typedef NS_ENUM(NSInteger, InputAccessoryExtensionType) {
}
- (void)applicationWillEnterForegroundNotification:(NSNotification *)notification {
[self callAPIAfterAndUpdateUIAndScrollToTop:YES];
if ([self.messageArray count] > 0) {
[self callAPIAfterAndUpdateUIAndScrollToTop:YES];
}
}
- (IBAction)chatAnchorButtonDidTapped:(id)sender {
......@@ -3068,7 +3075,6 @@ typedef NS_ENUM(NSInteger, InputAccessoryExtensionType) {
self.inputAccessoryExtensionHeightConstraint.constant = 0.0f;
}
[[TAPChatManager sharedManager] removeQuotedMessageObjectWithRoomID:self.currentRoom.roomID];
}
}
......@@ -3102,6 +3108,7 @@ typedef NS_ENUM(NSInteger, InputAccessoryExtensionType) {
- (IBAction)inputAccessoryExtensionCloseButtonDidTapped:(id)sender {
[self showInputAccessoryExtensionView:NO];
[[TAPChatManager sharedManager] removeQuotedMessageObjectWithRoomID:self.currentRoom.roomID];
}
- (void)showImagePreviewControllerWithSelectedImage:(UIImage *)image {
......@@ -3142,7 +3149,8 @@ typedef NS_ENUM(NSInteger, InputAccessoryExtensionType) {
CGFloat total = [totalString floatValue];
TAPMessageModel *currentMessage = [self.messageDictionary objectForKey:localID];
NSInteger currentRowIndex = [self.messageArray indexOfObject:currentMessage];
NSArray *messageArray = [self.messageArray copy];
NSInteger currentRowIndex = [messageArray indexOfObject:currentMessage];
TAPChatMessageType type = currentMessage.type;
if (type == TAPChatMessageTypeImage) {
......@@ -3171,7 +3179,8 @@ typedef NS_ENUM(NSInteger, InputAccessoryExtensionType) {
localID = [TAPUtil nullToEmptyString:localID];
TAPMessageModel *currentMessage = [self.messageDictionary objectForKey:localID];
NSInteger currentRowIndex = [self.messageArray indexOfObject:currentMessage];
NSArray *messageArray = [self.messageArray copy];
NSInteger currentRowIndex = [messageArray indexOfObject:currentMessage];
TAPChatMessageType type = currentMessage.type;
if (type == TAPChatMessageTypeImage) {
......@@ -3202,7 +3211,8 @@ typedef NS_ENUM(NSInteger, InputAccessoryExtensionType) {
localID = [TAPUtil nullToEmptyString:localID];
TAPMessageModel *currentMessage = [self.messageDictionary objectForKey:localID];
NSInteger currentRowIndex = [self.messageArray indexOfObject:currentMessage];
NSArray *messageArray = [self.messageArray copy];
NSInteger currentRowIndex = [messageArray indexOfObject:currentMessage];
TAPChatMessageType type = currentMessage.type;
if (type == TAPChatMessageTypeImage) {
......@@ -3232,7 +3242,8 @@ typedef NS_ENUM(NSInteger, InputAccessoryExtensionType) {
localID = [TAPUtil nullToEmptyString:localID];
TAPMessageModel *currentMessage = [self.messageDictionary objectForKey:localID];
NSInteger currentRowIndex = [self.messageArray indexOfObject:currentMessage];
NSArray *messageArray = [self.messageArray copy];
NSInteger currentRowIndex = [messageArray indexOfObject:currentMessage];
//Update message status to array and dictionary
currentMessage.isFailedSend = YES;
......@@ -3265,7 +3276,8 @@ typedef NS_ENUM(NSInteger, InputAccessoryExtensionType) {
}
TAPMessageModel *currentMessage = [self.messageDictionary objectForKey:localID];
NSInteger currentRowIndex = [self.messageArray indexOfObject:currentMessage];
NSArray *messageArray = [self.messageArray copy];
NSInteger currentRowIndex = [messageArray indexOfObject:currentMessage];
TAPChatMessageType type = currentMessage.type;
if (type == TAPChatMessageTypeImage) {
......@@ -3305,7 +3317,8 @@ typedef NS_ENUM(NSInteger, InputAccessoryExtensionType) {
}
TAPMessageModel *currentMessage = [self.messageDictionary objectForKey:localID];
NSInteger currentRowIndex = [self.messageArray indexOfObject:currentMessage];
NSArray *messageArray = [self.messageArray copy];
NSInteger currentRowIndex = [messageArray indexOfObject:currentMessage];
TAPChatMessageType type = currentMessage.type;
if (type == TAPChatMessageTypeImage) {
......@@ -3339,7 +3352,8 @@ typedef NS_ENUM(NSInteger, InputAccessoryExtensionType) {
}
TAPMessageModel *currentMessage = [self.messageDictionary objectForKey:localID];
NSInteger currentRowIndex = [self.messageArray indexOfObject:currentMessage];
NSArray *messageArray = [self.messageArray copy];
NSInteger currentRowIndex = [messageArray indexOfObject:currentMessage];
TAPChatMessageType type = currentMessage.type;
if (type == TAPChatMessageTypeImage) {
......@@ -3378,7 +3392,8 @@ typedef NS_ENUM(NSInteger, InputAccessoryExtensionType) {
}
TAPMessageModel *currentMessage = [self.messageDictionary objectForKey:localID];
NSInteger currentRowIndex = [self.messageArray indexOfObject:currentMessage];
NSArray *messageArray = [self.messageArray copy];
NSInteger currentRowIndex = [messageArray indexOfObject:currentMessage];
TAPChatMessageType type = currentMessage.type;
if (type == TAPChatMessageTypeImage) {
......@@ -3430,8 +3445,8 @@ typedef NS_ENUM(NSInteger, InputAccessoryExtensionType) {
// }
//
// TAPMessageModel *currentMessage = [self.messageDictionary objectForKey:localID];
// NSInteger currentRowIndex = [self.messageArray indexOfObject:currentMessage];
//
//NSArray *messageArray = [self.messageArray copy];
//NSInteger currentRowIndex = [messageArray indexOfObject:currentMessage];//
// TAPChatMessageType type = currentMessage.type;
// if (type == TAPChatMessageTypeImage) {
//
......@@ -3464,8 +3479,8 @@ typedef NS_ENUM(NSInteger, InputAccessoryExtensionType) {
// }
//
// TAPMessageModel *currentMessage = [self.messageDictionary objectForKey:localID];
// NSInteger currentRowIndex = [self.messageArray indexOfObject:currentMessage];
//
//NSArray *messageArray = [self.messageArray copy];
//NSInteger currentRowIndex = [messageArray indexOfObject:currentMessage];//
// TAPChatMessageType type = currentMessage.type;
// if (type == TAPChatMessageTypeImage) {
// if ([message.user.userID isEqualToString:[TAPChatManager sharedManager].activeUser.userID]) {
......@@ -3503,8 +3518,8 @@ typedef NS_ENUM(NSInteger, InputAccessoryExtensionType) {
// }
//
// TAPMessageModel *currentMessage = [self.messageDictionary objectForKey:localID];
// NSInteger currentRowIndex = [self.messageArray indexOfObject:currentMessage];
//
//NSArray *messageArray = [self.messageArray copy];
//NSInteger currentRowIndex = [messageArray indexOfObject:currentMessage];//
// TAPChatMessageType type = currentMessage.type;
// if (type == TAPChatMessageTypeImage) {
// if ([message.user.userID isEqualToString:[TAPChatManager sharedManager].activeUser.userID]) {
......
......@@ -359,12 +359,10 @@
if (![trimmedNewString isEqualToString:@""]) {
self.updatedString = newString;
self.updatedString = newString;
NSString *trimmedString = [self.updatedString stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
[TAPDataManager searchMessageWithString:trimmedString sortBy:@"created" success:^(NSArray *resultArray) {
self.searchResultMessageArray = [resultArray mutableCopy];
[TAPDataManager searchChatAndContactWithString:trimmedString SortBy:@"roomName" success:^(NSArray *roomArray, NSArray *unreadCountArray) {
self.searchResultMessageArray = [resultArray mutableCopy];
self.searchResultChatAndContactArray = [roomArray mutableCopy];
self.searchResultUnreadCountArray = [unreadCountArray mutableCopy];
......
......@@ -46,13 +46,13 @@
_profilePictureImage = [[TAPImageView alloc] initWithFrame:CGRectMake(8.0f, (CGRectGetHeight(self.contentView.frame) - 52.0f) / 2.0f, 52.0f, 52.0f)];
self.profilePictureImage.layer.cornerRadius = CGRectGetHeight(self.profilePictureImage.frame)/2.0f;
self.profilePictureImage.clipsToBounds = YES;
self.profilePictureImage.contentMode = UIViewContentModeScaleAspectFit;
self.profilePictureImage.contentMode = UIViewContentModeScaleAspectFill;
[self.contentView addSubview:self.profilePictureImage];
_contentImageView = [[TAPImageView alloc] initWithFrame:CGRectMake(CGRectGetWidth(self.contentView.frame) - 52.0f - 8.0f, (CGRectGetHeight(self.contentView.frame) - 52.0f) / 2.0f, 52.0f, 52.0f)];
self.contentImageView.layer.cornerRadius = 6.0f;
self.contentImageView.clipsToBounds = YES;
self.contentImageView.contentMode = UIViewContentModeScaleAspectFit;
self.contentImageView.contentMode = UIViewContentModeScaleAspectFill;
[self.contentView addSubview:self.contentImageView];
CGFloat profilePictureImageRightGap = 8.0f;
......@@ -98,13 +98,13 @@
_secondaryProfilePictureImage = [[TAPImageView alloc] initWithFrame:CGRectMake(8.0f, (CGRectGetHeight(self.contentView.frame) - 52.0f) / 2.0f, 52.0f, 52.0f)];
self.secondaryProfilePictureImage.layer.cornerRadius = CGRectGetHeight(self.profilePictureImage.frame)/2.0f;
self.secondaryProfilePictureImage.clipsToBounds = YES;
self.secondaryProfilePictureImage.contentMode = UIViewContentModeScaleAspectFit;
self.secondaryProfilePictureImage.contentMode = UIViewContentModeScaleAspectFill;
[self.secondaryContentView addSubview:self.secondaryProfilePictureImage];
_secondaryContentImageView = [[TAPImageView alloc] initWithFrame:CGRectMake(CGRectGetWidth(self.secondaryContentView.frame) - 52.0f - 8.0f, (CGRectGetHeight(self.contentView.frame) - 52.0f) / 2.0f, 52.0f, 52.0f)];
self.secondaryContentImageView.layer.cornerRadius = 6.0f;
self.secondaryContentImageView.clipsToBounds = YES;
self.secondaryContentImageView.contentMode = UIViewContentModeScaleAspectFit;
self.secondaryContentImageView.contentMode = UIViewContentModeScaleAspectFill;
[self.secondaryContentView addSubview:self.secondaryContentImageView];
_secondaryNameLabel = [[UILabel alloc] initWithFrame:CGRectMake(CGRectGetMaxX(self.secondaryProfilePictureImage.frame) + profilePictureImageRightGap, 15.0f, nameLabelWidth, 18.0f)];
......
......@@ -118,7 +118,7 @@
self.currentUserImageView.layer.borderColor = [UIColor whiteColor].CGColor;
self.currentUserImageView.layer.borderWidth = 4.0f;
self.currentUserImageView.clipsToBounds = YES;
self.currentUserImageView.contentMode = UIViewContentModeScaleAspectFit;
self.currentUserImageView.contentMode = UIViewContentModeScaleAspectFill;
self.currentUserImageView.alpha = 0.0f;
[self.whiteBaseView addSubview:self.currentUserImageView];
......@@ -127,7 +127,7 @@
self.addedUserImageView.layer.borderColor = [UIColor whiteColor].CGColor;
self.addedUserImageView.layer.borderWidth = 4.0f;
self.addedUserImageView.clipsToBounds = YES;
self.addedUserImageView.contentMode = UIViewContentModeScaleAspectFit;
self.addedUserImageView.contentMode = UIViewContentModeScaleAspectFill;
[self.whiteBaseView addSubview:self.addedUserImageView];
_addedUserUsernameLabel = [[UILabel alloc] initWithFrame:CGRectMake(24.0f, CGRectGetMaxY(self.addedUserImageView.frame) + self.profilePictureBottomGap, CGRectGetWidth(self.whiteBaseView.frame) - 24.0f - 24.0f, 22.0f)];
......
......@@ -23,7 +23,7 @@
if (self) {
_imageView = [[TAPImageView alloc] initWithFrame:CGRectMake(0.0f, 0.0f, CGRectGetWidth(frame), CGRectGetHeight(frame))];
self.imageView.clipsToBounds = YES;
self.imageView.contentMode = UIViewContentModeScaleAspectFit;
self.imageView.contentMode = UIViewContentModeScaleAspectFill;
[self.contentView addSubview:self.imageView];
}
......
......@@ -22,7 +22,7 @@
if (self) {
_selectedPictureImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0.0f, 0.0f, CGRectGetWidth(self.contentView.frame), CGRectGetHeight(self.contentView.frame))];
self.selectedPictureImageView.contentMode = UIViewContentModeScaleAspectFit;
self.selectedPictureImageView.contentMode = UIViewContentModeScaleAspectFill;
self.selectedPictureImageView.clipsToBounds = YES;
[self.contentView addSubview:self.selectedPictureImageView];
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment