pull/80/head
Niels Andriesse 5 years ago
parent 1d848d7332
commit 9d833e901a

@ -55,9 +55,31 @@ final class NewClosedGroupVC : UIViewController, UITableViewDataSource, UITableV
titleLabel.textColor = Colors.text
titleLabel.font = .boldSystemFont(ofSize: Values.veryLargeFontSize)
navigationItem.titleView = titleLabel
// Set up table view
view.addSubview(tableView)
tableView.pin(to: view)
// Set up content
if !contacts.isEmpty {
view.addSubview(tableView)
tableView.pin(to: view)
} else {
let explanationLabel = UILabel()
explanationLabel.textColor = Colors.text
explanationLabel.font = .systemFont(ofSize: Values.smallFontSize)
explanationLabel.numberOfLines = 0
explanationLabel.lineBreakMode = .byWordWrapping
explanationLabel.textAlignment = .center
explanationLabel.text = NSLocalizedString("You don't have any contacts yet", comment: "")
let createNewPrivateChatButton = Button(style: .prominentOutline, size: .medium)
createNewPrivateChatButton.setTitle(NSLocalizedString("Start a Session", comment: ""), for: UIControl.State.normal)
createNewPrivateChatButton.addTarget(self, action: #selector(createPrivateChat), for: UIControl.Event.touchUpInside)
createNewPrivateChatButton.set(.width, to: 160)
let stackView = UIStackView(arrangedSubviews: [ explanationLabel, createNewPrivateChatButton ])
stackView.axis = .vertical
stackView.spacing = Values.mediumSpacing
stackView.alignment = .center
view.addSubview(stackView)
stackView.center(.horizontal, in: view)
let verticalCenteringConstraint = stackView.center(.vertical, in: view)
verticalCenteringConstraint.constant = -16 // Makes things appear centered visually
}
}
// MARK: Data
@ -118,6 +140,11 @@ final class NewClosedGroupVC : UIViewController, UITableViewDataSource, UITableV
}
}
}
@objc private func createPrivateChat() {
presentingViewController?.dismiss(animated: true, completion: nil)
SignalApp.shared().homeViewController!.createPrivateChat()
}
}
// MARK: - Cell

@ -1006,7 +1006,7 @@
"GROUP_AVATAR_CHANGED" = "Avatar changed. ";
/* No comment provided by engineer. */
"GROUP_CREATED" = "Group created.";
"GROUP_CREATED" = "Group created";
/* Message shown in conversation view that indicates there were issues with group creation. */
"GROUP_CREATION_FAILED" = "Not all members could be added to the group. Tap to retry.";
@ -2790,3 +2790,5 @@
"Dismiss" = "Dismiss";
"New Closed Group" = "New Closed Group";
"Group Members" = "Group Members";
"You don't have any contacts yet" = "You don't have any contacts yet";
"Start a Session" = "Start a Session";

@ -5,6 +5,7 @@
#import "TSGroupModel.h"
#import "FunctionalUtil.h"
#import "NSString+SSK.h"
#import <SignalServiceKit/SignalServiceKit-Swift.h>
NS_ASSUME_NONNULL_BEGIN
@ -103,7 +104,7 @@ const int32_t kGroupIdLength = 16;
if (self == newModel) {
return NSLocalizedString(@"GROUP_UPDATED", @"");
}
if (![_groupName isEqual:newModel.groupName]) {
if (![_groupName isEqual:newModel.groupName] && newModel.groupName.length != 0) {
updatedGroupInfoString = [updatedGroupInfoString
stringByAppendingString:[NSString stringWithFormat:NSLocalizedString(@"GROUP_TITLE_CHANGED", @""),
newModel.groupName]];
@ -139,7 +140,7 @@ const int32_t kGroupIdLength = 16;
if ([membersWhoJoined count] > 0) {
NSArray *newMembersNames = [[membersWhoJoined allObjects] map:^NSString*(NSString* item) {
return [contactsManager displayNameForPhoneIdentifier:item];
return [LKDisplayNameUtilities getPrivateChatDisplayNameFor:item];
}];
updatedGroupInfoString = [updatedGroupInfoString
stringByAppendingString:[NSString stringWithFormat:NSLocalizedString(@"GROUP_MEMBER_JOINED", @""),

Loading…
Cancel
Save