Commit f87acd28 authored by Dominic Vedericho's avatar Dominic Vedericho
Browse files

update version 1.0.20, handle emit user update, changing App-Version to...

update version 1.0.20, handle emit user update, changing App-Version to SDK-Version in network header
parent 75f6c43b
......@@ -7,15 +7,15 @@
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForAnalyzing = "YES"
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES">
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "ECEFF4DE87169A8335FFBC8B46312B9E"
BuildableName = "Pods-TapTalk.framework"
BuildableName = "Pods_TapTalk.framework"
BlueprintName = "Pods-TapTalk"
ReferencedContainer = "container:Pods.xcodeproj">
</BuildableReference>
......@@ -23,14 +23,15 @@
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
buildConfiguration = "Debug">
<AdditionalOptions>
</AdditionalOptions>
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
......@@ -38,17 +39,14 @@
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
buildConfiguration = "Debug"
allowLocationSimulation = "YES">
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES"
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES">
debugDocumentVersioning = "YES">
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
......
......@@ -8,56 +8,78 @@
<dict>
<key>isShown</key>
<false/>
<key>orderHint</key>
<integer>0</integer>
</dict>
<key>GoogleMaps.xcscheme</key>
<dict>
<key>isShown</key>
<false/>
<key>orderHint</key>
<integer>1</integer>
</dict>
<key>GooglePlacePicker.xcscheme</key>
<dict>
<key>isShown</key>
<false/>
<key>orderHint</key>
<integer>2</integer>
</dict>
<key>GooglePlaces.xcscheme</key>
<dict>
<key>isShown</key>
<false/>
<key>orderHint</key>
<integer>3</integer>
</dict>
<key>JSONModel.xcscheme</key>
<dict>
<key>isShown</key>
<false/>
<key>orderHint</key>
<integer>4</integer>
</dict>
<key>PodAsset.xcscheme</key>
<dict>
<key>isShown</key>
<false/>
<key>orderHint</key>
<integer>5</integer>
</dict>
<key>Pods-TapTalk.xcscheme</key>
<dict>
<key>isShown</key>
<false/>
<key>orderHint</key>
<integer>6</integer>
</dict>
<key>Realm.xcscheme</key>
<dict>
<key>isShown</key>
<false/>
<key>orderHint</key>
<integer>7</integer>
</dict>
<key>SDWebImage.xcscheme</key>
<dict>
<key>isShown</key>
<false/>
<key>orderHint</key>
<integer>8</integer>
</dict>
<key>SocketRocket.xcscheme</key>
<dict>
<key>isShown</key>
<false/>
<key>orderHint</key>
<integer>9</integer>
</dict>
<key>ZSWTappableLabel.xcscheme</key>
<dict>
<key>isShown</key>
<false/>
<key>orderHint</key>
<integer>10</integer>
</dict>
</dict>
<key>SuppressBuildableAutocreation</key>
......
......@@ -3,7 +3,7 @@ Pod::Spec.new do |s|
# ――― Spec Metadata ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
s.name = "TapTalk"
s.version = "1.0.18"
s.version = "1.0.20"
s.summary = "TapTalk.io is a complete in-app chat SDK and messaging API. Its in-app chat feature give you and your user the best in-app chat experience, it provides you with UI Based implementation and code based implementation and fully customizable."
s.homepage = "https://taptalk.io"
......
......@@ -2142,7 +2142,7 @@
"@executable_path/Frameworks",
"@loader_path/Frameworks",
);
MARKETING_VERSION = 1.0.17;
MARKETING_VERSION = 1.0.20;
PRODUCT_BUNDLE_IDENTIFIER = io.TapTalk.TapTalk;
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
SKIP_INSTALL = YES;
......@@ -2176,7 +2176,7 @@
"@executable_path/Frameworks",
"@loader_path/Frameworks",
);
MARKETING_VERSION = 1.0.17;
MARKETING_VERSION = 1.0.20;
PRODUCT_BUNDLE_IDENTIFIER = io.TapTalk.TapTalk;
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
SKIP_INSTALL = YES;
......
No preview for this file type
......@@ -460,7 +460,7 @@
TAPMessageModel *quotedMessage = (TAPMessageModel *)quotedMessageObject;
quotedMessage = [quotedMessage copy];
if ([quotedMessage.quote.fileType isEqualToString:[NSString stringWithFormat: @"%ld", TAPChatMessageTypeFile]]) {
if ([quotedMessage.quote.fileType isEqualToString:[NSString stringWithFormat: @"%ld", TAPChatMessageTypeFile]] || [quotedMessage.quote.fileType isEqualToString:@"file"]) {
//TYPE FILE
message.quote = quotedMessage.quote;
}
......@@ -762,7 +762,7 @@
//if message quoted from message model then should construct quote and reply to model
TAPMessageModel *quotedMessage = (TAPMessageModel *)quotedMessageObject;
quotedMessage = [quotedMessage copy];
if ([quotedMessage.quote.fileType isEqualToString:[NSString stringWithFormat: @"%ld", TAPChatMessageTypeFile]]) {
if ([quotedMessage.quote.fileType isEqualToString:[NSString stringWithFormat: @"%ld", TAPChatMessageTypeFile]] || [quotedMessage.quote.fileType isEqualToString:@"file"]) {
//TYPE FILE
message.quote = quotedMessage.quote;
}
......@@ -854,7 +854,7 @@
//if message quoted from message model then should construct quote and reply to model
TAPMessageModel *quotedMessage = (TAPMessageModel *)quotedMessageObject;
quotedMessage = [quotedMessage copy];
if ([quotedMessage.quote.fileType isEqualToString:[NSString stringWithFormat: @"%ld", TAPChatMessageTypeFile]]) {
if ([quotedMessage.quote.fileType isEqualToString:[NSString stringWithFormat: @"%ld", TAPChatMessageTypeFile]] || [quotedMessage.quote.fileType isEqualToString:@"file"]) {
//TYPE FILE
message.quote = quotedMessage.quote;
}
......@@ -1015,7 +1015,7 @@
TAPMessageModel *decryptedMessage = [TAPEncryptorManager decryptToMessageModelFromDictionary:dataDictionary];
//Add User to Contact Manager
[[TAPContactManager sharedManager] addContactWithUserModel:decryptedMessage.user saveToDatabase:NO];
[[TAPContactManager sharedManager] addContactWithUserModel:decryptedMessage.user saveToDatabase:YES];
decryptedMessage.isSending = NO;
......
......@@ -68,6 +68,12 @@
TAPUserModel *activeUser = [TAPDataManager getActiveUser];
if(user.userID != activeUser.userID && user.userID != nil) {
//if user != self set to Dictionary
TAPUserModel *currentSavedUser = [self.contactUserDictionary objectForKey:user.userID];
if ([user.updated longValue] < [currentSavedUser.updated longValue]) {
return;
}
[self.contactUserDictionary setObject:user forKey:user.userID];
[self.phoneUserDictionary setObject:user forKey:user.phoneWithCode];
......@@ -81,6 +87,17 @@
}];
}
}
else {
//update active user data
if (user.userID != nil) {
TAPUserModel *currentSavedUser = [self.contactUserDictionary objectForKey:user.userID];
if ([user.updated longValue] < [currentSavedUser.updated longValue]) {
return;
}
[TAPDataManager setActiveUser:user];
}
}
}
- (void)addContactWithUserArray:(NSArray <TAPUserModel *> *)userArray saveToDatabase:(BOOL)save {
......@@ -95,6 +112,12 @@
TAPUserModel *activeUser = [TAPDataManager getActiveUser];
if(user.userID != activeUser.userID && user.userID != nil) {
//if user != self set to Dictionary
TAPUserModel *currentSavedUser = [self.contactUserDictionary objectForKey:user.userID];
if ([user.updated longValue] < [currentSavedUser.updated longValue]) {
return;
}
[self.contactUserDictionary setObject:user forKey:user.userID];
[self.phoneUserDictionary setObject:user forKey:user.phoneWithCode];
......@@ -102,6 +125,17 @@
[userDataArray addObject:user];
}
}
else {
//update active user data
if (user.userID != nil) {
TAPUserModel *currentSavedUser = [self.contactUserDictionary objectForKey:user.userID];
if ([user.updated longValue] < [currentSavedUser.updated longValue]) {
return;
}
[TAPDataManager setActiveUser:user];
}
}
}
if(save) {
......
......@@ -102,7 +102,9 @@
success(generatedRoom);
}
- (void)getGroupChatRoomWithGroupRoomID:(NSString *)groupRoomID success:(void (^)(TAPRoomModel *room))success failure:(void (^)(NSError *error))failure {
- (void)getGroupChatRoomWithGroupRoomID:(NSString *)groupRoomID
success:(void (^)(TAPRoomModel *room))success
failure:(void (^)(NSError *error))failure {
TAPRoomModel *obtainedRoom = [[TAPGroupManager sharedManager] getRoomWithRoomID:groupRoomID];
if (obtainedRoom == nil) {
[TAPDataManager callAPIGetRoomWithRoomID:groupRoomID success:^(TAPRoomModel *room) {
......
......@@ -73,7 +73,7 @@ static const NSInteger kAPITimeOut = 60;
[manager.requestSerializer setValue:[[UIDevice currentDevice] model] forHTTPHeaderField:@"Device-Model"];
[manager.requestSerializer setValue:@"ios" forHTTPHeaderField:@"Device-Platform"];
[manager.requestSerializer setValue:[[UIDevice currentDevice] systemVersion] forHTTPHeaderField:@"Device-OS-Version"];
[manager.requestSerializer setValue:[[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"] forHTTPHeaderField:@"App-Version"];
[manager.requestSerializer setValue:[[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"] forHTTPHeaderField:@"SDK-Version"];
[manager.requestSerializer setValue:@"ios" forHTTPHeaderField:@"User-Agent"];
[manager.requestSerializer setTimeoutInterval:kAPITimeOut];
......
......@@ -91,9 +91,60 @@
[self.profileView.navigationEditButton addTarget:self action:@selector(editButtonDidTapped) forControlEvents:UIControlEventTouchUpInside];
[self.profileView.editButton addTarget:self action:@selector(editButtonDidTapped) forControlEvents:UIControlEventTouchUpInside];
NSString *profileImageURL = self.room.imageURL.fullsize;
NSString *profileImageURL = @"";
NSString *roomName = @"";
if (self.room.type == RoomTypePersonal) {
NSString *otherUserID = [[TAPChatManager sharedManager] getOtherUserIDWithRoomID:self.room.roomID];
TAPUserModel *obtainedUser = [[TAPContactManager sharedManager] getUserWithUserID:otherUserID];
if([self.room.deleted longValue] != 0) {
profileImageURL = @"";
}
if (obtainedUser != nil && ![obtainedUser.imageURL.thumbnail isEqualToString:@""]) {
profileImageURL = obtainedUser.imageURL.fullsize;
profileImageURL = [TAPUtil nullToEmptyString:profileImageURL];
}
else {
profileImageURL = self.room.imageURL.fullsize;
profileImageURL = [TAPUtil nullToEmptyString:profileImageURL];
}
if (obtainedUser != nil && obtainedUser.fullname != nil && [self.room.deleted longValue] == 0) {
roomName = obtainedUser.fullname;
roomName = [TAPUtil nullToEmptyString:roomName];
}
else {
roomName = self.room.name;
roomName = [TAPUtil nullToEmptyString:roomName];
}
}
else if (self.room.type == RoomTypeGroup) {
TAPRoomModel *obtainedRoom = [[TAPGroupManager sharedManager] getRoomWithRoomID:self.room.roomID];
NSString *groupProfileImageURL = obtainedRoom.imageURL.fullsize;
groupProfileImageURL = [TAPUtil nullToEmptyString:groupProfileImageURL];
NSString *groupRoomName = obtainedRoom.name;
groupRoomName = [TAPUtil nullToEmptyString:groupRoomName];
if ([groupProfileImageURL isEqualToString:@""]) {
profileImageURL = self.room.imageURL.fullsize;
profileImageURL = [TAPUtil nullToEmptyString:profileImageURL];
}
else {
profileImageURL = groupProfileImageURL;
profileImageURL = [TAPUtil nullToEmptyString:profileImageURL];
}
if ([groupRoomName isEqualToString:@""]) {
roomName = self.room.name;
roomName = [TAPUtil nullToEmptyString:roomName];
}
else {
roomName = groupRoomName;
roomName = [TAPUtil nullToEmptyString:roomName];
}
}
if (profileImageURL == nil || [profileImageURL isEqualToString:@""]) {
if (self.room.type == RoomTypePersonal) {
//Personal
......@@ -108,8 +159,8 @@
[self.profileView.profileImageView setImageWithURLString:profileImageURL];
}
self.profileView.nameLabel.text = self.room.name;
self.profileView.navigationNameLabel.text = self.room.name;
self.profileView.nameLabel.text = roomName;
self.profileView.navigationNameLabel.text = roomName;
if (self.tapProfileViewControllerType == TAPProfileViewControllerTypeDefault) {
if (self.room.type == RoomTypePersonal) {
......
......@@ -55,6 +55,7 @@
- (void)openNewChatViewController;
- (void)hideSetupViewWithDelay:(double)delayTime;
- (void)getAndUpdateNumberOfUnreadToDelegate;
- (void)checkUpdatedUserProfileWithMessage:(TAPMessageModel *)message;
@end
......@@ -994,6 +995,11 @@
- (void)processMessageFromSocket:(TAPMessageModel *)message isNewMessage:(BOOL)isNewMessage {
NSString *messageRoomID = message.room.roomID;
//Check need to update user data or not
if (message.type == TAPChatMessageTypeSystemMessage && ([message.action isEqualToString:@"user/update"] || [message.action isEqualToString:@"room/update"])) {
[self checkUpdatedUserProfileWithMessage:message];
}
TAPRoomListModel *roomList = [self.roomListDictionary objectForKey:messageRoomID];
if (roomList != nil) {
......@@ -1161,4 +1167,12 @@
});
}
- (void)checkUpdatedUserProfileWithMessage:(TAPMessageModel *)message {
NSString *roomID = message.room.roomID;
TAPRoomListModel *roomList = [self.roomListDictionary objectForKey:roomID];
NSInteger cellRow = [self.roomListArray indexOfObject:roomList];
NSIndexPath *cellIndexPath = [NSIndexPath indexPathForRow:cellRow inSection:0];
[self updateCellDataAtIndexPath:cellIndexPath updateUnreadBubble:NO];
}
@end
......@@ -541,7 +541,7 @@
- (void)setQuote:(TAPQuoteModel *)quote userID:(NSString *)userID {
if ([quote.fileType isEqualToString:[NSString stringWithFormat:@"%ld", TAPChatMessageTypeFile]]) {
if ([quote.fileType isEqualToString:[NSString stringWithFormat:@"%ld", TAPChatMessageTypeFile]] || [quote.fileType isEqualToString:@"file"]) {
//TYPE FILE
self.fileImageView.alpha = 1.0f;
self.quoteImageView.alpha = 0.0f;
......
......@@ -622,7 +622,7 @@
}
- (void)setQuote:(TAPQuoteModel *)quote userID:(NSString *)userID {
if ([quote.fileType isEqualToString:[NSString stringWithFormat:@"%ld", TAPChatMessageTypeFile]]) {
if ([quote.fileType isEqualToString:[NSString stringWithFormat:@"%ld", TAPChatMessageTypeFile]] || [quote.fileType isEqualToString:@"file"]) {
//TYPE FILE
self.fileImageView.alpha = 1.0f;
self.quoteImageView.alpha = 0.0f;
......
......@@ -1164,7 +1164,7 @@
- (void)setQuote:(TAPQuoteModel *)quote userID:(NSString *)userID {
if ([quote.fileType isEqualToString:[NSString stringWithFormat:@"%ld", TAPChatMessageTypeFile]]) {
if ([quote.fileType isEqualToString:[NSString stringWithFormat:@"%ld", TAPChatMessageTypeFile]] || [quote.fileType isEqualToString:@"file"]) {
//TYPE FILE
self.fileImageView.alpha = 1.0f;
self.quoteImageView.alpha = 0.0f;
......
......@@ -586,7 +586,7 @@
}
- (void)setQuote:(TAPQuoteModel *)quote userID:(NSString *)userID {
if ([quote.fileType isEqualToString:[NSString stringWithFormat:@"%ld", TAPChatMessageTypeFile]]) {
if ([quote.fileType isEqualToString:[NSString stringWithFormat:@"%ld", TAPChatMessageTypeFile]] || [quote.fileType isEqualToString:@"file"]) {
//TYPE FILE
self.fileImageView.alpha = 1.0f;
self.quoteImageView.alpha = 0.0f;
......
......@@ -185,11 +185,6 @@
BOOL isGroup = NO;
NSString *lastSender = @"";
NSString *profileImageURL = message.room.imageURL.thumbnail;
if ([[TAPGroupManager sharedManager] getRoomWithRoomID:message.room.roomID]) {
TAPRoomModel *room = [[TAPGroupManager sharedManager] getRoomWithRoomID:message.room.roomID];
profileImageURL = room.imageURL.thumbnail;
}
NSInteger numberOfUnreadMessage = roomList.numberOfUnreadMessages;
TAPRoomModel *currentRoom = message.room;
......@@ -199,6 +194,59 @@
isGroup = YES;
}
NSString *profileImageURL = @"";
NSString *roomName = @"";
if (message.room.type == RoomTypePersonal) {
NSString *otherUserID = [[TAPChatManager sharedManager] getOtherUserIDWithRoomID:currentRoom.roomID];
TAPUserModel *obtainedUser = [[TAPContactManager sharedManager] getUserWithUserID:otherUserID];
if([message.room.deleted longValue] != 0) {
profileImageURL = @"";
}
else if (obtainedUser != nil && ![obtainedUser.imageURL.thumbnail isEqualToString:@""]) {
profileImageURL = obtainedUser.imageURL.thumbnail;
profileImageURL = [TAPUtil nullToEmptyString:profileImageURL];
}
else {
profileImageURL = message.room.imageURL.thumbnail;
profileImageURL = [TAPUtil nullToEmptyString:profileImageURL];
}
if (obtainedUser != nil && obtainedUser.fullname != nil && [message.room.deleted longValue] == 0) {
roomName = obtainedUser.fullname;
roomName = [TAPUtil nullToEmptyString:roomName];
}
else {
roomName = message.room.name;
roomName = [TAPUtil nullToEmptyString:roomName];
}
}
else if (message.room.type == RoomTypeGroup) {
TAPRoomModel *obtainedRoom = [[TAPGroupManager sharedManager] getRoomWithRoomID:message.room.roomID];
NSString *groupProfileImageURL = obtainedRoom.imageURL.thumbnail;
groupProfileImageURL = [TAPUtil nullToEmptyString:groupProfileImageURL];
NSString *groupRoomName = obtainedRoom.name;
groupRoomName = [TAPUtil nullToEmptyString:groupRoomName];
if ([groupProfileImageURL isEqualToString:@""]) {
profileImageURL = message.room.imageURL.thumbnail;
profileImageURL = [TAPUtil nullToEmptyString:profileImageURL];
}
else {
profileImageURL = groupProfileImageURL;
profileImageURL = [TAPUtil nullToEmptyString:profileImageURL];
}
if ([groupRoomName isEqualToString:@""]) {
roomName = message.room.name;
roomName = [TAPUtil nullToEmptyString:roomName];
}
else {
roomName = groupRoomName;
roomName = [TAPUtil nullToEmptyString:roomName];
}
}
if (isGroup) {
TAPUserModel *currentActiveUser = [TAPDataManager getActiveUser];
if ([currentActiveUser.userID isEqualToString:message.user.userID]) {
......@@ -209,9 +257,6 @@
}
}
NSString *roomName = currentRoom.name;
roomName = [TAPUtil nullToEmptyString:roomName];
NSTimeInterval lastMessageTimeInterval = [message.created doubleValue] / 1000.0f; //change to second from milisecond
NSDate *lastMessageDate = [NSDate dateWithTimeIntervalSince1970:lastMessageTimeInterval];
......
......@@ -127,15 +127,62 @@
if (room.type == RoomTypeGroup || room.type == RoomTypeChannel) {
isGroup = YES;
}
NSString *profileImageURL = room.imageURL.fullsize;
NSString *profileImageURL = @"";
NSString *roomName = @"";
if (room.type == RoomTypePersonal) {
NSString *otherUserID = [[TAPChatManager sharedManager] getOtherUserIDWithRoomID:room.roomID];
TAPUserModel *obtainedUser = [[TAPContactManager sharedManager] getUserWithUserID:otherUserID];
if([room.deleted longValue] != 0) {
profileImageURL = @"";
}
else if (obtainedUser != nil && ![obtainedUser.imageURL.thumbnail isEqualToString:@""]) {
profileImageURL = obtainedUser.imageURL.thumbnail;
profileImageURL = [TAPUtil nullToEmptyString:profileImageURL];
}
else {
profileImageURL = room.imageURL.thumbnail;
profileImageURL = [TAPUtil nullToEmptyString:profileImageURL];
}
if (obtainedUser != nil && obtainedUser.fullname != nil && [room.deleted longValue] == 0) {
roomName = obtainedUser.fullname;
roomName = [TAPUtil nullToEmptyString:roomName];
}
else {
roomName = room.name;
roomName = [TAPUtil nullToEmptyString:roomName];
}
}
else if (room.type == RoomTypeGroup) {
TAPRoomModel *obtainedRoom = [[TAPGroupManager sharedManager] getRoomWithRoomID:room.roomID];
NSString *groupProfileImageURL = obtainedRoom.imageURL.thumbnail;
groupProfileImageURL = [TAPUtil nullToEmptyString:groupProfileImageURL];
NSString *groupRoomName = obtainedRoom.name;
groupRoomName = [TAPUtil nullToEmptyString:groupRoomName];
if ([groupProfileImageURL isEqualToString:@""]) {
profileImageURL = room.imageURL.thumbnail;
profileImageURL = [TAPUtil nullToEmptyString:profileImageURL];
}
else {
profileImageURL = groupProfileImageURL;
profileImageURL = [TAPUtil nullToEmptyString:profileImageURL];
}
if ([groupRoomName isEqualToString:@""]) {
roomName = room.name;
roomName = [TAPUtil nullToEmptyString:roomName];
}
else {
roomName = groupRoomName;
roomName = [TAPUtil nullToEmptyString:roomName];
}
}
NSInteger numberOfUnreadMessage = [unreadMessageCount integerValue];
TAPRoomModel *currentRoom = room;
NSString *roomName = currentRoom.name;
roomName = [TAPUtil nullToEmptyString:roomName];
if (profileImageURL == nil || [profileImageURL isEqualToString:@""]) {
//No photo found, get the initial
self.initialNameView.alpha = 1.0f;
......
......@@ -367,26 +367,47 @@
if (message.room.type == RoomTypeGroup) {
[self showSenderInfo:YES];
if ([message.user.imageURL.thumbnail isEqualToString:@""]) {
NSString *thumbnailImageString = @"";
TAPUserModel *obtainedUser = [[TAPContactManager sharedManager] getUserWithUserID:message.user.userID];
if (obtainedUser != nil && ![obtainedUser.imageURL.thumbnail isEqualToString:@""]) {
thumbnailImageString = obtainedUser.imageURL.thumbnail;
thumbnailImageString = [TAPUtil nullToEmptyString:thumbnailImageString];
}
else {
thumbnailImageString = message.user.imageURL.thumbnail;
thumbnailImageString = [TAPUtil nullToEmptyString:thumbnailImageString];
}
NSString *fullNameString = @"";
if (obtainedUser != nil && ![obtainedUser.fullname isEqualToString:@""]) {
fullNameString = obtainedUser.fullname;
fullNameString = [TAPUtil nullToEmptyString:fullNameString];
}
else {
fullNameString = message.user.fullname;
fullNameString = [TAPUtil nullToEmptyString:fullNameString];
}
if ([thumbnailImageString isEqualToString:@""]) {
//No photo found, get the initial
self.senderInitialView.alpha = 1.0f;
self.senderImageView.alpha = 0.0f;
self.senderInitialView.backgroundColor = [[TAPStyleManager sharedManager] getRandomDefaultAvatarBackgroundColorWithName:message.user.fullname];
self.senderInitialLabel.text = [[TAPStyleManager sharedManager] getInitialsWithName:message.user.fullname isGroup:NO];
self.senderInitialView.backgroundColor = [[TAPStyleManager sharedManager] getRandomDefaultAvatarBackgroundColorWithName:fullNameString];
self.senderInitialLabel.text = [[TAPStyleManager sharedManager] getInitialsWithName:fullNameString isGroup:NO];
}
else {
if(![self.currentProfileImageURLString isEqualToString:message.user.imageURL.thumbnail]) {
if(![self.currentProfileImageURLString isEqualToString:thumbnailImageString]) {
self.senderImageView.image = nil;
}
self.senderInitialView.alpha = 0.0f;
self.senderImageView.alpha = 1.0f;
[self.senderImageView setImageWithURLString:message.user.imageURL.thumbnail];
_currentProfileImageURLString = message.user.imageURL.thumbnail;
[self.senderImageView setImageWithURLString:thumbnailImageString];
_currentProfileImageURLString = thumbnailImageString;
}
self.senderNameLabel.text = message.user.fullname;
self.senderNameLabel.text = fullNameString;
}
else {
[self showSenderInfo:NO];
......@@ -618,7 +639,7 @@
}
- (void)setQuote:(TAPQuoteModel *)quote userID:(NSString *)userID {
if ([quote.fileType isEqualToString:[NSString stringWithFormat:@"%ld", TAPChatMessageTypeFile]]) {
if ([quote.fileType isEqualToString:[NSString stringWithFormat:@"%ld", TAPChatMessageTypeFile]] || [quote.fileType isEqualToString:@"file"]) {
//TYPE FILE
self.fileView.alpha = 1.0f;
self.quoteImageView.alpha = 0.0f;
......@@ -635,7 +656,7 @@
}
//check id message sender is equal to active user id, if yes change the title to "You"
if ([userID isEqualToString:[TAPDataManager getActiveUser].userID] && ![quote.fileType isEqualToString:[NSString stringWithFormat:@"%ld", TAPChatMessageTypeFile]]) {
if ([userID isEqualToString:[TAPDataManager getActiveUser].userID] && !([quote.fileType isEqualToString:[NSString stringWithFormat:@"%ld", TAPChatMessageTypeFile]] || [quote.fileType isEqualToString:@"file"])) {
self.quoteTitleLabel.text = NSLocalizedString(@"You", @"");
}
else {
......
......@@ -111,24 +111,46 @@
self.bubbleLabel.text = NSLocalizedString(@"This message was deleted.", @"");
//CS NOTE - check chat room type, show sender info if group type
if (message.room.type == RoomTypeGroup) {
[self showSenderInfo:YES];
NSString *thumbnailImageString = @"";
TAPUserModel *obtainedUser = [[TAPContactManager sharedManager] getUserWithUserID:message.user.userID];
if (obtainedUser != nil && ![obtainedUser.imageURL.thumbnail isEqualToString:@""]) {
thumbnailImageString = obtainedUser.imageURL.thumbnail;
thumbnailImageString = [TAPUtil nullToEmptyString:thumbnailImageString];
}
else {
thumbnailImageString = message.user.imageURL.thumbnail;
thumbnailImageString = [TAPUtil nullToEmptyString:thumbnailImageString];
}
NSString *fullNameString = @"";
if (obtainedUser != nil && ![obtainedUser.fullname isEqualToString:@""]) {
fullNameString = obtainedUser.fullname;
fullNameString = [TAPUtil nullToEmptyString:fullNameString];
}
else {
fullNameString = message.user.fullname;
fullNameString = [TAPUtil nullToEmptyString:fullNameString];
}
if ([message.user.imageURL.thumbnail isEqualToString:@""]) {
if ([thumbnailImageString isEqualToString:@""]) {
//No photo found, get the initial
self.senderInitialView.alpha = 1.0f;
self.senderImageView.alpha = 0.0f;
self.senderProfileImageButton.alpha = 0.0f;
self.senderInitialView.backgroundColor = [[TAPStyleManager sharedManager] getRandomDefaultAvatarBackgroundColorWithName:message.user.fullname];
self.senderInitialLabel.text = [[TAPStyleManager sharedManager] getInitialsWithName:message.user.fullname isGroup:NO];
self.senderInitialView.backgroundColor = [[TAPStyleManager sharedManager] getRandomDefaultAvatarBackgroundColorWithName:fullNameString];
self.senderInitialLabel.text = [[TAPStyleManager sharedManager] getInitialsWithName:fullNameString isGroup:NO];
}
else {
self.senderInitialView.alpha = 0.0f;
self.senderImageView.alpha = 1.0f;
[self.senderImageView setImageWithURLString:message.user.imageURL.thumbnail];
[self.senderImageView setImageWithURLString:thumbnailImageString];
}
self.senderNameLabel.text = message.user.fullname;
self.senderNameLabel.text = fullNameString;
}
else {
[self showSenderInfo:NO];
......
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