show the detailed info of SSK group update

This commit is contained in:
Ryan ZHAO 2020-09-29 09:51:27 +10:00
parent 5996bd9496
commit d5b0ce8d28
2 changed files with 7 additions and 4 deletions

View file

@ -124,7 +124,8 @@ public final class ClosedGroupsProtocol : NSObject {
let newGroupModel = TSGroupModel(title: name, memberIds: members, image: nil, groupId: groupID, groupType: .closedGroup, adminIds: admins)
thread.setGroupModel(newGroupModel, with: transaction)
// Notify the user
let infoMessage = TSInfoMessage(timestamp: NSDate.ows_millisecondTimeStamp(), in: thread, messageType: .typeGroupUpdate)
let updateInfo = group.getInfoStringAboutUpdate(to: newGroupModel, contactsManager: SSKEnvironment.shared.contactsManager)
let infoMessage = TSInfoMessage(timestamp: NSDate.ows_millisecondTimeStamp(), in: thread, messageType: .typeGroupUpdate, customMessage: updateInfo)
infoMessage.save(with: transaction)
}
@ -206,7 +207,8 @@ public final class ClosedGroupsProtocol : NSObject {
thread.setGroupModel(newGroupModel, with: transaction)
// Notify the user
let infoMessageType: TSInfoMessageType = isUserLeaving ? .typeGroupQuit : .typeGroupUpdate
let infoMessage = TSInfoMessage(timestamp: NSDate.ows_millisecondTimeStamp(), in: thread, messageType: infoMessageType)
let updateInfo = group.getInfoStringAboutUpdate(to: newGroupModel, contactsManager: SSKEnvironment.shared.contactsManager)
let infoMessage = TSInfoMessage(timestamp: NSDate.ows_millisecondTimeStamp(), in: thread, messageType: infoMessageType, customMessage: updateInfo)
infoMessage.save(with: transaction)
// Return
return promise
@ -347,7 +349,8 @@ public final class ClosedGroupsProtocol : NSObject {
// Notify the user if needed (don't notify them if the message just contained linked device sender keys)
if Set(members) != Set(oldMembers) || Set(admins) != Set(group.groupAdminIds) || name != group.groupName {
let infoMessageType: TSInfoMessageType = wasUserRemoved ? .typeGroupQuit : .typeGroupUpdate
let infoMessage = TSInfoMessage(timestamp: NSDate.ows_millisecondTimeStamp(), in: thread, messageType: infoMessageType)
let updateInfo = group.getInfoStringAboutUpdate(to: newGroupModel, contactsManager: SSKEnvironment.shared.contactsManager)
let infoMessage = TSInfoMessage(timestamp: NSDate.ows_millisecondTimeStamp(), in: thread, messageType: infoMessageType, customMessage: updateInfo)
infoMessage.save(with: transaction)
}
}

View file

@ -133,7 +133,7 @@ const int32_t kGroupIdLength = 16;
if ([membersWhoLeft count] > 0) {
NSArray *oldMembersNames = [[membersWhoLeft allObjects] map:^NSString*(NSString* item) {
return [contactsManager displayNameForPhoneIdentifier:item];
return [LKUserDisplayNameUtilities getPrivateChatDisplayNameFor:item];
}];
updatedGroupInfoString = [updatedGroupInfoString
stringByAppendingString:[NSString