From 722c3a5e787223d0ae3ed0311560e7f0a40a295a Mon Sep 17 00:00:00 2001 From: Matthew Douglass Date: Sun, 16 Oct 2016 18:07:25 -0700 Subject: [PATCH] Create TSOutgoingMessage with info on group change MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit TSOutgoingMessage is created with details about the group changes so that we see more than just “Group Updated.” * Customizes message for new group creation Replaces GROUP_UPDATED with GROUP_CREATED for a brand new group. Localized for English only. * Updates to use fixed SignalServiceKit branch // FREEBIE --- Podfile.lock | 2 +- .../view controllers/MessagesViewController.m | 20 +++++++++++------- .../view controllers/NewGroupViewController.m | 1 + .../translations/en.lproj/Localizable.strings | Bin 57786 -> 57938 bytes 4 files changed, 14 insertions(+), 9 deletions(-) diff --git a/Podfile.lock b/Podfile.lock index 315d5d92e..68dfbe524 100644 --- a/Podfile.lock +++ b/Podfile.lock @@ -134,7 +134,7 @@ EXTERNAL SOURCES: CHECKOUT OPTIONS: SignalServiceKit: - :commit: 91fcd01632a81f2aa67d2d94b97c68d519e6881a + :commit: d4c55d69404c99927da716c443997415ad7bc6ba :git: https://github.com/WhisperSystems/SignalServiceKit.git SocketRocket: :commit: 41b57bb2fc292a814f758441a05243eb38457027 diff --git a/Signal/src/view controllers/MessagesViewController.m b/Signal/src/view controllers/MessagesViewController.m index c0863d86b..8fa4a03f2 100644 --- a/Signal/src/view controllers/MessagesViewController.m +++ b/Signal/src/view controllers/MessagesViewController.m @@ -2027,14 +2027,18 @@ typedef enum : NSUInteger { __block TSOutgoingMessage *message; [self.editingDatabaseConnection readWriteWithBlock:^(YapDatabaseReadWriteTransaction *transaction) { - groupThread = [TSGroupThread getOrCreateThreadWithGroupModel:newGroupModel transaction:transaction]; - groupThread.groupModel = newGroupModel; - [groupThread saveWithTransaction:transaction]; - message = [[TSOutgoingMessage alloc] initWithTimestamp:[NSDate ows_millisecondTimeStamp] - inThread:groupThread - messageBody:@"" - attachmentIds:[NSMutableArray new]]; - message.groupMetaMessage = TSGroupMessageUpdate; + groupThread = [TSGroupThread getOrCreateThreadWithGroupModel:newGroupModel transaction:transaction]; + + NSString *updateGroupInfo = [groupThread.groupModel getInfoStringAboutUpdateTo:newGroupModel contactsManager:self.contactsManager]; + + groupThread.groupModel = newGroupModel; + [groupThread saveWithTransaction:transaction]; + message = [[TSOutgoingMessage alloc] initWithTimestamp:[NSDate ows_millisecondTimeStamp] + inThread:groupThread + messageBody:@"" + attachmentIds:[NSMutableArray new]]; + message.groupMetaMessage = TSGroupMessageUpdate; + message.customMessage = updateGroupInfo; }]; if (newGroupModel.groupImage != nil) { diff --git a/Signal/src/view controllers/NewGroupViewController.m b/Signal/src/view controllers/NewGroupViewController.m index 2c3761961..5cabf5055 100644 --- a/Signal/src/view controllers/NewGroupViewController.m +++ b/Signal/src/view controllers/NewGroupViewController.m @@ -138,6 +138,7 @@ static NSString *const kUnwindToMessagesViewSegue = @"UnwindToMessagesViewSegue" messageBody:@"" attachmentIds:[NSMutableArray new]]; message.groupMetaMessage = TSGroupMessageNew; + message.customMessage = NSLocalizedString(@"GROUP_CREATED", nil); if (model.groupImage != nil) { [[TSMessagesManager sharedManager] sendAttachment:UIImagePNGRepresentation(model.groupImage) contentType:OWSMimeTypeImagePng diff --git a/Signal/translations/en.lproj/Localizable.strings b/Signal/translations/en.lproj/Localizable.strings index e02120f3192a0d79fd875ca9fcc83e7a059b8a34..f8ed70bb9bc8b9f005a97000c318ee68fc0e320a 100644 GIT binary patch delta 30 mcmdmWnEBEX<_-BylNFs+CQsZHH+j7y&t!IIfz72(uJZxWBn*@Q delta 14 Wcmca~gn8Ft<_-Byo7tVc=K}yW2L@sQ